Skip to content

Commit

Permalink
add icon to executable (on WIN32 platform)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Arutiunian committed Jan 11, 2018
1 parent 5e09819 commit 442ef06
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ set(CMAKE_CXX_STANDARD 17)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

set(NO_CONSOLE "")
set(WIN)
set(RES)

if (WIN32 AND CMAKE_BUILD_TYPE MATCHES Release)
set(NO_CONSOLE WIN32)
set(WIN WIN32)
endif ()

add_executable(doodle-jump ${NO_CONSOLE}
if (WIN32 AND EXISTS ${CMAKE_SOURCE_DIR}/resources.rc)
find_program(WINDRES "windres.exe")
if (WINDRES)
execute_process(
COMMAND windres.exe resources.rc -o resources.o
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
set(RES resources.o)
endif ()
endif ()

add_executable(doodle-jump ${WIN}
resources
lib/incbin/incbin.h
src/main.cpp
Expand Down Expand Up @@ -48,7 +60,8 @@ add_executable(doodle-jump ${NO_CONSOLE}
src/Assets.cpp
src/Assets.h
src/Sprite.cpp
src/Sprite.h)
src/Sprite.h
${RES})

target_compile_features(doodle-jump PUBLIC cxx_std_17)

Expand Down
24 changes: 24 additions & 0 deletions resources.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
0 ICON "resources/icon.ico"
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904E4"
BEGIN
VALUE "CompanyName", "David Arutiunian"
VALUE "FileDescription", "doodle jump"
VALUE "FileVersion", "1.0"
VALUE "InternalName", "doodle-jump"
VALUE "LegalCopyright", "David Arutiunian"
VALUE "OriginalFilename", "doodle-jump.exe"
VALUE "ProductName", "doodle jump"
VALUE "ProductVersion", "1.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1252
END
END
Binary file added resources/icon.ico
Binary file not shown.
Binary file modified resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <SFML/Graphics.hpp>
#include "../lib/incbin/incbin.h"

static const sf::Vector2u ICON_IMAGE_SIZE = {32, 32};
static const sf::Vector2u ICON_IMAGE_SIZE = {64, 64};
static const sf::Vector2f BACKGROUND_SPRITE_SIZE = {600.f, 800.f};
static const sf::Vector2f DOODLER_SPRITE_SIZE = {50.f, 45.f};
static const sf::Vector2f PLATFORM_SPRITE_SIZE = {40.f, 12.5f};
Expand Down

0 comments on commit 442ef06

Please sign in to comment.