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



371
372
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 371

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=



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

def data_source
  @data_source
end

#rateNumeric

Returns the rate of the bar

Returns:

  • (Numeric)

    0 ~ 1



357
358
359
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 357

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



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

def data=(data)
end

#dispose

Dispose the bar



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

def dispose
end

#set_position(x, y)

Change the position of the bar

Parameters:

  • x (Integer)
  • y (Integer)


404
405
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 404

def set_position(x, y)
end

#visibleBoolean

Returns the visible state of the bar

Returns:

  • (Boolean)


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

def visible
end

#visible=(value)

Change the visible state of the bar

Parameters:

  • value (Boolean)


379
380
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 379

def visible=(value)
end

#xInteger

Returns the x position of the bar

Returns:

  • (Integer)


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

def x
end

#x=(value)

Change the x position of the bar

Parameters:

  • value (Integer)


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

def x=(value)
end

#yInteger

Returns the y position of the bar

Returns:

  • (Integer)


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

def y
end

#y=(value)

Change the y position of the bar

Parameters:

  • value (Integer)


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

def y=(value)
end

#zInteger

Returns the z position of the bar

Returns:

  • (Integer)


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

def z
end

#z=(value)

Change the z position of the bar

Parameters:

  • value (Numeric)


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

def z=(value)
end