Raygui updated to version 4.0.

This commit is contained in:
jussi
2023-11-21 23:34:47 +02:00
parent 01883035b0
commit 85a48cf093
18 changed files with 4141 additions and 2756 deletions

View File

@@ -8,17 +8,18 @@ local spinnerActive = false
local spinnerValueRange = { 0, 10 }
local sliderValue = 5.0
local sliderValueRange = { 0.0, 10.0 }
local scrollbarValue = 0.0
local dropdownValue = 0
local dropdownActive = false
local index = 0
local listView = { item = 0, scroll = 0 }
local listViewEx = { item = 0, scroll = 0, focus = 0 }
local messageBox = { buttonIndex = -1 }
local textInputBox = { buttonIndex = 0, text = "", secretViewActive = 1 }
local textInputBox = { buttonIndex = 0, text = "", secretViewActive = false }
local colorPicker = { color = { 255, 255, 255 } }
local colorPanel = { color = { 255, 255, 255 }, alpha = 1.0, hue = 1.0, oldHue = 1.0 }
local comboBoxActive = 0
local scrollPanel = { scroll = { 0, 0 }, view = { 0, 0, 320, 200 } }
local guiTabBarActive = 0
local colorPickerHSV = { 0, 0, 0 }
local colorPanelHSV = { 0, 0, 0 }
function RL.init()
local monitor = 0
@@ -36,79 +37,86 @@ end
function RL.draw()
RL.ClearBackground( { 50, 20, 75 } )
local result = 0
-- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 10 )
if RL.GuiButton( { 112, 16, 96, 32 }, RL.GuiIconText( 113, "Exit" ) ) then
if RL.GuiButton( { 112, 16, 96, 32 }, RL.GuiIconText( 113, "Exit" ) ) == 1 then
RL.CloseWindow()
end
-- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 )
RL.GuiButton( { 112, 64, 96, 32 }, RL.GuiIconText( 113, "Cat" ) )
-- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 10 )
RL.GuiButton( { 112, 64, 96, 32 }, RL.GuiIconText( 100, "Cat" ) )
if windowOpen and RL.GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then
if windowOpen and RL.GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) == 1 then
windowOpen = false
end
RL.GuiPanel( { 60, 260, 100, 100 }, "Panel" )
toggled = RL.GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
index = RL.GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
checkbox = RL.GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
_, toggled = RL.GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
local textBoxToggle = false
textBoxToggle, textBoxText = RL.GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive )
-- textBoxToggle, textBoxText = RL.GuiTextBoxMulti( { 32, 400, 120, 64 }, textBoxText, 120, textBoxActive )
_, index = RL.GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
_, checkbox = RL.GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
if textBoxToggle then
result, textBoxText = RL.GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive )
if result == 1 then
textBoxActive = not textBoxActive
end
local spinnerToggle = false
spinnerToggle, spinnerValue = RL.GuiSpinner( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive )
-- spinnerToggle, spinnerValue = RL.GuiValueBox( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive )
if spinnerToggle then
result, spinnerValue = RL.GuiSpinner( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive )
if result == 1 then
spinnerActive = not spinnerActive
end
sliderValue = RL.GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] )
scrollbarValue = RL.GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 )
_, sliderValue = RL.GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] )
local dropdownToggle = false
dropdownToggle, dropdownValue = RL.GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive )
if dropdownToggle then
result, dropdownValue = RL.GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive )
if result == 1 then
dropdownActive = not dropdownActive
end
listView.item, listView.scroll = RL.GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item )
messageBox.buttonIndex = RL.GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
_, listView.scroll, listView.item = RL.GuiListView( { 200, 400, 200, 200 }, "Cat;Elefant;Squirrel", listView.scroll, listView.item )
if 0 <= messageBox.buttonIndex then
print( "messageBox.buttonIndex", messageBox.buttonIndex )
result = RL.GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes;No" )
if 0 <= result then
print( "messageBox.buttonIndex", result )
end
textInputBox.buttonIndex, textInputBox.text, textInputBox.secretViewActive
result, textInputBox.text, textInputBox.secretViewActive
= RL.GuiTextInputBox( { 420, 510, 300, 150 }, "Input Box", "Put text here", "Button", textInputBox.text, 200, textInputBox.secretViewActive )
if 0 <= textInputBox.buttonIndex then
print( "textInputBox.buttonIndex", textInputBox.buttonIndex )
if 0 <= result then
print( "textInputBox.buttonIndex", result )
end
colorPicker.color = RL.GuiColorPicker( { 620, 20, 150, 150 }, "Color Picker", colorPicker.color )
_, colorPicker.color = RL.GuiColorPicker( { 620, 20, 150, 150 }, "Color Picker", colorPicker.color )
colorPanel.color = RL.GuiColorPanel( { 820, 20, 150, 150 }, "Color Panel", colorPanel.color )
colorPanel.alpha = RL.GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha )
colorPanel.hue = RL.GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
_, colorPanel.color = RL.GuiColorPanel( { 820, 20, 150, 150 }, "Color Panel", colorPanel.color )
_, colorPanel.alpha = RL.GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha )
_, colorPanel.hue = RL.GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
if colorPanel.hue ~= colorPanel.oldHue then
colorPanel.oldHue = colorPanel.hue
colorPanel.color = RL.ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
end
RL.GuiDrawIcon( 121, { 6, 20 }, 2, RL.WHITE )
RL.GuiDrawIcon( 121, { 6, 80 }, 2, RL.BLACK )
comboBoxActive = RL.GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
_, comboBoxActive = RL.GuiComboBox( { 5, 150, 80, 20 }, "One;Two;Three", comboBoxActive )
result, scrollPanel.scroll, scrollPanel.view = RL.GuiScrollPanel(
{ 64, 640, 320, 200 },
"Scroll panel",
{ 0, 0, 640, 400 },
scrollPanel.scroll,
scrollPanel.view
)
_, guiTabBarActive = RL.GuiTabBar(
{ 420, 680, 320, 32 },
RL.GuiIconText( 13, "Play" )..";"..RL.GuiIconText( 12, "Cat.png" )..";"..RL.GuiIconText( 16, "Files" ),
guiTabBarActive
)
_, colorPickerHSV = RL.GuiColorPickerHSV( { 1024, 20, 150, 150 }, "GuiColorPuckerHSV", colorPickerHSV )
_, colorPanelHSV = RL.GuiColorPanelHSV( { 1230, 20, 150, 150 }, "GuiColorPuckerHSV", colorPanelHSV )
end