This commit is contained in:
2025-09-20 17:57:56 -05:00
parent a896b772fb
commit 90c3b6149e
16 changed files with 469 additions and 74 deletions

View File

@@ -8,11 +8,12 @@
using namespace Dawn;
Display::Display(void) :
Display::Display(Engine &engine) :
#if DAWN_SDL2
glContext(nullptr),
window(nullptr)
window(nullptr),
#endif
engine(engine)
{
#if DAWN_SDL2
uint32_t flags = SDL_INIT_VIDEO;
@@ -72,14 +73,14 @@ void Display::update(void) {
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT: {
Engine::getInstance()->console.exec("exit");
engine.console.exec("exit");
break;
}
case SDL_WINDOWEVENT: {
switch(event.window.event) {
case SDL_WINDOWEVENT_CLOSE: {
Engine::getInstance()->console.exec("exit");
engine.console.exec("exit");
break;
}

View File

@@ -7,8 +7,11 @@
#include "dawn.hpp"
namespace Dawn {
struct Engine;
struct Display {
private:
Engine &engine;
#if DAWN_SDL2
SDL_Window* window;
SDL_GLContext glContext;
@@ -20,8 +23,10 @@ namespace Dawn {
/**
* Display constructor
*
* @param engine The engine instance.
*/
Display(void);
Display(Engine &engine);
/**
* Update the display (swap buffers, etc.)