Its Based on :
-Array
-Frame
-Button
-Keyboard Image
---------------------------------------------------------------------------------------------------------------------------
I'm Edit the code and the Picture.This is "Keyboard On-Screen solution" for anyone use 1280 x 720 resolution :
Code: Select all
########################################################
init python:
text_list1=["Q","W","E","R","T","Y","U","I","O","P","0",
"A","S","D","F","G","H","J","K","L","0",
"Z","X","C","V","B","N","M","0"]
text_list2=["q","w","e","r","t","y","u","i","o","p","0",
"a","s","d","f","g","h","j","k","l","0",
"z","x","c","v","b","n","m","0"]
input_text = ''
input_header = 'NAME:'
text_limit = 16
text_list=text_list1
text_group=1
########################################################
label inputter:
if text_group==1:
$text_list=text_list1
elif text_group==2:
$text_list=text_list2
$ ui.frame(xalign=0.5, yalign=0.5)
$ ui.vbox()
$ ui.text(input_header+" "+input_text)
$ ui.null(height=50)
$ ui.hbox(xalign=0.5, yalign=1.0)
$ ui.textbutton("{size=+10}Done{/size}", clicked=ui.returns("Done"))
$ui.textbutton("{size=+10}Backspace{/size}", clicked=ui.returns("Backspace"))
$ui.textbutton("{size=+10}Clear{/size}", clicked=ui.returns("Deleteall"))
if text_group==1:
$ ui.textbutton("{size=+10}Caps (On){/size}", clicked=ui.returns("lowercase"))
image keyboard = "keyboard.png"
hide keyboard2
show keyboard
elif text_group==2:
$ ui.textbutton("{size=+10}Caps (Off){/size}", clicked=ui.returns("uppercase"))
image keyboard2 = "keyboard2.png"
hide keyboard
show keyboard2
$ ui.close()
$ ui.null(height=25)
$ 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=+47} {/size}', clicked=ui.returns(text_code))
$ ui.close()
$ ui.close()
$ button_selection=ui.interact()
if button_selection=="Backspace":
$ input_text=input_text[:-1]
jump inputter
elif button_selection=="Deleteall":
$ input_text=''
jump inputter
elif button_selection=="uppercase":
$text_group=1
jump inputter
elif button_selection=="lowercase":
$text_group=2
jump inputter
elif button_selection=="Done":
hide keyboard
hide keyboard2
return
$ select_text=button_selection
python:
for text_code in text_list:
if select_text==text_code:
input_text += text_code
jump inputter
---------------------------------------------------------------------------------------------------------------------------
Warning : Do not modify the "SPACE" at line below this. ( You "Must Edit" (This Code, or Keyboard Image) if your Game resolution are below or under 1280 x 720 px. )
Or everything will be not same. The "KEY" of keyboard width and height that match the keyboard image, are here :
Code: Select all
ui.textbutton('{size=+47} {/size}', clicked=ui.returns(text_code))
The "KEY" to show up Uppercase or lowercase Letter are :
Code: Select all
if text_group==1:
$ ui.textbutton("{size=+10}Caps (On){/size}", clicked=ui.returns("lowercase"))
image keyboard = "keyboard.png"
hide keyboard2
show keyboard
elif text_group==2:
$ ui.textbutton("{size=+10}Caps (Off){/size}", clicked=ui.returns("uppercase"))
image keyboard2 = "keyboard2.png"
hide keyboard
show keyboard2
Code: Select all
label character :
"What is your first name? (leave blank for 'Name')"
$ input_header = 'Input First name:'
call inputter
$ povFirstName = input_text or "Name"
"What is your last name? (leave blank for 'Surname')"
$ input_header = 'Input Last name:'
$ text_group = 1
$ input_text = ''
call inputter
$ povLastName = input_text or "Surname"
$ povName = povFirstName +" "+povLastName
Code: Select all
elif button_selection=="Done":
hide keyboard
hide keyboard2
return
---------------------------------------------------------------------------------------------------------------------------
This On-Screen Keyboard are modified by me, and thanks to :http://lemmasoft.renai.us/forums/viewto ... =8&t=14985
http://lemmasoft.renai.us/forums/member ... le&u=19404