GCP Assignment 1
Public Member Functions | Protected Attributes | List of all members
State Class Referenceabstract

Creates a State object to be inherited. More...

#include <State.h>

Inheritance diagram for State:
Inheritance graph
Collaboration diagram for State:
Collaboration graph

Public Member Functions

 State (StateManager *stateManager, SDL_Window *window, int screenWidth, int screenHeight)
 Constructs a State object. More...
 
virtual ~State ()
 A virtual destructor for the State object. More...
 
virtual bool input ()=0
 A pure virtual function to handle the user input for use with the State. More...
 
virtual void update (float dt)=0
 A pure virtual function to update the State to allow the State to run. More...
 
virtual void draw ()=0
 A pure virtual function to draw to the screen using the window. More...
 
SDL_Window * getWindow ()
 Gets the window. More...
 

Protected Attributes

StateManagerstateManager
 A pointer to the state manager. More...
 
SDL_Window * window
 The window to display to. More...
 
int screenWidth
 The width of the screen. More...
 
int screenHeight
 The height of the screen. More...
 

Detailed Description

Creates a State object to be inherited.

Constructor & Destructor Documentation

◆ State()

State::State ( StateManager stateManager,
SDL_Window *  window,
int  screenWidth,
int  screenHeight 
)

Constructs a State object.

Parameters
stateManagerA pointer to the StateManager.
windowA pointer to the window in use.
screenWidthThe screen width.
screenHeightThe screen height.

◆ ~State()

State::~State ( )
virtual

A virtual destructor for the State object.

Member Function Documentation

◆ draw()

virtual void State::draw ( )
pure virtual

A pure virtual function to draw to the screen using the window.

Implemented in MainState.

◆ getWindow()

SDL_Window * State::getWindow ( )

Gets the window.

Returns
A pointer to the window

◆ input()

virtual bool State::input ( )
pure virtual

A pure virtual function to handle the user input for use with the State.

Returns
If false then quit State.

Implemented in MainState.

◆ update()

virtual void State::update ( float  dt)
pure virtual

A pure virtual function to update the State to allow the State to run.

Parameters
dtThe delta time.

Implemented in MainState.

Member Data Documentation

◆ screenHeight

int State::screenHeight
protected

The height of the screen.

◆ screenWidth

int State::screenWidth
protected

The width of the screen.

◆ stateManager

StateManager* State::stateManager
protected

A pointer to the state manager.

◆ window

SDL_Window* State::window
protected

The window to display to.


The documentation for this class was generated from the following files: