improved level name input

This commit is contained in:
PossiblyAxolotl 2022-05-07 23:40:21 -06:00
parent 6274779d46
commit 484537afa1
4 changed files with 24 additions and 4 deletions

View file

@ -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)
@ -19,4 +20,14 @@ function playdate.keyboard.keyboardWillHideCallback(ok)
playdate.wait(0.3)
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

View file

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

View file

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