-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilities.lua
More file actions
34 lines (26 loc) · 769 Bytes
/
utilities.lua
File metadata and controls
34 lines (26 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--[[
Filgrim Engine
utilities.lua
A 2D platformer engine for LÖVE
By Hoover and Phil
]]
-- This is just misc. functions, some for convenience.
util = {} -- Keep our global scope clean by keeping these in their own table.
function util.makeSize(width, height)
return { width = width, height = height }
end
function util.makePoint(x, y)
return { x = x, y = y }
end
function util.makeRect(x, y, width, height)
return { x = x, y = y, width = width, height = height }
end
-- Object Oriented Utilities ==================================================
oo = {}
function oo.inherit(parent, metatable)
-- Constructor
local object = nil
if class then object = parent:new() else object = {} end
setmetatable(object, { __index = metatable })
return object
end