From b15b832ea4a7b221fc0b681fda59e26b81b52553 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:21:34 +0200 Subject: [PATCH 01/22] chore: update httplib wrap to 0.20.1 --- subprojects/cpp-httplib.wrap | 14 +++++++------- ....0_mingw.diff => cpp-httplib-0.20.1_mingw.diff} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename subprojects/packagefiles/{cpp-httplib-0.20.0_mingw.diff => cpp-httplib-0.20.1_mingw.diff} (100%) diff --git a/subprojects/cpp-httplib.wrap b/subprojects/cpp-httplib.wrap index 5b80b2001..c970fdd59 100644 --- a/subprojects/cpp-httplib.wrap +++ b/subprojects/cpp-httplib.wrap @@ -1,11 +1,11 @@ [wrap-file] -directory = cpp-httplib-0.20.0 -source_url = https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.20.0.tar.gz -source_filename = cpp-httplib-0.20.0.tar.gz -source_hash = 18064587e0cc6a0d5d56d619f4cbbcaba47aa5d84d86013abbd45d95c6653866 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cpp-httplib_0.20.0-1/cpp-httplib-0.20.0.tar.gz -wrapdb_version = 0.20.0-1 -diff_files = cpp-httplib-0.20.0_mingw.diff +directory = cpp-httplib-0.20.1 +source_url = https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.20.1.tar.gz +source_filename = cpp-httplib-0.20.1.tar.gz +source_hash = b74b1c2c150be2841eba80192f64d93e9a6711985b3ae8aaa1a9cec4863d1dd9 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cpp-httplib_0.20.1-1/cpp-httplib-0.20.1.tar.gz +wrapdb_version = 0.20.1-1 +diff_files = cpp-httplib-0.20.1_mingw.diff [provide] cpp-httplib = cpp_httplib_dep diff --git a/subprojects/packagefiles/cpp-httplib-0.20.0_mingw.diff b/subprojects/packagefiles/cpp-httplib-0.20.1_mingw.diff similarity index 100% rename from subprojects/packagefiles/cpp-httplib-0.20.0_mingw.diff rename to subprojects/packagefiles/cpp-httplib-0.20.1_mingw.diff From 290ac67640585f27e215bfcd5d0847f11a7da217 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:22:07 +0200 Subject: [PATCH 02/22] chore: update fmt wrap to 11.2.0 --- subprojects/fmt.wrap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap index a1e2a6466..0961ce675 100644 --- a/subprojects/fmt.wrap +++ b/subprojects/fmt.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = fmt-11.1.1 -source_url = https://github.com/fmtlib/fmt/archive/11.1.1.tar.gz -source_filename = fmt-11.1.1.tar.gz -source_hash = 482eed9efbc98388dbaee5cb5f368be5eca4893456bb358c18b7ff71f835ae43 -patch_filename = fmt_11.1.1-2_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.1.1-2/get_patch -patch_hash = eee2e90d5d43061a0a1f0b9f8eb188c5b8820ef3e1b15e4b8a4eb791ef82b325 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.1.1-2/fmt-11.1.1.tar.gz -wrapdb_version = 11.1.1-2 +directory = fmt-11.2.0 +source_url = https://github.com/fmtlib/fmt/archive/11.2.0.tar.gz +source_filename = fmt-11.2.0.tar.gz +source_hash = bc23066d87ab3168f27cef3e97d545fa63314f5c79df5ea444d41d56f962c6af +patch_filename = fmt_11.2.0-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.2.0-1/get_patch +patch_hash = 645bf1c335a24608b4b34f16ed10b9237bbb0131488668fb86454202239e086c +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.2.0-1/fmt-11.2.0.tar.gz +wrapdb_version = 11.2.0-1 diff_files = fmt_dependency_override.diff, fmt_emscripten.diff [provide] From 8c69a4f67c56f64df0b4db7ef4e69dd4ae8dae26 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:22:26 +0200 Subject: [PATCH 03/22] chore: update icu wrap to 76.1 --- subprojects/icu.wrap | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/subprojects/icu.wrap b/subprojects/icu.wrap index 7132d12fb..da83b40d6 100644 --- a/subprojects/icu.wrap +++ b/subprojects/icu.wrap @@ -1,13 +1,13 @@ [wrap-file] directory = icu -source_url = https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz -source_filename = icu4c-76_1-src.tgz -source_hash = dfacb46bfe4747410472ce3e1144bf28a102feeaa4e3875bac9b4c6cf30f4f3e -patch_filename = icu_76.1-2_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/icu_76.1-2/get_patch -patch_hash = aa53ee7a3f742be81b597a7066d21777fcf9ab8f8793fa91b0565848854c27d6 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/icu_76.1-2/icu4c-76_1-src.tgz -wrapdb_version = 76.1-2 +source_url = https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz +source_filename = icu4c-77_1-src.tgz +source_hash = 588e431f77327c39031ffbb8843c0e3bc122c211374485fa87dc5f3faff24061 +patch_filename = icu_77.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/icu_77.1-1/get_patch +patch_hash = e74d6061fbb6c72f30fc8f755ed7a7780d8a35551630c71f4677a8e2b6a34547 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/icu_77.1-1/icu4c-77_1-src.tgz +wrapdb_version = 77.1-1 [provide] icu-uc = icuuc_dep From 4ae35d384a91b902e51eb530d5d5d6c925d84851 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:22:43 +0200 Subject: [PATCH 04/22] chore: update libpng wrap to 1.6.48 --- subprojects/libpng.wrap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subprojects/libpng.wrap b/subprojects/libpng.wrap index ec796cd88..08a840ba8 100644 --- a/subprojects/libpng.wrap +++ b/subprojects/libpng.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = libpng-1.6.47 -source_url = https://github.com/glennrp/libpng/archive/v1.6.47.tar.gz -source_filename = libpng-1.6.47.tar.gz -source_hash = 631a4c58ea6c10c81f160c4b21fa8495b715d251698ebc2552077e8450f30454 -patch_filename = libpng_1.6.47-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.47-1/get_patch -patch_hash = a21f619a39da40a215e6c0d51e92af173c14b5e958bad0c0069eb91a6b9b0a3d -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.47-1/libpng-1.6.47.tar.gz -wrapdb_version = 1.6.47-1 +directory = libpng-1.6.48 +source_url = https://github.com/glennrp/libpng/archive/v1.6.48.tar.gz +source_filename = libpng-1.6.48.tar.gz +source_hash = b17e99026055727e8cba99160c3a9a7f9af788e9f786daeadded5a42243f1dd0 +patch_filename = libpng_1.6.48-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.48-1/get_patch +patch_hash = 542b94272aa117186f91857ac9fe6efdedcd97e870cd06104361e99a56badcad +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.48-1/libpng-1.6.48.tar.gz +wrapdb_version = 1.6.48-1 [provide] libpng = libpng_dep From abe8ce7ad86c699c7aa58f7b7573215244b6dfc3 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:32:10 +0200 Subject: [PATCH 05/22] chore: update nlohmann_json wrap to 3.12.0 --- subprojects/nlohmann_json.wrap | 14 +++++++------- ....diff => nlohmann_json-3.12.0_installable.diff} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename subprojects/packagefiles/{nlohmann_json-3.11.3_installable.diff => nlohmann_json-3.12.0_installable.diff} (100%) diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap index a16e068a5..4a9b291b3 100644 --- a/subprojects/nlohmann_json.wrap +++ b/subprojects/nlohmann_json.wrap @@ -1,12 +1,12 @@ [wrap-file] -directory = nlohmann_json-3.11.3 +directory = nlohmann_json-3.12.0 lead_directory_missing = true -source_url = https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip -source_filename = nlohmann_json-3.11.3.zip -source_hash = a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.11.3-1/nlohmann_json-3.11.3.zip -wrapdb_version = 3.11.3-1 -diff_files = nlohmann_json-3.11.3_installable.diff +source_url = https://github.com/nlohmann/json/releases/download/v3.12.0/include.zip +source_filename = nlohmann_json-3.12.0.zip +source_hash = b8cb0ef2dd7f57f18933997c9934bb1fa962594f701cd5a8d3c2c80541559372 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.12.0-1/nlohmann_json-3.12.0.zip +wrapdb_version = 3.12.0-1 +diff_files = nlohmann_json-3.12.0_installable.diff [provide] nlohmann_json = nlohmann_json_dep diff --git a/subprojects/packagefiles/nlohmann_json-3.11.3_installable.diff b/subprojects/packagefiles/nlohmann_json-3.12.0_installable.diff similarity index 100% rename from subprojects/packagefiles/nlohmann_json-3.11.3_installable.diff rename to subprojects/packagefiles/nlohmann_json-3.12.0_installable.diff From 645d5eaa42f5bbd6c4c97c8118519057e4934f3c Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 12:32:31 +0200 Subject: [PATCH 06/22] chore: update spdlog wrap to 1.15.2 --- subprojects/spdlog.wrap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index cc0e0e11d..f7a436006 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = spdlog-1.15.1 -source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.15.1.tar.gz -source_filename = spdlog-1.15.1.tar.gz -source_hash = 25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc -patch_filename = spdlog_1.15.1-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.1-1/get_patch -patch_hash = 75a3787aeab73c3b7426197820d9cd92a4cdf0ea5c8bbb6701c0f55c66a0a6d0 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.1-1/spdlog-1.15.1.tar.gz -wrapdb_version = 1.15.1-1 +directory = spdlog-1.15.2 +source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.15.2.tar.gz +source_filename = spdlog-1.15.2.tar.gz +source_hash = 7a80896357f3e8e920e85e92633b14ba0f229c506e6f978578bdc35ba09e9a5d +patch_filename = spdlog_1.15.2-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch +patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz +wrapdb_version = 1.15.2-3 [provide] spdlog = spdlog_dep From a14fe0b20901af3ecb83e3438830f6fdb4ca9d13 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Wed, 14 May 2025 14:03:01 +0200 Subject: [PATCH 07/22] fix: fix the spdlog wrap error with newer fmt >= 11.2.0 --- .../spdlog_1.15.2_fmt_11.2.0_compatibility.diff | 12 ++++++++++++ subprojects/spdlog.wrap | 1 + 2 files changed, 13 insertions(+) create mode 100644 subprojects/packagefiles/spdlog_1.15.2_fmt_11.2.0_compatibility.diff diff --git a/subprojects/packagefiles/spdlog_1.15.2_fmt_11.2.0_compatibility.diff b/subprojects/packagefiles/spdlog_1.15.2_fmt_11.2.0_compatibility.diff new file mode 100644 index 000000000..4514e550b --- /dev/null +++ b/subprojects/packagefiles/spdlog_1.15.2_fmt_11.2.0_compatibility.diff @@ -0,0 +1,12 @@ +diff --git a/meson.build b/meson.build +index 18d34cd..1bb306c 100644 +--- a/meson.build ++++ b/meson.build +@@ -38,7 +38,6 @@ if get_option('compile_library') + spdlog_compile_args += '-DSPDLOG_SHARED_LIB' + spdlog_compile_args += '-Dspdlog_EXPORTS' + if not fmt_dep.found() +- spdlog_compile_args += '-DFMT_EXPORT' + spdlog_compile_args += '-DFMT_SHARED' + endif + endif diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index f7a436006..affce1517 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -8,6 +8,7 @@ patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz wrapdb_version = 1.15.2-3 +diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff [provide] spdlog = spdlog_dep From d2841530b2aae2bc5cea3481425448679d09ea92 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 00:14:40 +0200 Subject: [PATCH 08/22] feat: update discord social sdk to 1.2.873 --- subprojects/discord-social-sdk.wrap | 8 ++++---- ..._mingw.diff => discord_social_sdk-1.2.8730_mingw.diff} | 0 subprojects/packagefiles/discord_social_sdk/meson.build | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename subprojects/packagefiles/{discord_social_sdk-1.1.8318_mingw.diff => discord_social_sdk-1.2.8730_mingw.diff} (100%) diff --git a/subprojects/discord-social-sdk.wrap b/subprojects/discord-social-sdk.wrap index 7f2795fbf..780ae6807 100644 --- a/subprojects/discord-social-sdk.wrap +++ b/subprojects/discord-social-sdk.wrap @@ -1,10 +1,10 @@ [wrap-file] directory = discord_social_sdk -source_url = https://oopetris.totto.lt/static/assets/discord/DiscordSocialSdk-1.1.8318.zip -source_filename = DiscordSocialSdk-1.1.8318.zip -source_hash = e78ac5c6462d74917b74d2511ed88876f59dbe00d31186590a98ea7953099e31 +source_url = https://oopetris.totto.lt/static/assets/discord/DiscordSocialSdk-1.2.8730.zip +source_filename = DiscordSocialSdk-1.2.8730.zip +source_hash = f0a8158169c490116500dc338290c93720c27126fd817663b11c4e8ebfa9cc00 patch_directory = discord_social_sdk -diff_files = discord_social_sdk-1.1.8318_mingw.diff +diff_files = discord_social_sdk-1.2.8730_mingw.diff [provide] discord-social-sdk = discord_social_sdk_dep diff --git a/subprojects/packagefiles/discord_social_sdk-1.1.8318_mingw.diff b/subprojects/packagefiles/discord_social_sdk-1.2.8730_mingw.diff similarity index 100% rename from subprojects/packagefiles/discord_social_sdk-1.1.8318_mingw.diff rename to subprojects/packagefiles/discord_social_sdk-1.2.8730_mingw.diff diff --git a/subprojects/packagefiles/discord_social_sdk/meson.build b/subprojects/packagefiles/discord_social_sdk/meson.build index 5e31cf773..d9e4b75eb 100644 --- a/subprojects/packagefiles/discord_social_sdk/meson.build +++ b/subprojects/packagefiles/discord_social_sdk/meson.build @@ -2,7 +2,7 @@ project( 'discord-social-sdk', 'cpp', 'c', - version: '1.1.8318', + version: '1.2.8730', meson_version: '>=1.4.0', default_options: { 'cpp_std': ['c++17'], From 67b3e22d6fc52d930692a01a98b9aacc46053dea Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 00:26:15 +0200 Subject: [PATCH 09/22] fix: include string.h in file, where it was previously implictely included, but it isn't now --- src/helper/console_helpers.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helper/console_helpers.hpp b/src/helper/console_helpers.hpp index 9bcf5c439..7a6b4e42a 100644 --- a/src/helper/console_helpers.hpp +++ b/src/helper/console_helpers.hpp @@ -8,6 +8,8 @@ #include "./windows.hpp" +#include + namespace console { OOPETRIS_GRAPHICS_EXPORTED void debug_write(const char* text, size_t size); From 92efcba26478cc1854ca31b11845e2b782e1dc6d Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 00:34:44 +0200 Subject: [PATCH 10/22] fix: include in file, where it was previously implictely included, but it isn't now --- src/helper/platform.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helper/platform.cpp b/src/helper/platform.cpp index 64650b1e1..1fa042883 100644 --- a/src/helper/platform.cpp +++ b/src/helper/platform.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace { From ee45a781ab4b1b86b791ae2d0aa8b075c2947202 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 00:55:15 +0200 Subject: [PATCH 11/22] fix: fix mingw detection in windows specifix , as gcc 15 changed a few things --- src/helper/message_box.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helper/message_box.hpp b/src/helper/message_box.hpp index fce6f43d1..6d506f62d 100644 --- a/src/helper/message_box.hpp +++ b/src/helper/message_box.hpp @@ -13,7 +13,8 @@ namespace helper { -#ifdef _WIN32 +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \ + || defined(__MINGW64__) // "WinUser.h" defines "#define MessageBox MessageBoxA" // which breaks this valid code, I love windows xD. #ifdef MessageBox From f3e50e03ab51aa9f2de522dcb2bbd058db53af15 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 01:13:31 +0200 Subject: [PATCH 12/22] fix: fix linker errors in the newest MSVC releases --- .../spdlog_1.15.2_linker_errors_msvc.diff | 22 +++++++++++++++++++ subprojects/spdlog.wrap | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff diff --git a/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff b/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff new file mode 100644 index 000000000..847c502fd --- /dev/null +++ b/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff @@ -0,0 +1,22 @@ +diff --git a/src/meson.build b/src/meson.build +index 969963c..dc11467 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -13,12 +13,16 @@ endif + + version_parts = meson.project_version().split('.') + ++cpp = meson.get_compiler('cpp') ++private_arguments = cpp.get_supported_arguments('/IGNORE:4275') ++ ++ + spdlog_lib = library( + 'spdlog', + src, + include_directories: inc, + dependencies: spdlog_dependencies, +- cpp_args: spdlog_compile_args, ++ cpp_args: spdlog_compile_args + private_arguments, + soversion: version_parts[0] + '.' + version_parts[1], + version: meson.project_version(), + install: true, diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index affce1517..932d5d934 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -8,7 +8,7 @@ patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz wrapdb_version = 1.15.2-3 -diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff +diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff [provide] spdlog = spdlog_dep From 81345e2581dd8feb0f8b3504b9cda752fa510897 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 10:23:44 +0200 Subject: [PATCH 13/22] fix: fix 3ds compilation, by correctly disabling TLS in spdlog --- .../spdlog_1.15.2_no_tls_option.diff | 29 +++++++++++++++++++ subprojects/spdlog.wrap | 2 +- tools/dependencies/meson.build | 13 +++++---- 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 subprojects/packagefiles/spdlog_1.15.2_no_tls_option.diff diff --git a/subprojects/packagefiles/spdlog_1.15.2_no_tls_option.diff b/subprojects/packagefiles/spdlog_1.15.2_no_tls_option.diff new file mode 100644 index 000000000..881d76e83 --- /dev/null +++ b/subprojects/packagefiles/spdlog_1.15.2_no_tls_option.diff @@ -0,0 +1,29 @@ +diff --git a/meson.build b/meson.build +index 1bb306c..dbc08b3 100644 +--- a/meson.build ++++ b/meson.build +@@ -32,6 +32,10 @@ else + spdlog_compile_args += '-DSPDLOG_FMT_EXTERNAL' + endif + ++if get_option('no_tls') ++spdlog_compile_args += '-DSPDLOG_NO_TLS' ++endif ++ + if get_option('compile_library') + spdlog_compile_args += '-DSPDLOG_COMPILED_LIB' + if get_option('default_library') != 'static' +diff --git a/meson_options.txt b/meson_options.txt +index 33dc985..08e844d 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -15,3 +15,9 @@ option( + type: 'feature', + description: 'Use std::format instead of internal fmt lib', + ) ++option( ++ 'no_tls', ++ type: 'boolean', ++ value: false, ++ description: 'prevent spdlog from using thread local storage', ++) diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index 932d5d934..b462427bc 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -8,7 +8,7 @@ patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz wrapdb_version = 1.15.2-3 -diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff +diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff,spdlog_1.15.2_no_tls_option.diff [provide] spdlog = spdlog_dep diff --git a/tools/dependencies/meson.build b/tools/dependencies/meson.build index 6a7b4b38c..6ee8a3857 100644 --- a/tools/dependencies/meson.build +++ b/tools/dependencies/meson.build @@ -373,23 +373,24 @@ if build_application 'compile_args': [graphics_lib.get('compile_args'), sdl2_mixer_defines], } + spdlog_no_tls = false + + if (meson.is_cross_build() and host_machine.system() == '3ds') + spdlog_no_tls = true + endif + spdlog_dep = dependency( 'spdlog', required: true, default_options: { 'tests': 'disabled', + 'no_tls': spdlog_no_tls, }, ) graphics_lib += { 'deps': [graphics_lib.get('deps'), spdlog_dep], } - if (meson.is_cross_build() and host_machine.system() == '3ds') - graphics_lib += { - 'compile_args': [graphics_lib.get('compile_args'), '-DSPDLOG_NO_TLS'], - } - endif - cpp_httlib_dep = dependency( 'cpp-httplib', required: false, From 5646370aff5e6808891ba48429b978107395511e Mon Sep 17 00:00:00 2001 From: "Totto16 (Windows VM)" Date: Thu, 15 May 2025 12:02:33 +0200 Subject: [PATCH 14/22] fix: fix include ordering in message_box in MSYS2 --- src/helper/message_box.hpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/helper/message_box.hpp b/src/helper/message_box.hpp index 6d506f62d..ad51be50d 100644 --- a/src/helper/message_box.hpp +++ b/src/helper/message_box.hpp @@ -13,16 +13,6 @@ namespace helper { -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \ - || defined(__MINGW64__) - // "WinUser.h" defines "#define MessageBox MessageBoxA" - // which breaks this valid code, I love windows xD. -#ifdef MessageBox -#undef MessageBox -#endif -#endif - - struct MessageBox { enum class Type : u8 { Error, Warning, Information }; @@ -36,4 +26,16 @@ namespace helper { }; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \ + || defined(__MINGW64__) + // "WinUser.h" defines "#define MessageBox MessageBoxA" + // which breaks this valid code, I love windows xD. +#ifdef MessageBox +#undef MessageBox +#endif +// this is to fix include order, if we include windows.h after this, it also works +using MessageBoxA = MessageBox; +#endif + + } // namespace helper From 5a2afa3107413f4548698c56305e382f64057f21 Mon Sep 17 00:00:00 2001 From: "Totto16 (Windows VM)" Date: Thu, 15 May 2025 12:17:30 +0200 Subject: [PATCH 15/22] fix: correctly define exported attributes in MSYS2 gcc 15 in mingw64 changed some things, and now we need more define cheks, to correctly link the library with MSYS2 --- src/helper/windows.hpp | 4 ++-- src/libs/core/hash-library/sha256.h | 4 ++-- src/libs/core/helper/windows.hpp | 4 ++-- src/libs/recordings/utility/windows.hpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/helper/windows.hpp b/src/helper/windows.hpp index ac04f70e0..1ab81db9a 100644 --- a/src/helper/windows.hpp +++ b/src/helper/windows.hpp @@ -1,6 +1,6 @@ #pragma once -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT) #define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllexport) @@ -8,7 +8,7 @@ #define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllimport) #endif #else -#define OOPETRIS_GRAPHICS_EXPORTED +#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((visibility("default"))) #endif #else #define OOPETRIS_GRAPHICS_EXPORTED diff --git a/src/libs/core/hash-library/sha256.h b/src/libs/core/hash-library/sha256.h index 23e1c6601..d56851c97 100644 --- a/src/libs/core/hash-library/sha256.h +++ b/src/libs/core/hash-library/sha256.h @@ -12,7 +12,7 @@ #include // define fixed size integer types -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) // Windows typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; @@ -25,7 +25,7 @@ typedef unsigned __int64 uint64_t; #define HASH_LIBRARY_EXPORTED __declspec(dllimport) #endif #else -#define HASH_LIBRARY_EXPORTED +#define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) #endif #else diff --git a/src/libs/core/helper/windows.hpp b/src/libs/core/helper/windows.hpp index 6929e7a60..1f2aec557 100644 --- a/src/libs/core/helper/windows.hpp +++ b/src/libs/core/helper/windows.hpp @@ -1,6 +1,6 @@ #pragma once -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0 #if defined(OOPETRIS_LIBRARY_CORE_EXPORT) #define OOPETRIS_CORE_EXPORTED __declspec(dllexport) @@ -8,7 +8,7 @@ #define OOPETRIS_CORE_EXPORTED __declspec(dllimport) #endif #else -#define OOPETRIS_CORE_EXPORTED +#define OOPETRIS_CORE_EXPORTED __attribute__((visibility("default"))) #endif #else #define OOPETRIS_CORE_EXPORTED diff --git a/src/libs/recordings/utility/windows.hpp b/src/libs/recordings/utility/windows.hpp index 4d0d4a089..ac970938a 100644 --- a/src/libs/recordings/utility/windows.hpp +++ b/src/libs/recordings/utility/windows.hpp @@ -1,6 +1,6 @@ #pragma once -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT) #define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllexport) @@ -8,7 +8,7 @@ #define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllimport) #endif #else -#define OOPETRIS_RECORDINGS_EXPORTED +#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((visibility("default"))) #endif #else #define OOPETRIS_RECORDINGS_EXPORTED From 557b2054a328b9e13eb619c970d1860e98f6435f Mon Sep 17 00:00:00 2001 From: "Totto16 (Windows VM)" Date: Thu, 15 May 2025 12:55:35 +0200 Subject: [PATCH 16/22] fix: correctyl dect MSYS2 in EXPORT declarations --- src/helper/graphic_utils.hpp | 10 +++++++++- src/helper/windows.hpp | 8 ++++++++ src/libs/core/hash-library/sha256.h | 8 ++++++++ src/libs/core/helper/windows.hpp | 8 ++++++++ src/libs/recordings/utility/windows.hpp | 8 ++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/helper/graphic_utils.hpp b/src/helper/graphic_utils.hpp index 0c525a982..9668818e1 100644 --- a/src/helper/graphic_utils.hpp +++ b/src/helper/graphic_utils.hpp @@ -50,13 +50,21 @@ namespace utils { #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT) +#if defined(__GNUC__) +#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __attribute__((dllexport, noreturn)) +#else #define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(dllexport, noreturn) +#endif +#else +#if defined(__GNUC__) +#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __attribute__((dllimport, noreturn)) #else #define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(dllimport, noreturn) #endif +#endif #else #define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(noreturn) #endif diff --git a/src/helper/windows.hpp b/src/helper/windows.hpp index 1ab81db9a..2022348f6 100644 --- a/src/helper/windows.hpp +++ b/src/helper/windows.hpp @@ -3,10 +3,18 @@ #if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT) +#if defined(__GNUC__) +#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((dllexport)) +#else #define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllexport) +#endif +#else +#if defined(__GNUC__) +#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((dllimport)) #else #define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllimport) #endif +#endif #else #define OOPETRIS_GRAPHICS_EXPORTED __attribute__((visibility("default"))) #endif diff --git a/src/libs/core/hash-library/sha256.h b/src/libs/core/hash-library/sha256.h index d56851c97..360a88379 100644 --- a/src/libs/core/hash-library/sha256.h +++ b/src/libs/core/hash-library/sha256.h @@ -20,10 +20,18 @@ typedef unsigned __int64 uint64_t; #if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0 #if defined(OOPETRIS_LIBRARY_CORE_EXPORT) +#if defined(__GNUC__) +#define HASH_LIBRARY_EXPORTED __attribute__((dllexport)) +#else #define HASH_LIBRARY_EXPORTED __declspec(dllexport) +#endif +#else +#if defined(__GNUC__) +#define HASH_LIBRARY_EXPORTED __attribute__((dllimport)) #else #define HASH_LIBRARY_EXPORTED __declspec(dllimport) #endif +#endif #else #define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) #endif diff --git a/src/libs/core/helper/windows.hpp b/src/libs/core/helper/windows.hpp index 1f2aec557..4622d8b54 100644 --- a/src/libs/core/helper/windows.hpp +++ b/src/libs/core/helper/windows.hpp @@ -3,10 +3,18 @@ #if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0 #if defined(OOPETRIS_LIBRARY_CORE_EXPORT) +#if defined(__GNUC__) +#define OOPETRIS_CORE_EXPORTED __attribute__((dllexport)) +#else #define OOPETRIS_CORE_EXPORTED __declspec(dllexport) +#endif +#else +#if defined(__GNUC__) +#define OOPETRIS_CORE_EXPORTED __attribute__((dllimport)) #else #define OOPETRIS_CORE_EXPORTED __declspec(dllimport) #endif +#endif #else #define OOPETRIS_CORE_EXPORTED __attribute__((visibility("default"))) #endif diff --git a/src/libs/recordings/utility/windows.hpp b/src/libs/recordings/utility/windows.hpp index ac970938a..4047e6985 100644 --- a/src/libs/recordings/utility/windows.hpp +++ b/src/libs/recordings/utility/windows.hpp @@ -3,10 +3,18 @@ #if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT) +#if defined(__GNUC__) +#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((dllexport)) +#else #define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllexport) +#endif +#else +#if defined(__GNUC__) +#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((dllimport)) #else #define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllimport) #endif +#endif #else #define OOPETRIS_RECORDINGS_EXPORTED __attribute__((visibility("default"))) #endif From ceaf6ddb06fbee507cf4036633b4bc0551ab1531 Mon Sep 17 00:00:00 2001 From: "Totto16 (Windows VM)" Date: Thu, 15 May 2025 14:18:35 +0200 Subject: [PATCH 17/22] fix: fix spdlog errors under msvc see https://github.com/gabime/spdlog/issues/3143 --- src/discord/core.cpp | 3 +-- src/executables/game/application.cpp | 1 + src/executables/game/main.cpp | 11 ++++++++++ src/executables/game/parser.cpp | 2 +- src/game/game.cpp | 1 + src/game/grid.cpp | 2 +- src/game/simulated_tetrion.cpp | 2 +- src/game/simulation.cpp | 2 +- src/game/tetrion.cpp | 2 +- src/graphics/texture.cpp | 2 +- src/graphics/texture.hpp | 1 - src/helper/clock_source.cpp | 2 +- src/helper/graphic_utils.cpp | 1 + src/helper/graphic_utils.hpp | 1 - src/helper/platform.cpp | 2 +- src/helper/web_utils.hpp | 2 +- src/input/controller_input.cpp | 2 +- src/input/game_input.cpp | 2 +- src/input/input.cpp | 2 +- src/input/input_creator.cpp | 2 +- src/input/joystick_input.cpp | 2 +- src/input/replay_input.cpp | 2 +- src/input/touch_input.cpp | 2 +- src/libs/core/helper/meson.build | 3 ++- src/libs/core/helper/spdlog_wrapper.hpp | 14 ++++++++++++ src/lobby/api.cpp | 2 +- src/lobby/credentials/secret.cpp | 2 +- src/manager/music_manager.cpp | 2 +- src/manager/settings.cpp | 2 +- src/manager/settings_manager.cpp | 2 +- src/scenes/settings_menu/settings_menu.cpp | 2 +- src/ui/components/abstract_slider.hpp | 1 - src/ui/components/button.hpp | 2 +- src/ui/components/link_label.cpp | 2 +- src/ui/components/link_label.hpp | 1 - src/ui/components/slider.hpp | 1 - .../spdlog_1.15.2_linker_errors_msvc.diff | 22 ------------------- subprojects/spdlog.wrap | 2 +- 38 files changed, 56 insertions(+), 55 deletions(-) create mode 100644 src/libs/core/helper/spdlog_wrapper.hpp delete mode 100644 subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff diff --git a/src/discord/core.cpp b/src/discord/core.cpp index c0b86a23e..b0938735b 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -4,8 +4,7 @@ #include "./core.hpp" #include -#include - +#include [[nodiscard]] std::string constants::discord ::get_asset_key(constants::discord::ArtAsset asset) { diff --git a/src/executables/game/application.cpp b/src/executables/game/application.cpp index 600e3f0b0..0a62b1a9a 100644 --- a/src/executables/game/application.cpp +++ b/src/executables/game/application.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #if defined(__CONSOLE__) #include "helper/console_helpers.hpp" diff --git a/src/executables/game/main.cpp b/src/executables/game/main.cpp index 4800a171c..637f628a2 100644 --- a/src/executables/game/main.cpp +++ b/src/executables/game/main.cpp @@ -28,10 +28,21 @@ #include "helper/web_utils.hpp" #endif + +#if defined(_MSC_VER) +#pragma warning(disable : 4275) +#pragma warning(disable : 4251) +#endif + +#include #include #include #include +#if defined(_MSC_VER) +#pragma warning(default : 4275) +#pragma warning(default : 4251) +#endif namespace { void initialize_spdlog() { diff --git a/src/executables/game/parser.cpp b/src/executables/game/parser.cpp index e950df285..6cd5a9043 100644 --- a/src/executables/game/parser.cpp +++ b/src/executables/game/parser.cpp @@ -10,7 +10,7 @@ #include -#include +#include helper::expected helper::parse_args(const std::vector& arguments) { diff --git a/src/game/game.cpp b/src/game/game.cpp index c44ee8bdd..1749a78dd 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "game.hpp" #include "input/replay_input.hpp" diff --git a/src/game/grid.cpp b/src/game/grid.cpp index d13652149..d0251e467 100644 --- a/src/game/grid.cpp +++ b/src/game/grid.cpp @@ -1,7 +1,7 @@ #include "grid.hpp" #include "graphics/renderer.hpp" -#include +#include Grid::Grid(const ui::Layout& layout, bool is_top_level) : ui::Widget{ layout, ui::WidgetType::Component, is_top_level } { diff --git a/src/game/simulated_tetrion.cpp b/src/game/simulated_tetrion.cpp index 8abc8943a..691b79a49 100644 --- a/src/game/simulated_tetrion.cpp +++ b/src/game/simulated_tetrion.cpp @@ -9,7 +9,7 @@ #include "simulated_tetrion.hpp" #include -#include +#include SimulatedTetrion::SimulatedTetrion( diff --git a/src/game/simulation.cpp b/src/game/simulation.cpp index 13f471d69..73fbf6c41 100644 --- a/src/game/simulation.cpp +++ b/src/game/simulation.cpp @@ -6,7 +6,7 @@ #include "input/replay_input.hpp" #include "simulation.hpp" -#include +#include Simulation::Simulation( diff --git a/src/game/tetrion.cpp b/src/game/tetrion.cpp index 9fce86f4d..c243269aa 100644 --- a/src/game/tetrion.cpp +++ b/src/game/tetrion.cpp @@ -8,7 +8,7 @@ #include "tetrion.hpp" #include "ui/components/label.hpp" -#include +#include #include diff --git a/src/graphics/texture.cpp b/src/graphics/texture.cpp index 0ec8e501b..a4cba02f4 100644 --- a/src/graphics/texture.cpp +++ b/src/graphics/texture.cpp @@ -2,7 +2,7 @@ #include "helper/graphic_utils.hpp" #include "texture.hpp" - +#include Texture::Texture(SDL_Texture* raw_texture) : m_raw_texture{ raw_texture } { } diff --git a/src/graphics/texture.hpp b/src/graphics/texture.hpp index d2b18c0ef..de5d544ea 100644 --- a/src/graphics/texture.hpp +++ b/src/graphics/texture.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include enum class RenderType : u8 { Solid, Blended, Shaded }; diff --git a/src/helper/clock_source.cpp b/src/helper/clock_source.cpp index 385d8247c..ae4652bcd 100644 --- a/src/helper/clock_source.cpp +++ b/src/helper/clock_source.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace { [[nodiscard]] double elapsed_time() { diff --git a/src/helper/graphic_utils.cpp b/src/helper/graphic_utils.cpp index 2e7c20952..01f6de4b7 100644 --- a/src/helper/graphic_utils.cpp +++ b/src/helper/graphic_utils.cpp @@ -1,6 +1,7 @@ #include "graphic_utils.hpp" #include +#include #if defined(__EMSCRIPTEN__) #include diff --git a/src/helper/graphic_utils.hpp b/src/helper/graphic_utils.hpp index 9668818e1..81f5a7fb0 100644 --- a/src/helper/graphic_utils.hpp +++ b/src/helper/graphic_utils.hpp @@ -8,7 +8,6 @@ #include #include -#include namespace utils { diff --git a/src/helper/platform.cpp b/src/helper/platform.cpp index 1fa042883..98de01dce 100644 --- a/src/helper/platform.cpp +++ b/src/helper/platform.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace { diff --git a/src/helper/web_utils.hpp b/src/helper/web_utils.hpp index 23c36a040..251c96d1e 100644 --- a/src/helper/web_utils.hpp +++ b/src/helper/web_utils.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/src/input/controller_input.cpp b/src/input/controller_input.cpp index 5841a542f..fdb5f185f 100644 --- a/src/input/controller_input.cpp +++ b/src/input/controller_input.cpp @@ -7,7 +7,7 @@ #include "manager/sdl_controller_key.hpp" -#include +#include input::ControllerInput::ControllerInput( SDL_GameController* controller, diff --git a/src/input/game_input.cpp b/src/input/game_input.cpp index 1b7ac4f1e..9d2aa7ef5 100644 --- a/src/input/game_input.cpp +++ b/src/input/game_input.cpp @@ -2,7 +2,7 @@ #include "input.hpp" #include "manager/event_dispatcher.hpp" -#include +#include void input::GameInput::handle_event(const InputEvent event, const SimulationStep simulation_step_index) { diff --git a/src/input/input.cpp b/src/input/input.cpp index fc3923ba3..aa985b7b3 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/input/input_creator.cpp b/src/input/input_creator.cpp index 93a3e8f40..a5a98c545 100644 --- a/src/input/input_creator.cpp +++ b/src/input/input_creator.cpp @@ -13,7 +13,7 @@ #include "input_creator.hpp" #include -#include +#include #include namespace { diff --git a/src/input/joystick_input.cpp b/src/input/joystick_input.cpp index 6608fb667..6a5d5a84e 100644 --- a/src/input/joystick_input.cpp +++ b/src/input/joystick_input.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include input::JoystickLikeInput::JoystickLikeInput(SDL_JoystickID instance_id, const std::string& name, JoystickLikeType type) diff --git a/src/input/replay_input.cpp b/src/input/replay_input.cpp index 5913ffc0a..7aed706ba 100644 --- a/src/input/replay_input.cpp +++ b/src/input/replay_input.cpp @@ -1,7 +1,7 @@ #include "replay_input.hpp" #include "game/tetrion.hpp" #include - +#include input::ReplayGameInput::ReplayGameInput( std::shared_ptr recording_reader, diff --git a/src/input/touch_input.cpp b/src/input/touch_input.cpp index b7654f01d..a7fa8e638 100644 --- a/src/input/touch_input.cpp +++ b/src/input/touch_input.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include void input::TouchGameInput::handle_event(const SDL_Event& event) { diff --git a/src/libs/core/helper/meson.build b/src/libs/core/helper/meson.build index 543f40793..6a65c8dd3 100644 --- a/src/libs/core/helper/meson.build +++ b/src/libs/core/helper/meson.build @@ -11,8 +11,8 @@ core_src_files += files( _header_files = files( 'bool_wrapper.hpp', - 'color.hpp', 'color_literals.hpp', + 'color.hpp', 'const_utils.hpp', 'date.hpp', 'errors.hpp', @@ -23,6 +23,7 @@ _header_files = files( 'point.hpp', 'random.hpp', 'sleep.hpp', + 'spdlog_wrapper.hpp', 'static_string.hpp', 'string_manipulation.hpp', 'timer.hpp', diff --git a/src/libs/core/helper/spdlog_wrapper.hpp b/src/libs/core/helper/spdlog_wrapper.hpp new file mode 100644 index 000000000..378e2e7b1 --- /dev/null +++ b/src/libs/core/helper/spdlog_wrapper.hpp @@ -0,0 +1,14 @@ +#pragma once + +#if defined(_MSC_VER) +#pragma warning(disable : 4275) +#pragma warning(disable : 4251) +#endif + +#include + + +#if defined(_MSC_VER) +#pragma warning(default : 4275) +#pragma warning(default : 4251) +#endif diff --git a/src/lobby/api.cpp b/src/lobby/api.cpp index 72dcc7aa3..01112d01c 100644 --- a/src/lobby/api.cpp +++ b/src/lobby/api.cpp @@ -3,7 +3,7 @@ #include "api.hpp" #include -#include +#include #if !defined(_OOPETRIS_ONLINE_SYSTEM) #error "_OOPETRIS_ONLINE_SYSTEM has to be defined" diff --git a/src/lobby/credentials/secret.cpp b/src/lobby/credentials/secret.cpp index 8529dd941..390b14727 100644 --- a/src/lobby/credentials/secret.cpp +++ b/src/lobby/credentials/secret.cpp @@ -151,7 +151,7 @@ secret::SecretStorage::store(const std::string& key, const Buffer& value, bool u #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #include -#include +#include #ifndef NOMINMAX #define NOMINMAX diff --git a/src/manager/music_manager.cpp b/src/manager/music_manager.cpp index 7ff6ace37..34fecda65 100644 --- a/src/manager/music_manager.cpp +++ b/src/manager/music_manager.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/manager/settings.cpp b/src/manager/settings.cpp index a7d9ac8f3..e5f7dba7c 100644 --- a/src/manager/settings.cpp +++ b/src/manager/settings.cpp @@ -4,7 +4,7 @@ #include "input/touch_input.hpp" -#include +#include void settings::to_json(nlohmann::json& obj, const settings::Settings& settings) { diff --git a/src/manager/settings_manager.cpp b/src/manager/settings_manager.cpp index 77a5e7e2a..4198153c4 100644 --- a/src/manager/settings_manager.cpp +++ b/src/manager/settings_manager.cpp @@ -2,7 +2,7 @@ #include "helper/graphic_utils.hpp" #include "input/keyboard_input.hpp" #include "input/touch_input.hpp" - +#include #if defined(__EMSCRIPTEN__) #include "helper/web_utils.hpp" diff --git a/src/scenes/settings_menu/settings_menu.cpp b/src/scenes/settings_menu/settings_menu.cpp index b5f1c7c1b..c2543af25 100644 --- a/src/scenes/settings_menu/settings_menu.cpp +++ b/src/scenes/settings_menu/settings_menu.cpp @@ -13,7 +13,7 @@ #include "ui/components/text_button.hpp" #include "ui/layouts/scroll_layout.hpp" -#include +#include namespace scenes { diff --git a/src/ui/components/abstract_slider.hpp b/src/ui/components/abstract_slider.hpp index 549342643..1eaddde57 100644 --- a/src/ui/components/abstract_slider.hpp +++ b/src/ui/components/abstract_slider.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/src/ui/components/button.hpp b/src/ui/components/button.hpp index e89ae33ff..87f0c3bb4 100644 --- a/src/ui/components/button.hpp +++ b/src/ui/components/button.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include "graphics/rect.hpp" diff --git a/src/ui/components/link_label.cpp b/src/ui/components/link_label.cpp index 0dff0ffd5..c785c51d8 100644 --- a/src/ui/components/link_label.cpp +++ b/src/ui/components/link_label.cpp @@ -1,7 +1,7 @@ #include "link_label.hpp" #include "helper/platform.hpp" - +#include ui::LinkLabel::LinkLabel( ServiceProvider* service_provider, diff --git a/src/ui/components/link_label.hpp b/src/ui/components/link_label.hpp index 20c9b9ff3..cd04a0d96 100644 --- a/src/ui/components/link_label.hpp +++ b/src/ui/components/link_label.hpp @@ -4,7 +4,6 @@ #include "ui/hoverable.hpp" #include "ui/widget.hpp" -#include #include namespace ui { diff --git a/src/ui/components/slider.hpp b/src/ui/components/slider.hpp index ed0a95f36..c6e2bc77f 100644 --- a/src/ui/components/slider.hpp +++ b/src/ui/components/slider.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include "abstract_slider.hpp" diff --git a/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff b/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff deleted file mode 100644 index 847c502fd..000000000 --- a/subprojects/packagefiles/spdlog_1.15.2_linker_errors_msvc.diff +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/src/meson.build b/src/meson.build -index 969963c..dc11467 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -13,12 +13,16 @@ endif - - version_parts = meson.project_version().split('.') - -+cpp = meson.get_compiler('cpp') -+private_arguments = cpp.get_supported_arguments('/IGNORE:4275') -+ -+ - spdlog_lib = library( - 'spdlog', - src, - include_directories: inc, - dependencies: spdlog_dependencies, -- cpp_args: spdlog_compile_args, -+ cpp_args: spdlog_compile_args + private_arguments, - soversion: version_parts[0] + '.' + version_parts[1], - version: meson.project_version(), - install: true, diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index b462427bc..a43c59378 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -8,7 +8,7 @@ patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz wrapdb_version = 1.15.2-3 -diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff,spdlog_1.15.2_no_tls_option.diff +diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_no_tls_option.diff [provide] spdlog = spdlog_dep From d9c0947d9f984474a729ba4a5ac4d2426fa1bce5 Mon Sep 17 00:00:00 2001 From: "Totto16 (Windows VM)" Date: Thu, 15 May 2025 16:11:08 +0200 Subject: [PATCH 18/22] fix: fix implementation of exported methods msvc doesn't care, if I say dllimport ona definition, but MSYS2 requires the definition and declaration to be seperated, when I use dllimports / exports this mainyl is the case for = delete functions and some missed implementations, that were still in .hpp files --- src/discord/core.hpp | 4 ++-- src/graphics/renderer.hpp | 4 ++-- src/graphics/sdl_context.hpp | 8 ++++---- src/graphics/texture.hpp | 4 ++-- src/graphics/window.hpp | 8 ++++---- src/helper/graphic_utils.hpp | 1 + src/input/game_input.cpp | 11 +++++++++++ src/input/game_input.hpp | 13 ++++++------- src/input/joystick_input.hpp | 4 ++-- src/input/touch_input.cpp | 19 ++++++++++++++----- src/input/touch_input.hpp | 27 +++++++++++++-------------- src/libs/core/game/mino.hpp | 2 +- src/lobby/api.hpp | 6 +++--- src/lobby/credentials/buffer.hpp | 8 +++++--- src/lobby/credentials/secret.hpp | 6 +++--- src/manager/font.cpp | 3 +++ src/manager/font.hpp | 2 +- src/manager/music_manager.hpp | 8 ++++---- src/ui/layout.cpp | 4 ++++ src/ui/layout.hpp | 9 +++------ 20 files changed, 88 insertions(+), 63 deletions(-) diff --git a/src/discord/core.hpp b/src/discord/core.hpp index 016d22c29..7550f6afa 100644 --- a/src/discord/core.hpp +++ b/src/discord/core.hpp @@ -137,9 +137,9 @@ struct DiscordInstance { OOPETRIS_GRAPHICS_EXPORTED DiscordInstance& operator=(DiscordInstance&& other) noexcept; - OOPETRIS_GRAPHICS_EXPORTED DiscordInstance(DiscordInstance& old) noexcept = delete; + DiscordInstance(DiscordInstance& old) noexcept = delete; - OOPETRIS_GRAPHICS_EXPORTED DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete; + DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete; OOPETRIS_GRAPHICS_EXPORTED ~DiscordInstance(); diff --git a/src/graphics/renderer.hpp b/src/graphics/renderer.hpp index 13dd0d962..96b05011b 100644 --- a/src/graphics/renderer.hpp +++ b/src/graphics/renderer.hpp @@ -24,8 +24,8 @@ struct Renderer final { public: OOPETRIS_GRAPHICS_EXPORTED explicit Renderer(const Window& window, VSync v_sync); - OOPETRIS_GRAPHICS_EXPORTED Renderer(const Renderer&) = delete; - OOPETRIS_GRAPHICS_EXPORTED Renderer& operator=(const Renderer&) = delete; + Renderer(const Renderer&) = delete; + Renderer& operator=(const Renderer&) = delete; OOPETRIS_GRAPHICS_EXPORTED ~Renderer(); OOPETRIS_GRAPHICS_EXPORTED void set_draw_color(const Color& color) const; diff --git a/src/graphics/sdl_context.hpp b/src/graphics/sdl_context.hpp index 98f583d58..f192f2d13 100644 --- a/src/graphics/sdl_context.hpp +++ b/src/graphics/sdl_context.hpp @@ -4,9 +4,9 @@ struct SdlContext final { OOPETRIS_GRAPHICS_EXPORTED SdlContext(); - OOPETRIS_GRAPHICS_EXPORTED SdlContext(const SdlContext&) = delete; - OOPETRIS_GRAPHICS_EXPORTED SdlContext(SdlContext&&) = delete; - OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(const SdlContext&) = delete; - OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(SdlContext&&) = delete; + SdlContext(const SdlContext&) = delete; + SdlContext(SdlContext&&) = delete; + SdlContext& operator=(const SdlContext&) = delete; + SdlContext& operator=(SdlContext&&) = delete; OOPETRIS_GRAPHICS_EXPORTED ~SdlContext(); }; diff --git a/src/graphics/texture.hpp b/src/graphics/texture.hpp index de5d544ea..3899d7913 100644 --- a/src/graphics/texture.hpp +++ b/src/graphics/texture.hpp @@ -39,8 +39,8 @@ struct Texture { OOPETRIS_GRAPHICS_EXPORTED static Texture get_for_render_target(SDL_Renderer* renderer, const shapes::UPoint& size); - OOPETRIS_GRAPHICS_EXPORTED Texture(const Texture&) = delete; - OOPETRIS_GRAPHICS_EXPORTED Texture& operator=(const Texture&) = delete; + Texture(const Texture&) = delete; + Texture& operator=(const Texture&) = delete; OOPETRIS_GRAPHICS_EXPORTED Texture(Texture&& old) noexcept; diff --git a/src/graphics/window.hpp b/src/graphics/window.hpp index d9db16ff1..93c63a920 100644 --- a/src/graphics/window.hpp +++ b/src/graphics/window.hpp @@ -25,10 +25,10 @@ struct Window final { OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, u32 x_pos, u32 y_pos, u32 width, u32 height); OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, WindowPosition position); OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, u32 x_pos, u32 y_pos); - OOPETRIS_GRAPHICS_EXPORTED Window(const Window&) = delete; - OOPETRIS_GRAPHICS_EXPORTED Window(Window&&) = delete; - OOPETRIS_GRAPHICS_EXPORTED Window& operator=(const Window&) = delete; - OOPETRIS_GRAPHICS_EXPORTED Window& operator=(Window&&) = delete; + Window(const Window&) = delete; + Window(Window&&) = delete; + Window& operator=(const Window&) = delete; + Window& operator=(Window&&) = delete; OOPETRIS_GRAPHICS_EXPORTED ~Window(); OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint size() const; diff --git a/src/helper/graphic_utils.hpp b/src/helper/graphic_utils.hpp index 81f5a7fb0..a57356348 100644 --- a/src/helper/graphic_utils.hpp +++ b/src/helper/graphic_utils.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace utils { diff --git a/src/input/game_input.cpp b/src/input/game_input.cpp index 9d2aa7ef5..c072d7a35 100644 --- a/src/input/game_input.cpp +++ b/src/input/game_input.cpp @@ -73,6 +73,12 @@ void input::GameInput::handle_event(const InputEvent event, const SimulationStep } } +input::GameInput::GameInput(GameInput&&) = default; + +input::GameInput& input::GameInput::operator=(GameInput&&) = default; + +input::GameInput::~GameInput() = default; + void input::GameInput::update(const SimulationStep simulation_step_index) { const auto current_simulation_step_index = simulation_step_index; @@ -97,3 +103,8 @@ void input::GameInput::update(const SimulationStep simulation_step_index) { } } } + + +void input::GameInput::late_update(SimulationStep /*simulation_step*/) { + //do nothing, is expected here, this is virtual, so if there is soemthing to do, it gets overridden +} diff --git a/src/input/game_input.hpp b/src/input/game_input.hpp index dd1705681..96fc728f8 100644 --- a/src/input/game_input.hpp +++ b/src/input/game_input.hpp @@ -65,17 +65,16 @@ namespace input { } public: - OOPETRIS_GRAPHICS_EXPORTED GameInput(const GameInput&) = delete; - OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(const GameInput&) = delete; + GameInput(const GameInput&) = delete; + GameInput& operator=(const GameInput&) = delete; - OOPETRIS_GRAPHICS_EXPORTED GameInput(GameInput&&) = default; - OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(GameInput&&) = default; - - OOPETRIS_GRAPHICS_EXPORTED virtual ~GameInput() = default; + OOPETRIS_GRAPHICS_EXPORTED GameInput(GameInput&&); + OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(GameInput&&); + OOPETRIS_GRAPHICS_EXPORTED virtual ~GameInput(); OOPETRIS_GRAPHICS_EXPORTED virtual void update(SimulationStep simulation_step_index); - OOPETRIS_GRAPHICS_EXPORTED virtual void late_update(SimulationStep /*simulation_step*/){}; + OOPETRIS_GRAPHICS_EXPORTED virtual void late_update(SimulationStep simulation_step); OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_menu_event(const SDL_Event& event ) const = 0; diff --git a/src/input/joystick_input.hpp b/src/input/joystick_input.hpp index 116bbbec8..b22ed72c6 100644 --- a/src/input/joystick_input.hpp +++ b/src/input/joystick_input.hpp @@ -251,8 +251,8 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED ~JoystickLikeGameInput() override; - OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(const JoystickLikeGameInput& input) = delete; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input + JoystickLikeGameInput(const JoystickLikeGameInput& input) = delete; + [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input ) = delete; OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(JoystickLikeGameInput&& input) noexcept; diff --git a/src/input/touch_input.cpp b/src/input/touch_input.cpp index a7fa8e638..8f566d8fd 100644 --- a/src/input/touch_input.cpp +++ b/src/input/touch_input.cpp @@ -6,8 +6,8 @@ #include "touch_input.hpp" #include -#include #include +#include #include void input::TouchGameInput::handle_event(const SDL_Event& event) { @@ -213,7 +213,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } -[[nodiscard]] std::optional input::TouchInput::get_navigation_event(const SDL_Event& event +[[nodiscard]] std::optional input::TouchInput::get_navigation_event( + const SDL_Event& event ) const { //technically no touch event, but it's a navigation event, and by APi design it can also handle those if (event.type == SDL_KEYDOWN and event.key.keysym.sym == SDLK_AC_BACK) { @@ -239,7 +240,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } } -[[nodiscard]] std::optional input::TouchInput::get_pointer_event(const SDL_Event& event +[[nodiscard]] std::optional input::TouchInput::get_pointer_event( + const SDL_Event& event ) const { auto pointer_event = input::PointerEvent::PointerUp; @@ -276,8 +278,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } -[[nodiscard]] SDL_Event input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) - const { +[[nodiscard]] SDL_Event +input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const { auto new_event = event; @@ -316,6 +318,13 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in return {}; } +input::TouchSettings input::TouchSettings::default_settings() { + return TouchSettings{ .move_x_threshold = 150.0 / 2160.0, + .move_y_threshold = 400.0 / 1080.0, + .rotation_duration_threshold = 500, + .drop_duration_threshold = 200 }; +} + void input::TouchInputManager::discover_devices( std::vector>& inputs, diff --git a/src/input/touch_input.hpp b/src/input/touch_input.hpp index 06414a53a..b6dec96e2 100644 --- a/src/input/touch_input.hpp +++ b/src/input/touch_input.hpp @@ -27,7 +27,8 @@ namespace input { const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event + OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event( + NavigationEvent event ) const override; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_pointer_event( @@ -55,12 +56,7 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected validate() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static TouchSettings default_settings() { - return TouchSettings{ .move_x_threshold = 150.0 / 2160.0, - .move_y_threshold = 400.0 / 1080.0, - .rotation_duration_threshold = 500, - .drop_duration_threshold = 200 }; - } + OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static TouchSettings default_settings(); }; struct PressedState { @@ -102,7 +98,8 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED void handle_event(const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void update(SimulationStep simulation_step_index) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event + OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event( + const SDL_Event& event ) const override; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; @@ -214,12 +211,14 @@ namespace nlohmann { static void to_json(json& obj, const input::TouchSettings& settings) { - obj = nlohmann::json::object({ - { "move_x_threshold", settings.move_x_threshold }, - { "move_y_threshold", settings.move_y_threshold }, - { "rotation_duration_threshold", settings.rotation_duration_threshold }, - { "drop_duration_threshold", settings.drop_duration_threshold } - }); + obj = nlohmann::json::object( + { + { "move_x_threshold", settings.move_x_threshold }, + { "move_y_threshold", settings.move_y_threshold }, + { "rotation_duration_threshold", settings.rotation_duration_threshold }, + { "drop_duration_threshold", settings.drop_duration_threshold } + } + ); } }; } // namespace nlohmann diff --git a/src/libs/core/game/mino.hpp b/src/libs/core/game/mino.hpp index 6fd0478a3..70f403767 100644 --- a/src/libs/core/game/mino.hpp +++ b/src/libs/core/game/mino.hpp @@ -16,7 +16,7 @@ struct Mino final { helper::TetrominoType m_type; public: - OOPETRIS_CORE_EXPORTED explicit constexpr Mino(grid::GridPoint position, helper::TetrominoType type) + explicit constexpr Mino(grid::GridPoint position, helper::TetrominoType type) : m_position{ position }, m_type{ type } { } diff --git a/src/lobby/api.hpp b/src/lobby/api.hpp index 3559e9cb0..a4d9a24a8 100644 --- a/src/lobby/api.hpp +++ b/src/lobby/api.hpp @@ -34,10 +34,10 @@ namespace lobby { public: OOPETRIS_GRAPHICS_EXPORTED API(API&& other) noexcept; - OOPETRIS_GRAPHICS_EXPORTED API& operator=(API&& other) noexcept = delete; + API& operator=(API&& other) noexcept = delete; - OOPETRIS_GRAPHICS_EXPORTED API(const API& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED API& operator=(const API& other) = delete; + API(const API& other) = delete; + API& operator=(const API& other) = delete; OOPETRIS_GRAPHICS_EXPORTED ~API(); diff --git a/src/lobby/credentials/buffer.hpp b/src/lobby/credentials/buffer.hpp index 76d386cb0..6cad6fcf3 100644 --- a/src/lobby/credentials/buffer.hpp +++ b/src/lobby/credentials/buffer.hpp @@ -15,7 +15,9 @@ namespace secret { public: OOPETRIS_GRAPHICS_EXPORTED explicit Buffer(const std::string& data); + OOPETRIS_GRAPHICS_EXPORTED explicit Buffer(std::byte* data, std::size_t size); + template explicit Buffer(std::array data) : m_size{ data.size() } { if (m_size == 0) { @@ -28,11 +30,11 @@ namespace secret { OOPETRIS_GRAPHICS_EXPORTED ~Buffer(); - OOPETRIS_GRAPHICS_EXPORTED Buffer(const Buffer& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED Buffer& operator=(const Buffer& other) = delete; + Buffer(const Buffer& other) = delete; + Buffer& operator=(const Buffer& other) = delete; OOPETRIS_GRAPHICS_EXPORTED Buffer(Buffer&& other) noexcept; - OOPETRIS_GRAPHICS_EXPORTED Buffer& operator=(Buffer&& other) noexcept = delete; + Buffer& operator=(Buffer&& other) noexcept = delete; [[nodiscard]] std::string as_string() const; diff --git a/src/lobby/credentials/secret.hpp b/src/lobby/credentials/secret.hpp index 1c96c3a65..ddc278420 100644 --- a/src/lobby/credentials/secret.hpp +++ b/src/lobby/credentials/secret.hpp @@ -46,11 +46,11 @@ namespace secret { OOPETRIS_GRAPHICS_EXPORTED ~SecretStorage(); //NOLINT(performance-trivially-destructible) - OOPETRIS_GRAPHICS_EXPORTED SecretStorage(const SecretStorage& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED SecretStorage& operator=(const SecretStorage& other) = delete; + SecretStorage(const SecretStorage& other) = delete; + SecretStorage& operator=(const SecretStorage& other) = delete; OOPETRIS_GRAPHICS_EXPORTED SecretStorage(SecretStorage&& other) noexcept; - OOPETRIS_GRAPHICS_EXPORTED SecretStorage& operator=(SecretStorage&& other) noexcept = delete; + SecretStorage& operator=(SecretStorage&& other) noexcept = delete; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected load(const std::string& key ) const; diff --git a/src/manager/font.cpp b/src/manager/font.cpp index b9cdd9c53..6f04ff077 100644 --- a/src/manager/font.cpp +++ b/src/manager/font.cpp @@ -2,6 +2,9 @@ #include #include +FontLoadingError::FontLoadingError(std::string message) : m_message{ std::move(message) } { } + + Font::Font(const std::filesystem::path& path, int size) : m_font{ TTF_OpenFont(path.string().c_str(), size), TTF_CloseFont } { if (m_font == nullptr) { diff --git a/src/manager/font.hpp b/src/manager/font.hpp index 3390d62c6..5a161d48c 100644 --- a/src/manager/font.hpp +++ b/src/manager/font.hpp @@ -12,7 +12,7 @@ struct FontLoadingError final : public std::exception { std::string m_message; public: - OOPETRIS_GRAPHICS_EXPORTED explicit FontLoadingError(std::string message) : m_message{ std::move(message) } { } + OOPETRIS_GRAPHICS_EXPORTED explicit FontLoadingError(std::string message); [[nodiscard]] const char* what() const noexcept override { return m_message.c_str(); diff --git a/src/manager/music_manager.hpp b/src/manager/music_manager.hpp index 9020cab67..d214d849f 100644 --- a/src/manager/music_manager.hpp +++ b/src/manager/music_manager.hpp @@ -38,11 +38,11 @@ struct MusicManager final { public: OOPETRIS_GRAPHICS_EXPORTED explicit MusicManager(ServiceProvider* service_provider, u8 channel_size = 2); - OOPETRIS_GRAPHICS_EXPORTED MusicManager(const MusicManager&) = delete; - OOPETRIS_GRAPHICS_EXPORTED MusicManager& operator=(const MusicManager&) = delete; + MusicManager(const MusicManager&) = delete; + MusicManager& operator=(const MusicManager&) = delete; - OOPETRIS_GRAPHICS_EXPORTED MusicManager(const MusicManager&&) = delete; - OOPETRIS_GRAPHICS_EXPORTED MusicManager& operator=(MusicManager&&) = delete; + MusicManager(const MusicManager&&) = delete; + MusicManager& operator=(MusicManager&&) = delete; OOPETRIS_GRAPHICS_EXPORTED ~MusicManager() noexcept; diff --git a/src/ui/layout.cpp b/src/ui/layout.cpp index bb3e50fc9..49c8363a9 100644 --- a/src/ui/layout.cpp +++ b/src/ui/layout.cpp @@ -1,6 +1,10 @@ #include "ui/layout.hpp" +ui::FullScreenLayout::FullScreenLayout(const shapes::URect& rect) : Layout{ rect, LayoutType::FullScreen } { } +ui::FullScreenLayout::FullScreenLayout(const Window& window) : FullScreenLayout{ window.screen_rect() } { } +ui::FullScreenLayout::FullScreenLayout(const Window* window) : FullScreenLayout{ window->screen_rect() } { } + [[nodiscard]] u32 ui::get_horizontal_alignment_offset(const Layout& layout, AlignmentHorizontal alignment, u32 width) { switch (alignment) { diff --git a/src/ui/layout.hpp b/src/ui/layout.hpp index aba053338..878535b16 100644 --- a/src/ui/layout.hpp +++ b/src/ui/layout.hpp @@ -43,12 +43,9 @@ namespace ui { struct FullScreenLayout : public Layout { - OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const shapes::URect& rect) - : Layout{ rect, LayoutType::FullScreen } { } - OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const Window& window) - : FullScreenLayout{ window.screen_rect() } { } - OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const Window* window) - : FullScreenLayout{ window->screen_rect() } { } + OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const shapes::URect& rect); + OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const Window& window); + OOPETRIS_GRAPHICS_EXPORTED explicit FullScreenLayout(const Window* window); }; From 3ecef8b3288652cc3482934f2a3ffb6de02e5bd3 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 16:16:58 +0200 Subject: [PATCH 19/22] fix: format all files --- src/discord/core.cpp | 2 +- src/executables/game/application.cpp | 2 +- src/executables/game/main.cpp | 2 +- src/game/game.cpp | 2 +- src/helper/graphic_utils.cpp | 2 +- src/helper/message_box.hpp | 4 ++-- src/helper/platform.cpp | 2 +- src/helper/web_utils.hpp | 2 +- src/input/input.cpp | 2 +- src/input/input_creator.cpp | 2 +- src/input/joystick_input.cpp | 2 +- src/input/joystick_input.hpp | 3 +-- src/input/touch_input.cpp | 10 ++++------ src/input/touch_input.hpp | 20 ++++++++------------ src/libs/core/hash-library/sha256.h | 2 +- src/libs/core/helper/windows.hpp | 2 +- src/libs/recordings/utility/windows.hpp | 4 ++-- src/lobby/api.cpp | 2 +- src/lobby/credentials/buffer.hpp | 2 +- src/lobby/credentials/secret.cpp | 2 +- src/lobby/web_client.cpp | 2 +- src/manager/music_manager.cpp | 2 +- src/ui/components/button.hpp | 2 +- 23 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/discord/core.cpp b/src/discord/core.cpp index b0938735b..0c96acf6c 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -3,8 +3,8 @@ #include "./core.hpp" -#include #include +#include [[nodiscard]] std::string constants::discord ::get_asset_key(constants::discord::ArtAsset asset) { diff --git a/src/executables/game/application.cpp b/src/executables/game/application.cpp index 0a62b1a9a..41e4a3a64 100644 --- a/src/executables/game/application.cpp +++ b/src/executables/game/application.cpp @@ -11,11 +11,11 @@ #include "ui/layout.hpp" +#include #include #include #include #include -#include #if defined(__CONSOLE__) #include "helper/console_helpers.hpp" diff --git a/src/executables/game/main.cpp b/src/executables/game/main.cpp index 637f628a2..21555ec88 100644 --- a/src/executables/game/main.cpp +++ b/src/executables/game/main.cpp @@ -34,10 +34,10 @@ #pragma warning(disable : 4251) #endif -#include #include #include #include +#include #if defined(_MSC_VER) #pragma warning(default : 4275) diff --git a/src/game/game.cpp b/src/game/game.cpp index 1749a78dd..a29b8ead5 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include #include "game.hpp" #include "input/replay_input.hpp" diff --git a/src/helper/graphic_utils.cpp b/src/helper/graphic_utils.cpp index 01f6de4b7..99ec0bf4e 100644 --- a/src/helper/graphic_utils.cpp +++ b/src/helper/graphic_utils.cpp @@ -1,7 +1,7 @@ #include "graphic_utils.hpp" -#include #include +#include #if defined(__EMSCRIPTEN__) #include diff --git a/src/helper/message_box.hpp b/src/helper/message_box.hpp index ad51be50d..a2c7d58d4 100644 --- a/src/helper/message_box.hpp +++ b/src/helper/message_box.hpp @@ -33,8 +33,8 @@ namespace helper { #ifdef MessageBox #undef MessageBox #endif -// this is to fix include order, if we include windows.h after this, it also works -using MessageBoxA = MessageBox; + // this is to fix include order, if we include windows.h after this, it also works + using MessageBoxA = MessageBox; #endif diff --git a/src/helper/platform.cpp b/src/helper/platform.cpp index 98de01dce..c3a367731 100644 --- a/src/helper/platform.cpp +++ b/src/helper/platform.cpp @@ -10,9 +10,9 @@ #include #include +#include #include #include -#include namespace { diff --git a/src/helper/web_utils.hpp b/src/helper/web_utils.hpp index 251c96d1e..2da38e1a3 100644 --- a/src/helper/web_utils.hpp +++ b/src/helper/web_utils.hpp @@ -13,9 +13,9 @@ #include "manager/service_provider.hpp" +#include #include #include -#include #include #include diff --git a/src/input/input.cpp b/src/input/input.cpp index aa985b7b3..7c59fc66c 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -10,9 +10,9 @@ #include "touch_input.hpp" #include +#include #include #include -#include #include #include diff --git a/src/input/input_creator.cpp b/src/input/input_creator.cpp index a5a98c545..505403c9e 100644 --- a/src/input/input_creator.cpp +++ b/src/input/input_creator.cpp @@ -12,8 +12,8 @@ #include "input/replay_input.hpp" #include "input_creator.hpp" -#include #include +#include #include namespace { diff --git a/src/input/joystick_input.cpp b/src/input/joystick_input.cpp index 6a5d5a84e..9ce34c3fe 100644 --- a/src/input/joystick_input.cpp +++ b/src/input/joystick_input.cpp @@ -10,9 +10,9 @@ #include "joystick_input.hpp" #include +#include #include #include -#include input::JoystickLikeInput::JoystickLikeInput(SDL_JoystickID instance_id, const std::string& name, JoystickLikeType type) diff --git a/src/input/joystick_input.hpp b/src/input/joystick_input.hpp index b22ed72c6..0fa5533bd 100644 --- a/src/input/joystick_input.hpp +++ b/src/input/joystick_input.hpp @@ -252,8 +252,7 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED ~JoystickLikeGameInput() override; JoystickLikeGameInput(const JoystickLikeGameInput& input) = delete; - [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input - ) = delete; + [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input) = delete; OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(JoystickLikeGameInput&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] JoystickLikeGameInput& operator=(JoystickLikeGameInput&& input diff --git a/src/input/touch_input.cpp b/src/input/touch_input.cpp index 8f566d8fd..c09ac5ed0 100644 --- a/src/input/touch_input.cpp +++ b/src/input/touch_input.cpp @@ -213,8 +213,7 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } -[[nodiscard]] std::optional input::TouchInput::get_navigation_event( - const SDL_Event& event +[[nodiscard]] std::optional input::TouchInput::get_navigation_event(const SDL_Event& event ) const { //technically no touch event, but it's a navigation event, and by APi design it can also handle those if (event.type == SDL_KEYDOWN and event.key.keysym.sym == SDLK_AC_BACK) { @@ -240,8 +239,7 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } } -[[nodiscard]] std::optional input::TouchInput::get_pointer_event( - const SDL_Event& event +[[nodiscard]] std::optional input::TouchInput::get_pointer_event(const SDL_Event& event ) const { auto pointer_event = input::PointerEvent::PointerUp; @@ -278,8 +276,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr& window, in } -[[nodiscard]] SDL_Event -input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const { +[[nodiscard]] SDL_Event input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) + const { auto new_event = event; diff --git a/src/input/touch_input.hpp b/src/input/touch_input.hpp index b6dec96e2..1add0d0c9 100644 --- a/src/input/touch_input.hpp +++ b/src/input/touch_input.hpp @@ -27,8 +27,7 @@ namespace input { const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event( - NavigationEvent event + OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event ) const override; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_pointer_event( @@ -98,8 +97,7 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED void handle_event(const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void update(SimulationStep simulation_step_index) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event( - const SDL_Event& event + OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event ) const override; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; @@ -211,14 +209,12 @@ namespace nlohmann { static void to_json(json& obj, const input::TouchSettings& settings) { - obj = nlohmann::json::object( - { - { "move_x_threshold", settings.move_x_threshold }, - { "move_y_threshold", settings.move_y_threshold }, - { "rotation_duration_threshold", settings.rotation_duration_threshold }, - { "drop_duration_threshold", settings.drop_duration_threshold } - } - ); + obj = nlohmann::json::object({ + { "move_x_threshold", settings.move_x_threshold }, + { "move_y_threshold", settings.move_y_threshold }, + { "rotation_duration_threshold", settings.rotation_duration_threshold }, + { "drop_duration_threshold", settings.drop_duration_threshold } + }); } }; } // namespace nlohmann diff --git a/src/libs/core/hash-library/sha256.h b/src/libs/core/hash-library/sha256.h index 360a88379..621a182a2 100644 --- a/src/libs/core/hash-library/sha256.h +++ b/src/libs/core/hash-library/sha256.h @@ -33,7 +33,7 @@ typedef unsigned __int64 uint64_t; #endif #endif #else -#define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) +#define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) #endif #else diff --git a/src/libs/core/helper/windows.hpp b/src/libs/core/helper/windows.hpp index 4622d8b54..946dd0896 100644 --- a/src/libs/core/helper/windows.hpp +++ b/src/libs/core/helper/windows.hpp @@ -16,7 +16,7 @@ #endif #endif #else -#define OOPETRIS_CORE_EXPORTED __attribute__((visibility("default"))) +#define OOPETRIS_CORE_EXPORTED __attribute__((visibility("default"))) #endif #else #define OOPETRIS_CORE_EXPORTED diff --git a/src/libs/recordings/utility/windows.hpp b/src/libs/recordings/utility/windows.hpp index 4047e6985..026c5ae75 100644 --- a/src/libs/recordings/utility/windows.hpp +++ b/src/libs/recordings/utility/windows.hpp @@ -1,6 +1,6 @@ #pragma once -#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0 #if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT) #if defined(__GNUC__) @@ -16,7 +16,7 @@ #endif #endif #else -#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((visibility("default"))) +#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((visibility("default"))) #endif #else #define OOPETRIS_RECORDINGS_EXPORTED diff --git a/src/lobby/api.cpp b/src/lobby/api.cpp index 01112d01c..703b242cd 100644 --- a/src/lobby/api.cpp +++ b/src/lobby/api.cpp @@ -2,8 +2,8 @@ #include "api.hpp" -#include #include +#include #if !defined(_OOPETRIS_ONLINE_SYSTEM) #error "_OOPETRIS_ONLINE_SYSTEM has to be defined" diff --git a/src/lobby/credentials/buffer.hpp b/src/lobby/credentials/buffer.hpp index 6cad6fcf3..73a5790cc 100644 --- a/src/lobby/credentials/buffer.hpp +++ b/src/lobby/credentials/buffer.hpp @@ -15,7 +15,7 @@ namespace secret { public: OOPETRIS_GRAPHICS_EXPORTED explicit Buffer(const std::string& data); - + OOPETRIS_GRAPHICS_EXPORTED explicit Buffer(std::byte* data, std::size_t size); template diff --git a/src/lobby/credentials/secret.cpp b/src/lobby/credentials/secret.cpp index 390b14727..c43dc70a9 100644 --- a/src/lobby/credentials/secret.cpp +++ b/src/lobby/credentials/secret.cpp @@ -150,8 +150,8 @@ secret::SecretStorage::store(const std::string& key, const Buffer& value, bool u #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -#include #include +#include #ifndef NOMINMAX #define NOMINMAX diff --git a/src/lobby/web_client.cpp b/src/lobby/web_client.cpp index 96def579c..bac2dac31 100644 --- a/src/lobby/web_client.cpp +++ b/src/lobby/web_client.cpp @@ -1,8 +1,8 @@ #include "./web_client.hpp" -#include #include +#include // Note: this uses emscripten fetch //see: https://emscripten.org/docs/api_reference/fetch.html diff --git a/src/manager/music_manager.cpp b/src/manager/music_manager.cpp index 34fecda65..16f334c7b 100644 --- a/src/manager/music_manager.cpp +++ b/src/manager/music_manager.cpp @@ -8,9 +8,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/src/ui/components/button.hpp b/src/ui/components/button.hpp index 87f0c3bb4..5234897e6 100644 --- a/src/ui/components/button.hpp +++ b/src/ui/components/button.hpp @@ -2,8 +2,8 @@ #include -#include #include +#include #include #include "graphics/rect.hpp" From 6d5b104f722093fddf36329f6d3b7201164b47a1 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 17:21:29 +0200 Subject: [PATCH 20/22] feat: reafctor export symbols - unify the complex and complicated #ifdef chains for windows, MSYS2, gcc etc. - also rename the files to export_symbols so that it is not called windows.hpp --- src/discord/core.hpp | 8 ++-- src/game/bag.hpp | 2 +- src/game/command_line_arguments.hpp | 2 +- src/game/game.hpp | 10 ++--- src/game/graphic_helpers.hpp | 2 +- src/game/grid.hpp | 8 ++-- src/game/rotation.hpp | 2 +- src/game/simulated_tetrion.hpp | 16 ++++---- src/game/simulation.hpp | 4 +- src/game/tetrion.hpp | 12 +++--- src/game/tetromino.hpp | 8 ++-- src/graphics/renderer.hpp | 8 ++-- src/graphics/sdl_context.hpp | 2 +- src/graphics/text.hpp | 2 +- src/graphics/texture.hpp | 4 +- src/graphics/window.hpp | 10 ++--- src/helper/clock_source.hpp | 8 ++-- src/helper/console_helpers.hpp | 6 +-- src/helper/export_symbols.hpp | 14 +++++++ src/helper/graphic_utils.hpp | 16 ++++---- src/helper/meson.build | 2 +- src/helper/message_box.hpp | 2 +- src/helper/platform.hpp | 6 +-- src/helper/windows.hpp | 23 ----------- src/input/controller_input.hpp | 16 ++++---- src/input/game_input.hpp | 8 ++-- src/input/guid.hpp | 8 ++-- src/input/input.hpp | 38 +++++++++--------- src/input/input_creator.hpp | 13 ++++--- src/input/joystick_input.hpp | 39 +++++++++---------- src/input/keyboard_input.hpp | 18 ++++----- src/input/mouse_input.hpp | 10 ++--- src/input/replay_input.hpp | 10 ++--- src/input/touch_input.hpp | 24 ++++++------ src/libs/core/game/mino.hpp | 12 +++--- src/libs/core/game/mino_stack.hpp | 12 +++--- src/libs/core/game/tetromino_type.hpp | 6 +-- src/libs/core/hash-library/sha256.h | 4 +- src/libs/core/helper/color.hpp | 18 ++++----- src/libs/core/helper/date.hpp | 6 +-- src/libs/core/helper/errors.hpp | 10 ++--- src/libs/core/helper/export_helper.hpp | 23 +++++++++++ src/libs/core/helper/export_symbols.hpp | 14 +++++++ src/libs/core/helper/meson.build | 5 ++- src/libs/core/helper/parse_json.hpp | 4 +- src/libs/core/helper/random.hpp | 6 +-- src/libs/core/helper/sleep.hpp | 2 +- src/libs/core/helper/string_manipulation.hpp | 2 +- src/libs/core/helper/timer.hpp | 2 +- src/libs/core/helper/windows.hpp | 23 ----------- .../utility/additional_information.hpp | 24 ++++++------ .../recordings/utility/checksum_helper.hpp | 4 +- .../recordings/utility/export_symbols.hpp | 15 +++++++ src/libs/recordings/utility/meson.build | 2 +- src/libs/recordings/utility/recording.hpp | 8 ++-- .../recordings/utility/recording_reader.hpp | 20 +++++----- .../recordings/utility/recording_writer.hpp | 6 +-- .../recordings/utility/tetrion_snapshot.hpp | 18 ++++----- src/libs/recordings/utility/windows.hpp | 23 ----------- src/lobby/api.hpp | 29 +++++++------- src/lobby/client.hpp | 20 +++++----- src/lobby/credentials/buffer.hpp | 2 +- src/lobby/credentials/secret.hpp | 8 ++-- src/lobby/curl_client.hpp | 16 ++++---- src/lobby/httplib_client.hpp | 16 ++++---- src/lobby/web_client.hpp | 16 ++++---- src/manager/font.hpp | 4 +- src/manager/music_manager.hpp | 4 +- src/manager/sdl_controller_key.hpp | 6 +-- src/manager/sdl_key.hpp | 14 +++---- src/manager/settings.hpp | 2 +- src/manager/settings_manager.hpp | 4 +- src/scenes/about_page/about_page.hpp | 2 +- src/scenes/logo/logo.hpp | 2 +- src/scenes/main_menu/main_menu.hpp | 2 +- .../multiplayer_menu/multiplayer_menu.hpp | 2 +- src/scenes/online_lobby/online_lobby.hpp | 2 +- .../play_select_menu/play_select_menu.hpp | 2 +- .../recording_selector/recording_chooser.hpp | 4 +- .../recording_component.hpp | 4 +- .../recording_selector/recording_selector.hpp | 2 +- src/scenes/replay_game/replay_game.hpp | 4 +- src/scenes/scene.hpp | 4 +- .../settings_menu/color_setting_row.hpp | 8 ++-- src/scenes/settings_menu/settings_menu.hpp | 2 +- src/scenes/single_player_game/game_over.hpp | 2 +- src/scenes/single_player_game/pause.hpp | 4 +- .../single_player_game/single_player_game.hpp | 4 +- src/ui/components/color_picker.hpp | 6 +-- src/ui/components/image_view.hpp | 2 +- src/ui/components/label.hpp | 2 +- src/ui/components/link_label.hpp | 2 +- src/ui/components/textinput.hpp | 2 +- src/ui/layout.hpp | 8 ++-- src/ui/layouts/focus_layout.hpp | 2 +- src/ui/layouts/grid_layout.hpp | 2 +- src/ui/layouts/scroll_layout.hpp | 4 +- src/ui/widget.hpp | 4 +- 98 files changed, 427 insertions(+), 428 deletions(-) create mode 100644 src/helper/export_symbols.hpp delete mode 100644 src/helper/windows.hpp create mode 100644 src/libs/core/helper/export_helper.hpp create mode 100644 src/libs/core/helper/export_symbols.hpp delete mode 100644 src/libs/core/helper/windows.hpp create mode 100644 src/libs/recordings/utility/export_symbols.hpp delete mode 100644 src/libs/recordings/utility/windows.hpp diff --git a/src/discord/core.hpp b/src/discord/core.hpp index 7550f6afa..067f7c2bf 100644 --- a/src/discord/core.hpp +++ b/src/discord/core.hpp @@ -5,7 +5,7 @@ #include #include -#include "../helper/windows.hpp" +#include "../helper/export_symbols.hpp" #include #ifdef _WIN32 @@ -58,7 +58,7 @@ namespace constants::discord { // manually synchronized to https://discord.com/developers/applications/1220147916371394650/rich-presence/assets enum class ArtAsset : u8 { Logo }; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string get_asset_key(ArtAsset asset); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string get_asset_key(ArtAsset asset); } // namespace constants::discord @@ -116,7 +116,7 @@ struct DiscordActivityWrapper { } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const discordpp::Activity& get_raw() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const discordpp::Activity& get_raw() const; }; enum class DiscordStatus : u8 { Starting = 0, Ok, Error }; @@ -131,7 +131,7 @@ struct DiscordInstance { public: OOPETRIS_GRAPHICS_EXPORTED explicit DiscordInstance(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] DiscordStatus get_status(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED DiscordStatus get_status(); OOPETRIS_GRAPHICS_EXPORTED DiscordInstance(DiscordInstance&& old) noexcept; diff --git a/src/game/bag.hpp b/src/game/bag.hpp index 3bbe1aff4..b65dfd326 100644 --- a/src/game/bag.hpp +++ b/src/game/bag.hpp @@ -3,7 +3,7 @@ #include #include -#include "../helper/windows.hpp" +#include "../helper/export_symbols.hpp" #include struct Bag final { diff --git a/src/game/command_line_arguments.hpp b/src/game/command_line_arguments.hpp index 42e79d62e..2abf44026 100644 --- a/src/game/command_line_arguments.hpp +++ b/src/game/command_line_arguments.hpp @@ -6,7 +6,7 @@ #include #include -#include "../helper/windows.hpp" +#include "../helper/export_symbols.hpp" #include #include diff --git a/src/game/game.hpp b/src/game/game.hpp index 0535edb8c..0efd5735f 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -3,7 +3,7 @@ #include #include "helper/clock_source.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/input_creator.hpp" #include "tetrion.hpp" #include "ui/widget.hpp" @@ -32,14 +32,14 @@ struct Game : public ui::Widget { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void set_paused(bool paused); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_paused() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_paused() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_finished() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_finished() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::shared_ptr& game_input() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::shared_ptr& game_input() const; }; diff --git a/src/game/graphic_helpers.hpp b/src/game/graphic_helpers.hpp index 3bc1367fc..475a4cc11 100644 --- a/src/game/graphic_helpers.hpp +++ b/src/game/graphic_helpers.hpp @@ -2,7 +2,7 @@ #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/service_provider.hpp" enum class MinoTransparency : u8 { diff --git a/src/game/grid.hpp b/src/game/grid.hpp index 447f61d1a..56ec219d5 100644 --- a/src/game/grid.hpp +++ b/src/game/grid.hpp @@ -4,7 +4,7 @@ #include #include "graphics/rect.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/service_provider.hpp" #include "ui/layout.hpp" #include "ui/widget.hpp" @@ -26,13 +26,13 @@ struct Grid final : public ui::Widget { [[nodiscard]] shapes::UPoint tile_size() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] double scale_to_original() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED double scale_to_original() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint to_screen_coords(grid::GridPoint grid_coords) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::UPoint to_screen_coords(grid::GridPoint grid_coords) const; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::BoolWrapper> + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::BoolWrapper> handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; private: diff --git a/src/game/rotation.hpp b/src/game/rotation.hpp index c025cb1b9..4f6e0b9f6 100644 --- a/src/game/rotation.hpp +++ b/src/game/rotation.hpp @@ -2,7 +2,7 @@ #include -#include "../helper/windows.hpp" +#include "../helper/export_symbols.hpp" enum class Rotation : u8 { North = 0, diff --git a/src/game/simulated_tetrion.hpp b/src/game/simulated_tetrion.hpp index f3cce5716..30c90ef2e 100644 --- a/src/game/simulated_tetrion.hpp +++ b/src/game/simulated_tetrion.hpp @@ -8,7 +8,7 @@ #include "bag.hpp" #include "grid.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/game_input.hpp" #include "manager/service_provider.hpp" #include "tetromino.hpp" @@ -123,14 +123,14 @@ struct SimulatedTetrion { OOPETRIS_GRAPHICS_EXPORTED bool drop_tetromino(SimulationStep simulation_step_index); OOPETRIS_GRAPHICS_EXPORTED void hold_tetromino(SimulationStep simulation_step_index); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u8 tetrion_index() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 level() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u64 score() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 lines_cleared() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const MinoStack& mino_stack() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr core_information() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u8 tetrion_index() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 level() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u64 score() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 lines_cleared() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const MinoStack& mino_stack() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr core_information() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_over() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_over() const; private: template diff --git a/src/game/simulation.hpp b/src/game/simulation.hpp index e110d2a76..19073fe8e 100644 --- a/src/game/simulation.hpp +++ b/src/game/simulation.hpp @@ -3,7 +3,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/input_creator.hpp" #include "input/replay_input.hpp" #include "simulated_tetrion.hpp" @@ -28,5 +28,5 @@ struct Simulation { OOPETRIS_GRAPHICS_EXPORTED void update(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_finished() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_finished() const; }; diff --git a/src/game/tetrion.hpp b/src/game/tetrion.hpp index 589b18e6c..c99757cdc 100644 --- a/src/game/tetrion.hpp +++ b/src/game/tetrion.hpp @@ -5,7 +5,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/game_input.hpp" #include "manager/service_provider.hpp" #include "simulated_tetrion.hpp" @@ -44,13 +44,13 @@ struct Tetrion final : public ui::Widget, SimulatedTetrion { OOPETRIS_GRAPHICS_EXPORTED Tetrion& operator=(Tetrion&& other) noexcept = delete; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Grid* get_grid(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const Grid* get_grid() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] ui::GridLayout* get_text_layout(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const ui::GridLayout* get_text_layout() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Grid* get_grid(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const Grid* get_grid() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED ui::GridLayout* get_text_layout(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const ui::GridLayout* get_text_layout() const; private: void refresh_texts() override; diff --git a/src/game/tetromino.hpp b/src/game/tetromino.hpp index 5c0cdb038..29ddbe517 100644 --- a/src/game/tetromino.hpp +++ b/src/game/tetromino.hpp @@ -3,7 +3,7 @@ #include #include "graphic_helpers.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "rotation.hpp" #include @@ -27,8 +27,8 @@ struct Tetromino final { m_type{ type }, m_minos{ create_minos(position, m_rotation, type) } { } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::TetrominoType type() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Rotation rotation() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::TetrominoType type() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Rotation rotation() const; OOPETRIS_GRAPHICS_EXPORTED void render( const ServiceProvider& service_provider, @@ -47,7 +47,7 @@ struct Tetromino final { OOPETRIS_GRAPHICS_EXPORTED void move_right(); OOPETRIS_GRAPHICS_EXPORTED void move(shapes::AbstractPoint offset); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::array& minos() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::array& minos() const; private: diff --git a/src/graphics/renderer.hpp b/src/graphics/renderer.hpp index 96b05011b..207a088b3 100644 --- a/src/graphics/renderer.hpp +++ b/src/graphics/renderer.hpp @@ -2,7 +2,7 @@ #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/font.hpp" #include "rect.hpp" #include "texture.hpp" @@ -78,15 +78,15 @@ struct Renderer final { texture.render(m_renderer, from, dest); } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture load_image(const std::filesystem::path& image_path) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture prerender_text( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture load_image(const std::filesystem::path& image_path) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture prerender_text( const std::string& text, const Font& font, const Color& color, RenderType render_type = RenderType::Blended, const Color& background_color = Color::black() ) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture get_texture_for_render_target(const shapes::UPoint& size) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture get_texture_for_render_target(const shapes::UPoint& size) const; OOPETRIS_GRAPHICS_EXPORTED void set_render_target(const Texture& texture) const; OOPETRIS_GRAPHICS_EXPORTED void reset_render_target() const; diff --git a/src/graphics/sdl_context.hpp b/src/graphics/sdl_context.hpp index f192f2d13..3a6f5ccdd 100644 --- a/src/graphics/sdl_context.hpp +++ b/src/graphics/sdl_context.hpp @@ -1,6 +1,6 @@ #pragma once -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" struct SdlContext final { OOPETRIS_GRAPHICS_EXPORTED SdlContext(); diff --git a/src/graphics/text.hpp b/src/graphics/text.hpp index 20884900f..c4b848675 100644 --- a/src/graphics/text.hpp +++ b/src/graphics/text.hpp @@ -2,7 +2,7 @@ #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/font.hpp" #include "manager/service_provider.hpp" #include "rect.hpp" diff --git a/src/graphics/texture.hpp b/src/graphics/texture.hpp index 3899d7913..28aeb957b 100644 --- a/src/graphics/texture.hpp +++ b/src/graphics/texture.hpp @@ -6,7 +6,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/font.hpp" #include "rect.hpp" @@ -61,7 +61,7 @@ struct Texture { SDL_RenderCopy(renderer, m_raw_texture, &from_rect_sdl, &to_rect_sdl); } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint size() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::UPoint size() const; OOPETRIS_GRAPHICS_EXPORTED void set_as_render_target(SDL_Renderer* renderer) const; }; diff --git a/src/graphics/window.hpp b/src/graphics/window.hpp index 93c63a920..64092409b 100644 --- a/src/graphics/window.hpp +++ b/src/graphics/window.hpp @@ -3,8 +3,8 @@ #include #include "graphics/rect.hpp" +#include "helper/export_symbols.hpp" #include "helper/message_box.hpp" -#include "helper/windows.hpp" #include "sdl_context.hpp" #include @@ -31,13 +31,13 @@ struct Window final { Window& operator=(Window&&) = delete; OOPETRIS_GRAPHICS_EXPORTED ~Window(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint size() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::UPoint size() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_Window* get_sdl_window() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_Window* get_sdl_window() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const SdlContext& context() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const SdlContext& context() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::URect screen_rect() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::URect screen_rect() const; OOPETRIS_GRAPHICS_EXPORTED void show_simple(helper::MessageBox::Type type, const std::string& title, const std::string& content) const; diff --git a/src/helper/clock_source.hpp b/src/helper/clock_source.hpp index bd3ad3c5f..d00d98359 100644 --- a/src/helper/clock_source.hpp +++ b/src/helper/clock_source.hpp @@ -3,7 +3,7 @@ #include -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include @@ -11,8 +11,8 @@ struct ClockSource { OOPETRIS_GRAPHICS_EXPORTED virtual ~ClockSource() = default; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual SimulationStep simulation_step_index() const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual bool can_be_paused() = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual SimulationStep simulation_step_index() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual bool can_be_paused() = 0; OOPETRIS_GRAPHICS_EXPORTED virtual void pause() { throw std::runtime_error("not implemented"); @@ -35,7 +35,7 @@ struct LocalClock : public ClockSource { public: OOPETRIS_GRAPHICS_EXPORTED explicit LocalClock(u32 target_frequency); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SimulationStep simulation_step_index() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SimulationStep simulation_step_index() const override; OOPETRIS_GRAPHICS_EXPORTED bool can_be_paused() override; OOPETRIS_GRAPHICS_EXPORTED void pause() override; OOPETRIS_GRAPHICS_EXPORTED double resume() override; diff --git a/src/helper/console_helpers.hpp b/src/helper/console_helpers.hpp index 7a6b4e42a..adf924221 100644 --- a/src/helper/console_helpers.hpp +++ b/src/helper/console_helpers.hpp @@ -6,7 +6,7 @@ #include -#include "./windows.hpp" +#include "./export_symbols.hpp" #include @@ -22,13 +22,13 @@ namespace console { debug_write(value.c_str(), value.size()); } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string open_url(const std::string& url); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string open_url(const std::string& url); OOPETRIS_GRAPHICS_EXPORTED void platform_init(); OOPETRIS_GRAPHICS_EXPORTED void platform_exit(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool inMainLoop(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool inMainLoop(); template diff --git a/src/helper/export_symbols.hpp b/src/helper/export_symbols.hpp new file mode 100644 index 000000000..5d8a4457e --- /dev/null +++ b/src/helper/export_symbols.hpp @@ -0,0 +1,14 @@ +#pragma once + +// see https://gcc.gnu.org/wiki/Visibility +#include + +#if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0 +#if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT) +#define OOPETRIS_GRAPHICS_EXPORTED OOPETRIS_DLL_EXPORT +#else +#define OOPETRIS_GRAPHICS_EXPORTED OOPETRIS_DLL_IMPORT +#endif +#else +#define OOPETRIS_GRAPHICS_EXPORTED OOPETRIS_ONLY_LOCAL +#endif diff --git a/src/helper/graphic_utils.hpp b/src/helper/graphic_utils.hpp index a57356348..13846ac09 100644 --- a/src/helper/graphic_utils.hpp +++ b/src/helper/graphic_utils.hpp @@ -3,7 +3,7 @@ #include -#include "./windows.hpp" +#include "./export_symbols.hpp" #include "helper/constants.hpp" #include @@ -12,13 +12,13 @@ namespace utils { - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_Color sdl_color_from_color(const Color& color); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_Color sdl_color_from_color(const Color& color); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::vector supported_features(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::vector supported_features(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::filesystem::path get_assets_folder(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::filesystem::path get_assets_folder(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::filesystem::path get_root_folder(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::filesystem::path get_root_folder(); OOPETRIS_GRAPHICS_EXPORTED std::optional log_error(const std::string& error); @@ -29,13 +29,13 @@ namespace utils { public: OOPETRIS_GRAPHICS_EXPORTED explicit ExitException(int status_code) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] int status_code() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED int status_code() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const char* what() const noexcept override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const char* what() const noexcept override; }; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional create_directory(const std::filesystem::path& folder, bool recursive); // this needs some special handling, so the macro is defined here diff --git a/src/helper/meson.build b/src/helper/meson.build index ca607430c..8dc91055a 100644 --- a/src/helper/meson.build +++ b/src/helper/meson.build @@ -14,7 +14,7 @@ graphics_src_files += files( 'platform.hpp', 'web_utils.cpp', 'web_utils.hpp', - 'windows.hpp', + 'export_symbols.hpp', ) if have_file_dialogs diff --git a/src/helper/message_box.hpp b/src/helper/message_box.hpp index a2c7d58d4..76f196170 100644 --- a/src/helper/message_box.hpp +++ b/src/helper/message_box.hpp @@ -9,7 +9,7 @@ #include -#include "./windows.hpp" +#include "./export_symbols.hpp" namespace helper { diff --git a/src/helper/platform.hpp b/src/helper/platform.hpp index 0c3bc1be0..7928e10bd 100644 --- a/src/helper/platform.hpp +++ b/src/helper/platform.hpp @@ -6,7 +6,7 @@ #include -#include "./windows.hpp" +#include "./export_symbols.hpp" enum class Platform : u8 { PC, Android, Console, Web }; @@ -42,8 +42,8 @@ namespace utils { } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string built_for_platform(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string built_for_platform(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool open_url(const std::string& url); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool open_url(const std::string& url); } // namespace utils diff --git a/src/helper/windows.hpp b/src/helper/windows.hpp deleted file mode 100644 index 2022348f6..000000000 --- a/src/helper/windows.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -#if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0 -#if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT) -#if defined(__GNUC__) -#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((dllexport)) -#else -#define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllexport) -#endif -#else -#if defined(__GNUC__) -#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((dllimport)) -#else -#define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllimport) -#endif -#endif -#else -#define OOPETRIS_GRAPHICS_EXPORTED __attribute__((visibility("default"))) -#endif -#else -#define OOPETRIS_GRAPHICS_EXPORTED -#endif diff --git a/src/input/controller_input.hpp b/src/input/controller_input.hpp index ebb82f21e..7e9b385a2 100644 --- a/src/input/controller_input.hpp +++ b/src/input/controller_input.hpp @@ -2,7 +2,7 @@ #pragma once -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input.hpp" #include "joystick_input.hpp" #include "manager/sdl_controller_key.hpp" @@ -25,14 +25,14 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED ControllerInput(ControllerInput&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED ControllerInput& operator=(ControllerInput&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static helper::expected, std::string> + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static helper::expected, std::string> get_by_device_index(int device_index); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_navigation_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_navigation_event(NavigationEvent event ) const override; private: @@ -52,7 +52,7 @@ namespace input { sdl::ControllerKey open_settings; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected validate() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected validate() const; [[nodiscard]] static ControllerSettings default_settings() { @@ -82,12 +82,12 @@ namespace input { ControllerInput* underlying_input ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_menu_event(const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_menu_event(MenuEvent event) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const ControllerInput* underlying_input() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const ControllerInput* underlying_input() const override; protected: [[nodiscard]] std::optional sdl_event_to_input_event(const SDL_Event& event) const override; diff --git a/src/input/game_input.hpp b/src/input/game_input.hpp index 96fc728f8..cf2589693 100644 --- a/src/input/game_input.hpp +++ b/src/input/game_input.hpp @@ -8,7 +8,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" struct SimulatedTetrion; @@ -76,10 +76,10 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED virtual void update(SimulationStep simulation_step_index); OOPETRIS_GRAPHICS_EXPORTED virtual void late_update(SimulationStep simulation_step); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_menu_event(const SDL_Event& event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::optional get_menu_event(const SDL_Event& event ) const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::string describe_menu_event(MenuEvent event) const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::string describe_menu_event(MenuEvent event) const = 0; [[nodiscard]] GameInputType input_type() const { return m_input_type; @@ -99,6 +99,6 @@ namespace input { } - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual const Input* underlying_input() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual const Input* underlying_input() const = 0; }; } // namespace input diff --git a/src/input/guid.hpp b/src/input/guid.hpp index c756ee128..2bc3594ca 100644 --- a/src/input/guid.hpp +++ b/src/input/guid.hpp @@ -10,7 +10,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" extern "C" { #if SDL_MAJOR_VERSION < 2 || SDL_MINOR_VERSION < 30 || SDL_PATCHLEVEL < 0 @@ -36,13 +36,13 @@ namespace sdl { OOPETRIS_GRAPHICS_EXPORTED explicit GUID(const SDL_GUID& data); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static helper::expected from_string( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static helper::expected from_string( const std::string& value ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool operator==(const GUID& other) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool operator==(const GUID& other) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string to_string(FormatType type = FormatType::Long) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string to_string(FormatType type = FormatType::Long) const; }; } // namespace sdl diff --git a/src/input/input.hpp b/src/input/input.hpp index 93f0d37b6..e328532d1 100644 --- a/src/input/input.hpp +++ b/src/input/input.hpp @@ -9,7 +9,7 @@ #include "game_input.hpp" #include "graphics/rect.hpp" #include "graphics/window.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/service_provider.hpp" @@ -43,14 +43,14 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED Input(Input&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED Input& operator=(Input&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::string& name() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] InputType type() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::string& name() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED InputType type() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::optional get_navigation_event( const SDL_Event& event ) const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::string describe_navigation_event(NavigationEvent event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::string describe_navigation_event(NavigationEvent event ) const = 0; }; @@ -64,26 +64,26 @@ namespace input { public: OOPETRIS_GRAPHICS_EXPORTED PointerEventHelper(shapes::IPoint pos, PointerEvent event); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] PointerEvent event() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED PointerEvent event() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::IPoint position() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::IPoint position() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_in(const shapes::URect& rect) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_in(const shapes::URect& rect) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_in(const shapes::IRect& rect) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_in(const shapes::IRect& rect) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool operator==(PointerEvent event) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool operator==(PointerEvent event) const; }; struct PointerInput : Input { OOPETRIS_GRAPHICS_EXPORTED explicit PointerInput(const std::string& name); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_pointer_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::optional get_pointer_event( const SDL_Event& event ) const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual SDL_Event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual SDL_Event offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const = 0; }; @@ -94,13 +94,13 @@ namespace input { public: OOPETRIS_GRAPHICS_EXPORTED explicit InputManager(const std::shared_ptr& window); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::vector>& inputs() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::vector>& inputs() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_navigation_event( const SDL_Event& event ) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_pointer_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_pointer_event( const SDL_Event& event ) const; @@ -111,17 +111,17 @@ namespace input { * @param point the point to offset it by * @return SDL_Event which has the correct offset */ - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_Event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_Event offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::BoolWrapper process_special_inputs( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::BoolWrapper process_special_inputs( const SDL_Event& event ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected, std::string> + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected, std::string> get_game_input(ServiceProvider* service_provider); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const input::Input* get_primary_input(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const input::Input* get_primary_input(); }; diff --git a/src/input/input_creator.hpp b/src/input/input_creator.hpp index 6339c50a2..1c3f44ded 100644 --- a/src/input/input_creator.hpp +++ b/src/input/input_creator.hpp @@ -4,7 +4,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/game_input.hpp" #include "manager/service_provider.hpp" @@ -37,11 +37,14 @@ namespace input { using AdditionalInfo = std::tuple, tetrion::StartingParameters>; - OOPETRIS_GRAPHICS_EXPORTED - [[nodiscard]] std::pair, recorder::AdditionalInformation> - get_game_parameters_for_replay(ServiceProvider* service_provider, const std::filesystem::path& recording_path); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED + std::pair, recorder::AdditionalInformation> + get_game_parameters_for_replay( + ServiceProvider* service_provider, + const std::filesystem::path& recording_path + ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected get_single_player_game_parameters( ServiceProvider* service_provider, recorder::AdditionalInformation&& information, diff --git a/src/input/joystick_input.hpp b/src/input/joystick_input.hpp index 0fa5533bd..87356ceef 100644 --- a/src/input/joystick_input.hpp +++ b/src/input/joystick_input.hpp @@ -4,7 +4,7 @@ #include #include "guid.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input.hpp" #include "input/console_buttons.hpp" #include "input/game_input.hpp" @@ -69,7 +69,7 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED JoystickLikeInput(SDL_JoystickID instance_id, const std::string& name, JoystickLikeType type); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_JoystickID instance_id() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_JoystickID instance_id() const; }; @@ -89,11 +89,11 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED JoystickInput(JoystickInput&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED JoystickInput& operator=(JoystickInput&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] sdl::GUID guid() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED sdl::GUID guid() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual JoystickSettings default_settings() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual JoystickSettings default_settings() const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static std::optional> + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static std::optional> get_joystick_by_guid( const sdl::GUID& guid, SDL_Joystick* joystick, @@ -105,12 +105,11 @@ namespace input { struct JoyStickInputManager { OOPETRIS_GRAPHICS_EXPORTED static void discover_devices(std::vector>& inputs); - OOPETRIS_GRAPHICS_EXPORTED - [[nodiscard]] static helper::expected, std::string> get_by_device_index( - int device_index - ); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static helper:: + expected, std::string> + get_by_device_index(int device_index); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static bool + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static bool process_special_inputs(const SDL_Event& event, std::vector>& inputs); private: @@ -255,7 +254,7 @@ namespace input { [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input) = delete; OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(JoystickLikeGameInput&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] JoystickLikeGameInput& operator=(JoystickLikeGameInput&& input + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput& operator=(JoystickLikeGameInput&& input ) noexcept; OOPETRIS_GRAPHICS_EXPORTED void handle_event(const SDL_Event& event) override; @@ -276,15 +275,15 @@ namespace input { JoystickGameInput(EventDispatcher* event_dispatcher, JoystickInput* underlying_input); - OOPETRIS_GRAPHICS_EXPORTED - [[nodiscard]] static helper::expected, std::string> - get_game_input_by_settings( - const input::InputManager& input_manager, - EventDispatcher* event_dispatcher, - const JoystickSettings& settings - ); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static helper:: + expected, std::string> + get_game_input_by_settings( + const input::InputManager& input_manager, + EventDispatcher* event_dispatcher, + const JoystickSettings& settings + ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const JoystickInput* underlying_input() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const JoystickInput* underlying_input() const override; protected: template @@ -338,7 +337,7 @@ namespace input { namespace json_helper { - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string get_key_from_object(const nlohmann::json& obj, const std::string& name); } // namespace json_helper diff --git a/src/input/keyboard_input.hpp b/src/input/keyboard_input.hpp index 88a3d5457..2b541058c 100644 --- a/src/input/keyboard_input.hpp +++ b/src/input/keyboard_input.hpp @@ -4,7 +4,7 @@ #include #include "game_input.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input.hpp" #include "manager/event_dispatcher.hpp" #include "manager/sdl_key.hpp" @@ -20,11 +20,11 @@ namespace input { public: OOPETRIS_GRAPHICS_EXPORTED KeyboardInput(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_navigation_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_navigation_event(NavigationEvent event ) const override; }; @@ -42,7 +42,7 @@ namespace input { sdl::Key open_settings; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected validate() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected validate() const; [[nodiscard]] static KeyboardSettings default_settings() { return KeyboardSettings{ .rotate_left = sdl::Key{ SDLK_LEFT }, @@ -75,19 +75,19 @@ namespace input { [[nodiscard]] KeyboardGameInput& operator=(const KeyboardGameInput& input) = delete; OOPETRIS_GRAPHICS_EXPORTED KeyboardGameInput(KeyboardGameInput&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] KeyboardGameInput& operator=(KeyboardGameInput&& input) noexcept; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED KeyboardGameInput& operator=(KeyboardGameInput&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED void handle_event(const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void update(SimulationStep simulation_step_index) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_menu_event(const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_menu_event(MenuEvent event) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const KeyboardInput* underlying_input() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const KeyboardInput* underlying_input() const override; private: [[nodiscard]] std::optional sdl_event_to_input_event(const SDL_Event& event) const; @@ -98,7 +98,7 @@ namespace input { namespace json_helper { - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] sdl::Key get_key(const nlohmann::json& obj, const std::string& name); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED sdl::Key get_key(const nlohmann::json& obj, const std::string& name); } // namespace json_helper diff --git a/src/input/mouse_input.hpp b/src/input/mouse_input.hpp index 23094721b..8e2374e0d 100644 --- a/src/input/mouse_input.hpp +++ b/src/input/mouse_input.hpp @@ -1,6 +1,6 @@ #pragma once -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input.hpp" namespace input { @@ -9,18 +9,18 @@ namespace input { public: OOPETRIS_GRAPHICS_EXPORTED MouseInput(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_navigation_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_navigation_event(NavigationEvent event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_pointer_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_pointer_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_Event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_Event offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const override; }; diff --git a/src/input/replay_input.hpp b/src/input/replay_input.hpp index 422cf5afd..5a3f8c70d 100644 --- a/src/input/replay_input.hpp +++ b/src/input/replay_input.hpp @@ -3,7 +3,7 @@ #include #include "game_input.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include @@ -24,14 +24,14 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED void update(SimulationStep simulation_step_index) override; OOPETRIS_GRAPHICS_EXPORTED void late_update(SimulationStep simulation_step_index) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_menu_event(const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_menu_event(MenuEvent event) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_end_of_recording() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_end_of_recording() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const Input* underlying_input() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const Input* underlying_input() const override; }; } // namespace input diff --git a/src/input/touch_input.hpp b/src/input/touch_input.hpp index 1add0d0c9..26d1de72f 100644 --- a/src/input/touch_input.hpp +++ b/src/input/touch_input.hpp @@ -3,7 +3,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input.hpp" #include "input/game_input.hpp" #include "manager/event_dispatcher.hpp" @@ -20,21 +20,21 @@ namespace input { OOPETRIS_GRAPHICS_EXPORTED TouchInput(const std::shared_ptr& window, SDL_TouchID touch_id, const std::string& name); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static helper::expected, std::string> + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static helper::expected, std::string> get_by_device_index(const std::shared_ptr& window, int device_index); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_navigation_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_navigation_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_navigation_event(NavigationEvent event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_navigation_event(NavigationEvent event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_pointer_event( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_pointer_event( const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] SDL_Event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED SDL_Event offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const override; }; @@ -53,9 +53,9 @@ namespace input { u32 rotation_duration_threshold; u32 drop_duration_threshold; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected validate() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected validate() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] static TouchSettings default_settings(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED static TouchSettings default_settings(); }; struct PressedState { @@ -92,17 +92,17 @@ namespace input { [[nodiscard]] TouchGameInput& operator=(const TouchGameInput& input) = delete; OOPETRIS_GRAPHICS_EXPORTED TouchGameInput(TouchGameInput&& input) noexcept; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] TouchGameInput& operator=(TouchGameInput&& input) noexcept; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED TouchGameInput& operator=(TouchGameInput&& input) noexcept; OOPETRIS_GRAPHICS_EXPORTED void handle_event(const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void update(SimulationStep simulation_step_index) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_menu_event(const SDL_Event& event + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_menu_event(const SDL_Event& event ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string describe_menu_event(MenuEvent event) const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string describe_menu_event(MenuEvent event) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const TouchInput* underlying_input() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const TouchInput* underlying_input() const override; private: [[nodiscard]] std::optional sdl_event_to_input_event(const SDL_Event& event); diff --git a/src/libs/core/game/mino.hpp b/src/libs/core/game/mino.hpp index 70f403767..7702cf5d9 100644 --- a/src/libs/core/game/mino.hpp +++ b/src/libs/core/game/mino.hpp @@ -1,8 +1,8 @@ #pragma once +#include "../helper/export_symbols.hpp" #include "../helper/point.hpp" #include "../helper/types.hpp" -#include "../helper/windows.hpp" #include "./grid_properties.hpp" #include "./tetromino_type.hpp" @@ -20,13 +20,13 @@ struct Mino final { : m_position{ position }, m_type{ type } { } - OOPETRIS_CORE_EXPORTED [[nodiscard]] helper::TetrominoType type() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED helper::TetrominoType type() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] const grid::GridPoint& position() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED const grid::GridPoint& position() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] grid::GridPoint& position(); + [[nodiscard]] OOPETRIS_CORE_EXPORTED grid::GridPoint& position(); - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool operator==(const Mino& other) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool operator==(const Mino& other) const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool operator!=(const Mino& other) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool operator!=(const Mino& other) const; }; diff --git a/src/libs/core/game/mino_stack.hpp b/src/libs/core/game/mino_stack.hpp index 27555f1a2..8f70d7e67 100644 --- a/src/libs/core/game/mino_stack.hpp +++ b/src/libs/core/game/mino_stack.hpp @@ -1,7 +1,7 @@ #pragma once +#include "../helper/export_symbols.hpp" #include "../helper/types.hpp" -#include "../helper/windows.hpp" #include "./mino.hpp" #include @@ -15,17 +15,17 @@ struct MinoStack final { public: OOPETRIS_CORE_EXPORTED void clear_row_and_let_sink(u8 row); - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool is_empty(grid::GridPoint coordinates) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool is_empty(grid::GridPoint coordinates) const; OOPETRIS_CORE_EXPORTED void set(grid::GridPoint coordinates, helper::TetrominoType type); - OOPETRIS_CORE_EXPORTED [[nodiscard]] u32 num_minos() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED u32 num_minos() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] const std::vector& minos() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED const std::vector& minos() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool operator==(const MinoStack& other) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool operator==(const MinoStack& other) const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool operator!=(const MinoStack& other) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool operator!=(const MinoStack& other) const; }; OOPETRIS_CORE_EXPORTED std::ostream& operator<<(std::ostream& ostream, const MinoStack& mino_stack); diff --git a/src/libs/core/game/tetromino_type.hpp b/src/libs/core/game/tetromino_type.hpp index 88334012f..16571938c 100644 --- a/src/libs/core/game/tetromino_type.hpp +++ b/src/libs/core/game/tetromino_type.hpp @@ -1,8 +1,8 @@ #pragma once #include "../helper/color.hpp" +#include "../helper/export_symbols.hpp" #include "../helper/types.hpp" -#include "../helper/windows.hpp" namespace helper { @@ -17,8 +17,8 @@ namespace helper { LastType = Z, }; - OOPETRIS_CORE_EXPORTED [[nodiscard]] Color get_foreground_color(TetrominoType type, u8 alpha); + [[nodiscard]] OOPETRIS_CORE_EXPORTED Color get_foreground_color(TetrominoType type, u8 alpha); - OOPETRIS_CORE_EXPORTED [[nodiscard]] Color get_background_color(TetrominoType type, u8 alpha); + [[nodiscard]] OOPETRIS_CORE_EXPORTED Color get_background_color(TetrominoType type, u8 alpha); } // namespace helper diff --git a/src/libs/core/hash-library/sha256.h b/src/libs/core/hash-library/sha256.h index 621a182a2..ff4500ba6 100644 --- a/src/libs/core/hash-library/sha256.h +++ b/src/libs/core/hash-library/sha256.h @@ -33,14 +33,14 @@ typedef unsigned __int64 uint64_t; #endif #endif #else -#define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) +#define HASH_LIBRARY_EXPORTED #endif #else // GCC #include -#define HASH_LIBRARY_EXPORTED +#define HASH_LIBRARY_EXPORTED __attribute__((visibility("default"))) #endif namespace hash_library { diff --git a/src/libs/core/helper/color.hpp b/src/libs/core/helper/color.hpp index 120199033..b47601a64 100644 --- a/src/libs/core/helper/color.hpp +++ b/src/libs/core/helper/color.hpp @@ -2,9 +2,9 @@ #include "./const_utils.hpp" #include "./expected.hpp" +#include "./export_symbols.hpp" #include "./types.hpp" #include "./utils.hpp" -#include "./windows.hpp" #include #include @@ -62,19 +62,19 @@ struct HSVColor { constexpr HSVColor() : HSVColor{ 0.0, 0.0, 0.0, 0 } { } - OOPETRIS_CORE_EXPORTED [[nodiscard]] static helper::expected from_string( + [[nodiscard]] OOPETRIS_CORE_EXPORTED static helper::expected from_string( const std::string& value ); using InfoType = std::tuple; - OOPETRIS_CORE_EXPORTED [[nodiscard]] static helper::expected from_string_with_info( + [[nodiscard]] OOPETRIS_CORE_EXPORTED static helper::expected from_string_with_info( const std::string& value ); - OOPETRIS_CORE_EXPORTED [[nodiscard]] Color to_rgb_color() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED Color to_rgb_color() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] std::string to_string(bool force_alpha = false) const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED std::string to_string(bool force_alpha = false) const; OOPETRIS_CORE_EXPORTED std::ostream& operator<<(std::ostream& os) const; }; @@ -140,18 +140,18 @@ struct Color { constexpr Color(u8 red, u8 green, u8 blue) : Color{ red, green, blue, 0xFF } { } - OOPETRIS_CORE_EXPORTED [[nodiscard]] static helper::expected from_string( + [[nodiscard]] OOPETRIS_CORE_EXPORTED static helper::expected from_string( const std::string& value ); using InfoType = std::tuple; - OOPETRIS_CORE_EXPORTED [[nodiscard]] static helper::expected from_string_with_info( + [[nodiscard]] OOPETRIS_CORE_EXPORTED static helper::expected from_string_with_info( const std::string& value ); - OOPETRIS_CORE_EXPORTED [[nodiscard]] HSVColor to_hsv_color() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED HSVColor to_hsv_color() const; constexpr Color(const HSVColor& color) { //NOLINT(google-explicit-constructor) @@ -263,7 +263,7 @@ struct Color { return Color{ 0xFF, 0xFF, 0xFF, alpha }; }; - OOPETRIS_CORE_EXPORTED [[nodiscard]] std::string + [[nodiscard]] OOPETRIS_CORE_EXPORTED std::string to_string(color::SerializeMode mode = color::SerializeMode::RGB, bool force_alpha = false) const; OOPETRIS_CORE_EXPORTED std::ostream& operator<<(std::ostream& os) const; diff --git a/src/libs/core/helper/date.hpp b/src/libs/core/helper/date.hpp index 1f4878128..acd770fea 100644 --- a/src/libs/core/helper/date.hpp +++ b/src/libs/core/helper/date.hpp @@ -1,8 +1,8 @@ #pragma once #include "./expected.hpp" +#include "./export_symbols.hpp" #include "./types.hpp" -#include "./windows.hpp" #include #include @@ -23,9 +23,9 @@ namespace date { OOPETRIS_CORE_EXPORTED static ISO8601Date now(); OOPETRIS_CORE_EXPORTED static helper::expected from_string(const std::string& input); - OOPETRIS_CORE_EXPORTED [[nodiscard]] helper::expected to_string() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED helper::expected to_string() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] u64 value() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED u64 value() const; private: [[nodiscard]] static helper::expected get_tm_struct(std::time_t value); diff --git a/src/libs/core/helper/errors.hpp b/src/libs/core/helper/errors.hpp index 525cfb1a5..f902701bd 100644 --- a/src/libs/core/helper/errors.hpp +++ b/src/libs/core/helper/errors.hpp @@ -2,8 +2,8 @@ #pragma once +#include "./export_symbols.hpp" #include "./types.hpp" -#include "./windows.hpp" #include @@ -32,12 +32,12 @@ namespace helper { [[nodiscard]] GeneralError& operator=(const GeneralError& error) noexcept; OOPETRIS_CORE_EXPORTED GeneralError(GeneralError&& error) noexcept; - OOPETRIS_CORE_EXPORTED [[nodiscard]] GeneralError& operator=(GeneralError&& error) noexcept; + [[nodiscard]] OOPETRIS_CORE_EXPORTED GeneralError& operator=(GeneralError&& error) noexcept; - OOPETRIS_CORE_EXPORTED [[nodiscard]] const std::string& message() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] error::Severity severity() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED const std::string& message() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED error::Severity severity() const; - OOPETRIS_CORE_EXPORTED [[nodiscard]] const char* what() const noexcept override; + [[nodiscard]] OOPETRIS_CORE_EXPORTED const char* what() const noexcept override; }; struct FatalError : public GeneralError { diff --git a/src/libs/core/helper/export_helper.hpp b/src/libs/core/helper/export_helper.hpp new file mode 100644 index 000000000..ffc0617d9 --- /dev/null +++ b/src/libs/core/helper/export_helper.hpp @@ -0,0 +1,23 @@ + +#pragma once + +// see: https://gcc.gnu.org/wiki/Visibility + +// clang-format off +#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + #define OOPETRIS_ONLY_LOCAL + + #if defined(__GNUC__) + #define OOPETRIS_DLL_EXPORT __attribute__((dllexport)) + #define OOPETRIS_DLL_IMPORT __attribute__((dllimport)) + #else + #define OOPETRIS_DLL_EXPORT __declspec(dllexport) + #define OOPETRIS_DLL_IMPORT __declspec(dllimport) + #endif +#else + #define OOPETRIS_ONLY_LOCAL __attribute__((visibility("hidden"))) + + #define OOPETRIS_DLL_EXPORT __attribute__((visibility("default"))) + #define OOPETRIS_DLL_IMPORT __attribute__((visibility("default"))) +#endif +// clang-format on diff --git a/src/libs/core/helper/export_symbols.hpp b/src/libs/core/helper/export_symbols.hpp new file mode 100644 index 000000000..18cfeb279 --- /dev/null +++ b/src/libs/core/helper/export_symbols.hpp @@ -0,0 +1,14 @@ +#pragma once + +// see https://gcc.gnu.org/wiki/Visibility +#include + +#if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0 +#if defined(OOPETRIS_LIBRARY_CORE_EXPORT) +#define OOPETRIS_CORE_EXPORTED OOPETRIS_DLL_EXPORT +#else +#define OOPETRIS_CORE_EXPORTED OOPETRIS_DLL_IMPORT +#endif +#else +#define OOPETRIS_CORE_EXPORTED OOPETRIS_ONLY_LOCAL +#endif diff --git a/src/libs/core/helper/meson.build b/src/libs/core/helper/meson.build index 6a65c8dd3..add7ca856 100644 --- a/src/libs/core/helper/meson.build +++ b/src/libs/core/helper/meson.build @@ -11,12 +11,14 @@ core_src_files += files( _header_files = files( 'bool_wrapper.hpp', - 'color_literals.hpp', 'color.hpp', + 'color_literals.hpp', 'const_utils.hpp', 'date.hpp', 'errors.hpp', 'expected.hpp', + 'export_helper.hpp', + 'export_symbols.hpp', 'input_event.hpp', 'magic_enum_wrapper.hpp', 'parse_json.hpp', @@ -30,7 +32,6 @@ _header_files = files( 'types.hpp', 'utils.hpp', 'versions.hpp', - 'windows.hpp', ) core_header_files += _header_files diff --git a/src/libs/core/helper/parse_json.hpp b/src/libs/core/helper/parse_json.hpp index 23b9117f2..09022614e 100644 --- a/src/libs/core/helper/parse_json.hpp +++ b/src/libs/core/helper/parse_json.hpp @@ -10,7 +10,7 @@ #include #include "./expected.hpp" -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include @@ -188,7 +188,7 @@ namespace json { OOPETRIS_CORE_EXPORTED std::string get_json_type(const nlohmann::json::value_t& type); - OOPETRIS_CORE_EXPORTED [[nodiscard]] bool is_meta_key(const std::string& key); + [[nodiscard]] OOPETRIS_CORE_EXPORTED bool is_meta_key(const std::string& key); OOPETRIS_CORE_EXPORTED void check_for_no_additional_keys(const nlohmann::json& obj, const std::vector& keys); diff --git a/src/libs/core/helper/random.hpp b/src/libs/core/helper/random.hpp index ced8f629a..a3cd6ac2b 100644 --- a/src/libs/core/helper/random.hpp +++ b/src/libs/core/helper/random.hpp @@ -1,7 +1,7 @@ #pragma once +#include "./export_symbols.hpp" #include "./utils.hpp" -#include "./windows.hpp" #include @@ -24,9 +24,9 @@ struct Random { return distribution(m_generator); } - OOPETRIS_CORE_EXPORTED [[nodiscard]] double random(); + [[nodiscard]] OOPETRIS_CORE_EXPORTED double random(); - OOPETRIS_CORE_EXPORTED [[nodiscard]] Seed seed() const; + [[nodiscard]] OOPETRIS_CORE_EXPORTED Seed seed() const; OOPETRIS_CORE_EXPORTED void seed(Seed seed); diff --git a/src/libs/core/helper/sleep.hpp b/src/libs/core/helper/sleep.hpp index f86c1c3b8..d43f21d3d 100644 --- a/src/libs/core/helper/sleep.hpp +++ b/src/libs/core/helper/sleep.hpp @@ -1,6 +1,6 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include diff --git a/src/libs/core/helper/string_manipulation.hpp b/src/libs/core/helper/string_manipulation.hpp index fbeb345f8..dd79f85e4 100644 --- a/src/libs/core/helper/string_manipulation.hpp +++ b/src/libs/core/helper/string_manipulation.hpp @@ -1,7 +1,7 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include diff --git a/src/libs/core/helper/timer.hpp b/src/libs/core/helper/timer.hpp index 3879bee18..da06fadc9 100644 --- a/src/libs/core/helper/timer.hpp +++ b/src/libs/core/helper/timer.hpp @@ -5,7 +5,7 @@ #include #include -#include "./windows.hpp" +#include "./export_symbols.hpp" namespace helper { diff --git a/src/libs/core/helper/windows.hpp b/src/libs/core/helper/windows.hpp deleted file mode 100644 index 946dd0896..000000000 --- a/src/libs/core/helper/windows.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -#if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0 -#if defined(OOPETRIS_LIBRARY_CORE_EXPORT) -#if defined(__GNUC__) -#define OOPETRIS_CORE_EXPORTED __attribute__((dllexport)) -#else -#define OOPETRIS_CORE_EXPORTED __declspec(dllexport) -#endif -#else -#if defined(__GNUC__) -#define OOPETRIS_CORE_EXPORTED __attribute__((dllimport)) -#else -#define OOPETRIS_CORE_EXPORTED __declspec(dllimport) -#endif -#endif -#else -#define OOPETRIS_CORE_EXPORTED __attribute__((visibility("default"))) -#endif -#else -#define OOPETRIS_CORE_EXPORTED -#endif diff --git a/src/libs/recordings/utility/additional_information.hpp b/src/libs/recordings/utility/additional_information.hpp index eb29dae66..57fbd06d2 100644 --- a/src/libs/recordings/utility/additional_information.hpp +++ b/src/libs/recordings/utility/additional_information.hpp @@ -2,8 +2,8 @@ #pragma once #include "./checksum_helper.hpp" +#include "./export_symbols.hpp" #include "./helper.hpp" -#include "./windows.hpp" #include #include @@ -65,7 +65,7 @@ namespace recorder { return m_value; } - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] std::string to_string(u32 recursion_depth = 0) const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED std::string to_string(u32 recursion_depth = 0) const; template [[nodiscard]] bool operator==(const T& other) const { // NOLINT(misc-no-recursion) @@ -118,11 +118,11 @@ namespace recorder { OOPETRIS_RECORDINGS_EXPORTED static helper::expected, std::string> read_from_istream(std::istream& istream); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected, std::string> to_bytes( + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected, std::string> to_bytes( u32 recursion_depth = 0 ) const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] static std::vector string_to_bytes(const std::string& value); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED static std::vector string_to_bytes(const std::string& value); private: static helper::expected read_string_from_istream(std::istream& istream); @@ -158,9 +158,9 @@ namespace recorder { add_value(key, value, overwrite); } - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] std::optional get(const std::string& key) const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED std::optional get(const std::string& key) const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] bool has(const std::string& key) const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED bool has(const std::string& key) const; template [[nodiscard]] std::optional get_if(const std::string& key) const { @@ -178,9 +178,9 @@ namespace recorder { return value.as(); } - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected, std::string> to_bytes() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected, std::string> to_bytes() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected get_checksum( + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected get_checksum( ) const; // iterator trait @@ -193,13 +193,13 @@ namespace recorder { using iterator_category = std::bidirectional_iterator_tag; //NOLINT(readability-identifier-naming) - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] iterator begin(); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED iterator begin(); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const_iterator begin() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const_iterator begin() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] iterator end(); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED iterator end(); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const_iterator end() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const_iterator end() const; }; STATIC_ASSERT_WITH_MESSAGE( diff --git a/src/libs/recordings/utility/checksum_helper.hpp b/src/libs/recordings/utility/checksum_helper.hpp index 53ddcd32d..ed9f959c1 100644 --- a/src/libs/recordings/utility/checksum_helper.hpp +++ b/src/libs/recordings/utility/checksum_helper.hpp @@ -2,7 +2,7 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include @@ -48,5 +48,5 @@ struct Sha256Stream { return *this; } - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] Checksum get_hash(); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED Checksum get_hash(); }; diff --git a/src/libs/recordings/utility/export_symbols.hpp b/src/libs/recordings/utility/export_symbols.hpp new file mode 100644 index 000000000..307748026 --- /dev/null +++ b/src/libs/recordings/utility/export_symbols.hpp @@ -0,0 +1,15 @@ +#pragma once + +// see https://gcc.gnu.org/wiki/Visibility +#include + + +#if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0 +#if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT) +#define OOPETRIS_RECORDINGS_EXPORTED OOPETRIS_DLL_EXPORT +#else +#define OOPETRIS_RECORDINGS_EXPORTED OOPETRIS_DLL_IMPORT +#endif +#else +#define OOPETRIS_RECORDINGS_EXPORTED OOPETRIS_ONLY_LOCAL +#endif diff --git a/src/libs/recordings/utility/meson.build b/src/libs/recordings/utility/meson.build index 226be7967..ce0330c94 100644 --- a/src/libs/recordings/utility/meson.build +++ b/src/libs/recordings/utility/meson.build @@ -17,7 +17,7 @@ _header_files = files( 'recording_writer.hpp', 'tetrion_core_information.hpp', 'tetrion_snapshot.hpp', - 'windows.hpp', + 'export_symbols.hpp', ) recordings_header_files += _header_files diff --git a/src/libs/recordings/utility/recording.hpp b/src/libs/recordings/utility/recording.hpp index bb35d89cd..2faff8f76 100644 --- a/src/libs/recordings/utility/recording.hpp +++ b/src/libs/recordings/utility/recording.hpp @@ -1,6 +1,6 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include #include @@ -58,11 +58,11 @@ namespace recorder { Recording& operator=(Recording&&) = delete; virtual ~Recording() = default; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const std::vector& tetrion_headers() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const std::vector& tetrion_headers() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const AdditionalInformation& information() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const AdditionalInformation& information() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] static Sha256Stream::Checksum get_header_checksum( + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED static Sha256Stream::Checksum get_header_checksum( u8 version_number, const std::vector& tetrion_headers, const AdditionalInformation& information diff --git a/src/libs/recordings/utility/recording_reader.hpp b/src/libs/recordings/utility/recording_reader.hpp index 106bc07ee..5e353f178 100644 --- a/src/libs/recordings/utility/recording_reader.hpp +++ b/src/libs/recordings/utility/recording_reader.hpp @@ -1,6 +1,6 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include "./helper.hpp" @@ -32,15 +32,15 @@ namespace recorder { const std::filesystem::path& path ); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const Record& at(usize index) const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const Record& at(usize index) const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] usize num_records() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED usize num_records() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const UnderlyingContainer& records() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const UnderlyingContainer& records() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const std::vector& snapshots() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const std::vector& snapshots() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] static helper:: + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED static helper:: expected>, std::string> is_header_valid(const std::filesystem::path& path); @@ -53,13 +53,13 @@ namespace recorder { using reference = UnderlyingContainer::reference; //NOLINT(readability-identifier-naming) using iterator_category = std::bidirectional_iterator_tag; //NOLINT(readability-identifier-naming) - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] iterator begin(); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED iterator begin(); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const_iterator begin() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const_iterator begin() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] iterator end(); + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED iterator end(); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const_iterator end() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const_iterator end() const; private: [[nodiscard]] static helper::expected< diff --git a/src/libs/recordings/utility/recording_writer.hpp b/src/libs/recordings/utility/recording_writer.hpp index 50a9db82b..22e01eff0 100644 --- a/src/libs/recordings/utility/recording_writer.hpp +++ b/src/libs/recordings/utility/recording_writer.hpp @@ -5,7 +5,7 @@ #include "./recording.hpp" #include "./tetrion_core_information.hpp" -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include @@ -32,13 +32,13 @@ namespace recorder { bool overwrite = false ); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected add_record( + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected add_record( u8 tetrion_index, // NOLINT(bugprone-easily-swappable-parameters) u64 simulation_step_index, InputEvent event ); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected add_snapshot(u64 simulation_step_index, std::unique_ptr information); private: diff --git a/src/libs/recordings/utility/tetrion_snapshot.hpp b/src/libs/recordings/utility/tetrion_snapshot.hpp index f833e7644..7f4e31df8 100644 --- a/src/libs/recordings/utility/tetrion_snapshot.hpp +++ b/src/libs/recordings/utility/tetrion_snapshot.hpp @@ -1,6 +1,6 @@ #pragma once -#include "./windows.hpp" +#include "./export_symbols.hpp" #include #include #include @@ -46,21 +46,21 @@ struct TetrionSnapshot final { OOPETRIS_RECORDINGS_EXPORTED TetrionSnapshot(std::unique_ptr information, SimulationStep simulation_step_index); - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] u8 tetrion_index() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED u8 tetrion_index() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] Level level() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED Level level() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] Score score() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED Score score() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] LineCount lines_cleared() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED LineCount lines_cleared() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] u64 simulation_step_index() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED u64 simulation_step_index() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] const MinoStack& mino_stack() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED const MinoStack& mino_stack() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] std::vector to_bytes() const; + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED std::vector to_bytes() const; - OOPETRIS_RECORDINGS_EXPORTED [[nodiscard]] helper::expected compare_to( + [[nodiscard]] OOPETRIS_RECORDINGS_EXPORTED helper::expected compare_to( const TetrionSnapshot& other ) const; }; diff --git a/src/libs/recordings/utility/windows.hpp b/src/libs/recordings/utility/windows.hpp deleted file mode 100644 index 026c5ae75..000000000 --- a/src/libs/recordings/utility/windows.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -#if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0 -#if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT) -#if defined(__GNUC__) -#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((dllexport)) -#else -#define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllexport) -#endif -#else -#if defined(__GNUC__) -#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((dllimport)) -#else -#define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllimport) -#endif -#endif -#else -#define OOPETRIS_RECORDINGS_EXPORTED __attribute__((visibility("default"))) -#endif -#else -#define OOPETRIS_RECORDINGS_EXPORTED -#endif diff --git a/src/lobby/api.hpp b/src/lobby/api.hpp index a4d9a24a8..4b51c6a45 100644 --- a/src/lobby/api.hpp +++ b/src/lobby/api.hpp @@ -6,7 +6,7 @@ #include "./credentials/secret.hpp" #include "./types.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include @@ -41,8 +41,7 @@ namespace lobby { OOPETRIS_GRAPHICS_EXPORTED ~API(); - OOPETRIS_GRAPHICS_EXPORTED - [[nodiscard]] helper::expected static get_api( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected static get_api( ServiceProvider* service_provider, const std::string& url ); @@ -54,38 +53,38 @@ namespace lobby { std::function&& callback ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_authenticated(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_authenticated(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool authenticate(const Credentials& credentials); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool authenticate(const Credentials& credentials); OOPETRIS_GRAPHICS_EXPORTED void logout(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected, std::string> get_lobbies(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected, std::string> get_lobbies(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected join_lobby(int lobby_id); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected join_lobby(int lobby_id); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected get_lobby_detail( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected get_lobby_detail( int lobby_id ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected delete_lobby(int lobby_id); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected delete_lobby(int lobby_id); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected leave_lobby(int lobby_id); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected leave_lobby(int lobby_id); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected start_lobby(int lobby_id); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected start_lobby(int lobby_id); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected create_lobby( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected create_lobby( const CreateLobbyRequest& arguments ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected, std::string> get_users(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected, std::string> get_users(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected register_user( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected register_user( const RegisterRequest& register_request ); private: - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool setup_authentication(const std::string& token); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool setup_authentication(const std::string& token); }; diff --git a/src/lobby/client.hpp b/src/lobby/client.hpp index 5e3f470f0..14cf7c0f2 100644 --- a/src/lobby/client.hpp +++ b/src/lobby/client.hpp @@ -4,7 +4,7 @@ #include "./constants.hpp" #include "./types.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include #include @@ -21,36 +21,36 @@ namespace oopetris::http { struct Result { //NOLINT(cppcoreguidelines-special-member-functions) OOPETRIS_GRAPHICS_EXPORTED virtual ~Result(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_header(const std::string& key + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::optional get_header(const std::string& key ) const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::string body() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::string body() const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual int status() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual int status() const = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional get_error() const = 0; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::optional get_error() const = 0; }; struct Client { //NOLINT(cppcoreguidelines-special-member-functions) OOPETRIS_GRAPHICS_EXPORTED virtual ~Client(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::unique_ptr Get( //NOLINT(readability-identifier-naming) const std::string& url ) = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::unique_ptr Delete( //NOLINT(readability-identifier-naming) const std::string& url ) = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::unique_ptr Post( //NOLINT(readability-identifier-naming) const std::string& url, const std::optional>& payload ) = 0; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED virtual std::unique_ptr Put( //NOLINT(readability-identifier-naming) const std::string& url, const std::optional>& payload @@ -63,7 +63,7 @@ namespace oopetris::http { OOPETRIS_GRAPHICS_EXPORTED virtual void ResetBearerAuth() = 0; //NOLINT(readability-identifier-naming) }; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string status_message(int status); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string status_message(int status); OOPETRIS_GRAPHICS_EXPORTED helper::expected is_json_response( const std::unique_ptr& result diff --git a/src/lobby/credentials/buffer.hpp b/src/lobby/credentials/buffer.hpp index 73a5790cc..ecd805697 100644 --- a/src/lobby/credentials/buffer.hpp +++ b/src/lobby/credentials/buffer.hpp @@ -5,7 +5,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" namespace secret { struct Buffer { diff --git a/src/lobby/credentials/secret.hpp b/src/lobby/credentials/secret.hpp index ddc278420..5d3330977 100644 --- a/src/lobby/credentials/secret.hpp +++ b/src/lobby/credentials/secret.hpp @@ -8,7 +8,7 @@ #include #include "./buffer.hpp" -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "manager/service_provider.hpp" #if defined(__linux__) @@ -52,13 +52,13 @@ namespace secret { OOPETRIS_GRAPHICS_EXPORTED SecretStorage(SecretStorage&& other) noexcept; SecretStorage& operator=(SecretStorage&& other) noexcept = delete; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::expected load(const std::string& key + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::expected load(const std::string& key ) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional store(const std::string& key, const Buffer& value, bool update = true) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional remove(const std::string& key) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional remove(const std::string& key) const; }; } // namespace secret diff --git a/src/lobby/curl_client.hpp b/src/lobby/curl_client.hpp index 64c6c4da9..60505fa06 100644 --- a/src/lobby/curl_client.hpp +++ b/src/lobby/curl_client.hpp @@ -36,14 +36,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED ActualResult(const ActualResult& other) = delete; OOPETRIS_GRAPHICS_EXPORTED ActualResult& operator=(const ActualResult& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_header(const std::string& key + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_header(const std::string& key ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string body() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string body() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] int status() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED int status() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_error() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_error() const override; }; @@ -65,14 +65,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED explicit ActualClient(const std::string& api_url); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Get(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Get(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Delete(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Delete(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Post(const std::string& url, const std::optional>& payload) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Put(const std::string& url, const std::optional>& payload) override; OOPETRIS_GRAPHICS_EXPORTED void SetBearerAuth(const std::string& token) override; diff --git a/src/lobby/httplib_client.hpp b/src/lobby/httplib_client.hpp index 894e05e28..73a785541 100644 --- a/src/lobby/httplib_client.hpp +++ b/src/lobby/httplib_client.hpp @@ -39,14 +39,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED ActualResult(const ActualResult& other) = delete; OOPETRIS_GRAPHICS_EXPORTED ActualResult& operator=(const ActualResult& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_header(const std::string& key + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_header(const std::string& key ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string body() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string body() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] int status() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED int status() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_error() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_error() const override; }; @@ -65,14 +65,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED explicit ActualClient(const std::string& api_url); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Get(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Get(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Delete(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Delete(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Post(const std::string& url, const std::optional>& payload) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Put(const std::string& url, const std::optional>& payload) override; OOPETRIS_GRAPHICS_EXPORTED void SetBearerAuth(const std::string& token) override; diff --git a/src/lobby/web_client.hpp b/src/lobby/web_client.hpp index 014d59e39..000087914 100644 --- a/src/lobby/web_client.hpp +++ b/src/lobby/web_client.hpp @@ -30,14 +30,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED ActualResult(const ActualResult& other) = delete; OOPETRIS_GRAPHICS_EXPORTED ActualResult& operator=(const ActualResult& other) = delete; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_header(const std::string& key + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_header(const std::string& key ) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string body() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string body() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] int status() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED int status() const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_error() const override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_error() const override; }; @@ -58,14 +58,14 @@ namespace oopetris::http::implementation { OOPETRIS_GRAPHICS_EXPORTED explicit ActualClient(const std::string& api_url); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Get(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Get(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr Delete(const std::string& url) override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Delete(const std::string& url) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Post(const std::string& url, const std::optional>& payload) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr Put(const std::string& url, const std::optional>& payload) override; OOPETRIS_GRAPHICS_EXPORTED void SetBearerAuth(const std::string& token) override; diff --git a/src/manager/font.hpp b/src/manager/font.hpp index 5a161d48c..af721268a 100644 --- a/src/manager/font.hpp +++ b/src/manager/font.hpp @@ -5,7 +5,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" struct FontLoadingError final : public std::exception { private: @@ -28,7 +28,7 @@ struct Font final { Font() = default; OOPETRIS_GRAPHICS_EXPORTED Font(const std::filesystem::path& path, int size); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] TTF_Font* get() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED TTF_Font* get() const; friend struct Text; friend struct Renderer; diff --git a/src/manager/music_manager.hpp b/src/manager/music_manager.hpp index d214d849f..6355f09b8 100644 --- a/src/manager/music_manager.hpp +++ b/src/manager/music_manager.hpp @@ -3,7 +3,7 @@ #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/input.hpp" #include "manager/service_provider.hpp" @@ -55,7 +55,7 @@ struct MusicManager final { play_effect(const std::string& name, u8 channel_num = 1, int loop = 0); //TODO(Totto): atm the volume changers only work on the music channel, when adding more effects, this should support channels via https://wiki.libsdl.org/SDL2_mixer/Mix_Volume - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional get_volume() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional get_volume() const; OOPETRIS_GRAPHICS_EXPORTED void set_volume(std::optional new_volume, bool force_update = false, bool notify_listeners = true); diff --git a/src/manager/sdl_controller_key.hpp b/src/manager/sdl_controller_key.hpp index b65ddef4f..b88ae6632 100644 --- a/src/manager/sdl_controller_key.hpp +++ b/src/manager/sdl_controller_key.hpp @@ -2,7 +2,7 @@ #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include #include @@ -21,9 +21,9 @@ namespace sdl { const std::string& value ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool operator==(const ControllerKey& other) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool operator==(const ControllerKey& other) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string to_string() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string to_string() const; }; diff --git a/src/manager/sdl_key.hpp b/src/manager/sdl_key.hpp index 330889a40..899245e61 100644 --- a/src/manager/sdl_key.hpp +++ b/src/manager/sdl_key.hpp @@ -3,7 +3,7 @@ #include #include -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include #include @@ -53,7 +53,7 @@ namespace sdl { OOPETRIS_GRAPHICS_EXPORTED static helper::expected from_string(const std::string& value); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_key(const Key& other) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_key(const Key& other) const; /** * @brief Checks if the key has a modifier, this performs a logical check, e.g. LALT and ALT are treated as match @@ -61,7 +61,7 @@ namespace sdl { * @param modifier * @return bool */ - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool has_modifier(const Modifier& modifier) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool has_modifier(const Modifier& modifier) const; /** * @brief Checks if the key has a modifier, this performs a exact check, e.g. LALT and ALT are treated as NON-match @@ -69,7 +69,7 @@ namespace sdl { * @param modifier * @return bool */ - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool has_modifier_exact(const Modifier& modifier) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool has_modifier_exact(const Modifier& modifier) const; /** * @brief Shorthand for is_equal(key, true); @@ -77,7 +77,7 @@ namespace sdl { * @param other * @return bool */ - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool operator==(const Key& other) const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool operator==(const Key& other) const; /** * @brief compare two keys with another, this IS symmetrical. The result is true when these conditions are met: @@ -98,10 +98,10 @@ namespace sdl { * @param ignore_special_modifiers * @return bool */ - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_equal(const Key& other, bool ignore_special_modifiers = true) + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_equal(const Key& other, bool ignore_special_modifiers = true) const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string to_string() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string to_string() const; private: [[nodiscard]] static helper::expected sdl_keycode_from_string(const std::string& value diff --git a/src/manager/settings.hpp b/src/manager/settings.hpp index d77943bcb..425baf8a3 100644 --- a/src/manager/settings.hpp +++ b/src/manager/settings.hpp @@ -1,7 +1,7 @@ #pragma once -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/controller_input.hpp" #include "input/joystick_input.hpp" #include "input/keyboard_input.hpp" diff --git a/src/manager/settings_manager.hpp b/src/manager/settings_manager.hpp index 2d73a0ca4..81bfff8b2 100644 --- a/src/manager/settings_manager.hpp +++ b/src/manager/settings_manager.hpp @@ -1,7 +1,7 @@ #pragma once -#include "helper/windows.hpp" +#include "helper/export_symbols.hpp" #include "input/controller_input.hpp" #include "input/joystick_input.hpp" #include "input/keyboard_input.hpp" @@ -23,7 +23,7 @@ struct SettingsManager { public: OOPETRIS_GRAPHICS_EXPORTED explicit SettingsManager(ServiceProvider* service_provider); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const settings::Settings& settings() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const settings::Settings& settings() const; OOPETRIS_GRAPHICS_EXPORTED void add_callback(Callback&& callback); diff --git a/src/scenes/about_page/about_page.hpp b/src/scenes/about_page/about_page.hpp index e937bed00..7f49fa059 100644 --- a/src/scenes/about_page/about_page.hpp +++ b/src/scenes/about_page/about_page.hpp @@ -22,7 +22,7 @@ namespace scenes { public: OOPETRIS_GRAPHICS_EXPORTED explicit AboutPage(ServiceProvider* service_provider, const ui::Layout& layout); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/logo/logo.hpp b/src/scenes/logo/logo.hpp index 798c0faef..d2c7f7ab2 100644 --- a/src/scenes/logo/logo.hpp +++ b/src/scenes/logo/logo.hpp @@ -9,7 +9,7 @@ namespace logo { constexpr const auto width = 33; constexpr const auto height = 5; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture get_logo(const ServiceProvider* service_provider, double scale = 1.0); } // namespace logo diff --git a/src/scenes/main_menu/main_menu.hpp b/src/scenes/main_menu/main_menu.hpp index 61996ac18..34706cd39 100644 --- a/src/scenes/main_menu/main_menu.hpp +++ b/src/scenes/main_menu/main_menu.hpp @@ -23,7 +23,7 @@ namespace scenes { public: OOPETRIS_GRAPHICS_EXPORTED explicit MainMenu(ServiceProvider* service_provider, const ui::Layout& layout); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/multiplayer_menu/multiplayer_menu.hpp b/src/scenes/multiplayer_menu/multiplayer_menu.hpp index 0b381e803..feb17a2fb 100644 --- a/src/scenes/multiplayer_menu/multiplayer_menu.hpp +++ b/src/scenes/multiplayer_menu/multiplayer_menu.hpp @@ -20,7 +20,7 @@ namespace scenes { const ui::Layout& layout ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/online_lobby/online_lobby.hpp b/src/scenes/online_lobby/online_lobby.hpp index 91fa4caa6..65cc64d50 100644 --- a/src/scenes/online_lobby/online_lobby.hpp +++ b/src/scenes/online_lobby/online_lobby.hpp @@ -19,7 +19,7 @@ namespace scenes { public: OOPETRIS_GRAPHICS_EXPORTED explicit OnlineLobby(ServiceProvider* service_provider, const ui::Layout& layout); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/play_select_menu/play_select_menu.hpp b/src/scenes/play_select_menu/play_select_menu.hpp index 6982e40be..5fbc120ac 100644 --- a/src/scenes/play_select_menu/play_select_menu.hpp +++ b/src/scenes/play_select_menu/play_select_menu.hpp @@ -17,7 +17,7 @@ namespace scenes { public: OOPETRIS_GRAPHICS_EXPORTED explicit PlaySelectMenu(ServiceProvider* service_provider, const ui::Layout& layout); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/recording_selector/recording_chooser.hpp b/src/scenes/recording_selector/recording_chooser.hpp index c8082764f..429aa1840 100644 --- a/src/scenes/recording_selector/recording_chooser.hpp +++ b/src/scenes/recording_selector/recording_chooser.hpp @@ -28,10 +28,10 @@ namespace custom_ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::vector& get_currently_chosen_files( + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::vector& get_currently_chosen_files( ) const; private: diff --git a/src/scenes/recording_selector/recording_component.hpp b/src/scenes/recording_selector/recording_component.hpp index 5e812c935..9760dda96 100644 --- a/src/scenes/recording_selector/recording_component.hpp +++ b/src/scenes/recording_selector/recording_component.hpp @@ -47,10 +47,10 @@ namespace custom_ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] data::RecordingMetadata metadata() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED data::RecordingMetadata metadata() const; private: [[nodiscard]] std::tuple get_texts(); diff --git a/src/scenes/recording_selector/recording_selector.hpp b/src/scenes/recording_selector/recording_selector.hpp index f7ce46483..218883b34 100644 --- a/src/scenes/recording_selector/recording_selector.hpp +++ b/src/scenes/recording_selector/recording_selector.hpp @@ -42,7 +42,7 @@ namespace scenes { const ui::Layout& layout ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; diff --git a/src/scenes/replay_game/replay_game.hpp b/src/scenes/replay_game/replay_game.hpp index c452edcdc..66095a9aa 100644 --- a/src/scenes/replay_game/replay_game.hpp +++ b/src/scenes/replay_game/replay_game.hpp @@ -20,9 +20,9 @@ namespace scenes { const std::filesystem::path& recording_path ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; }; diff --git a/src/scenes/scene.hpp b/src/scenes/scene.hpp index d9fad46d7..407782c46 100644 --- a/src/scenes/scene.hpp +++ b/src/scenes/scene.hpp @@ -80,9 +80,9 @@ namespace scenes { handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) = 0; // override this, if you (the scene) could potentially be displayed in non fullscreen! OOPETRIS_GRAPHICS_EXPORTED virtual void on_unhover(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const ui::Layout& get_layout() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const ui::Layout& get_layout() const; }; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr create_scene(ServiceProvider& service_provider, SceneId identifier, const ui::Layout& layout); } // namespace scenes diff --git a/src/scenes/settings_menu/color_setting_row.hpp b/src/scenes/settings_menu/color_setting_row.hpp index 292dbc9d6..326c11156 100644 --- a/src/scenes/settings_menu/color_setting_row.hpp +++ b/src/scenes/settings_menu/color_setting_row.hpp @@ -30,13 +30,13 @@ namespace detail { bool is_top_level ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Color& color(); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Color& color(); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const Color& color() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const Color& color() const; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; }; @@ -56,7 +56,7 @@ namespace detail { Callback callback ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] scenes::Scene::UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED scenes::Scene::UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; diff --git a/src/scenes/settings_menu/settings_menu.hpp b/src/scenes/settings_menu/settings_menu.hpp index 831dbe347..12c04e5e5 100644 --- a/src/scenes/settings_menu/settings_menu.hpp +++ b/src/scenes/settings_menu/settings_menu.hpp @@ -66,7 +66,7 @@ namespace scenes { const std::shared_ptr& game_input ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; diff --git a/src/scenes/single_player_game/game_over.hpp b/src/scenes/single_player_game/game_over.hpp index f367fd8ff..cfc671738 100644 --- a/src/scenes/single_player_game/game_over.hpp +++ b/src/scenes/single_player_game/game_over.hpp @@ -18,7 +18,7 @@ namespace scenes { const std::shared_ptr& game_input ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; diff --git a/src/scenes/single_player_game/pause.hpp b/src/scenes/single_player_game/pause.hpp index 52a327ffc..87de8f322 100644 --- a/src/scenes/single_player_game/pause.hpp +++ b/src/scenes/single_player_game/pause.hpp @@ -19,11 +19,11 @@ namespace scenes { const std::shared_ptr& game_input ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; }; } // namespace scenes diff --git a/src/scenes/single_player_game/single_player_game.hpp b/src/scenes/single_player_game/single_player_game.hpp index 4df415dfb..da9aecd65 100644 --- a/src/scenes/single_player_game/single_player_game.hpp +++ b/src/scenes/single_player_game/single_player_game.hpp @@ -20,9 +20,9 @@ namespace scenes { const ui::Layout& layout ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] UpdateResult update() override; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED UpdateResult update() override; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; }; diff --git a/src/ui/components/color_picker.hpp b/src/ui/components/color_picker.hpp index da72564d1..34a407ea5 100644 --- a/src/ui/components/color_picker.hpp +++ b/src/ui/components/color_picker.hpp @@ -63,7 +63,7 @@ namespace detail { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void on_change(ColorChangeOrigin origin, const HSVColor& color); @@ -118,10 +118,10 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Color get_color() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Color get_color() const; private: void after_color_change(detail::ColorChangeOrigin origin, const HSVColor& color); diff --git a/src/ui/components/image_view.hpp b/src/ui/components/image_view.hpp index 5c72b0edf..d9175c37a 100644 --- a/src/ui/components/image_view.hpp +++ b/src/ui/components/image_view.hpp @@ -27,7 +27,7 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& even) override; }; } // namespace ui diff --git a/src/ui/components/label.hpp b/src/ui/components/label.hpp index 36936ce16..058a5e2ed 100644 --- a/src/ui/components/label.hpp +++ b/src/ui/components/label.hpp @@ -24,7 +24,7 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& /*event*/) override; OOPETRIS_GRAPHICS_EXPORTED void set_text(const ServiceProvider& service_provider, const std::string& text); diff --git a/src/ui/components/link_label.hpp b/src/ui/components/link_label.hpp index cd04a0d96..e5dde35a4 100644 --- a/src/ui/components/link_label.hpp +++ b/src/ui/components/link_label.hpp @@ -42,7 +42,7 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) override; OOPETRIS_GRAPHICS_EXPORTED void on_clicked(); diff --git a/src/ui/components/textinput.hpp b/src/ui/components/textinput.hpp index 0354c3846..366440dd1 100644 --- a/src/ui/components/textinput.hpp +++ b/src/ui/components/textinput.hpp @@ -70,7 +70,7 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void set_text(const std::string& text); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::string& get_text() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::string& get_text() const; private: void recalculate_textures(bool text_changed); diff --git a/src/ui/layout.hpp b/src/ui/layout.hpp index 878535b16..1a54f62a3 100644 --- a/src/ui/layout.hpp +++ b/src/ui/layout.hpp @@ -102,16 +102,16 @@ namespace ui { using Alignment = std::pair; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 get_horizontal_alignment_offset(const Layout& layout, AlignmentHorizontal alignment, u32 width); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 get_vertical_alignment_offset(const Layout& layout, AlignmentVertical alignment, u32 height); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::URect + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::URect get_rectangle_aligned(const Layout& layout, const std::pair& size, const Alignment& alignment); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::pair + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::pair ratio_helper(const std::pair& size, bool respect_ratio, const shapes::UPoint& original_ratio); enum class Direction : u8 { Horizontal, Vertical }; diff --git a/src/ui/layouts/focus_layout.hpp b/src/ui/layouts/focus_layout.hpp index a437363eb..2240e4a47 100644 --- a/src/ui/layouts/focus_layout.hpp +++ b/src/ui/layouts/focus_layout.hpp @@ -41,7 +41,7 @@ namespace ui { OOPETRIS_GRAPHICS_EXPORTED void update() override; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 widget_count() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 widget_count() const; template diff --git a/src/ui/layouts/grid_layout.hpp b/src/ui/layouts/grid_layout.hpp index 140292142..f23c1a5ce 100644 --- a/src/ui/layouts/grid_layout.hpp +++ b/src/ui/layouts/grid_layout.hpp @@ -23,7 +23,7 @@ namespace ui { bool is_top_level = true ); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 total_size() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 total_size() const; OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override; diff --git a/src/ui/layouts/scroll_layout.hpp b/src/ui/layouts/scroll_layout.hpp index ce6b6efd1..c4f29eace 100644 --- a/src/ui/layouts/scroll_layout.hpp +++ b/src/ui/layouts/scroll_layout.hpp @@ -23,9 +23,9 @@ namespace ui { ItemSize(u32 height, ItemSizeType type); public: - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 get_height() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 get_height() const; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] ItemSizeType get_type() const; + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED ItemSizeType get_type() const; }; struct AbsolutItemSize : public ItemSize { diff --git a/src/ui/widget.hpp b/src/ui/widget.hpp index 28684771a..3159fb44a 100644 --- a/src/ui/widget.hpp +++ b/src/ui/widget.hpp @@ -59,9 +59,9 @@ namespace ui { handle_event(const std::shared_ptr& input_manager, const SDL_Event& event) = 0; }; - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional as_focusable(Widget* widget); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional as_focusable(Widget* widget); - OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::optional as_hoverable(Widget* widget); + [[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::optional as_hoverable(Widget* widget); } // namespace ui From 7d4ef0b9805190d895e9eb4ebc6a35dd188dd228 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 17:24:29 +0200 Subject: [PATCH 21/22] fix: format meson files --- src/helper/meson.build | 2 +- src/libs/recordings/utility/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helper/meson.build b/src/helper/meson.build index 8dc91055a..4462e2f23 100644 --- a/src/helper/meson.build +++ b/src/helper/meson.build @@ -4,6 +4,7 @@ graphics_src_files += files( 'console_helpers.cpp', 'console_helpers.hpp', 'constants.hpp', + 'export_symbols.hpp', 'git_helper.hpp', 'graphic_utils.cpp', 'graphic_utils.hpp', @@ -14,7 +15,6 @@ graphics_src_files += files( 'platform.hpp', 'web_utils.cpp', 'web_utils.hpp', - 'export_symbols.hpp', ) if have_file_dialogs diff --git a/src/libs/recordings/utility/meson.build b/src/libs/recordings/utility/meson.build index ce0330c94..534fa3150 100644 --- a/src/libs/recordings/utility/meson.build +++ b/src/libs/recordings/utility/meson.build @@ -10,6 +10,7 @@ recordings_src_files = files( _header_files = files( 'additional_information.hpp', 'checksum_helper.hpp', + 'export_symbols.hpp', 'helper.hpp', 'recording.hpp', 'recording_json_wrapper.hpp', @@ -17,7 +18,6 @@ _header_files = files( 'recording_writer.hpp', 'tetrion_core_information.hpp', 'tetrion_snapshot.hpp', - 'export_symbols.hpp', ) recordings_header_files += _header_files From 5d7a0726745e2152182da50a606da16bea3c70fc Mon Sep 17 00:00:00 2001 From: Totto16 Date: Thu, 15 May 2025 17:54:56 +0200 Subject: [PATCH 22/22] fix: move spdlog_wrapper into graphics library, since spldog is not required for the core library --- src/discord/core.cpp | 2 +- src/executables/game/application.cpp | 2 +- src/executables/game/parser.cpp | 2 +- src/game/game.cpp | 2 +- src/game/grid.cpp | 2 +- src/game/simulated_tetrion.cpp | 2 +- src/game/simulation.cpp | 2 +- src/game/tetrion.cpp | 2 +- src/graphics/texture.cpp | 2 +- src/helper/clock_source.cpp | 2 +- src/helper/graphic_utils.cpp | 2 +- src/helper/meson.build | 1 + src/helper/platform.cpp | 2 +- src/{libs/core => }/helper/spdlog_wrapper.hpp | 1 - src/helper/web_utils.hpp | 2 +- src/input/controller_input.cpp | 2 +- src/input/game_input.cpp | 2 +- src/input/input.cpp | 2 +- src/input/input_creator.cpp | 2 +- src/input/joystick_input.cpp | 2 +- src/input/replay_input.cpp | 2 +- src/input/touch_input.cpp | 2 +- src/libs/core/helper/meson.build | 1 - src/lobby/api.cpp | 2 +- src/lobby/credentials/secret.cpp | 2 +- src/manager/music_manager.cpp | 2 +- src/manager/settings.cpp | 2 +- src/manager/settings_manager.cpp | 2 +- src/scenes/settings_menu/settings_menu.cpp | 2 +- src/ui/components/button.hpp | 2 +- src/ui/components/link_label.cpp | 2 +- 31 files changed, 29 insertions(+), 30 deletions(-) rename src/{libs/core => }/helper/spdlog_wrapper.hpp (99%) diff --git a/src/discord/core.cpp b/src/discord/core.cpp index 0c96acf6c..6a8c99ef8 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -1,9 +1,9 @@ +#include "helper/spdlog_wrapper.hpp" #include #include "./core.hpp" -#include #include [[nodiscard]] std::string constants::discord ::get_asset_key(constants::discord::ArtAsset asset) { diff --git a/src/executables/game/application.cpp b/src/executables/game/application.cpp index 41e4a3a64..1dfcb0ab5 100644 --- a/src/executables/game/application.cpp +++ b/src/executables/game/application.cpp @@ -11,7 +11,7 @@ #include "ui/layout.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include #include #include diff --git a/src/executables/game/parser.cpp b/src/executables/game/parser.cpp index 6cd5a9043..e855ab282 100644 --- a/src/executables/game/parser.cpp +++ b/src/executables/game/parser.cpp @@ -9,8 +9,8 @@ #include "helper/graphic_utils.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include helper::expected helper::parse_args(const std::vector& arguments) { diff --git a/src/game/game.cpp b/src/game/game.cpp index a29b8ead5..10441101e 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,6 +1,6 @@ +#include "helper/spdlog_wrapper.hpp" #include -#include #include #include "game.hpp" diff --git a/src/game/grid.cpp b/src/game/grid.cpp index d0251e467..61affd3c4 100644 --- a/src/game/grid.cpp +++ b/src/game/grid.cpp @@ -1,7 +1,7 @@ #include "grid.hpp" #include "graphics/renderer.hpp" -#include +#include "helper/spdlog_wrapper.hpp" Grid::Grid(const ui::Layout& layout, bool is_top_level) : ui::Widget{ layout, ui::WidgetType::Component, is_top_level } { diff --git a/src/game/simulated_tetrion.cpp b/src/game/simulated_tetrion.cpp index 691b79a49..5806bc9c8 100644 --- a/src/game/simulated_tetrion.cpp +++ b/src/game/simulated_tetrion.cpp @@ -8,8 +8,8 @@ #include "manager/music_manager.hpp" #include "simulated_tetrion.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include SimulatedTetrion::SimulatedTetrion( diff --git a/src/game/simulation.cpp b/src/game/simulation.cpp index 73fbf6c41..f122c98df 100644 --- a/src/game/simulation.cpp +++ b/src/game/simulation.cpp @@ -6,7 +6,7 @@ #include "input/replay_input.hpp" #include "simulation.hpp" -#include +#include "helper/spdlog_wrapper.hpp" Simulation::Simulation( diff --git a/src/game/tetrion.cpp b/src/game/tetrion.cpp index c243269aa..1dc047c9c 100644 --- a/src/game/tetrion.cpp +++ b/src/game/tetrion.cpp @@ -8,7 +8,7 @@ #include "tetrion.hpp" #include "ui/components/label.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include diff --git a/src/graphics/texture.cpp b/src/graphics/texture.cpp index a4cba02f4..40f15e885 100644 --- a/src/graphics/texture.cpp +++ b/src/graphics/texture.cpp @@ -1,8 +1,8 @@ #include #include "helper/graphic_utils.hpp" +#include "helper/spdlog_wrapper.hpp" #include "texture.hpp" -#include Texture::Texture(SDL_Texture* raw_texture) : m_raw_texture{ raw_texture } { } diff --git a/src/helper/clock_source.cpp b/src/helper/clock_source.cpp index ae4652bcd..6c329f1b2 100644 --- a/src/helper/clock_source.cpp +++ b/src/helper/clock_source.cpp @@ -1,8 +1,8 @@ #include "helper/clock_source.hpp" +#include "helper/spdlog_wrapper.hpp" #include #include -#include namespace { [[nodiscard]] double elapsed_time() { diff --git a/src/helper/graphic_utils.cpp b/src/helper/graphic_utils.cpp index 99ec0bf4e..9debe74c8 100644 --- a/src/helper/graphic_utils.cpp +++ b/src/helper/graphic_utils.cpp @@ -1,6 +1,6 @@ #include "graphic_utils.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include #if defined(__EMSCRIPTEN__) diff --git a/src/helper/meson.build b/src/helper/meson.build index 4462e2f23..49f745a00 100644 --- a/src/helper/meson.build +++ b/src/helper/meson.build @@ -13,6 +13,7 @@ graphics_src_files += files( 'music_utils.hpp', 'platform.cpp', 'platform.hpp', + 'spdlog_wrapper.hpp', 'web_utils.cpp', 'web_utils.hpp', ) diff --git a/src/helper/platform.cpp b/src/helper/platform.cpp index c3a367731..3b70f7dd3 100644 --- a/src/helper/platform.cpp +++ b/src/helper/platform.cpp @@ -8,9 +8,9 @@ #include "input/console_buttons.hpp" #endif +#include "helper/spdlog_wrapper.hpp" #include #include -#include #include #include diff --git a/src/libs/core/helper/spdlog_wrapper.hpp b/src/helper/spdlog_wrapper.hpp similarity index 99% rename from src/libs/core/helper/spdlog_wrapper.hpp rename to src/helper/spdlog_wrapper.hpp index 378e2e7b1..a32ab7392 100644 --- a/src/libs/core/helper/spdlog_wrapper.hpp +++ b/src/helper/spdlog_wrapper.hpp @@ -7,7 +7,6 @@ #include - #if defined(_MSC_VER) #pragma warning(default : 4275) #pragma warning(default : 4251) diff --git a/src/helper/web_utils.hpp b/src/helper/web_utils.hpp index 2da38e1a3..cc62506ed 100644 --- a/src/helper/web_utils.hpp +++ b/src/helper/web_utils.hpp @@ -13,7 +13,7 @@ #include "manager/service_provider.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include #include #include diff --git a/src/input/controller_input.cpp b/src/input/controller_input.cpp index fdb5f185f..9f14cf02f 100644 --- a/src/input/controller_input.cpp +++ b/src/input/controller_input.cpp @@ -7,7 +7,7 @@ #include "manager/sdl_controller_key.hpp" -#include +#include "helper/spdlog_wrapper.hpp" input::ControllerInput::ControllerInput( SDL_GameController* controller, diff --git a/src/input/game_input.cpp b/src/input/game_input.cpp index c072d7a35..40a43eaa1 100644 --- a/src/input/game_input.cpp +++ b/src/input/game_input.cpp @@ -2,7 +2,7 @@ #include "input.hpp" #include "manager/event_dispatcher.hpp" -#include +#include "helper/spdlog_wrapper.hpp" void input::GameInput::handle_event(const InputEvent event, const SimulationStep simulation_step_index) { diff --git a/src/input/input.cpp b/src/input/input.cpp index 7c59fc66c..10f9cb4bb 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -9,8 +9,8 @@ #include "mouse_input.hpp" #include "touch_input.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include #include #include #include diff --git a/src/input/input_creator.cpp b/src/input/input_creator.cpp index 505403c9e..2e7906bc2 100644 --- a/src/input/input_creator.cpp +++ b/src/input/input_creator.cpp @@ -12,7 +12,7 @@ #include "input/replay_input.hpp" #include "input_creator.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include #include diff --git a/src/input/joystick_input.cpp b/src/input/joystick_input.cpp index 9ce34c3fe..539135357 100644 --- a/src/input/joystick_input.cpp +++ b/src/input/joystick_input.cpp @@ -9,8 +9,8 @@ #include "input/input.hpp" #include "joystick_input.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include #include #include diff --git a/src/input/replay_input.cpp b/src/input/replay_input.cpp index 7aed706ba..1b3cb8b82 100644 --- a/src/input/replay_input.cpp +++ b/src/input/replay_input.cpp @@ -1,7 +1,7 @@ #include "replay_input.hpp" #include "game/tetrion.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include input::ReplayGameInput::ReplayGameInput( std::shared_ptr recording_reader, diff --git a/src/input/touch_input.cpp b/src/input/touch_input.cpp index c09ac5ed0..b8812042e 100644 --- a/src/input/touch_input.cpp +++ b/src/input/touch_input.cpp @@ -5,8 +5,8 @@ #include "input/input.hpp" #include "touch_input.hpp" +#include "helper/spdlog_wrapper.hpp" #include -#include #include #include diff --git a/src/libs/core/helper/meson.build b/src/libs/core/helper/meson.build index add7ca856..c440546a5 100644 --- a/src/libs/core/helper/meson.build +++ b/src/libs/core/helper/meson.build @@ -25,7 +25,6 @@ _header_files = files( 'point.hpp', 'random.hpp', 'sleep.hpp', - 'spdlog_wrapper.hpp', 'static_string.hpp', 'string_manipulation.hpp', 'timer.hpp', diff --git a/src/lobby/api.cpp b/src/lobby/api.cpp index 703b242cd..c96924346 100644 --- a/src/lobby/api.cpp +++ b/src/lobby/api.cpp @@ -2,7 +2,7 @@ #include "api.hpp" -#include +#include "helper/spdlog_wrapper.hpp" #include #if !defined(_OOPETRIS_ONLINE_SYSTEM) diff --git a/src/lobby/credentials/secret.cpp b/src/lobby/credentials/secret.cpp index c43dc70a9..8ea5373c3 100644 --- a/src/lobby/credentials/secret.cpp +++ b/src/lobby/credentials/secret.cpp @@ -150,7 +150,7 @@ secret::SecretStorage::store(const std::string& key, const Buffer& value, bool u #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -#include +#include "helper/spdlog_wrapper.hpp" #include #ifndef NOMINMAX diff --git a/src/manager/music_manager.cpp b/src/manager/music_manager.cpp index 16f334c7b..5c9eee526 100644 --- a/src/manager/music_manager.cpp +++ b/src/manager/music_manager.cpp @@ -6,9 +6,9 @@ #include "manager/music_manager.hpp" #include "manager/sdl_key.hpp" +#include "helper/spdlog_wrapper.hpp" #include #include -#include #include #include #include diff --git a/src/manager/settings.cpp b/src/manager/settings.cpp index e5f7dba7c..e87d5693b 100644 --- a/src/manager/settings.cpp +++ b/src/manager/settings.cpp @@ -4,7 +4,7 @@ #include "input/touch_input.hpp" -#include +#include "helper/spdlog_wrapper.hpp" void settings::to_json(nlohmann::json& obj, const settings::Settings& settings) { diff --git a/src/manager/settings_manager.cpp b/src/manager/settings_manager.cpp index 4198153c4..3bc8ce333 100644 --- a/src/manager/settings_manager.cpp +++ b/src/manager/settings_manager.cpp @@ -1,8 +1,8 @@ #include "settings_manager.hpp" #include "helper/graphic_utils.hpp" +#include "helper/spdlog_wrapper.hpp" #include "input/keyboard_input.hpp" #include "input/touch_input.hpp" -#include #if defined(__EMSCRIPTEN__) #include "helper/web_utils.hpp" diff --git a/src/scenes/settings_menu/settings_menu.cpp b/src/scenes/settings_menu/settings_menu.cpp index c2543af25..01d62b275 100644 --- a/src/scenes/settings_menu/settings_menu.cpp +++ b/src/scenes/settings_menu/settings_menu.cpp @@ -13,7 +13,7 @@ #include "ui/components/text_button.hpp" #include "ui/layouts/scroll_layout.hpp" -#include +#include "helper/spdlog_wrapper.hpp" namespace scenes { diff --git a/src/ui/components/button.hpp b/src/ui/components/button.hpp index 5234897e6..fc03e78db 100644 --- a/src/ui/components/button.hpp +++ b/src/ui/components/button.hpp @@ -2,7 +2,7 @@ #include -#include +#include "helper/spdlog_wrapper.hpp" #include #include diff --git a/src/ui/components/link_label.cpp b/src/ui/components/link_label.cpp index c785c51d8..83ce2ea71 100644 --- a/src/ui/components/link_label.cpp +++ b/src/ui/components/link_label.cpp @@ -1,7 +1,7 @@ #include "link_label.hpp" #include "helper/platform.hpp" -#include +#include "helper/spdlog_wrapper.hpp" ui::LinkLabel::LinkLabel( ServiceProvider* service_provider,