diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 09:59:45 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 09:59:45 +0200 |
commit | 34134e88f6c6b8b4d19fec53366d6e40a3303c6e (patch) | |
tree | 2e8cd4ee882ffbaca7a2caae2d1e6b0be49c93ef | |
parent | cecd124c0c043ef261256fb9e3f1108cde1265c1 (diff) |
a
-rw-r--r-- | compat/integer-types.hpp | 53 | ||||
-rw-r--r-- | compat/prelude.hpp | 6 | ||||
-rw-r--r-- | editor/app.cpp | 25 | ||||
-rw-r--r-- | editor/imgui.cpp | 2 | ||||
-rw-r--r-- | main/floormat-events.cpp | 5 | ||||
-rw-r--r-- | main/floormat-main-impl.hpp | 4 | ||||
-rw-r--r-- | main/floormat.hpp | 2 | ||||
-rw-r--r-- | main/main.cpp | 4 | ||||
-rw-r--r-- | src/chunk.hpp | 1 |
9 files changed, 88 insertions, 14 deletions
diff --git a/compat/integer-types.hpp b/compat/integer-types.hpp new file mode 100644 index 00000000..791bea64 --- /dev/null +++ b/compat/integer-types.hpp @@ -0,0 +1,53 @@ +#pragma once + +#ifdef __MSC_VER +#ifdef _WIN64 +typedef unsigned __int64 size_t; +typedef __int64 ptrdiff_t; +typedef __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int size_t; +typedef int ptrdiff_t; +typedef int intptr_t; +typedef unsigned int uintptr_t; +#endif +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +#else +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __INTPTR_TYPE__ intptr_t; +typedef __UINTPTR_TYPE__ uintptr_t; + +typedef __INT8_TYPE__ int8_t; +typedef __INT16_TYPE__ int16_t; +typedef __INT32_TYPE__ int32_t; +typedef __INT64_TYPE__ int64_t; +typedef __UINT8_TYPE__ uint8_t; +typedef __UINT16_TYPE__ uint16_t; +typedef __UINT32_TYPE__ uint32_t; +typedef __UINT64_TYPE__ uint64_t; +#endif + +namespace std { +using ::size_t; +using ::ptrdiff_t; +using ::intptr_t; +using ::uintptr_t; + +using ::int8_t; +using ::int16_t; +using ::int32_t; +using ::int64_t; +using ::uint8_t; +using ::uint16_t; +using ::uint32_t; +using ::uint64_t; +} // namespace std diff --git a/compat/prelude.hpp b/compat/prelude.hpp index 4e8aa7b3..c21f9d27 100644 --- a/compat/prelude.hpp +++ b/compat/prelude.hpp @@ -1,9 +1,9 @@ #pragma once -#include <cstddef> -#include <cstdint> -#include <type_traits> +#include "integer-types.hpp" +namespace Corrade::Containers {} namespace Magnum {} namespace floormat { using namespace ::Magnum; + using namespace ::Corrade::Containers; } // namespace floormat diff --git a/editor/app.cpp b/editor/app.cpp index d6884edb..878e4052 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -62,16 +62,35 @@ static bool parse_bool(StringView name, StringView str, bool def) int app::run_from_argv(const int argc, const char* const* const argv) { - fm_options opts; + fm_settings opts; { Corrade::Utility::Arguments args{}; - args.addOption("vsync", "default") - .addOption("gpu-validation", "true") + args.addOption("vsync", "m") + .addOption("gpu-validation", "1") + .addOption("msaa", "1") .parse(argc, argv); opts.vsync = parse_tristate("--vsync", args.value<StringView>("vsync"), opts.vsync); + opts.msaa = parse_bool("--msaa", args.value<StringView>("msaaa"), opts.msaa); } app application; return application.exec(); } +#ifdef _MSC_VER +#include <cstdlib> // for __arg{c,v} +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wmain" +#endif +extern "C" int __stdcall WinMain(void*, void*, void*, int); + +extern "C" int __stdcall WinMain(void*, void*, void*, int) +{ + return main(__argc, __argv); +} +#ifdef __clang__ +# pragma clang diagnostic pop +#endif +#endif + } // namespace floormat diff --git a/editor/imgui.cpp b/editor/imgui.cpp index f6a3db1e..aea34ae9 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -232,7 +232,7 @@ void app::draw_cursor_tile() const auto size = ImGui::CalcTextSize(buf); const auto window_size = M->window_size(); - ImGui::SetNextWindowPos({window_size[0]/2 - size.x/2, 3}); + ImGui::SetNextWindowPos({window_size[0]*.5f - size.x/2, 3}); ImGui::SetNextWindowSize(size); if (auto flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBackground; diff --git a/main/floormat-events.cpp b/main/floormat-events.cpp index 62409d35..3200728a 100644 --- a/main/floormat-events.cpp +++ b/main/floormat-events.cpp @@ -1,4 +1,3 @@ -#pragma once #include "floormat-main-impl.hpp" #include "floormat-app.hpp" #include "floormat-events.hpp" @@ -63,7 +62,7 @@ void main_impl::keyPressEvent(Platform::Sdl2Application::KeyEvent& event) app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), (SDL_Keymod)(std::uint16_t)event.modifiers(), event.isRepeated()}, - true) + true); } void main_impl::keyReleaseEvent(Platform::Sdl2Application::KeyEvent& event) @@ -71,7 +70,7 @@ void main_impl::keyReleaseEvent(Platform::Sdl2Application::KeyEvent& event) app.on_key_up_down({(SDL_Keycode)(std::uint32_t)event.key(), (SDL_Keymod)(std::uint16_t)event.modifiers(), event.isRepeated()}, - false) + false); } void main_impl::anyEvent(SDL_Event& event) diff --git a/main/floormat-main-impl.hpp b/main/floormat-main-impl.hpp index c6a75129..0406760a 100644 --- a/main/floormat-main-impl.hpp +++ b/main/floormat-main-impl.hpp @@ -31,8 +31,8 @@ struct main_impl final : Platform::Sdl2Application, floormat_main struct world& world() noexcept override; SDL_Window* window() noexcept override; - fm_settings& settings() noexcept; - const fm_settings& settings() const noexcept; + fm_settings& settings() noexcept override; + const fm_settings& settings() const noexcept override; global_coords pixel_to_tile(Vector2d position) const noexcept override; diff --git a/main/floormat.hpp b/main/floormat.hpp index 032c7865..d596c21b 100644 --- a/main/floormat.hpp +++ b/main/floormat.hpp @@ -25,7 +25,7 @@ struct fm_settings fullscreen_desktop : 1 = false, borderless : 1 = false, maximized : 1 = false, - msaa : 1 = true; // TODO + msaa : 1 = true; }; } // namespace floormat diff --git a/main/main.cpp b/main/main.cpp index 7ffc1a28..37325809 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -6,6 +6,8 @@ #include <Corrade/Utility/DebugStl.h> #include <Magnum/GL/DefaultFramebuffer.h> +#if 0 + #ifdef FM_MSAA #include <Magnum/GL/RenderbufferFormat.h> #endif @@ -109,3 +111,5 @@ extern "C" int __stdcall WinMain(void*, void*, void*, int) # pragma clang diagnostic pop #endif #endif + +#endif diff --git a/src/chunk.hpp b/src/chunk.hpp index 13c9eeb7..f0ed1426 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -34,7 +34,6 @@ struct chunk final chunk& operator=(chunk&&) = default; fm_DECLARE_DELETED_COPY_ASSIGNMENT(chunk); - fm_DECLARE_DEPRECATED_MOVE_ASSIGNMENT(chunk); private: std::array<tile, TILE_COUNT> _tiles = {}; |