chewbranca.com

Check-in [6f88a252fe]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enable STI to ignore non-visible objects
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | lisp-game-jam-2020
Files: files | file ages | folders
SHA3-256: 6f88a252fe2ba46836d9966d8be23b113f809985ea2fe8bb038629b8132d96c0
User & Date: chewbranca 2020-04-20 01:30:14
Context
2020-04-20
03:07
Hack out a playable game check-in: 55dab480a6 user: chewbranca tags: lisp-game-jam-2020
01:30
Enable STI to ignore non-visible objects check-in: 6f88a252fe user: chewbranca tags: lisp-game-jam-2020
01:27
Map updates check-in: 0d823e0a3b user: chewbranca tags: lisp-game-jam-2020
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/fahombo/lib/sti/init.lua.

616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
...
929
930
931
932
933
934
935

936
937
938
939
940
941
942
943
944
945
946

947
948
949
950
951
952
953
	if layer.draworder == "topdown" then
		table.sort(layer.objects, function(a, b)
			return a.y + a.height < b.y + b.height
		end)
	end

	for _, object in ipairs(layer.objects) do
		if object.gid then
			local tile    = self.tiles[object.gid] or self:setFlippedGID(object.gid)
			local tileset = tile.tileset
			local image   = self.tilesets[tileset].image

			batches[tileset] = batches[tileset] or newBatch(image)

			local sx = object.width  / tile.width
................................................................................
		end

		lg.setColor(line)
		lg.polygon("line", vertex)
	end

	for _, object in ipairs(layer.objects) do

		if object.shape == "rectangle" and not object.gid then
			drawShape(object.rectangle, "rectangle")
		elseif object.shape == "ellipse" then
			drawShape(object.ellipse, "ellipse")
		elseif object.shape == "polygon" then
			drawShape(object.polygon, "polygon")
		elseif object.shape == "polyline" then
			drawShape(object.polyline, "polyline")
		elseif object.shape == "point" then
			lg.points(object.x, object.y)
		end

	end

	lg.setColor(reset)
	for _, batch in pairs(layer.batches) do
		lg.draw(batch, 0, 0)
	end
	lg.setColor(r,g,b,a)







|







 







>
|
|
|
|
|
|
|
|
|
|
|
>







616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
...
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
	if layer.draworder == "topdown" then
		table.sort(layer.objects, function(a, b)
			return a.y + a.height < b.y + b.height
		end)
	end

	for _, object in ipairs(layer.objects) do
		if object.visible ~= false and object.gid then
			local tile    = self.tiles[object.gid] or self:setFlippedGID(object.gid)
			local tileset = tile.tileset
			local image   = self.tilesets[tileset].image

			batches[tileset] = batches[tileset] or newBatch(image)

			local sx = object.width  / tile.width
................................................................................
		end

		lg.setColor(line)
		lg.polygon("line", vertex)
	end

	for _, object in ipairs(layer.objects) do
        if object.visible ~= false then
            if object.shape == "rectangle" and not object.gid then
                drawShape(object.rectangle, "rectangle")
            elseif object.shape == "ellipse" then
                drawShape(object.ellipse, "ellipse")
            elseif object.shape == "polygon" then
                drawShape(object.polygon, "polygon")
            elseif object.shape == "polyline" then
                drawShape(object.polyline, "polyline")
            elseif object.shape == "point" then
                lg.points(object.x, object.y)
            end
        end
	end

	lg.setColor(reset)
	for _, batch in pairs(layer.batches) do
		lg.draw(batch, 0, 0)
	end
	lg.setColor(r,g,b,a)