- [FIX] view.origin() estaba invertit

- [FIX] Al generar un jailmoji no s'actualitzava la cadena de generació
- [NEW] Al pulsar amb el botó de la dreta sobre un spin_button o color_button, se va cap arrere
This commit is contained in:
2025-11-11 11:59:14 +01:00
parent 5f05f6e568
commit ed5acc7f50

View File

@@ -91,6 +91,9 @@ jailmoji={
pal.subpal()
surf.target(0)
jailmoji.editor.str=""
for i=1,#jailmoji.gendata do jailmoji.editor.str = jailmoji.editor.str .. string.char(jailmoji.gendata[i]+65) end
end,
random=function()
@@ -156,19 +159,28 @@ jailmoji={
spin_button=function(x, y, current_value, max_value)
local rect,color = draw.rect, 8
local mx,my = mouse.pos() mx,my = view.tolocal(mx,my)
local mx,my = mouse.pos() --mx,my = view.tolocal(mx,my)
local hover = mx>=x and mx<x+9 and my>=y and my<y+9
local clicked = hover and mouse.down(mouse.LEFT)
local label = string.char(current_value + 65)
if clicked then rect,color = draw.rectf, 5 else rect,color = draw.rect, 8 end
rect(x,y,9,9,8)
draw.text(label,x+3,y+2,color)
if hover and mouse.press(mouse.LEFT) then
jailmoji.editor.changed = true
if current_value+1 > max_value then
return 0
else
return current_value+1
if hover then
if mouse.press(mouse.LEFT) then
jailmoji.editor.changed = true
if current_value+1 > max_value then
return 0
else
return current_value+1
end
elseif mouse.press(mouse.RIGHT) then
jailmoji.editor.changed = true
if current_value == 0 then
return max_value
else
return current_value-1
end
end
end
return current_value
@@ -176,17 +188,26 @@ jailmoji={
color_button=function(x, y, current_value)
local c1,c2,c3 = current_value+1,6,8
local mx,my = mouse.pos() mx,my = view.tolocal(mx,my)
local mx,my = mouse.pos() --mx,my = view.tolocal(mx,my)
local hover = mx>=x and mx<x+9 and my>=y and my<y+9
local clicked = hover and mouse.down(mouse.LEFT)
if clicked then c1,c2,c3 = 6,6,8 end
draw.rectf(x,y,9,9,c1) draw.rect(x+1,y+1,7,7,c2) draw.rect(x,y,9,9,c3)
if hover and mouse.press(mouse.LEFT) then
jailmoji.editor.changed = true
if current_value+1 > 15 then
return 0
else
return current_value+1
if hover then
if mouse.press(mouse.LEFT) then
jailmoji.editor.changed = true
if current_value+1 > 15 then
return 0
else
return current_value+1
end
elseif mouse.press(mouse.RIGHT) then
jailmoji.editor.changed = true
if current_value == 0 then
return 15
else
return current_value-1
end
end
end
return current_value
@@ -214,7 +235,7 @@ jailmoji={
self.view=self.text_button(39,74,"S",self.view, 2)
self.animated=self.text_button(60,74,"A",self.animated, not self.animated)
view.origin(-70,-23)
view.origin(70,23)
draw.text("Vestit:",1,2,8)
jailmoji.gendata[1] = self.spin_button(28,0,jailmoji.gendata[1],jailmoji.MAX_BASE)
@@ -251,14 +272,14 @@ jailmoji={
if jailmoji.editor.changed then
jailmoji.editor.changed = false
jailmoji.generate()
self.str=""
for i=1,#jailmoji.gendata do self.str = self.str .. string.char(jailmoji.gendata[i]+65) end
--self.str=""
--for i=1,#jailmoji.gendata do self.str = self.str .. string.char(jailmoji.gendata[i]+65) end
end
draw.rectf(19,88, 122, 9,7)
draw.rect(19,88, 122, 9,8)
draw.text(self.str,21,90,8)
local mx,my = mouse.pos() mx,my = view.tolocal(mx,my)
--local mx,my = mouse.pos() --mx,my = view.tolocal(mx,my)
-- 'COPY' button
draw.rectf(19,98, 24, 9,9)