The UISprite class is pretty simple. It has only two functions: a constructor and a rendering function. Like with every other CPP file in our project, the first thing we must do is include the game.hpp file:
#include "game.hpp"
The UISprite class is pretty simple. It has only two functions: a constructor and a rendering function. Like with every other CPP file in our project, the first thing we must do is include the game.hpp file:
#include "game.hpp"
The constructor is very familiar. It sets the m_dest rectangle's x and y values to the values that were passed into the constructor. It loads the texture from the virtual filesystem using the file_name variable that we passed in as a parameter. Finally, it centers the m_dest rectangle using the width and height values that were retrieved using the SDL_QueryTexture function. Here is the code for the constructor:
UISprite::UISprite( int x, int y, char...