Merge branch 'master' of git://github.com/vrld/Quickie.git

This commit is contained in:
mkosler 2012-02-21 12:50:21 -06:00
commit d51babb366
9 changed files with 12 additions and 31 deletions

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
-- the widget -- the widget
return function(title, x,y, w,h, draw) return function(title, x,y, w,h, draw)

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
return function(info, x,y, w,h, draw) return function(info, x,y, w,h, draw)
local id = core.generateID() local id = core.generateID()

View file

@ -1,5 +1,6 @@
-- state -- state
local context = {maxid = 0} local context = {maxid = 0}
local draw_items = {n = 0}
local NO_WIDGET = function()end local NO_WIDGET = function()end
local function generateID() local function generateID()
@ -97,7 +98,6 @@ local function save_unpack(t, i)
return t[i], save_unpack(t, i+1) return t[i], save_unpack(t, i+1)
end end
local draw_items = {n = 0}
local function registerDraw(id, f, ...) local function registerDraw(id, f, ...)
assert(type(f) == 'function' or (getmetatable(f) or {}).__call, assert(type(f) == 'function' or (getmetatable(f) or {}).__call,
'Drawing function is not a callable type!') 'Drawing function is not a callable type!')
@ -151,7 +151,7 @@ return {
hasKeyFocus = hasKeyFocus, hasKeyFocus = hasKeyFocus,
makeTabable = makeTabable, makeTabable = makeTabable,
style = require((...):match("^(.+)%.[^%.]+") .. '.style-default'), style = require((...):match("(.-)[^%.]+$") .. '.style-default'),
color = color, color = color,
registerDraw = registerDraw, registerDraw = registerDraw,
draw = draw, draw = draw,

View file

@ -1,4 +1,4 @@
local BASE = (...) .. '.' local BASE = ((...):match('(.+)%.') or ...) .. '.'
return { return {
core = require(BASE .. 'core'), core = require(BASE .. 'core'),

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
return function(info, x,y,w,h, draw) return function(info, x,y,w,h, draw)
info.text = info.text or "" info.text = info.text or ""
@ -10,6 +10,7 @@ return function(info, x,y,w,h, draw)
if core.isActive(id) then core.setKeyFocus(id) end if core.isActive(id) then core.setKeyFocus(id) end
core.registerDraw(id, draw or core.style.Input, info.text, info.cursor, x,y,w,h) core.registerDraw(id, draw or core.style.Input, info.text, info.cursor, x,y,w,h)
if not core.hasKeyFocus(id) then return false end
local changed = false local changed = false
-- editing -- editing

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
return function(text, x,y,w,h,align, draw) return function(text, x,y,w,h,align, draw)
local id = core.generateID() local id = core.generateID()

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
return function(info, x,y,w,h, draw) return function(info, x,y,w,h, draw)
assert(type(info) == 'table' and info.value, "Incomplete slider value info") assert(type(info) == 'table' and info.value, "Incomplete slider value info")

View file

@ -1,4 +1,4 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core') local core = require((...):match("(.-)[^%.]+$") .. 'core')
return function(info, x,y,w,h, draw) return function(info, x,y,w,h, draw)
assert(type(info) == 'table' and type(info.value) == "table", "Incomplete slider value info") assert(type(info) == 'table' and type(info.value) == "table", "Incomplete slider value info")

View file

@ -12,10 +12,6 @@ end
local function Button(state, title, x,y,w,h) local function Button(state, title, x,y,w,h)
local c = color[state] local c = color[state]
if state ~= 'normal' then
love.graphics.setColor(c.fg)
love.graphics.rectangle('fill', x+3,y+3,w,h)
end
love.graphics.setColor(c.bg) love.graphics.setColor(c.bg)
love.graphics.rectangle('fill', x,y,w,h) love.graphics.rectangle('fill', x,y,w,h)
love.graphics.setColor(c.fg) love.graphics.setColor(c.fg)
@ -39,10 +35,6 @@ end
local function Slider(state, fraction, x,y,w,h, vertical) local function Slider(state, fraction, x,y,w,h, vertical)
local c = color[state] local c = color[state]
if state ~= 'normal' then
love.graphics.setColor(c.fg)
love.graphics.rectangle('fill', x+3,y+3,w,h)
end
love.graphics.setColor(c.bg) love.graphics.setColor(c.bg)
love.graphics.rectangle('fill', x,y,w,h) love.graphics.rectangle('fill', x,y,w,h)
@ -59,10 +51,6 @@ end
local function Slider2D(state, fraction, x,y,w,h, vertical) local function Slider2D(state, fraction, x,y,w,h, vertical)
local c = color[state] local c = color[state]
if state ~= 'normal' then
love.graphics.setColor(c.fg)
love.graphics.rectangle('fill', x+3,y+3,w,h)
end
love.graphics.setColor(c.bg) love.graphics.setColor(c.bg)
love.graphics.rectangle('fill', x,y,w,h) love.graphics.rectangle('fill', x,y,w,h)
@ -83,10 +71,6 @@ end
local function Input(state, text, cursor, x,y,w,h) local function Input(state, text, cursor, x,y,w,h)
local c = color[state] local c = color[state]
if state ~= 'normal' then
love.graphics.setColor(c.fg)
love.graphics.rectangle('fill', x+3,y+3,w,h)
end
love.graphics.setColor(c.bg) love.graphics.setColor(c.bg)
love.graphics.rectangle('fill', x,y,w,h) love.graphics.rectangle('fill', x,y,w,h)
love.graphics.setColor(c.fg) love.graphics.setColor(c.fg)
@ -107,17 +91,13 @@ end
local function Checkbox(state, checked, x,y,w,h) local function Checkbox(state, checked, x,y,w,h)
local c = color[state] local c = color[state]
if state ~= 'normal' then
love.graphics.setColor(c.fg)
love.graphics.rectangle('fill', x+3,y+3,w,h)
end
love.graphics.setColor(c.bg) love.graphics.setColor(c.bg)
love.graphics.rectangle('fill', x,y,w,h) love.graphics.rectangle('fill', x,y,w,h)
love.graphics.setColor(c.fg) love.graphics.setColor(c.fg)
love.graphics.rectangle('line', x,y,w,h) love.graphics.rectangle('line', x,y,w,h)
if checked then if checked then
local r = math.max(math.min(w/2,h/2) - 3, 2) local r = math.max(math.min(w/7,h/7), 2)
love.graphics.circle('fill', x+w/2,y+h/2,r) love.graphics.rectangle('fill', x+r,y+r, w-2*r,h-2*r)
end end
end end