Add API with basic rectangle functions
This commit is contained in:
parent
803a008054
commit
58f82fec83
|
@ -0,0 +1,23 @@
|
|||
local api = {} -- API functions provided to games
|
||||
local drawState = {color=15}
|
||||
|
||||
local function callGraphic(...)
|
||||
local args = {...}
|
||||
local name = table.remove(args,1)
|
||||
love.graphics.setCanvas(scr)
|
||||
pal.setColor(drawState.color)
|
||||
love.graphics[name](unpack(args))
|
||||
love.graphics.setCanvas()
|
||||
end
|
||||
|
||||
local function api.rectfill(x,y,w,h,c)
|
||||
drawState.color = c or drawState.color
|
||||
return callGraphic("rectangle","fill",x,y,w,h)
|
||||
end
|
||||
|
||||
local function api.rect(x,y,w,h,c)
|
||||
drawState.color = c or drawState.color
|
||||
return callGraphic("rectangle","line",x,y,w,h)
|
||||
end
|
||||
|
||||
return api
|
Loading…
Reference in New Issue