Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard input #6

Closed
slime73 opened this issue Dec 29, 2013 · 8 comments
Closed

Keyboard input #6

slime73 opened this issue Dec 29, 2013 · 8 comments
Labels
feature New feature or request

Comments

@slime73
Copy link
Member

slime73 commented Dec 29, 2013

Original report by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


As slime noted this should work somewhat automatically. Still this should be validated

@slime73
Copy link
Member Author

slime73 commented Jan 9, 2014

Original comment by Pavol Rusnak (Bitbucket: prusnak, GitHub: prusnak).


Tested with USB keyboard plugged in via USB OTG and it works just fine. I think we can close this.

@slime73
Copy link
Member Author

slime73 commented Jan 9, 2014

Original comment by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


And the onscreen keyboard works as well?

@slime73
Copy link
Member Author

slime73 commented Jan 9, 2014

Original comment by Pavol Rusnak (Bitbucket: prusnak, GitHub: prusnak).


How do I achieve opening of onscreen keyboard while running Love app?

@slime73
Copy link
Member Author

slime73 commented Jan 9, 2014

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


Try love.keyboard.setTextInput(true).

I'll eventually update the function to optionally specify the rectangle for where the OSK should go, probably.

@slime73
Copy link
Member Author

slime73 commented Jan 10, 2014

Original comment by Pavol Rusnak (Bitbucket: prusnak, GitHub: prusnak).


I confirm that calling love.keyboard.setTextInput(true) shows on-screen-keyboard and using it fires love.textinput(t) callback correctly.

Attaching main.lua for reference:

#!lua

function love.load()
    text = "Type away! -- "
    love.keyboard.setTextInput(true)
end

function love.textinput(t)
    text = text .. t
end

function love.draw()
    love.graphics.printf(text, 0, 0, love.graphics.getWidth())
end

@slime73
Copy link
Member Author

slime73 commented Jan 10, 2014

Original comment by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


Thanks for testing! And great work @slime73!

@slime73 slime73 closed this as completed Jan 10, 2014
@slime73
Copy link
Member Author

slime73 commented Jan 10, 2014

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


Great work SDL developers, more like. :)

@slime73
Copy link
Member Author

slime73 commented Jan 10, 2014

Original comment by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


True. But also your foresight to add setTextInput and love.textinput(t) was smart!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant