C# Класс Sharplike.Core.Game

Game is the core entry point of the Sharplike engine.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Описание методов

Initialize() публичный статический Метод

Creates a new game. The base directory will be the location of the .exe file that was run.
public static Initialize ( ) : void
Результат void

Initialize() публичный статический Метод

Creates a new game.
public static Initialize ( String basedir ) : void
basedir String The base application directory.
Результат void

PathTo() публичный статический Метод

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.
Результат String

PathTo() публичный статический Метод

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.
Результат String

Process() публичный статический Метод

Processes the game's core subsystems. Game function should not be called except by expert users.
public static Process ( ) : void
Результат void

PumpMessages() публичный статический Метод

Pumps game messages. For expert users only!
public static PumpMessages ( ) : void
Результат void

RegisterTask() публичный статический Метод

Thread Safe. Registers a new scheduled task to be run every step.
public static RegisterTask ( IScheduledTask task ) : void
task IScheduledTask The task to schedule.
Результат void

Run() публичный статический Метод

Starts the game's processing and immediately returns. For expert users only!
public static Run ( ) : void
Результат void

Run() публичный статический Метод

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.
Результат void

SendMessage() публичный статический Метод

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
Результат void

SendMessage() публичный статический Метод

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
Результат void

SetAudioSystem() публичный статический Метод

Sets the audio engine to use.
public static SetAudioSystem ( String sys ) : void
sys String The name of the audio engine. Default is "OpenTK".
Результат void

SetInputSystem() публичный статический Метод

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.
Результат void

SetRenderSystem() публичный статический Метод

Sets the rendering engine to use.
public static SetRenderSystem ( String sys ) : void
sys String The name of the rendering engine. Default is "OpenTK".
Результат void

SetTick() публичный статический Метод

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.
Результат System.Int64

Step() публичный статический Метод

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
Результат void

Stop() публичный статический Метод

Stops the game from running. For expert users only!
public static Stop ( ) : void
Результат void

SubscribeToChannel() публичный статический Метод

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.
Результат void

SubscribeToChannels() публичный статический Метод

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.
Результат void

Terminate() публичный статический Метод

Call Game when your application's done. Disposes of Game and fires any OnGameTermination events.
public static Terminate ( ) : void
Результат void

UnregisterTask() публичный статический Метод

Thread Safe. Unregisters a task from the task queue.
public static UnregisterTask ( IScheduledTask task ) : void
task IScheduledTask The task to unregister.
Результат void

Unsubscribe() публичный статический Метод

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.
Результат void