Screen class
The Screen
class defines the interface required for a Robot Devastation in-game screen. Inheriting from this class allows the creation of different game screens. Currently, all implementations of game screens use SDL as graphics backend.
The main methods of a Screen
are:
init()
: this method should be called before theScreen
is set as current screen in theScreenManager
. It performs the resource loading and initialization.cleanup()
: this method should be called to free all the resources reserved or loaded by theScreen
before finishing the program.drawScreen()
: performs all the required graphic operations to draw the screen graphical elements. A screen canvas is passed as argument to this method, whose type depends on the graphics backend being used.update()
: updates theScreen
contents after some displayed parameter has changed. Currently, several signatures are used as they are required by the correspondingScreen
. An alternative implementation could use void * or templates to simplify the API, leaving a singleupdate()
method.
Mock Screen class
Simple Screen for testing that shows a funny image with a custom message. This message can be configured through the update()
method.
Init Screen class
Screen
to be shown when the Robot Devastation game is started (InitState). It is just a splash screen showing the Robot Devastation logo.
Game Screen class
This Screen
is the main game screen. Shows the video stream of the robot's point of view. On top of it, the game HUD, including health, ammo and other players' info is drawn.
Dead Screen class
This `Screen is shown when the player dies. It shows the time the player has to wait until he is respawned.