From 5979c5f77805b1614160eb060bfff9fdd4eb7c9d Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 29 Nov 2014 17:23:42 +0100 Subject: [PATCH] Add placeholder application icon --- CMakeLists.txt | 1 + assets/icon.png | Bin 0 -> 1263 bytes assets/icon.svg | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ mkxp.pro | 3 +- src/main.cpp | 27 ++++++++++------- 5 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 assets/icon.png create mode 100644 assets/icon.svg diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cf8e74..025fb29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,7 @@ set(EMBEDDED_INPUT shader/blurV.vert shader/simpleMatrix.vert assets/liberation.ttf + assets/icon.png ) if (RGSS2) diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..906f73b5be0b9742247122b5284a99ce2d4bb7a2 GIT binary patch literal 1263 zcmc(f|2q>19LGOw8VW7Ux5S#Kn<>JKB^g;vESB@-!ps##z9!c4C0m(`xQvQjk|XP= zt|zfX-3%#T(w^2Sr_xitEu|c3nw|cNdq2od30YH!D=fhYb z<-4^JD|xXs|2=>PE+`;`s#dF4n*U8GBv_+in-%Qc3`k9&Y=qJPkfp$fTu}4D6AK7U z(9we0P?*U9MK)XtfjtD!)PPtbygLT3GGX6V(9i(iO)!`QJ~n_wLt89}Szw_L;~XGa zLL3Q{C*cbZ1a#p0!f6^rIfAPtEb?H2162&zjR!|_kj8`C1|V;M^zG1_0C;04@`rd= zsMtfg3inn9vdv)7_ksZAch}l80QYWov8S(SmKsi?8sfa@gnrB&t>6-nv zTJINn7Xc6qnvYjVxU@cOB6OOvHd;e#H9pwrE~Cp2t&Jg`9!7t90mgkf>ISj1#p}2% zM8xAk1O3W#1LY}kI%X8yh8rmv{Z`tG4}QoNRHHxJRp}O7Ia+XKr^GfwQTZpS(S4{1 zQ+;;prK0{Xftj+(!z97WDd%zAk>rKd!Mj~rg$_n%?2T7{l~s3_+OKh8M%Mnc^qjYo z_xtB3H;_n{U-^@!w$c?qx2af%!BAoelOk(P1a-N85EE!K!;M?0s1+sxH z3D<6rhf`|mLP(LKOg_h=7NuNPb_hFI#KB3klOG>UdWeNMl_WepExc#Z}#XecJWQeS!@aCi1MGTH4p6|MZp7}C;@9{l;dIg8^W)cd07cS}(tFMzX3p&+dSO{3#|^%YyIJz6rT#5ET>~l{J(r zOgfkJ?+|O=e+Z51LU6YWJqz=!sc!y~unUJtb1~Cc!E7IQ7?rwi;~Se3DhVEQ!kLym zyRZ2c^Rjny-K4e79g&ku1ahxc0rR%kfbPu7L z63Kq + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/mkxp.pro b/mkxp.pro index 0ee0547..78aee3e 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -202,7 +202,8 @@ EMBED = \ shader/blurV.vert \ shader/simpleMatrix.vert \ shader/tilemapvx.vert \ - assets/liberation.ttf + assets/liberation.ttf \ + assets/icon.png SHARED_FLUID { DEFINES += SHARED_FLUID diff --git a/src/main.cpp b/src/main.cpp index cd2ca59..23fc918 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,6 +26,9 @@ #include #include +#include +#include +#include #include #include "sharedstate.h" @@ -37,9 +40,7 @@ #include "binding.h" -#include -#include -#include +#include "icon.png.xxd" static void rgssThreadError(RGSSThreadData *rtData, const std::string &msg) @@ -236,6 +237,16 @@ int main(int argc, char *argv[]) return 0; } + /* Setup application icon */ + SDL_RWops *iconSrc; + + if (conf.iconPath.empty()) + iconSrc = SDL_RWFromConstMem(assets_icon_png, assets_icon_png_len); + else + iconSrc = SDL_RWFromFile(conf.iconPath.c_str(), "rb"); + + SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE); + SDL_SetHint("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0"); SDL_Window *win; @@ -256,14 +267,10 @@ int main(int argc, char *argv[]) return 0; } - if (!conf.iconPath.empty()) + if (iconImg) { - SDL_Surface *iconImg = IMG_Load(conf.iconPath.c_str()); - if (iconImg) - { - SDL_SetWindowIcon(win, iconImg); - SDL_FreeSurface(iconImg); - } + SDL_SetWindowIcon(win, iconImg); + SDL_FreeSurface(iconImg); } EventThread eventThread;