Skip to content

Commit

Permalink
added screenshot of demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Longwater1234 committed Feb 26, 2024
1 parent 17d40bd commit e917255
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ set(DEMO_EXE "demo_widgets")
# ##############################################################################
# IMPORTANT HINT: Tell CMake where you installed SFML libs & headers (root folder)
###############################################################################
# set(SFML_HOME "C:/SFML/SFML-2.6.1") ## (<---WINDOWS)
# set(SFML_HOME "/Library/Frameworks/SFML.framework/") ## (<---MACOS) set(SFML_DIR
# ${SFML_HOME}/lib/cmake/SFML) s
##### (WINDOWS)
# set(SFML_HOME "C:/SFML/SFML-2.6.1")
##### (MACOS)
# set(SFML_HOME "/Library/Frameworks/SFML.framework/")

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

set(ENABLE_DEMO TRUE)

# FIND SFML libs
find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system")
Expand All @@ -28,11 +31,18 @@ if(WIN32)
endif()

# ##############################################################################
# Configure build for SFGraphing library
# Configure build for SFML Widgets library
file(GLOB_RECURSE SFML_WIDGETS_SRC src/Gui/*.cpp 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/)
target_include_directories(sfml-widgets PUBLIC ${SFML_HOME}/include ${CMAKE_SOURCE_DIR}/src/)

# show warnings (depending on C++ compiler)
if(MSVC)
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC /W4)
else()
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC -Wall -Wextra)
endif()

# ##############################################################################
# Configure build for Sample program
Expand All @@ -41,20 +51,17 @@ if(ENABLE_DEMO)

if(WIN32)
add_executable(${DEMO_EXE} WIN32 ${DEMO_SRC})
target_link_libraries(
${DEMO_EXE} PRIVATE sfml-widgets sfml-main OpenGL::GL sfml-graphics
target_link_libraries(${DEMO_EXE} PRIVATE sfml-widgets sfml-main OpenGL::GL sfml-graphics
sfml-window sfml-system)

elseif(APPLE)
include(${CMAKE_SOURCE_DIR}/apple_cmake/MacBundle.cmake)
find_library(FOUNDATION_FRAMEWORK Foundation)
target_link_libraries(
${DEMO_EXE} PRIVATE sfml-widgets OpenGL::GL sfml-graphics sfml-window
target_link_libraries(${DEMO_EXE} PRIVATE sfml-widgets OpenGL::GL sfml-graphics sfml-window
sfml-system ${FOUNDATION_FRAMEWORK})
else()
add_executable(${DEMO_EXE} ${DEMO_SRC})
target_link_libraries(
${DEMO_EXE} PRIVATE sfml-widgets OpenGL::GL sfml-graphics sfml-window
target_link_libraries(${DEMO_EXE} PRIVATE sfml-widgets OpenGL::GL sfml-graphics sfml-window
sfml-system)
endif(WIN32)

Expand All @@ -73,9 +80,3 @@ endif(ENABLE_DEMO)
# include SFML headers
include_directories(${SFML_HOME}/include)

# show warnings (depending on C++ compiler)
if(MSVC)
target_compile_options(${DEMO_EXE} PUBLIC /W4)
else()
target_compile_options(${DEMO_EXE} PUBLIC -Wall -Wextra)
endif()
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ int main()

`demo/demo.cpp` conains a more complex example, featuring all widgets.

![demo_screenshot](doc/demo_screenshot.png)

## Widgets

### `gui::Button`
Expand Down
2 changes: 1 addition & 1 deletion demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main()
gui::Menu menu(app);
menu.setPosition(10, 10);

gui::Theme::loadFont(chk::getResourcePath("resources/tahoma.ttf"));
gui::Theme::loadFont(chk::getResourcePath("tahoma.ttf"));
gui::Theme::loadTexture(defaultTheme.texturePath);
gui::Theme::textSize = 11;
gui::Theme::click.textColor = hex2color("#191B18");
Expand Down
Binary file added doc/demo_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e917255

Please sign in to comment.