Ren'Py Moving Input in Android (to avoid keyboard)

Impious Monk

Active Member
Game Developer
Oct 14, 2021
626
2,808
I'm porting my Ren'py game over to Android and I've got just one problem left to solve. When the game asks the player to input a first name, the keyboard covers up whatever is being typed in by the player. I've read that the solution to this is to move the input upwards, but I have not been able to figure out how to implement that solution. Any assistance would be appreciated. Here is the code I've got:

Code:
    xx "In {i}Leaving DNA{/i}, you will play the role of Assistant District Attorney Rockford."
    $ mc_name = renpy.input("What is your first name? (leave blank for default)", length=16)
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "John"
    xx "Your name is [mc_name] Rockford."
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,130
3,194
there might be a away but you will need to code it by yourself by using google voice controls somehow

meaning of code it by yourself
it hasn't been done before with renpy that I know of... so it might work or it might not work
 
  • Like
Reactions: Impious Monk

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,191
I've read that the solution to this is to move the input upwards, but I have not been able to figure out how to implement that solution.
Open the "screen.rpy" file, then search the screen named "input". You'll find a vbox, and have to change the value for the ypos property.

But you'll probably want something a bit better, so this should do it:
Python:
screen input(prompt):
    style_prefix "input"

    window:

        vbox:
            xalign gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            if renpy.variant("touch"):  #
                ypos 100                #
            else:                       #
                ypos gui.dialogue_ypos

            text prompt style "input_prompt"
            input id "input"
 
  • Like
Reactions: Impious Monk

Impious Monk

Active Member
Game Developer
Oct 14, 2021
626
2,808
Open the "screen.rpy" file, then search the screen named "input". You'll find a vbox, and have to change the value for the ypos property.

But you'll probably want something a bit better, so this should do it:
Python:
screen input(prompt):
    style_prefix "input"

    window:

        vbox:
            xalign gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            if renpy.variant("touch"):  #
                ypos 100                #
            else:                       #
                ypos gui.dialogue_ypos

            text prompt style "input_prompt"
            input id "input"
Thank you, Anne!