C# Class SharpNeat.DomainsExtra.Box2D.Box2dDomainView

显示文件 Open project: colgreen/sharpneat

Protected Properties

Property Type Description
_box IBlackBox
_simWorld SimulationWorld

Public Methods

Method Description
Box2dDomainView ( IBlackBox>.IGenomeDecoder genomeDecoder ) : System

Construct with the provided IGenomeDecoder, this is used to decode genome(s) into IBlackBox controllers.

RefreshView ( object genome ) : void

Refresh/update the view with the provided genome.

Protected Methods

Method Description
CreateSimulationWorld ( ) : SimulationWorld

Create a Box2D simulation world.

InvokeController ( ) : void

Invoke any required control logic in the Box2D world.

OnHandleDestroyed ( EventArgs e ) : void

Event handler to clean-up on window closure.

TestStopCondition ( ) : bool

Test if the Box2D world has arrived at a stop condition.

Private Methods

Method Description
ConvertScreenToWorld ( float x, float y ) : Vec2

Convert screen coordinates to box2d world coords.

InitDebugDraw ( ) : void

Initialise debug drawing object (interface between Box2D world and openGL rendering).

RunTrial ( ) : void

Run one simulation.

SetView ( ) : void

Set the extents of the viewport and the box2D world. The extents of the two coordinate systems are set to preserve the correct aspect ratio when rendering the Box2d world. This is done simply be always rendering the full height of the box2D world and varying the horizontal extents to maintain the aspect ratio as the viewport is resized.

SimulationThread ( ) : void

Run simulations until thread is terminated.

btnReset_Click ( object sender, EventArgs e ) : void
openGlControl_MouseDown ( object sender, MouseEventArgs e ) : void
openGlControl_MouseMove ( object sender, MouseEventArgs e ) : void
openGlControl_MouseUp ( object sender, MouseEventArgs e ) : void
openGlControl_Resize ( object sender, EventArgs e ) : void

Method Details

Box2dDomainView() public method

Construct with the provided IGenomeDecoder, this is used to decode genome(s) into IBlackBox controllers.
public Box2dDomainView ( IBlackBox>.IGenomeDecoder genomeDecoder ) : System
genomeDecoder IBlackBox>.IGenomeDecoder
return System

CreateSimulationWorld() protected abstract method

Create a Box2D simulation world.
protected abstract CreateSimulationWorld ( ) : SimulationWorld
return SimulationWorld

InvokeController() protected abstract method

Invoke any required control logic in the Box2D world.
protected abstract InvokeController ( ) : void
return void

OnHandleDestroyed() protected method

Event handler to clean-up on window closure.
protected OnHandleDestroyed ( EventArgs e ) : void
e EventArgs
return void

RefreshView() public method

Refresh/update the view with the provided genome.
public RefreshView ( object genome ) : void
genome object
return void

TestStopCondition() protected method

Test if the Box2D world has arrived at a stop condition.
protected TestStopCondition ( ) : bool
return bool

Property Details

_box protected_oe property

The black box controller used by the simulation thread.
protected IBlackBox _box
return IBlackBox

_simWorld protected_oe property

The Box2D world.
protected SimulationWorld,SharpNeat.DomainsExtra.Box2D _simWorld
return SimulationWorld