RendererSDL3 functional
This commit is contained in:
@@ -182,7 +182,6 @@
|
|||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
sdl3
|
sdl3
|
||||||
glew
|
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@@ -191,15 +190,15 @@
|
|||||||
modules/ImguiModule/src/*.cpp \
|
modules/ImguiModule/src/*.cpp \
|
||||||
modules/WindowModule/src/*.cpp \
|
modules/WindowModule/src/*.cpp \
|
||||||
$imgui/backends/imgui_impl_sdl3.cpp \
|
$imgui/backends/imgui_impl_sdl3.cpp \
|
||||||
$imgui/backends/imgui_impl_opengl3.cpp \
|
$imgui/backends/imgui_impl_sdlrenderer3.cpp \
|
||||||
$imgui/misc/cpp/*.cpp \
|
$imgui/misc/cpp/*.cpp \
|
||||||
$imgui/*.cpp \
|
$imgui/*.cpp \
|
||||||
-DRENDERER=1 \
|
-DRENDERER=2 \
|
||||||
-DWINDOW=2 \
|
-DWINDOW=2 \
|
||||||
-DMAINGUI_DYNAMIC \
|
-DMAINGUI_DYNAMIC \
|
||||||
-fpic -shared \
|
-fpic -shared \
|
||||||
-I src -I include -I $imgui -I . \
|
-I src -I include -I $imgui -I . \
|
||||||
-lGL -lSDL3 -lGLEW \
|
-lSDL3 \
|
||||||
-Wall \
|
-Wall \
|
||||||
-o $name
|
-o $name
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -58,15 +58,6 @@ namespace Archimedes {
|
|||||||
|
|
||||||
SDL_GL_MakeCurrent(w, gl_context);
|
SDL_GL_MakeCurrent(w, gl_context);
|
||||||
SDL_GL_SetSwapInterval(1); // Enable vsync
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
#elif RENDERER == 2
|
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr);
|
|
||||||
SDL_SetRenderVSync(renderer, 1);
|
|
||||||
if (renderer == nullptr)
|
|
||||||
{
|
|
||||||
std::cerr << "Error: SDL_CreateRenderer(): " << SDL_GetError() << std::endl;
|
|
||||||
std::abort();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
/*SDL_AddEventWatch([](void* ptr, SDL_Event* e) -> bool {
|
/*SDL_AddEventWatch([](void* ptr, SDL_Event* e) -> bool {
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void ImguiModule::onLoad() {
|
|||||||
window = wm->aquireWindow();
|
window = wm->aquireWindow();
|
||||||
|
|
||||||
#if RENDERER == 2
|
#if RENDERER == 2
|
||||||
renderer = window->getRenderer().renderer;
|
renderer = window->getRenderer()->getRendererImpl().renderer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "utils/Renderer/Renderer.h"
|
#include "utils/Renderer/Renderer.h"
|
||||||
#include "utils/Window/Window.h"
|
#include "utils/Window/Window.h"
|
||||||
|
|
||||||
|
static_assert(!(WINDOW == 1 && RENDERER == 2), "Window and Renderer are incompatible!\n");
|
||||||
|
|
||||||
class WindowModule : public Archimedes::Module {
|
class WindowModule : public Archimedes::Module {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -44,7 +46,9 @@ class WindowModule : public Archimedes::Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
windowRefs++;
|
windowRefs++;
|
||||||
|
#if RENDERER == 1
|
||||||
window->getWindowImpl().restoreContext();
|
window->getWindowImpl().restoreContext();
|
||||||
|
#endif
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
void MinimalApp::run() {
|
void MinimalApp::run() {
|
||||||
|
|
||||||
for(std::string m : runOrder) {
|
for(std::string m : runOrder) {
|
||||||
std::cout << "load" << m << std::endl;
|
|
||||||
modules[m]->onLoad();
|
modules[m]->onLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user