This repository is no longer maintained.
I am focusing on a new project, betterUI which is much better than this module. Feel free to explore this repository, but i will not update this project.
- This module is made for making better elements for LuaRT.
- It uses
canvas
module for creating new and better elements.
- All Elements listed above:
Button
CheckBox
Label
IconButton
LoadBar
RotatedLoadBar
Frame
Image
Border
Shadow
ListLayout
💡 Tip: CheckBoxes can be used like RadioButtons.
⚠️ Warning:Border
,ListLayout
andShadow
is not actual Elements.It attaches to Elements.
Example:
--Creating BetterElement_Canvas
local canvas = betterElements:newCanvas(WINDOW,{
bgcolor = 0x242424;
})
--Creating new Frame
local frame = betterElements:newFrame(canvas,{
x = 10;
y = 10;
width = 250;
height = 180;
radius = 10;
bgcolor = 0xC9C9C9FF;
visible = true;
childs = {}
})
--Adding new border to Frame
local newBorder = betterElements:setBorder(frame,{
color = 0x000000FF;
thickness = 2;
})
--Adding new shadow to Frame
local shadowOfFrame = betterElements:setShadow(frame,{
color = 0x000000FF;
thickness = 1;
visible = true;
offsetX = 0;
offsetY = 1;
})
--Check examples folder for better example.
⚠️ Warning: IconButton icons need to be32x32
for better results.
Element colors is represented by a number, an RGBA value (one byte per primary color and one byte for alpha channel).- You can use
transparency
property for this now.
Example:
local betterElements = require("betterElements")
local canvas = betterElements:newCanvas(mainWindow,{
bgcolor = 0x242424FF;
})
local frame = betterElements:newFrame(canvas,{
x = 10;
y = 10;
width = 250;
height = 180;
radius = 10;
bgcolor = 0xC9C9C9FF; --Alpha channel is FF (means it is opaque) but it will be not seen because transparency is 1.
visible = true;
transparency = 1;
childs = {}
})
--Frame CANNOT be seen.
--Check examples folder for better example.
⚠️ Warning: Elements with atransparency
value of0
can still interact with the user.You can setvisible
value tofalse
if you don't want this.
- Added
betterElements:isMouseOnElement(window,object)
function.
Usage Example:
function betterElements_Canvas:onContext()
if betterElement.isMouseOnElement(mainWindow,underPlusButton) then
require("console").writeln("Hello")
end
end
- Added
Image
element.
- Just download betterElements.lua and require it from your lua file.
- Check examples folder for examples.
📝 Information: Check screenshots folder to see difference between BetterElements and standart Elements.
⚠️ Warning: Try to not create more than oneCanvas
at the same time.You can useBetterElements:addToPaint(func)
function to add function to paint process.If you need other elements for canvas just create it from there or just edit the originalbetterElements.lua
file.
⚠️ Warning: If you are creating standart Elements,don't forget to add(element):tofront()
for making them visible.
- You can contact me from LuaRT Discord Community Server.