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)")
|
print(" assuming LÖVE version > 0.10.1 (there may be bugs)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pop_ref = nil
|
local pop_ref = false
|
||||||
local window
|
local window
|
||||||
do
|
do
|
||||||
local _class_0
|
local _class_0
|
||||||
local _parent_0 = element
|
local _parent_0 = element
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
wrap = function(pop)
|
load = function(pop)
|
||||||
pop_ref = pop
|
pop_ref = pop
|
||||||
return function(...)
|
|
||||||
return pop.create("window", ...)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
debugDraw = function(self)
|
debugDraw = function(self)
|
||||||
graphics.setLineWidth(0.5)
|
graphics.setLineWidth(0.5)
|
||||||
|
@ -28,6 +28,9 @@ pop.load = function()
|
|||||||
end
|
end
|
||||||
local name = elements[i]:sub(1, -5)
|
local name = elements[i]:sub(1, -5)
|
||||||
pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
|
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) .. "\"")
|
print("element loaded: \"" .. tostring(name) .. "\"")
|
||||||
if not (pop[name]) then
|
if not (pop[name]) then
|
||||||
if pop.elements[name].wrap then
|
if pop.elements[name].wrap then
|
||||||
|
@ -25,17 +25,14 @@ do
|
|||||||
print(" assuming LÖVE version > 0.10.1 (there may be bugs)")
|
print(" assuming LÖVE version > 0.10.1 (there may be bugs)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pop_ref = nil
|
local pop_ref = false
|
||||||
local window
|
local window
|
||||||
do
|
do
|
||||||
local _class_0
|
local _class_0
|
||||||
local _parent_0 = element
|
local _parent_0 = element
|
||||||
local _base_0 = {
|
local _base_0 = {
|
||||||
wrap = function(pop)
|
load = function(pop)
|
||||||
pop_ref = pop
|
pop_ref = pop
|
||||||
return function(...)
|
|
||||||
return pop.create("window", ...)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
debugDraw = function(self)
|
debugDraw = function(self)
|
||||||
graphics.setLineWidth(0.5)
|
graphics.setLineWidth(0.5)
|
||||||
|
@ -28,6 +28,9 @@ pop.load = function()
|
|||||||
end
|
end
|
||||||
local name = elements[i]:sub(1, -5)
|
local name = elements[i]:sub(1, -5)
|
||||||
pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
|
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) .. "\"")
|
print("element loaded: \"" .. tostring(name) .. "\"")
|
||||||
if not (pop[name]) then
|
if not (pop[name]) then
|
||||||
if pop.elements[name].wrap then
|
if pop.elements[name].wrap then
|
||||||
|
@ -22,14 +22,16 @@ do
|
|||||||
print "elements/window: unrecognized LÖVE version: #{major}.#{minor}.#{revision}"
|
print "elements/window: unrecognized LÖVE version: #{major}.#{minor}.#{revision}"
|
||||||
print " assuming LÖVE version > 0.10.1 (there may be bugs)"
|
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 = false -- reference to pop, loaded by pop.load!
|
||||||
pop_ref = nil -- yes, this is convoluted and probably needs a re-design
|
|
||||||
|
|
||||||
class window extends element
|
class window extends element
|
||||||
wrap: (pop) ->
|
load: (pop) ->
|
||||||
pop_ref = pop -- set our reference to pop (needed for mouse handling)
|
pop_ref = pop
|
||||||
return (...) -> -- standard wrapper, nothing special needed
|
|
||||||
return pop.create("window", ...)
|
--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}) =>
|
new: (parent, title="window", tBackground={25, 180, 230, 255}, tColor={255, 255, 255, 255}, wBackground={200, 200, 210, 255}) =>
|
||||||
super parent
|
super parent
|
||||||
|
@ -28,6 +28,10 @@ pop.load = ->
|
|||||||
-- load into pop.elements table
|
-- load into pop.elements table
|
||||||
name = elements[i]\sub 1, -5
|
name = elements[i]\sub 1, -5
|
||||||
pop.elements[name] = require "#{path}/elements/#{name}"
|
pop.elements[name] = require "#{path}/elements/#{name}"
|
||||||
|
|
||||||
|
if pop.elements[name].load
|
||||||
|
pop.elements[name].load pop
|
||||||
|
|
||||||
print "element loaded: \"#{name}\""
|
print "element loaded: \"#{name}\""
|
||||||
|
|
||||||
-- create pop.element() wrapper if possible
|
-- create pop.element() wrapper if possible
|
||||||
|
Loading…
Reference in New Issue
Block a user