-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathDevTools.hpp
More file actions
106 lines (88 loc) · 2.76 KB
/
DevTools.hpp
File metadata and controls
106 lines (88 loc) · 2.76 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
#pragma once
#include "platform/platform.hpp"
#include <imgui.h>
#include "themes.hpp"
#include <cocos2d.h>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/addresser.hpp>
#include <Geode/loader/Loader.hpp>
#include <Geode/loader/ModMetadata.hpp>
using namespace geode::prelude;
enum class HighlightMode {
Selected,
Hovered,
Layout,
};
struct Settings {
bool GDInWindow = true;
bool attributesInTree = false;
bool alwaysHighlight = true;
bool highlightLayouts = false;
bool arrowExpand = false;
bool orderChildren = true;
bool advancedSettings = false;
bool showMemoryViewer = false;
std::string theme = DARK_THEME;
};
class DevTools {
protected:
bool m_visible = false;
bool m_setup = false;
bool m_reloadTheme = true;
bool m_shouldRelayout = false;
bool m_showModGraph = false;
bool m_pauseGame = false;
Settings m_settings;
ImGuiID m_dockspaceID;
ImFont* m_defaultFont = nullptr;
ImFont* m_smallFont = nullptr;
ImFont* m_monoFont = nullptr;
ImFont* m_boxFont = nullptr;
CCTexture2D* m_fontTexture = nullptr;
Ref<CCNode> m_selectedNode;
std::vector<std::pair<CCNode*, HighlightMode>> m_toHighlight;
void setupFonts();
void setupPlatform();
void drawTree();
void drawTreeBranch(CCNode* node, size_t index);
void drawSettings();
void drawAdvancedSettings();
void drawNodeAttributes(CCNode* node);
void drawAttributes();
void drawPreview();
void drawNodePreview(CCNode* node);
void drawHighlight(CCNode* node, HighlightMode mode);
void drawLayoutHighlights(CCNode* node);
void drawGD(GLRenderCtx* ctx);
void drawModGraph();
void drawModGraphNode(Mod* node);
ModMetadata inputMetadata(void* treePtr, ModMetadata metadata);
void drawPage(const char* name, void(DevTools::* fun)());
void drawPages();
void drawMemory();
void draw(GLRenderCtx* ctx);
void newFrame();
void renderDrawData(ImDrawData*);
void renderDrawDataFallback(ImDrawData*);
bool hasExtension(const std::string& ext) const;
DevTools() { loadSettings(); }
public:
static DevTools* get();
void loadSettings();
void saveSettings();
bool shouldUseGDWindow() const;
bool shouldPopGame() const;
bool pausedGame() const;
bool isSetup() const;
bool shouldOrderChildren() const;
CCNode* getSelectedNode() const;
void selectNode(CCNode* node);
void highlightNode(CCNode* node, HighlightMode mode);
void sceneChanged();
void render(GLRenderCtx* ctx);
// setup ImGui & DevTools
void setup();
void destroy();
void show(bool visible);
void toggle();
};