Class: UI::Bar

Inherits:
Object show all
Defined in:
docs/01450_Systems_00000_General_00100_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



319
320
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 319

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=



307
308
309
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 307

def data_source
  @data_source
end

#rateNumeric

Returns the rate of the bar

Returns:

  • (Numeric)

    0 ~ 1



305
306
307
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 305

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



367
368
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 367

def data=(data)
end

#dispose

Dispose the bar



363
364
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 363

def dispose
end

#set_position(x, y)

Change the position of the bar

Parameters:

  • x (Integer)
  • y (Integer)


352
353
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 352

def set_position(x, y)
end

#visibleBoolean

Returns the visible state of the bar

Returns:

  • (Boolean)


331
332
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 331

def visible
end

#visible=(value)

Change the visible state of the bar

Parameters:

  • value (Boolean)


327
328
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 327

def visible=(value)
end

#xInteger

Returns the x position of the bar

Returns:

  • (Integer)


335
336
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 335

def x
end

#x=(value)

Change the x position of the bar

Parameters:

  • value (Integer)


343
344
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 343

def x=(value)
end

#yInteger

Returns the y position of the bar

Returns:

  • (Integer)


339
340
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 339

def y
end

#y=(value)

Change the y position of the bar

Parameters:

  • value (Integer)


347
348
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 347

def y=(value)
end

#zInteger

Returns the z position of the bar

Returns:

  • (Integer)


356
357
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 356

def z
end

#z=(value)

Change the z position of the bar

Parameters:

  • value (Numeric)


360
361
# File 'docs/01450_Systems_00000_General_00100_UI_Generics.rb', line 360

def z=(value)
end