Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Trouble adding text. Help?

edited January 2015 in Questions Posts: 100

I tried the reference but there was nothing on this happening?

-- Storage

-- Use this function to perform your initial setup
function setup()
    passon = true
    method = "store"
    store = ""
    pass = ""
    key = ""
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(255, 255, 255, 255)

    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing here
    textAlign(LEFT)
    text(pass, WIDTH/2, 1)
    text(store, WIDTH/2, 6)
    text(key, WIDTH/2, 11)

    --Keyboard
    if isKeyboardShowing() == false then
        showKeyboard()
    end

end

function keyboard(k)
    if k == RETURN then
        if method == "store" then
            if passon then
                passon = false
            else
                saveLocalData(pass, store)
                passon = true
            end
        elseif method == "read" then
            print(readLocalData(key))
        end
        store = ""
    elseif k == BACKSPACE then
        if method == "store" then
            if passon then
                pass = store:sub(1,#store-1)
            else
                store = store:sub(1,#store-1)
            end
        elseif method == "read" then
            key = key:sub(1,#key-1)
        end
    else
        if method == "store" then
            if passon then
                pass = pass .. k
            else
                store = store .. k
            end
        elseif method == "read" then
            key = key .. k
        end
    end
end

function touched(t)
    if t.state == BEGAN then
        if method == "store" then
            print("ReadMode")
            pass = ""
            store = ""
            method = "read"
        elseif method == "read" then
            print("StoreMode")
            key = ""
            passon = true
            method = "store"
        end
    end
end

displayMode(FULLSCREEN)

showKeyboard()

I'm not seeing any text at all?

Comments

  • Posts: 1,976

    Please try and keep all your questions about the same project in one topic - as for your problem, try drawing them higher on the screen. You're drawing them at the very bottom, and the bottom half of the screen is covered by the keyboard.

  • Oh, Ty, I thought it should be at the top. Another change from Touch Lua

  • IgnatzIgnatz Mod
    Posts: 5,396

    @warspyking - I don't know why you expect things to be the same as Touch Lua.

    And as SkyTheCoder says, please keep all questions for this project in a single thread, otherwise the forum gets cluttered. You can change the subject title if you want, by editing the original post.

  • @Ignatz

    Well, I'm used to Touch Lua, so basically I'll assume things work the sane where until I find otherwise, I'll be used to Codea once I understand things properly.

  • Also, I'll do that from now on (about multiple project questions in one post) but when I do, should I change the body also?

  • dave1707dave1707 Mod
    Posts: 6,828

    @warspyking Just change the subject title and add your question to the end of the post.

Sign In or Register to comment.