previews overhaul (#13)
* allow quitting if there are no themes or splashes * load preview only once if the user toggles more than once
This commit is contained in:
@@ -38,6 +38,7 @@ typedef struct {
|
|||||||
ssize_t icon_id;
|
ssize_t icon_id;
|
||||||
|
|
||||||
bool has_preview;
|
bool has_preview;
|
||||||
|
int preview_offset;
|
||||||
|
|
||||||
u16 path[0x106];
|
u16 path[0x106];
|
||||||
bool is_zip;
|
bool is_zip;
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ void draw_theme_interface(Theme_s * themes_list, int theme_count, int selected_t
|
|||||||
if (current_theme.has_preview)
|
if (current_theme.has_preview)
|
||||||
{
|
{
|
||||||
pp2d_begin_draw(GFX_TOP);
|
pp2d_begin_draw(GFX_TOP);
|
||||||
pp2d_draw_texture_part(TEXTURE_PREVIEW, 0, 0, 6, 0, 400, 240);
|
pp2d_draw_texture_part(TEXTURE_PREVIEW, 0, 0, preview_offset, 0, 400, 240);
|
||||||
pp2d_draw_on(GFX_BOTTOM);
|
pp2d_draw_on(GFX_BOTTOM);
|
||||||
pp2d_draw_texture_part(TEXTURE_PREVIEW, 0, 0, 46, 240, 320, 240);
|
pp2d_draw_texture_part(TEXTURE_PREVIEW, 0, 0, 40+preview_offset, 240, 320, 240);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ int main(void)
|
|||||||
bool splash_mode = false;
|
bool splash_mode = false;
|
||||||
int selected_splash = 0;
|
int selected_splash = 0;
|
||||||
int selected_theme = 0;
|
int selected_theme = 0;
|
||||||
|
int previously_selected = 0;
|
||||||
int shuffle_theme_count = 0;
|
int shuffle_theme_count = 0;
|
||||||
bool preview_mode = false;
|
bool preview_mode = false;
|
||||||
|
|
||||||
@@ -83,6 +84,14 @@ int main(void)
|
|||||||
if (!splash_mode) draw_theme_interface(themes_list, theme_count, selected_theme, preview_mode);
|
if (!splash_mode) draw_theme_interface(themes_list, theme_count, selected_theme, preview_mode);
|
||||||
else draw_splash_interface(splashes_list, splash_count, selected_splash, preview_mode);
|
else draw_splash_interface(splashes_list, splash_count, selected_splash, preview_mode);
|
||||||
|
|
||||||
|
if (kDown & KEY_START)
|
||||||
|
{
|
||||||
|
exit_screens();
|
||||||
|
exit_services();
|
||||||
|
PTMSYSM_RebootAsync(0);
|
||||||
|
ptmSysmExit();
|
||||||
|
}
|
||||||
|
|
||||||
if (themes_list == NULL && !splash_mode)
|
if (themes_list == NULL && !splash_mode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -96,11 +105,10 @@ int main(void)
|
|||||||
{
|
{
|
||||||
if (!preview_mode)
|
if (!preview_mode)
|
||||||
{
|
{
|
||||||
|
if (!current_theme->has_preview)
|
||||||
load_theme_preview(current_theme);
|
load_theme_preview(current_theme);
|
||||||
if (current_theme->has_preview)
|
|
||||||
{
|
preview_mode = current_theme->has_preview;
|
||||||
preview_mode = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
preview_mode = false;
|
preview_mode = false;
|
||||||
@@ -203,12 +211,10 @@ int main(void)
|
|||||||
else selected_theme = theme_count-1;
|
else selected_theme = theme_count-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kDown & KEY_START)
|
if (!splash_mode && selected_theme != previously_selected)
|
||||||
{
|
{
|
||||||
exit_screens();
|
current_theme->has_preview = false;
|
||||||
exit_services();
|
previously_selected = selected_theme;
|
||||||
PTMSYSM_RebootAsync(0);
|
|
||||||
ptmSysmExit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ void load_theme_preview(Theme_s *theme)
|
|||||||
|
|
||||||
theme->has_preview = true;
|
theme->has_preview = true;
|
||||||
pp2d_load_texture_memory(TEXTURE_PREVIEW, image, (u32)width, (u32)height);
|
pp2d_load_texture_memory(TEXTURE_PREVIEW, image, (u32)width, (u32)height);
|
||||||
|
theme->preview_offset = (width-400)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(image);
|
free(image);
|
||||||
|
|||||||
Reference in New Issue
Block a user