Skip to content
coding_jackalope edited this page Aug 30, 2020 · 23 revisions
Table of Contents

Slab

Slab is an immediate mode GUI toolkit for the Love 2D framework. This library is designed to allow users to easily add this library to their existing Love 2D projects and quickly create tools to enable them to iterate on their ideas quickly. The user should be able to utilize this library with minimal integration steps and is completely written in Lua and utilizes the Love 2D API. No compiled binaries are required and the user will have access to the source so that they may make adjustments that meet the needs of their own projects and tools. Refer to main.lua and SlabTest.lua for additional example usage of this library.

This page will be the central navigation point for all the documentation associated with Slab. Return back here if documentation for other pages is desired.

Integration

Integrating Slab into an existing project is 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

Slab Test

This is a module that can be used as a reference point for information on controls and how they can be implemented.

Documentation

Below will be links to documentation for specific controls and functions available in Slab. Refer to these pages for more in-depth information about each control.

Clone this wiki locally