add docking but it's laggy
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
#include "TestClay.h"
|
||||||
|
|
||||||
|
#define CLAY_IMPLIMENTATION
|
||||||
|
#include "clay.h"
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
TestClay::TestClay(void* h, Archimedes::App& a) : Archimedes::GuiModule(h, a) {
|
||||||
|
|
||||||
|
name = "TestClay";
|
||||||
|
}
|
||||||
|
|
||||||
|
TestClay::~TestClay() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestClay::onLoad() {
|
||||||
|
|
||||||
|
createWindow();
|
||||||
|
|
||||||
|
window->getRenderer().init();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestClay::run() {
|
||||||
|
|
||||||
|
window->getRenderer().addRenderCmd([](){
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if(window->shouldClose())
|
||||||
|
app.end();
|
||||||
|
window->doFrame();
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#include "Archimedes.h"
|
||||||
|
|
||||||
|
|
||||||
|
class TestClay : public Archimedes::GuiModule {
|
||||||
|
|
||||||
|
public:
|
||||||
|
TestClay(void*, Archimedes::App&);
|
||||||
|
|
||||||
|
~TestClay();
|
||||||
|
|
||||||
|
void onLoad();
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
Archimedes::Module* create(void* handle, Archimedes::App& app) {
|
||||||
|
return new TestClay(handle, app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ void TestImgui::onLoad() {
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
||||||
|
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
// Setup Dear ImGui style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsLight();
|
//ImGui::StyleColorsLight();
|
||||||
@@ -50,6 +53,12 @@ void TestImgui::run() {
|
|||||||
|
|
||||||
window->getRenderer().addRenderCmd([](){
|
window->getRenderer().addRenderCmd([](){
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
|
{
|
||||||
|
ImGui::UpdatePlatformWindows();
|
||||||
|
ImGui::RenderPlatformWindowsDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(window->shouldClose())
|
if(window->shouldClose())
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ namespace Archimedes {
|
|||||||
|
|
||||||
bool shouldClose();
|
bool shouldClose();
|
||||||
|
|
||||||
void doFrame() { glfwSwapBuffers(w); }
|
void doFrame() { restoreContext(); glfwSwapBuffers(w); }
|
||||||
|
|
||||||
void pollEvents() { glfwPollEvents(); }
|
void pollEvents() { glfwPollEvents(); }
|
||||||
|
|
||||||
|
void restoreContext() { glfwMakeContextCurrent(w); }
|
||||||
|
|
||||||
void getSize(int&, int&);
|
void getSize(int&, int&);
|
||||||
|
|
||||||
GLFWwindow* getWindow() { return w; }
|
GLFWwindow* getWindow() { return w; }
|
||||||
|
|||||||
Reference in New Issue
Block a user