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, #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



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

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

Instance Attribute Details

#maxInteger

Maximum value

Returns:

  • (Integer)


88
89
90
# File 'docs/4_Systems_205_Input.rb', line 88

def max
  @max
end

#minInteger

Minimum value

Returns:

  • (Integer)


85
86
87
# File 'docs/4_Systems_205_Input.rb', line 85

def min
  @min
end

#numberInteger

Currently inputed number

Returns:

  • (Integer)


91
92
93
# File 'docs/4_Systems_205_Input.rb', line 91

def number
  @number
end

Instance Method Details

#heightInteger

Get the height of the UI

Returns:

  • (Integer)


112
113
# File 'docs/4_Systems_205_Input.rb', line 112

def height
end

#update

Update the UI element



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

def update
end

#widthInteger

Get the width of the UI

Returns:

  • (Integer)


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

def width
end