help
This commit is contained in:
@@ -191,7 +191,7 @@
|
|||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
g++ \
|
g++ \
|
||||||
modules/TestImgui/src/*.cpp src/App.cpp \
|
modules/GUImodules/TestImgui/src/*.cpp src/App.cpp \
|
||||||
$imgui/backends/imgui_impl_glfw.cpp \
|
$imgui/backends/imgui_impl_glfw.cpp \
|
||||||
$imgui/backends/imgui_impl_opengl3.cpp \
|
$imgui/backends/imgui_impl_opengl3.cpp \
|
||||||
$imgui/*.cpp \
|
$imgui/*.cpp \
|
||||||
|
|||||||
@@ -7,21 +7,8 @@
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
TestImgui::TestImgui(void* h, Archimedes::App& a) : Archimedes::GuiModule(h, a) {
|
TestImgui::TestImgui(void* h, Archimedes::App& a) : Archimedes::GuiModule(h, a) {
|
||||||
|
|
||||||
name = "TestImgui";
|
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() {
|
TestImgui::~TestImgui() {
|
||||||
@@ -30,7 +17,32 @@ TestImgui::~TestImgui() {
|
|||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestImgui::onLoad() {}
|
void TestImgui::onLoad() {
|
||||||
|
|
||||||
|
createWindow();
|
||||||
|
|
||||||
|
std::cout << "Check version" << std::endl;
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
std::cout << "CreateContext" << std::endl;
|
||||||
|
ImGui::CreateContext();
|
||||||
|
std::cout << "GetIO" << std::endl;
|
||||||
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
|
std::cout << "Set Style" << std::endl;
|
||||||
|
// Setup Dear ImGui style
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
//ImGui::StyleColorsLight();
|
||||||
|
|
||||||
|
std::cout << "ImGui_ImplGlfw_InitForOpenGL" << std::endl;
|
||||||
|
// Setup Platform/Renderer backends
|
||||||
|
ImGui_ImplGlfw_InitForOpenGL(window->getWindowImpl().getWindow(), true);
|
||||||
|
std::cout << "ImGui_ImplOpenGL3_Init" << std::endl;
|
||||||
|
ImGui_ImplOpenGL3_Init("#version 130");
|
||||||
|
|
||||||
|
std::cout << "Successful onLoad" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void TestImgui::run() {
|
void TestImgui::run() {
|
||||||
|
|
||||||
@@ -42,7 +54,7 @@ void TestImgui::run() {
|
|||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
getWindow()->getRenderer().addRenderCmd([](){
|
window->getRenderer().addRenderCmd([](){
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ namespace Archimedes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Module::create_t* create = (Module::create_t*) dlsym(h, "create");
|
Module::create_t* create = (Module::create_t*) dlsym(h, "create");
|
||||||
|
char* err = dlerror();
|
||||||
if(dlerror()) {
|
if(err) {
|
||||||
std::cout << "error finding create function in file: " << lib << std::endl;
|
std::cout << "error finding create function in file: " << lib << std::endl;
|
||||||
|
std::cout << "dlerror(): " << err << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module* m = create(h, App::Get());
|
Module* m = create(h, App::Get());
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ namespace Archimedes {
|
|||||||
typedef GuiModule* create_t(void*, App&);
|
typedef GuiModule* create_t(void*, App&);
|
||||||
|
|
||||||
GuiModule(void* h, App& a) : Module(h, a) {}
|
GuiModule(void* h, App& a) : Module(h, a) {}
|
||||||
virtual ~GuiModule() {}
|
virtual ~GuiModule() { if(window) delete window; }
|
||||||
virtual void onLoad() = 0;
|
virtual void onLoad() = 0;
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
|
|
||||||
Window* getWindow() { return window; }
|
Window* getWindow() { return window; }
|
||||||
|
void createWindow() { window = new Window(); }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
Window* window;
|
Window* window;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "RendererOpenGL.h"
|
#include "RendererOpenGL.h"
|
||||||
|
|
||||||
#include "pch.hpp"
|
|
||||||
|
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
@@ -11,6 +9,10 @@ namespace Archimedes {
|
|||||||
|
|
||||||
RendererOpenGL::~RendererOpenGL() {}
|
RendererOpenGL::~RendererOpenGL() {}
|
||||||
|
|
||||||
|
void RendererOpenGL::init() {
|
||||||
|
glewInit();
|
||||||
|
}
|
||||||
|
|
||||||
void RendererOpenGL::render(std::list<renderCmd*> cmdList, int& w, int& h) {
|
void RendererOpenGL::render(std::list<renderCmd*> cmdList, int& w, int& h) {
|
||||||
|
|
||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace Archimedes {
|
|||||||
RendererOpenGL();
|
RendererOpenGL();
|
||||||
~RendererOpenGL();
|
~RendererOpenGL();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
void render(std::list<renderCmd*>, int&, int&);
|
void render(std::list<renderCmd*>, int&, int&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace Archimedes {
|
|||||||
glfwSetErrorCallback([](int e, const char* m){
|
glfwSetErrorCallback([](int e, const char* m){
|
||||||
std::cout << "GLFW Error: " << m << std::endl;
|
std::cout << "GLFW Error: " << m << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!glfwInit()) {
|
if(!glfwInit()) {
|
||||||
std::cout << "glfwInit failed!\n";
|
std::cout << "glfwInit failed!\n";
|
||||||
std::abort();
|
std::abort();
|
||||||
@@ -18,7 +19,7 @@ namespace Archimedes {
|
|||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
std::cout << "Window Created!\n";
|
||||||
glfwMakeContextCurrent(w);
|
glfwMakeContextCurrent(w);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Archimedes {
|
|||||||
|
|
||||||
void getSize(int&, int&);
|
void getSize(int&, int&);
|
||||||
|
|
||||||
auto getWindow() { return w; }
|
GLFWwindow* getWindow() { return w; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLFWwindow* w;
|
GLFWwindow* w;
|
||||||
|
|||||||
Reference in New Issue
Block a user