summaryrefslogtreecommitdiff
path: root/img/shitty_disp.lua
blob: ea9681bdee7db9fe95d979da69b6acf544703206 (plain)
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
-- bad displayment thing
local disp_common = require("disp_common")
local improve_palette,closest_palette_color = disp_common.improve_palette,disp_common.closest_palette_color


local function disp(R,img,scrx,scry,w,h,imgx,imgy)
	scrx = scrx or 1
	scry = scry or 1
	w = w or img.width
	h = h or img.height
	imgx = imgx or 1
	imgy = imgy or 1

	improve_palette(R,img,w,h,imgx,imgy)

	for offx=0,w-1 do
		for offy=0,h-1 do
			R.setCursorPos(scrx+offx,scry+offy)
			local icol = img[imgy+offy][imgx+offx]
			local pcol = closest_palette_color(R,icol)
			R.setBackgroundColor(pcol)
			R.write(" ")
		end
	end
end

return {disp=disp}