From 2679d49a53a3f9825ce855f6ed25b3b045ec5aa1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 5 Dec 2022 08:17:00 +0100 Subject: editor, main: use less sdl includes --- editor/CMakeLists.txt | 11 +++++++---- editor/app.hpp | 2 +- editor/events.cpp | 5 +---- editor/precomp.hpp | 2 -- 4 files changed, 9 insertions(+), 11 deletions(-) (limited to 'editor') diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 2119ee9e..f94c21e1 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -12,6 +12,10 @@ endif() add_library(${self}_o OBJECT "${res}" "${sources}") target_link_libraries(${self}_o PUBLIC MagnumIntegration::ImGui fmt::fmt nlohmann_json::nlohmann_json) +if(WIN32) + target_sources(${self}_o PRIVATE "../main/floormat.rc") +endif() + if(NOT SDL2_INCLUDE_DIRS) if(NOT TARGET SDL2::SDL2) find_package(SDL2 QUIET REQUIRED) @@ -19,11 +23,10 @@ if(NOT SDL2_INCLUDE_DIRS) get_target_property(SDL2_INCLUDE_DIRS SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES) endif() endif() -target_include_directories(${self}_o SYSTEM PRIVATE "${SDL2_INCLUDE_DIRS}") - -if(WIN32) - target_sources(${self}_o PRIVATE "../main/floormat.rc") +if(FLOORMAT_PRECOMPILED-HEADERS) + include_directories("${SDL2_INCLUDE_DIRS}") endif() +set_property(SOURCE "events.cpp" APPEND PROPERTY INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}") add_executable(${self} dummy.cc) target_link_libraries(${self} PRIVATE ${self}_o floormat-main floormat-serialize floormat-draw floormat) diff --git a/editor/app.hpp b/editor/app.hpp index 776b0fcf..c34b7ebd 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -107,7 +107,7 @@ private: void do_key(key k, int mods); void do_key(key k); void apply_commands(const key_set& k); - static int get_key_modifiers(); + int get_key_modifiers(); void clear_keys(key min_inclusive, key max_exclusive); void clear_keys(); void clear_non_global_keys(); diff --git a/editor/events.cpp b/editor/events.cpp index 426acac4..6bf4b3e7 100644 --- a/editor/events.cpp +++ b/editor/events.cpp @@ -10,9 +10,6 @@ #include #include -#include -#include - namespace floormat { void app::on_focus_in() noexcept {} @@ -198,7 +195,7 @@ void app::do_key(floormat::key k) int app::get_key_modifiers() { - return fixup_mods(SDL_GetModState()); + return fixup_mods(M->get_mods()); } } // namespace floormat diff --git a/editor/precomp.hpp b/editor/precomp.hpp index 775f59e7..8949f3ed 100644 --- a/editor/precomp.hpp +++ b/editor/precomp.hpp @@ -13,6 +13,4 @@ #if __has_include() #include -#include -#include #endif -- cgit v1.2.3