-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFEEditor.h
More file actions
109 lines (83 loc) · 3 KB
/
FEEditor.h
File metadata and controls
109 lines (83 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#pragma once
#include "EditorWindows/InspectorWindow.h"
#include "EditorWindows/EditorBaseWindowClasses/FEEditorSceneWindow.h"
#include <functional>
class FEEditor
{
friend class FEEditorSceneWindow;
friend class FEProjectManager;
friend class FEPrefabEditorManager;
public:
SINGLETON_PUBLIC_PART(FEEditor)
// Initialization and rendering
void InitializeResources();
void Render();
// Mouse and input
double GetLastMouseX() const;
void SetLastMouseX(double NewValue);
double GetLastMouseY() const;
void SetLastMouseY(double NewValue);
double GetMouseX() const;
void SetMouseX(double NewValue);
double GetMouseY() const;
void SetMouseY(double NewValue);
// Clipboard
std::string GetSceneEntityIDInClipboard();
void SetSceneEntityIDInClipboard(std::string NewValue);
void AddEditorScene(FEScene* Scene);
void AddCustomEditorScene(FEEditorSceneWindow* SceneWindow);
FEEditorSceneWindow* GetEditorSceneWindow(std::string SceneID);
std::vector<std::string> GetEditorOpenedScenesIDs() const;
bool SetFocusedScene(FEScene* NewSceneInFocus);
bool SetFocusedScene(std::string NewSceneInFocusID);
FEScene* GetFocusedScene() const;
bool IsInGameMode() const;
void SetGameMode(bool GameMode);
void UpdateBeforeRender();
private:
SINGLETON_PRIVATE_PART(FEEditor)
// Mouse and input
double LastMouseX, LastMouseY;
double MouseX, MouseY;
std::string FocusedEditorSceneID = "";
ImGuiID DockspaceID = 0;
std::vector<FEEditorSceneWindow*> EditorSceneWindows;
void DeleteScene(std::string SceneID);
// Clipboard
std::string SceneEntityIDInClipboard;
// Callbacks
static void AfterEngineUpdate();
static void MouseButtonCallback(int Button, int Action, int Mods);
static void MouseMoveCallback(double Xpos, double Ypos);
static void KeyButtonCallback(int Key, int Scancode, int Action, int Mods);
static void OnViewportResize(std::string ViewportID);
static void DropCallback(int Count, const char** Paths);
static void CloseWindowCallBack();
// Effects window
bool bEditorCamerasWindowVisible = true;
void DisplayEditorCamerasWindow() const;
// Log window
bool bLogWindowVisible = true;
void DisplayLogWindow() const;
// Resource under mouse
int TextureUnderMouse = -1;
int MeshUnderMouse = -1;
std::string ShaderIdUnderMouse;
int MaterialUnderMouse = -1;
int GameModelUnderMouse = -1;
int EntityUnderMouse = -1;
// Game mode
bool bGameMode = false;
bool SetGameModeInternal(bool GameMode);
std::unordered_map<std::string, FEScene*> ParentIDToScenesInGameMode;
bool DuplicateScenesForGameMode();
// Sub-windows
void RenderAllSubWindows();
// ImGui setup
void SetUpImgui();
void SetImguiStyle();
void OnProjectClose();
void BeforeChangeOfFocusedScene(FEScene* NewSceneInFocus);
std::unordered_map<std::string, std::string> SceneIDToOldMainCameraID;
};
#define EDITOR FEEditor::GetInstance()