Tuesday, June 5, 2007

XNA - Boo

Voci un exemple pour Boo, adapté de C# par Cédric Vidier.

Voci un exemple pour Boo, adapté de C# par Cédric Vidier.


namespace SimpleExample

import System
import System.Collections.Generic
import Microsoft.Xna.Framework
import Microsoft.Xna.Framework.Audio
import Microsoft.Xna.Framework.Content
import Microsoft.Xna.Framework.Graphics
import Microsoft.Xna.Framework.Input
import Microsoft.Xna.Framework.Storage


///
/// When run, you'll see an empty blue screen. This code can
/// be run in both Mono.Xna and Microsoft XNA without changing
/// any code.
///

class SimpleExampleGame(Microsoft.Xna.Framework.Game):
graphics as GraphicsDeviceManager
content as ContentManager

def constructor():
graphics = GraphicsDeviceManager(self)
content = ContentManager(Services)


/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.

protected override def Initialize():
// TODO: Add your initialization logic here
super()


/// Load your graphics content. If loadAllContent is true, you should
/// load content from both ResourceManagementMode pools. Otherwise, just
/// load ResourceManagementMode.Manual content.

/// Which type of content to load.
protected override def LoadGraphicsContent(loadAllContent as bool):
if loadAllContent:
// TODO: Load any ResourceManagementMode.Automatic content
pass
// TODO: Load any ResourceManagementMode.Manual content


/// Unload your graphics content. If unloadAllContent is true, you should
/// unload content from both ResourceManagementMode pools. Otherwise, just
/// unload ResourceManagementMode.Manual content. Manual content will get
/// Disposed by the GraphicsDevice during a Reset.

/// Which type of content to unload.
protected override def UnloadGraphicsContent(unloadAllContent as bool):
if unloadAllContent:
content.Unload()


/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input and playing audio.

/// Provides a snapshot of timing values.
protected override def Update(gameTime as GameTime):
// Allows the default game to exit on Xbox 360 and Windows
if GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed:
Exit()

// TODO: Add your update logic here
super(gameTime)


/// This is called when the game should draw itself.

/// Provides a snapshot of timing values.
protected override def Draw(gameTime as GameTime):
graphics.GraphicsDevice.Clear(Color.CornflowerBlue)

// TODO: Add your drawing code here
super(gameTime)

No comments:

Post a Comment