Sample code using Lua to create a button and text edit box in Graal3D:
Chat.lua
PHP Code:
chatSizeX = 60
chatSizeY = 60
if game.OS == "Android" then
chatSizeX = 120
chatSizeY = 120
end
local button = CreateButton(0, "",10,10,chatSizeX,chatSizeY)
button:setDrawBorder(false)
button:setImage("GUIs/Chat.png")
button:setScaleImage(true)
button:setUseAlphaChannel(true)
button:setVisible(true)
local chatBox = CreateEditBox(0, 10, 15, window.width-20, chatSizeY-5)
if keyIsDown(KEY_TAB) then
if holding == false then
tabPress = true
holding = true
elseif holding then
tabPress = false
end
else
holding = false
end
if tabPress and chatBox:isFocused() then
chatBox:setFocused(false)
elseif button:isPressed() or (tabPress and button:isVisible()) then
button:setVisible(false)
chatBox:setVisible(true)
chatBox:setFocused(true)
end
if chatBox:isFocused() then
game_removeControls()
chatBox:setVisible(true)
button:setVisible(false)
else
chatBox:setVisible(false)
button:setVisible(true)
end
if keyIsDown(KEY_RETURN) and chatBox:isVisible() then
player.chat = chatBox:getText()
chatBox:setText("")
chatBox:setFocused(false)
chatBox:setVisible(false)
button:setVisible(true)
end
Explination of code:
This code creates a button that, when pressed, opens a chat box to type what you want the player to say.
For PC users, they can press Tab to open the chat box and type what they want.
Just a demonstration for how coding in Graal3D will work, as everyone who downloads Graal3D will be able to code *whatever they want