C# Class Sharplike.Core.Game

Game is the core entry point of the Sharplike engine.
ファイルを表示 Open project: eropple/sharplike

Public Methods

Method 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 method

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

Initialize() public static method

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

PathTo() public static method

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.
return String

PathTo() public static method

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.
return String

Process() public static method

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

PumpMessages() public static method

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

RegisterTask() public static method

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

Run() public static method

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

Run() public static method

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.
return void

SendMessage() public static method

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
return void

SendMessage() public static method

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
return void

SetAudioSystem() public static method

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

SetInputSystem() public static method

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.
return void

SetRenderSystem() public static method

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

SetTick() public static method

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.
return System.Int64

Step() public static method

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
return void

Stop() public static method

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

SubscribeToChannel() public static method

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.
return void

SubscribeToChannels() public static method

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.
return void

Terminate() public static method

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

UnregisterTask() public static method

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

Unsubscribe() public static method

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.
return void