displayManager.h 941 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef DISPLAYMANAGER_H
  2. #define DISPLAYMANAGER_H
  3. #include "SDL.h"
  4. #include "buffer.h"
  5. #include "texture.h"
  6. class DisplayManager{
  7. public:
  8. const static int SCREEN_WIDTH = 640; //640
  9. const static int SCREEN_HEIGHT = 480; //480
  10. //Dummy Constructor / Destructor
  11. DisplayManager();
  12. ~DisplayManager();
  13. //Initializes SDL context and creates window according to values above
  14. bool startUp();
  15. void shutDown();
  16. //Clear screens to black
  17. void clear();
  18. //Swaps the pixel buffer with the texture buffer and draws to screen
  19. void draw(Buffer<Uint32> *pixelBuffer);
  20. private:
  21. bool startSDL();
  22. bool createWindow();
  23. bool createSDLRenderer();
  24. bool createScreenTexture();
  25. Texture screenTexture;
  26. SDL_Surface *surface;
  27. SDL_Renderer *SDLRenderer;
  28. SDL_Window *mainWindow;
  29. };
  30. #endif