Fix #17: Support multiple instances
This commit is contained in:
parent
f77ab8e5e8
commit
aca8a297bb
14 changed files with 385 additions and 244 deletions
66
init.lua
66
init.lua
|
@ -1,14 +1,58 @@
|
|||
-- This file is part of SUIT, copyright (c) 2016 Matthias Richter
|
||||
|
||||
local BASE = (...) .. '.'
|
||||
local BASE = (...) .. "."
|
||||
local suit = require(BASE .. "core")
|
||||
|
||||
return {
|
||||
core = require(BASE .. 'core'),
|
||||
layout = require(BASE .. 'layout'),
|
||||
Button = require(BASE .. 'button'),
|
||||
ImageButton = require(BASE .. 'imagebutton'),
|
||||
Slider = require(BASE .. 'slider'),
|
||||
Label = require(BASE .. 'label'),
|
||||
Input = require(BASE .. 'input'),
|
||||
Checkbox = require(BASE .. 'checkbox')
|
||||
}
|
||||
local instance = suit.new()
|
||||
return setmetatable({
|
||||
new = suit.new,
|
||||
getOptionsAndSize = suit.getOptionsAndSize,
|
||||
|
||||
-- core functions
|
||||
anyHovered = function(...) return instance:anyHovered(...) end,
|
||||
isHovered = function(...) return instance:isHovered(...) end,
|
||||
wasHovered = function(...) return instance:wasHovered(...) end,
|
||||
isActive = function(...) return instance:isActive(...) end,
|
||||
|
||||
mouseInRect = function(...) return instance:mouseInRect(...) end,
|
||||
registerHitbox = function(...) return instance:registerHitbox(...) end,
|
||||
registerMouseHit = function(...) return instance:registerMouseHit(...) end,
|
||||
mouseReleasedOn = function(...) return instance:mouseReleasedOn(...) end,
|
||||
updateMouse = function(...) return instance:updateMouse(...) end,
|
||||
getMousePosition = function(...) return instance:getMousePosition(...) end,
|
||||
|
||||
getPressedKey = function(...) return instance:getPressedKey(...) end,
|
||||
keypressed = function(...) return instance:keypressed(...) end,
|
||||
textinput = function(...) return instance:textinput(...) end,
|
||||
grabKeyboardFocus = function(...) return instance:grabKeyboardFocus(...) end,
|
||||
hasKeyboardFocus = function(...) return instance:hasKeyboardFocus(...) end,
|
||||
keyPressedOn = function(...) return instance:keyPressedOn(...) end,
|
||||
|
||||
enterFrame = function(...) return instance:enterFrame(...) end,
|
||||
exitFrame = function(...) return instance:exitFrame(...) end,
|
||||
registerDraw = function(...) return instance:registerDraw(...) end,
|
||||
draw = function(...) return instance:draw(...) end,
|
||||
|
||||
-- widgets
|
||||
Button = function(...) return instance:Button(...) end,
|
||||
ImageButton = function(...) return instance:ImageButton(...) end,
|
||||
Label = function(...) return instance:Label(...) end,
|
||||
Checkbox = function(...) return instance:Checkbox(...) end,
|
||||
Input = function(...) return instance:Input(...) end,
|
||||
Slider = function(...) return instance:Slider(...) end,
|
||||
|
||||
-- layout
|
||||
layout = instance.layout
|
||||
}, {
|
||||
-- theme
|
||||
__newindex = function(t, k, v)
|
||||
if k == "theme" then
|
||||
instance.theme = v
|
||||
else
|
||||
rawset(t, k, v)
|
||||
end
|
||||
end,
|
||||
__index = function(t, k)
|
||||
return k == "theme" and instance.theme or rawget(t, k)
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue