C# Class Axiom.Samples.SampleContext

Base class responsible for setting up a common context for samples. May be subclassed for specific sample types (not specific samples). Allows one sample to run at a time, while maintaining a sample queue.
Inheritance: IWindowEventListener, SharpInputSystem.IKeyboardListener, SharpInputSystem.IMouseListener, IDisposable
Afficher le fichier Open project: WolfgangSt/axiom

Protected Properties

Свойство Type Description
ConfigurationManager IConfigurationManager
InputManager SharpInputSystem.InputManager
IsLastRun bool
IsSamplePaused bool
Keyboard SharpInputSystem.Keyboard
LastSample Sample
LastSampleState NameValuePairList
Mouse SharpInputSystem.Mouse
NextRenderer String
Root Axiom.Core.Root

Méthodes publiques

Méthode Description
Dispose ( ) : void
FrameEnded ( object sender, FrameEventArgs evt ) : void

Processes frame ended events.

FrameRenderingQueued ( object sender, FrameEventArgs evt ) : void

Processes rendering queued events.

FrameStarted ( object sender, FrameEventArgs evt ) : void

Processes frame started events.

Go ( ) : void

This function encapsulates the entire lifetime of the context.

Go ( Sample initialSample ) : void

This function encapsulates the entire lifetime of the context.

KeyPressed ( SharpInputSystem evt ) : bool
KeyReleased ( SharpInputSystem evt ) : bool
MouseMoved ( SharpInputSystem evt ) : bool
MousePressed ( SharpInputSystem evt, SharpInputSystem id ) : bool
MouseReleased ( SharpInputSystem evt, SharpInputSystem id ) : bool
PauseCurrentSample ( ) : void

Pauses the current running sample

RunSample ( Sample s ) : void

Quits the current sample and starts a new one.

SampleContext ( IConfigurationManager cfgManager ) : System

Creates a new instance of the type SampleContext

UnpauseCurrentSample ( ) : void

Unpauses the current sample

WindowClosed ( Axiom.Graphics.RenderWindow rw ) : void
WindowClosing ( Axiom.Graphics.RenderWindow rw ) : bool
WindowFocusChange ( Axiom.Graphics.RenderWindow rw ) : void
WindowMoved ( Axiom.Graphics.RenderWindow rw ) : void
WindowResized ( Axiom.Graphics.RenderWindow rw ) : void

Processes window size change event. Adjusts mouse's region to match that of the window. You could also override this method to prevent resizing.

Méthodes protégées

Méthode Description
CaptureInputDevices ( ) : void

Captures input device states.

CreateInputDevices ( ) : void

Creates the individual input devices. I only create a keyboard and mouse here because they are the most common, but you can override this method for other modes and devices.

CreateRoot ( ) : void

Creates the Axiom root.

CreateWindow ( ) : void

Creates the render window to be used for this context. I use an auto-created window here, but you can also create an external window if you wish. Just don't forget to initialize the root.

LoadResources ( ) : void

Loads context-wide resource groups. I chose here to simply initialise all groups, but you can fully load specific ones if you wish.

LocateResources ( ) : void

Finds context-wide resource groups. I load paths from a config file here, but you can choose your resource locations however you want.

Log ( string msg ) : void

Logs a message to the default logfile.

OneTimeConfig ( ) : bool

Configures the startup settings for Axiom. It will first load the settings from a configuration file, then open a dialog for any further configuration.

Reconfigure ( String renderer, NameValuePairList options ) : void

Reconfigures the context. Attempts to preserve the current sample state.

RecoverLastSample ( ) : void

Recovers the last sample after a reset. You can override in the case that the last sample is destroyed in the process of resetting, and you have to recover it through another means.

Setup ( ) : void

Sets up the context after configuration.

SetupInput ( ) : void

Sets up SIS input.

Shutdown ( ) : void

Cleans up and shuts down the context.

ShutdownInput ( ) : void

Destroys SIS input devices and the input manager.

Method Details

CaptureInputDevices() protected méthode

Captures input device states.
protected CaptureInputDevices ( ) : void
Résultat void

CreateInputDevices() protected méthode

Creates the individual input devices. I only create a keyboard and mouse here because they are the most common, but you can override this method for other modes and devices.
protected CreateInputDevices ( ) : void
Résultat void

CreateRoot() protected méthode

Creates the Axiom root.
protected CreateRoot ( ) : void
Résultat void

CreateWindow() protected méthode

Creates the render window to be used for this context. I use an auto-created window here, but you can also create an external window if you wish. Just don't forget to initialize the root.
protected CreateWindow ( ) : void
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

FrameEnded() public méthode

Processes frame ended events.
public FrameEnded ( object sender, FrameEventArgs evt ) : void
sender object
evt FrameEventArgs
Résultat void

FrameRenderingQueued() public méthode

Processes rendering queued events.
public FrameRenderingQueued ( object sender, FrameEventArgs evt ) : void
sender object
evt FrameEventArgs
Résultat void

FrameStarted() public méthode

Processes frame started events.
public FrameStarted ( object sender, FrameEventArgs evt ) : void
sender object
evt FrameEventArgs
Résultat void

Go() public méthode

This function encapsulates the entire lifetime of the context.
public Go ( ) : void
Résultat void

Go() public méthode

This function encapsulates the entire lifetime of the context.
public Go ( Sample initialSample ) : void
initialSample Sample
Résultat void

KeyPressed() public méthode

public KeyPressed ( SharpInputSystem evt ) : bool
evt SharpInputSystem
Résultat bool

KeyReleased() public méthode

public KeyReleased ( SharpInputSystem evt ) : bool
evt SharpInputSystem
Résultat bool

LoadResources() protected méthode

Loads context-wide resource groups. I chose here to simply initialise all groups, but you can fully load specific ones if you wish.
protected LoadResources ( ) : void
Résultat void

LocateResources() protected méthode

Finds context-wide resource groups. I load paths from a config file here, but you can choose your resource locations however you want.
protected LocateResources ( ) : void
Résultat void

Log() protected méthode

Logs a message to the default logfile.
protected Log ( string msg ) : void
msg string
Résultat void

MouseMoved() public méthode

public MouseMoved ( SharpInputSystem evt ) : bool
evt SharpInputSystem
Résultat bool

MousePressed() public méthode

public MousePressed ( SharpInputSystem evt, SharpInputSystem id ) : bool
evt SharpInputSystem
id SharpInputSystem
Résultat bool

MouseReleased() public méthode

public MouseReleased ( SharpInputSystem evt, SharpInputSystem id ) : bool
evt SharpInputSystem
id SharpInputSystem
Résultat bool

OneTimeConfig() protected méthode

Configures the startup settings for Axiom. It will first load the settings from a configuration file, then open a dialog for any further configuration.
protected OneTimeConfig ( ) : bool
Résultat bool

PauseCurrentSample() public méthode

Pauses the current running sample
public PauseCurrentSample ( ) : void
Résultat void

Reconfigure() protected méthode

Reconfigures the context. Attempts to preserve the current sample state.
protected Reconfigure ( String renderer, NameValuePairList options ) : void
renderer String
options NameValuePairList
Résultat void

RecoverLastSample() protected méthode

Recovers the last sample after a reset. You can override in the case that the last sample is destroyed in the process of resetting, and you have to recover it through another means.
protected RecoverLastSample ( ) : void
Résultat void

RunSample() public méthode

Quits the current sample and starts a new one.
public RunSample ( Sample s ) : void
s Sample
Résultat void

SampleContext() public méthode

Creates a new instance of the type SampleContext
public SampleContext ( IConfigurationManager cfgManager ) : System
cfgManager IConfigurationManager
Résultat System

Setup() protected méthode

Sets up the context after configuration.
protected Setup ( ) : void
Résultat void

SetupInput() protected méthode

Sets up SIS input.
protected SetupInput ( ) : void
Résultat void

Shutdown() protected méthode

Cleans up and shuts down the context.
protected Shutdown ( ) : void
Résultat void

ShutdownInput() protected méthode

Destroys SIS input devices and the input manager.
protected ShutdownInput ( ) : void
Résultat void

UnpauseCurrentSample() public méthode

Unpauses the current sample
public UnpauseCurrentSample ( ) : void
Résultat void

WindowClosed() public méthode

public WindowClosed ( Axiom.Graphics.RenderWindow rw ) : void
rw Axiom.Graphics.RenderWindow
Résultat void

WindowClosing() public méthode

public WindowClosing ( Axiom.Graphics.RenderWindow rw ) : bool
rw Axiom.Graphics.RenderWindow
Résultat bool

WindowFocusChange() public méthode

public WindowFocusChange ( Axiom.Graphics.RenderWindow rw ) : void
rw Axiom.Graphics.RenderWindow
Résultat void

WindowMoved() public méthode

public WindowMoved ( Axiom.Graphics.RenderWindow rw ) : void
rw Axiom.Graphics.RenderWindow
Résultat void

WindowResized() public méthode

Processes window size change event. Adjusts mouse's region to match that of the window. You could also override this method to prevent resizing.
public WindowResized ( Axiom.Graphics.RenderWindow rw ) : void
rw Axiom.Graphics.RenderWindow
Résultat void

Property Details

ConfigurationManager protected_oe property

Configuration Manager
protected IConfigurationManager ConfigurationManager
Résultat IConfigurationManager

InputManager protected_oe property

SharpInputSystem Input Manager
protected InputManager,SharpInputSystem InputManager
Résultat SharpInputSystem.InputManager

IsLastRun protected_oe property

Whether or not this is the final run
protected bool IsLastRun
Résultat bool

IsSamplePaused protected_oe property

protected bool IsSamplePaused
Résultat bool

Keyboard protected_oe property

Keyboard Device
protected Keyboard,SharpInputSystem Keyboard
Résultat SharpInputSystem.Keyboard

LastSample protected_oe property

last sample run before reconfiguration
protected Sample LastSample
Résultat Sample

LastSampleState protected_oe property

state of last sample
protected NameValuePairList LastSampleState
Résultat NameValuePairList

Mouse protected_oe property

Mouse Device
protected Mouse,SharpInputSystem Mouse
Résultat SharpInputSystem.Mouse

NextRenderer protected_oe property

Name of renderer used for next run
protected String NextRenderer
Résultat String

Root protected_oe property

Axiom root
protected Root,Axiom.Core Root
Résultat Axiom.Core.Root