From 1bce3719992466e8ae225a208a40388fa8198636 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 23 Feb 2018 14:19:22 +1100 Subject: [PATCH] Added themed launch button description --- Makefile.pc | 13 ++++++++++++- common/menu.c | 34 ++++++++++++++++++++++++++++------ common/theme.c | 8 ++++++-- common/theme.h | 1 + data/button_a_dark.bin | Bin 0 -> 4096 bytes data/button_a_light.bin | Bin 0 -> 4096 bytes 6 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 data/button_a_dark.bin create mode 100644 data/button_a_light.bin diff --git a/Makefile.pc b/Makefile.pc index 766f9b3..c2bbc8f 100644 --- a/Makefile.pc +++ b/Makefile.pc @@ -11,7 +11,8 @@ test : pc_main/main.cpp pc_main/pc_launch.c \ common/menu.c common/font.c common/language.c common/launch.c \ common/menu-entry.c common/menu-list.c common/text.c \ common/nanojpeg.c common/ui.c common/math.c common/theme.c \ - build_pc/tahoma24.o build_pc/tahoma12.o build_pc/switchicon_questionmark.bin.o build_pc/folder_icon.bin.o + build_pc/tahoma24.o build_pc/tahoma12.o build_pc/switchicon_questionmark.bin.o build_pc/folder_icon.bin.o \ + build_pc/button_a_light.bin.o build_pc/button_a_dark.bin.o gcc -Wall -O2 -g0 $^ -lsfml-graphics -lsfml-window -lsfml-system -lstdc++ -I. -Ibuild_pc -o $@ build_pc/tahoma12.o : data/tahoma12.nxfnt @@ -34,5 +35,15 @@ build_pc/folder_icon.bin.o : data/folder_icon.bin @echo $(notdir $<) @$(bin2o) +build_pc/button_a_light.bin.o : data/button_a_light.bin + mkdir -p $(dir $@) + @echo $(notdir $<) + @$(bin2o) + +build_pc/button_a_dark.bin.o : data/button_a_dark.bin + mkdir -p $(dir $@) + @echo $(notdir $<) + @$(bin2o) + clean: rm -rf build_pc/ test diff --git a/common/menu.c b/common/menu.c index 5ad0df8..47d1007 100644 --- a/common/menu.c +++ b/common/menu.c @@ -14,15 +14,34 @@ void launchMenuEntryTask(menuEntry_s* arg) launchMenuEntry(me); } -//Draws a RGB888 image. -static void drawImage(int x, int y, int width, int height, const uint8_t *image) { +typedef enum +{ + IMAGE_MODE_RGB24, + IMAGE_MODE_RGB32 +} ImageMode; + +//Draws an RGB888 or RGB8888 image. +static void drawImage(int x, int y, int width, int height, const uint8_t *image, ImageMode mode) { int tmpx, tmpy; int pos; + color_t current_color; for (tmpx=0; tmpxnEntries==0) { DrawText(tahoma12, 64, 96 + 32, themeCurrent.textColor, textGetString(StrId_NoAppsFound_Msg)); diff --git a/common/theme.c b/common/theme.c index 0cc57bf..2db60c2 100644 --- a/common/theme.c +++ b/common/theme.c @@ -1,4 +1,6 @@ #include "theme.h" +#include "button_a_light_bin.h" +#include "button_a_dark_bin.h" void themeStartup(ThemePreset preset) { switch (preset) { @@ -10,7 +12,8 @@ void themeStartup(ThemePreset preset) { backWaveColor: MakeColor(154, 171, 255, 255), backgroundColor: MakeColor(233, 236, 241, 255), highlightColor: MakeColor(129, 137, 236, 255), - enableWaveBlending: 0 + enableWaveBlending: 0, + buttonAImage: button_a_light_bin }; break; @@ -22,7 +25,8 @@ void themeStartup(ThemePreset preset) { backWaveColor: MakeColor(73, 103, 169, 255), backgroundColor: MakeColor(45, 55, 66, 255), highlightColor: MakeColor(129, 137, 236, 255), - enableWaveBlending: 0 + enableWaveBlending: 0, + buttonAImage: button_a_dark_bin }; break; } diff --git a/common/theme.h b/common/theme.h index d3c2756..15a42dd 100644 --- a/common/theme.h +++ b/common/theme.h @@ -11,6 +11,7 @@ typedef struct color_t backgroundColor; color_t highlightColor; bool enableWaveBlending; + const uint8_t *buttonAImage; } theme_t; typedef enum diff --git a/data/button_a_dark.bin b/data/button_a_dark.bin new file mode 100644 index 0000000000000000000000000000000000000000..3be501a80c34e91a8c8e7fce8fcb8c52e39df27d GIT binary patch literal 4096 zcmeH~&20iP5QRC=01`Do0W`4G6htN414SU{gEqn`7dGFE*2o&!o*}G6A~Dj)Yx~WQ zhv(U4Hhar|slYG{D|C+@(F=MVRnJ<}-fHUe;B$kX(5MKzc{UGx%+Vgbp^u7eWIO*& z9@s6=Gy1H^$KsJ3!0X&o#7?=(SGW#fRX0yA=}Z8{KTrCEZ;dz+*KVFO_CJyzJqPge z>2eZGgy&!2mRbBIbFF!DN;ahtJhsT7sBfcW`Iq!te^NH~AjxWT&I)@j>QoXksb}L`nLxpL{ z)y7S8jJ)`F-hs{eR$DLS@tNY;5wKVP&f3^HK0F?_>fhpD)vl03>l`iqweFwC^Lu{O zK=-01t@~H&KQ-Rj7!e*;`;Y2~!&3i^^2@_D`|lWkLk{-+(~W!H{mScPc^G>CjB$Ef z*a_ynd`E;>Fa7>dj^yyN@2^y&u@3qzEFV~MMK-bxe|M$0cEpD`S-KZ27iE&~??N8x Q58nTewY7WC|851o0h(yGEdT%j literal 0 HcmV?d00001 diff --git a/data/button_a_light.bin b/data/button_a_light.bin new file mode 100644 index 0000000000000000000000000000000000000000..f166ee6b63ccd76de1ee3a84f79b586b1181d140 GIT binary patch literal 4096 zcmeH~!EFLD5Jfqpfk>$U(1r^q8raknluGC!MWCb)+DJ~hK>ibqWhQHTAV?$)B z6W>a08{u_6#H_$LCy)7jey=^eJIv7j^B6F|Iwc2kz67`B0oEyXpl%jh={L3~`Jlg6 zZC2)A>y_(5Sk3z_zh}e24)AZmwwO{cpQg^`^VN0TgJEDZ*UABGiy7)4b+s^97tX7X zXD$+3J0FC>+0wd?yXkb=!_U604$MVj;qbZJSn-@|E&ilCVJ&G{d_;$9^Y^{DoAKgH zx;yyi`9yS>{5`+0Im?Ut*Lu>O>?iZZ1}maNI6SY7Su@O`Uh7GB*ydB3xAnZ2?}zdE zUVhd3o9=vEJ`U)xSby=?^jD0_`LP@ODC$qODL#K%Yw0}Yhi_i<+=j#FYva=SqnJV6 z<+#}LYwECe{*Z?-ew@FW8`RwZf7K6c+iR(p&qBCI?;q1$>-kb_s?&fDL+>B*5`X0V zTRbOxT@K^W`xpLee}9m}HNU^$=b{dWdvT