Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
pauljessup
Party member
Posts: 189
Joined: Wed Jul 03, 2013 4:06 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by pauljessup »

Why not just use Insert Tile on the object layer, and have a tileset setup just for object/tiles in TileD? Then when you bring it in through Lua, you can bring in all the custom properties and stuff...

It's what I'm doing in my next project
monolifed
Party member
Posts: 155
Joined: Sat Feb 06, 2016 9:42 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by monolifed »

Why do every function in graphics.lua check for graphics.isCreated before the actual love.graphics function call?
Wouldn't something like this be more optimal?
(I mean not this particular code but calling love.graphics functions directly)

Code: Select all

local lg       = _G.love.graphics
local graphics = { isCreated = lg and true or false }

local function noop() end
local function return_0() return 0 end

local fnlist = {"newSpriteBatch", "newCanvas", "newImage", "newQuad", "getCanvas", "setCanvas",
	"clear", "push", "origin", "scale", "translate", "pop", "draw", "rectangle", "getColor",
	"setColor", "line", "polygon", "points", "getWidth", "getHeight"}

if not graphics.isCreated then
	for i, v in ipairs(fnlist) do
		graphics[v] = noop
	end
	graphics.getWidth  = return_0
	graphics.getHeight = return_0

else
	for i, v in ipairs(fnlist) do
		graphics[v] = lg[v]
	end
end

return graphics
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 17 guests