C# Class Sharplike.Core.Game

Game is the core entry point of the Sharplike engine.
Afficher le fichier Open project: eropple/sharplike

Méthodes publiques

Méthode Description
Initialize ( ) : void

Creates a new game. The base directory will be the location of the .exe file that was run.

Initialize ( String basedir ) : void

Creates a new game.

PathTo ( IEnumerable location ) : String

Builds a full system path to the specified location from an IEnumerable of path components.

PathTo ( String location ) : String

Returns a full system path to the given location. Properly accounts for system differences. Regardless of your development platform, use the foreslash ("/") to separate path elements.

Process ( ) : void

Processes the game's core subsystems. Game function should not be called except by expert users.

PumpMessages ( ) : void

Pumps game messages. For expert users only!

RegisterTask ( IScheduledTask task ) : void

Thread Safe. Registers a new scheduled task to be run every step.

Run ( ) : void

Starts the game's processing and immediately returns. For expert users only!

Run ( AbstractGameLoop loop ) : void

Starts the game's processing. Make sure that the game has been initialized through a call to Initialize() first. Game call will not return until the user has quit the game.

SendMessage ( IMessageReceiver target, String messagename ) : void

Thread safe. Send a message to a particular target.

SendMessage ( String channel, String messagename ) : void

Thread safe. Broadcasts a message to a channel.

SetAudioSystem ( String sys ) : void

Sets the audio engine to use.

SetInputSystem ( String sys ) : void

Sets the input system to use. WARNING: Many input systems (such as OpenTK) reference the rendering system for a window handle. Consult the documentation of your input system for details, but in general be sure to initialize your rendering system first.

SetRenderSystem ( String sys ) : void

Sets the rendering engine to use.

SetTick ( System.Int64 newTickValue ) : System.Int64

Used to set the value of the game loop's current tick. This is NOT being used as the property's setter because it must be stressed that this is a BAD THING TO MESS WITH. Only do so in established, defined situations (for example, setting the tick value of a restored saved game).

Step ( ) : void

Processes a single step of game code. This will be called every frame for realtime games. Should not be called except by expert users. Even they should reconsider.

Stop ( ) : void

Stops the game from running. For expert users only!

SubscribeToChannel ( String chan, IMessageReceiver subscriber ) : void

Thread safe. Subscribes a message receiver to a particular channel.

If an object is subscribed to a channel, it MUST be unsubscribed on destruction.

SubscribeToChannels ( IMessageReceiver subscriber ) : void

Thread safe. Automatically subscribe to all channels specified in class attributes.

If an object is subscribed to a channel, it MUST be unsubscribed on destruction.

Terminate ( ) : void

Call Game when your application's done. Disposes of Game and fires any OnGameTermination events.

UnregisterTask ( IScheduledTask task ) : void

Thread Safe. Unregisters a task from the task queue.

Unsubscribe ( IMessageReceiver subscriber ) : void

Thread safe. Unsubscribes an object from the whole post system. This object will no longer receive messages.

Method Details

Initialize() public static méthode

Creates a new game. The base directory will be the location of the .exe file that was run.
public static Initialize ( ) : void
Résultat void

Initialize() public static méthode

Creates a new game.
public static Initialize ( String basedir ) : void
basedir String The base application directory.
Résultat void

PathTo() public static méthode

Builds a full system path to the specified location from an IEnumerable of path components.
public static PathTo ( IEnumerable location ) : String
location IEnumerable An enumerable collection of path components.
Résultat String

PathTo() public static méthode

Returns a full system path to the given location. Properly accounts for system differences. Regardless of your development platform, use the foreslash ("/") to separate path elements.
public static PathTo ( String location ) : String
location String The path to generate off of the game's BaseDirectory.
Résultat String

Process() public static méthode

Processes the game's core subsystems. Game function should not be called except by expert users.
public static Process ( ) : void
Résultat void

PumpMessages() public static méthode

Pumps game messages. For expert users only!
public static PumpMessages ( ) : void
Résultat void

RegisterTask() public static méthode

Thread Safe. Registers a new scheduled task to be run every step.
public static RegisterTask ( IScheduledTask task ) : void
task IScheduledTask The task to schedule.
Résultat void

Run() public static méthode

Starts the game's processing and immediately returns. For expert users only!
public static Run ( ) : void
Résultat void

Run() public static méthode

Starts the game's processing. Make sure that the game has been initialized through a call to Initialize() first. Game call will not return until the user has quit the game.
public static Run ( AbstractGameLoop loop ) : void
loop Sharplike.Core.Runtime.AbstractGameLoop The AbstractGameLoop that's responsible for delegating to game logic.
Résultat void

SendMessage() public static méthode

Thread safe. Send a message to a particular target.
public static SendMessage ( IMessageReceiver target, String messagename ) : void
target IMessageReceiver The target to send the message to.
messagename String The name of the message to send
Résultat void

SendMessage() public static méthode

Thread safe. Broadcasts a message to a channel.
public static SendMessage ( String channel, String messagename ) : void
channel String The channel to send to
messagename String The name of the message to send
Résultat void

SetAudioSystem() public static méthode

Sets the audio engine to use.
public static SetAudioSystem ( String sys ) : void
sys String The name of the audio engine. Default is "OpenTK".
Résultat void

SetInputSystem() public static méthode

Sets the input system to use. WARNING: Many input systems (such as OpenTK) reference the rendering system for a window handle. Consult the documentation of your input system for details, but in general be sure to initialize your rendering system first.
public static SetInputSystem ( String sys ) : void
sys String The name of the input system to use.
Résultat void

SetRenderSystem() public static méthode

Sets the rendering engine to use.
public static SetRenderSystem ( String sys ) : void
sys String The name of the rendering engine. Default is "OpenTK".
Résultat void

SetTick() public static méthode

Used to set the value of the game loop's current tick. This is NOT being used as the property's setter because it must be stressed that this is a BAD THING TO MESS WITH. Only do so in established, defined situations (for example, setting the tick value of a restored saved game).
public static SetTick ( System.Int64 newTickValue ) : System.Int64
newTickValue System.Int64 The new value of the current tick.
Résultat System.Int64

Step() public static méthode

Processes a single step of game code. This will be called every frame for realtime games. Should not be called except by expert users. Even they should reconsider.
public static Step ( ) : void
Résultat void

Stop() public static méthode

Stops the game from running. For expert users only!
public static Stop ( ) : void
Résultat void

SubscribeToChannel() public static méthode

Thread safe. Subscribes a message receiver to a particular channel.
If an object is subscribed to a channel, it MUST be unsubscribed on destruction.
public static SubscribeToChannel ( String chan, IMessageReceiver subscriber ) : void
chan String The channel to subscribe to.
subscriber IMessageReceiver The object that will receive messages.
Résultat void

SubscribeToChannels() public static méthode

Thread safe. Automatically subscribe to all channels specified in class attributes.
If an object is subscribed to a channel, it MUST be unsubscribed on destruction.
public static SubscribeToChannels ( IMessageReceiver subscriber ) : void
subscriber IMessageReceiver The object to create subscriptions for.
Résultat void

Terminate() public static méthode

Call Game when your application's done. Disposes of Game and fires any OnGameTermination events.
public static Terminate ( ) : void
Résultat void

UnregisterTask() public static méthode

Thread Safe. Unregisters a task from the task queue.
public static UnregisterTask ( IScheduledTask task ) : void
task IScheduledTask The task to unregister.
Résultat void

Unsubscribe() public static méthode

Thread safe. Unsubscribes an object from the whole post system. This object will no longer receive messages.
public static Unsubscribe ( IMessageReceiver subscriber ) : void
subscriber IMessageReceiver The object to unsubscribe.
Résultat void