Compare commits

...

2 Commits

Author SHA1 Message Date
f3d85fd8ae - [FIX] Les "formiguetes" en les seleccions no es veïen
- [FIX] El item seleccionat per a posar no es veia
- [NEW] Al arrastrar un item, també te "formiguetes"
2026-03-10 11:19:23 +01:00
8226236f07 - [FIX] Al tornar al editor des del joc, recuperar la paleta normal
- [FIX] Quan no es pinta el fondo, que es veja un quadrejat, com el fondo "transparent" dels editor gràfics
- [FIX] Durant el joc totes les capes han de vores, independentment del marcat en l'editor
2026-03-10 10:33:38 +01:00
6 changed files with 25 additions and 7 deletions

View File

@@ -17,14 +17,27 @@ 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
draw.rectf(x, y, 8, 8, color);
end
end
-- Pintar el menú (el marcador serà en el modul game.lua)
--score.draw()
menu.draw()
@@ -43,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)
@@ -113,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

View File

@@ -104,7 +104,7 @@ rooms = {
end,
is_visible = function(layer)
return rooms.visibility & layer == layer
return (app.update==game.update) or (rooms.visibility & layer == layer)
end,
set_visibility = function(layer, visibility)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -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
}