New docks are now automatically added as tabs

simple_math_single_header
Martin Felis 2018-03-04 12:31:05 +01:00
parent 85c0b2cf42
commit 5cacee03c1
4 changed files with 1266 additions and 43 deletions

1238
3rdparty/imgui_dock_lumix/imgui_dock.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

19
3rdparty/imgui_dock_lumix/imgui_dock.h vendored Normal file
View File

@ -0,0 +1,19 @@
#pragma once
namespace ImGui
{
IMGUI_API void ShutdownDock();
IMGUI_API void RootDock(const ImVec2& pos, const ImVec2& size);
IMGUI_API bool BeginDock(const char* label, bool* opened = nullptr, ImGuiWindowFlags extra_flags = 0, const ImVec2& default_size = ImVec2(-1, -1));
IMGUI_API void EndDock();
IMGUI_API void SetDockActive();
//IMGUI_API void SaveDock(Lumix::FS::OsFile& file);
//IMGUI_API void LoadDock(lua_State* L);
} // namespace ImGui

View File

@ -45,7 +45,7 @@ INCLUDE_DIRECTORIES (
3rdparty/glfw/deps
3rdparty/glfw/include
3rdparty/tinyobjloader
3rdparty/imgui_dock
3rdparty/imgui_dock_lumix
${CMAKE_CURRENT_BINARY_DIR}/src
3rdparty/imgui
@ -75,7 +75,7 @@ SET ( protot_SRCS
3rdparty/imgui/examples/libs/gl3w/GL/gl3w.c
3rdparty/imgui/examples/opengl3_example/imgui_impl_glfw_gl3.cpp
3rdparty/imgui_dock/imgui_dock.cpp
3rdparty/imgui_dock_lumix/imgui_dock.cpp
)
SET (PROTOT_SOURCE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -32,11 +32,11 @@ double gTimeAtStart = 0;
double mouse_scroll_x = 0.;
double mouse_scroll_y = 0.;
using namespace std;
bool show_dock_1 = true;
bool show_dock_2 = true;
bool show_dock_3 = true;
// extern "C" {
// GLAPI int gladLoadGL(void);
// }
using namespace std;
static void error_callback(int error, const char* description)
{
@ -203,7 +203,6 @@ int main(void)
int width, height;
glfwGetWindowSize(gWindow, &width, &height);
ImGui::BeginMainMenuBar();
if (ImGui::BeginMenu("Dialogs"))
@ -212,49 +211,16 @@ int main(void)
ImGui::EndMenu();
}
float menu_bar_height = ImGui::GetWindowHeight();
ImGui::EndMainMenuBar();
if (draw_imgui_demo)
ImGui::ShowDemoWindow();
#ifdef USE_DOCKS
ImGui::SetNextWindowPos(ImVec2(0.0f, 10.0f));
ImGui::SetNextWindowSize(ImVec2(width, height));
if (ImGui::Begin("DockArea", NULL,
ImGuiWindowFlags_NoTitleBar
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoMove
| ImGuiWindowFlags_NoBringToFrontOnFocus
)) {
ImGui::BeginDockspace();
ImGui::RootDock(ImVec2(0.0f, menu_bar_height), ImVec2(width, height - menu_bar_height));
if (ImGui::BeginDock("dock1")) {
ImGui::Text("HEllo 1");
}
ImGui::EndDock();
module_manager.Update(gTimer->mDeltaTime);
if (ImGui::BeginDock("dock2")) {
ImGui::Text("HEllo2");
}
ImGui::EndDock();
if (ImGui::BeginDock("dock3")) {
ImGui::Text("HEllo3");
}
ImGui::EndDock();
#endif
module_manager.Update(gTimer->mDeltaTime);
#ifdef USE_DOCKS
ImGui::EndDockspace();
}
ImGui::End();
#endif
//
ImGui::Render();
usleep(16000);