Files
Basalt/docs/objects/Basalt.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

2.6 KiB

This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt.

Before you can access Basalt, you need to add the following code on top of your file:

local basalt = require("basalt")

What this code does is it loads basalt into the basalt variable. You are now able to access the following list of methods:

autoUpdate Starts the event and draw listener
createFrame Creates a new base frame
debug Writes something into the debug console
getFrame Returns a frame object by it's id
getActiveFrame Returns the currently active base frame
getTheme Returns the currently active theme
getVariable Returns a variable defined with setVariable
getVersion Returns the Basalt version
isKeyDown Returns if the key is held down
log Writes something into the log file
memory Returns the current memory usage of Basalt
onEvent Event listener
removeFrame Removes a previously created base frame
schedule Schedules a new task
setActiveFrame Sets the active frame
setTheme Changes the base theme of basalt
setMouseDragThrottle Changes the mouse drag throttle amount
setMouseMoveThrottle CraftOS-PC: Changes the mouse move throttle amount
setRenderingThrottle Sets the rendering throttle amount
setVariable Sets a variable which you can access via XML
stopUpdate / stop Stops the currently active event and draw listener
update Starts the event and draw listener once

Examples

Here is a Lua example on how to create an empty base frame and start Basalt's listener.

local basalt = require("basalt") -- Loads Basalt into our project

local main = basalt.createFrame() -- Creates a base frame. On that frame, we are able to add objects

-- Here we would add additional objects

basalt.autoUpdate() -- Starts listening to incoming events and draw stuff on the screen. This should nearly always be the last line.