Gly Game Engine 0.0.11
Game engine in lua
Loading...
Searching...
No Matches
Ui

Functions

local function add (application, size)
 
local function add_items (applications)
 
local function get_item (id)
 
local function style (classlist)
 
local function next ()
 
local function back ()
 

Detailed Description

Grid System

The grid system is very versatile, and adjusts itself with the resolution and can be used by nesting one grid inside another, the best of all is that in frameworks that limit you to thinking in 12 or 24 columns like bootstrap you must define how many columns yourself.
Example
local function init(std, data)
std.ui.grid('4x8 full6x8 ultra8x8')
:add_items(list_of_widgets)
end
local function add_items(applications)
Breakpoints
Todo
comming soon
1seg SD 480 HD 720 FULL HD 1080 QUAD HD 1440 ULTRA HD 4K
prefix sd hd full quad ultra
width >0px >679px >1279px >1919px >2569px >3839px
Offset
To create blank columns, simply add an empty table {} to represent an empty node. You can also specify the size of these whitespace columns as needed.
std.ui.grid('3x2')
:add({}, 2)
:add(btn0)
:add(btn1)
:add(btn2)
:add(btn3)
:apply()
local function add(application, size)
Columns

You can add several different items to your grid: classes, nodes, offsets, entire applications and even another grid.

  • class
    local btn = {
    draw=function(std, data)end
    }
    std.ui.grid('1x1'):add(btn)
  • node
    local btn_node = std.node.load(btn)
    std.ui.grid('1x1'):add(node_btn)
  • offset
    std.ui.grid('1x1'):add({})
  • application
    local game = {
    meta={
    title='pong'
    },
    callbacks={
    init=function() end,
    loop=function() end,
    draw=function() end,
    exit=function() end
    }
    }
    std.ui.grid('1x1'):add(game)
    local function exit()
    local function title(window_name)
  • grid
    std.ui.grid('1x1')
    :add(std.ui.grid('1x1')
    :add(btn)
    )
    :apply()

Slide System

also known as carousel, it has similar behavior to grid but with visual selection of items. but it only accepts one-dimensional grids such as 1x1 2x1 or 1x2 .

Example
std.ui.slide('6x1')
:add_items(my_items)
:apply()

Style

there is a css style componetization style, you define the name of a class and define fixed attributes or you can pass functions.
Attributes
  • pos_x
  • pos_y
  • width
  • height
Example
std.ui.style('home')
:height(300)
:pos_y(function(std, node, parent)
return parent.data.height - 300
end)
std.ui.style('center')
:pos_x(function(std, node, parent)
return parent.data.width/2 - node.data.width/2
end)
std.ui.grid('3x1')
:style('center home')
:add(item1)
:add({})
:add(item2)
local function style(classlist)

Function Documentation

◆ add()

local function add ( application ,
size  )
Parameters
[in,out]applicationnew column
[in]sizecolumn width in blocks

◆ add_items()

local function add_items ( applications )
Parameters
[in,out]listof application columns

◆ back()

local function back ( )
Precondition
avaliable only in the std.ui.slide
Example
std.ui.slide('1x6'):add_items(items):back():apply()
local function back()

◆ get_item()

local function get_item ( id )
Parameters
[in]iditem index
Returns
node

◆ next()

local function next ( )
Precondition
avaliable only in the std.ui.slide
Example
std.ui.slide('6x1'):add_items(items):next(2):apply()
local function next()

◆ style()

local function style ( classlist )