GCP Assignment 1
State.h
Go to the documentation of this file.
1 //DISCLAMER - This is a modified version of code from one of my other assignments.
2 
3 #pragma once
4 
5 #include <SDL.h>
6 #include <iostream>
7 #include <string.h>
8 
10 class StateManager;
11 
15 class State
16 {
17 public:
26 
30  virtual ~State();
31 
36  virtual bool input() = 0;
37 
42  virtual void update(float dt) = 0;
43 
47  virtual void draw() = 0;
48 
53  SDL_Window* getWindow();
54 
55 protected:
59  SDL_Window* window;
64 };
Creates a State object to be inherited.
Definition: State.h:15
State(StateManager *stateManager, SDL_Window *window, int screenWidth, int screenHeight)
Constructs a State object.
Definition: State.cpp:5
Creates a StateManager object.
Definition: StateManager.h:13
StateManager * stateManager
A pointer to the state manager.
Definition: State.h:57
virtual bool input()=0
A pure virtual function to handle the user input for use with the State.
SDL_Window * window
The window to display to.
Definition: State.h:59
SDL_Window * getWindow()
Gets the window.
Definition: State.cpp:21
virtual ~State()
A virtual destructor for the State object.
Definition: State.cpp:17
int screenHeight
The height of the screen.
Definition: State.h:63
int screenWidth
The width of the screen.
Definition: State.h:61
virtual void draw()=0
A pure virtual function to draw to the screen using the window.
virtual void update(float dt)=0
A pure virtual function to update the State to allow the State to run.