This refactor of the editor code makes the code more maintainable. All widget objects have now moved away from RAII and are now just allocated object that live for the entirety of the applications lifetime. This feels better as I am used to this style plus constantly pushing and popping objects from the stack seems a little wasteful (although I as of right now have no way to prove that it is ).
26 lines
740 B
C++
26 lines
740 B
C++
#pragma once
|
|
#include "../../YoggieEngine/src/YoggieEngine.h"
|
|
#include "../EditorWindow.h"
|
|
|
|
#define RuntimeControlWindowFlags (ImGuiWindowFlags_)(ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse)
|
|
|
|
struct ButtonInfo {
|
|
const char* Name;
|
|
ImVec4 Color;
|
|
};
|
|
|
|
class RuntimeControls : public EditorWindow {
|
|
public:
|
|
RuntimeControls() : EditorWindow("RuntimeControls", RuntimeControlWindowFlags) {}
|
|
|
|
void Draw() override;
|
|
|
|
private:
|
|
ImVec2 buttonSize = ImVec2{ 90 ,25 };
|
|
unsigned int numButtons = 2;
|
|
ButtonInfo button[2] = {
|
|
{"Play" , ImVec4{ 0.001 * 12 , 0.001 * 201 , 0.001 * 69, 1.0f}},
|
|
{"Simulate", ImVec4{ 0.001 * 14, 0.001 * 157, 0.001 * 201, 1.0f}}
|
|
};
|
|
|
|
}; |