triangle?
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#ifdef WINDOW_GLFW
|
||||
#undef WINDOW_GLFW
|
||||
#ifndef WINDOW_GLFW_H
|
||||
#define WINDOW_GLFW_H
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
@@ -33,7 +34,7 @@ namespace Archimedes {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
//glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, 1);
|
||||
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, 1);
|
||||
#endif
|
||||
|
||||
window = glfwCreateWindow(640, 480, "Archimedes", NULL, NULL);
|
||||
@@ -115,7 +116,7 @@ namespace Archimedes {
|
||||
return glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
void restoreContext() { glfwMakeContextCurrent(window); }
|
||||
void restoreContext() override { glfwMakeContextCurrent(window); }
|
||||
|
||||
void getSize(int& w, int& h) override {
|
||||
glfwGetFramebufferSize(window, &w, &h);
|
||||
@@ -135,3 +136,4 @@ namespace Archimedes {
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user