From 3fd19031472c296f93642485a5f5cbcc601bdb94 Mon Sep 17 00:00:00 2001 From: Kasper Date: Tue, 6 May 2025 22:45:12 +0300 Subject: [PATCH] add some comments to main --- .gitmodules | 3 +++ CMakeLists.txt | 6 ++---- hiisi/main.cpp | 15 +++++++++++++++ hiload | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) create mode 160000 hiload diff --git a/.gitmodules b/.gitmodules index fae1402..d851447 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "3rd/SDL"] path = 3rd/SDL url = https://github.com/libsdl-org/SDL.git +[submodule "hiload"] + path = hiload + url = git@git.kitemoonsche.me:schme/hiload.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a5da1da..9b467b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17) add_subdirectory(3rd/SDL EXCLUDE_FROM_ALL) +add_subdirectory(hiload) add_subdirectory(hiisi) -# target_link_options(SDL3-shared PRIVATE -Wl,-z,nodelete) - add_executable(hiisi-run hiisi/main.cpp) -target_link_libraries(hiisi-run hiisi-engine) -# target_link_libraries(hiisi-run hiload) +target_link_libraries(hiisi-run hiisi-engine hiload) diff --git a/hiisi/main.cpp b/hiisi/main.cpp index 7ab2e2b..b4d47c3 100644 --- a/hiisi/main.cpp +++ b/hiisi/main.cpp @@ -1,5 +1,7 @@ #include "hiisi.h" +#include "hiload.h" + #include #include #include @@ -10,13 +12,26 @@ int main(int argc, char **argv) { + /* Hiload hotreloader is compiled as a shared library, these are the + * only required changes for the code to successfully reload */ + + // Init hiload + const char *himodules[] = {"", "libhiisi-engine.so"}; + hi_init(2, himodules); + HiisiEngine hiisi; hiisi.init(argc, argv); while (hiisi.event()) { hiisi.iterate(); + + // Reload changes + hi_reload(); } hiisi.quit(); + + // Deinit hiload + hi_deinit(); return 0; } diff --git a/hiload b/hiload new file mode 160000 index 0000000..a5e7233 --- /dev/null +++ b/hiload @@ -0,0 +1 @@ +Subproject commit a5e723364f39a5ee00d49f0037d0e47e70aa40ed