Class: RedBird::UIBox::Style
- Inherits:
-
Object
- Object
- RedBird::UIBox::Style
- Defined in:
- lib/red_bird/uibox.rb
Overview
A style defines the visual appearance of a Box.
Instance Attribute Summary collapse
- #bg_color ⇒ RedBird::Color readonly
-
#sprite_height ⇒ Object
readonly
Returns the value of attribute sprite_height.
- #sprite_width ⇒ Integer readonly
- #sprites ⇒ Array<RedBird::Sprite> readonly
- #texture ⇒ RedBird::Texture readonly
Instance Method Summary collapse
-
#initialize(texture_file, texture_palette, bg_color, sprite_width, sprite_height) ⇒ Style
constructor
A new instance of Style.
Constructor Details
#initialize(texture_file, texture_palette, bg_color, sprite_width, sprite_height) ⇒ Style
Returns a new instance of Style.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/red_bird/uibox.rb', line 33 def initialize(texture_file, texture_palette, bg_color, sprite_width, sprite_height) @texture = Texture.new(texture_file, texture_palette) @bg_color = bg_color @sprite_width = sprite_width @sprite_height = sprite_height @sprites = {} @sprites[:arrow_select] = Sprite.new( @texture, 1 * @sprite_width, 1 * @sprite_height, @sprite_width, @sprite_height) @sprites[:box_top_left] = Sprite.new( @texture, 0, 0, @sprite_width, @sprite_height) @sprites[:box_top] = Sprite.new( @texture, 1 * @sprite_width, 0, @sprite_width, @sprite_height) @sprites[:box_top_right] = Sprite.new( @texture, 2 * @sprite_height, 0, @sprite_width, @sprite_height) @sprites[:box_left] = Sprite.new( @texture, 0, 1 * @sprite_height, @sprite_width, @sprite_height) @sprites[:box_right] = Sprite.new( @texture, 2 * @sprite_width, 1 * @sprite_height, @sprite_width, @sprite_height) @sprites[:box_bottom_left] = Sprite.new( @texture, 0, 2 * @sprite_height, @sprite_width, @sprite_height) @sprites[:box_bottom] = Sprite.new( @texture, 1 * @sprite_width, 2 * @sprite_height, @sprite_width, @sprite_height) @sprites[:box_bottom_right] = Sprite.new( @texture, 2 * @sprite_width, 2 * @sprite_height, @sprite_width, @sprite_height) end |
Instance Attribute Details
#bg_color ⇒ RedBird::Color (readonly)
22 |
# File 'lib/red_bird/uibox.rb', line 22 attr_reader :texture, :bg_color, :sprites, :sprite_width, :sprite_height |
#sprite_height ⇒ Object (readonly)
Returns the value of attribute sprite_height.
22 |
# File 'lib/red_bird/uibox.rb', line 22 attr_reader :texture, :bg_color, :sprites, :sprite_width, :sprite_height |
#sprite_width ⇒ Integer (readonly)
22 |
# File 'lib/red_bird/uibox.rb', line 22 attr_reader :texture, :bg_color, :sprites, :sprite_width, :sprite_height |
#sprites ⇒ Array<RedBird::Sprite> (readonly)
22 |
# File 'lib/red_bird/uibox.rb', line 22 attr_reader :texture, :bg_color, :sprites, :sprite_width, :sprite_height |
#texture ⇒ RedBird::Texture (readonly)
22 23 24 |
# File 'lib/red_bird/uibox.rb', line 22 def texture @texture end |