Skip to content

Instantly share code, notes, and snippets.

@davepermen
Created January 6, 2014 10:09
Show Gist options
  • Select an option

  • Save davepermen/8280699 to your computer and use it in GitHub Desktop.

Select an option

Save davepermen/8280699 to your computer and use it in GitHub Desktop.
class StartScreen : Scene<EmptyModel>
{
public StartScreen()
{
var mesh = Helpers.StreamLoader<Mesh>.Load(Environment.CurrentDirectory + "/schiff V37.faroffmesh", file => file.Load());
var timer = new Timer();
var start = new Vector3(0, 10, 30);
var position = start;
Update = timeSpan =>
{
if (Keyboard.On[Portable.Keys.Space] || timer.Update(timeSpan).TotalSeconds > 2)
{
Switcher.Show(new TitleScreen(), false);
}
if (Keyboard.On[Portable.Keys.Escape])
{
Switcher.Leave();
}
var r = -10 * Math.PI * (timer.Now.TotalSeconds + 30) / 180;
position.X = (float)Math.Sin(r) * start.X + (float)Math.Cos(r) * start.Z;
position.Z = (float)Math.Cos(r) * start.X - (float)Math.Sin(r) * start.Z;
};
View = () => new View
{
Content = "\n\n\n Conesoft\n presents\n ...",
Background = Colors.DarkOliveGreen,
Fog = true,
Mesh = mesh,
Camera = new Camera
{
Target = Vector3.Zero,
Up = Vector3.Up,
Position = position,
FieldOfView = 45
}
};
}
}
class BlackScene : Scene<EmptyModel>
{
public BlackScene()
{
View = () => new View
{
Background = Colors.Black
};
}
}
class Bootstrapper
{
public Bootstrapper(ISetup setup)
{
setup.EmptyScene = new BlackScene();
setup.FirstScene = new StartScreen();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment