It provides display animated sprites.
Types
AnimatedSpriteObj = object of Node2DObj reversed*, paused*: bool filter*: ColorRef animation*: string animations*: AnimationArray[GlTextureObj]
AnimatedSpritePtr = ptr AnimatedSpriteObj
Procs
proc AnimatedSprite(name: string = "AnimatedSprite"): AnimatedSpritePtr {...}{.raises: [], tags: [].}
-
Creates a new AnimatedSprite pointer.
Arguments:
- name is a node name.
Examples:
var node = AnimatedSprite("AnimatedSprite")
Methods
method draw(self: AnimatedSpritePtr; w, h: GLfloat) {...}{.raises: [GLerror], tags: [].}
- this method uses in the window.nim.
method duplicate(self: AnimatedSpritePtr): AnimatedSpritePtr {...}{.base, raises: [], tags: [].}
- Duplicates AnimatedSprite object and create a new AnimatedSprite pointer.
method getGlobalMousePosition(self: AnimatedSpritePtr): Vector2Ref {...}{.inline, raises: [], tags: [].}
- Returns mouse position.
method addAnimation(self: AnimatedSpritePtr; 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: AnimatedSpritePtr; name: string; frame: GlTextureObj) {...}{.base, raises: [], tags: [].}
-
Adds a new frame in the animation.
Arguments:
- name is an animation name.
method removeAnimation(self: AnimatedSpritePtr; name: string) {...}{.base, raises: [], 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: AnimatedSpritePtr) {...}{.base, raises: [], tags: [].}
- Stops animation.
method play(self: AnimatedSpritePtr; 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: AnimatedSpritePtr) {...}{.base, raises: [], tags: [].}
- Resumes animation.
method setSpeed(self: AnimatedSpritePtr; 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.