Class: MG::Widget

Inherits:
Node
  • Object
show all
Defined in:
motion-game

Overview

The base class for all UI widgets. You should not instantiate this class directly but use a subclass instead.

Direct Known Subclasses

Button, Layout, Slider, Text, Web

Properties (collapse)

Attributes inherited from Node

#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #visible?, #z_index

Events (collapse)

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #parent

Instance Attribute Details

- (Boolean) enabled?

Whether the widget is enabled. When enabled, a widget can be touched or clicked. By default, a widget is enabled.

Returns:

  • (Boolean)

    whether the widget is enabled.



726
727
728
# File 'motion-game', line 726

def enabled?
  @enabled?
end

- (Boolean) highlighted?

Whether the widget is highlighted. By default, a widget is not highlighted.

Returns:

  • (Boolean)

    whether the widget is highlighted.



730
731
732
# File 'motion-game', line 730

def highlighted?
  @highlighted?
end

Instance Method Details

- (Widget) on_touch {|Symbol| ... }

Configures a block to be called when a touch event is received on the widget.

Yields:

  • (Symbol)

    the given block will be called when the event is received with a Symbol that describes the type of event, which can be :begin, :move, :end or :cancel.

Returns:



741
# File 'motion-game', line 741

def on_touch; end