summaryrefslogtreecommitdiffstats
path: root/gui/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/gui.cpp')
-rw-r--r--gui/gui.cpp117
1 files changed, 8 insertions, 109 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp
index d99764aea..7cf21b0a0 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -62,15 +62,11 @@ extern "C"
#define LOGEVENT(...) do {} while (0)
#endif
-const static int CURTAIN_FADE = 32;
-
using namespace rapidxml;
// Global values
-static gr_surface gCurtain = NULL;
static int gGuiInitialized = 0;
static TWAtomicInt gForceRender;
-const int gNoAnimation = 1;
blanktimer blankTimer;
int ors_read_fd = -1;
static FILE* orsout = NULL;
@@ -107,80 +103,6 @@ void rapidxml::parse_error_handler(const char *what, void *where)
//abort();
}
-static void curtainSet()
-{
- gr_color(0, 0, 0, 255);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), TW_X_OFFSET, TW_Y_OFFSET);
- gr_flip();
-}
-
-static void curtainRaise(gr_surface surface)
-{
- int sy = 0;
- int h = gr_get_height(gCurtain) - 1;
- int w = gr_get_width(gCurtain);
- int fy = 1;
-
- int msw = gr_get_width(surface);
- int msh = gr_get_height(surface);
- int CURTAIN_RATE = msh / 30;
-
- if (gNoAnimation == 0)
- {
- for (; h > 0; h -= CURTAIN_RATE, sy += CURTAIN_RATE, fy += CURTAIN_RATE)
- {
- gr_blit(surface, 0, 0, msw, msh, 0, 0);
- gr_blit(gCurtain, 0, sy, w, h, 0, 0);
- gr_flip();
- }
- }
- gr_blit(surface, 0, 0, msw, msh, 0, 0);
- flip();
-}
-
-void curtainClose()
-{
-#if 0
- int w = gr_get_width(gCurtain);
- int h = 1;
- int sy = gr_get_height(gCurtain) - 1;
- int fbh = gr_fb_height();
- int CURTAIN_RATE = fbh / 30;
-
- if (gNoAnimation == 0)
- {
- for (; h < fbh; h += CURTAIN_RATE, sy -= CURTAIN_RATE)
- {
- gr_blit(gCurtain, 0, sy, w, h, 0, 0);
- gr_flip();
- }
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain),
- gr_get_height(gCurtain), 0, 0);
- gr_flip();
-
- if (gRecorder != -1)
- close(gRecorder);
-
- int fade;
- for (fade = 16; fade < 255; fade += CURTAIN_FADE)
- {
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain),
- gr_get_height(gCurtain), 0, 0);
- gr_color(0, 0, 0, fade);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_flip();
- }
- gr_color(0, 0, 0, 255);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_flip();
- }
-#else
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), 0, 0);
- gr_flip();
-#endif
-}
-
class InputHandler
{
public:
@@ -618,17 +540,6 @@ static int runPages(const char *page_name, const int stop_on_page_done)
gui_changePage(page_name);
}
- // Raise the curtain
- if (gCurtain != NULL)
- {
- gr_surface surface;
-
- PageManager::Render();
- gr_get_surface(&surface);
- curtainRaise(surface);
- gr_free_surface(surface);
- }
-
gGuiRunning = 1;
DataManager::SetValue("tw_loaded", 1);
@@ -822,30 +733,18 @@ std::string gui_lookup(const std::string& resource_name, const std::string& defa
extern "C" int gui_init(void)
{
gr_init();
- std::string curtain_path = TWRES "images/curtain.jpg";
- gr_surface source_Surface = NULL;
- if (res_create_surface(curtain_path.c_str(), &source_Surface))
- {
- printf("Unable to locate '%s'\nDid you set a TW_THEME in your config files?\n", curtain_path.c_str());
- return -1;
+ // load and show splash screen
+ if (PageManager::LoadPackage("splash", TWRES "splash.xml", "splash")) {
+ LOGERR("Failed to load splash screen XML.\n");
}
- if (gr_get_width(source_Surface) != (unsigned)gr_fb_width() || gr_get_height(source_Surface) != (unsigned)gr_fb_height()) {
- // We need to scale the curtain to fit the screen
- float scale_w = (float)gr_fb_width() / (float)gr_get_width(source_Surface);
- float scale_h = (float)gr_fb_height() / (float)gr_get_height(source_Surface);
- if (res_scale_surface(source_Surface, &gCurtain, scale_w, scale_h)) {
- LOGINFO("Failed to scale curtain\n");
- gCurtain = source_Surface;
- } else {
- LOGINFO("Scaling the curtain width %fx and height %fx\n", scale_w, scale_h);
- }
- } else {
- gCurtain = source_Surface;
+ else {
+ PageManager::SelectPackage("splash");
+ PageManager::Render();
+ flip();
+ PageManager::ReleasePackage("splash");
}
- curtainSet();
-
ev_init();
return 0;
}