Gah, this is getting so frustrating! I'm trying to make a tile map editor. So far, I've got a start menu with options for new project and load project. The load project item isn't implemented yet, but for new project, I had integrated cancan's version of the danzeff osk to enter text for a project name, then create a new sub directory with that name. Up to that point, it was working fine, while testing I could go in, enter text, and the new directory would be created.
Then, I added in a tile loader function. The tile loader function appears to be working, but now the osk input for the project name isn't. I have no Idea what happened, I didn't change anything in the part of the code that calls up the osk. I've been looking at this for hours and I just can't figure out what's wrong
Code:
-- Lua Map Maker
-- by Merick
lum = Image.load("lum.png")
hyperion = Font.load("hyperion.ttf")
hyperion2 = Font.load("hyperion.ttf")
hyperion:setPixelSizes(0, 20)
hyperion2:setPixelSizes(43,50)
red=Color.new(255,0,0)
blue=Color.new(0,0,255)
white=Color.new(255,255,255)
dofile("danzeff.lua")
keys = Danzeff:New()
keys:Init(20, 20)
menuitem = 1
tiles = {}
tiles.pic = {}
tiles.file = {}
loop = true
pname=""
function title() -- display title screen
screen:fontPrint(hyperion2,10,50,"Lu", red)
x=hyperion2:getTextSize("Lu")["width"]
screen:fontPrint(hyperion2,x+10,50, "a ",blue)
x=hyperion2:getTextSize("Lua ")["width"]
screen:fontPrint(hyperion2,x+10,50,"M", red)
x=hyperion2:getTextSize("Lua M")["width"]
screen:fontPrint(hyperion2,x+10,50, "ap ",blue)
x=hyperion2:getTextSize("Lua Map ")["width"]
screen:fontPrint(hyperion2,x+10,50,"M", red)
x=hyperion2:getTextSize("Lua Map M")["width"]
screen:fontPrint(hyperion2,x+10,50,"aker",blue)
screen:blit(225, 122, lum)
end
function getpname() -- use osk to get name for new project
while loop do
screen:fontPrint(hyperion, 180, 20, "left trigger = numbers", white)
screen:fontPrint(hyperion, 180, 50, "right trigger = shift", white)
screen:fontPrint(hyperion, 180, 80, "D-pad up = backspace", white)
screen:fontPrint(hyperion, 180, 110, "start = accept name", white)
pad = Controls.read()
newchar=keys:Input(pad)
if newchar > 10 and newchar ~= oldchar then pname = pname .. string.char(newchar) end
if newchar == 8 and newchar ~= oldchar then pname = string.sub(pname, 1, string.len(pname) - 1) end
if newchar == 8 and newchar ~= oldchar then pname = string.sub(pname, 1, string.len(pname) - 1) end
if newchar==4 then loop=false end
if pname ~= nil then screen:fontPrint(hyperion, 20, 200, pname, white) end
oldpad=pad
oldchar=newchar
keys:Display()
screen:waitVblankStart()
screen:flip()
end
screen:clear()
screen:flip()
end
-- load all images from tiles folder
function loadtiles()
screen:clear()
screen:fontPrint(hyperion, 100, 100, "loading tiles", red)
screen:flip()
local files = System.listDirectory("./tiles")
for i = 3, table.getn(files) do
tiles.pic[i-2] = Image.load("./tiles/"..files[i].name)
tiles.file[i-2] = (files[i].name)
end
screen:fontPrint(hyperion, 100, 150, "done", blue)
screen:flip()
return
end
-- end of functions
loadtiles()
-- first menu screen
while loop do
screen:clear()
title()
if menuitem==1 then screen:fontPrint(hyperion, 10, 150,"Start New Project", red)
else screen:fontPrint(hyperion, 10, 150,"Start New Project", white)
end
if menuitem==2 then screen:fontPrint(hyperion, 10, 180,"Load Project", red)
else screen:fontPrint(hyperion, 10, 180,"Load Project", white)
end
pad = Controls.read()
if pad:up() then menuitem=1 end
if pad:down() then menuitem=2 end
if pad:start() then loop=false end
screen:waitVblankStart()
screen:flip( )
end
-- create new project folder
if menuitem==1 then getpname()
System.createDirectory(pname)
pjdir = "./"..pname.."/"
end
loop=true
while loop do
pad = Controls.read()
if pad:select() then loop=false end
end