summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/CMakeLists.txt5
-rw-r--r--main/app.hpp2
-rw-r--r--main/draw.cpp5
-rw-r--r--main/imgui-raii.hpp2
-rw-r--r--main/imgui.cpp4
-rw-r--r--main/loader-impl.cpp1
6 files changed, 14 insertions, 5 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 1da8afa5..9780ad4c 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -6,6 +6,11 @@ link_libraries(Magnum::Sdl2Application Magnum::Trade)
link_libraries(MagnumIntegration::ImGui)
corrade_add_resource(res ../resources.conf)
+if(MSVC)
+ set_property(SOURCE "${res}" APPEND PROPERTY COMPILE_OPTIONS "-W0")
+else()
+ set_property(SOURCE "${res}" APPEND PROPERTY COMPILE_OPTIONS "-w")
+endif()
add_executable(${self} "${sources}" "${res}")
set_property(TARGET ${self} PROPERTY OUTPUT_NAME "${PROJECT_NAME}")
install(TARGETS ${self} RUNTIME DESTINATION bin)
diff --git a/main/app.hpp b/main/app.hpp
index 60b9a607..96400cda 100644
--- a/main/app.hpp
+++ b/main/app.hpp
@@ -27,7 +27,7 @@ struct app final : private Platform::Application
private:
struct app_settings;
- [[maybe_unused]] static void usage(const Utility::Arguments& args);
+ [[maybe_unused]] [[noreturn]] static void usage(const Utility::Arguments& args);
explicit app(const Arguments& arguments, app_settings opts);
using dpi_policy = Platform::Implementation::Sdl2DpiScalingPolicy;
diff --git a/main/draw.cpp b/main/draw.cpp
index 92fa8b9d..ddeccc23 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -19,7 +19,10 @@ void app::drawEvent()
_frame_time = dt;
}
else
- swapBuffers(), timeline.nextFrame();
+ {
+ swapBuffers();
+ timeline.nextFrame();
+ }
{
const float dt = std::clamp(timeline.previousFrameDuration(), 1e-3f, 1e-1f);
diff --git a/main/imgui-raii.hpp b/main/imgui-raii.hpp
index 931b5189..85512b2d 100644
--- a/main/imgui-raii.hpp
+++ b/main/imgui-raii.hpp
@@ -2,7 +2,7 @@
#include <Corrade/Containers/StringView.h>
#include <Magnum/Math/Color.h>
-#include <ImGui.h>
+#include <imgui.h>
namespace floormat::imgui {
diff --git a/main/imgui.cpp b/main/imgui.cpp
index 13a09a8b..e1790968 100644
--- a/main/imgui.cpp
+++ b/main/imgui.cpp
@@ -154,7 +154,7 @@ void app::draw_fps()
auto c6 = push_style_color(ImGuiCol_Text, {0, 1, 0, 1});
char buf[16];
- const double dt = _frame_time > 1e-6 ? std::round(1/double(_frame_time)*10.)*.1 + 0.05 : 999;
+ const double dt = _frame_time > 1e-6f ? std::round(1/double(_frame_time)*10.)*.1 + 0.05 : 999;
snprintf(buf, sizeof(buf), "%.1f FPS", dt);
const ImVec2 size = ImGui::CalcTextSize(buf);
@@ -179,7 +179,7 @@ void app::draw_cursor_coord()
auto c3 = push_style_var(ImGuiStyleVar_WindowBorderSize, 0);
auto c4 = push_style_var(ImGuiStyleVar_WindowMinSize, {1, 1});
auto c5 = push_style_var(ImGuiStyleVar_ScrollbarSize, 0);
- auto c6 = push_style_color(ImGuiCol_Text, {.9, .9, .9, 1});
+ auto c6 = push_style_color(ImGuiCol_Text, {.9f, .9f, .9f, 1});
char buf[64];
const auto coord = *_cursor_tile;
diff --git a/main/loader-impl.cpp b/main/loader-impl.cpp
index 0fe5befa..8112b350 100644
--- a/main/loader-impl.cpp
+++ b/main/loader-impl.cpp
@@ -66,6 +66,7 @@ std::shared_ptr<tile_atlas> loader_impl::tile_atlas(Containers::StringView name,
Trade::ImageData2D loader_impl::tile_texture(Containers::StringView filename_)
{
static_assert(IMAGE_PATH[sizeof(IMAGE_PATH)-2] == '/');
+ ASSERT(filename_.size() < 4096);
char* const filename = (char*)alloca(filename_.size() + sizeof(IMAGE_PATH));
std::memcpy(filename, IMAGE_PATH, sizeof(IMAGE_PATH)-1);