#module \
Keyboard

#deffunc local \
Show
	showing = True
	text = ""

	Return

#deffunc local \
Hide
	showing = False

	Return

#defcfunc local \
GetChar
	if showing = False {
		Return ""
	}

	MTList getChar_id

	If stat = 0 {
		touching = False

		Return ""
	}

	If touching {
		Return ""
	}

	MTInfo getChar_touchInfo, getChar_id.0

	If getChar_touchInfo.2 < 1920 - 480 {
		Return ""
	}

	getChar_charId = (1080 - getChar_touchInfo.1) / 96 * 5 + (getChar_touchInfo.2 - (1920 - 480)) / 96
	getChar_textLength = StrLen (text)

	Repeat 3
		Poke text, getChar_textLength + cnt, Peek (charDict@Char, getChar_charId * 3 + cnt)
	Loop

	touching = True

	Return ""

#deffunc local \
Draw
	If showing = False {
		Return
	}

	Color COLOUR_BLACK
	BoxF 0, 1920 - 480, 1080, 1920

	Repeat 50
		Pos 1080 - 96 * (cnt / 5 + 1), 1920 - 480 + 96 * (cnt \ 5)
		CelPut BUFFER_CHAR, cnt, 3, 3
	Loop

	Return

#global

