-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphics.h
52 lines (37 loc) · 986 Bytes
/
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
#ifndef _GRAPHICS_H
#define _GRAPHICS_H
#include <SDL.h>
#undef main
#include <SDL_image.h>
#include <stdio.h>
#include <string>
#include <SDL_ttf.h>
using namespace std;
class Graphics
{
public:
static const int SCREEN_WIDTH = 1024;
static const int SCREEN_HEIGHT = 896;
const char* WINDOW_TITLE = "Galaga";
private:
static Graphics* sInstance;
static bool sInitialized;
SDL_Window* mWindow;
SDL_Surface* mBackBuffer;
SDL_Renderer* mRenderer;
public:
static Graphics* Instance();
static void Release();
static bool Initialized();
SDL_Texture* LoadTexture(string path);
SDL_Texture* CreateTextTexture(TTF_Font* font, string text, SDL_Color color);
void ClearBackBuffer();
void DrawTexture(SDL_Texture* tex, SDL_Rect* clip = NULL, SDL_Rect* rend = NULL, float angle = 0.0f, SDL_RendererFlip flip = SDL_FLIP_NONE);
void DrawLine(float startX, float startY, float endX, float endY);
void Render();
private:
Graphics();
~Graphics();
bool Init();
};
#endif