diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c5f5ec..4f3b563 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,7 @@ jobs: -DIMGUI_SFML_BUILD_EXAMPLES=ON \ -DIMGUI_SFML_BUILD_TESTING=ON \ -DIMGUI_SFML_ENABLE_WARNINGS=ON \ + -DIMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS=ON \ ${{matrix.platform.flags}} \ ${{matrix.config.flags}} diff --git a/CMakeLists.txt b/CMakeLists.txt index eca4000..51eec12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(imgui_sfml VERSION 3.0.0 LANGUAGES CXX) option(IMGUI_SFML_FIND_SFML "Use find_package to find SFML" ON) option(IMGUI_SFML_ENABLE_WARNINGS "Enable compiler warnings" OFF) +option(IMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS "Disable obsolete ImGui functions" OFF) # If you want to use your own user config when compiling ImGui, please set the following variables # For example, if you have your config in /path/to/dir/with/config/myconfig.h, set the variables as follows: @@ -78,6 +79,9 @@ if(BUILD_SHARED_LIBS) set_target_properties(ImGui-SFML PROPERTIES DEFINE_SYMBOL "IMGUI_SFML_EXPORTS") set_target_properties(ImGui-SFML PROPERTIES DEBUG_POSTFIX "_d") endif() +if(IMGUI_SFML_DISABLE_OBSOLETE_FUNCTIONS) + target_compile_definitions(ImGui-SFML PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS) +endif() # Add compiler warnings if(IMGUI_SFML_ENABLE_WARNINGS) diff --git a/imgui-SFML.cpp b/imgui-SFML.cpp index 72a6519..b78898a 100644 --- a/imgui-SFML.cpp +++ b/imgui-SFML.cpp @@ -425,10 +425,10 @@ void ProcessEvent(const sf::Window& window, const sf::Event& event) } else { - io.AddKeyEvent(ImGuiKey_ModCtrl, keyChanged.control); - io.AddKeyEvent(ImGuiKey_ModShift, keyChanged.shift); - io.AddKeyEvent(ImGuiKey_ModAlt, keyChanged.alt); - io.AddKeyEvent(ImGuiKey_ModSuper, keyChanged.system); + io.AddKeyEvent(ImGuiMod_Ctrl, keyChanged.control); + io.AddKeyEvent(ImGuiMod_Shift, keyChanged.shift); + io.AddKeyEvent(ImGuiMod_Alt, keyChanged.alt); + io.AddKeyEvent(ImGuiMod_Super, keyChanged.system); } const ImGuiKey key = keycodeToImGuiKey(keyChanged.code); @@ -1481,16 +1481,16 @@ ImGuiKey keycodeToImGuiMod(sf::Keyboard::Key code) { case sf::Keyboard::Key::LControl: case sf::Keyboard::Key::RControl: - return ImGuiKey_ModCtrl; + return ImGuiMod_Ctrl; case sf::Keyboard::Key::LShift: case sf::Keyboard::Key::RShift: - return ImGuiKey_ModShift; + return ImGuiMod_Shift; case sf::Keyboard::Key::LAlt: case sf::Keyboard::Key::RAlt: - return ImGuiKey_ModAlt; + return ImGuiMod_Alt; case sf::Keyboard::Key::LSystem: case sf::Keyboard::Key::RSystem: - return ImGuiKey_ModSuper; + return ImGuiMod_Super; default: break; }