Right, right, merge this first.

This commit is contained in:
Jason Felds
2011-06-12 03:09:11 -04:00
6 changed files with 57 additions and 10 deletions
@@ -10,7 +10,7 @@
#BACKGROUND:;
#LYRICSPATH:;
#CDTITLE:;
#MUSIC:ScreenGameplaySyncMachine music.ogg;
#MUSIC:_sync music.ogg;
#OFFSET:-0.012;
#SAMPLESTART:0.000;
#SAMPLELENGTH:12.000;
+21 -6
View File
@@ -114,17 +114,32 @@ function Actor:FullScreen()
end
--[[ Typical background sizes:
320x240 - DDR 1st-Extreme, most NVLM_ZK songs
640x480 - most simfiles in distribution today are this big.
768x480 - 16:10 aspect ratio backgrounds
854x480 - pump it up pro
320x240 - [4:3]
640x480 - [4:3] (most simfiles in distribution today use this res.)
768x480 - [16:10]
854x480 - [16:9]
]]
-- "Most backgrounds are 640x480. Some are 768x480. Stretch the 4:3 ones."
function Actor:scale_or_crop_background()
if (self:GetWidth() * 3) / 4 == self:GetHeight() then
local gw = self:GetWidth()
local gh = self:GetHeight()
local graphicAspect = gw/gh
local displayAspect = DISPLAY:GetDisplayWidth()/DISPLAY:GetDisplayHeight()
if graphicAspect == displayAspect then
-- bga matches the current aspect, we can stretch it.
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
else
-- temp
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
--[[
-- bga doesn't match the aspect.
if displayAspect > graphicAspect then
-- the graphic is smaller than the display aspect ratio
else
-- the graphic is bigger than the display aspect ratio; crop me
end
--]]
end
end
+14 -3
View File
@@ -11,6 +11,8 @@ static void *Handle = NULL;
static INIT Module_Init;
static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText;
static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate;
LoadingWindow_Gtk::LoadingWindow_Gtk()
{
@@ -33,6 +35,12 @@ RString LoadingWindow_Gtk::Init()
Module_SetText = (SETTEXT) dlsym(Handle, "SetText");
if( !Module_SetText )
return "Couldn't load symbol Module_SetText";
Module_SetProgress = (SETPROGRESS) dlsym(Handle, "SetProgress");
if( !Module_SetProgress )
return "Couldn't load symbol Module_SetProgress";
Module_SetIndeterminate = (SETINDETERMINATE) dlsym(Handle, "SetIndeterminate");
if( !Module_SetIndeterminate )
return "Couldn't load symbol Module_SetIndeterminate";
const char *ret = Module_Init( &g_argc, &g_argv );
if( ret != NULL )
@@ -58,17 +66,20 @@ void LoadingWindow_Gtk::SetText( RString s )
void LoadingWindow_Gtk::SetProgress( const int progress )
{
; // stub, needs to be finished.
LoadingWindow::SetProgress( progress );
Module_SetProgress( m_progress, m_totalWork );
}
void LoadingWindow_Gtk::SetTotalWork( const int totalWork )
{
; // stub, needs to be finished.
LoadingWindow::SetTotalWork( totalWork );
Module_SetProgress( m_progress, m_totalWork );
}
void LoadingWindow_Gtk::SetIndeterminate( bool indeterminate )
{
; // stub, needs to be finished.
LoadingWindow::SetIndeterminate( indeterminate );
Module_SetIndeterminate( m_indeterminate );
}
/*
@@ -5,6 +5,7 @@
static GtkWidget *label;
static GtkWidget *window;
static GtkWidget *progressBar;
extern "C" const char *Init( int *argc, char ***argv )
{
@@ -22,9 +23,12 @@ extern "C" const char *Init( int *argc, char ***argv )
loadimage = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,5);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_box_pack_start(GTK_BOX(vbox),loadimage,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(vbox),progressBar,TRUE,TRUE,0);
gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0);
gtk_widget_show_all(window);
@@ -47,6 +51,21 @@ extern "C" void SetText( const char *s )
gtk_main_iteration_do(FALSE);
}
extern "C" void SetProgress( int progress, int totalWork )
{
gdouble fraction = ( totalWork > 0 ? progress / (gdouble)totalWork : 0 );
if( fraction > 1.0 ) fraction = 1.0;
if( fraction < 0.0 ) fraction = 0.0;
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), fraction );
gtk_main_iteration_do(FALSE);
}
extern "C" void SetIndeterminate( bool indeterminate )
{
// TODO: Implement this!
gtk_main_iteration_do(FALSE);
}
/*
* (c) 2003-2004 Glenn Maynard, Sean Burke
* All rights reserved.
@@ -4,6 +4,8 @@
typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s );
typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate );
#endif