In-progress browser for a directory of text files
on.draw = function()
	for _,obj in ipairs(Surface) do
		love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
		if obj.type == 'rectangle' then
			love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h), scale(obj.rx or 5), scale(obj.rx or obj.ry or 5))
		elseif obj.type == 'line' then
			love.graphics.line(unpack(obj.zdata))
		elseif obj.type == 'circle' then
			love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
		elseif obj.type == 'arc' then
			love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
		elseif obj.type == 'ellipse' then
			love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
		elseif obj.type == 'bezier' then
			love.graphics.line(unpack(obj.zdata))
		elseif obj.type == 'text' then
			if obj.w == nil then
				love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
			else
				edit.draw(obj.editor, obj.fg, not obj.show_cursor)
			end
		end
	end
	if Show_debug then draw_debug() end
	if Global_state.thread then
		draw_menu_bar()
	end
end