gui: Refactor textures vars for dark theme and add icons for settings menu

This commit is contained in:
Joel16 2021-06-04 13:52:30 -04:00
parent 142d88ac77
commit e365cb36de
21 changed files with 139 additions and 119 deletions

BIN
app/data/about_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
app/data/ftp_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
app/data/ftp_icon_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
app/data/sort_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
app/data/sort_icon_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -3,17 +3,18 @@
#include <glib2d.h>
constexpr int NUM_ICONS = 6;
constexpr int NUM_FILE_ICONS = 6;
constexpr int NUM_BATT_ICONS = 6;
constexpr int NUM_THEMES = 2;
extern g2dTexture *file_icons[NUM_ICONS], *icon_dir, *icon_dir_dark, *icon_check, *icon_check_dark, *icon_uncheck, \
*icon_uncheck_dark, *icon_toggle_on, *icon_toggle_dark_on, *icon_toggle_off, *icon_radio_off, \
*icon_radio_on, *icon_radio_dark_off, *icon_radio_dark_on, *icon_nav_drawer, *icon_back, \
*options_dialog, *options_dialog_dark, *properties_dialog, *properties_dialog_dark, *dialog, *dialog_dark, \
extern g2dTexture *file_icons[NUM_FILE_ICONS], *icon_dir[NUM_THEMES], *icon_check[NUM_THEMES], *icon_uncheck[NUM_THEMES], \
*icon_toggle_on[NUM_THEMES], *icon_toggle_off, *icon_radio_off[NUM_THEMES], *icon_radio_on[NUM_THEMES], *icon_nav_drawer, \
*icon_back, *options_dialog[NUM_THEMES], *properties_dialog[NUM_THEMES], *dialog[NUM_THEMES], \
*battery_charging[NUM_BATT_ICONS], *battery[NUM_BATT_ICONS], *usb_icon, \
*default_artwork, *default_artwork_blur, *btn_play, *btn_pause, *btn_rewind, *btn_forward, \
*btn_repeat, *btn_shuffle, *btn_repeat_overlay, *btn_shuffle_overlay, \
*bg_header, *icon_sd, *icon_secure, *icon_sd_dark, *icon_secure_dark, *ic_play_btn;
*bg_header, *icon_sd[NUM_THEMES], *icon_secure[NUM_THEMES], *ic_play_btn, *ftp_icon[NUM_THEMES], *sort_icon[NUM_THEMES], \
*dark_theme_icon[NUM_THEMES], *dev_options_icon[NUM_THEMES], *about_icon[NUM_THEMES];
namespace Textures {
void Load(void);

View File

@ -63,16 +63,16 @@ namespace GUI {
GUI::DisplayFileBrowser(&item);
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, title.c_str());
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, title.c_str());
int text_width = intraFontMeasureText(font, message.c_str());
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog->h)) / 2) + 60, message.c_str());
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, message.c_str());
G2D::DrawRect(((480 - dialog->w) / 2) + 20, ((272 - dialog->h) / 2) + 70, 318, 4, SELECTOR_COLOUR);
G2D::DrawRect(((480 - dialog->w) / 2) + 20, ((272 - dialog->h) / 2) + 70,
G2D::DrawRect(((480 - dialog[0]->w) / 2) + 20, ((272 - dialog[0]->h) / 2) + 70, 318, 4, SELECTOR_COLOUR);
G2D::DrawRect(((480 - dialog[0]->w) / 2) + 20, ((272 - dialog[0]->h) / 2) + 70,
static_cast<int>((static_cast<float>(offset) / static_cast<float>(size)) * 318.f), 4, TITLE_COLOUR);
g2dFlip(G2D_VSYNC);

View File

@ -42,9 +42,9 @@ namespace GUI {
void DisplayDeleteOptions(void) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, "Delete");
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, "Delete");
int confirm_width = intraFontMeasureText(font, "YES");
int cancel_width = intraFontMeasureText(font, "NO");
@ -59,7 +59,7 @@ namespace GUI {
int prompt_width = intraFontMeasureText(font, prompt.c_str());
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog->h)) / 2) + 60, prompt.c_str());
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, prompt.c_str());
}
void ControlDeleteOptions(MenuItem *item, int *ctrl) {

View File

@ -38,13 +38,13 @@ namespace GUI {
G2D::DrawRect(0, start_y + (sel_dist * (i - start)), 480, sel_dist, SELECTOR_COLOUR);
if ((item->checked[i]) && (!item->checked_cwd.compare(cfg.cwd)))
G2D::DrawImageScale(cfg.dark_theme? icon_check_dark : icon_check, 0, start_y + (sel_dist * (i - start)), 18.f, 18.f);
G2D::DrawImageScale(icon_check[cfg.dark_theme], 0, start_y + (sel_dist * (i - start)), 18.f, 18.f);
else
G2D::DrawImageScale(cfg.dark_theme? icon_uncheck_dark : icon_uncheck, 0, start_y + (sel_dist * (i - start)), 18.f, 18.f);
G2D::DrawImageScale(icon_uncheck[cfg.dark_theme], 0, start_y + (sel_dist * (i - start)), 18.f, 18.f);
FileType file_type = FS::GetFileType(filename);
if (FIO_S_ISDIR(item->entries[i].d_stat.st_mode))
G2D::DrawImageScale(cfg.dark_theme? icon_dir_dark : icon_dir, 20, start_y + (sel_dist * (i - start)), 18.f, 18.f);
G2D::DrawImageScale(icon_dir[cfg.dark_theme], 20, start_y + (sel_dist * (i - start)), 18.f, 18.f);
else
G2D::DrawImageScale(file_icons[file_type], 20, start_y + (sel_dist * (i - start)), 18.f, 18.f);

View File

@ -11,9 +11,9 @@ namespace GUI {
void DisplayHomeMenu(void) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, "Exit");
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, "Exit");
int confirm_width = intraFontMeasureText(font, "YES");
int cancel_width = intraFontMeasureText(font, "NO");
@ -28,7 +28,7 @@ namespace GUI {
int prompt_width = intraFontMeasureText(font, prompt.c_str());
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog->h)) / 2) + 60, prompt.c_str());
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, prompt.c_str());
}
bool ControlHomeMenu(MenuItem *item, int *ctrl) {

View File

@ -30,61 +30,61 @@ namespace GUI {
G2D::FontSetStyle(font, 1.0f, cfg.dark_theme? WHITE : BLACK, INTRAFONT_ALIGN_LEFT);
if (is_psp_go) {
G2D::DrawImage(cfg.dark_theme? icon_sd_dark : icon_sd, pos_x + 10, 92);
G2D::DrawImage(icon_sd[cfg.dark_theme], pos_x + 10, 92);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2), !is_ms_inserted? "ef0:/" : "ms0:/");
if (is_ms_inserted) {
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 122);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 122);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 30, "ef0:/");
if (cfg.dev_options) {
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 152);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 152);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 60, "flash0:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 182);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 182);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 90, "flash1:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 212);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 212);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 120, "flash2:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 242);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 242);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 150, "flash3:/");
}
}
else {
if (cfg.dev_options) {
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 122);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 122);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 30, "flash0:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 152);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 152);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 60, "flash1:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 182);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 182);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 90, "flash2:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 212);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 212);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 120, "flash3:/");
}
}
}
else {
G2D::DrawImage(cfg.dark_theme? icon_sd_dark : icon_sd, pos_x + 10, 92);
G2D::DrawImage(icon_sd[cfg.dark_theme], pos_x + 10, 92);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2), "ms0:/");
if (cfg.dev_options) {
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 122);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 122);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 30, "flash0:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 152);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 152);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 60, "flash1:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 182);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 182);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 90, "flash2:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 212);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 212);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 120, "flash3:/");
G2D::DrawImage(cfg.dark_theme? icon_secure_dark : icon_secure, pos_x + 10, 242);
G2D::DrawImage(icon_secure[cfg.dark_theme], pos_x + 10, 242);
G2D::DrawText(pos_x + 50, 90 + ((30 - (font->glyph->height - 6)) / 2) + 150, "disc0:/");
}
}

View File

@ -124,7 +124,7 @@ namespace Options {
namespace GUI {
void DisplayFileOptions(MenuItem *item) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? options_dialog_dark : options_dialog, (480 - options_dialog->w) / 2, (272 - options_dialog->h) / 2);
G2D::DrawImage(options_dialog[cfg.dark_theme], (480 - options_dialog[0]->w) / 2, (272 - options_dialog[0]->h) / 2);
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(140, 52, "Actions");

View File

@ -10,10 +10,10 @@
namespace GUI {
void DisplayFileProperties(MenuItem *item) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? properties_dialog_dark : properties_dialog, ((480 - (properties_dialog->w)) / 2), ((272 - (properties_dialog->h)) / 2));
G2D::DrawImage(properties_dialog[cfg.dark_theme], ((480 - (properties_dialog[0]->w)) / 2), ((272 - (properties_dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (properties_dialog->w)) / 2) + 10, ((272 - (properties_dialog->h)) / 2) + 20, "Properties");
G2D::DrawText(((480 - (properties_dialog[0]->w)) / 2) + 10, ((272 - (properties_dialog[0]->h)) / 2) + 20, "Properties");
int ok_width = intraFontMeasureText(font, "OK");
G2D::DrawRect((340 - (ok_width)) - 5, (220 - (font->texYSize - 15)) - 5, ok_width + 10, (font->texYSize - 5) + 10, SELECTOR_COLOUR);

View File

@ -229,9 +229,9 @@ namespace GUI {
static void DisplayFTPSettings(void) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, "FTP");
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, "FTP");
int ok_width = intraFontMeasureText(font, "OK");
G2D::DrawRect((409 - (ok_width)) - 5, (180 - (font->texYSize - 15)) - 5, ok_width + 10, (font->texYSize - 5) + 10, SELECTOR_COLOUR);
@ -239,7 +239,7 @@ namespace GUI {
int text_width = intraFontMeasureText(font, ftp_text);
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog->h)) / 2) + 60, ftp_text);
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, ftp_text);
}
static void ControlFTPSettings(void) {
@ -267,10 +267,10 @@ namespace GUI {
G2D::DrawText(40, 204, "Size");
G2D::DrawText(40, 218, "Sort by size (smallest first).");
G2D::DrawImage(cfg.sort == 0? (cfg.dark_theme? icon_radio_dark_on : icon_radio_on) : (cfg.dark_theme? icon_radio_dark_off : icon_radio_off), 425, 60);
G2D::DrawImage(cfg.sort == 1? (cfg.dark_theme? icon_radio_dark_on : icon_radio_on) : (cfg.dark_theme? icon_radio_dark_off : icon_radio_off), 425, 104);
G2D::DrawImage(cfg.sort == 2? (cfg.dark_theme? icon_radio_dark_on : icon_radio_on) : (cfg.dark_theme? icon_radio_dark_off : icon_radio_off), 425, 148);
G2D::DrawImage(cfg.sort == 3? (cfg.dark_theme? icon_radio_dark_on : icon_radio_on) : (cfg.dark_theme? icon_radio_dark_off : icon_radio_off), 425, 192);
G2D::DrawImage(cfg.sort == 0? icon_radio_on[cfg.dark_theme] : icon_radio_off[cfg.dark_theme], 425, 60);
G2D::DrawImage(cfg.sort == 1? icon_radio_on[cfg.dark_theme] : icon_radio_off[cfg.dark_theme], 425, 104);
G2D::DrawImage(cfg.sort == 2? icon_radio_on[cfg.dark_theme] : icon_radio_off[cfg.dark_theme], 425, 148);
G2D::DrawImage(cfg.sort == 3? icon_radio_on[cfg.dark_theme] : icon_radio_off[cfg.dark_theme], 425, 192);
}
static void ControlSortSettings(MenuItem *item) {
@ -289,9 +289,9 @@ namespace GUI {
static void DisplayAboutSettings(void) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, "About");
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, "About");
int ok_width = intraFontMeasureText(font, "OK");
G2D::DrawRect((409 - (ok_width)) - 5, (180 - (font->texYSize - 15)) - 5, ok_width + 10, (font->texYSize - 5) + 10, SELECTOR_COLOUR);
@ -299,11 +299,11 @@ namespace GUI {
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
int version_width = intraFontMeasureText(font, "CMFileManager-PSP version: v4.0.0");
intraFontPrintf(font, ((480 - (version_width)) / 2), ((272 - (dialog->h)) / 2) + 50, "CMFileManager-PSP version: v%d.%d.%d",
intraFontPrintf(font, ((480 - (version_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 50, "CMFileManager-PSP version: v%d.%d.%d",
VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO);
int author_width = intraFontMeasureText(font, "Author: Joel16");
G2D::DrawText(((480 - (author_width)) / 2), ((272 - (dialog->h)) / 2) + 68, "Author: Joel16");
G2D::DrawText(((480 - (author_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 68, "Author: Joel16");
}
static void ControlAboutSettings(void) {
@ -317,27 +317,33 @@ namespace GUI {
G2D::DrawText(40, 40, "Settings");
G2D::FontSetStyle(font, 1.0f, cfg.dark_theme? WHITE : BLACK, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(40, 72, "FTP connection");
G2D::DrawText(40, 86, "Wireless connection");
G2D::DrawText(40, 116, "Sorting options");
G2D::DrawText(40, 130, "Select between various sorting options.");
G2D::DrawImage(ftp_icon[cfg.dark_theme], 15, 59);
G2D::DrawText(60, 72, "FTP connection");
G2D::DrawText(60, 86, "Wireless connection");
G2D::DrawText(40, 160, "Dark theme");
G2D::DrawText(40, 174, "Enables dark theme mode.");
G2D::DrawImage(sort_icon[cfg.dark_theme], 15, 103);
G2D::DrawText(60, 116, "Sorting options");
G2D::DrawText(60, 130, "Select between various sorting options.");
G2D::DrawText(40, 204, "Developer options");
G2D::DrawText(40, 218, "Enable logging and fs access to NAND.");
G2D::DrawImage(dark_theme_icon[cfg.dark_theme], 15, 147);
G2D::DrawText(60, 160, "Dark theme");
G2D::DrawText(60, 174, "Enables dark theme mode.");
G2D::DrawText(40, 248, "About");
G2D::DrawText(40, 262, "Application and device info");
G2D::DrawImage(dev_options_icon[cfg.dark_theme], 15, 191);
G2D::DrawText(60, 204, "Developer options");
G2D::DrawText(60, 218, "Enable logging and fs access to NAND.");
G2D::DrawImage(about_icon[cfg.dark_theme], 15, 235);
G2D::DrawText(60, 248, "About");
G2D::DrawText(60, 262, "Application and device info");
if (cfg.dark_theme)
G2D::DrawImage(cfg.dark_theme? icon_toggle_dark_on : icon_toggle_on, 415, 143);
G2D::DrawImage(icon_toggle_on[cfg.dark_theme], 415, 143);
else
G2D::DrawImage(icon_toggle_off, 415, 143);
G2D::DrawImage(cfg.dev_options? (cfg.dark_theme? icon_toggle_dark_on : icon_toggle_on) : icon_toggle_off, 415, 187);
G2D::DrawImage(cfg.dev_options? icon_toggle_on[cfg.dark_theme] : icon_toggle_off, 415, 187);
}
static void ControlGeneralSettings(MenuItem *item, int *ctrl) {

View File

@ -580,9 +580,9 @@ namespace TextViewer {
if (state == STATE_DIALOG) {
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50: 80));
G2D::DrawImage(cfg.dark_theme? dialog_dark : dialog, ((480 - (dialog->w)) / 2), ((272 - (dialog->h)) / 2));
G2D::DrawImage(dialog[cfg.dark_theme], ((480 - (dialog[0]->w)) / 2), ((272 - (dialog[0]->h)) / 2));
G2D::FontSetStyle(font, 1.0f, TITLE_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (dialog->w)) / 2) + 10, ((272 - (dialog->h)) / 2) + 20, "Save");
G2D::DrawText(((480 - (dialog[0]->w)) / 2) + 10, ((272 - (dialog[0]->h)) / 2) + 20, "Save");
int confirm_width = intraFontMeasureText(font, "YES");
int cancel_width = intraFontMeasureText(font, "NO");
@ -597,7 +597,7 @@ namespace TextViewer {
int prompt_width = intraFontMeasureText(font, prompt.c_str());
G2D::FontSetStyle(font, 1.0f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog->h)) / 2) + 60, prompt.c_str());
G2D::DrawText(((480 - (prompt_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, prompt.c_str());
}
g2dFlip(G2D_VSYNC);

View File

@ -14,7 +14,9 @@ extern unsigned char ic_fso_type_app_png_start[], ic_fso_type_compress_png_start
default_artwork_png_start[], default_artwork_blur_png_start[], btn_playback_play_png_start[], btn_playback_pause_png_start[],
btn_playback_rewind_png_start[], btn_playback_forward_png_start[], btn_playback_repeat_png_start[], btn_playback_shuffle_png_start[],
btn_playback_repeat_overlay_png_start[], btn_playback_shuffle_overlay_png_start[], bg_header_png_start[], ic_material_light_sdcard_png_start[],
ic_material_light_secure_png_start[], ic_material_light_sdcard_dark_png_start[], ic_material_light_secure_dark_png_start[], ic_play_btn_png_start[];
ic_material_light_secure_png_start[], ic_material_light_sdcard_dark_png_start[], ic_material_light_secure_dark_png_start[], ic_play_btn_png_start[],
ftp_icon_png_start[], sort_icon_png_start[], dark_theme_icon_png_start[], dev_options_icon_png_start[], about_icon_png_start[],
ftp_icon_dark_png_start[], sort_icon_dark_png_start[], dark_theme_icon_dark_png_start[], dev_options_icon_dark_png_start[], about_icon_dark_png_start[];
extern unsigned int ic_fso_type_app_png_size, ic_fso_type_compress_png_size, ic_fso_type_audio_png_size, ic_fso_folder_png_size,
ic_fso_folder_dark_png_size, ic_fso_default_png_size, ic_fso_type_image_png_size, ic_fso_type_text_png_size,
@ -30,16 +32,18 @@ extern unsigned int ic_fso_type_app_png_size, ic_fso_type_compress_png_size, ic_
default_artwork_png_size, default_artwork_blur_png_size, btn_playback_play_png_size, btn_playback_pause_png_size, btn_playback_rewind_png_size,
btn_playback_forward_png_size, btn_playback_repeat_png_size, btn_playback_shuffle_png_size, btn_playback_repeat_overlay_png_size,
btn_playback_shuffle_overlay_png_size, bg_header_png_size, ic_material_light_sdcard_png_size, ic_material_light_secure_png_size,
ic_material_light_sdcard_dark_png_size, ic_material_light_secure_dark_png_size, ic_play_btn_png_size;
ic_material_light_sdcard_dark_png_size, ic_material_light_secure_dark_png_size, ic_play_btn_png_size,
ftp_icon_png_size, sort_icon_png_size, dark_theme_icon_png_size, dev_options_icon_png_size, about_icon_png_size,
ftp_icon_dark_png_size, sort_icon_dark_png_size, dark_theme_icon_dark_png_size, dev_options_icon_dark_png_size, about_icon_dark_png_size;
g2dTexture *file_icons[NUM_ICONS], *icon_dir, *icon_dir_dark, *icon_check, *icon_check_dark, *icon_uncheck, \
*icon_uncheck_dark, *icon_toggle_on, *icon_toggle_dark_on, *icon_toggle_off, *icon_radio_off, \
*icon_radio_on, *icon_radio_dark_off, *icon_radio_dark_on, *icon_nav_drawer, *icon_back, \
*options_dialog, *options_dialog_dark, *properties_dialog, *properties_dialog_dark, *dialog, *dialog_dark, \
g2dTexture *file_icons[NUM_FILE_ICONS], *icon_dir[NUM_THEMES], *icon_check[NUM_THEMES], *icon_uncheck[NUM_THEMES], \
*icon_toggle_on[NUM_THEMES], *icon_toggle_off, *icon_radio_off[NUM_THEMES], *icon_radio_on[NUM_THEMES], *icon_nav_drawer, \
*icon_back, *options_dialog[NUM_THEMES], *properties_dialog[NUM_THEMES], *dialog[NUM_THEMES], \
*battery_charging[NUM_BATT_ICONS], *battery[NUM_BATT_ICONS], *usb_icon, \
*default_artwork, *default_artwork_blur, *btn_play, *btn_pause, *btn_rewind, *btn_forward, \
*btn_repeat, *btn_shuffle, *btn_repeat_overlay, *btn_shuffle_overlay, \
*bg_header, *icon_sd, *icon_secure, *icon_sd_dark, *icon_secure_dark, *ic_play_btn;
*bg_header, *icon_sd[NUM_THEMES], *icon_secure[NUM_THEMES], *ic_play_btn, *ftp_icon[NUM_THEMES], *sort_icon[NUM_THEMES], \
*dark_theme_icon[NUM_THEMES], *dev_options_icon[NUM_THEMES], *about_icon[NUM_THEMES];
namespace Textures {
void Load(void) {
@ -49,29 +53,29 @@ namespace Textures {
file_icons[3] = g2dTexLoadMemory(ic_fso_type_audio_png_start, ic_fso_type_audio_png_size, G2D_SWIZZLE);
file_icons[4] = g2dTexLoadMemory(ic_fso_type_image_png_start, ic_fso_type_image_png_size, G2D_SWIZZLE);
file_icons[5] = g2dTexLoadMemory(ic_fso_type_text_png_start, ic_fso_type_text_png_size, G2D_SWIZZLE);
icon_dir = g2dTexLoadMemory(ic_fso_folder_png_start, ic_fso_folder_png_size, G2D_SWIZZLE);
icon_dir_dark = g2dTexLoadMemory(ic_fso_folder_dark_png_start, ic_fso_folder_dark_png_size, G2D_SWIZZLE);
icon_check = g2dTexLoadMemory(btn_material_light_check_on_normal_png_start, btn_material_light_check_on_normal_png_size, G2D_SWIZZLE);
icon_check_dark = g2dTexLoadMemory(btn_material_light_check_on_normal_dark_png_start, btn_material_light_check_on_normal_dark_png_size, G2D_SWIZZLE);
icon_uncheck = g2dTexLoadMemory(btn_material_light_check_off_normal_png_start, btn_material_light_check_off_normal_png_size, G2D_SWIZZLE);
icon_uncheck_dark = g2dTexLoadMemory(btn_material_light_check_off_normal_dark_png_start, btn_material_light_check_off_normal_dark_png_size, G2D_SWIZZLE);
icon_toggle_on = g2dTexLoadMemory(btn_material_light_toggle_on_normal_png_start, btn_material_light_toggle_on_normal_png_size, G2D_SWIZZLE);
icon_toggle_dark_on = g2dTexLoadMemory(btn_material_light_toggle_on_normal_dark_png_start, btn_material_light_toggle_on_normal_dark_png_size, G2D_SWIZZLE);
icon_dir[0] = g2dTexLoadMemory(ic_fso_folder_png_start, ic_fso_folder_png_size, G2D_SWIZZLE);
icon_dir[1] = g2dTexLoadMemory(ic_fso_folder_dark_png_start, ic_fso_folder_dark_png_size, G2D_SWIZZLE);
icon_check[0] = g2dTexLoadMemory(btn_material_light_check_on_normal_png_start, btn_material_light_check_on_normal_png_size, G2D_SWIZZLE);
icon_check[1] = g2dTexLoadMemory(btn_material_light_check_on_normal_dark_png_start, btn_material_light_check_on_normal_dark_png_size, G2D_SWIZZLE);
icon_uncheck[0] = g2dTexLoadMemory(btn_material_light_check_off_normal_png_start, btn_material_light_check_off_normal_png_size, G2D_SWIZZLE);
icon_uncheck[1] = g2dTexLoadMemory(btn_material_light_check_off_normal_dark_png_start, btn_material_light_check_off_normal_dark_png_size, G2D_SWIZZLE);
icon_toggle_on[0] = g2dTexLoadMemory(btn_material_light_toggle_on_normal_png_start, btn_material_light_toggle_on_normal_png_size, G2D_SWIZZLE);
icon_toggle_on[1] = g2dTexLoadMemory(btn_material_light_toggle_on_normal_dark_png_start, btn_material_light_toggle_on_normal_dark_png_size, G2D_SWIZZLE);
icon_toggle_off = g2dTexLoadMemory(btn_material_light_toggle_off_normal_png_start, btn_material_light_toggle_off_normal_png_size, G2D_SWIZZLE);
icon_radio_off = g2dTexLoadMemory(btn_material_light_radio_off_normal_png_start, btn_material_light_radio_off_normal_png_size, G2D_SWIZZLE);
icon_radio_on = g2dTexLoadMemory(btn_material_light_radio_on_normal_png_start, btn_material_light_radio_on_normal_png_size, G2D_SWIZZLE);
icon_radio_dark_off = g2dTexLoadMemory(btn_material_light_radio_off_normal_dark_png_start, btn_material_light_radio_off_normal_dark_png_size, G2D_SWIZZLE);
icon_radio_dark_on = g2dTexLoadMemory(btn_material_light_radio_on_normal_dark_png_start, btn_material_light_radio_on_normal_dark_png_size, G2D_SWIZZLE);
icon_radio_off[0] = g2dTexLoadMemory(btn_material_light_radio_off_normal_png_start, btn_material_light_radio_off_normal_png_size, G2D_SWIZZLE);
icon_radio_off[1] = g2dTexLoadMemory(btn_material_light_radio_off_normal_dark_png_start, btn_material_light_radio_off_normal_dark_png_size, G2D_SWIZZLE);
icon_radio_on[0] = g2dTexLoadMemory(btn_material_light_radio_on_normal_png_start, btn_material_light_radio_on_normal_png_size, G2D_SWIZZLE);
icon_radio_on[1] = g2dTexLoadMemory(btn_material_light_radio_on_normal_dark_png_start, btn_material_light_radio_on_normal_dark_png_size, G2D_SWIZZLE);
icon_nav_drawer = g2dTexLoadMemory(ic_material_light_navigation_drawer_png_start, ic_material_light_navigation_drawer_png_size, G2D_SWIZZLE);
icon_back = g2dTexLoadMemory(ic_arrow_back_normal_png_start, ic_arrow_back_normal_png_size, G2D_SWIZZLE);
options_dialog = g2dTexLoadMemory(ic_material_options_dialog_png_start, ic_material_options_dialog_png_size, G2D_SWIZZLE);
options_dialog_dark = g2dTexLoadMemory(ic_material_options_dialog_dark_png_start, ic_material_options_dialog_dark_png_size, G2D_SWIZZLE);
properties_dialog = g2dTexLoadMemory(ic_material_properties_dialog_png_start, ic_material_properties_dialog_png_size, G2D_SWIZZLE);
properties_dialog_dark = g2dTexLoadMemory(ic_material_properties_dialog_dark_png_start, ic_material_properties_dialog_dark_png_size, G2D_SWIZZLE);
dialog = g2dTexLoadMemory(ic_material_dialog_png_start, ic_material_dialog_png_size, G2D_SWIZZLE);
dialog_dark = g2dTexLoadMemory(ic_material_dialog_dark_png_start, ic_material_dialog_dark_png_size, G2D_SWIZZLE);
options_dialog[0] = g2dTexLoadMemory(ic_material_options_dialog_png_start, ic_material_options_dialog_png_size, G2D_SWIZZLE);
options_dialog[1] = g2dTexLoadMemory(ic_material_options_dialog_dark_png_start, ic_material_options_dialog_dark_png_size, G2D_SWIZZLE);
properties_dialog[0] = g2dTexLoadMemory(ic_material_properties_dialog_png_start, ic_material_properties_dialog_png_size, G2D_SWIZZLE);
properties_dialog[1] = g2dTexLoadMemory(ic_material_properties_dialog_dark_png_start, ic_material_properties_dialog_dark_png_size, G2D_SWIZZLE);
dialog[0] = g2dTexLoadMemory(ic_material_dialog_png_start, ic_material_dialog_png_size, G2D_SWIZZLE);
dialog[1] = g2dTexLoadMemory(ic_material_dialog_dark_png_start, ic_material_dialog_dark_png_size, G2D_SWIZZLE);
battery_charging[0] = g2dTexLoadMemory(battery_20_charging_png_start, battery_20_charging_png_size, G2D_SWIZZLE);
battery_charging[1] = g2dTexLoadMemory(battery_30_charging_png_start, battery_30_charging_png_size, G2D_SWIZZLE);
battery_charging[2] = g2dTexLoadMemory(battery_50_charging_png_start, battery_50_charging_png_size, G2D_SWIZZLE);
@ -87,6 +91,7 @@ namespace Textures {
battery[5] = g2dTexLoadMemory(battery_full_png_start, battery_full_png_size, G2D_SWIZZLE);
usb_icon = g2dTexLoadMemory(ic_material_light_usb_png_start, ic_material_light_usb_png_size, G2D_SWIZZLE);
default_artwork = g2dTexLoadMemory(default_artwork_png_start, default_artwork_png_size, G2D_SWIZZLE);
default_artwork_blur = g2dTexLoadMemory(default_artwork_blur_png_start, default_artwork_blur_png_size, G2D_SWIZZLE);
btn_play = g2dTexLoadMemory(btn_playback_play_png_start, btn_playback_play_png_size, G2D_SWIZZLE);
@ -97,20 +102,28 @@ namespace Textures {
btn_shuffle = g2dTexLoadMemory(btn_playback_shuffle_png_start, btn_playback_shuffle_png_size, G2D_SWIZZLE);
btn_repeat_overlay = g2dTexLoadMemory(btn_playback_repeat_overlay_png_start, btn_playback_repeat_overlay_png_size, G2D_SWIZZLE);
btn_shuffle_overlay = g2dTexLoadMemory(btn_playback_shuffle_overlay_png_start, btn_playback_shuffle_overlay_png_size, G2D_SWIZZLE);
bg_header = g2dTexLoadMemory(bg_header_png_start, bg_header_png_size, G2D_SWIZZLE);
icon_sd = g2dTexLoadMemory(ic_material_light_sdcard_png_start, ic_material_light_sdcard_png_size, G2D_SWIZZLE);
icon_secure = g2dTexLoadMemory(ic_material_light_secure_png_start, ic_material_light_secure_png_size, G2D_SWIZZLE);
icon_sd_dark = g2dTexLoadMemory(ic_material_light_sdcard_dark_png_start, ic_material_light_sdcard_dark_png_size, G2D_SWIZZLE);
icon_secure_dark = g2dTexLoadMemory(ic_material_light_secure_dark_png_start, ic_material_light_secure_dark_png_size, G2D_SWIZZLE);
icon_sd[0] = g2dTexLoadMemory(ic_material_light_sdcard_png_start, ic_material_light_sdcard_png_size, G2D_SWIZZLE);
icon_sd[1] = g2dTexLoadMemory(ic_material_light_sdcard_dark_png_start, ic_material_light_sdcard_dark_png_size, G2D_SWIZZLE);
icon_secure[0] = g2dTexLoadMemory(ic_material_light_secure_png_start, ic_material_light_secure_png_size, G2D_SWIZZLE);
icon_secure[1] = g2dTexLoadMemory(ic_material_light_secure_dark_png_start, ic_material_light_secure_dark_png_size, G2D_SWIZZLE);
ic_play_btn = g2dTexLoadMemory(ic_play_btn_png_start, ic_play_btn_png_size, G2D_SWIZZLE);
ftp_icon[0] = g2dTexLoadMemory(ftp_icon_png_start, ftp_icon_png_size, G2D_SWIZZLE);
ftp_icon[1] = g2dTexLoadMemory(ftp_icon_dark_png_start, ftp_icon_dark_png_size, G2D_SWIZZLE);
sort_icon[0] = g2dTexLoadMemory(sort_icon_png_start, sort_icon_png_size, G2D_SWIZZLE);
sort_icon[1] = g2dTexLoadMemory(sort_icon_dark_png_start, sort_icon_dark_png_size, G2D_SWIZZLE);
dark_theme_icon[0] = g2dTexLoadMemory(dark_theme_icon_png_start, dark_theme_icon_png_size, G2D_SWIZZLE);
dark_theme_icon[1] = g2dTexLoadMemory(dark_theme_icon_dark_png_start, dark_theme_icon_dark_png_size, G2D_SWIZZLE);
dev_options_icon[0] = g2dTexLoadMemory(dev_options_icon_png_start, dev_options_icon_png_size, G2D_SWIZZLE);
dev_options_icon[1] = g2dTexLoadMemory(dev_options_icon_dark_png_start, dev_options_icon_dark_png_size, G2D_SWIZZLE);
about_icon[0] = g2dTexLoadMemory(about_icon_png_start, about_icon_png_size, G2D_SWIZZLE);
about_icon[1] = g2dTexLoadMemory(about_icon_dark_png_start, about_icon_dark_png_size, G2D_SWIZZLE);
}
void Free(void) {
g2dTexFree(&ic_play_btn);
g2dTexFree(&icon_secure_dark);
g2dTexFree(&icon_sd_dark);
g2dTexFree(&icon_secure);
g2dTexFree(&icon_sd);
g2dTexFree(&bg_header);
g2dTexFree(&btn_shuffle_overlay);
g2dTexFree(&btn_repeat_overlay);
@ -123,29 +136,29 @@ namespace Textures {
g2dTexFree(&default_artwork_blur);
g2dTexFree(&default_artwork);
g2dTexFree(&usb_icon);
g2dTexFree(&dialog_dark);
g2dTexFree(&dialog);
g2dTexFree(&properties_dialog_dark);
g2dTexFree(&properties_dialog);
g2dTexFree(&options_dialog_dark);
g2dTexFree(&options_dialog);
g2dTexFree(&icon_back);
g2dTexFree(&icon_nav_drawer);
g2dTexFree(&icon_radio_dark_on);
g2dTexFree(&icon_radio_dark_off);
g2dTexFree(&icon_radio_on);
g2dTexFree(&icon_radio_off);
g2dTexFree(&icon_toggle_off);
g2dTexFree(&icon_toggle_dark_on);
g2dTexFree(&icon_toggle_on);
g2dTexFree(&icon_uncheck_dark);
g2dTexFree(&icon_uncheck);
g2dTexFree(&icon_check_dark);
g2dTexFree(&icon_check);
g2dTexFree(&icon_dir_dark);
g2dTexFree(&icon_dir);
for (int i = 0; i < NUM_THEMES; i++) {
g2dTexFree(&about_icon[i]);
g2dTexFree(&dev_options_icon[i]);
g2dTexFree(&sort_icon[i]);
g2dTexFree(&ftp_icon[i]);
g2dTexFree(&icon_secure[i]);
g2dTexFree(&icon_sd[i]);
g2dTexFree(&dialog[i]);
g2dTexFree(&properties_dialog[i]);
g2dTexFree(&options_dialog[i]);
g2dTexFree(&icon_radio_on[i]);
g2dTexFree(&icon_radio_off[i]);
g2dTexFree(&icon_toggle_on[i]);
g2dTexFree(&icon_uncheck[i]);
g2dTexFree(&icon_check[i]);
g2dTexFree(&icon_dir[i]);
}
for (int i = 0; i < NUM_ICONS; i++)
for (int i = 0; i < NUM_FILE_ICONS; i++)
g2dTexFree(&file_icons[i]);
for (int i = 0; i < NUM_BATT_ICONS; i++) {