the gui problem^TM

This commit is contained in:
2025-03-21 16:16:25 -05:00
parent 7900def444
commit 6b8861a7fb
15 changed files with 316 additions and 206 deletions

View File

@@ -1,5 +1,49 @@
#include "TestImgui.h"
void TestImgui::load() {}
#include "imgui/imgui.h"
#include "imgui/backends/imgui_impl_glfw.h"
#include "imgui/backends/imgui_impl_opengl3.h"
void TestImgui::run() {}
#include <GLFW/glfw3.h>
TestImgui::TestImgui(void* h, Archimedes::App& a) : Archimedes::GuiModule(h, a) {
name = "TestImgui";
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsLight();
// Setup Platform/Renderer backends
ImGui_ImplGlfw_InitForOpenGL(getWindow()->getWindowImpl().getWindow(), true);
ImGui_ImplOpenGL3_Init("#version 130");
}
TestImgui::~TestImgui() {
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void TestImgui::onLoad() {}
void TestImgui::run() {
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::ShowDemoWindow(&this->demo);
ImGui::Render();
getWindow()->getRenderer().addRenderCmd([](){
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
});
}

View File

@@ -1,38 +1,24 @@
#include "Archimedes.h"
#include <imgui.h>
#include <backends/imgui_impl_glfw.h>
#include <backends/imgui_impl_opengl3.h>
#include <GLFW/glfw3.h>
class TestImgui : public Module {
class TestImgui : public Archimedes::GuiModule {
public:
TestImgui(void* h, App& a) : Module(h, a) {
TestImgui(void*, Archimedes::App&);
std::cout << "Enter path to Window library: ";
std::string path;
std::cin.ignore();
std::getline(std::cin, path);
deps["Window"] = path;
name = "TestImgui";
}
~TestImgui();
~TestImgui() {}
void load();
void onLoad();
void run();
private:
bool demo = true;
};
extern "C" {
Module* create(void* handle, App& app) {
Archimedes::Module* create(void* handle, Archimedes::App& app) {
return new TestImgui(handle, app);
}
}