mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
* build: replace FetchContent with direct includes for glm * build(deps): replace SOIL2 with stb for image and vorbis decoding * build: replace FetchContent with direct includes for toml++ * refactor(texture): bump block texture size to 512 and disable items tab * feat: add hotbar system with ItemStack and RowLayout * fix(ui): restrict Ctrl key handling to typing mode * feat(ui): add widget border support and highlight selected hotbar slot * fix(ui): update borders on scale change and correct Image width - Added update_border() calls in set_scale() for Button, ChatBox, Image, Label, and TextField. - Fixed Image::width() to multiply by width instead of height. - Added early return in Widget::update_border() if border is not supported. * feat(ui): add border visual feedback on slider drag * feat(ui): add ItemSlot widget and refactor hotbar to use it * feat(world_scene): add inventory UI and pause type enum * feat(ui): add item slot tooltip and make window size static * fix(ui label): account for background offset in width/height * refactor(ui): centralize item info label in inventory and add update * feat(ui): add hotbar interaction in inventory UI * fix(inventory-ui): correct row creation logic for first item The loop starting at index 0 created a new row on the first iteration (i % 10 == 0). Shift the loop to start at 1 and adjust modulus condition to create rows correctly every 10 items. * feat(block): add name_key for localized block names Add `name_key` field to all block TOML definitions, enabling per-block localization. Update `BlockData` struct and `BlockManager` with `local_name()` method that returns a localized string via the translation system. Add corresponding entries to `en_US.json` and `zh_CN.json`. Modify inventory UI to use the localized name when displaying block info, and fix a bug where emptying a hotbar slot did not clear the item locally. * fix(ui): change inventory item slot color from white to gray * fix(ui): add missing include for std::array
235 lines
6.3 KiB
C++
235 lines
6.3 KiB
C++
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
|
|
//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
|
|
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
|
// SPDX-License-Identifier: MIT
|
|
#ifndef TOMLPLUSPLUS_HPP
|
|
#define TOMLPLUSPLUS_HPP
|
|
|
|
#define INCLUDE_TOMLPLUSPLUS_H // old guard name used pre-v3
|
|
#define TOMLPLUSPLUS_H // guard name used in the legacy toml.h
|
|
|
|
#include "impl/preprocessor.hpp"
|
|
|
|
TOML_PUSH_WARNINGS;
|
|
TOML_DISABLE_SPAM_WARNINGS;
|
|
TOML_DISABLE_SWITCH_WARNINGS;
|
|
TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
|
|
|
|
// misc warning false-positives
|
|
#if TOML_MSVC
|
|
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch
|
|
#if TOML_SHARED_LIB
|
|
#pragma warning(disable : 4251) // dll exports for std lib types
|
|
#endif
|
|
#elif TOML_CLANG
|
|
TOML_PRAGMA_CLANG(diagnostic ignored "-Wheader-hygiene")
|
|
#if TOML_CLANG >= 12
|
|
TOML_PRAGMA_CLANG(diagnostic ignored "-Wc++20-extensions")
|
|
#endif
|
|
#if TOML_CLANG == 13
|
|
TOML_PRAGMA_CLANG(diagnostic ignored "-Wreserved-identifier")
|
|
#endif
|
|
#endif
|
|
|
|
// IWYU pragma: begin_exports
|
|
#include "impl/std_new.hpp"
|
|
#include "impl/std_string.hpp"
|
|
#include "impl/std_optional.hpp"
|
|
#include "impl/forward_declarations.hpp"
|
|
#include "impl/print_to_stream.hpp"
|
|
#include "impl/source_region.hpp"
|
|
#include "impl/date_time.hpp"
|
|
#include "impl/at_path.hpp"
|
|
#include "impl/path.hpp"
|
|
#include "impl/node.hpp"
|
|
#include "impl/node_view.hpp"
|
|
#include "impl/value.hpp"
|
|
#include "impl/make_node.hpp"
|
|
#include "impl/array.hpp"
|
|
#include "impl/key.hpp"
|
|
#include "impl/table.hpp"
|
|
#include "impl/unicode_autogenerated.hpp"
|
|
#include "impl/unicode.hpp"
|
|
#include "impl/parse_error.hpp"
|
|
#include "impl/parse_result.hpp"
|
|
#include "impl/parser.hpp"
|
|
#include "impl/formatter.hpp"
|
|
#include "impl/toml_formatter.hpp"
|
|
#include "impl/json_formatter.hpp"
|
|
#include "impl/yaml_formatter.hpp"
|
|
// IWYU pragma: end_exports
|
|
|
|
#if TOML_IMPLEMENTATION
|
|
|
|
#include "impl/std_string.inl"
|
|
#include "impl/print_to_stream.inl"
|
|
#include "impl/node.inl"
|
|
#include "impl/at_path.inl"
|
|
#include "impl/path.inl"
|
|
#include "impl/array.inl"
|
|
#include "impl/table.inl"
|
|
#include "impl/unicode.inl"
|
|
#include "impl/parser.inl"
|
|
#include "impl/formatter.inl"
|
|
#include "impl/toml_formatter.inl"
|
|
#include "impl/json_formatter.inl"
|
|
#include "impl/yaml_formatter.inl"
|
|
|
|
#endif // TOML_IMPLEMENTATION
|
|
|
|
TOML_POP_WARNINGS;
|
|
|
|
// macro hygiene
|
|
#if TOML_UNDEF_MACROS
|
|
#undef TOML_ABI_NAMESPACE_BOOL
|
|
#undef TOML_ABI_NAMESPACE_END
|
|
#undef TOML_ABI_NAMESPACE_START
|
|
#undef TOML_ABI_NAMESPACES
|
|
#undef TOML_ABSTRACT_INTERFACE
|
|
#undef TOML_ALWAYS_INLINE
|
|
#undef TOML_ANON_NAMESPACE
|
|
#undef TOML_ANON_NAMESPACE_END
|
|
#undef TOML_ANON_NAMESPACE_START
|
|
#undef TOML_ARCH_AMD64
|
|
#undef TOML_ARCH_ARM
|
|
#undef TOML_ARCH_ARM32
|
|
#undef TOML_ARCH_ARM64
|
|
#undef TOML_ARCH_BITNESS
|
|
#undef TOML_ARCH_ITANIUM
|
|
#undef TOML_ARCH_X64
|
|
#undef TOML_ARCH_X86
|
|
#undef TOML_ASSERT
|
|
#undef TOML_ASSERT_ASSUME
|
|
#undef TOML_ASSUME
|
|
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
|
|
#undef TOML_ATTR
|
|
#undef TOML_CLANG
|
|
#undef TOML_CLANG_VERSION
|
|
#undef TOML_CLOSED_ENUM
|
|
#undef TOML_CLOSED_FLAGS_ENUM
|
|
#undef TOML_COMPILER_HAS_EXCEPTIONS
|
|
#undef TOML_COMPILER_HAS_RTTI
|
|
#undef TOML_CONST
|
|
#undef TOML_CONST_GETTER
|
|
#undef TOML_CONST_INLINE_GETTER
|
|
#undef TOML_CONSTRAINED_TEMPLATE
|
|
#undef TOML_CPP
|
|
#undef TOML_DECLSPEC
|
|
#undef TOML_DELETE_DEFAULTS
|
|
#undef TOML_DISABLE_ARITHMETIC_WARNINGS
|
|
#undef TOML_DISABLE_CODE_ANALYSIS_WARNINGS
|
|
#undef TOML_DISABLE_SPAM_WARNINGS
|
|
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_10
|
|
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_11
|
|
#undef TOML_DISABLE_SUGGEST_ATTR_WARNINGS
|
|
#undef TOML_DISABLE_SWITCH_WARNINGS
|
|
#undef TOML_DISABLE_WARNINGS
|
|
#undef TOML_DOXYGEN
|
|
#undef TOML_EMPTY_BASES
|
|
#undef TOML_ENABLE_IF
|
|
#undef TOML_ENABLE_WARNINGS
|
|
#undef TOML_EVAL_BOOL_0
|
|
#undef TOML_EVAL_BOOL_1
|
|
#undef TOML_EXTERNAL_LINKAGE
|
|
#undef TOML_FLAGS_ENUM
|
|
#undef TOML_FLOAT_CHARCONV
|
|
#undef TOML_FLOAT128
|
|
#undef TOML_FLOAT16_DIG
|
|
#undef TOML_FLOAT16_LIMITS_SET
|
|
#undef TOML_FLOAT16_MANT_DIG
|
|
#undef TOML_FLOAT16_MAX_10_EXP
|
|
#undef TOML_FLOAT16_MAX_EXP
|
|
#undef TOML_FLOAT16_MIN_10_EXP
|
|
#undef TOML_FLOAT16_MIN_EXP
|
|
#undef TOML_GCC
|
|
#undef TOML_GCC_LIKE
|
|
#undef TOML_HAS_ATTR
|
|
#undef TOML_HAS_BUILTIN
|
|
#undef TOML_HAS_CHAR8
|
|
#undef TOML_HAS_CPP_ATTR
|
|
#undef TOML_HAS_CUSTOM_OPTIONAL_TYPE
|
|
#undef TOML_HAS_FEATURE
|
|
#undef TOML_HAS_INCLUDE
|
|
#undef TOML_HAS_SSE2
|
|
#undef TOML_HAS_SSE4_1
|
|
#undef TOML_HIDDEN_CONSTRAINT
|
|
#undef TOML_ICC
|
|
#undef TOML_ICC_CL
|
|
#undef TOML_IMPL_NAMESPACE_END
|
|
#undef TOML_IMPL_NAMESPACE_START
|
|
#undef TOML_IMPLEMENTATION
|
|
#undef TOML_INCLUDE_WINDOWS_H
|
|
#undef TOML_INLINE_GETTER
|
|
#undef TOML_INT_CHARCONV
|
|
#undef TOML_INT128
|
|
#undef TOML_INTELLISENSE
|
|
#undef TOML_INTERNAL_LINKAGE
|
|
#undef TOML_LANG_AT_LEAST
|
|
#undef TOML_LANG_EFFECTIVE_VERSION
|
|
#undef TOML_LANG_HIGHER_THAN
|
|
#undef TOML_LANG_UNRELEASED
|
|
#undef TOML_LAUNDER
|
|
#undef TOML_LIFETIME_HOOKS
|
|
#undef TOML_LIKELY
|
|
#undef TOML_LIKELY_CASE
|
|
#undef TOML_LINUX
|
|
#undef TOML_MAKE_FLAGS
|
|
#undef TOML_MAKE_FLAGS_
|
|
#undef TOML_MAKE_FLAGS_1
|
|
#undef TOML_MAKE_FLAGS_2
|
|
#undef TOML_MAKE_STRING
|
|
#undef TOML_MAKE_STRING_1
|
|
#undef TOML_MAKE_VERSION
|
|
#undef TOML_MSVC
|
|
#undef TOML_MSVC_LIKE
|
|
#undef TOML_NAMESPACE
|
|
#undef TOML_NEVER_INLINE
|
|
#undef TOML_NODISCARD
|
|
#undef TOML_NODISCARD_CTOR
|
|
#undef TOML_NVCC
|
|
#undef TOML_OPEN_ENUM
|
|
#undef TOML_OPEN_FLAGS_ENUM
|
|
#undef TOML_PARSER_TYPENAME
|
|
#undef TOML_POP_WARNINGS
|
|
#undef TOML_PRAGMA_CLANG
|
|
#undef TOML_PRAGMA_CLANG_GE_10
|
|
#undef TOML_PRAGMA_CLANG_GE_11
|
|
#undef TOML_PRAGMA_CLANG_GE_8
|
|
#undef TOML_PRAGMA_CLANG_GE_9
|
|
#undef TOML_PRAGMA_GCC
|
|
#undef TOML_PRAGMA_ICC
|
|
#undef TOML_PRAGMA_MSVC
|
|
#undef TOML_PURE
|
|
#undef TOML_PURE_GETTER
|
|
#undef TOML_PURE_INLINE_GETTER
|
|
#undef TOML_PUSH_WARNINGS
|
|
#undef TOML_REQUIRES
|
|
#undef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
|
|
#undef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_MESSAGE
|
|
#undef TOML_SA_LIST_BEG
|
|
#undef TOML_SA_LIST_END
|
|
#undef TOML_SA_LIST_NEW
|
|
#undef TOML_SA_LIST_NXT
|
|
#undef TOML_SA_LIST_SEP
|
|
#undef TOML_SA_NATIVE_VALUE_TYPE_LIST
|
|
#undef TOML_SA_NEWLINE
|
|
#undef TOML_SA_NODE_TYPE_LIST
|
|
#undef TOML_SA_UNWRAPPED_NODE_TYPE_LIST
|
|
#undef TOML_SA_VALUE_EXACT_FUNC_MESSAGE
|
|
#undef TOML_SA_VALUE_FUNC_MESSAGE
|
|
#undef TOML_SA_VALUE_MESSAGE_CONST_CHAR8
|
|
#undef TOML_SA_VALUE_MESSAGE_U8STRING_VIEW
|
|
#undef TOML_SA_VALUE_MESSAGE_WSTRING
|
|
#undef TOML_SIMPLE_STATIC_ASSERT_MESSAGES
|
|
#undef TOML_TRIVIAL_ABI
|
|
#undef TOML_UINT128
|
|
#undef TOML_UNIX
|
|
#undef TOML_UNLIKELY
|
|
#undef TOML_UNLIKELY_CASE
|
|
#undef TOML_UNREACHABLE
|
|
#undef TOML_UNUSED
|
|
#undef TOML_WINDOWS
|
|
#endif
|
|
|
|
#endif // TOMLPLUSPLUS_HPP
|