-
-
Notifications
You must be signed in to change notification settings - Fork 26
Setup
Integrating Slab into an existing project is designed to be very simple. Below is an example of a simple window rendering a "Hello World" text field. The only functions that are necessary to be called are Slab.Initialize, Slab.Update, and Slab.Draw. Other functions such as wheelmoved and textinput are handled by Slab and will re-route those calls to the Love defined version of the function.
local Slab = require 'Slab'
function love.load(args)
love.graphics.setBackgroundColor(0.4, 0.88, 1.0)
Slab.Initialize(args)
end
function love.update(dt)
Slab.Update(dt)
Slab.BeginWindow('MyFirstWindow', {Title = "My First Window"})
Slab.Text("Hello World")
Slab.EndWindow()
end
function love.draw()
Slab.Draw()
end
Below is a list of functions associated with setting up Slab.
Initializes Slab and hooks into the required events. This function should be called in love.load.
Parameter | Type | Description |
---|---|---|
args | Table | The list of parameters passed in by the user on the command-line. This should be passed in from love.load function. |
Option | Type | Description |
---|---|---|
NoMessages | String | Disables the messaging system that warns developers of any changes in the API. |
NoDocks | String | Disables all docks. |
Retrieves the current version of Slab being used as a string.
Return | Description |
---|---|
String | String of the current Slab version. |
Retrieves the current version of Love being used as a string.
Return | Description |
---|---|
String | String of the current Love version. |
Updates the input state and states of various widgets. This function must be called every frame. This should be called before any Slab calls are made to ensure proper responses to Input are made.
Parameter | Type | Description |
---|---|---|
dt | Number | The delta time for the frame. This should be passed in from love.update. |
This function will execute all buffered draw calls from the various Slab calls made prior. This function should be called from love.draw and should be called at the very to ensure Slab is rendered above the user's workspace.