Externalize widget hit test to style definition.
This commit is contained in:
parent
2e5927e963
commit
6de65888dc
7 changed files with 18 additions and 17 deletions
|
|
@ -10,6 +10,10 @@ if not love.graphics.getFont() then
|
|||
love.graphics.setFont(love.graphics.newFont(12))
|
||||
end
|
||||
|
||||
local function widgetHit(xx,yy, x,y,w,h)
|
||||
return xx >= x and xx <= x+w and yy >= y and yy <= y+h
|
||||
end
|
||||
|
||||
local function Button(state, title, x,y,w,h)
|
||||
local c = color[state]
|
||||
love.graphics.setColor(c.bg)
|
||||
|
|
@ -104,6 +108,7 @@ end
|
|||
|
||||
-- the style
|
||||
return {
|
||||
widgetHit = widgetHit,
|
||||
color = color,
|
||||
Button = Button,
|
||||
Label = Label,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue