triangle?

This commit is contained in:
2026-02-10 23:51:27 -06:00
parent 1f22a661cd
commit 0244f463c4
11 changed files with 83 additions and 49 deletions

View File

@@ -1,5 +1,6 @@
#ifdef WINDOW_SDL3
#undef WINDOW_SDL3
#ifndef WINDOW_SDL3_H
#define WINDOW_SDL3_H
#include "pch.hpp"
@@ -7,7 +8,7 @@
#include <SDL3/SDL.h>
#if RENDERER == 1
#ifdef RENDERER_OPENGL
#include <SDL3/SDL_opengl.h>
@@ -76,13 +77,14 @@ namespace Archimedes {
std::abort();
}
#if RENDERER == 1
#ifdef RENDERER_OPENGL
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_WindowFlags window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN;
#elif RENDERER == 2
#endif
#ifdef RENDERER_SDL3
SDL_WindowFlags window_flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
#endif
@@ -94,7 +96,7 @@ namespace Archimedes {
}
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
#if RENDERER == 1
#ifdef RENDERER_OPENGL
gl_context = SDL_GL_CreateContext(window);
if (gl_context == nullptr)
@@ -112,7 +114,7 @@ namespace Archimedes {
}
~WindowSDL3() {
#if RENDERER == 1
#ifdef RENDERER_OPENGL
SDL_GL_DestroyContext(gl_context);
#endif
SDL_RemoveEventWatch(EventCallback, &data);
@@ -123,7 +125,7 @@ namespace Archimedes {
bool shouldClose() override { return false; }
void swapBuffers() override {
#if RENDERER == 1
#ifdef RENDERER_OPENGL
restoreContext();
SDL_GL_SwapWindow(window);
#endif
@@ -136,8 +138,8 @@ namespace Archimedes {
WindowSDL3* getWindowImpl() override { return this; };
#if RENDERER == 1
void restoreContext() { SDL_GL_MakeCurrent(window, gl_context); }
#ifdef RENDERER_OPENGL
void restoreContext() override { SDL_GL_MakeCurrent(window, gl_context); }
#endif
void getSize(int& w, int& h) override {
w = this->w;
@@ -150,14 +152,14 @@ namespace Archimedes {
}
SDL_Window* getWindow() { return window; }
#if RENDERER == 1
#ifdef RENDERER_OPENGL
SDL_GLContext getContext() { return gl_context; }
#endif
WindowData data;
private:
SDL_Window* window;
#if RENDERER == 1
#ifdef RENDERER_OPENGL
SDL_GLContext gl_context;
#endif
@@ -165,3 +167,4 @@ namespace Archimedes {
}
#endif
#endif