work on renderer
This commit is contained in:
@@ -15,8 +15,6 @@ ImguiModule::~ImguiModule() {
|
||||
if(app) {
|
||||
WindowModule* wm; { wm = (WindowModule*) moduleInstances[WindowModule()]; }
|
||||
|
||||
wm->getRenderer()->getCmdList().erase(rcmd_it);
|
||||
|
||||
#if WINDOW == 2
|
||||
wm->removeEventFn(ecmd_it);
|
||||
#endif
|
||||
@@ -80,21 +78,6 @@ void ImguiModule::onLoad() {
|
||||
std::cout << "rendererInit failed!\n" << std::endl;
|
||||
}
|
||||
|
||||
wm->getRenderer()->getCmdList().push_back([this](){
|
||||
ImGui::Render();
|
||||
|
||||
rendererRenderDrawData();
|
||||
|
||||
if(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
||||
window->getWindowImpl().restoreContext();
|
||||
}
|
||||
});
|
||||
|
||||
rcmd_it = --wm->getRenderer()->getCmdList().end()++;
|
||||
|
||||
#if WINDOW == 2
|
||||
ecmd_it = wm->addEventFn([](Archimedes::Event* e){
|
||||
if(e->userData.type() == typeid(SDL_Event*)) {
|
||||
@@ -113,6 +96,17 @@ void ImguiModule::run() {
|
||||
rendererNewFrame();
|
||||
windowNewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
rendererRenderDrawData();
|
||||
|
||||
if(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
|
||||
window->getWindowImpl().restoreContext();
|
||||
}
|
||||
};
|
||||
|
||||
bool ImguiModule::onEvent(const Archimedes::Event &e) {
|
||||
|
||||
@@ -84,19 +84,22 @@ class ImguiModule : public Archimedes::Module {
|
||||
void rendererRenderDrawData() { ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData(), renderer); }
|
||||
#endif
|
||||
|
||||
#if WINDOW == 1
|
||||
#if RENDERER == 1
|
||||
auto windowInit() { return ImGui_ImplGlfw_InitForOpenGL(window->getWindowImpl().getWindow(), true); }
|
||||
#ifdef WINDOW_GLFW
|
||||
#ifdef RENDERER_OPENGL
|
||||
auto windowInit() { return ImGui_ImplGlfw_InitForOpenGL(window->getWindowImpl()->getWindow(), true); }
|
||||
#endif
|
||||
|
||||
void windowShutdown() { ImGui_ImplGlfw_Shutdown(); }
|
||||
|
||||
void windowNewFrame() { ImGui_ImplGlfw_NewFrame(); }
|
||||
|
||||
#elif WINDOW == 2
|
||||
#if RENDERER == 1
|
||||
#endif
|
||||
|
||||
#ifdef WINDOW_SDL3
|
||||
#ifdef RENDERER_OPENGL
|
||||
auto windowInit() { return ImGui_ImplSDL3_InitForOpenGL(window->getWindowImpl().getWindow(), window->getWindowImpl().getContext()); }
|
||||
#elif RENDERER == 2
|
||||
#endif
|
||||
#ifdef RENDERER_SDL3
|
||||
auto windowInit() { return ImGui_ImplSDL3_InitForSDLRenderer(window->getWindowImpl().getWindow(), renderer); }
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user