-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window.h
54 lines (34 loc) · 846 Bytes
/
Window.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
#ifndef _WINDOW_H_
#define _WINDOW_H_
#include <SDL2/SDL.h>
#include <math.h>
#include "utils.h"
struct Point
{
float x;
float y;
Point():x(0.0), y(0.0){}
Point(float x, float y):x(x), y(y){}
};
class Window
{
private:
SDL_Texture* texture;
SDL_Window* window;
SDL_Renderer* renderer;
int w;
int h;
public:
SDL_Surface* canvas;
Window(int w, int h);
~Window();
int GetW(){return w;}
int GetH(){return h;}
bool ResizeCanvas(int w, int h);
void FillCanvas(Uint8 r, Uint8 g, Uint8 b);
bool DrawPixel(int x, int y, Uint8 r, Uint8 g, Uint8 b);
bool DrawPixel(int x, int y, Uint8 r, Uint8 g, Uint8 b, SDL_Surface* canvas);
void DrawLine(float x1, float y1, float x2, float y2, uint thickness, Uint8 r, Uint8 g, Uint8 b);
void RefreshCanvas();
};
#endif