From 5a0a1cf326e6f3f594ef637c6eaae1a604ac9094 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 30 Sep 2026 20:43:43 +0300 Subject: [PATCH 1/5] ui fixes --- src/graphics/ui/elements/InlineFrame.cpp | 11 +++- src/graphics/ui/elements/SplitBox.cpp | 13 +++++ src/graphics/ui/elements/SplitBox.hpp | 1 + src/logic/scripting/scripting_functional.cpp | 54 ++++++++++++++------ 4 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/graphics/ui/elements/InlineFrame.cpp b/src/graphics/ui/elements/InlineFrame.cpp index 8699fd70b..acf00916e 100644 --- a/src/graphics/ui/elements/InlineFrame.cpp +++ b/src/graphics/ui/elements/InlineFrame.cpp @@ -35,8 +35,15 @@ void InlineFrame::setDocument(const std::shared_ptr& document) { root->setSize(size); - gui.postRunnable([this]() { - scripting::on_ui_open(*this->document, {}); + gui.postRunnable([weak = weak_from_this(), document]() { + auto node = weak.lock(); + if (node == nullptr) { + return; + } + if (static_cast(*node).document != document) { + return; + } + scripting::on_ui_open(*document, {}); }); } diff --git a/src/graphics/ui/elements/SplitBox.cpp b/src/graphics/ui/elements/SplitBox.cpp index 247ef7410..c35374529 100644 --- a/src/graphics/ui/elements/SplitBox.cpp +++ b/src/graphics/ui/elements/SplitBox.cpp @@ -82,6 +82,19 @@ void SplitBox::doubleClick(int x, int y) { refresh(); } +std::shared_ptr SplitBox::getAt(const glm::vec2& pos) { + auto hover = Container::getAt(pos); + if (hover.get() != this) { + return hover; + } + for (const auto& node : nodes) { + if (node->isVisible() && node->isInside(pos)) { + return nullptr; + } + } + return hover; +} + void SplitBox::fullRefresh() { refresh(); reposition(); diff --git a/src/graphics/ui/elements/SplitBox.hpp b/src/graphics/ui/elements/SplitBox.hpp index 8482e73ec..1a452c2ff 100644 --- a/src/graphics/ui/elements/SplitBox.hpp +++ b/src/graphics/ui/elements/SplitBox.hpp @@ -11,6 +11,7 @@ namespace gui { virtual void refresh() override; virtual void fullRefresh() override; virtual void doubleClick(int x, int y) override; + virtual std::shared_ptr getAt(const glm::vec2& pos) override; private: float splitPos; }; diff --git a/src/logic/scripting/scripting_functional.cpp b/src/logic/scripting/scripting_functional.cpp index a6ef42a48..c71133ca8 100644 --- a/src/logic/scripting/scripting_functional.cpp +++ b/src/logic/scripting/scripting_functional.cpp @@ -99,14 +99,21 @@ template std::function create_supplier( const scriptenv& env, const std::string& src, const std::string& file ) { - return [=]() { + return [=, errorLogged = false]() mutable { + lua::stackguard guard(lua::get_main_state()); if (auto L = process_callback(env, src, file)) { - if (lua::isfunction(L, -1)) { - lua::call_nothrow(L, 0); + if (lua::isfunction(L, -1) && !lua::call_nothrow(L, 0)) { + return T {}; + } + try { + return tovalueFunc(L, -1); + } catch (const std::exception& err) { + if (!errorLogged) { + logger.error() << "supplier " << util::quote(src) << ": " + << err.what(); + errorLogged = true; + } } - auto str = tovalueFunc(L, -1); - lua::pop(L); - return str; } return T {}; }; @@ -158,16 +165,33 @@ int_array_consumer scripting::create_int_array_consumer( vec2supplier scripting::create_vec2_supplier( const scriptenv& env, const std::string& src, const std::string& file ) { - return [=]() { - if (auto L = process_callback(env, src, file)) { - if (lua::isfunction(L, -1)) { - lua::call_nothrow(L, 0); + return [=, errorLogged = false]() mutable { + auto L = lua::get_main_state(); + lua::stackguard guard(L); + int top = lua::gettop(L); + if (process_callback(env, src, file)) { + if (lua::isfunction(L, -1) && !lua::call_nothrow(L, 0)) { + return glm::vec2(0, 0); + } + if (lua::gettop(L) - top < 2) { + if (!errorLogged) { + logger.error() << "supplier " << util::quote(src) + << ": two numbers expected"; + errorLogged = true; + } + return glm::vec2(0, 0); + } + try { + auto y = lua::tonumber(L, -1); + auto x = lua::tonumber(L, -2); + return glm::vec2(x, y); + } catch (const std::exception& err) { + if (!errorLogged) { + logger.error() << "supplier " << util::quote(src) << ": " + << err.what(); + errorLogged = true; + } } - auto y = lua::tonumber(L, -1); - lua::pop(L); - auto x = lua::tonumber(L, -1); - lua::pop(L); - return glm::vec2(x, y); } return glm::vec2(0, 0); }; From d8017ff99553039e6d0114a033eb9c352076eaee Mon Sep 17 00:00:00 2001 From: ostermine Date: Sat, 10 Oct 2026 00:52:23 +0300 Subject: [PATCH 2/5] fix reload_module ignoring pack environment reload_module loaded the new module code with the global environment, while require runs modules in their pack environment. After reload, PACK_ID and other pack globals were nil in the module. --- dev/tests/reload_module.lua | 33 +++++++++++++++++++++++++++++++++ res/scripts/stdmin.lua | 16 ++++++++++------ 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 dev/tests/reload_module.lua diff --git a/dev/tests/reload_module.lua b/dev/tests/reload_module.lua new file mode 100644 index 000000000..8ee5ab232 --- /dev/null +++ b/dev/tests/reload_module.lua @@ -0,0 +1,33 @@ +-- reload_module must run the module in its pack environment, as require does +local util = require "core:tests_util" +util.create_demo_world() + +-- a pack with a module that uses pack environment (PACK_ID) +local PACK = "world:content/reload_test" +file.mkdirs(PACK .. "/modules") +file.write(PACK .. "/package.json", json.tostring({id="reload_test", title="reload_test"})) + +local function write_module(version) + file.write(PACK .. "/modules/mod.lua", string.format([[ +local this = {} +function this.info() return PACK_ID, %d end +return this +]], version)) +end + +write_module(1) +app.reconfig_packs({"reload_test"}, {}) +app.tick() + +local mod = require "reload_test:mod" +local packid, version = mod.info() +assert(packid == "reload_test" and version == 1) + +write_module(2) +reload_module("reload_test:mod") +packid, version = mod.info() +assert(version == 2, "module is not reloaded") +assert(packid == "reload_test", "reloaded module has no pack environment") + +app.close_world(true) +app.delete_world("demo") diff --git a/res/scripts/stdmin.lua b/res/scripts/stdmin.lua index e1b735478..9fe297aab 100644 --- a/res/scripts/stdmin.lua +++ b/res/scripts/stdmin.lua @@ -183,6 +183,12 @@ function on_deprecated_call(name, alternatives) end end +local __pack_envs = __vc__pack_envs +function __vc_internals.get_pack_env(packid) + return __pack_envs[packid] +end +__vc__pack_envs = nil + function reload_module(name) local prefix, name = parse_path(name) local path = prefix..":modules/"..name..".lua" @@ -196,6 +202,10 @@ function reload_module(name) if script == nil then error(err) end + local env = __pack_envs[prefix] + if env then + script = setfenv(script, env) + end local result = script() if not result then return @@ -270,12 +280,6 @@ function __vc_lock_internal_modules() __internal_locked = true end -local __pack_envs = __vc__pack_envs -function __vc_internals.get_pack_env(packid) - return __pack_envs[packid] -end -__vc__pack_envs = nil - function require(path) if not string.find(path, ':') then local prefix, _ = parse_path(_debug_getinfo(2).source) From a2321e0e28a21dd1abc39db67f727ca7ed728dcc Mon Sep 17 00:00:00 2001 From: DIvan2000 Date: Sat, 10 Oct 2026 05:04:14 +0400 Subject: [PATCH 3/5] fix program filename --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ead09d092..83b5cc955 100644 --- a/flake.nix +++ b/flake.nix @@ -64,7 +64,7 @@ packages.default = voxel-core; apps.default = { type = "app"; - program = "${voxel-core}/bin/VoxelCore"; + program = "${voxel-core}/bin/VoxelEngine"; }; } ); From 8962042627ded0641db85f4a8b6d896d7d7dbbf4 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 10 Oct 2026 10:54:36 +0300 Subject: [PATCH 4/5] complete the rename of voxelengine to voxelcore --- .github/workflows/appimage.yml | 6 +++--- .github/workflows/cmake.yml | 6 +++--- .github/workflows/macos.yml | 20 ++++++++++---------- .github/workflows/release.yml | 2 +- .github/workflows/windows-clang.yml | 3 +-- .github/workflows/windows.yml | 3 +-- CMakeLists.txt | 12 ++++++------ Dockerfile | 2 +- README.md | 4 ++-- dev/AppImageBuilder.yml | 2 +- dev/VoxelCore.desktop | 4 ++-- dev/cmake/BuildAppdir.cmake | 2 +- dev/tests/network_http.lua | 2 +- doc/en/scripting/builtins/libnetwork.md | 2 +- doc/ru/scripting/builtins/libnetwork.md | 2 +- doc/specs/binary_json_spec.md | 2 +- flake.nix | 4 ++-- run.sh | 4 ++-- src/CMakeLists.txt | 12 ++++++------ test/CMakeLists.txt | 10 +++++----- test/network/curltest.cpp | 2 +- 21 files changed, 52 insertions(+), 54 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 5bfebeb4d..7b53b3fbf 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -50,13 +50,13 @@ jobs: - name: Run engine tests timeout-minutes: 5 run: | - chmod +x build/VoxelEngine + chmod +x build/VoxelCore chmod +x AppDir/usr/bin/vctest - AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build --memchecker valgrind + AppDir/usr/bin/vctest -e build/VoxelCore -d dev/tests -u build --memchecker valgrind - name: Build AppImage uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910 env: - UPDATE_INFO: gh-releases-zsync|MihailRis|VoxelEngine-Cpp|latest|*x86_64.AppImage.zsync + UPDATE_INFO: gh-releases-zsync|MihailRis|voxelcore|latest|*x86_64.AppImage.zsync with: recipe: dev/AppImageBuilder.yml - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 52f7b7183..6956a1f3d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -62,7 +62,7 @@ jobs: # Build your program with the given configuration run: | cmake --build ${{github.workspace}}/build --config ${{inputs.build_type}} - mv ${{github.workspace}}/build/VoxelEngine VoxelEngine + mv ${{github.workspace}}/build/VoxelCore VoxelCore - name: Run tests if: ${{ inputs.run_tests }} run: ctest --test-dir ${{github.workspace}}/build @@ -70,7 +70,7 @@ jobs: if: ${{ inputs.upload_artifacts }} uses: actions/upload-artifact@v4 with: - name: VoxelEngine + name: VoxelCore path: | - VoxelEngine + VoxelCore res/* diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b4d9f6328..a446821d8 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -39,7 +39,7 @@ jobs: run: chmod +x dev/fix_dylibs.sh - name: Fix dylibs - run: ./dev/fix_dylibs.sh VoxelEngine Release build + run: ./dev/fix_dylibs.sh VoxelCore Release build - name: Run tests run: ctest --output-on-failure --test-dir build @@ -47,19 +47,19 @@ jobs: - name: Run engine tests timeout-minutes: 5 run: | - chmod +x build/VoxelEngine + chmod +x build/VoxelCore chmod +x AppDir/usr/bin/vctest - AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build --output-always --debugger "lldb -batch -o 'run' -o 'thread backtrace all' -o 'quit' -- " + AppDir/usr/bin/vctest -e build/VoxelCore -d dev/tests -u build --output-always --debugger "lldb -batch -o 'run' -o 'thread backtrace all' -o 'quit' -- " - name: Create DMG run: | - mkdir VoxelEngineDmgContent - cp -r build/res VoxelEngineDmgContent/ - cp -r build/VoxelEngine VoxelEngineDmgContent/ - cp -r build/libs VoxelEngineDmgContent/libs - hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO + mkdir VoxelCoreDmgContent + cp -r build/res VoxelCoreDmgContent/ + cp -r build/VoxelCore VoxelCoreDmgContent/ + cp -r build/libs VoxelCoreDmgContent/libs + hdiutil create VoxelCoreMacApp.dmg -volname "VoxelCore" -srcfolder VoxelCoreDmgContent -ov -format UDZO - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: VoxelEngineMacOs - path: VoxelEngineMacApp.dmg + name: VoxelCoreMacOs + path: VoxelCoreMacApp.dmg diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a1d17c64..f6b539ba1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: mkdir release mv ./artifacts/AppImage/VoxelCore-latest-x86_64.AppImage \ ./release/voxelcore-${RELEASE_VERSION}_x86-64.AppImage - mv ./artifacts/VoxelEngineMacOs/VoxelEngineMacApp.dmg \ + mv ./artifacts/VoxelCoreMacOs/VoxelCoreMacApp.dmg \ ./release/voxelcore-${RELEASE_VERSION}_macos.dmg (cd ./artifacts/Windows-Build && zip -r ../../release/voxelcore-${RELEASE_VERSION}_win64.zip .) ls -la ./release diff --git a/.github/workflows/windows-clang.yml b/.github/workflows/windows-clang.yml index 5dd91a576..1fe591ac8 100644 --- a/.github/workflows/windows-clang.yml +++ b/.github/workflows/windows-clang.yml @@ -59,11 +59,10 @@ jobs: run: | mkdir packaged mkdir packaged/res - cp build/VoxelEngine.exe packaged/ + cp build/VoxelCore.exe packaged/ cp build/vctest/vctest.exe packaged/ cp build/*.dll packaged/ cp -r build/res/* packaged/res/ - mv packaged/VoxelEngine.exe packaged/VoxelCore.exe - uses: actions/upload-artifact@v4 with: name: Windows-Build diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ffcb0c318..ec5322bc0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -37,7 +37,7 @@ jobs: run: ctest --preset default-vs-msvc-windows - name: Run engine tests run: | - build/vctest/RelWithDebInfo/vctest.exe -e build/RelWithDebInfo/VoxelEngine.exe -d dev/tests -u build + build/vctest/RelWithDebInfo/vctest.exe -e build/RelWithDebInfo/VoxelCore.exe -d dev/tests -u build timeout-minutes: 5 - name: Package for Windows run: | @@ -45,7 +45,6 @@ jobs: cp -r build/RelWithDebInfo/* packaged/ cp build/vctest/RelWithDebInfo/vctest.exe packaged/ cp C:/Windows/System32/msvcp140.dll packaged/msvcp140.dll - mv packaged/VoxelEngine.exe packaged/VoxelCore.exe working-directory: ${{ github.workspace }} - uses: actions/upload-artifact@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a9d507b..a9ac24a1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(VoxelEngine) +project(VoxelCore) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -27,23 +27,23 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif() add_subdirectory(src) -add_executable(VoxelEngine src/main.cpp) +add_executable(VoxelCore src/main.cpp) if(VOXELENGINE_BUILD_APPDIR) include(${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/BuildAppdir.cmake) endif() -target_link_libraries(VoxelEngine PRIVATE VoxelEngineSrc +target_link_libraries(VoxelCore PRIVATE VoxelCoreSrc $<$:winmm>) -target_link_options(VoxelEngine PRIVATE $<$:-no-pie>) +target_link_options(VoxelCore PRIVATE $<$:-no-pie>) # Deploy res to build dir add_custom_command( - TARGET VoxelEngine + TARGET VoxelCore POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/res $/res) + ${CMAKE_CURRENT_SOURCE_DIR}/res $/res) if(VOXELENGINE_BUILD_TESTS) enable_testing() diff --git a/Dockerfile b/Dockerfile index 3a06d1afc..fb1a628c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Build docker container: docker build -t voxelcore . # Build project: docker run --rm -it -v$(pwd):/project voxelcore bash -c "cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE -Bbuild && cmake --build build" -# Run project in docker: docker run --rm -it -v$(pwd):/project -v/tmp/.X11-unix:/tmp/.X11-unix -v${XAUTHORITY}:/home/user/.Xauthority:ro -eDISPLAY --network=host voxelcore ./build/VoxelEngine +# Run project in docker: docker run --rm -it -v$(pwd):/project -v/tmp/.X11-unix:/tmp/.X11-unix -v${XAUTHORITY}:/home/user/.Xauthority:ro -eDISPLAY --network=host voxelcore ./build/VoxelCore FROM debian:bookworm-slim LABEL Description="Docker container for building VoxelCore for Linux" diff --git a/README.md b/README.md index 67788d9fd..d040e7707 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ docker run --rm -it \ -v "$XAUTHORITY:/home/user/.Xauthority:ro" \ -e DISPLAY="$DISPLAY" \ --network=host \ - voxel-engine ./build/VoxelEngine + voxel-engine ./build/VoxelCore ``` ### On Windows @@ -218,5 +218,5 @@ docker run --rm -it -v "${PWD}:/project" voxel-engine bash -c "cmake -DCMAKE_BUI #### Step 4. Run the application ```powershell -docker run --rm -it -v "${PWD}:/project" -e DISPLAY=host.docker.internal:0.0 --network=host voxel-engine ./build/VoxelEngine +docker run --rm -it -v "${PWD}:/project" -e DISPLAY=host.docker.internal:0.0 --network=host voxel-engine ./build/VoxelCore ``` diff --git a/dev/AppImageBuilder.yml b/dev/AppImageBuilder.yml index b2c7f09ec..bed1dde47 100644 --- a/dev/AppImageBuilder.yml +++ b/dev/AppImageBuilder.yml @@ -6,7 +6,7 @@ AppDir: name: VoxelCore icon: VoxelCore version: latest - exec: usr/bin/VoxelEngine + exec: usr/bin/VoxelCore exec_args: --dir $HOME/.config/voxelcore --res $APPDIR/usr/share/VoxelCore/res $@ apt: arch: amd64 diff --git a/dev/VoxelCore.desktop b/dev/VoxelCore.desktop index 48809b392..eeaf4be30 100644 --- a/dev/VoxelCore.desktop +++ b/dev/VoxelCore.desktop @@ -3,8 +3,8 @@ Version=1.0 Type=Application Name=VoxelCore Comment=Minecraft-like game engine in C++ with OpenGL -TryExec=VoxelEngine -Exec=VoxelEngine +TryExec=VoxelCore +Exec=VoxelCore Icon=VoxelCore MimeType=image/x-foo; Categories=Game; diff --git a/dev/cmake/BuildAppdir.cmake b/dev/cmake/BuildAppdir.cmake index e3a017e94..7445d1016 100644 --- a/dev/cmake/BuildAppdir.cmake +++ b/dev/cmake/BuildAppdir.cmake @@ -12,4 +12,4 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.desktop DESTINATION ${CMAKE_ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin) -install(TARGETS VoxelEngine DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin) +install(TARGETS VoxelCore DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin) diff --git a/dev/tests/network_http.lua b/dev/tests/network_http.lua index 12149de09..76fd7f54e 100644 --- a/dev/tests/network_http.lua +++ b/dev/tests/network_http.lua @@ -1,6 +1,6 @@ local response_received = false -network.get("https://api.github.com/repos/MihailRis/VoxelEngine-Cpp/releases/latest", function (s) +network.get("https://api.github.com/repos/MihailRis/voxelcore/releases/latest", function (s) print(json.parse(s).name) response_received = true end, function (code) diff --git a/doc/en/scripting/builtins/libnetwork.md b/doc/en/scripting/builtins/libnetwork.md index 8893407d4..ecd76bbf3 100644 --- a/doc/en/scripting/builtins/libnetwork.md +++ b/doc/en/scripting/builtins/libnetwork.md @@ -50,7 +50,7 @@ network.get( ) -- Example: -network.get("https://api.github.com/repos/MihailRis/VoxelEngine-Cpp/releases/latest", function (s) +network.get("https://api.github.com/repos/MihailRis/voxelcore/releases/latest", function (s) print(json.parse(s).name) -- will output the name of the latest engine release end) diff --git a/doc/ru/scripting/builtins/libnetwork.md b/doc/ru/scripting/builtins/libnetwork.md index c60f0f178..2c322405e 100644 --- a/doc/ru/scripting/builtins/libnetwork.md +++ b/doc/ru/scripting/builtins/libnetwork.md @@ -50,7 +50,7 @@ network.get( ) -- Пример: -network.get("https://api.github.com/repos/MihailRis/VoxelEngine-Cpp/releases/latest", function (s) +network.get("https://api.github.com/repos/MihailRis/voxelcore/releases/latest", function (s) print(json.parse(s).name) -- выведет имя последнего релиза движка end) diff --git a/doc/specs/binary_json_spec.md b/doc/specs/binary_json_spec.md index 46ed868d6..4bed562e4 100644 --- a/doc/specs/binary_json_spec.md +++ b/doc/specs/binary_json_spec.md @@ -2,7 +2,7 @@ Format version: 1.1 -This binary data format is developed for use as binary version of JSON in [VoxelEngine-Cpp](https://github.com/MihailRis/VoxelEngine-Cpp) and not compatible with [BSON](https://bsonspec.org/spec.html) due to elements/entries syntax and type codes differences +This binary data format is developed for use as binary version of JSON in [voxelcore](https://github.com/MihailRis/voxelcore) and not compatible with [BSON](https://bsonspec.org/spec.html) due to elements/entries syntax and type codes differences ## Basic types diff --git a/flake.nix b/flake.nix index 83b5cc955..cb6bfe6ca 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ installPhase = '' mkdir -p $out/bin - cp VoxelEngine $out/bin/ + cp VoxelCore $out/bin/ ''; }; in @@ -64,7 +64,7 @@ packages.default = voxel-core; apps.default = { type = "app"; - program = "${voxel-core}/bin/VoxelEngine"; + program = "${voxel-core}/bin/VoxelCore"; }; } ); diff --git a/run.sh b/run.sh index 612f06935..40532ad5c 100755 --- a/run.sh +++ b/run.sh @@ -62,5 +62,5 @@ done if [[ $run ]]; then echo "[RUN SCRIPT] Run project" - ./build/VoxelEngine -fi \ No newline at end of file + ./build/VoxelCore +fi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 802c06e1a..8eae55c33 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,10 @@ -project(VoxelEngineSrc) +project(VoxelCoreSrc) file(GLOB_RECURSE headers ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) -add_library(VoxelEngineSrc STATIC ${sources} ${headers}) +add_library(VoxelCoreSrc STATIC ${sources} ${headers}) find_package(OpenGL REQUIRED) find_package(GLEW REQUIRED) @@ -70,10 +70,10 @@ else() add_library(luajit::luajit ALIAS PkgConfig::luajit) endif() -target_include_directories(VoxelEngineSrc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(VoxelCoreSrc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries( - VoxelEngineSrc + VoxelCoreSrc PRIVATE glfw OpenGL::GL GLEW::GLEW @@ -91,7 +91,7 @@ target_link_libraries( ) target_compile_options( - VoxelEngineSrc + VoxelCoreSrc PUBLIC $<$: /utf-8 /MP @@ -129,7 +129,7 @@ target_compile_options( >) target_link_options( - VoxelEngineSrc + VoxelCoreSrc PUBLIC $<$: -no-pie diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e2aae2a74..708fb8da1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,22 +1,22 @@ -project(VoxelEngineTest) +project(VoxelCoreTest) file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) find_package(GTest) -add_executable(VoxelEngineTest ${sources}) +add_executable(VoxelCoreTest ${sources}) -target_link_libraries(VoxelEngineTest PRIVATE VoxelEngineSrc GTest::gtest_main) +target_link_libraries(VoxelCoreTest PRIVATE VoxelCoreSrc GTest::gtest_main) # HACK: copy res to test/ folder for fixing problem compatibility MultiConfig # and non MultiConfig builds. Delete in future and use only root res folder Also # this resolve problem with ctests, because it set cwd to # ${CMAKE_CURRENT_BINARY_DIR} add_custom_command( - TARGET VoxelEngineTest + TARGET VoxelCoreTest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/res) include(GoogleTest) -gtest_discover_tests(VoxelEngineTest) +gtest_discover_tests(VoxelCoreTest) diff --git a/test/network/curltest.cpp b/test/network/curltest.cpp index e7fc4840d..44a5bb38e 100644 --- a/test/network/curltest.cpp +++ b/test/network/curltest.cpp @@ -8,7 +8,7 @@ TEST(curltest, curltest) { auto network = network::Network::create(settings); network::HttpRequest request {}; - request.url = "https://raw.githubusercontent.com/MihailRis/VoxelEngine-Cpp/refs/" + request.url = "https://raw.githubusercontent.com/MihailRis/voxelcore/refs/" "heads/curl/res/content/base/blocks/lamp.json"; request.onResponse = [](network::HttpResponse response) { if (response.body.empty()) { From 521ebf43abf971f737bb473f3a3deb4a61772a11 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 10 Oct 2026 11:36:31 +0300 Subject: [PATCH 5/5] remove incorrect fix --- src/graphics/ui/elements/SplitBox.cpp | 13 ------------- src/graphics/ui/elements/SplitBox.hpp | 1 - 2 files changed, 14 deletions(-) diff --git a/src/graphics/ui/elements/SplitBox.cpp b/src/graphics/ui/elements/SplitBox.cpp index c35374529..247ef7410 100644 --- a/src/graphics/ui/elements/SplitBox.cpp +++ b/src/graphics/ui/elements/SplitBox.cpp @@ -82,19 +82,6 @@ void SplitBox::doubleClick(int x, int y) { refresh(); } -std::shared_ptr SplitBox::getAt(const glm::vec2& pos) { - auto hover = Container::getAt(pos); - if (hover.get() != this) { - return hover; - } - for (const auto& node : nodes) { - if (node->isVisible() && node->isInside(pos)) { - return nullptr; - } - } - return hover; -} - void SplitBox::fullRefresh() { refresh(); reposition(); diff --git a/src/graphics/ui/elements/SplitBox.hpp b/src/graphics/ui/elements/SplitBox.hpp index 1a452c2ff..8482e73ec 100644 --- a/src/graphics/ui/elements/SplitBox.hpp +++ b/src/graphics/ui/elements/SplitBox.hpp @@ -11,7 +11,6 @@ namespace gui { virtual void refresh() override; virtual void fullRefresh() override; virtual void doubleClick(int x, int y) override; - virtual std::shared_ptr getAt(const glm::vec2& pos) override; private: float splitPos; };