summaryrefslogtreecommitdiff
path: root/examples/gui/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gui/main.lua')
-rw-r--r--examples/gui/main.lua76
1 files changed, 37 insertions, 39 deletions
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index e569b0a..97c18ad 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -20,94 +20,92 @@ local colorPicker = { color = { 255, 255, 255 } }
local colorPanel = { color = { 255, 255, 255 }, alpha = 1.0, hue = 1.0, oldHue = 1.0 }
local comboBoxActive = 0
-function init()
+function RL.init()
local monitor = 0
- local mPos = RL_GetMonitorPosition( monitor )
- local mSize = RL_GetMonitorSize( monitor )
+ local mPos = RL.GetMonitorPosition( monitor )
+ local mSize = RL.GetMonitorSize( monitor )
local winSize = { 1920, 1080 }
- RL_GuiSetFont( 0 )
- RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
- RL_SetWindowState( FLAG_VSYNC_HINT )
- RL_SetWindowSize( winSize )
- RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
+ RL.GuiSetFont( 0 )
+ RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
+ RL.SetWindowState( RL.FLAG_VSYNC_HINT )
+ RL.SetWindowSize( winSize )
+ RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
end
-function process( delta )
+function RL.process( delta )
end
-function draw()
- RL_ClearBackground( { 50, 20, 75 } )
+function RL.draw()
+ RL.ClearBackground( { 50, 20, 75 } )
- -- if RL_GuiButton( { 112, 16, 96, 32 }, "Exit" ) then
- if RL_GuiButton( { 112, 16, 96, 32 }, RL_GuiIconText( 113, "Exit" ) ) then
- RL_CloseWindow()
+ if RL.GuiButton( { 112, 16, 96, 32 }, RL.GuiIconText( 113, "Exit" ) ) then
+ RL.CloseWindow()
end
- if windowOpen and RL_GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then
+ if windowOpen and RL.GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then
windowOpen = false
end
- RL_GuiPanel( { 60, 260, 100, 100 }, "Panel" )
+ 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 )
+ index = RL.GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
+ checkbox = RL.GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
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 )
-
+ textBoxToggle, textBoxText = RL.GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive )
+ -- textBoxToggle, textBoxText = RL.GuiTextBoxMulti( { 32, 400, 120, 64 }, textBoxText, 120, textBoxActive )
+
if textBoxToggle 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 )
+ 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
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] )
+ scrollbarValue = RL.GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 )
local dropdownToggle = false
- dropdownToggle, dropdownValue = RL_GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive )
+ dropdownToggle, dropdownValue = RL.GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive )
if dropdownToggle then
dropdownActive = not dropdownActive
end
- listView.item, listView.scroll = RL_GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item )
- -- listViewEx.item, listViewEx.scroll, listViewEx.focus = RL_GuiListViewEx( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listViewEx.focus, listViewEx.scroll, listViewEx.item )
- messageBox.buttonIndex = RL_GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
+ 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" )
if 0 <= messageBox.buttonIndex then
print( "messageBox.buttonIndex", messageBox.buttonIndex )
end
textInputBox.buttonIndex, textInputBox.text, textInputBox.secretViewActive
- = RL_GuiTextInputBox( { 420, 510, 300, 150 }, "Input Box", "Put text here", "Button",textInputBox.text, 200, 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 )
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 )
+ colorPanel.color = RL.ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
end
-
- RL_GuiDrawIcon( 121, { 6, 20 }, 2, WHITE )
- comboBoxActive = RL_GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
+ RL.GuiDrawIcon( 121, { 6, 20 }, 2, RL.WHITE )
+
+ comboBoxActive = RL.GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
end