OverlayElement

From oWiki

Jump to: navigation, search

Contents


Attributes

top

float  ( r, w )
Gets/Sets the element's top position.

left

float  ( r, w )
Gets/Sets the element's left position.

width

float  ( r, w )
Gets/Sets the element's width.

height

float  ( r, w )
Gets/Sets the element's height.

caption

string  ( r, w )
Gets/Sets the element's caption.

alignment

int  ( r, w )
Gets/Sets the element's alignment. Possible values are: Left = 0, Right = 1, Center = 2.

charHeight

float  ( r, w )
Gets/Sets the element's text height.

spaceWidth

float  ( r, w )
Gets/Sets the width of a space.

transparent

bool  ( r, w )
Sets whether this panel element is transparent (used only as a grouping level), or if it is actually rendered.


Methods

show()

Shows the element if it was hidden.

hide()

Hides the element if it was visible.

addChild( e )

e: an OverlayElement or string

Adds a child element to this element. This element must be a container element (Panel or BorderPanel). e can also be given as the name of an existing OverlayElement.

setMetricsMode( m )

m: int

Tells this element how to interpret the position and dimension values it is given.

By default, OverlayElements are positioned and sized according to relative dimensions of the screen. This is to ensure portability between different resolutions when you want things to be positioned and sized the same way across all resolutions. However, sometimes you want things to be sized according to fixed pixels. In order to do this, you can call this method with the parameter GMM_PIXELS. Note that if you then want to place your element relative to the center, right or bottom of it's parent, you will need to set the alignment.

Possible values for m are:

Value Description
GMM_RELATIVE = 0 'left', 'top', 'height' and 'width' are parametrics from 0.0 to 1.0.
GMM_PIXELS = 1 Positions & sizes are in absolute pixels.
GMM_RELATIVE_ASPECT_ADJUSTED = 2 Positions & sizes are in virtual pixels.

setMaterialName( name )

name: string

Sets the name of the material this element will use.

setColor( rgba )

rgba: a RGBA object

Sets the colour of the text.

setColorTop( rgba )

rgba: a RGBA object

Sets the color of the top of the letters. By setting a separate top and bottom colour, you can create a text area which has a graduated color effect to it.

setColorBottom( rgba )

rgba: a RGBA object

Sets the color of the bottom of the letters.

setFontName( name )

name: string

Uses the given font for rendering text. See Camera Molecule::loadFont.

setTiling( x, y, l )

x: float
y: float
l: int

Sets the number of times textures should repeat.

x: The number of times the texture should repeat horizontally.
y: The number of times the texture should repeat vertically.
l: The texture layer to specify (only needs to be altered if you're using a multi-texture layer material).

setUV( u1, v1, u2, v2 )

u1: float
v1: float
u2: float
v2: float

Sets the texture coordinates for the panel.

setBorderSize( l, r, t, b )

l: float
r: float
t: float
b: float

Sets the size of the border separately for all borders as a factor of the screen dimensions i.e. 0.2 is one-fifth of the screen size.

This method sets a size all borders separately. Remember that the dimensions specified here are in relation to the size of the screen, so 0.1 is 1/10th of the screen width or height. Also note that because most screen resolutions are 1.333:1 width:height ratio that using the same border size will look slightly bigger across than up.

setBorderMaterialName( name )

name: string

Sets the name of the material this element uses.
Personal tools