1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# QUICKIE
Quickie is an [immediate mode gui][IMGUI] library for [LÖVE][LOVE]
## Example
local gui = require 'quickie'
-- widgets are "created" by calling their corresponding functions in love.update.
-- if you want to remove a widget, simply don't call the function (just like with
-- any other love drawable). widgets dont hold their own state - this is your job:
--
-- sliders have a value and optional a minimum (default = 0) and maximum (default = 1)
local slider = {value = 10, min = 0, max = 100}
-- input boxes have a text and a cursor position (defaults to end of string)
local input = {text = "Hello, World!", cursor = 0}
-- checkboxes have only a `checked' status
local checkbox = {checked = false}
function love.update(dt)
-- widgets are defined by simply calling them. usually a widget returns true if
-- if its value changed or if it was activated (click on button, ...)
if gui.Input(input, 10, 10, 300, 20) then
print('Text changed:', input.text)
end
if gui.Button('Clear', 320,10,100,20) then
input.text = ""
end
-- add more widgets here
end
function love.draw()
-- draw the widgets which were "created" in love.update
gui.core.draw()
end
function love.keypressed(key,code)
-- forward keyboard events to the gui. If you don't want widget tabbing and
-- input widgets, skip this line
gui.core.keyboard.pressed(key, code)
end
## Documentation
TODO
[LOVE]: http://love2d.org
[IMGUI]: http://www.mollyrocket.com/forums/viewforum.php?f=10
|