SDL Breakout Engine  0.1.0
An implementation of a Breakout game using sdl, implemented with efficient resource management.
SDLGraphicsProgram.hpp
Go to the documentation of this file.
1 #ifndef SDLGRAPHICSPROGRAM_HPP
2 #define SDLGRAPHICSPROGRAM_HPP
3 
4 // ==================== Libraries ==================
5 // Depending on the operating system we use
6 // The paths to SDL are actually different.
7 // The #define statement should be passed in
8 // when compiling using the -D argument.
9 // This gives an example of how a programmer
10 // may support multiple platforms with different
11 // dependencies.
12 //
13 // Note that your path may be different depending on where you intalled things
14 //
15 //
16 #include <SDL2/SDL.h>
17 #include <SDL2/SDL_ttf.h>
18 #include <GameObject.hpp>
19 #include <LevelManager.hpp>
20 #include <BasicText.hpp>
21 #include "LocalizationManager.hpp"
22 
27 {
28 public:
29  SDLGraphicsProgram(int w , int h , std::string level , Language l);
31  void update(int lastFPS , float dt , Vector3D speed );
32  void render();
33  void loop();
34  SDL_Window *getSDLWindow();
35  SDL_Renderer *getSDLRenderer();
36 private:
37  int screenHeight;
38  int screenWidth;
39  std::vector<Brick> board = {};
40  std::map<BlockColor, std::string> colorMapping = {
41  {BlockColor::BLUE, "blue_rect"},
42  {BlockColor::GREEN, "green_rect"},
43  {BlockColor::GREY, "grey_rect"},
44  {BlockColor::PURPLE, "purple_rect"},
45  {BlockColor::RED, "red_rect"},
46  {BlockColor::YELLOW, "yellow_rect"},
47  };
48  std::map<std::string, std::shared_ptr<BasicText>> textObjects;
49  std::unique_ptr<Translator> gTranslator;
50  MovingGUIElement gPaddle;
51  Ball gBall;
52  // The window we'll be rendering to
53  SDL_Window *gWindow;
54  // SDL Renderer
55  SDL_Renderer *gRenderer = NULL;
56 };
57 
58 #endif
Definition: GameObject.hpp:222
Definition: GameObject.hpp:290
Yellow tile.
Definition: LevelManager.hpp:24
Grey tile.
Definition: LevelManager.hpp:21
Purple tile.
Definition: LevelManager.hpp:22
Green tile.
Definition: LevelManager.hpp:20
Blue tile.
Definition: LevelManager.hpp:19
SDL_Renderer * getSDLRenderer()
Get Pointer to Renderer.
Definition: SDLGraphicsProgram.cpp:416
SDL_Window * getSDLWindow()
Get Pointer to Window.
Definition: SDLGraphicsProgram.cpp:410
void loop()
game loop
Definition: SDLGraphicsProgram.cpp:276
void render()
Renders shapes to the screen.
Definition: SDLGraphicsProgram.cpp:232
Definition: TinyMath.hpp:15
void update(int lastFPS, float dt, Vector3D speed)
per frame updating
Definition: SDLGraphicsProgram.cpp:208
Language
Definition: LocalizationManager.hpp:20
Red tile.
Definition: LevelManager.hpp:23
Definition: LevelManager.hpp:30
SDLGraphicsProgram(int w, int h, std::string level, Language l)
creates the program with a certain width/height.
Definition: SDLGraphicsProgram.cpp:32
Definition: SDLGraphicsProgram.hpp:26
~SDLGraphicsProgram()
cleans up sdl program
Definition: SDLGraphicsProgram.cpp:190