Created
January 8, 2020 01:08
-
-
Save KarimIO/15c709bb7b69231a8ab9c5b5b5b62c45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool prepareDockspace(const char *name) { | |
static ImGuiDockNodeFlags opt_flags = ImGuiDockNodeFlags_None; | |
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar; | |
if (opt_flags & ImGuiDockNodeFlags_PassthruCentralNode) | |
window_flags |= ImGuiWindowFlags_NoBackground; | |
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); | |
bool win_open = ImGui::Begin(name, nullptr, window_flags); | |
ImGui::PopStyleVar(); | |
if (win_open) { | |
opt_flags |= ImGuiDockNodeFlags_None; | |
// Dockspace | |
ImGuiIO& io = ImGui::GetIO(); | |
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable) | |
{ | |
ImGuiID dockspace_id = ImGui::GetID(name); | |
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), opt_flags); | |
} | |
if (ImGui::BeginMenuBar()) { | |
if (ImGui::BeginMenu("File")) { | |
} | |
ImGui::EndMenuBar(); | |
} | |
} | |
ImGui::End(); | |
return win_open; | |
} | |
void run(std::string material_name_) { | |
prepareDockspace(material_name_.c_str()); | |
if (ImGui::Begin((material_name_ + " Viewport").c_str())) { | |
ImGui::End(); | |
} | |
if (ImGui::Begin((material_name_ + " Properties").c_str())) { | |
char name_buff[256]; | |
name_buff[0] = 0; | |
ImGui::InputText("Name", name_buff, 256); | |
ImGui::End(); | |
} | |
} | |
run("A"); | |
run("B"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment