Use star symbols from shared font instead of images

This commit is contained in:
hippydave 2019-07-08 03:13:51 +01:00
parent 30961e9991
commit 0891bfaba6
13 changed files with 20 additions and 20 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -27,9 +27,6 @@ assetsDataEntry g_assetsDataList[AssetId_Max] = {
GENASSET("wifi3_icon.bin"),
GENASSET("eth_icon.bin"),
GENASSET("eth_none_icon.bin"),
GENASSET("star_small.bin"),
GENASSET("star_on.bin"),
GENASSET("star_off.bin"),
};
static void assetsClearEntry(assetsDataEntry *entry) {

View File

@ -17,9 +17,6 @@ typedef enum {
AssetId_wifi3_icon,
AssetId_eth_icon,
AssetId_eth_none_icon,
AssetId_star_small,
AssetId_star_on,
AssetId_star_off,
AssetId_Max
} AssetId;

View File

@ -43,6 +43,10 @@ static bool FontSetType(u32 font)
case interuimedium30:
scale = 8;
break;
case largestar:
scale = 18;
break;
default:
return false;

View File

@ -43,3 +43,4 @@ extern const ffnt_header_t interuiregular18_nxfnt;*/
#define interuiregular14 0//&interuiregular14_nxfnt
#define interuiregular18 1//&interuiregular18_nxfnt
#define fontscale7 4
#define largestar 5

View File

@ -294,7 +294,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
if (smallimg) {
drawImage(start_x, start_y + 32, 140, 140, smallimg, IMAGE_MODE_RGB24);
if (me->starred)
drawImage(start_x + 105 + 12, start_y - 12, 35, 33, themeCurrent.starSmallImage, IMAGE_MODE_RGBA32);
DrawText(interuimedium30, start_x + 105 + 16, start_y + 16, themeCurrent.borderTextColor, themeCurrent.labelStarOnText);
}
if (is_active && largeimg) {
@ -335,10 +335,10 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
if (me->starred)
{
drawImage(start_x - 64, 100, 64, 61, themeCurrent.starOnImage, IMAGE_MODE_RGBA32);
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOnText);
} else {
if (smallimg != theme_icon_small)//if (me->type != ENTRY_TYPE_THEME) <- why this crash?
drawImage(start_x - 64, 100, 64, 61, themeCurrent.starOffImage, IMAGE_MODE_RGBA32);
DrawText(largestar, start_x - 68, 160, themeCurrent.textColor, themeCurrent.labelStarOffText);
}
}
}

View File

@ -30,10 +30,9 @@ void themeStartup(ThemePreset preset) {
.buttonYText = "\uE0E3",
.buttonPText = "\uE0EF",
.buttonMText = "\uE0F0",
.labelStarOnText = "\u2605",
.labelStarOffText = "\u2606",
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_light),
.starSmallImage = assetsGetDataBuffer(AssetId_star_small),
.starOnImage = assetsGetDataBuffer(AssetId_star_on),
.starOffImage = assetsGetDataBuffer(AssetId_star_off)
};
theme_t themeDark = (theme_t) {
@ -54,10 +53,9 @@ void themeStartup(ThemePreset preset) {
.buttonYText = "\uE0A3",
.buttonPText = "\uE0B3",
.buttonMText = "\uE0B4",
.labelStarOnText = "\u2605",
.labelStarOffText = "\u2606",
.hbmenuLogoImage = assetsGetDataBuffer(AssetId_hbmenu_logo_dark),
.starSmallImage = assetsGetDataBuffer(AssetId_star_small),
.starOnImage = assetsGetDataBuffer(AssetId_star_on),
.starOffImage = assetsGetDataBuffer(AssetId_star_off)
};
char themePath[PATH_MAX] = {0};
@ -69,7 +67,7 @@ void themeStartup(ThemePreset preset) {
config_setting_t *theme = NULL;
color_t text, frontWave, middleWave, backWave, background, highlight, separator, borderColor, borderTextColor, progressBarColor;
int waveBlending;
const char *AText, *BText, *XText, *YText, *PText, *MText;
const char *AText, *BText, *XText, *YText, *PText, *MText, *starOnText, *starOffText;
bool good_cfg = false;
if(themePath[0]!=0)
@ -126,7 +124,11 @@ void themeStartup(ThemePreset preset) {
PText = themeDefault->buttonPText;
if (!config_setting_lookup_string(theme, "buttonMText", &MText))
MText = themeDefault->buttonMText;
themeCurrent = (theme_t) {
if (!config_setting_lookup_string(theme, "labelStarOnText", &starOnText))
starOnText = themeDefault->labelStarOnText;
if (!config_setting_lookup_string(theme, "labelStarOffText", &starOffText))
starOffText = themeDefault->labelStarOffText;
themeCurrent = (theme_t) {
.textColor = text,
.frontWaveColor = frontWave,
.middleWaveColor = middleWave,

View File

@ -22,10 +22,9 @@ typedef struct
char buttonYText[32];
char buttonPText[32];
char buttonMText[32];
char labelStarOnText[32];
char labelStarOffText[32];
const uint8_t *hbmenuLogoImage;
const uint8_t *starSmallImage;
const uint8_t *starOnImage;
const uint8_t *starOffImage;
} theme_t;
typedef enum

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB