Skip to content

Commit

Permalink
added icon .ico for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Longwater1234 committed Feb 27, 2024
1 parent 82faca4 commit 5292480
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(sfml-widgets VERSION 1.1.0)

# ##############################################################################
Expand All @@ -14,11 +14,10 @@ set(DEMO_EXE "demo_widgets")
##### (MACOS)
# set(SFML_HOME "/Library/Frameworks/SFML.framework/")

# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)

set(ENABLE_DEMO TRUE)

# FIND SFML precompiled libs
# FIND SFML precompiled libs & headers
# set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system")
find_package(OpenGL REQUIRED)

Expand All @@ -32,7 +31,7 @@ endif()

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

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

Expand All @@ -75,8 +74,7 @@ if(ENABLE_DEMO)
#####################################################
if(NOT APPLE)
add_custom_command(TARGET ${DEMO_EXE}
POST_BUILD
COMMAND
POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/demo/resources
$<TARGET_FILE_DIR:${DEMO_EXE}>/resources)
endif()
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ A simple GUI module for SFML.

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

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

### MacOS
Expand Down Expand Up @@ -70,14 +69,14 @@ int main()
{
sf::RenderWindow app(sf::VideoMode(800, 600), "SFML Widgets", sf::Style::Close);
//set FPS limit
//Set FPS limit
//app.setFramerateLimit(60);

// Declare menu
gui::Menu menu(app);

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

// Create some button widget
gui::Button* button = new gui::Button("My button");
Expand Down
Binary file added demo/resources/win-icon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions demo/resources/win-icon.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "win-icon.ico"

0 comments on commit 5292480

Please sign in to comment.