C# Class Axiom.Overlays.OverlayElement

Abstract definition of a 2D element to be displayed in an Overlay.
This class abstracts all the details of a 2D element which will appear in an overlay. In fact, not all OverlayElement instances can be directly added to an Overlay, only those which are OverlayElementContainer instances (derived from this class) are able to be added, however they can contain any OverlayElement however. This is done to enforce some level of grouping of widgets.
OverlayElements should be managed using OverlayElementManager. This class is responsible for instantiating / deleting elements, and also for accepting new types of element from plugins etc.
Note that positions / dimensions of 2D screen elements are expressed as parametric values (0.0 - 1.0) because this makes them resolution-independent. However, most screen resolutions have an aspect ratio of 1.3333:1 (width : height) so note that in physical pixels 0.5 is wider than it is tall, so a 0.5x0.5 panel will not be square on the screen (but it will take up exactly half the screen in both dimensions).
Inheritance: IRenderable
Show file Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
clippingRegion Axiom.Core.Rectangle
color Axiom.Core.ColorEx
customParams List
derivedLeft float
emptyLightList LightList
horzAlign HorizontalAlignment
isCloneable bool
isDerivedOutOfDate bool
isEnabled bool
isGeomPositionsOutOfDate bool
isGeomUVsOutOfDate bool
isInitialized bool
isVisible bool
left float
material Axiom.Graphics.Material
materialName string
metricsMode MetricsMode
name string
overlay Overlay
parent OverlayElementContainer
pixelHeight float
pixelLeft float
pixelScaleX float
pixelScaleY float
pixelTop float
pixelWidth float
renderOperation Axiom.Graphics.RenderOperation
sourceTemplate OverlayElement
text string
vertAlign VerticalAlignment
xform Axiom.MathLib.Matrix4[]
zOrder int

Public Methods

Method Description
Clone ( string instanceName ) : OverlayElement
Contains ( float x, float y ) : bool

Returns true if xy is within the constraints of the component

CopyFromTemplate ( OverlayElement template ) : void

Copys data from the template element to this element to clone it.

CopyParametersTo ( OverlayElement instance ) : void
FindElementAt ( float x, float y ) : OverlayElement

Returns true if xy is within the constraints of the component

GetCustomParameter ( int index ) : Vector4
GetSquaredViewDepth ( Camera camera ) : float

Implementation of IRenderable.

GetWorldOrientation ( ) : Axiom.MathLib.Quaternion

GetWorldPosition ( ) : Vector3
GetWorldTransforms ( Axiom.MathLib.Matrix4 matrices ) : void

Hide ( ) : void

Hides an element if it is currently visible.

Initialize ( ) : void

Initialize the OverlayElement.

NotifyParent ( OverlayElementContainer parent, Overlay overlay ) : void

Internal method for notifying the gui element of it's parent and ultimate overlay.

NotifyViewport ( ) : void

Notifies the viewport.

NotifyWorldTransforms ( Axiom.MathLib.Matrix4 xform ) : void

Notifies the world transforms.

NotifyZOrder ( int zOrder ) : int

Internal method to notify the element when Zorder of parent overlay has changed.

Overlays have explicit Z orders. OverlayElements do not, they inherit the ZOrder of the overlay, and the Zorder is incremented for every container nested within this to ensure that containers are displayed behind contained items. This method is used internally to notify the element of a change in final zorder which is used to render the element.

PositionsOutOfDate ( ) : void

Tells this element to recaculate it's position.

ScreenDimensions ( float width, float height ) : void

Sets the width and height of this element in relation to the screen (where 1.0 = screen width)

ScreenHeight ( float height ) : void

Sets the height of this element in relation to the screen (where 1.0 = screen width)

ScreenLeft ( float left ) : void

Sets the left of this element in relation to the screen (where 1.0 = screen width)

ScreenPosition ( float left, float top ) : void

Sets the left and top of this element in relation to the screen (where 1.0 = screen width)

ScreenTop ( float top ) : void

Sets the top of this element in relation to the screen (where 1.0 = screen width)

ScreenWidth ( float width ) : void

Sets the width of this element in relation to the screen (where 1.0 = screen width)

SetCustomParameter ( int index, Vector4 val ) : void
SetDimensions ( float width, float height ) : void

Sets the dimensions.

SetParam ( string param, string val ) : bool

Sets param values from script values. Subclasses can define their own params in addition to what this base class already defines.

SetPosition ( float left, float top ) : void

Sets the position of this element.

Show ( ) : void

Shows this element if it was previously hidden.

Update ( ) : void

Internal method to update the element based on transforms applied.

UpdateCustomGpuParameter ( GpuProgramParameters entry, GpuProgramParameters gpuParams ) : void
UpdateFromParent ( ) : void

Updates this elements transform based on it's parent.

UpdateRenderQueue ( RenderQueue queue ) : void

Internal method to put the contents onto the render queue.

Protected Methods

Method Description
OverlayElement ( string name ) : System

UpdatePositionGeometry ( ) : void

Internal method which is triggered when the positions of the element get updated, meaning the element should be rebuilding it's mesh positions. Abstract since subclasses must implement this.

UpdateTextureGeometry ( ) : void

Internal method which is triggered when the UVs of the element get updated, meaning the element should be rebuilding it's mesh UVs. Abstract since subclasses must implement this.

dispose ( bool disposeManagedResources ) : void

Class level dispose method

When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }

Method Details

Clone() public method

public Clone ( string instanceName ) : OverlayElement
instanceName string
return OverlayElement

Contains() public method

Returns true if xy is within the constraints of the component
public Contains ( float x, float y ) : bool
x float
y float
return bool

CopyFromTemplate() public method

Copys data from the template element to this element to clone it.
public CopyFromTemplate ( OverlayElement template ) : void
template OverlayElement
return void

CopyParametersTo() public method

public CopyParametersTo ( OverlayElement instance ) : void
instance OverlayElement
return void

FindElementAt() public method

Returns true if xy is within the constraints of the component
public FindElementAt ( float x, float y ) : OverlayElement
x float The x.
y float The y.
return OverlayElement

GetCustomParameter() public method

public GetCustomParameter ( int index ) : Vector4
index int
return Vector4

GetSquaredViewDepth() public method

Implementation of IRenderable.
public GetSquaredViewDepth ( Camera camera ) : float
camera Axiom.Core.Camera
return float

GetWorldOrientation() public method

public GetWorldOrientation ( ) : Axiom.MathLib.Quaternion
return Axiom.MathLib.Quaternion

GetWorldPosition() public method

public GetWorldPosition ( ) : Vector3
return Vector3

GetWorldTransforms() public method

public GetWorldTransforms ( Axiom.MathLib.Matrix4 matrices ) : void
matrices Axiom.MathLib.Matrix4
return void

Hide() public method

Hides an element if it is currently visible.
public Hide ( ) : void
return void

Initialize() public abstract method

Initialize the OverlayElement.
public abstract Initialize ( ) : void
return void

NotifyParent() public method

Internal method for notifying the gui element of it's parent and ultimate overlay.
public NotifyParent ( OverlayElementContainer parent, Overlay overlay ) : void
parent OverlayElementContainer Parent of this element.
overlay Overlay Overlay this element belongs to.
return void

NotifyViewport() public method

Notifies the viewport.
public NotifyViewport ( ) : void
return void

NotifyWorldTransforms() public method

Notifies the world transforms.
public NotifyWorldTransforms ( Axiom.MathLib.Matrix4 xform ) : void
xform Axiom.MathLib.Matrix4 The xform.
return void

NotifyZOrder() public method

Internal method to notify the element when Zorder of parent overlay has changed.
Overlays have explicit Z orders. OverlayElements do not, they inherit the ZOrder of the overlay, and the Zorder is incremented for every container nested within this to ensure that containers are displayed behind contained items. This method is used internally to notify the element of a change in final zorder which is used to render the element.
public NotifyZOrder ( int zOrder ) : int
zOrder int The z order.
return int

OverlayElement() protected method

protected OverlayElement ( string name ) : System
name string
return System

PositionsOutOfDate() public method

Tells this element to recaculate it's position.
public PositionsOutOfDate ( ) : void
return void

ScreenDimensions() public method

Sets the width and height of this element in relation to the screen (where 1.0 = screen width)
public ScreenDimensions ( float width, float height ) : void
width float
height float
return void

ScreenHeight() public method

Sets the height of this element in relation to the screen (where 1.0 = screen width)
public ScreenHeight ( float height ) : void
height float
return void

ScreenLeft() public method

Sets the left of this element in relation to the screen (where 1.0 = screen width)
public ScreenLeft ( float left ) : void
left float
return void

ScreenPosition() public method

Sets the left and top of this element in relation to the screen (where 1.0 = screen width)
public ScreenPosition ( float left, float top ) : void
left float
top float
return void

ScreenTop() public method

Sets the top of this element in relation to the screen (where 1.0 = screen width)
public ScreenTop ( float top ) : void
top float
return void

ScreenWidth() public method

Sets the width of this element in relation to the screen (where 1.0 = screen width)
public ScreenWidth ( float width ) : void
width float
return void

SetCustomParameter() public method

public SetCustomParameter ( int index, Vector4 val ) : void
index int
val Vector4
return void

SetDimensions() public method

Sets the dimensions.
public SetDimensions ( float width, float height ) : void
width float The width.
height float The height.
return void

SetParam() public method

Sets param values from script values. Subclasses can define their own params in addition to what this base class already defines.
public SetParam ( string param, string val ) : bool
param string
val string
return bool

SetPosition() public method

Sets the position of this element.
public SetPosition ( float left, float top ) : void
left float The left.
top float The top.
return void

Show() public method

Shows this element if it was previously hidden.
public Show ( ) : void
return void

Update() public method

Internal method to update the element based on transforms applied.
public Update ( ) : void
return void

UpdateCustomGpuParameter() public method

public UpdateCustomGpuParameter ( GpuProgramParameters entry, GpuProgramParameters gpuParams ) : void
entry Axiom.Graphics.GpuProgramParameters
gpuParams Axiom.Graphics.GpuProgramParameters
return void

UpdateFromParent() public method

Updates this elements transform based on it's parent.
public UpdateFromParent ( ) : void
return void

UpdatePositionGeometry() protected abstract method

Internal method which is triggered when the positions of the element get updated, meaning the element should be rebuilding it's mesh positions. Abstract since subclasses must implement this.
protected abstract UpdatePositionGeometry ( ) : void
return void

UpdateRenderQueue() public method

Internal method to put the contents onto the render queue.
public UpdateRenderQueue ( RenderQueue queue ) : void
queue Axiom.Graphics.RenderQueue Current render queue.
return void

UpdateTextureGeometry() protected abstract method

Internal method which is triggered when the UVs of the element get updated, meaning the element should be rebuilding it's mesh UVs. Abstract since subclasses must implement this.
protected abstract UpdateTextureGeometry ( ) : void
return void

dispose() protected method

Class level dispose method
When implementing this method in an inherited class the following template should be used; protected override void dispose( bool disposeManagedResources ) { if ( !isDisposed ) { if ( disposeManagedResources ) { // Dispose managed resources. } // There are no unmanaged resources to release, but // if we add them, they need to be released here. } // If it is available, make the call to the // base class's Dispose(Boolean) method base.dispose( disposeManagedResources ); }
protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool True if Unmanaged resources should be released.
return void

Property Details

clippingRegion protected property

protected Rectangle,Axiom.Core clippingRegion
return Axiom.Core.Rectangle

color protected property

protected ColorEx,Axiom.Core color
return Axiom.Core.ColorEx

customParams protected property

protected List customParams
return List

derivedLeft protected property

protected float derivedLeft
return float

emptyLightList protected property

protected LightList emptyLightList
return LightList

horzAlign protected property

protected HorizontalAlignment horzAlign
return HorizontalAlignment

isCloneable protected property

protected bool isCloneable
return bool

isDerivedOutOfDate protected property

protected bool isDerivedOutOfDate
return bool

isEnabled protected property

protected bool isEnabled
return bool

isGeomPositionsOutOfDate protected property

protected bool isGeomPositionsOutOfDate
return bool

isGeomUVsOutOfDate protected property

protected bool isGeomUVsOutOfDate
return bool

isInitialized protected property

protected bool isInitialized
return bool

isVisible protected property

protected bool isVisible
return bool

left protected property

protected float left
return float

material protected property

protected Material,Axiom.Graphics material
return Axiom.Graphics.Material

materialName protected property

protected string materialName
return string

metricsMode protected property

protected MetricsMode metricsMode
return MetricsMode

name protected property

protected string name
return string

overlay protected property

protected Overlay,Axiom.Overlays overlay
return Overlay

parent protected property

protected OverlayElementContainer,Axiom.Overlays parent
return OverlayElementContainer

pixelHeight protected property

protected float pixelHeight
return float

pixelLeft protected property

protected float pixelLeft
return float

pixelScaleX protected property

protected float pixelScaleX
return float

pixelScaleY protected property

protected float pixelScaleY
return float

pixelTop protected property

protected float pixelTop
return float

pixelWidth protected property

protected float pixelWidth
return float

renderOperation protected property

protected RenderOperation,Axiom.Graphics renderOperation
return Axiom.Graphics.RenderOperation

sourceTemplate protected property

protected OverlayElement,Axiom.Overlays sourceTemplate
return OverlayElement

text protected property

protected string text
return string

vertAlign protected property

protected VerticalAlignment vertAlign
return VerticalAlignment

xform protected property

protected Matrix4[],Axiom.MathLib xform
return Axiom.MathLib.Matrix4[]

zOrder protected property

protected int zOrder
return int