Animations
Description
Animations in SwinGame can be used to move between cells in bitmaps and sprites. Each Animation generates a number sequence that can then be used when drawing bitmaps.
Animation Current Cell
Returns the current cell (the part of the image or sprite) of this animation. This can be used to animate an image or sprite.
- Animation Current Cell (anim) : Longint [show]
Returns the current cell (the part of the image or sprite) of this animation. This can be used to animate an image or sprite.
- Parameters:
-
- anim : Animation
- Returns:
- Longint :
- Signatures by Language:
- C/C++: int32_t animation_current_cell(animation anim);
- Pascal: function AnimationCurrentCell(anim: Animation): Longint;
Animation Current Vector
Returns the vector assigned to the current frame in the animation.
Animation Ended
Indicates if an animation has ended. Animations with loops will never end.
Animation Entered Frame
Returns true if the animation entered a new frame on its last update. This can be used to trigger actions on frames within an animation.
- Animation Entered Frame (anim) : Boolean [show]
Returns true if the animation entered a new frame on its last update. This can be used to trigger actions on frames within an animation.
- Parameters:
-
- anim : Animation
- Returns:
- Boolean :
- Signatures by Language:
- C/C++: bool animation_entered_frame(animation anim);
- Pascal: function AnimationEnteredFrame(anim: Animation): Boolean;
Animation Frame Time
Returns the amount of time spent in the current frame. When this exceeds the frame's duration the animation moves to the next frame.
- Animation Frame Time (anim) : Single [show]
Returns the amount of time spent in the current frame. When this exceeds the frame's duration the animation moves to the next frame.
- Parameters:
-
- anim : Animation
- Returns:
- Single :
- Signatures by Language:
- C/C++: float animation_frame_time(animation anim);
- Pascal: function AnimationFrameTime(anim: Animation): Single;
Animation Index
The index of the animation within the animation template that has the supplied name.
- Animation Index (temp, name) : Longint [show]
The index of the animation within the animation template that has the supplied name.
- Parameters:
-
- temp : AnimationScript
- name : String
- Returns:
- Longint :
- Signatures by Language:
- C/C++: int32_t animation_index(animation_script temp, const char *name);
- Pascal: function AnimationIndex(temp: AnimationScript; name: String): Longint;
Animation Name
The name of the animation within the animation template at the specified index.
- Animation Name (temp, idx) : String [show]
The name of the animation within the animation template at the specified index.
- Parameters:
-
- temp : AnimationScript
- idx : Longint
- Returns:
- String :
- Signatures by Language:
- C/C++: void animation_name(animation_script temp, int32_t idx, char *result);
- Pascal: function AnimationName(temp: AnimationScript; idx: Longint): String;
Animation Script Name
Returns the name of the Animation Script.
- Animation Script Name (script) : String [show]
Returns the name of the Animation Script.
- Parameters:
-
- script : AnimationScript
- Returns:
- String :
- Signatures by Language:
- C/C++: void animation_script_name(animation_script script, char *result);
- Pascal: function AnimationScriptName(script: AnimationScript): String;
Animation Script Named
Returns the AnimationScript that has been loaded with the specified name, see LoadAnimationScriptNamed.
- Animation Script Named (name) : AnimationScript [show]
Returns the AnimationScript that has been loaded with the specified name, see LoadAnimationScriptNamed.
- Parameters:
-
- name : String
- Returns:
- AnimationScript :
- Signatures by Language:
- C/C++: animation_script animation_script_named(const char *name);
- Pascal: function AnimationScriptNamed(name: String): AnimationScript;
Assign Animation
Assign a new starting animation to the passed in animation from the AnimationScript. This may play a sound if the first frame of the animation is linked to a sound effect.
- Assign Animation (anim, name, script) [show]
Assign a new starting animation to the passed in animation from the AnimationScript. This may play a sound if the first frame of the animation is linked to a sound effect.
- Parameters:
-
- anim : Animation
- name : String
- script : AnimationScript
- Signatures by Language:
- C/C++: void assign_animation_named(animation anim, const char *name, animation_script script);
- C++: void assign_animation(animation anim, const char *name, animation_script script);
- Pascal: procedure AssignAnimation(anim: Animation; name: String; script: AnimationScript);
- source code
- lib name: AssignAnimationNamed
- Assign Animation (anim, idx, script) [show]
Assign a new starting animation to the passed in animation from the AnimationScript. This may play a sound if the first frame of the animation is linked to a sound effect.
- Parameters:
-
- anim : Animation
- idx : Longint
- script : AnimationScript
- Signatures by Language:
- C/C++: void assign_animation(animation anim, int32_t idx, animation_script script);
- Pascal: procedure AssignAnimation(anim: Animation; idx: Longint; script: AnimationScript);
- Assign Animation (anim, name, script, withSound) [show]
Assign a new starting animation to the passed in animation from the AnimationScript. This may play a sound if the first frame of the animation is linked to a sound effect, and withSound is true.
- Parameters:
-
- anim : Animation
- name : String
- script : AnimationScript
- withSound : Boolean
- Signatures by Language:
- C/C++: void assign_animation_named_with_sound(animation anim, const char *name, animation_script script, bool withSound);
- C++: void assign_animation(animation anim, const char *name, animation_script script, bool withSound);
- Pascal: procedure AssignAnimation(anim: Animation; name: String; script: AnimationScript; withSound: Boolean);
- source code
- lib name: AssignAnimationNamedWithSound
- Assign Animation (anim, idx, script, withSound) [show]
Assign a new starting animation to the passed in animation from the AnimationScript. This may play a sound if the first frame of the animation is linked to a sound effect, and withSound is true.
- Parameters:
-
- anim : Animation
- idx : Longint
- script : AnimationScript
- withSound : Boolean
- Signatures by Language:
- C/C++: void assign_animation_with_sound(animation anim, int32_t idx, animation_script script, bool withSound);
- C++: void assign_animation(animation anim, int32_t idx, animation_script script, bool withSound);
- Pascal: procedure AssignAnimation(anim: Animation; idx: Longint; script: AnimationScript; withSound: Boolean);
- source code
- lib name: AssignAnimationWithSound
Create Animation
Creates an animation from an AnimationScript. This may play a sound effect if the animation is set to play a sound effect on its first frame.
- Create Animation (identifier, script) : Animation [show]
Creates an animation from an AnimationScript. This may play a sound effect if the animation is set to play a sound effect on its first frame.
- Parameters:
-
- identifier : Longint
- script : AnimationScript
- Returns:
- Animation :
- Signatures by Language:
- C/C++: animation create_animation_with_sound(int32_t identifier, animation_script script);
- C++: animation create_animation(int32_t identifier, animation_script script);
- Pascal: function CreateAnimation(identifier: Longint; script: AnimationScript): Animation;
- source code
- lib name: CreateAnimationWithSound
- Create Animation (identifier, script) : Animation [show]
Creates an animation from a AnimationScript. This may play a sound effect if the animation is set to play a sound effect on its first frame.
- Parameters:
-
- identifier : String
- script : AnimationScript
- Returns:
- Animation :
- Signatures by Language:
- C/C++: animation create_animation_named(const char *identifier, animation_script script);
- C++: animation create_animation(const char *identifier, animation_script script);
- Pascal: function CreateAnimation(identifier: String; script: AnimationScript): Animation;
- source code
- lib name: CreateAnimationNamed
- Create Animation (identifier, script, withSound) : Animation [show]
Creates an animation from an AnimationScript. If withSound is true, this may play a sound effect if the animation is set to play a sound effect on its first frame.
- Parameters:
-
- identifier : Longint
- script : AnimationScript
- withSound : Boolean
- Returns:
- Animation :
- Signatures by Language:
- C/C++: animation create_animation(int32_t identifier, animation_script script, bool withSound);
- Pascal: function CreateAnimation(identifier: Longint; script: AnimationScript; withSound: Boolean): Animation;
- Create Animation (identifier, script, withSound) : Animation [show]
Creates an animation from a AnimationScript. If withSound is true, this may play a sound effect if the animation is set to play a sound effect on its first frame.
- Parameters:
-
- identifier : String
- script : AnimationScript
- withSound : Boolean
- Returns:
- Animation :
- Signatures by Language:
- C/C++: animation create_animation_named_with_sound(const char *identifier, animation_script script, bool withSound);
- C++: animation create_animation(const char *identifier, animation_script script, bool withSound);
- Pascal: function CreateAnimation(identifier: String; script: AnimationScript; withSound: Boolean): Animation;
- source code
- lib name: CreateAnimationNamedWithSound
Draw Animation
Uses the animation information to draw a bitmap at the specified point.
- Draw Animation (ani, bmp, const pt) [show]
Uses the animation information to draw a bitmap at the specified point.
- Parameters:
- Signatures by Language:
- C/C++: void draw_animation_at_point(animation ani, bitmap bmp, const point2d *pt);
- C/C++: void draw_animation_at_point_byval(animation ani, bitmap bmp, const point2d pt);
- C++: void draw_animation(animation ani, bitmap bmp, const point2d &pt);
- Pascal: procedure DrawAnimation(ani: Animation; bmp: Bitmap; const pt: Point2D);
- source code
- lib name: DrawAnimationAtPoint
- Draw Animation (ani, bmp, x, y) [show]
- Draw Animation (dest, ani, bmp, const pt) [show]
Uses the animation information to draw a bitmap at the specified point on a destination bitmap.
- Parameters:
- Signatures by Language:
- C/C++: void draw_animation_onto_dest_at_pt(bitmap dest, animation ani, bitmap bmp, const point2d *pt);
- C/C++: void draw_animation_onto_dest_at_pt_byval(bitmap dest, animation ani, bitmap bmp, const point2d pt);
- C++: void draw_animation(bitmap dest, animation ani, bitmap bmp, const point2d &pt);
- Pascal: procedure DrawAnimation(dest: Bitmap; ani: Animation; bmp: Bitmap; const pt: Point2D);
- source code
- lib name: DrawAnimationOntoDestAtPt
- Draw Animation (dest, ani, bmp, x, y) [show]
Uses the animation information to draw a bitmap at the specified x,y location on a destination bitmap.
- Parameters:
- Signatures by Language:
- C/C++: void draw_animation_onto_dest(bitmap dest, animation ani, bitmap bmp, int32_t x, int32_t y);
- C++: void draw_animation(bitmap dest, animation ani, bitmap bmp, int32_t x, int32_t y);
- Pascal: procedure DrawAnimation(dest: Bitmap; ani: Animation; bmp: Bitmap; x: Longint; y: Longint);
- source code
- lib name: DrawAnimationOntoDest
Draw Animation On Screen
Uses the animation information to draw a bitmap to the screen at the specified point.
- Draw Animation On Screen (ani, bmp, const pt) [show]
Uses the animation information to draw a bitmap to the screen at the specified point.
- Parameters:
- Signatures by Language:
- C/C++: void draw_animation_on_screen_at_pt(animation ani, bitmap bmp, const point2d *pt);
- C/C++: void draw_animation_on_screen_at_pt_byval(animation ani, bitmap bmp, const point2d pt);
- C++: void draw_animation_on_screen(animation ani, bitmap bmp, const point2d &pt);
- Pascal: procedure DrawAnimationOnScreen(ani: Animation; bmp: Bitmap; const pt: Point2D);
- source code
- lib name: DrawAnimationOnScreenAtPt
- Draw Animation On Screen (ani, bmp, x, y) [show]
Uses the animation information to draw a bitmap to the screen at the specified x,y location.
Free Animation
Disposes of the resources used in the animation.
Free Animation Script
Frees loaded animation frames data. Use this when you will no longer be using the animation for any purpose, including within sprites.
- Free Animation Script (var scriptToFree) [show]
Frees loaded animation frames data. Use this when you will no longer be using the animation for any purpose, including within sprites.
- Parameters:
-
- scriptToFree : AnimationScript
- Signatures by Language:
- C/C++: void free_animation_script(animation_script *scriptToFree);
- C++: void free_animation_script(animation_script &scriptToFree);
- Pascal: procedure FreeAnimationScript(var scriptToFree: AnimationScript);
Has Animation Script
Determines if SwinGame has animation frames loaded for the supplied name. This checks against all loaded animation frames, those loaded without a name are assigned the filename as a default.
- Has Animation Script (name) : Boolean [show]
Determines if SwinGame has animation frames loaded for the supplied name. This checks against all loaded animation frames, those loaded without a name are assigned the filename as a default.
- Parameters:
-
- name : String
- Returns:
- Boolean :
- Signatures by Language:
- C/C++: bool has_animation_script(const char *name);
- Pascal: function HasAnimationScript(name: String): Boolean;
Load Animation Script
Load animation details from a animation frames file.
- Load Animation Script (filename) : AnimationScript [show]
Load animation details from a animation frames file.
- Parameters:
-
- filename : String
- Returns:
- AnimationScript :
- Signatures by Language:
- C/C++: animation_script load_animation_script(const char *filename);
- Pascal: function LoadAnimationScript(filename: String): AnimationScript;
Load Animation Script Named
Loads and returns a AnimationScript. The supplied filename is used to locate the AnimationScript to load. The supplied name indicates the name to use to refer to this in SwinGame. The AnimationScript can then be retrieved by passing this name to the AnimationScriptNamed function.
- Load Animation Script Named (name, filename) : AnimationScript [show]
Loads and returns a AnimationScript. The supplied filename is used to locate the AnimationScript to load. The supplied name indicates the name to use to refer to this in SwinGame. The AnimationScript can then be retrieved by passing this name to the AnimationScriptNamed function.
- Parameters:
-
- name : String
- filename : String
- Returns:
- AnimationScript :
- Signatures by Language:
- C/C++: animation_script load_animation_script_named(const char *name, const char *filename);
- Pascal: function LoadAnimationScriptNamed(name: String; filename: String): AnimationScript;
Release All Animation Scripts
Releases all of the animation templates that have been loaded.
- Release All Animation Scripts () [show]
Releases all of the animation templates that have been loaded.
Release Animation Script
Releases the SwinGame resources associated with the animation template of the specified name.
- Release Animation Script (name) [show]
Releases the SwinGame resources associated with the animation template of the specified name.
- Parameters:
-
- name : String
- Signatures by Language:
- C/C++: void release_animation_script(const char *name);
- Pascal: procedure ReleaseAnimationScript(name: String);
Restart Animation
Restarts the animation. This may play a sound effect if the first frame triggers a sound.
- Restart Animation (anim) [show]
Restarts the animation. This may play a sound effect if the first frame triggers a sound.
- Parameters:
-
- anim : Animation
- Signatures by Language:
- C/C++: void restart_animation(animation anim);
- Pascal: procedure RestartAnimation(anim: Animation);
- Restart Animation (anim, withSound) [show]
Restarts the animation. This may play a sound effect if the first frame triggers a sound and withSound is true.
- Parameters:
-
- anim : Animation
- withSound : Boolean
- Signatures by Language:
- C/C++: void reset_animation_with_sound(animation anim, bool withSound);
- C++: void restart_animation(animation anim, bool withSound);
- Pascal: procedure RestartAnimation(anim: Animation; withSound: Boolean);
- source code
- lib name: ResetAnimationWithSound
Update Animation
Updates the animation, updating the time spent and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Update Animation (anim) [show]
Updates the animation, updating the time spent and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Parameters:
-
- anim : Animation
- Signatures by Language:
- C/C++: void update_animation(animation anim);
- Pascal: procedure UpdateAnimation(anim: Animation);
- Update Animation (anim, pct) [show]
Updates the animation a certain percentage and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Parameters:
-
- anim : Animation
- pct : Single
- Signatures by Language:
- C/C++: void update_animation_pct(animation anim, float pct);
- C++: void update_animation(animation anim, float pct);
- Pascal: procedure UpdateAnimation(anim: Animation; pct: Single);
- source code
- lib name: UpdateAnimationPct
- Update Animation (anim, pct, withSound) [show]
Updates the animation a certain percentage and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound and withSound is true.
- Parameters:
-
- anim : Animation
- pct : Single
- withSound : Boolean
- Signatures by Language:
- C/C++: void update_animation_pct_and_sound(animation anim, float pct, bool withSound);
- C++: void update_animation(animation anim, float pct, bool withSound);
- Pascal: procedure UpdateAnimation(anim: Animation; pct: Single; withSound: Boolean);
- source code
- lib name: UpdateAnimationPctAndSound