Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __Game__
- #define __Game__
- #include<SDL2/SDL.h>
- #include<SDL2/SDL_image.h>
- #include <iostream>
- #include <string>
- #include <map>
- #include <vector>
- #include "Enemy.h"
- #include "Game.h"
- #include "GameObject.h"
- #include "InputHandler.h"
- #include "Player.h"
- #include "TextureManager.h"
- #include "Vector2d.h"
- class Game
- {
- public:
- Game(){}
- ~Game(){}
- // simply set the running variable to true
- bool init(const char* title, int xpos, int ypos, int width,
- int height, int flags);
- void draw(SDL_Renderer*);
- void render();
- void update();
- void handleEvents();
- void clean();
- void quit();
- // a function to access the private running variable
- bool running() { return m_bRunning; }
- SDL_Renderer* getRenderer() const { return m_pRenderer; }
- static Game* Instance()
- {
- if (s_pInstance == 0)
- {
- s_pInstance = new Game();
- return s_pInstance;
- }
- return s_pInstance;
- }
- static Game *s_pInstance;
- private:
- SDL_Window* m_pWindow = 0;
- SDL_Renderer* m_pRenderer = 0;
- SDL_Surface* pTempSurface = 0;
- SDL_Texture* m_pTexture = 0;
- SDL_Rect m_sourceRectangle;
- SDL_Rect m_destinationRectangle;
- bool m_bRunning;
- int m_currentFrame;
- GameObject *m_go;
- GameObject *mplayer;
- std::vector<GameObject*> m_gameObjects;
- };
- typedef Game TheGame;
- #endif /*defined(__Game__) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement