ImguiModule
This commit is contained in:
43
flake.nix
43
flake.nix
@@ -60,6 +60,49 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ImguiModule = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
|
name = "ImguiModule";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
imgui = inputs.imgui;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
clang
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
glfw
|
||||||
|
glew
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
clang++ \
|
||||||
|
modules/examples/GuiModules/TestImgui/src/*.cpp \
|
||||||
|
modules/WindowModule/src/*.cpp \
|
||||||
|
$imgui/backends/imgui_impl_glfw.cpp \
|
||||||
|
$imgui/backends/imgui_impl_opengl3.cpp \
|
||||||
|
$imgui/*.cpp \
|
||||||
|
-DRENDERER_OPENGL \
|
||||||
|
-DWINDOW_GLFW \
|
||||||
|
-DGUIMODULE \
|
||||||
|
-DIMGUIMODULE_DYNAMIC \
|
||||||
|
-fpic -shared \
|
||||||
|
-I src -I include -I $imgui -I . \
|
||||||
|
-lGL -lglfw -lGLEW \
|
||||||
|
-Wall \
|
||||||
|
-o $name
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp $name $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
MainGUI = pkgs.stdenvNoCC.mkDerivation {
|
MainGUI = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
name = "MainGUI";
|
name = "MainGUI";
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ namespace Archimedes {
|
|||||||
void* handle;
|
void* handle;
|
||||||
|
|
||||||
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
||||||
std::unordered_map<std::string, Module*> depsInstances;
|
std::unordered_map<std::string, std::variant<std::string, Module*>> exts;
|
||||||
|
std::unordered_map<std::string, Module*> moduleInstances;
|
||||||
|
|
||||||
//std::unordered_map<std::string, std::any> data;
|
//std::unordered_map<std::string, std::any> data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ ImguiModule::~ImguiModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImguiModule::onLoad() {
|
void ImguiModule::onLoad() {
|
||||||
WindowModule* wm = (WindowModule*) depsInstances["WindowModule"];
|
WindowModule* wm = (WindowModule*) moduleInstances["WindowModule"];
|
||||||
|
|
||||||
if(!wm) {
|
if(!wm) {
|
||||||
std::cout << "No WindowModule for ImguiModule!\n";
|
std::cout << "No WindowModule for ImguiModule!\n";
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ImguiModule : public Archimedes::GuiModule {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TESTIMGUI_DYNAMIC
|
#ifdef IMGUIMODULE_DYNAMIC
|
||||||
#define MODULE_TYPE ImguiModule
|
#define MODULE_TYPE ImguiModule
|
||||||
#include "endModule.h"
|
#include "endModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ void MinimalApp::run() {
|
|||||||
|
|
||||||
for(auto m : toOpen) {
|
for(auto m : toOpen) {
|
||||||
if(std::holds_alternative<std::string>(m.second)) {
|
if(std::holds_alternative<std::string>(m.second)) {
|
||||||
load(std::get<std::string>(m.second));
|
load(std::get<std::string>(m.second))->onLoad();
|
||||||
} else {
|
} else {
|
||||||
load(std::get<Archimedes::Module*>(m.second));
|
load(std::get<Archimedes::Module*>(m.second))->onLoad();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toOpen.clear();
|
toOpen.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user