Level H Engine
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, std::string name)
 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 ()=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...
 
std::string getName ()
 Gets the name of the state. More...
 
void destroyState ()
 A function to destroy all data in a state. More...
 

Protected Attributes

StateManagerstateManager
 A pointer to the state manager. More...
 
SDL_Window * window
 The window to display to. More...
 
std::string name
 The state name. More...
 
bool destroyed
 A boolean for if the state is destroyed. More...
 

Detailed Description

Creates a State object to be inherited.

Constructor & Destructor Documentation

◆ State()

State::State ( StateManager stateManager,
SDL_Window *  window,
std::string  name 
)

Constructs a State object.

Parameters
stateManagerA pointer to the StateManager.
windowA pointer to the window in use.
nameThe name of the state.

◆ ~State()

State::~State ( )
virtual

A virtual destructor for the State object.

Member Function Documentation

◆ destroyState()

void State::destroyState ( )

A function to destroy all data in a state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw()

virtual void State::draw ( )
pure virtual

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

Implemented in CannonGame, Assignment1Demo, Splash, WinLose, Help, FlockingDemo, HeightmapDemo, and MainMenu.

◆ getName()

std::string State::getName ( )

Gets the name of the state.

Returns
The name of the state
Here is the caller graph for this function:

◆ 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 CannonGame, Assignment1Demo, Splash, WinLose, Help, FlockingDemo, HeightmapDemo, and MainMenu.

◆ update()

virtual void State::update ( )
pure virtual

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

Implemented in CannonGame, Assignment1Demo, Splash, WinLose, Help, FlockingDemo, HeightmapDemo, and MainMenu.

Member Data Documentation

◆ destroyed

bool State::destroyed
protected

A boolean for if the state is destroyed.

◆ name

std::string State::name
protected

The state name.

◆ 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: