epervier-old/gamecore/modules/world/maps/parent.lua

82 lines
1.6 KiB
Lua
Raw Normal View History

local ParentMap = Object:extend()
-- INIT FUNCTION
-- Initialize the map
function ParentMap:new(world, r, g, b)
self.world = world
local r = r or 128
local g = g or 128
local b = b or 128
self.backgroundColor = {r, g, b}
self:register()
end
function ParentMap:register()
self.world.map = self
end
-- UPDATE FUNCTION
-- Update or modify the map
function ParentMap:resize(w, h)
-- Empty Placeholder function
end
function ParentMap:update(dt)
-- Empty Placeholder function
end
function ParentMap:loadObjects()
self:loadCollisions()
self:loadPlayers()
self:loadActors()
end
function ParentMap:loadCollisions()
-- Empty Placeholder function
end
function ParentMap:loadPlayers()
-- Empty Placeholder function
end
function ParentMap:loadActors()
-- Empty Placeholder function
end
function ParentMap:setBackgroundColor(r, g, b)
local r = r or 128
local g = g or 128
local b = b or 128
self.backgroundColor = {r, g, b}
end
function ParentMap:setBackgroundColorFromTable(backgroundColor)
self.backgroundColor = backgroundColor or {128, 128, 128}
end
function ParentMap:getBackgroundColor()
return self.backgroundColor[1]/256, self.backgroundColor[2]/256, self.backgroundColor[3]/256
end
function ParentMap:getDimensions()
return core.screen:getDimensions()
end
function ParentMap:getBox()
local w, h = self:getDimensions()
return 0, 0, w, h
end
function ParentMap:drawBackgroundColor()
local r, g, b = self.backgroundColor[1], self.backgroundColor[2], self.backgroundColor[3]
love.graphics.setColor(r/256, g/256, b/256)
love.graphics.rectangle("fill", 0, 0, 480, 272)
utils.graphics.resetColor()
end
return ParentMap