Game Development Community

SplashScreen Problem

by Temasek Polytechnic (#0001) · in Torque X 2D · 02/25/2008 (12:01 am) · 3 replies

Hi, i want to create a splashscreen using the PlatformerDemo. I followed through the tutorial from this url http://tdn.garagegames.com/wiki/TorqueX/SplashScreen#Creating_the_Splash_Screen but i encounter problems such as "cannot implicitly convert type 'Microsoft.Xna.Framework.Vector2' to 'GarageGames.Torque.MathUtil.SizeF' and The name PlatfomerStarter' does not exist in the current context'. Im not sure what it means.Could anyone help??

//SplashScreen.cs
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
//using PointF = Microsoft.Xna.Framework.Vector2;
using GarageGames.Torque.Platform;
using GarageGames.Torque.Core;
using GarageGames.Torque.Sim;
using GarageGames.Torque.GUI;
using GarageGames.Torque.MathUtil;
using GarageGames.Torque.T2D;

namespace GarageGames.Torque.PlatformerDemo
{
class SplashScreen : GUISplash, IGUIScreen
{
//======================================================
#region Constructors

public SplashScreen()
{
// create the Style for our splash ad
GUISplashStyle splashStyle = new GUISplashStyle();
splashStyle.FadeInSec = 2; // black to image 2 seconds
splashStyle.FadeOutSec = 2; // image to black 2 seconds
splashStyle.FadeWaitSec = 4; // still image for 4 seconds
splashStyle.Bitmap = @"data\images\nice";
splashStyle.PreserveAspectRatio = true;
//splashStyle.Anchor = AnchorFlags.All;

// set some info for this control
Name = "SplashScreen";
Style = splashStyle;
Size = new Vector2(800, 600); // Changed System.Drawing.SizeF to Microsoft.Xna.Vector2
OnFadeFinished = OnSplashFinished;

// create a black letterbox
// only visible on widescreen displays
GUIStyle lbStyle = new GUIStyle();
lbStyle.IsOpaque = true;
lbStyle.FillColor = Color.Black;

GUIControl letterbox = new GUIControl();
letterbox.Style = lbStyle;
GUICanvas.Instance.LetterBoxControl = letterbox;
}

#endregion

//======================================================
#region Public methods

///
/// Callback from the Splashscreen when the splash has finished fading.
///

public void OnSplashFinished()
{
//SceneLoader.Load(@"data\levels\my_level_26.txscene");
PlatformerStarter.Game.Instance.SceneLoader.Load(@"data\levels\my_level_26.txscene");
GUIStyle playStyle = new GUIStyle();
GUISceneview play = new GUISceneview();
play.Name = "PlayScreen";
play.Style = playStyle;

GUICanvas.Instance.SetContentControl(play);
PlatformerDemoGUI.Instance.GUI.Folder = GUICanvas.Instance;
}

#endregion

}
}

#1
02/25/2008 (12:04 am)
---------------------------------------------------------------------------------------------------------------
//Game.cs

protected override void BeginRun()
{
base.BeginRun();

// go to splash screen
GUIUtil.InitGUIScreens("Starter.UI");
GUIStyle splashStyle = new GUIStyle();
GUISceneview splash = new GUISceneview();
splash.Style = splashStyle;
GUICanvas.Instance.SetContentControl("SplashScreen");

// load the test level
SceneLoader.Load(@"data\levels\my_level_26.txscene");
// set the parallax manager's target object
T2DSceneCamera camera = T2DSceneGraph.Instance.Camera as T2DSceneCamera;
ParallaxManager.Instance.ParallaxTarget = camera;

// create game gui
GUIStyle playStyle = new GUIStyle();
GUISceneview play = new GUISceneview();
play.Name = "PlayScreen";
play.Style = playStyle;

GUICanvas.Instance.SetContentControl(play);
PlatformerDemoGUI.Instance.GUI.Folder = GUICanvas.Instance;

// register sound groups
SoundManager.Instance.RegisterSoundGroup(@"data\sound\music");
SoundManager.Instance.RegisterSoundGroup(@"data\sound\general");
SoundManager.Instance.RegisterSoundGroup(@"data\sound\drill");
SoundManager.Instance.RegisterSoundGroup(@"data\sound\dragon_dirt.xsb", @"data\sound\dragon.xwb");
SoundManager.Instance.RegisterSoundGroup(@"data\sound\dragon_grass.xsb", @"data\sound\dragon.xwb");
SoundManager.Instance.RegisterSoundGroup(@"data\sound\dragon_wood.xsb", @"data\sound\dragon.xwb");

// grab the sound categories
_soundEffectsCategory = Engine.SFXDevice.GetCategory("Default");
_musicCategory = Engine.SFXDevice.GetCategory("Music");

// game start
_gameStart = Time;

// start music loop
_indoorMusic = "indoor_music";
_outdoorMusic = "outdoor_music";
_levelCompletedMusic = "finish_level";
_musicCueName = _outdoorMusic;
_musicSoundGroup = @"data\sound\music";
_music = SoundManager.Instance.PlaySound(_musicSoundGroup, _outdoorMusic);

// play the dragon's startup sound for the first time
SoundManager.Instance.PlaySound(@"data\sound\dragon_grass.xsb", "startup");
}

#endregion



//======================================================
#region Private, protected, internal fields

Random _random;
float totalTime;
float _gameStart;
bool _gameIsOver = false;
bool _gameEnter = false;
List _players = new List();

Cue _music;
string _musicSoundGroup;
string _musicCueName;
string _outdoorMusic;
string _indoorMusic;
string _levelCompletedMusic;
AudioCategory _soundEffectsCategory;
AudioCategory _musicCategory;

#endregion
}
}
#2
02/25/2008 (12:43 am)
Its alrite, I figured it out.
#3
03/10/2008 (9:33 pm)
How did you figure this out? I'm still getting the "The name PlatfomerStarter' does not exist in the current context" error from the Splashscreen.cs