Skip to content

Commit 5292480

Browse files
committed
added icon .ico for Windows
1 parent 82faca4 commit 5292480

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

CMakeLists.txt

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.18)
1+
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
22
project(sfml-widgets VERSION 1.1.0)
33

44
# ##############################################################################
@@ -14,11 +14,10 @@ set(DEMO_EXE "demo_widgets")
1414
##### (MACOS)
1515
# set(SFML_HOME "/Library/Frameworks/SFML.framework/")
1616

17-
# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
18-
1917
set(ENABLE_DEMO TRUE)
2018

21-
# FIND SFML precompiled libs
19+
# FIND SFML precompiled libs & headers
20+
# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
2221
find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system")
2322
find_package(OpenGL REQUIRED)
2423

@@ -32,7 +31,7 @@ endif()
3231

3332
# ##############################################################################
3433
# Configure build for SFML Widgets library
35-
file(GLOB_RECURSE SFML_WIDGETS_SRC src/Gui/*.cpp src/Gui/**/*.cpp)
34+
file(GLOB_RECURSE SFML_WIDGETS_SRC src/Gui/*.cpp)
3635
add_library(sfml-widgets ${SFML_WIDGETS_SRC})
3736
target_link_libraries(sfml-widgets PUBLIC sfml-graphics sfml-window sfml-system)
3837
target_include_directories(sfml-widgets PUBLIC ${CMAKE_SOURCE_DIR}/src/)
@@ -52,7 +51,7 @@ if(ENABLE_DEMO)
5251
file(GLOB DEMO_SRC demo/*.cpp demo/*.mm)
5352

5453
if(WIN32)
55-
add_executable(${DEMO_EXE} WIN32 ${DEMO_SRC})
54+
add_executable(${DEMO_EXE} WIN32 ${DEMO_SRC} ${CMAKE_SOURCE_DIR}/demo/resources/win-icon.rc)
5655
target_link_libraries(${DEMO_EXE} PRIVATE sfml-widgets sfml-main OpenGL::GL sfml-graphics
5756
sfml-window sfml-system)
5857

@@ -75,8 +74,7 @@ if(ENABLE_DEMO)
7574
#####################################################
7675
if(NOT APPLE)
7776
add_custom_command(TARGET ${DEMO_EXE}
78-
POST_BUILD
79-
COMMAND
77+
POST_BUILD COMMAND
8078
${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/demo/resources
8179
$<TARGET_FILE_DIR:${DEMO_EXE}>/resources)
8280
endif()

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ A simple GUI module for SFML.
1414

1515
## Requirements:
1616
- [Download SFML 2.6.x](https://www.sfml-dev.org/download.php) for your platform
17-
- Download latest [CMake Installer](https://cmake.org/download/)
17+
- Latest [CMake Installer](https://cmake.org/download/) - version 3.20 or higher
1818

1919
### Windows:
2020
- Visual Studio 2022 or later (select complete "**Desktop C++ Development**" workload)
21-
- Windows SDK.
2221
- CMake for VS2022 (download using Visual Studio installer).
2322

2423
### MacOS
@@ -70,14 +69,14 @@ int main()
7069
{
7170
sf::RenderWindow app(sf::VideoMode(800, 600), "SFML Widgets", sf::Style::Close);
7271
73-
//set FPS limit
72+
//Set FPS limit
7473
//app.setFramerateLimit(60);
7574

7675
// Declare menu
7776
gui::Menu menu(app);
7877

79-
gui::Theme::loadFont("resources/tahoma.ttf"); //TODO handle error
80-
gui::Theme::loadTexture("resources/texture-default.png"); //TODO handle error
78+
gui::Theme::loadFont("resources/tahoma.ttf");
79+
gui::Theme::loadTexture("resources/texture-default.png");
8180

8281
// Create some button widget
8382
gui::Button* button = new gui::Button("My button");

demo/resources/win-icon.ico

176 KB
Binary file not shown.

demo/resources/win-icon.rc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDI_ICON1 ICON DISCARDABLE "win-icon.ico"

0 commit comments

Comments
 (0)