Chapter 3. Graphics – Common Methods

This chapter will cover the following recipes:

  • Creating a window in libSDL
  • Creating surfaces
  • Surfaces manipulation
  • Using colors
  • Cursor manipulation
  • Initializing the graphics mode with OpenGL
  • Getting OpenGL information
  • Using OpenGL extensions with GLEW and Lua
  • Loading images with SDL_image
  • Creating textures
  • Loading and using bitmap fonts
  • Loading and using TrueType fonts
  • Displaying the text
  • Creating texture atlas with the rover-design pattern
  • Using tiles and tilesets in the game

Introduction

This chapter covers the basic principles of using the graphical interface in conjunction of LuaSDL with OpenGL. It covers basic operations on surface objects, using color models, cursor manipulation, image loading, and using textures and fonts. It also contains a few examples of game engine optimizations such as texture atlas and tilesets.

These recipes can be enhanced with the information from subsequent chapters to get better efficiency on resource handling.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.137.58