up-editor/draw.lua

33 lines
779 B
Lua
Raw Normal View History

2020-02-21 12:43:31 +01:00
function love.draw()
2020-02-21 15:10:49 +01:00
love.graphics.push()
love.graphics.scale(scale)
2020-02-21 15:16:35 +01:00
--draw screen
love.graphics.setColor(1, 1, 1, 1)
2020-02-21 15:10:49 +01:00
x = 0
y = 0
2020-02-21 12:43:31 +01:00
for i = 1, SCREEN_LEN, 1 do
2020-02-21 15:10:49 +01:00
current_tile = selected_screen:sub(i, i)
tile_id = 0
for i, v in ipairs(tiles_char) do
if v == current_tile then tile_id = i break end
end
if tiles[tile_id] then
love.graphics.draw(tiles[tile_id], x, y)
end
x = x + 16
if x > 16 * 25 then
x = 0
y = y + 16
end
2020-02-21 12:43:31 +01:00
end
2020-02-21 15:16:35 +01:00
--draw preview
love.graphics.setColor(1, 1, 1, 0.5)
2020-02-21 15:35:35 +01:00
if tiles[selected_tile] then
love.graphics.draw(tiles[selected_tile], clip_mouse_x, clip_mouse_y)
end
2020-02-21 15:10:49 +01:00
--gui
love.graphics.pop()
love.graphics.setColor(0.8, 0.8, 0.8, 1)
2020-02-25 11:10:01 +01:00
love.graphics.print(screen_id, 2, 0)
2020-02-21 12:43:31 +01:00
end