-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCore.h
85 lines (56 loc) · 1.52 KB
/
Core.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
77
78
79
80
81
82
83
84
85
#pragma once
#include <string>
#include <vector>
using namespace std;
#include "SDL.h"
#include "Math.h"
#include "Log.h"
class Core
{
public:
//initilizes SDL, creates window, renderer, and pixel array
void Init(int w, int h, string title);
//closes SDL and frees memory
void Quit();
SDL_Window *GetWindow();
SDL_Renderer *GetRenderer();
//singleton getter
static Core *GetInstance();
//puts a single pixel at a passed X,Y
void PutPixel(int x, int y, Uint32 color);
//gets the pixel color of a passed X,Y screen coordinate
Uint32 GetPixel(int x, int y);
//gets screen information
int GetWidth();
int GetHeight();
int GetTotalPixels();
//clears screen buffers
void ClearScreen();
//swaps screen buffers
void PresentScreen();
//draws a line of a specified color in between passed X,Y points
void DrawLine(int x1, int y1, int x2, int y2, Uint32 color);
//draws a line of a specified color in between 2 points
void DrawLine(Point p1, Point p2, Uint32 color);
//flood fill specified color
void Fill(int x, int y, Uint32 newColor);
private:
//singleton
static Core *instance;
//SDL data structures
SDL_Window *theWindow;
SDL_Renderer *theRenderer;
SDL_Surface *windowSurface;
//streamed texture that has pixel array below imposed on it
SDL_Texture *rasterTexture;
//all the pixels on the screen for rendering
//modified by set pixel
Uint32 *PixelArray;
//screen information
int ScreenWidth;
int ScreenHeight;
int ScreenPixels;
protected:
//default constructor for singleton
Core();
};