Coding the factory to use all our new classes
The Factory
is an important class. It will be where we create all our smart pointers to derived Update
and Graphics
instances. We will call all the constructors and assemble
function implementations while sharing the various required pointers that we have been coding. For example, the Factory
is where we will share the pointer to the player and the position of the platforms with the LevelUpdate
instance.
Remembering the texture coordinates
First of all, we will add code to the Factory.h
file. In the Factory.h
file, add the following variables to the private
section:
const int PLAYER_TEX_LEFT = 0;
const int PLAYER_TEX_TOP = 0;
const int PLAYER_TEX_WIDTH = 80;
const int PLAYER_TEX_HEIGHT = 96;
const float CAM_VIEW_WIDTH = 300.f;
const float CAM_SCREEN_RATIO_LEFT = 0.f;
const float CAM_SCREEN_RATIO_TOP = 0.f;
const float CAM_SCREEN_RATIO_WIDTH = 1.f;
const float CAM_SCREEN_RATIO_HEIGHT = 1.f;
const int CAM_TEX_LEFT...