Added themed launch button description
This commit is contained in:
parent
ad52da6278
commit
1bce371999
13
Makefile.pc
13
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
|
||||
|
@ -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; tmpx<width; tmpx++) {
|
||||
for (tmpy=0; tmpy<height; tmpy++) {
|
||||
pos = ((tmpy*width) + tmpx) * 3;
|
||||
DrawPixelRaw(x+tmpx, y+tmpy, MakeColor(image[pos+0], image[pos+1], image[pos+2], 255));
|
||||
switch (mode) {
|
||||
case IMAGE_MODE_RGB24:
|
||||
pos = ((tmpy*width) + tmpx) * 3;
|
||||
current_color = MakeColor(image[pos+0], image[pos+1], image[pos+2], 255);
|
||||
break;
|
||||
|
||||
case IMAGE_MODE_RGB32:
|
||||
pos = ((tmpy*width) + tmpx) * 4;
|
||||
current_color = MakeColor(image[pos+0], image[pos+1], image[pos+2], image[pos+3]);
|
||||
//fprintf(stderr, "%d\n", image[pos+3]);
|
||||
break;
|
||||
}
|
||||
|
||||
DrawPixel(x+tmpx, y+tmpy, current_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,11 +157,11 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
|
||||
}
|
||||
|
||||
if (smallimg) {
|
||||
drawImage(start_x, start_y + 32, 140, 140, smallimg);
|
||||
drawImage(start_x, start_y + 32, 140, 140, smallimg, IMAGE_MODE_RGB24);
|
||||
}
|
||||
|
||||
if (is_active && largeimg) {
|
||||
drawImage(220, 100, 256, 256, largeimg);
|
||||
drawImage(220, 100, 256, 256, largeimg, IMAGE_MODE_RGB24);
|
||||
|
||||
shadow_start_y = 100+256;
|
||||
border_start_x = 220;
|
||||
@ -272,6 +291,9 @@ void menuLoop() {
|
||||
|
||||
//drawTime();
|
||||
|
||||
drawImage(1280 - 190 + 64, 720 - 32 - 16, 32, 32, themeCurrent.buttonAImage, IMAGE_MODE_RGB32);
|
||||
DrawText(tahoma12, 1280 - 190 + 32 + 68, 720 - 32 - 16 + 4, themeCurrent.textColor, "Launch");
|
||||
|
||||
if (menu->nEntries==0)
|
||||
{
|
||||
DrawText(tahoma12, 64, 96 + 32, themeCurrent.textColor, textGetString(StrId_NoAppsFound_Msg));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ typedef struct
|
||||
color_t backgroundColor;
|
||||
color_t highlightColor;
|
||||
bool enableWaveBlending;
|
||||
const uint8_t *buttonAImage;
|
||||
} theme_t;
|
||||
|
||||
typedef enum
|
||||
|
BIN
data/button_a_dark.bin
Normal file
BIN
data/button_a_dark.bin
Normal file
Binary file not shown.
BIN
data/button_a_light.bin
Normal file
BIN
data/button_a_light.bin
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user