Class: UI::Bar

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

Overview

Class that display a bar on screen using the whole texture to display the bar component

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(viewport, x, y, bmp, bw, bh, bx, by, nb_states, background_width = nil) ⇒ Bar

Create a new bar

Parameters:

  • viewport (Viewport) —

    the viewport in which the bar is shown

  • x (Integer) —

    the x position of the bar

  • y (Integer) —

    the y position of the bar

  • bmp (Texture) —

    the texture of the bar (including the bar states)

  • bw (Integer) —

    the bar width (progress part)

  • bh (Integer) —

    the bar height (progress part)

  • bx (Integer) —

    the x position of the bar inside the sprite

  • by (Integer) —

    the y position of the bar inside the sprite

  • nb_states (Integer) —

    the number of state the bar has

  • background_width (Integer) (defaults to: nil) —

    the bar width (background part). Useful if the bar has a different width than its real image



374
375
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 374

def initialize(viewport, x, y, bmp, bw, bh, bx, by, nb_states, background_width = nil)
end

Instance Attribute Details

#data_source

Return the data source to get the rate info through data=



362
363
364
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 362

def data_source
  @data_source
end

#rate ⇒ Numeric

Returns the rate of the bar

Returns:

  • (Numeric) —

    0 ~ 1



360
361
362
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 360

def rate
  @rate
end

Instance Method Details

#data=(data)

Change the data value (for SpriteStack usage)

Parameters:

  • data (Object) —

    the data where we'll call the @data_source to get the actual rate



422
423
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 422

def data=(data)
end

#dispose

Dispose the bar



418
419
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 418

def dispose
end

#set_position(x, y)

Change the position of the bar

Parameters:

  • x (Integer)
  • y (Integer)


407
408
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 407

def set_position(x, y)
end

#visible ⇒ Boolean

Returns the visible state of the bar

Returns:

  • (Boolean)


386
387
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 386

def visible
end

#visible=(value)

Change the visible state of the bar

Parameters:

  • value (Boolean)


382
383
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 382

def visible=(value)
end

#x ⇒ Integer

Returns the x position of the bar

Returns:

  • (Integer)


390
391
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 390

def x
end

#x=(value)

Change the x position of the bar

Parameters:

  • value (Integer)


398
399
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 398

def x=(value)
end

#y ⇒ Integer

Returns the y position of the bar

Returns:

  • (Integer)


394
395
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 394

def y
end

#y=(value)

Change the y position of the bar

Parameters:

  • value (Integer)


402
403
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 402

def y=(value)
end

#z ⇒ Integer

Returns the z position of the bar

Returns:

  • (Integer)


411
412
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 411

def z
end

#z=(value)

Change the z position of the bar

Parameters:

  • value (Numeric)


415
416
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 415

def z=(value)
end