-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.h
76 lines (54 loc) · 1.45 KB
/
graphics.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
68
69
70
71
72
73
74
75
76
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#include "definitions.h"
#include <string>
#include <SDL.h>
#include <SDL_image.h>
#include "gamelogic.h"
#include <SDL_ttf.h>
#include <map>
class Graphics
{
public:
//constructor and destructor
Graphics();
~Graphics();
//Screen dimension constants
//Starts up SDL and creates window
bool init();
//Loads media
bool loadMedia();
//draws main
bool drawMain();
//draws options
bool drawOptions();
//draw game
bool drawGame(GameLogic &gamelogic);
//draw game over screen
bool drawGameOver(GameLogic &gamelogic);
//draws a screen, how to play
bool drawHelp();
//renders text
bool drawText(std::string text, int x,int y,SDL_Color color,int size);
//draws an empty rect
bool drawRect( int x,int y,int w, int h, int linewidth, SDL_Color color);
//Frees media and shuts down SDL
void close();
private:
//The window we'll be rendering to
SDL_Window* gWindow;
//The surface contained by the window
SDL_Surface* gScreenSurface;
//The image we will load and show on the screen
SDL_Texture *gBackgroundImage;
SDL_Texture *gPieceWhiteImage;
SDL_Texture *gPieceBlackImage;
SDL_Texture *gHoleImage;
SDL_Texture *gHelpImage;
SDL_Renderer *gRenderer;
//Globally used fonts
std::map<int,TTF_Font*> gFonts;
SDL_Texture* mTexture;
SDL_Texture* textBgTexture;
};
#endif