mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
added element load call (yay\!)
This commit is contained in:
parent
d38a398cbc
commit
cdf3f99705
@ -25,17 +25,14 @@ do
|
||||
print(" assuming LÖVE version > 0.10.1 (there may be bugs)")
|
||||
end
|
||||
end
|
||||
local pop_ref = nil
|
||||
local pop_ref = false
|
||||
local window
|
||||
do
|
||||
local _class_0
|
||||
local _parent_0 = element
|
||||
local _base_0 = {
|
||||
wrap = function(pop)
|
||||
load = function(pop)
|
||||
pop_ref = pop
|
||||
return function(...)
|
||||
return pop.create("window", ...)
|
||||
end
|
||||
end,
|
||||
debugDraw = function(self)
|
||||
graphics.setLineWidth(0.5)
|
||||
|
@ -28,6 +28,9 @@ pop.load = function()
|
||||
end
|
||||
local name = elements[i]:sub(1, -5)
|
||||
pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
|
||||
if pop.elements[name].load then
|
||||
pop.elements[name].load(pop)
|
||||
end
|
||||
print("element loaded: \"" .. tostring(name) .. "\"")
|
||||
if not (pop[name]) then
|
||||
if pop.elements[name].wrap then
|
||||
|
@ -25,17 +25,14 @@ do
|
||||
print(" assuming LÖVE version > 0.10.1 (there may be bugs)")
|
||||
end
|
||||
end
|
||||
local pop_ref = nil
|
||||
local pop_ref = false
|
||||
local window
|
||||
do
|
||||
local _class_0
|
||||
local _parent_0 = element
|
||||
local _base_0 = {
|
||||
wrap = function(pop)
|
||||
load = function(pop)
|
||||
pop_ref = pop
|
||||
return function(...)
|
||||
return pop.create("window", ...)
|
||||
end
|
||||
end,
|
||||
debugDraw = function(self)
|
||||
graphics.setLineWidth(0.5)
|
||||
|
@ -28,6 +28,9 @@ pop.load = function()
|
||||
end
|
||||
local name = elements[i]:sub(1, -5)
|
||||
pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
|
||||
if pop.elements[name].load then
|
||||
pop.elements[name].load(pop)
|
||||
end
|
||||
print("element loaded: \"" .. tostring(name) .. "\"")
|
||||
if not (pop[name]) then
|
||||
if pop.elements[name].wrap then
|
||||
|
@ -22,14 +22,16 @@ do
|
||||
print "elements/window: unrecognized LÖVE version: #{major}.#{minor}.#{revision}"
|
||||
print " assuming LÖVE version > 0.10.1 (there may be bugs)"
|
||||
|
||||
-- a reference to pop is needed for windows, this is obtained using the wrap function when it is loaded
|
||||
pop_ref = nil -- yes, this is convoluted and probably needs a re-design
|
||||
pop_ref = false -- reference to pop, loaded by pop.load!
|
||||
|
||||
class window extends element
|
||||
wrap: (pop) ->
|
||||
pop_ref = pop -- set our reference to pop (needed for mouse handling)
|
||||
return (...) -> -- standard wrapper, nothing special needed
|
||||
return pop.create("window", ...)
|
||||
load: (pop) ->
|
||||
pop_ref = pop
|
||||
|
||||
--wrap: (pop) ->
|
||||
-- pop_ref = pop -- set our reference to pop (needed for mouse handling)
|
||||
-- return (...) -> -- standard wrapper, nothing special needed
|
||||
-- return pop.create("window", ...)
|
||||
|
||||
new: (parent, title="window", tBackground={25, 180, 230, 255}, tColor={255, 255, 255, 255}, wBackground={200, 200, 210, 255}) =>
|
||||
super parent
|
||||
|
@ -28,6 +28,10 @@ pop.load = ->
|
||||
-- load into pop.elements table
|
||||
name = elements[i]\sub 1, -5
|
||||
pop.elements[name] = require "#{path}/elements/#{name}"
|
||||
|
||||
if pop.elements[name].load
|
||||
pop.elements[name].load pop
|
||||
|
||||
print "element loaded: \"#{name}\""
|
||||
|
||||
-- create pop.element() wrapper if possible
|
||||
|
Loading…
Reference in New Issue
Block a user