Class: UI::GenericBase

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

Overview

Generica base UI for most of the scenes

Defined Under Namespace

Classes: ControlButton

Constant Summary collapse

DEFAULT_KEYS =

List of key by default

%i[A X Y B]
BUTTON_TO_HIDE =

List of button to hide when a text is shown

0..2

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

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, texts = [], keys = DEFAULT_KEYS, hide_background_and_button: false) ⇒ GenericBase

Create a new GenericBase UI

Parameters:

  • viewport (Viewport)
  • texts (Array<String>) (defaults to: []) —

    list of texts shown in the ControlButton

  • keys (Array<Symbol>) (defaults to: DEFAULT_KEYS) —

    list of keys used in the ControlButton

  • hide_background_and_button (Boolean) (defaults to: false) —

    tell if we don't want to show the button and its bar



444
445
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 444

def initialize(viewport, texts = [], keys = DEFAULT_KEYS, hide_background_and_button: false)
end

Instance Attribute Details

#background ⇒ Sprite (readonly)

Returns:



434
435
436
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 434

def background
  @background
end

#button_texts ⇒ Array<String>

Returns the texts shown in the button.

Returns:

  • (Array<String>) —

    the texts shown in the button



430
431
432
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 430

def button_texts
  @button_texts
end

#ctrl ⇒ Array<ControlButton> (readonly)

Returns the control buttons.

Returns:



432
433
434
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 432

def ctrl
  @ctrl
end

#keys ⇒ Array<Symbol>

Returns keys shown in the button.

Returns:

  • (Array<Symbol>) —

    keys shown in the button



428
429
430
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 428

def keys
  @keys
end

Instance Method Details

#hide_win_text

Hide the "win text"



459
460
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 459

def hide_win_text
end

#show_win_text(text)

Show the "win text" (bottom text giving information to the player)

Parameters:

  • text (String) —

    text to show



456
457
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 456

def show_win_text(text)
end

#update_background_animation

Update the background animation



466
467
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 466

def update_background_animation
end

#win_text_visible? ⇒ Boolean

Tell if the win text is visible

Returns:

  • (Boolean)


463
464
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 463

def win_text_visible?
end