From 06adaaeadc22033f678312bc27aed962bed1ae4f Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 29 Mar 2025 18:17:19 +0300 Subject: [PATCH 1/5] fix doc/*/scripting/builtins/libinventory.md --- doc/en/scripting/builtins/libinventory.md | 2 +- doc/ru/scripting/builtins/libinventory.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/scripting/builtins/libinventory.md b/doc/en/scripting/builtins/libinventory.md index 3816fb45..0be4a103 100644 --- a/doc/en/scripting/builtins/libinventory.md +++ b/doc/en/scripting/builtins/libinventory.md @@ -170,7 +170,7 @@ inventory.decrement( -- creating a local `uses` property if none. -- Removes one item from the slot when the counter reaches zero. -- Does nothing if the `uses` property is not specified in the item's JSON. --- See [property `uses`](../../item-properties.md#number-of-uses-durability---uses) +-- See an item property `uses` inventory.use( -- inventory id invid: int, diff --git a/doc/ru/scripting/builtins/libinventory.md b/doc/ru/scripting/builtins/libinventory.md index 72a06b6b..701ed50c 100644 --- a/doc/ru/scripting/builtins/libinventory.md +++ b/doc/ru/scripting/builtins/libinventory.md @@ -181,7 +181,7 @@ inventory.decrement( -- создавая локальное свойство `uses` при отсутствии. -- Удаляет один предмет из слота при достижении нулевого значения счётчика. -- При отсутствии в JSON предмета свойства `uses` ничего не делает. --- См. [свойство `uses`](../../item-properties.md#число-использований-прочность---uses) +-- См. свойство предметов `uses` inventory.use( -- id инвентаря invid: int, From a6015a326bbb02cc07c07aff085d3cfcb52adfa4 Mon Sep 17 00:00:00 2001 From: "@clasher113" Date: Sat, 29 Mar 2025 21:53:05 +0200 Subject: [PATCH 2/5] fix: image render & LabelCache::update crash --- src/graphics/ui/elements/Label.cpp | 2 +- src/graphics/ui/elements/UINode.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/graphics/ui/elements/Label.cpp b/src/graphics/ui/elements/Label.cpp index fd8ac725..3339f307 100644 --- a/src/graphics/ui/elements/Label.cpp +++ b/src/graphics/ui/elements/Label.cpp @@ -51,7 +51,7 @@ void LabelCache::update(std::wstring_view text, bool multiline, bool wrap) { if (text[i] == L'\n') { lines.push_back(LineScheme {i+1, false}); len = 0; - } else if (i > 0 && wrap && text[i+1] != L'\n') { + } else if (i > 0 && i+1 < text.length() && wrap && text[i+1] != L'\n') { size_t width = font->calcWidth(text, i-len-1, i-(i-len)+2); if (width >= wrapWidth) { // starting a fake line diff --git a/src/graphics/ui/elements/UINode.cpp b/src/graphics/ui/elements/UINode.cpp index d975315a..08316e32 100644 --- a/src/graphics/ui/elements/UINode.cpp +++ b/src/graphics/ui/elements/UINode.cpp @@ -160,9 +160,9 @@ CursorShape UINode::getCursor() const { glm::vec2 UINode::calcPos() const { if (parent) { - return pos + parent->calcPos() + parent->getContentOffset(); + return glm::ivec2(pos + parent->calcPos() + parent->getContentOffset()); } - return pos; + return glm::ivec2(pos); } void UINode::scrolled(int value) { From 7b90fa15dbb89aea4b0ec7e32a9dfc301092991b Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 31 Mar 2025 14:15:51 +0300 Subject: [PATCH 3/5] fix ingame chat size --- res/layouts/ingame_chat.xml | 2 +- src/graphics/ui/elements/UINode.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/res/layouts/ingame_chat.xml b/res/layouts/ingame_chat.xml index 45ad4749..e7c3a52c 100644 --- a/res/layouts/ingame_chat.xml +++ b/res/layouts/ingame_chat.xml @@ -1,5 +1,5 @@ getSize(); } + newSize.x = newSize.x == 0 ? size.x : newSize.x; + newSize.y = newSize.y == 0 ? size.y : newSize.y; setSize( {newSize.x < 0 ? defsize.x + (newSize.x + 1) : newSize.x, newSize.y < 0 ? defsize.y + (newSize.y + 1) : newSize.y} From 0042d8a60cee1595502f1313a2f4bdfdae16bbfb Mon Sep 17 00:00:00 2001 From: boolean-false <113813870+boolean-false@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:34:12 +0700 Subject: [PATCH 4/5] add check for OpenGL Debug extension support (#498) * Fix crash on Osx Arm * Check OpenGL extension support safely * Replace on cstring * Moved to Window.cpp and added extensions cache --- src/window/Window.cpp | 34 ++++++++++++++++++++++++++++++++-- src/window/Window.hpp | 1 + 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 0c1cccee..4e68877f 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "debug/Logger.hpp" #include "graphics/core/ImageData.hpp" @@ -32,6 +33,7 @@ bool Window::fullscreen = false; CursorShape Window::cursor = CursorShape::ARROW; static util::ObjectsKeeper observers_keeper; +static std::unordered_set extensionsCache; static const char* gl_error_name(int error) { switch (error) { @@ -223,8 +225,10 @@ int Window::initialize(DisplaySettings* settings) { } } - glEnable(GL_DEBUG_OUTPUT); - glDebugMessageCallback(gl_message_callback, 0); + if (isGlExtensionSupported("GL_KHR_debug")) { + glEnable(GL_DEBUG_OUTPUT); + glDebugMessageCallback(gl_message_callback, nullptr); + } glViewport(0, 0, width, height); glClearColor(0.0f, 0.0f, 0.0f, 1); @@ -501,3 +505,29 @@ void Window::setIcon(const ImageData* image) { image->getData()}; glfwSetWindowIcon(window, 1, &icon); } + +static void initGlExtensionsCache() { + if (!extensionsCache.empty()) { + return; + } + + GLint numExtensions = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); + + for (GLint i = 0; i < numExtensions; ++i) { + const char *ext = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); + if (ext) { + extensionsCache.insert(ext); + } + } +} + +bool Window::isGlExtensionSupported(const char *extension) { + if (!extension || !*extension) { + return false; + } + + initGlExtensionsCache(); + + return extensionsCache.find(extension) != extensionsCache.end(); +} diff --git a/src/window/Window.hpp b/src/window/Window.hpp index 77fd7076..b81da395 100644 --- a/src/window/Window.hpp +++ b/src/window/Window.hpp @@ -24,6 +24,7 @@ class Window { static CursorShape cursor; static bool tryToMaximize(GLFWwindow* window, GLFWmonitor* monitor); + static bool isGlExtensionSupported(const char *extension); public: static int posX; static int posY; From 149d095e6d94ece181d336ea4e2e1f80d33c3269 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 2 Apr 2025 13:25:02 +0300 Subject: [PATCH 5/5] update minimum cmake version (#499) * update minimum cmake version to 3.5 * add '-DCMAKE_POLICY_VERSION_MINIMUM=3.5' to appimage workflow * add '-DCMAKE_POLICY_VERSION_MINIMUM=3.5' to appimage workflow --- .github/workflows/appimage.yml | 4 ++-- CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index ed214cd0..f5224c8f 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -32,11 +32,11 @@ jobs: # install EnTT git clone https://github.com/skypjack/entt.git cd entt/build - cmake -DCMAKE_BUILD_TYPE=Release -DENTT_INSTALL=on .. + cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DENTT_INSTALL=on .. sudo make install cd ../.. - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON + run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON - name: Build run: cmake --build build -t install - name: Run tests diff --git a/CMakeLists.txt b/CMakeLists.txt index f64a574e..6966e81f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.26) +cmake_minimum_required(VERSION 3.5) project(VoxelEngine) set(CMAKE_CXX_STANDARD 17)