Here's a function that takes a Unicode code point and returns the corresponding UTF-8 encoded character bytes. Example:
utf8.encode(0x265c) -- returns '♜'
Please feel free to edit or revert if it's not your style. It might not be relevant to Quickie, though it's a handy UTF-8 utility.
1) [input.lua] Pressing backspace while the cursor was at the beggining
of the text removed the first character. Fixed thanks to riidom.
2) [LÖVE 0.9] Use setLine(Width|Style) instead of setLine. Split
keyboard.pressed() into keyboard.pressed() and keyboard.textinput().
(see readme)
3) [utf8.lua] Add support for UTF-8 text editing. May still fail
spectacurlarly with invalid UTF-8 strings.
When clicked, Button() and Input() return the respective mouse button
constant ('l', 'r', 'm') instead of just true.
When activated by keyboard, Button() and Input() return 'return'.
Otherwise Button() and Input() return false.
Changes to default-style.lua:
Prevent text from being drawn past bounding box via love.graphics.setScissor().
The cursor and surrounding text are kept in visible range by calculating a draw offset.
Made a marginally simpler & more readable Slider draw routine using rectangles instead of lines.
Also the ends of the slider "track" are capped now. I split this commit in case a rollback is desired.
Slider, when vertical, was drawing the grab box with inverted position. Center "track" had incorrect orientation.
Also, slider.lua was passing a bunk table to group.getRect().
Remove `info' table. The user is responsible for updating the checking
condition. Old style:
checkbox = {checked = true, label = "foo", align = "left"}
(...)
gui.Checkbox{info = checkbox}
New style:
checked = false
(...)
if gui.Checkbox{checked = checked, text = "foo", align = "left"} then
checked = not checked
end
Also note that `label' is renamed to `text'.
Convenience function that wraps func() in a push/pop pair, i.e.
gui.group{grow=grow, spacing=spacing, size=size, pos=pos, function()
do_stuff()
end}
is equivalent to
gui.group.push{grow=grow, spacing=spacing, size=size, pos=pos}
do_stuff()
gui.group.pop()