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