Skip to content

Commit 080aae4

Browse files
committed
Use SFML 3
1 parent 4a3b745 commit 080aae4

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
77
include(FetchContent)
88
FetchContent_Declare(SFML
99
GIT_REPOSITORY https://github.com/SFML/SFML.git
10-
GIT_TAG 2.6.x)
10+
GIT_TAG master)
1111
FetchContent_MakeAvailable(SFML)
1212

1313
add_executable(CMakeSFMLProject src/main.cpp)
14-
target_link_libraries(CMakeSFMLProject PRIVATE sfml-graphics)
15-
target_compile_features(CMakeSFMLProject PRIVATE cxx_std_17)
16-
17-
if(WIN32)
18-
add_custom_command(
19-
TARGET CMakeSFMLProject
20-
COMMENT "Copy OpenAL DLL"
21-
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/openal32.dll $<TARGET_FILE_DIR:CMakeSFMLProject>
22-
VERBATIM)
23-
endif()
14+
target_link_libraries(CMakeSFMLProject PRIVATE SFML::Graphics)
2415

2516
install(TARGETS CMakeSFMLProject)

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
int main()
44
{
5-
auto window = sf::RenderWindow{ { 1920u, 1080u }, "CMake SFML Project" };
5+
auto window = sf::RenderWindow{ sf::VideoMode{ { 1920u, 1080u } }, "CMake SFML Project" };
66
window.setFramerateLimit(144);
77

88
while (window.isOpen())
99
{
10-
for (auto event = sf::Event{}; window.pollEvent(event);)
10+
while (const auto event = window.pollEvent())
1111
{
12-
if (event.type == sf::Event::Closed)
12+
if (event.is<sf::Event::Closed>())
1313
{
1414
window.close();
1515
}
@@ -18,4 +18,4 @@ int main()
1818
window.clear();
1919
window.display();
2020
}
21-
}
21+
}

0 commit comments

Comments
 (0)