Class: UI::InputNumber

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

Overview

UI element showing input number (for number choice & selling)

Constant Summary collapse

IMAGE_SOURCE =

Image used as source for the UI build

'numin_bg'
IMAGE_COMPOSITION =

List of coordinates used to know how to build the UI from the image

{left: [0, 0, 33, 44], number: [33, 0, 24, 44], separator: [57, 0, 6, 44], right: [83, 0, 10, 44], money_add: [94, 0, 68, 44]}
MONEY_PADDING =

Padding for money text

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_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, max_digits, default_number = 0, accept_negatives = false) ⇒ InputNumber

Create a new Input number

Parameters:

  • viewport (Viewport)
  • max_digits (Integer) —

    maximum number of digit

  • default_number (Integer) (defaults to: 0) —

    default number

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

    if we can provide negative values



106
107
# File 'docs/4_Systems_205_Input.rb', line 106

def initialize(viewport, max_digits, default_number = 0, accept_negatives = false)
end

Instance Attribute Details

#max ⇒ Integer

Maximum value

Returns:

  • (Integer)


97
98
99
# File 'docs/4_Systems_205_Input.rb', line 97

def max
  @max
end

#min ⇒ Integer

Minimum value

Returns:

  • (Integer)


94
95
96
# File 'docs/4_Systems_205_Input.rb', line 94

def min
  @min
end

#number ⇒ Integer

Currently inputed number

Returns:

  • (Integer)


100
101
102
# File 'docs/4_Systems_205_Input.rb', line 100

def number
  @number
end

Instance Method Details

#height ⇒ Integer

Get the height of the UI

Returns:

  • (Integer)


121
122
# File 'docs/4_Systems_205_Input.rb', line 121

def height
end

#update

Update the UI element



109
110
# File 'docs/4_Systems_205_Input.rb', line 109

def update
end

#width ⇒ Integer

Get the width of the UI

Returns:

  • (Integer)


117
118
# File 'docs/4_Systems_205_Input.rb', line 117

def width
end