Immediate Mode GUI library for LÖVE
Find a file
2012-10-10 15:20:45 +02:00
.gitignore Fix file permissions 2012-02-22 22:56:10 +01:00
button.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
checkbox.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
core.lua Remove keyboard focus print 2012-09-09 19:53:49 +03:00
group.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
init.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
input.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
keyboard.lua Rename (dis|en)ableFocus() to (dis|en)able() 2012-10-10 15:20:45 +02:00
label.lua Fix #3 - Thanks martinfelis! 2012-07-30 19:27:04 +02:00
mouse.lua Fix #4: keyboard.disableFocus() not working. 2012-09-03 15:30:17 +02:00
README.md Delete now obsulete documentation 2012-05-09 21:28:46 +02:00
slider.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
slider2d.lua Mega update: Auto layout, code cleanup, api change. 2012-05-09 21:27:45 +02:00
style-default.lua Slick default style 2012-05-09 21:29:02 +02:00

QUICKIE

Quickie is an immediate mode gui library for LÖVE. Initial inspiration came from the article Sol on Immediate Mode GUIs (IMGUI). You should check it out to understand how Quickie works.

Example

local gui = require "Quickie"

-- lazy font loading
local fonts = setmetatable({}, {__index = function(t,k)
    local f = love.graphics.newFont(k)
    rawset(t, k, f)
    return f
end })

function love.load()
    love.graphics.setBackgroundColor(17,17,17)
    love.graphics.setFont(fonts[12])

    -- group defaults
    gui.group.default.size[1] = 150
    gui.group.default.size[2] = 25
    gui.group.default.spacing = 5
end

local menu_open = {
    main  = false,
    right = false,
    foo   = false,
    demo  = false
}
local check1   = {checked = false, label = "Checkbox"}
local check2   = {checked = false, label = "Another one"}
local input    = {text = ""}
local slider   = {value = .5}
local slider2d = {value = {.5,.5}}
function love.update(dt)
    gui.group.push{grow = "down", pos = {5,5}}
    if gui.Button{text = "Menu"} then
        menu_open.main = not menu_open.main
    end

    if menu_open.main then
        gui.group.push{grow = "right"}
        if gui.Button{text = "Group stacking"} then
            menu_open.right = not menu_open.right
        end

        if menu_open.right then
            gui.group.push{grow = "up"}
            if gui.Button{text = "Foo"} then
                menu_open.foo = not menu_open.foo
            end
            if menu_open.foo then
                gui.Button{text = "???"}
            end
            gui.group.pop{}

            gui.Button{text = "Bar"}
            gui.Button{text = "Baz"}
        end
        gui.group.pop{}

        if gui.Button{text = "Widget demo"} then
            menu_open.demo = not menu_open.open
        end

    end
    gui.group.pop{}

    if menu_open.demo then
        gui.group.push{grow = "down", pos = {200, 80}}

        love.graphics.setFont(fonts[20])
        gui.Label{text = "Widgets"}
        love.graphics.setFont(fonts[12])
        gui.group.push{grow = "right"}
        gui.Button{text = "Button"}
        gui.Button{text = "Tight Button", size = {"tight"}}
        gui.Button{text = "Tight² Button", size = {"tight", "tight"}}
        gui.group.pop{}

        gui.group.push{grow = "right"}
        gui.Button{text = "", size = {2}}
        gui.Label{text = "Tight Label", size = {"tight"}}
        gui.Button{text = "", size = {2}}
        gui.Label{text = "Center Label", align = "center"}
        gui.Button{text = "", size = {2}}
        gui.Label{text = "Another Label"}
        gui.Button{text = "", size = {2}}
        gui.group.pop{}

        gui.group.push{grow = "right"}
        gui.Checkbox{info = check1, size = {"tight"}}
        gui.Checkbox{info = check2}
        gui.group.pop{}

        gui.group.push{grow = "right"}
        gui.Label{text = "Input", size = {70}}
        gui.Input{info = input, size = {300}}
        gui.group.pop{}

        gui.group.push{grow = "right"}
        gui.Label{text = "Slider", size = {70}}
        gui.Slider{info = slider}
        gui.Label{text = ("Value: %.2f"):format(slider.value), size = {70}}
        gui.group.pop{}

        gui.Label{text = "2D Slider", pos = {nil,10}}
        gui.Slider2D{info = slider2d, size = {250, 250}}
        gui.Label{text = ("Value: %.2f, %.2f"):format(slider2d.value[1], slider2d.value[2])}

    end
end

function love.draw()
    gui.core.draw()
end

function love.keypressed(key, code)
    gui.keyboard.pressed(key, code)
end

Documentation

To be done...

License

Copyright (c) 2012 Matthias Richter

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.