Skip to content

Add keybinding to camera and maybe bring in generic keybinding #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ target_sources(${PROJECT_NAME} PRIVATE
src/editor/inspector.cpp
src/editor/log.cpp
src/editor/scene_tree.cpp
)
"src/editor/keybinder.cpp")
7 changes: 7 additions & 0 deletions lib/engine/include/facade/engine/editor/keybinder.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <cassert>

namespace facade::editor {

}
6 changes: 6 additions & 0 deletions lib/engine/src/editor/keybinder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <facade/engine/editor/keybinder.hpp>

namespace facade::editor {


}
10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ static constexpr auto test_json_v = R"(

struct MainMenu {
struct {
bool stats{};
bool tree{};
bool stats{};
bool log{};
bool camera;
bool imgui_demo{};
} windows{};

Expand Down Expand Up @@ -176,6 +177,11 @@ struct MainMenu {
if (auto window = editor::Window{"Log", &windows.log}) { data.log.render(window); }
}

void cam(Scene& scene) {
ImGui::SetNextWindowSize({600.0f, 200.0f}, ImGuiCond_Once);
if (auto window = editor::Window{"Camera", &windows.camera}) { scene.camera().transform; }
}

void display(Engine& engine, float const dt) {
if (auto main = editor::MainMenu{}) {
if (auto file = editor::Menu{main, "File"}) {
Expand All @@ -186,6 +192,7 @@ struct MainMenu {
if (ImGui::MenuItem("Tree")) { windows.tree = true; }
if (ImGui::MenuItem("Stats")) { windows.stats = true; }
if (ImGui::MenuItem("Log")) { windows.log = true; }
if (ImGui::MenuItem("Camera")) { windows.camera = true; }
if constexpr (debug_v) {
if (ImGui::MenuItem("ImGui demo")) { windows.imgui_demo = true; }
}
Expand All @@ -198,6 +205,7 @@ struct MainMenu {
if (data.inspectee) { inspector(engine.scene()); }
if (windows.stats) { stats(engine, dt); }
if (windows.log) { log(); }
if (windows.camera) { cam(engine.scene()); }
if (windows.imgui_demo) { ImGui::ShowDemoWindow(&windows.imgui_demo); }
}
};
Expand Down