Raygui lib callbacks to single table.

This commit is contained in:
jussi
2024-03-21 23:18:35 +02:00
parent a7528da4eb
commit 95f03bae31
10 changed files with 568 additions and 533 deletions

View File

@@ -5,6 +5,7 @@ KEY CHANGES:
- CHANGE: Process renamed to update to be more inline with naming of raylib and common convention.
- ADDED: apiScanner.lua for searching unimplemented functions from raylib.
- ADDED Automation events.
- CHANGE: Raygui lib callbacks to single table.
DETAILED CHANGES:
- ADDED: GetBufferElementSize and GetBufferLength.

View File

@@ -3,7 +3,7 @@ Current {
Backlog {
* Raygui
* Set callbacks to single table.
* File browser.
* Raygui lib
* Check if could remove flickering from changing draw order by making queue for order
changing and only change them after everything is drawn.

View File

@@ -16,12 +16,11 @@ function Calculator:new( pos )
object.window = Gui:WindowBox(
Rect:new( pos.x, pos.y, 188, 216 ),
"Calculator",
-- Close callback.
function() object:setVisible( false ) end,
-- Grab callback.
function() object:set2Top() end,
-- Drag callback.
function( self ) object:setPosition( Vec2:new( self.bounds.x, self.bounds.y ) ) end
{ -- Callbacks.
close = function() object:setVisible( false ) end,
grab = function() object:set2Top() end,
drag = function( self ) object:setPosition( Vec2:new( self.bounds.x, self.bounds.y ) ) end
}
)
object.display = Gui:Label(
Rect:new( 0, 0, 180, 20 ),
@@ -31,22 +30,22 @@ function Calculator:new( pos )
object.buttons = {}
local buttons = {
{ "7", function() object:addNumber( 7 ) end },
{ "8", function() object:addNumber( 8 ) end },
{ "9", function() object:addNumber( 9 ) end },
{ "/", function() object:addOperation( self.OPERATIONS.DIV ) end },
{ "4", function() object:addNumber( 4 ) end },
{ "5", function() object:addNumber( 5 ) end },
{ "6", function() object:addNumber( 6 ) end },
{ "*", function() object:addOperation( self.OPERATIONS.MUL ) end },
{ "1", function() object:addNumber( 1 ) end },
{ "2", function() object:addNumber( 2 ) end },
{ "3", function() object:addNumber( 3 ) end },
{ "-", function() object:addOperation( self.OPERATIONS.SUB ) end },
{ "0", function() object:addNumber( 0 ) end },
{ "C", function() object:addOperation( self.OPERATIONS.CLEAR ) end },
{ "=", function() object:addOperation( self.OPERATIONS.EQUAL ) end },
{ "+", function() object:addOperation( self.OPERATIONS.ADD ) end },
{ "7", { pressed = function() object:addNumber( 7 ) end } },
{ "8", { pressed = function() object:addNumber( 8 ) end } },
{ "9", { pressed = function() object:addNumber( 9 ) end } },
{ "/", { pressed = function() object:addOperation( self.OPERATIONS.DIV ) end } },
{ "4", { pressed = function() object:addNumber( 4 ) end } },
{ "5", { pressed = function() object:addNumber( 5 ) end } },
{ "6", { pressed = function() object:addNumber( 6 ) end } },
{ "*", { pressed = function() object:addOperation( self.OPERATIONS.MUL ) end } },
{ "1", { pressed = function() object:addNumber( 1 ) end } },
{ "2", { pressed = function() object:addNumber( 2 ) end } },
{ "3", { pressed = function() object:addNumber( 3 ) end } },
{ "-", { pressed = function() object:addOperation( self.OPERATIONS.SUB ) end } },
{ "0", { pressed = function() object:addNumber( 0 ) end } },
{ "C", { pressed = function() object:addOperation( self.OPERATIONS.CLEAR ) end } },
{ "=", { pressed = function() object:addOperation( self.OPERATIONS.EQUAL ) end } },
{ "+", { pressed = function() object:addOperation( self.OPERATIONS.ADD ) end } },
}
local rowCount = 4
local buttonRect = Rect:new( 5, 64, 40, 32 )

View File

@@ -55,13 +55,13 @@ local function addSpriteButtons()
local buttonSize = Vec2:new( 216, 32 )
local bounds = Rect:new( winSize.x / 2 - buttonSize.x / 2, 200, 216, 32 )
local gap = buttonSize.y + 2
addButton( bounds, "Start New Game", function() print( "New Game!" ) end )
addButton( bounds, "Start New Game", { pressed = function() print( "New Game!" ) end } )
bounds.y = bounds.y + gap
addButton( bounds, "Load Game", function() print( "Load Game!" ) end )
addButton( bounds, "Load Game", { pressed = function() print( "Load Game!" ) end } )
bounds.y = bounds.y + gap
addButton( bounds, "Options", function() print( "Options!" ) end )
addButton( bounds, "Options", { pressed = function() print( "Options!" ) end } )
bounds.y = bounds.y + gap
addButton( bounds, "Quit", function() RL.CloseWindow() end )
addButton( bounds, "Quit", { pressed = function() RL.CloseWindow() end } )
end
local function getTextValue( text )
@@ -74,10 +74,10 @@ local function addPropertyList()
PropertyList = Gui:PropertyList(
Rect:new( 20, 20, 256, 328 ),
"Property List",
nil, -- Callback.
function( self ) Gui:set2Top( self ) end, -- Grab callback.
nil, -- Drag callback.
{
{ -- Callbacks.
grab = function( self ) Gui:set2Top( self ) end,
},
{ -- Styles.
properties = {
-- { RL.SCROLLBAR, RL.ARROWS_VISIBLE, RL.ARROWS_VISIBLE },
{ RL.LISTVIEW, RL.BORDER_COLOR_FOCUSED, RL.GuiGetStyle( RL.LISTVIEW, RL.BORDER_COLOR_NORMAL ) },
@@ -106,11 +106,13 @@ local function addPropertyList()
cat.dest.x,
32,
false,
function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.dest.x = self.value
end,
{ -- Callbacks.
edit = function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.dest.x = self.value
end
},
nil,
"Position X"
), transformGroup, true )
@@ -119,11 +121,13 @@ local function addPropertyList()
cat.dest.y,
32,
false,
function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.dest.y = self.value
end,
{ -- Callbacks.
edit = function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.dest.y = self.value
end
},
nil,
"Position Y"
), transformGroup )
@@ -137,11 +141,13 @@ local function addPropertyList()
cat.dest.x,
32,
false,
function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.origin.x = self.value
end,
{ -- Callbacks.
edit = function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.origin.x = self.value
end
},
nil,
"Origin X"
), transformGroup, true )
@@ -150,11 +156,13 @@ local function addPropertyList()
cat.dest.y,
32,
false,
function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.origin.y = self.value
end,
{ -- Callbacks.
edit = function( self )
self.value = getTextValue( self.text )
self.text = tostring( self.value )
cat.origin.y = self.value
end
},
nil,
"Origin Y"
), transformGroup )
@@ -166,11 +174,13 @@ local function addPropertyList()
0,
0,
360,
function( self )
self.value = Util.round( self.value )
cat.rotation = self.value
self.textRight = self.value
end,
{ -- Callbacks.
edit = function( self )
self.value = Util.round( self.value )
cat.rotation = self.value
self.textRight = self.value
end
},
nil,
"Rotation angle"
), transformGroup )
@@ -179,7 +189,9 @@ local function addPropertyList()
Rect:new( 0, 0, 20, 20 ),
"Flipped",
cat.flipped,
function( self ) cat.flipped = self.checked end,
{ -- Callbacks.
pressed = function( self ) cat.flipped = self.checked end
},
nil,
"Flips the image"
), transformGroup )
@@ -192,7 +204,9 @@ local function addPropertyList()
Rect:new( 0, 0, 20, 20 ),
"Visible",
cat.visible,
function( self ) cat.visible = self.checked end,
{ -- Callbacks.
pressed = function( self ) cat.visible = self.checked end
},
{
properties = {
{ RL.CHECKBOX, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_RIGHT },
@@ -206,7 +220,9 @@ local function addPropertyList()
Rect:new( 0, 0, 128, 128 ),
"Color Picker",
Color:new(),
function( self ) cat.tint = self.color end
{ -- Callbacks.
edit = function( self ) cat.tint = self.color end
}
), tintGroup )
PropertyList:addControl( PropertyList.gui:Line(
@@ -219,7 +235,9 @@ local function addPropertyList()
"Dog\nGiraffe\nLion\nHorse",
0,
false,
function( self ) print( self:getItem( self.active ) ) end
{ -- Callbacks.
select = function( self ) print( self:getItem( self.active ) ) end
}
) )
local test = PropertyList:addGroup( "Test", false )
@@ -229,7 +247,9 @@ local function addPropertyList()
Rect:new( 128, 0, 20, 20 ),
i.."_Visible",
false,
function( self ) print( "Checked" ) end,
{ -- Callbacks.
pressed = function( self ) print( "Checked" ) end
},
{
properties = {
-- { RL.CHECKBOX, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT },
@@ -250,10 +270,11 @@ local function addTreeView()
TreeView = Gui:TreeView(
Rect:new( 600, 20, 256, 328 ),
"Tree View",
function( controls ) selected( controls ) end, -- Callback.
function( self ) Gui:set2Top( self ) end, -- Grab callback.
nil, -- Drag callback.
{
{ -- Callbacks.
select = function( controls ) selected( controls ) end,
grab = function( self ) Gui:set2Top( self ) end,
},
{ -- Styles.
properties = {
-- { RL.SCROLLBAR, RL.ARROWS_VISIBLE, RL.ARROWS_VISIBLE },
{ RL.LISTVIEW, RL.BORDER_COLOR_FOCUSED, RL.GuiGetStyle( RL.LISTVIEW, RL.BORDER_COLOR_NORMAL ) },

View File

@@ -1,7 +1,7 @@
local PropertyList = {}
PropertyList.__index = PropertyList
function PropertyList:new( bounds, text, callback, grabCallback, dragCallback, styles, tooltip )
function PropertyList:new( bounds, text, callbacks, styles, tooltip )
local object = setmetatable( {}, self )
object._gui = nil
@@ -12,9 +12,7 @@ function PropertyList:new( bounds, text, callback, grabCallback, dragCallback, s
object.text = text
object.scroll = Vec2:new()
object.view = Rect:new()
object.callback = callback
object.grabCallback = grabCallback
object.dragCallback = dragCallback
object.callbacks = callbacks -- scroll, grab, drag.
object.styles = styles
object.tooltip = tooltip
@@ -140,8 +138,10 @@ function PropertyList:addGroup( name, active, group )
self:getDefaultBounds(),
setGroupText( name, active ),
active,
function( this ) this.text = setGroupText( name, this.active ) self:updateContent() end,
{
{ -- Callbacks.
pressed = function( this ) this.text = setGroupText( name, this.active ) self:updateContent() end,
},
{ -- Styles.
properties = {
{ RL.TOGGLE, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT }
}
@@ -194,8 +194,8 @@ function PropertyList:draw()
self:updateMouseOffset()
self.gui.view:set( -self.scroll.x, -self.scroll.y, self.view.width, self.view.height )
if self.callback ~= nil then
self.callback( self )
if self.callbacks.scroll ~= nil then
self.callbacks.scroll( self )
end
end
@@ -250,8 +250,8 @@ function PropertyList:setSize( size )
end
function PropertyList:register( gui )
function gui:PropertyList( bounds, text, callback, grabCallback, dragCallback, styles, tooltip )
return self:addControl( PropertyList:new( bounds, text, callback, grabCallback, dragCallback, styles, tooltip ) )
function gui:PropertyList( bounds, text, callbacks, styles, tooltip )
return self:addControl( PropertyList:new( bounds, text, callbacks, styles, tooltip ) )
end
end

View File

@@ -1,7 +1,7 @@
local SpriteButton = {}
SpriteButton.__index = SpriteButton
function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip )
function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip )
local object = setmetatable( {}, self )
object._gui = nil
@@ -10,7 +10,7 @@ function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, c
object.buttonTexture = texture
object.nPatchNormal = nPatchNormal
object.nPatchPressed = nPatchPressed
object.callback = callback
object.callbacks = callbacks -- pressed.
object.styles = styles
object.tooltip = tooltip
@@ -33,8 +33,8 @@ function SpriteButton:draw()
local result = RL.GuiLabelButton( self.bounds, self.text )
if result == 1 and self.callback ~= nil and self._gui:clickedInBounds( self.bounds ) then
self.callback( self )
if result == 1 and self.callbacks.pressed ~= nil and self._gui:clickedInBounds( self.bounds ) then
self.callbacks.pressed( self )
end
end
@@ -44,8 +44,8 @@ function SpriteButton:setPosition( pos )
end
function SpriteButton:register( gui )
function gui:SpriteButton( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip )
return self:addControl( SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip ) )
function gui:SpriteButton( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip )
return self:addControl( SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip ) )
end
end

View File

@@ -9,7 +9,7 @@ function TreeItem:new( bounds, text, callbacks, styles, tooltip )
object.bounds = bounds:clone()
object.text = text
object.callbacks = callbacks -- toggle, open.
object.callbacks = callbacks -- select, open.
object.controls = {}
@@ -68,8 +68,8 @@ function TreeItem:draw()
local oldActive = self.active
_, self.active = RL.GuiToggle( toggleRect, self.text, self.active )
if self.callbacks.toggle and oldActive ~= self.active then
self.callbacks.toggle( self )
if self.callbacks.select and oldActive ~= self.active then
self.callbacks.select( self )
end
if hasContainer then

View File

@@ -10,7 +10,7 @@ TreeView.MOVE_ITEM_IN = 1
TreeView.MOVE_ITEM_UP = 2
TreeView.MOVE_ITEM_DOWN = 3
function TreeView:new( bounds, text, callback, grabCallback, dragCallback, styles, tooltip )
function TreeView:new( bounds, text, callbacks, styles, tooltip )
local object = setmetatable( {}, self )
object._gui = nil
@@ -22,9 +22,7 @@ function TreeView:new( bounds, text, callback, grabCallback, dragCallback, style
object.text = text
object.scroll = Vec2:new()
object.view = Rect:new()
object.callback = callback
object.grabCallback = grabCallback
object.dragCallback = dragCallback
object.callbacks = callbacks -- select, grab, drag.
object.styles = styles
object.tooltip = tooltip
@@ -132,7 +130,7 @@ function TreeView:addItem( name, group )
name,
{ -- Callbacks.
open = function( this ) self:updateContent() end,
toggle = function( this ) self:itemSelect( this ) end,
select = function( this ) self:itemSelect( this ) end,
},
{ -- Styles.
properties = {
@@ -262,8 +260,8 @@ function TreeView:itemSelect( item )
self._lastActiveItem = item -- Old clicked.
end
if self.callback ~= nil then
-- self.callback( self.selectedItems )
if self.callbacks.select ~= nil then
self.callbacks.select( self.selectedItems )
end
end
@@ -399,8 +397,8 @@ function TreeView:setSize( size )
end
function TreeView:register( gui )
function gui:TreeView( bounds, text, callback, grabCallback, dragCallback, styles, tooltip )
return self:addControl( TreeView:new( bounds, text, callback, grabCallback, dragCallback, styles, tooltip ) )
function gui:TreeView( bounds, text, callbacks, styles, tooltip )
return self:addControl( TreeView:new( bounds, text, callbacks, styles, tooltip ) )
end
end

View File

@@ -63,12 +63,16 @@ function RL.init()
Rect:new( 68, 16, 64, 32 ),
"Cat\nDog",
0,
function( self ) print( self:getItem( self.active ) ) end
{ -- Callbacks.
select = function( self ) print( self:getItem( self.active ) ) end
}
)
local button = Gui:Button(
Rect:new( 245, 188, 64, 32 ),
"Dog",
function() toggleGroup:setText( "Dog;Cat\nEagle" ) end,
{ -- Callbacks.
pressed = function() toggleGroup:setText( "Dog;Cat\nEagle" ) end
},
{
properties = {
{ RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
@@ -82,25 +86,30 @@ function RL.init()
Rect:new( 116, 128, 20, 20 ),
"Visible",
toggleGroup.visible,
function( self ) toggleGroup.visible = self.checked end
{ -- Callbacks.
pressed = function( self ) toggleGroup.visible = self.checked end
}
)
local toggle = Gui:Toggle(
Rect:new( 32, 160, 100, 32 ),
"Toggle",
false,
nil
{} -- Callbacks.
)
local combobox = Gui:ComboBox(
Rect:new( 64, 256, 128, 32 ),
"Dog\nCow\nDonkey",
0
0,
{} -- Callbacks.
)
local dropdownbox = Gui:DropdownBox(
Rect:new( 256, 128, 128, 32 ),
"Dog\nGiraffe\nLion\nHorse",
0,
false,
function( self ) print( self:getItem( self.active ) ) end
{ -- Callbacks.
select = function( self ) print( self:getItem( self.active ) ) end
}
)
local spinner = Gui:Spinner(
Rect:new( 464, 256, 128, 32 ),
@@ -109,7 +118,9 @@ function RL.init()
0,
10,
false,
function( self ) print( "Spinner value changed to "..self.value ) end
{ -- Callbacks.
edit = function( self ) print( "Spinner value changed to "..self.value ) end
}
)
local valuebox = Gui:ValueBox(
Rect:new( 464, 316, 128, 32 ),
@@ -118,21 +129,28 @@ function RL.init()
0,
100,
false,
function( self ) print( "ValueBox value changed to "..self.value ) end
{ -- Callbacks.
edit = function( self ) print( "ValueBox value changed to "..self.value ) end
}
)
local textbox = Gui:TextBox(
Rect:new( 32, 316, 256, 32 ),
"Name",
32,
false,
function( self ) print( "Set text "..self.text ) end
{ -- Callbacks.
edit = function( self ) print( "Set text "..self.text ) end,
-- editMode = function( self ) print( "Entered edit mode" ) end
}
)
local textbox2 = Gui:TextBox(
Rect:new( 32, 380, 256, 32 ),
"Name",
32,
false,
function( self ) print( "Set text "..self.text ) end
{ -- Callbacks.
edit = function( self ) print( "Set text 2 "..self.text ) end
}
)
local slider = Gui:Slider(
Rect:new( 50, 500, 256, 32 ),
@@ -141,8 +159,10 @@ function RL.init()
0,
0,
100,
function( self ) print( "Changed value "..self.value ) end,
{
{ -- Callbacks.
edit = function( self ) print( "Changed value "..self.value ) end,
},
{ -- Styles.
texture = { texture = texture, rect = textureRect },
}
)
@@ -153,7 +173,9 @@ function RL.init()
0,
0,
100,
function( self ) print( "Changed value "..self.value ) end
{ -- Callbacks.
edit = function( self ) print( "Changed value "..self.value ) end
}
)
local progressbar = Gui:ProgressBar(
Rect:new( 50, 600, 256, 32 ),
@@ -162,7 +184,9 @@ function RL.init()
20,
0,
100,
function( self ) print( "Changed value "..self.value ) end
{ -- Callbacks.
edit = function( self ) print( "Changed value "..self.value ) end
}
)
local statusbar = Gui:StatusBar(
Rect:new( 50, 650, 256, 32 ),
@@ -176,17 +200,17 @@ function RL.init()
Rect:new( 400, 400, 256, 256 ),
"Grid",
32,
2
2,
{} -- Callbacks.
)
windowbox = Gui:WindowBox(
Rect:new( 720, 250, 256, 256 ),
"WindowBox",
-- Close callback.
function( self ) self.visible = false end,
-- Grab callback.
function( self ) Gui:set2Top( self ) end,
nil,
{
{ -- Callbacks.
close = function( self ) self.visible = false end,
grab = function( self ) Gui:set2Top( self ) end,
},
{ -- Styles.
properties = {
{ RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
},
@@ -205,10 +229,10 @@ function RL.init()
local panel = Gui:Panel(
Rect:new( 400, 64, 256, 128 ),
"Panel",
-- Grab callback.
function( self ) Gui:set2Top( self ) end,
nil,
{
{ -- Callbacks.
grab = function( self ) Gui:set2Top( self ) end
},
{ -- Styles.
properties = {
{ RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.MAGENTA ) },
{ RL.DEFAULT, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_CENTER },
@@ -220,25 +244,28 @@ function RL.init()
Rect:new( 700, 520, 700, 32 ),
"Cat;Dog;Horse;Cow;Dog;Horse;Cow",
0,
nil,
closeTab
{ -- Callbacks.
close = closeTab
}
)
local scrollpanel = Gui:ScrollPanel(
Rect:new( 800, 64, 256, 256 ),
"ScrollPanel",
Rect:new( 0, 0, 300, 600 ),
Vec2:new( 0, 0 ),
-- Callback.
function( self ) print( self.scroll ) end,
-- Grab callback.
function( self ) Gui:set2Top( self ) end
{ -- Callbacks.
scroll = function( self ) print( self.scroll ) end,
grab = function( self ) Gui:set2Top( self ) end
}
)
local listview = Gui:ListView(
Rect:new( 1100, 64, 128, 128 ),
"Cat;Dog;Horse;Cow;Pig;Eagle;Lion",
0,
0,
function( self ) print( self:getItem( self.active ) ) end
{ -- Callbacks.
select = function( self ) print( self:getItem( self.active ) ) end
}
)
local listviewex = Gui:ListViewEx(
Rect:new( 1300, 64, 128, 128 ),
@@ -246,8 +273,10 @@ function RL.init()
0,
0,
0,
function( self ) print( self:getItem( self.active ) ) end,
{
{ -- Callbacks.
select = function( self ) print( self:getItem( self.active ) ) end
},
{ -- Styles.
properties = {
{ RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
{ RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) },
@@ -261,17 +290,18 @@ function RL.init()
"Title",
"Should we disable\nwindow box?",
"No;Yes",
function( self )
if 0 < self.buttonIndex then
if self.buttonIndex == 1 then
windowbox.disabled = false
elseif self.buttonIndex == 2 then
windowbox.disabled = true
{ -- Callbacks.
pressed = function( self )
if 0 < self.buttonIndex then
if self.buttonIndex == 1 then
windowbox.disabled = false
elseif self.buttonIndex == 2 then
windowbox.disabled = true
end
end
end
end,
-- Grab callback.
function( self ) Gui:set2Top( self ) end
end,
grab = function( self ) Gui:set2Top( self ) end
}
)
local textinputbox = Gui:TextInputBox(
Rect:new( 1100, 300, 300, 128 ),
@@ -281,40 +311,47 @@ function RL.init()
"Text",
8,
false,
function( self )
if 0 < self.buttonIndex then
print( "You pressed "..self:getItem( self.buttonIndex ) )
end
end,
-- Grab callback.
function( self ) Gui:set2Top( self ) end
{ -- Callbacks.
pressed = function( self )
if 0 < self.buttonIndex then
print( "You pressed "..self:getItem( self.buttonIndex ) )
end
end,
grab = function( self ) Gui:set2Top( self ) end
}
)
local colorpicker = Gui:ColorPicker(
Rect:new( 1500, 32, 128, 128 ),
"Color Picker",
Color:new()
Color:new(),
{} -- Callbacks.
)
local colorpanel = Gui:ColorPanel(
Rect:new( 1700, 32, 128, 128 ),
"Color Panel",
Color:new()
Color:new(),
{} -- Callbacks.
)
local colorbaralpha = Gui:ColorBarAlpha(
Rect:new( 1700, 180, 128, 20 ),
"Color Panel",
1.0
1.0,
{} -- Callbacks.
)
local colorbarhue = Gui:ColorBarHue(
Rect:new( 1840, 32, 20, 128 ),
"Color Panel",
1.0
1.0,
{} -- Callbacks.
)
local scrollbar = Gui:GuiScrollBar(
Rect:new( 50, 760, 256, 16 ),
0,
0,
256,
function( self ) print( "Scrollbar value: ", self.value ) end
{ -- Callbacks.
scroll = function( self ) print( "Scrollbar value: ", self.value ) end
}
)
end

File diff suppressed because it is too large Load Diff