improved level name input
This commit is contained in:
parent
6274779d46
commit
484537afa1
4 changed files with 24 additions and 4 deletions
|
@ -1,16 +1,17 @@
|
|||
import "CoreLibs/keyboard"
|
||||
|
||||
local gfx <const> = playdate.graphics
|
||||
local prevtext = ""
|
||||
|
||||
function newProject()
|
||||
mode = "newproj"
|
||||
playdate.keyboard.show("test")
|
||||
playdate.keyboard.show("NEW LEVEL")
|
||||
end
|
||||
|
||||
function updateNewproj()
|
||||
gfx.clear()
|
||||
gfx.drawText("LEVEL NAME:", 0, 105)
|
||||
gfx.drawText(playdate.keyboard.text:upper(),0,125)
|
||||
gfx.drawTextInRect(playdate.keyboard.text:upper(),0,125, 210, 80)
|
||||
end
|
||||
|
||||
function playdate.keyboard.keyboardWillHideCallback(ok)
|
||||
|
@ -20,3 +21,13 @@ function playdate.keyboard.keyboardWillHideCallback(ok)
|
|||
editLoad()
|
||||
end
|
||||
end
|
||||
|
||||
function playdate.keyboard.textChangedCallback()
|
||||
print(#playdate.keyboard.text)
|
||||
|
||||
if #playdate.keyboard.text > 24 then
|
||||
playdate.keyboard.text = prevtext
|
||||
end
|
||||
|
||||
prevtext = playdate.keyboard.text
|
||||
end
|
|
@ -16,7 +16,7 @@ local gfx <const> = playdate.graphics
|
|||
local disp <const> = playdate.display
|
||||
local font <const> = gfx.font.new("gfx/big")
|
||||
|
||||
dev = true
|
||||
local dev = false
|
||||
|
||||
gfx.setFont(font)
|
||||
gfx.setBackgroundColor(gfx.kColorBlack)
|
||||
|
|
|
@ -45,7 +45,7 @@ function loadSpins(_spins)
|
|||
s.middle:moveTo(s.x,s.y)
|
||||
s.middle:add()
|
||||
|
||||
local sb = {speed=s.speed,arms=s.arms,armlen=s.armlen,blades={},time=0}
|
||||
local sb = {speed=s.speed,arms=s.arms,armlen=s.armlen,blades={},mid=s.middle,time=0}
|
||||
for i = 1, s.arms, 1 do
|
||||
for p = 1, s.armlen, 1 do
|
||||
local degrees = (360 / s.arms) * i
|
||||
|
@ -84,4 +84,13 @@ function killBlades()
|
|||
blades[i].saw:remove()
|
||||
end
|
||||
blades = {}
|
||||
|
||||
for i = 1, #spinblades, 1 do
|
||||
spinblades[i].mid:remove()
|
||||
for b = 1, #spinblades[i].blades do
|
||||
spinblades[i].blades[b]:remove()
|
||||
end
|
||||
end
|
||||
|
||||
spinblades = {}
|
||||
end
|
Loading…
Reference in a new issue