Class: UI::GenericBase::ControlButton

Inherits:
SpriteStack show all
Defined in:
docs/4_Systems_000_General_4_UI_Generics.rb

Overview

Generic Button used to help the player to know what key he can press

Constant Summary collapse

COORDINATES =

Array of button coordinates

[[3, 219], [83, 219], [163, 219], [243, 219]]

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from SpriteStack

#animated, #data, #font_id, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

Methods inherited from SpriteStack

#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, coords_index, key, default_cache: :pokedex) ⇒ ControlButton

Create a new Button

Parameters:

  • viewport (Viewport)
  • coords_index (Integer) —

    index of the coordinates to use in order to position the button

  • key (Symbol) —

    key to show by default

  • default_cache (Symbol) (defaults to: :pokedex) —

    the cache to use for loading button assets



513
514
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 513

def initialize(viewport, coords_index, key, default_cache: :pokedex)
end

Instance Method Details

#key=(value)

Set the key shown by the button

Parameters:

  • value (Symbol)


526
527
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 526

def key=(value)
end

#pressed=(pressed) Also known as: set_press

Set the button pressed

Parameters:

  • pressed (Boolean) —

    if the button is pressed or not



517
518
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 517

def pressed=(pressed)
end

#text=(value)

Set the text shown by the button

Parameters:

  • value (String) —

    text to show



522
523
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 522

def text=(value)
end