diff --git a/CMakeLists.txt b/CMakeLists.txt index e86d78a..aff6bbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ target_sources(${PROJECT_NAME} PRIVATE # target_compile_options(${PROJECT_NAME} PRIVATE -pg -no-pie) # target_link_options(${PROJECT_NAME} PRIVATE -pg -no-pie) #endif() -target_link_libraries(${PROJECT_NAME} sfml::sfml) +target_link_libraries(${PROJECT_NAME} -static gcc stdc++ pthread -dynamic sfml::sfml) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}${BUILDNAME_SUFFIX} CXX_STANDARD 17 diff --git a/ProtoTank.cpp b/ProtoTank.cpp index 08945f8..170e155 100644 --- a/ProtoTank.cpp +++ b/ProtoTank.cpp @@ -87,19 +87,22 @@ int main(int argc, char** argv) { } } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { - mainWindow->close(); - status = GAME_QUIT; - } else if ((sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt) || sf::Keyboard::isKeyPressed(sf::Keyboard::RAlt)) && sf::Keyboard::isKeyPressed(sf::Keyboard::Enter)) { - wndParams.wndFullscreen = !wndParams.wndFullscreen; - try { - CreateWindow(mainWindow, wndParams); - } catch (const std::exception& ex) { - log.PrintCritical(std::string(ex.what())); - return EXIT_FAILURE; - } + // Focused-only keys actions + if (mainWindow->hasFocus()) { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + mainWindow->close(); + status = GAME_QUIT; + } else if ((sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt) || sf::Keyboard::isKeyPressed(sf::Keyboard::RAlt)) && sf::Keyboard::isKeyPressed(sf::Keyboard::Enter)) { + wndParams.wndFullscreen = !wndParams.wndFullscreen; + try { + CreateWindow(mainWindow, wndParams); + } catch (const std::exception& ex) { + log.PrintCritical(std::string(ex.what())); + return EXIT_FAILURE; + } - arcadeGame.EventWindowSizeChanged(mainWindow->getSize().x, mainWindow->getSize().y); + arcadeGame.EventWindowSizeChanged(mainWindow->getSize().x, mainWindow->getSize().y); + } } status = arcadeGame.Tick(); diff --git a/conanfile.py b/conanfile.py index b8e1af8..747e453 100644 --- a/conanfile.py +++ b/conanfile.py @@ -21,7 +21,7 @@ class ProtoTank(ConanFile): def configure(self): - self.options["sfml"].audio = True + self.options["sfml"].audio = False self.options["sfml"].window = True self.options["sfml"].network = False self.options["sfml"].graphics = True