Class: SpriteSheet

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

Overview

SpriteSheet is a class that helps the maker to display a sprite from a Sprite Sheet on the screen

Instance Attribute Summary collapse

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y

Instance Method Summary collapse

Methods inherited from Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update

Methods inherited from LiteRGSS::Sprite

new, #set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport, nb_x, nb_y) ⇒ SpriteSheet

Create a new SpriteSheet

Parameters:

  • viewport (Viewport, nil)

    where to display the sprite

  • nb_x (Integer)

    the number of sprites on the x axis in the sheet

  • nb_y (Integer)

    the number of sprites on the y axis in the sheet



19
20
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 19

def initialize(viewport, nb_x, nb_y)
end

Instance Attribute Details

#nb_xInteger

Return the number of sprite on the x axis of the sheet

Returns:

  • (Integer)


5
6
7
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 5

def nb_x
  @nb_x
end

#nb_yInteger

Return the number of sprite on the y axis of the sheet

Returns:

  • (Integer)


8
9
10
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 8

def nb_y
  @nb_y
end

#sxInteger

Return the x sprite index of the sheet

Returns:

  • (Integer)


11
12
13
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 11

def sx
  @sx
end

#syInteger

Return the y sprite index of the sheet

Returns:

  • (Integer)


14
15
16
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 14

def sy
  @sy
end

Instance Method Details

#bitmap=(value)

Change the bitmap of the sprite

Parameters:



23
24
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 23

def bitmap=(value)
end

#resize(nb_x, nb_y)

Redefine the number of cells the sheet supports on both axis

Parameters:

  • nb_x (Integer)

    number of cell on the x axis

  • nb_y (Integer)

    number of cell on the y axis



36
37
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 36

def resize(nb_x, nb_y)
end

#select(sx, sy) ⇒ self

Select a sprite on the sheet according to its x and y index

Parameters:

  • sx (Integer)

    the x sprite index of the sheet

  • sy (Integer)

    the y sprite index of the sheet

Returns:

  • (self)


50
51
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 50

def select(sx, sy)
end