Class Button

A predefined component that may be used as one would normally expect Ensures that the mouse was clicked and released over the button Button doesn't handle timing of press or anything like that

class Button
  : Component ;

Constructors

NameDescription
this Makes a button given its location

Fields

NameTypeDescription
_location AxisAlignedBoundingBox!(int,2)Where the button is on the screen
container DisplayThe display that contains this component

Properties

NameTypeDescription
isClicked[get] boolGets whether the mouse button is held down over this button
isHovered[get] boolGets whether the mouse is hovering over this button
location[get] AxisAlignedBoundingBox!(int,2)Gets where the button is on the screen
location[set] AxisAlignedBoundingBox!(int,2)Sets where the button is on the screen

Methods

NameDescription
handleEvent How the button determines when it has been pressed Collects events and if the events signify the button has been pressed, calls the button's action
draw How the component should draw itself on the screen