diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 621fb8d..f0a8bce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Install Linux Dependencies if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev + run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev libegl1-mesa-dev libfreetype-dev - name: Checkout uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cf460b..40c163e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,26 +1,16 @@ cmake_minimum_required(VERSION 3.28) -project(CMakeSFMLProject LANGUAGES CXX) +project(CMakeSFMLProject) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -option(BUILD_SHARED_LIBS "Build shared libraries" OFF) include(FetchContent) FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML.git - GIT_TAG 2.6.x + GIT_TAG master GIT_SHALLOW ON EXCLUDE_FROM_ALL SYSTEM) FetchContent_MakeAvailable(SFML) add_executable(main src/main.cpp) -target_link_libraries(main PRIVATE sfml-graphics) -target_compile_features(main PRIVATE cxx_std_17) - -if(WIN32) - add_custom_command( - TARGET main - COMMENT "Copy OpenAL DLL" - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$,x64,x86>/openal32.dll $ - VERBATIM) -endif() +target_link_libraries(main PRIVATE SFML::Graphics) diff --git a/README.md b/README.md index 23ac18a..8344e77 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ The template starts out very basic, but might receive additional features over t libxcursor-dev \ libudev-dev \ libfreetype-dev \ - libopenal-dev \ libflac-dev \ libvorbis-dev \ libgl1-mesa-dev \ diff --git a/src/main.cpp b/src/main.cpp index f41c87f..e1aec12 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,14 +2,14 @@ int main() { - auto window = sf::RenderWindow({1920u, 1080u}, "CMake SFML Project"); + auto window = sf::RenderWindow(sf::VideoMode({1920u, 1080u}), "CMake SFML Project"); window.setFramerateLimit(144); while (window.isOpen()) { - for (auto event = sf::Event(); window.pollEvent(event);) + while (const std::optional event = window.pollEvent()) { - if (event.type == sf::Event::Closed) + if (event->is()) { window.close(); }