feat: Add hierarchy, scene, project and inspector windows
This commit is contained in:
parent
76af2938da
commit
4b636b436e
@ -5,20 +5,16 @@
|
||||
#include "imgui_impl_glfw.h"
|
||||
#include "imgui_impl_opengl3.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
string log_message;
|
||||
std::string log_message;
|
||||
bool show_demo_window = true;
|
||||
bool show_another_window = false;
|
||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||
|
||||
void debug(string message){
|
||||
void debug(std::string message){
|
||||
log_message = message;
|
||||
}
|
||||
|
||||
bool open_main = true;
|
||||
|
||||
void show_main(){
|
||||
void show_menu(){
|
||||
if(ImGui::BeginMainMenuBar()){
|
||||
if(ImGui::BeginMenu("File")){
|
||||
if (ImGui::MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ }
|
||||
@ -30,26 +26,16 @@ void show_main(){
|
||||
}
|
||||
}
|
||||
|
||||
void show_tools(){
|
||||
static float f = 0.0f;
|
||||
static int counter = 0;
|
||||
void show_hierarchy(){
|
||||
ImGui::Begin("Hierarchy");
|
||||
|
||||
ImGui::Begin("Tools"); // Create a window called "Hello, world!" and append into it.
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||
ImGui::Checkbox("Another Window", &show_another_window);
|
||||
void show_project(){
|
||||
ImGui::Begin("Project");
|
||||
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||
|
||||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||
counter++;
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("counter = %d", counter);
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGui::End();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void show_console(){
|
||||
@ -64,15 +50,38 @@ void show_console(){
|
||||
if(ImGui::Button("Debug")){
|
||||
debug("Debug message");
|
||||
}
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
|
||||
ImGui::Text("%s", log_message.c_str());
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void show_scene(){
|
||||
ImGui::Begin("Scene");
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void show_inspector(){
|
||||
static float f = 0.0f;
|
||||
static int counter = 0;
|
||||
|
||||
ImGui::Begin("Inspector");
|
||||
|
||||
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||
ImGui::Checkbox("Another Window", &show_another_window);
|
||||
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||
|
||||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||
counter++;
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("counter = %d", counter);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@ -121,12 +130,18 @@ int main(void){
|
||||
// ImGui::ShowDemoWindow(&show_demo_window);
|
||||
|
||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
||||
show_main();
|
||||
show_menu();
|
||||
|
||||
show_tools();
|
||||
show_hierarchy();
|
||||
|
||||
show_scene();
|
||||
|
||||
show_project();
|
||||
|
||||
show_console();
|
||||
|
||||
show_inspector();
|
||||
|
||||
// 3. Show another simple window.
|
||||
if (show_another_window)
|
||||
{
|
||||
|
52
imgui.ini
52
imgui.ini
@ -1,6 +1,6 @@
|
||||
[Window][DockSpaceViewport_11111111]
|
||||
Pos=0,19
|
||||
Size=640,461
|
||||
Size=1366,693
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
@ -9,21 +9,53 @@ Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Console]
|
||||
Pos=232,300
|
||||
Size=408,180
|
||||
Pos=290,532
|
||||
Size=802,180
|
||||
Collapsed=0
|
||||
DockId=0x00000005,0
|
||||
|
||||
[Window][Tools]
|
||||
Pos=0,19
|
||||
Size=230,461
|
||||
Size=233,693
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=640,461 Split=X
|
||||
DockNode ID=0x00000002 Parent=0x8B93E3BD SizeRef=230,461 Selected=0xD44407B5
|
||||
DockNode ID=0x00000003 Parent=0x8B93E3BD SizeRef=408,461 Split=Y
|
||||
DockNode ID=0x00000004 Parent=0x00000003 SizeRef=321,279 CentralNode=1
|
||||
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=321,180 Selected=0x49278EEE
|
||||
[Window][Inspector]
|
||||
Pos=1094,19
|
||||
Size=272,693
|
||||
Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][Scene]
|
||||
Pos=290,19
|
||||
Size=802,511
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Hierarchy]
|
||||
Pos=0,19
|
||||
Size=288,693
|
||||
Collapsed=0
|
||||
DockId=0x00000007,0
|
||||
|
||||
[Window][Another Window]
|
||||
Pos=60,60
|
||||
Size=198,67
|
||||
Collapsed=0
|
||||
|
||||
[Window][Project]
|
||||
Pos=300,525
|
||||
Size=32,35
|
||||
Collapsed=0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=1366,693 Split=X
|
||||
DockNode ID=0x00000007 Parent=0x8B93E3BD SizeRef=288,693 Selected=0x29EABFBD
|
||||
DockNode ID=0x00000008 Parent=0x8B93E3BD SizeRef=1076,693 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=802,693 Split=X
|
||||
DockNode ID=0x00000002 Parent=0x00000001 SizeRef=233,461 Selected=0xD44407B5
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=901,461 Split=Y
|
||||
DockNode ID=0x00000004 Parent=0x00000003 SizeRef=321,279 CentralNode=1 Selected=0xE192E354
|
||||
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=321,180 Selected=0x49278EEE
|
||||
DockNode ID=0x00000006 Parent=0x00000008 SizeRef=272,693 Selected=0xE7039252
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user