Skip to content

UI Elements

AlienTina edited this page Oct 12, 2023 · 1 revision

InputField:

A Textbox that accepts keyboard input into text.

Creation:

InputField field = new InputField();
InputField field = new InputField(string name);
InputField field = new InputField(string name, List<Component> components);

Usage:

  • InputField.boundingBox(Rectangle): Used to check if the mouse is on the InputField. If the InputField has a Renderer, it will use it's sprite as the bounding box.

  • InputField.text(string): Text that's been typed into the field.

  • InputField.textColor(Color): Color of the typed text.

Label:

A Text renderer.

Creation:

Label label = new Label();
Label label = new Label(string name);
Label label = new Label(string name, List<Component> components);

Usage:

  • Label.text(string): Text that gets rendered.
  • Label.color(Color): Color of the text.

UIButton:

A button that reacts to mouse input.

Creation:

UIButton button = new UIButton();
UIButton button = new UIButton(string name);
UIButton button = new UIButton(string name, List<Component> components);

Usage:

  • UIButton.boundingBox(Rectangle): Used to check if the mouse of on the button. If the UIButton has a Renderer, it will use it's sprite as the bounding box.

  • UIButton.onCLick(EventHandler): Event handler for when the button gets clicked on. It returns the MouseClickEventArgs, which only include the position of the mouse when it clicked the button.

Clone this wiki locally