I'm trying to create a virtual keyboard in my game because several users have complained about not being able to enter their name at the beginning, due to them having a custom keyboard on their device. I thought creating a special keyboard in the game would help solve this issue.
However, while my keyboard works just fine on mobiles, when I test the game on a tablet, it's a different story. Due to the different size of the screen, the images of the keys are no longer aligned with the actual commands of the keys; suddenly, they're too much on the right.
Is there a way to fix this, please? I can't find anything on my own.
This is my code:
Code: Select all
transform key2:
ypos 150 xpos 175
transform key1:
ypos 150 xpos 175
label inputter:
if text_group==1:
$text_list=text_list1
elif text_group==2:
$text_list=text_list2
$ ui.frame(xpos=0.5, ypos=0.1, xanchor=0.5, yanchor=0, xminimum=450)
$ ui.vbox()
$ ui.text(input_header+" "+input_text, ypos = 110, xpos = 25)
$ ui.null(height=30)
$ ui.hbox()
$ ui.imagebutton("gui/valider.png", clicked=ui.returns("Done"), xpos = 598, ypos = 400)
$ui.imagebutton("gui/retour.png", clicked=ui.returns("Backspace"), xpos = 461, ypos = 400)
$ui.imagebutton("gui/trash.png", clicked=ui.returns("Deleteall"), xpos = 324, ypos = 400)
if text_group==1:
image keyboard = "gui/keyboard.png"
hide keyboard2
show keyboard at key1
$ ui.imagebutton("gui/capsoff.png", clicked=ui.returns("lowercase"), xpos = 187, ypos = 400)
elif text_group==2:
$ ui.imagebutton("gui/capson.png", clicked=ui.returns("uppercase"), xpos = 187, ypos = 400)
image keyboard2 = "gui/keyboard2.png"
hide keyboard
show keyboard2 at key2
$ ui.close()
$ ui.null(height=10)
$ ui.hbox(xalign= 0.5)
python:
for text_code in text_list:
if text_code=="0":
ui.close()
ui.hbox(xalign= 0.5)
elif len(input_text)<=text_limit-1:
ui.textbutton('{size=+22} {/size}', clicked=ui.returns(text_code))
Thank you very, very much in advance to whoever can help!