Class: LiteRGSS::Sprite

Inherits:
Drawable show all
Defined in:
LiteRGSS.rb.yard.rb

Overview

Note:

Sprites cannot be saved, loaded from file nor cloned in the memory

Class that describe a sprite shown on the screen or inside a viewport

Direct Known Subclasses

ShaderedSprite

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Disposable

#dispose, #disposed?

Instance Attribute Details

#__index__Integer (readonly)

Return the sprite index to know if it has been created before an other sprite (in the same viewport)

Returns:

  • (Integer)

    Return the sprite index to know if it has been created before an other sprite (in the same viewport)



367
368
369
# File 'LiteRGSS.rb.yard.rb', line 367

def __index__
  @__index__
end

#angleNumeric

Returns The rotation of the sprite in degree.

Returns:

  • (Numeric)

    The rotation of the sprite in degree



385
386
387
# File 'LiteRGSS.rb.yard.rb', line 385

def angle
  @angle
end

#bitmapBitmap?

Returns texture shown by the sprite.

Returns:

  • (Bitmap, nil)

    texture shown by the sprite



369
370
371
# File 'LiteRGSS.rb.yard.rb', line 369

def bitmap
  @bitmap
end

#heightInteger (readonly)

Return the sprite height

Returns:

  • (Integer)

    Return the sprite height



399
400
401
# File 'LiteRGSS.rb.yard.rb', line 399

def height
  @height
end

#mirrorBoolean

Returns If the sprite texture is mirrored.

Returns:

  • (Boolean)

    If the sprite texture is mirrored



395
396
397
# File 'LiteRGSS.rb.yard.rb', line 395

def mirror
  @mirror
end

#opacityNumeric

Returns The opacity of the sprite.

Returns:

  • (Numeric)

    The opacity of the sprite



391
392
393
# File 'LiteRGSS.rb.yard.rb', line 391

def opacity
  @opacity
end

#oxNumeric

Returns The x coordinate of the pixel inside the texture that is shown at x coordinate of the sprite.

Returns:

  • (Numeric)

    The x coordinate of the pixel inside the texture that is shown at x coordinate of the sprite



381
382
383
# File 'LiteRGSS.rb.yard.rb', line 381

def ox
  @ox
end

#oyNumeric

Returns The y coordinate of the pixel inside the texture that is shown at y coordinate of the sprite.

Returns:

  • (Numeric)

    The y coordinate of the pixel inside the texture that is shown at y coordinate of the sprite



383
384
385
# File 'LiteRGSS.rb.yard.rb', line 383

def oy
  @oy
end

#src_rectRect

Returns Surface of the sprite's texture show on the screen.

Returns:

  • (Rect)

    Surface of the sprite's texture show on the screen



371
372
373
# File 'LiteRGSS.rb.yard.rb', line 371

def src_rect
  @src_rect
end

#viewportViewport, ...

Returns The sprite viewport.

Returns:



393
394
395
# File 'LiteRGSS.rb.yard.rb', line 393

def viewport
  @viewport
end

#visibleBoolean

Returns If the sprite is shown or not.

Returns:

  • (Boolean)

    If the sprite is shown or not



373
374
375
# File 'LiteRGSS.rb.yard.rb', line 373

def visible
  @visible
end

#widthInteger (readonly)

Return the sprite width

Returns:

  • (Integer)

    Return the sprite width



397
398
399
# File 'LiteRGSS.rb.yard.rb', line 397

def width
  @width
end

#xNumeric

Returns X coordinate of the sprite.

Returns:

  • (Numeric)

    X coordinate of the sprite



375
376
377
# File 'LiteRGSS.rb.yard.rb', line 375

def x
  @x
end

#yNumeric

Returns Y coordinate of the sprite.

Returns:

  • (Numeric)

    Y coordinate of the sprite



377
378
379
# File 'LiteRGSS.rb.yard.rb', line 377

def y
  @y
end

#zNumeric

Returns The z Coordinate of the sprite (for sorting).

Returns:

  • (Numeric)

    The z Coordinate of the sprite (for sorting)



379
380
381
# File 'LiteRGSS.rb.yard.rb', line 379

def z
  @z
end

#zoom=(value) ⇒ Numeric (writeonly)

Returns Define the zoom of the sprite when shown on screen.

Returns:

  • (Numeric)

    Define the zoom of the sprite when shown on screen



365
366
367
# File 'LiteRGSS.rb.yard.rb', line 365

def zoom=(value)
  @zoom = value
end

#zoom_xNumeric

Returns The zoom scale in width axis of the sprite.

Returns:

  • (Numeric)

    The zoom scale in width axis of the sprite



387
388
389
# File 'LiteRGSS.rb.yard.rb', line 387

def zoom_x
  @zoom_x
end

#zoom_yNumeric

Returns The zoom scale in height axis of the sprite.

Returns:

  • (Numeric)

    The zoom scale in height axis of the sprite



389
390
391
# File 'LiteRGSS.rb.yard.rb', line 389

def zoom_y
  @zoom_y
end

Class Method Details

.new(viewport)

Create a new Sprite

Parameters:

  • viewport (Viewport, Window)

    the viewport in which the sprite is shown, can be a Window



347
348
349
# File 'LiteRGSS.rb.yard.rb', line 347

def self.new(viewport)

end

Instance Method Details

#set_origin(ox, oy) ⇒ self

Define the origine of the sprite (inside the texture)

Parameters:

  • ox (Numeric)
  • oy (Numeric)

Returns:

  • (self)


361
362
363
# File 'LiteRGSS.rb.yard.rb', line 361

def set_origin(ox, oy)

end

#set_position(x, y) ⇒ self

Define the position of the sprite

Parameters:

  • x (Numeric)
  • y (Numeric)

Returns:

  • (self)


354
355
356
# File 'LiteRGSS.rb.yard.rb', line 354

def set_position(x, y)

end