InputField
What is it ?
Inputfield is made to enter a text, numbers, email etc... really useful to interract with player if you need a text.
How create it ?
You have to add InputField component in a GameObject. All component require will be added by the InputField.
Example :
auto inputFieldObject = scene.createScene("My Button");
auto inputField = std::make_shared<KapEngine::UI::Inputfield>(inputFieldObject);
inputFieldObject->addComponent(inputField);
Functions
setPlaceholderText : set the text of placeholder (text display when there is no content)
setInputType : set the type of input (to allow keys or not)
setBackground : set an image in background of button
Example :
auto inputFieldObject = scene.createScene("My Button");
auto inputField = std::make_shared<KapEngine::UI::Inputfield>(inputFieldObject);
inputFieldObject->addComponent(inputField);
//call all available functions
inputField->setPlaceholderText("My placeholder...");
//at base InputType is set for text but you can change it like that :
KapEngine::UI::Inputfield::InputType type;
type = KapEngine::UI::Inputfield::InputType::PASSWORD;
inputField->setInputType(type);
inputField->setbackground("path/image.png", {0, 0, 100, 100});
Last updated