diff --git a/data/editor.lua b/data/editor.lua index d3c4676..89479c8 100644 --- a/data/editor.lua +++ b/data/editor.lua @@ -17,15 +17,20 @@ editor = { enable = function() app.update = editor.update - sys.beat(2) + sys.beat(5) shader.disable(); pal.set(palfade.original) end, update = function() + if sys.beat() then + editor.ants = (editor.ants<<12) | (editor.ants>>4) + end + view.origin(0,0) surf.target(0) + -- Pintar fondo quadrejat, per si la capa background està oculta for y=0,104,8 do for x=0,160,8 do local color = (((x+y)//8)%2==0) and 23 or 16 @@ -51,12 +56,10 @@ editor = { local rx1,ry1,rx2,ry2=editor.selection.x1<<3,editor.selection.y1<<3,editor.selection.x2<<3,editor.selection.y2<<3 if rx1>rx2 then rx1,rx2=rx2,rx1 end if ry1>ry2 then ry1,ry2=ry2,ry1 end + draw.mode(draw.PATTERN) draw.pattern(editor.ants) draw.rect(rx1-1, ry1-1, rx2-rx1+10, ry2-ry1+10, 28) - draw.pattern(0xffff) - if sys.beat() then - editor.ants = (editor.ants<<12) | (editor.ants>>4) - end + draw.mode(draw.NORMAL) else draw.rect(mx-1, my-1, editor.brush.w*8+2, editor.brush.h*8+2, 28) draw.rect(mx, my, editor.brush.w*8, editor.brush.h*8, 1) @@ -121,6 +124,7 @@ editor = { end if editor.item_selected then local k = items[editor.item_selected] + surf.source(surf_sprites) draw.surf(k.visual.x, k.visual.y, k.visual.w, k.visual.h, mx, my, k.visual.w, k.visual.h, editor.flip) end end diff --git a/data/sprites.lua b/data/sprites.lua index a0cd6de..2e720e2 100644 --- a/data/sprites.lua +++ b/data/sprites.lua @@ -575,8 +575,13 @@ sprites = { if (app.update == editor.update) and (editor.item_selected or editor.layer~=LAYER_ITEMS) then ignore_selected = true end for i,v in ipairs(sprites.list) do if not ignore_selected and app.update == editor.update and mx>=v.pos.x and mx<=v.pos.x+v.size.w and my>=v.pos.y and my<=v.pos.y+v.size.h then - sprites.draw_sprite_selected(v) editor.item_hovered = i + if editor.item_dragged == editor.item_hovered then + draw.mode(draw.PATTERN) + draw.pattern(editor.ants) + end + sprites.draw_sprite_selected(v) + draw.mode(draw.NORMAL) else if (not ignore_selected) or (not v.no_shadow) or (app.update ~= game.update) then sprites.draw_sprite(v) @@ -632,6 +637,7 @@ sprites = { draw.surf(sx, sy, w, h, x, y, w, h, f) draw.surf(sx, sy, w, h, x+1, y+1, w, h, f) pal.subpal() + draw.mode(draw.NORMAL) draw.surf(sx, sy, w, h, x, y, w, h, f) end } \ No newline at end of file