It provides display animated sprites.
Types
AnimatedSpriteObj = object of Node2DObj reversed*, paused*: bool filter*: ColorRef animation*: string animations*: AnimationArray[GlTextureObj]
AnimatedSpriteRef = ref AnimatedSpriteObj
Procs
proc AnimatedSprite(name: string = "AnimatedSprite"): AnimatedSpriteRef {...}{. raises: [], tags: [].}
-
Creates a new AnimatedSprite.
Arguments:
- name is a node name.
Example:
var node = AnimatedSprite("AnimatedSprite")
Methods
method draw(self: AnimatedSpriteRef; w, h: GLfloat) {...}{.raises: [GLerror], tags: [].}
- this method uses in the window.nim.
method duplicate(self: AnimatedSpriteRef): AnimatedSpriteRef {...}{.base, raises: [], tags: [].}
- Duplicates AnimatedSprite object and create a new AnimatedSprite.
method addAnimation(self: AnimatedSpriteRef; name: string; speed: float = 2.0'f32) {...}{.base, raises: [], tags: [].}
-
Adds a new animation to the AnimatedSprite animations.
Arguments:
- name is an animation name.
- speed is an animation speed.
method addFrame(self: AnimatedSpriteRef; name: string; frame: GlTextureObj) {...}{. base, raises: [], tags: [].}
-
Adds a new frame in the animation.
Arguments:
- name is an animation name.
method removeAnimation(self: AnimatedSpriteRef; name: string) {...}{.base, raises: [GLerror], tags: [].}
-
Deletes animation from the AnimatedSprite animations. If name is a current animation name, then animation will not delete.
Arguments:
- name is an animation name.
method pause(self: AnimatedSpriteRef) {...}{.base, raises: [], tags: [].}
- Stops animation.
method play(self: AnimatedSpriteRef; name: string = ""; backward: bool = false) {...}{. base, raises: [], tags: [].}
-
Plays animation.
Arguments:
- name is an animation name. if it is "" than plays current animation.
- if backward is true then plays animation in reverse order.
method resume(self: AnimatedSpriteRef) {...}{.base, raises: [], tags: [].}
- Resumes animation.
method setSpeed(self: AnimatedSpriteRef; name: string = ""; speed: float = 2.0'f32) {...}{.base, raises: [], tags: [].}
-
Changes animation speed. If name is "" then changes the speed of the current animation.
Arguments:
- name is an animation name.
- speed is a new speed.