» Back To Index
Demoniak3D/LUA API: HUDs handling library
The
HYP_Hud library offers general functionalities on HUDs of the 3d scene.
HYP_Hud.DoFadeInOut
HYP_Hud.ProgressiveDisplay
HYP_Hud.ProgressiveUnDisplayWithStretch
HYP_Hud.GetVertexColor
HYP_Hud.GetVertexPosition
HYP_Hud.SetVertexColor
HYP_Hud.SetVertexPosition
HYP_Hud.SetSize
HYP_Hud.GetSize
HYP_Hud.PushVertices
HYP_Hud.PopVertices
HYP_Hud.SetVertexTexCoord
HYP_Hud.GetVertexTexCoord
HYP_Hud.Create
HYP_Hud.Destroy
DoFadeInOut
DoFadeInOut allows to create an effect of fade-in/fade-out in order to ease transitions in a scene.
Syntax
HYP_Hud.DoFadeInOut( name, time );
- name - [STR127] - character string representing the "name" of the hud specified in the XML script by the name attribute.
- time - [INTEGER] - fade-in and fade-out duration in milliseconds.
SetVertexPosition
SetVertexPosition allows to change the position of one of the 4 vertices of the HUD.
Remember: the 4 vertices of a HUD are divided as follows:
2 +----------------------+ 3
| |
| |
| |
| |
| |
0 +----------------------+ 1
Syntax
HYP_Hud.SetVertexPosition( name, index, x, y, z );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- index - [REAL] - vertex index. Value between 0 and 3.
- x - [REAL] - X coordinate of the vertex.
- y - [REAL] - Y coordinate of the vertex.
- z - [REAL] - Z coordinate of the vertex.
GetVertexPosition
GetVertexPosition allows to get the position of one vertex of the 4 vertices of HUD.
Syntax
x, y, z = HYP_Hud.GetVertexPosition( name, index );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- index - [REAL] - vertex index. Value between 0 and 3.
- x - [REAL] - X coordinate of the vertex.
- y - [REAL] - Y coordinate of the vertex.
- z - [REAL] - Z coordinate of the vertex.
SetVertexColor
SetVertexColor allows to change the color of the 4 vertices of the HUD.
Remember: the 4 vertices of a HUD are divided as follows:
2 +----------------------+ 3
| |
| |
| |
| |
| |
0 +----------------------+ 1
Syntax
HYP_Hud.SetVertexColor( name, vertex_index, r, g, b, a );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- index - [REAL] - vertex index. Value between 0 and 3.
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
- a - [CLAMPED_REAL] - alpha component of the color.
GetVertexColor
GetVertexColor allows to get the color of the 4 vertices of the HUD.
Syntax
r, g, b, a = HYP_Hud.GetVertexColor( name, vertex_index );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- index - [REAL] - vertex index. Value between 0 and 3.
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
- a - [CLAMPED_REAL] - alpha component of the color.
ProgressiveDisplay
ProgressiveDisplay allows to display progressively a HUD of which the render_state has previously been changed to FALSE.
Syntax
HYP_Hud.ProgressiveDisplay( name, delay );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- delay - [INTEGER] - displaying delay in milliseconds.
ProgressiveUnDisplayWithStretch
ProgressiveUnDisplayWithStretch allows to hide progressively a HUD of which the render_state has previously been changed to TRUE.
Syntax
HYP_Hud.ProgressiveUnDisplayWithStretch( name, delay, stretch_mode );
- name - [STR127] - character string representing the name of the hud specified in the XML script by the "name" attribute
- delay - [INTEGER] - displaying delay in milliseconds.
- stretch_mode - [INTEGER] - disappearance mode by stretching. Follow values are accepted:
- 0: no stretching, normal disappearance.
- 1: horizontal stretching.
- 2: vertical stretching.
Example
NO_STRETCH = 0;
HORIZONTAL_STRETCH = 1;
VERTICAL_STRETCH = 2;
HYP_Hud.ProgressiveDisplay( "hud_dream", 1000 );
HYP_Hud.ProgressiveUnDisplayWithStretch( "hud_hyperion", 1000, HORIZONTAL_STRETCH );
HYP_ParticleSystem.Enable( "particle_system_1" );
SetSize
SetSize allows to set the dimensions of a HUD.
Syntax
HYP_Hud.SetSize( name|id, w, h );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- w - [REAL] - width (X direction) of the HUD.
- h - [REAL] - height (Y direction) of the HUD.
GetSize
GetSize allows to get the dimensions of a HUD.
Syntax
w, h = HYP_Hud.GetSize( name|id );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- w - [REAL] - width (X direction) of the HUD.
- h - [REAL] - height (Y direction) of the HUD.
PushVertices
PushVertices allows to save the 4 vertices of a HUD into the internal registry. A call to PopVertices
will restore them later.
Syntax
HYP_Hud.PushVertices( name|id, [vertex_attrib] );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- vertex_attrib - [INTEGER] - lets specify which vertex attributes are to be pushed:
- VERTEX_ATTRIB_POSITION = 1
- VERTEX_ATTRIB_NORMAL = 2
- VERTEX_ATTRIB_UVMAP = 4
- VERTEX_ATTRIB_COLOR = 8
- VERTEX_ATTRIB_ALL = 15 (default value)
PopVertices
PopVertices allows to restore the 4 vertices of a HUD that have been saved by the PushVertices function.
Syntax
HYP_Hud.PopVertices( name|id, [vertex_attrib] );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- vertex_attrib - [INTEGER] - lets specify which vertex attributes are to be poped:
- VERTEX_ATTRIB_POSITION = 1
- VERTEX_ATTRIB_NORMAL = 2
- VERTEX_ATTRIB_UVMAP = 4
- VERTEX_ATTRIB_COLOR = 8
- VERTEX_ATTRIB_ALL = 15 (default value)
SetVertexTexCoord
SetVertexTexCoord allows to change the texture coordinates of the HUD vertices.
Syntax
HYP_Hud.SetVertexTexCoord( name|id, vertex, u, v, tu );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- vertex - [INTEGER] - vertex index. Value ranging between 0 and 3.
- u - [REAL] - u texture coordinate.
- v - [REAL] - v texture coordinate.
- tu - [INTEGER] - texture unit. Value ranging between 0 and 7.
GetVertexTexCoord
GetVertexTexCoord allows to get the texture coordinates of the HUD vertices.
Syntax
u, v = HYP_Hud.GetVertexTexCoord( name|id, vertex, tu );
- id - [INTEGER] - identifier of the hud.
- name - [STR64] - name of the hud.
- vertex - [INTEGER] - vertex index. Value ranging between 0 and 3.
- u - [REAL] - u texture coordinate.
- v - [REAL] - v texture coordinate.
- tu - [INTEGER] - texture unit. Value ranging between 0 and 7.
Create
Create allows to create a HUD.
Syntax
id = HYP_Hud.Create( name );
- id - [INTEGER] - hud identifier.
- name - [STR64] - hud name.
Destroy
Destroy allows to destroy HUD.
Syntax
HYP_Hud.Destroy( name|id );
- id - [INTEGER] - hud identifier.
- name - [STR64] - hud name.