forked from a544jh/panel-pop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSDLContext.h
67 lines (55 loc) · 1.49 KB
/
SDLContext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* SDLContext.h
*
* Created on: Aug 15, 2015
* Author: axel
*/
#ifndef SDLCONTEXT_H_
#define SDLCONTEXT_H_
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#include <string>
class SDLContext {
public:
static const int WINDOW_WIDTH = 640, WINDOW_HEIGHT = 480;
static SDLContext& getInstance();
bool init();
void tearDown();
SDL_Renderer* getRenderer();
SDL_Texture* getSpriteSheet();
void renderTextureToWindow(SDL_Texture*);
void toggleFullscreen();
bool isFullscreen();
SDL_Texture* makeTextureFromImage(std::string);
SDL_Texture* makeTextureFromFont(std::string, SDL_Color, TTF_Font*);
void renderText(std::string, SDL_Color, TTF_Font*, int, int);
TTF_Font* _fontPs;
TTF_Font* _fontSquare;
Mix_Music* _musicBgIntro;
Mix_Music* _musicBgLoop;
Mix_Music* _musicPanic;
Mix_Chunk* _sfxPop[40];
Mix_Chunk* _sfxCursor;
Mix_Chunk* _sfxSwap;
Mix_Chunk* _sfxThump;
Mix_Chunk* _sfxBigThump;
Mix_Chunk* _sfxCombo;
Mix_Chunk* _sfxChain;
Mix_Chunk* _sfxFanfare1;
Mix_Chunk* _sfxFanfare2;
Mix_Chunk* _sfxFanfare3;
Mix_Chunk* _sfxCountdown;
Mix_Chunk* _sfxGo;
Mix_Chunk* _sfxPause;
private:
SDLContext();
SDLContext(SDLContext const&) = delete;
void operator=(SDLContext const&) = delete;
SDL_Window* _window;
SDL_Renderer* _renderer;
SDL_Texture* _spriteSheet;
bool loadSpriteSheet();
bool loadFonts();
bool loadAudio();
};
#endif /* SDLCONTEXT_H_ */