Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
ui Class Reference

#include <LUA_API_UI.h>

Public Member Functions

void newText (string lable_ID, posx, posy)
 This function creates a new text lable set to the position passed in the argument. More...
 
void text (string lable_ID, string text)
 Change the lables text to the contents passed in the argument text. More...
 
void setFontSize (int size)
 Sets the font to a new size. More...
 
int setColor (string lable_ID, float r, float g, float b)
 Sets the color of the text to the color specified in the arguments rgb. More...
 
int enableDefaultUI (int state)
 Use this function to set the visibility of the Default Editor UI. More...
 
int setLayerVisible (string lable_ID, int state)
 This function can set the visibility of the text lable. More...
 
int setLayer (string layer_ID)
 By calling this function you set the layer to be used for any proceeding text processes. More...
 
void newLayer (string layer_ID)
 Use this function to create a new text layer. Once created any new text opertations will be performed to this layer. More...
 
void deleteLayer (string layer_ID)
 Delete the specified layer. More...
 

Detailed Description

The following ui functions can be used to display basic game play data, very light weight and handy when prototyping a game idea.
Use as ui.function()
For more information on how these functions can be used please visit the User Manual - https://home.aurasoft-skyline.co.uk

Here is an example script file that shows UI Layer in use.
Use the Keys :
J - make UI1 Layer visible and UI2 Layer invisible.
K - make UI1 Layer invisible and UI2 Layer visible.
L - show both UI1 Layer and UI2 Layer.
M - Delete UI2 Layer.

obj         = 0 -- | Define a variable for our object ID

function onInit(objID)
    obj = objID;

    ui.newLayer("ui1");
    ui.setLayer("ui1");
    ui.setFontSize(14);
    ui.newText("ui1",100,100); 
    ui.setColor("ui1", 1, 0, 0);
    ui.text("ui1", "NEW TEXT 1");
    ui.setLayerVisible("ui1",1);
    
    ui.enableDefaultUI(0);
    
    ui.newLayer("ui2");
    ui.setLayer("ui2");
    ui.setFontSize(14);
    ui.newText("ui2",10,10); 
    ui.setColor("ui2", 0, 1, 0);
    ui.text("ui2", "NEW TEXT 2");
    ui.setLayerVisible("ui2",0);    
end

function onKeyDown( key )
    if(key=="j") then
        ui.setLayerVisible("ui1",1);
        ui.setLayerVisible("ui2",0);
    end
    
    if(key=="k") then
        ui.setLayerVisible("ui1",0);
        ui.setLayerVisible("ui2",1);
    end
    
    if(key=="l") then
        ui.setLayerVisible("ui1",1);
        ui.setLayerVisible("ui2",1);
    end
    
    if(key=="m") then
        ui.deleteLayer("ui2");
    end
end

function onStop()
    ui.enableDefaultUI(1);
    ui.setLayerVisible("ui1",0);
    ui.setLayerVisible("ui2",0);
end

Member Function Documentation

void ui::deleteLayer ( string  layer_ID)

Delete the specified layer.

Parameters
layer_ID: The layer id to delete.

The following is a Small Example on how to use this function:

function onInit(objID)
    layer_ID = "ui2";
    ui.deleteLayer(layer_ID);
end
int ui::enableDefaultUI ( int  state)

Use this function to set the visibility of the Default Editor UI.

Parameters
state:Set state to 0 = disable, 1 = enable

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.enableDefaultUI(1);
end
void ui::newLayer ( string  layer_ID)

Use this function to create a new text layer. Once created any new text opertations will be performed to this layer.

Parameters
layer_ID: The layer id to create.

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.newLayer("ui2");
end
void ui::newText ( string  lable_ID,
posx  ,
posy   
)

This function creates a new text lable set to the position passed in the argument.

Parameters
lable_ID:Provide a lable id to the lable that you want to change.
posx:Screen X position to place the text
posy:Screen Y position to place the text

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.newText("ui",10,10); 
end
int ui::setColor ( string  lable_ID,
float  r,
float  g,
float  b 
)

Sets the color of the text to the color specified in the arguments rgb.

Parameters
lable_ID: The id name of the lable.
r:The red component of the color
g:The green component of the color
b:The blue component of the color

To Set the Color of the text, you will need to call this function before calling ui.text();

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.setColor("lable_ID", r, g, b);
end
void ui::setFontSize ( int  size)

Sets the font to a new size.

Parameters
size:size to set the font

Available Sizes:
size = 9
size = 14
size = 24
To set the Font Size of a new Text Label. You will need to call this function first and then call ui.newText();

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.setFontSize(14);
end
int ui::setLayer ( string  layer_ID)

By calling this function you set the layer to be used for any proceeding text processes.

Parameters
layer_ID: The layer id to set proceeding text operations to.

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.setLayer("ui2");
end
int ui::setLayerVisible ( string  lable_ID,
int  state 
)

This function can set the visibility of the text lable.

Parameters
lable_ID: The id name of the lable.
state:Set state to 0 = hide, 1 = show

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.setLayerVisible(lable_ID,1);
end
void ui::text ( string  lable_ID,
string  text 
)

Change the lables text to the contents passed in the argument text.

Parameters
lable_ID:Set the name of the lable you would like to access.
text:The text to displayed on the screen

The following is a Small Example on how to use this function:

function onInit(objID)
    ui.text("ui", "My new Text!");
end

The documentation for this class was generated from the following file: