GUI/SplashScreens

From TDN

Introduction

This enables you to play music at startup as well as have as many startup logos as you want

Code

Startgui.gui

//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
	profile = "GuiInputCtrlProfile";
	horizSizing = "right";
	vertSizing = "bottom";
	position = "0 0";
	extent = "640 480";
	minExtent = "8 8";
	visible = "1";
	helpTag = "0";
	bitmap = "";
	wrap = "0";
	fadeinTime = "1000";
	waitTime   = "3000";
	fadeoutTime = "1000";
};

new GuiFadeinBitmapCtrl(BlankGui) {
	profile = "GuiInputCtrlProfile";
	horizSizing = "right";
	vertSizing = "bottom";
	position = "0 0";
	extent = "640 480";
	minExtent = "8 8";
	visible = "1";
	helpTag = "0";
	bitmap = "";
	wrap = "0";
	fadeinTime = "1000";
	waitTime   = "2000";
	fadeoutTime = "1000";
};
//--- OBJECT WRITE END ---	

Note: "startgui.cs" will need to be added to the "./client/scripts/" directory. Add

exec("./scripts/startgui.cs");

to the "./client/init.cs"


startgui.cs

//--- OBJECT WRITE BEGIN ---

function loadStartup()
{
	$StartupIdx=0;
	StartupGui::next();
   schedule(100, 0, checkStartupDone );
   alxPlay(menumusic);
}

//-------------------------------------
function StartupGui::click()
{
	StartupGui.done=true;
   checkStartupDone();
}

//-------------------------------------
function StartupGui::next()
{
	Canvas.setContent( BlankGui );
		
	$StartupIdx++;
	
	%bitmap[1] = "GarageGames.jpg";
	%bitmap[2] = "";
	%bitmap[3] = "";

    StartupGui.setBitmap("starter.fps/client/ui/" @ %bitmap[$StartupIdx]);
	StartupGui.done=false;
	Canvas.setContent( StartupGui );

}

//-------------------------------------
function checkStartupDone()
{
   if (!isObject(StartupGui))
      return;
      
   if (StartupGui.done)
		if ($StartupIdx==3)
		{
         StartupGui.done=1;
         StartupGui.delete();
         BlankGui.delete();
         flushTextureCache(); // dont wanna keep the startup logos in vram
         loadMainMenu();
         alxstop(menumusic);
		} else {			
			StartupGui::next();
			schedule(100, 0, checkStartupDone );
		}
   else
      schedule(100, 0, checkStartupDone );
}

//--- OBJECT WRITE END ---

Ideas

-> Use Theora for movie startup logos