Skip to content

Commit dab108f

Browse files
committed
CLEANUP
1 parent 5026321 commit dab108f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4975
-3659
lines changed

Makefile.emscripten

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ SOURCES += $(FMT_DIR)/src/format.cc
2626
SOURCES += $(wildcard $(SRC_DIR)/utils/*.cpp)
2727
SOURCES += $(wildcard $(SRC_DIR)/sources/*.cpp)
2828

29-
SOURCES += $(SRC_DIR)/backend_sdl_emscripten.cpp
30-
SOURCES += $(SRC_DIR)/main.cpp
29+
SOURCES += $(SRC_DIR)/main_sdl_emscripten.cpp
30+
SOURCES += $(SRC_DIR)/main_window.cpp
3131

3232
##---------------------------------------------------------------------
3333

@@ -54,7 +54,7 @@ CPPFLAGS += -DIMGUI_DISABLE_FILE_FUNCTIONS
5454

5555
CPPFLAGS += -DPROJECT_VERSION_STRING="\"$(VERSION)\""
5656
CPPFLAGS += -DGIT_SHA1="\"$(HASH)\""
57-
CPPFLAGS += -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I$(IMGUI_DIR)/misc/cpp -I$(FMT_DIR)/include -I$(SRC_DIR)/sources
57+
CPPFLAGS += -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I$(IMGUI_DIR)/misc/cpp -I$(FMT_DIR)/include -I$(SRC_DIR)/sources -I$(SRC_DIR)/utils
5858
CPPFLAGS += -Wall -Wformat -Os $(EMS)
5959
LDFLAGS += --shell-file shell.html $(EMS)
6060

Makefile.unix.old

Lines changed: 0 additions & 119 deletions
This file was deleted.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
1
22
2
3-
2
3+
3

src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/sources/*.h ${CMAKE_CURREN
88
add_executable(${TARGET} WIN32 MACOSX_BUNDLE
99
${SOURCES}
1010
${HEADERS}
11-
backend_glfw_opengl3.cpp
12-
main.cpp
11+
main_glfw_opengl3.cpp
12+
main_window.cpp
1313
)
1414

1515
message(STATUS "IMGUI_INCLUDE_DIRS: ${IMGUI_INCLUDE_DIRS}")
1616
message(STATUS "FMT_INCLUDE_DIRS: ${FMT_INCLUDE_DIRS}")
1717

18+
target_include_directories(${TARGET} PRIVATE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/sources)
19+
target_include_directories(${TARGET} PRIVATE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/utils)
1820
target_include_directories(${TARGET} PRIVATE SYSTEM ${IMGUI_INCLUDE_DIRS})
1921
target_include_directories(${TARGET} PRIVATE SYSTEM ${FMT_INCLUDE_DIRS})
2022
target_include_directories(${TARGET} PRIVATE SYSTEM ${GLFW_INCLUDE_DIR})

src/includes.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/backend_glfw_opengl3.cpp renamed to src/main_glfw_opengl3.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
#include <GLFW/glfw3.h>
12
#include "imgui.h"
23
#include "imgui_impl_glfw.h"
34
#include "imgui_impl_opengl3.h"
45

5-
#include "includes.h"
6-
#include "main.h"
6+
#include "main_window.h"
7+
8+
#ifndef PROJECT_VERSION_STRING
9+
#define PROJECT_VERSION_STRING "0.0.0"
10+
#endif
11+
#ifndef GIT_SHA1
12+
#define GIT_SHA1 "0000000"
13+
#endif
714

815
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
916
#pragma comment(lib, "legacy_stdio_definitions")
@@ -30,9 +37,8 @@ int main(int argc, char *argv[])
3037
}
3138
}
3239

33-
State state;
34-
state.gui.bw.objects.reserve(2048);
35-
state.rng.seed(time(NULL));
40+
ImStudio::GUI gui;
41+
gui.bw.objects.reserve(2048);
3642

3743
glfwSetErrorCallback(glfw_error_callback);
3844
if (!glfwInit())
@@ -75,14 +81,14 @@ int main(int argc, char *argv[])
7581
ImGui_ImplGlfw_InitForOpenGL(glwindow, true);
7682
ImGui_ImplOpenGL3_Init(glsl_version);
7783

78-
while ((!glfwWindowShouldClose(glwindow)) && (state.gui.state))
84+
while ((!glfwWindowShouldClose(glwindow)) && (gui.state))
7985
{
8086
glfwPollEvents();
8187
ImGui_ImplOpenGL3_NewFrame();
8288
ImGui_ImplGlfw_NewFrame();
8389
ImGui::NewFrame();
8490

85-
MainWindowGUI(state);
91+
MainWindowGUI(gui);
8692

8793
ImGui::Render();
8894
int display_w, display_h;

src/backend_sdl_emscripten.cpp renamed to src/main_sdl_emscripten.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include <SDL.h>
77
#include <SDL_opengles2.h>
88

9-
#include "includes.h"
10-
#include "main.h"
9+
#include "main_window.h"
1110

1211
SDL_Window *g_Window = NULL;
1312
SDL_GLContext g_GLContext = NULL;
@@ -16,9 +15,8 @@ static void main_loop(void *);
1615

1716
int main(int, char **)
1817
{
19-
State state;
20-
state.gui.bw.objects.reserve(2048);
21-
state.rng.seed(time(NULL));
18+
ImStudio::GUI gui;
19+
gui.bw.objects.reserve(2048);
2220

2321
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
2422
{
@@ -58,7 +56,7 @@ int main(int, char **)
5856
ImGui_ImplOpenGL3_Init(glsl_version);
5957

6058
/////////////////////////////////////////////////////////
61-
emscripten_set_main_loop_arg(main_loop, &state, 0, true);
59+
emscripten_set_main_loop_arg(main_loop, &gui, 0, true);
6260
/////////////////////////////////////////////////////////
6361
}
6462

@@ -74,8 +72,8 @@ static void main_loop(void *arg)
7472
ImGui::NewFrame();
7573

7674
ImGuiIO &io = ImGui::GetIO();
77-
State &state = *(State *)arg;
78-
MainWindowGUI(state);
75+
ImStudio::GUI &gui = *(ImStudio::GUI *)arg;
76+
MainWindowGUI(gui);
7977

8078
ImGui::Render();
8179
SDL_GL_MakeCurrent(g_Window, g_GLContext);

src/main.cpp renamed to src/main_window.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "main.h"
1+
#include "main_window.h"
22

33
void MainWindowStyle()
44
{
@@ -57,19 +57,15 @@ void MainWindowStyle()
5757

5858
}
5959

60-
void MainWindowGUI(State & state)
60+
void MainWindowGUI(ImStudio::GUI & gui_r)
6161
{
6262

6363
//////////////////////////////////
64-
ImStudio::GUI &gui = state.gui;
65-
std::mt19937 &rng = state.rng;
64+
ImStudio::GUI &gui = gui_r;
6665
ImGuiIO &io = ImGui::GetIO();
6766

6867
static int w_w = io.DisplaySize.x;
6968
static int w_h = io.DisplaySize.y;
70-
71-
std::uniform_int_distribution<int>
72-
gen(999, 9999);
7369
//////////////////////////////////
7470

7571
ImGui::SetNextWindowPos(ImVec2(0, 0));
@@ -98,7 +94,7 @@ void MainWindowGUI(State & state)
9894
// create-viewport
9995
gui.vp_P = ImVec2(gui.sb_S.x, gui.mb_S.y);
10096
gui.vp_S = ImVec2(gui.pt_P.x - gui.sb_S.x, w_h - gui.mb_S.y);
101-
if (gui.viewport) gui.ShowViewport(gen(rng));
97+
if (gui.viewport) gui.ShowViewport();
10298

10399
}
104100
}
@@ -129,7 +125,7 @@ void MainWindowGUI(State & state)
129125
// create-viewport
130126
gui.vp_P = ImVec2(gui.sb_S.x, gui.mb_S.y);
131127
gui.vp_S = ImVec2(gui.pt_P.x - gui.sb_S.x, w_h - gui.mb_S.y);
132-
if (gui.viewport) gui.ShowViewport(gen(rng));
128+
if (gui.viewport) gui.ShowViewport();
133129
}
134130

135131
{ // create-children

src/main_window.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
3+
#include "ims_object.h"
4+
#include "ims_buffer.h"
5+
#include "ims_gui.h"
6+
7+
void MainWindowStyle();
8+
void MainWindowGUI(ImStudio::GUI & gui);

src/sources/buffer.cpp renamed to src/sources/ims_buffer.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#include "../includes.h"
2-
#include "buffer.h"
3-
#include "object.h"
1+
#include "ims_buffer.h"
42

5-
void ImStudio::BufferWindow::drawall(int *select, int gen_rand)
3+
void ImStudio::BufferWindow::drawall(int *select)
64
{
75
if (state)
86
{
@@ -33,7 +31,7 @@ void ImStudio::BufferWindow::drawall(int *select, int gen_rand)
3331
{
3432
if (o.type != "child")
3533
{
36-
o.draw(select, gen_rand, staticlayout);
34+
o.draw(select, staticlayout);
3735
}
3836
else
3937
{
@@ -43,7 +41,7 @@ void ImStudio::BufferWindow::drawall(int *select, int gen_rand)
4341
o.child.init = true;
4442
}
4543

46-
o.child.drawall(select, gen_rand, staticlayout);
44+
o.child.drawall(select, staticlayout);
4745
}
4846
}
4947
}

0 commit comments

Comments
 (0)