mirror of
https://github.com/PoetryInCode/simple-rigid-sim.git
synced 2026-08-13 11:24:39 -04:00
added window class, may implement in future
This commit is contained in:
parent
540d4d3448
commit
0b3e1c4be0
30
src/Window.cpp
Normal file
30
src/Window.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "Window.h"
|
||||||
|
|
||||||
|
int Window::setClearColor(Color c) {
|
||||||
|
clearColor = &c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Window::setClearColor(uint8_t r,Uint8 g,Uint8 b,Uint8 a) {
|
||||||
|
clearColor[0].r = r;
|
||||||
|
clearColor[0].g = g;
|
||||||
|
clearColor[0].b = b;
|
||||||
|
clearColor[0].a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Window::initUI() {
|
||||||
|
if(SDL_Init(SDL_INIT_EVERYTHING) != 0) {
|
||||||
|
fprintf(stderr,"\033[92m[ ERROR ] Could not initialize SDL:\n%s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
win = SDL_CreateWindow("Simple Rigid Sim",
|
||||||
|
SDL_WINDOWPOS_CENTERED,
|
||||||
|
SDL_WINDOWPOS_CENTERED,
|
||||||
|
500,
|
||||||
|
500,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
rend = SDL_CreateRenderer(win,
|
||||||
|
-1,
|
||||||
|
SDL_RENDERER_ACCELERATED
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
14
src/Window.h
Normal file
14
src/Window.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#include <SDL2/SDL_timer.h>
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
|
class Window {
|
||||||
|
public:
|
||||||
|
Color *clearColor = new Color(BLACK);
|
||||||
|
SDL_Window *win;
|
||||||
|
SDL_Renderer *rend;
|
||||||
|
virtual int update() {};
|
||||||
|
int initUI() {};
|
||||||
|
int setClearColor(Color c) {};
|
||||||
|
int setClearColor(Uint8 r,Uint8 g,Uint8 b,Uint8 a) {};
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user