NcEngine
EditorContext.h
Go to the documentation of this file.
1
5#pragma once
6
7#include "ncengine/ecs/Ecs.h"
8#include "ncengine/input/Input.h"
11
12namespace nc
13{
14struct SystemEvents;
15
16namespace ui::editor
17{
20{
21 input::KeyCode toggleEditor = input::KeyCode::Tilde;
22 input::KeyCode openNewSceneDialog = input::KeyCode::F1;
23 input::KeyCode openSaveSceneDialog = input::KeyCode::F2;
24 input::KeyCode openLoadSceneDialog = input::KeyCode::F3;
25 input::KeyCode toggleEditorCamera = input::KeyCode::F5;
26};
27
29enum class OpenState
30{
31 Closed, // Editor was closed this frame
32 ClosePersisted, // Editor remains closed
33 Opened, // Editor was opened this frame
34 OpenPersisted // Editor remains open
35};
36
39{
40 // General game state
41 ecs::Ecs world;
42 ModuleProvider modules;
43 SystemEvents* events = nullptr;
44
45 // Mutable state (for internal use)
46 Entity selectedEntity = Entity::Null();
47 OpenState openState = OpenState::Closed;
48 ImVec2 dimensions = ImVec2{};
49 bool rebuildStaticsOnTransformWrite = true;
50
51 // Immutable state
52 const Entity objectBucket = Entity::Null();
53 const Entity editorCamera = Entity::Null();
54 const EditorHotkeys hotkeys = EditorHotkeys{};
55};
56} // namespace ui::editor
57} // namespace nc
OpenState
Signals editor open and close events.
Definition: EditorContext.h:30
Identifies an object in the registry.
Definition: Entity.h:18
static constexpr auto Null() noexcept
Construct a null Entity.
Definition: Entity.h:61
Provides access to registered Modules.
Definition: ModuleProvider.h:15
Interface for higher-level entity and component operations with optional type access restriction.
Definition: Ecs.h:18
Signals for internal engine events.
Definition: Events.h:14
State for the editor.
Definition: EditorContext.h:39
Hotkeys for the editor.
Definition: EditorContext.h:20