Programming – Week 4

This week we have worked together in class on creating a blueprint for a ”simple” game engine. We are going to use this engine to create a copy of Arkanoid. The engine includes a DrawManager, InputManager and a StateManager so far.

DrawManager creates a window and a renderer. It has a functions that clears the screen with a single color and a functions that presents what we have drawn onto the screen.

InputManager contains a Mouse and Keyboard pointer. The values of inside the pointers is set from SDL_Event ‘s. The events are controlled and checked inside a function in Engine called HandleEvents.

StateManager handles different states. A state can be for an example GameState which handles logic and drawing for when the game is running. We could also have a MenuState which has its own logic and drawing. By using polymorphism we can create different logic and drawing in each state.
All states will inherit from the base class State. The State class contains pure virtual functions which means that we have to override them when inheriting from the State class.


Lämna en kommentar