diff --git a/templates/docking/mcpp.toml.in b/templates/docking/mcpp.toml.in new file mode 100644 index 0000000..879293e --- /dev/null +++ b/templates/docking/mcpp.toml.in @@ -0,0 +1,6 @@ +[package] +name = "{{project.name}}" +version = "0.1.0" + +[dependencies] +{{self.name}} = { version = "{{self.version}}", features = ["docking-full"] } diff --git a/templates/docking/src/main.cpp.in b/templates/docking/src/main.cpp.in new file mode 100644 index 0000000..1dbb083 --- /dev/null +++ b/templates/docking/src/main.cpp.in @@ -0,0 +1,31 @@ +// {{project.name}} — generated from {{self.name}}@{{self.version}}:docking +import imgui.core; +import imgui.app; + +int main() { + return ImGui::App::run({.title = "{{project.name}}"}, [] { + auto dockspace = ImGui::DockSpaceOverViewport(); + + static bool layout_built = false; + if (!layout_built) { + layout_built = true; + const auto root = dockspace; + auto left = ImGui::DockBuilderSplitNode( + dockspace, ImGui::Dir_Left, 0.22f, nullptr, &dockspace); + auto down = ImGui::DockBuilderSplitNode( + dockspace, ImGui::Dir_Down, 0.28f, nullptr, &dockspace); + auto right = ImGui::DockBuilderSplitNode( + dockspace, ImGui::Dir_Right, 0.30f, nullptr, &dockspace); + ImGui::DockBuilderDockWindow("Scene", left); + ImGui::DockBuilderDockWindow("Console", down); + ImGui::DockBuilderDockWindow("Inspector", right); + ImGui::DockBuilderDockWindow("Viewport", dockspace); + ImGui::DockBuilderFinish(root); + } + + ImGui::Begin("Scene"); ImGui::TextUnformatted("scene tree"); ImGui::End(); + ImGui::Begin("Viewport"); ImGui::TextUnformatted("drag tabs to re-split / detach"); ImGui::End(); + ImGui::Begin("Inspector"); ImGui::TextUnformatted("properties"); ImGui::End(); + ImGui::Begin("Console"); ImGui::TextUnformatted("logs"); ImGui::End(); + }); +} diff --git a/templates/docking/template.toml b/templates/docking/template.toml new file mode 100644 index 0000000..e991608 --- /dev/null +++ b/templates/docking/template.toml @@ -0,0 +1,3 @@ +[template] +description = "IDE-style docking layout + detachable OS windows (docking-full)" +post_message = "`mcpp run`: four docked panes; drag a tab outside to detach it." diff --git a/templates/window/mcpp.toml.in b/templates/window/mcpp.toml.in new file mode 100644 index 0000000..ba6c3dd --- /dev/null +++ b/templates/window/mcpp.toml.in @@ -0,0 +1,6 @@ +[package] +name = "{{project.name}}" +version = "0.1.0" + +[dependencies] +{{self.name}} = "{{self.version}}" diff --git a/templates/window/src/main.cpp.in b/templates/window/src/main.cpp.in new file mode 100644 index 0000000..7c6c2cb --- /dev/null +++ b/templates/window/src/main.cpp.in @@ -0,0 +1,11 @@ +// {{project.name}} — generated from {{self.name}}@{{self.version}}:window +import imgui.core; +import imgui.app; + +int main() { + return ImGui::App::run({.title = "{{project.name}}"}, [] { + ImGui::Begin("{{project.name}}"); + ImGui::TextUnformatted("Hello from mcpp + imgui"); + ImGui::End(); + }); +} diff --git a/templates/window/template.toml b/templates/window/template.toml new file mode 100644 index 0000000..891b381 --- /dev/null +++ b/templates/window/template.toml @@ -0,0 +1,4 @@ +[template] +description = "Minimal imgui.app window" +default = true +post_message = "cd into the project and run `mcpp run` — the window appears."