GEJM  1.0.0.0
a 2D platformer made by students
SDLWrapper.h
1 #ifndef SDLWRAPPER_H
2 #define SDLWRAPPER_H
3 
4 #include "InitError.h"
5 #include "GameDefs.h"
6 #include <SDL.h>
7 #include <SDL_ttf.h>
8 #include <SDL_image.h>
9 #include <vector>
10 
15 enum MenuTexture
16 {
17  //General purpose textures
18  PauseMenu = 0,
19  LostMenu,
20 
21  //Button textures
22  StartButton,
23  ResumeButton,
24  MenuButton,
25  QuitButton,
26  RetryButton,
27 
28  //Text textures
29  TitleText,
30  SubtitleText,
31  LostText,
32  WinText
33 };
34 
39 enum LevelTexture
40 {
41  PlayerLeft = 0,
42  PlayerRight,
43  PlayerFront,
44  MonsterLeft,
45  MonsterRight
46 };
47 
52 enum Font
53 {
54  Regular = 0,
55  Title,
56  Subtitle,
57  RegularOutline
58 };
59 
64 {
65 public:
69  SDLWrapper();
70 
74  ~SDLWrapper();
75 
79  SDL_Window* window;
80 
84  SDL_Renderer* renderer;
85 
89  std::vector<TTF_Font*> fontVector;
90 
94  std::vector<SDL_Texture*> menuTextureVector;
95 
99  std::vector<SDL_Texture*> levelTextureVector;
100 
109  SDL_Texture* loadTextureFromRenderedText(std::string textureText, SDL_Color textColor, Font font = Font::Regular);
110 
116  SDL_Texture* loadTextureFromFile(std::string path);
117 
122  void loadLevelTextures();
123 
128  void unloadLevelTextures();
129 private:
134  void loadFonts();
135 
140  void unloadFonts();
141 
146  void loadMenuTextures();
147 
152  void unloadMenuTextures();
153 };
154 
155 #endif // SDLWRAPPER_H
std::vector< SDL_Texture * > menuTextureVector
Definition: SDLWrapper.h:94
SDL_Renderer * renderer
Definition: SDLWrapper.h:84
void loadLevelTextures()
Definition: SDLWrapper.cpp:179
std::vector< TTF_Font * > fontVector
Definition: SDLWrapper.h:89
SDL_Texture * loadTextureFromRenderedText(std::string textureText, SDL_Color textColor, Font font=Font::Regular)
Definition: SDLWrapper.cpp:106
Definition: SDLWrapper.h:63
SDL_Window * window
Definition: SDLWrapper.h:79
SDL_Texture * loadTextureFromFile(std::string path)
Definition: SDLWrapper.cpp:143
void unloadLevelTextures()
Definition: SDLWrapper.cpp:222
SDLWrapper()
Definition: SDLWrapper.cpp:13
~SDLWrapper()
Definition: SDLWrapper.cpp:86
std::vector< SDL_Texture * > levelTextureVector
Definition: SDLWrapper.h:99