Table of Contents

Class ANIMO

Namespace
PIKLib
Assembly
PIKLib.dll

2D sprite animation.

ANIMO : OBJECT
Inheritance
ANIMO
Inherited Members

Properties

FILENAME

A path to a file where the animation data is stored.

string FILENAME

Property Value

string

Remarks

The file must be in the ANN format.

See Also

FPS

Target animation speed (in frames per second).

int? FPS

Property Value

int?

Default value: NULL.

Remarks

The property overrides settings from a file.

See Also

MONITORCOLLISIONALPHA

Should the pixel-perfect collision algorithm be used instead of the default AABB one?

bool MONITORCOLLISIONALPHA

Property Value

bool

Default value: FALSE.

Remarks

The property is ignored if MONITORCOLLISION is set to FALSE.

See Also

MONITORCOLLISION

Should 2D collisions be detected for the object?

bool MONITORCOLLISION

Property Value

bool

Default value: FALSE.

Remarks

Setting the property to TRUE means ONCOLLISION callback is called.

By default, AABB collision algorithm is used.

See Also

PRELOAD

Should the file specified in FILENAME be loaded instantly?

bool PRELOAD

Property Value

bool

PRIORITY

The position of the object on the Z axis (directed out of the screen). Objects with greater priority are displayed over those with smaller priority.

int PRIORITY

Property Value

int

Remarks

For the same priority value, objects declared later are displayed over those declared before.

See Also

RELEASE

Should the file handle be released after loading the file specified in FILENAME?

bool RELEASE

Property Value

bool

TOCANVAS

bool TOCANVAS

Property Value

bool

Default value: FALSE.

Remarks

Without setting the property to TRUE, the object remains invisible.

VISIBLE

Should the object be visible by default?

bool VISIBLE

Property Value

bool

Default value: FALSE.

See Also

Methods

GETCENTERX()

Retrieves the horizontal position of the center of the object (in pixels).

int GETCENTERX()

Returns

int

The horizontal position of the object's center (in pixels).

GETCENTERY()

Retrieves the vertical position of the center of the object (in pixels).

int GETCENTERY()

Returns

int

The vertical position of the object's center (in pixels).

GETCFRAMEINEVENT()

Retrieves the 0-based index of the current frame within its parent (a sequence of frames).

int GETCFRAMEINEVENT()

Returns

int

The index of the current frame within the current event.

See Also

GETCURRFRAMEPOSX()

Retrieves the horizontal position of the current animation frame (in pixels).

int GETCURRFRAMEPOSX()

Returns

int

The horizontal position of the current animation frame (in pixels).

GETCURRFRAMEPOSY()

Retrieves the vertical position of the current animation frame (in pixels).

int GETCURRFRAMEPOSY()

Returns

int

The vertical position of the current animation frame (in pixels).

GETENDX()

Retrieves the horizontal position of the right edge of the object (in pixels).

int GETENDX()

Returns

int

The horizontal position of the object's right edge (in pixels).

GETENDY()

Retrieves the vertical position of the bottom edge of the object (in pixels).

int GETENDY()

Returns

int

The vertical position of the object's bottom edge (in pixels).

GETEVENTNAME()

Retrieves the name of the current (a sequence of frames).

string GETEVENTNAME()

Returns

string

The name of the current event.

GETFRAME()

Retrieves the 0-based index of the compound image pointed to by the current animation frame.

int GETFRAME()

Returns

int

The index of currently displayed animation image (not the index of a frame).

See Also

GETFRAMENAME()

Retrieves the name of the current frame.

string GETFRAMENAME()

Returns

string

The name of the current frame.

See Also

GETHEIGHT()

Retrieves the height of the current animation frame (in pixels).

int GETHEIGHT()

Returns

int

The height of the current animation frame (in pixels).

GETMAXWIDTH()

Checks the height of all compound images and returns the maximum (in pixels).

int GETMAXWIDTH()

Returns

int

The maximal possible height of the displayed image (in pixels).

GETNOE()

Retrieves the total number of animation events (sequences of frames).

int GETNOE()

Returns

int

The total number of animation events.

GETNOF()

Retrieves the total number of animation frames within the current (a sequence of frames).

int GETNOF()

Returns

int

The total number of animation frames within the current event.

GETNOFINEVENT(string)

Retrieves the total number of animation frames within the (a sequence of frames) identified by the given name.

int GETNOFINEVENT(string event_name)

Parameters

event_name string

The name of the to check.

Returns

int

The total number of animation frames within the specified event.

GETOPACITY()

Retrieves the general opacity of the animation.

int GETOPACITY()

Returns

int

The general opacity of the animation.

See Also

GETPOSITIONX()

Retrieves the horizontal position of the object (in pixels).

int GETPOSITIONX()

Returns

int

The horizontal position of the object (in pixels).

See Also

GETPOSITIONY()

Retrieves the base vertical position of the object (in pixels).

int GETPOSITIONY()

Returns

int

The base vertical position of the object (in pixels).

See Also

GETPRIORITY()

Retrieves the priority of the object.

int GETPRIORITY()

Returns

int

The priority of the object.

See Also

GETWIDTH()

Retrieves the width of the current animation frame (in pixels).

int GETWIDTH()

Returns

int

The width of the current animation frame (in pixels).

HIDE()

Makes the object invisible.

void HIDE()
See Also

INVALIDATE()

void INVALIDATE()

ISAT(int, int, bool)

bool ISAT(int x, int y, bool _)

Parameters

x int
y int
_ bool

Returns

bool

ISNEAR(string, string)

Checks if the object is near the other one.

bool ISNEAR(string other, string iou_threshold)

Parameters

other string

Another graphics object for which nearness with the current object is checked.

iou_threshold string

Minimum IoU value to treat two objects as being near each other.

Returns

bool

A boolean value indicating if objects are near each other.

ISPLAYING()

Checks if any animation (a sequence of frames) is currently being played.

bool ISPLAYING()

Returns

bool

Boolean value indicating if any animation is currently being played.

See Also

ISVISIBLE()

Checks if the object is visible.

bool ISVISIBLE()

Returns

bool

A boolean value indicating if the object is visible.

See Also

LOAD(string)

Loads animation data from the file located at the given path.

void LOAD(string filename)

Parameters

filename string

The path where the file is located.

MERGEALPHA()

void MERGEALPHA()

MONITORCOLLISION(bool)

Enables the 2D collision detection for the object.

void MONITORCOLLISION(bool pixel_perfect)

Parameters

pixel_perfect bool

Should the pixel-perfect collision algorithm be used instead of the default AABB one?

See Also

MOVE(int, int)

Moves the animation object by the given offset (in pixels).

void MOVE(int x_offset, int y_offset)

Parameters

x_offset int

A horizontal offset to be added to the current base object position.

y_offset int

A vertical offset to be added to the current base object position.

See Also

NEXT()

void NEXT()

NEXTFRAME()

void NEXTFRAME()

NPLAY()

void NPLAY()

PAUSE()

Pauses the current animation (a sequence of frames).

void PAUSE()
See Also

PLAY(int)

Plays animation identified by index event_index.

void PLAY(int event_index)

Parameters

event_index int

The 0-based index of the animation to be played.

Remarks

Makes the object visible.

Animation can loop depending on its definition (see ANN format specification).

See Also

PLAY(string)

Plays animation identified by name event_name.

void PLAY(string event_name)

Parameters

event_name string

The name of the animation to be played.

Remarks

Makes the object visible.

Animation can loop depending on its definition (see ANN format specification).

See Also

PREVFRAME()

void PREVFRAME()

REMOVEMONITORCOLLISION()

Disables the 2D collision detection for the object.

void REMOVEMONITORCOLLISION()
See Also

RESUME()

Unpauses the current animation (a sequence of frames).

void RESUME()
See Also

SETANCHOR(anchor)

void SETANCHOR(anchor anchor)

Parameters

anchor anchor

SETASBUTTON(bool, bool)

Enables or disables the object being interactable.

void SETASBUTTON(bool as_button, bool with_cursor_pointer)

Parameters

as_button bool

Should interactibility be enabled?

with_cursor_pointer bool

Should the mouse cursor icon be changed to pointer when it hovers over the interactable area? The argument is ignored if as_button is FALSE.

Remarks

Interactibility means reacting to mouse cursor being hovered and mouse button being clicked over the displayed object. In reaction to these events, the following signals are fires: ONFOCUSON, ONFOCUSOFF, ONCLICK, ONRELEASE.

The interactable area is the AABB representing the frame at the time of calling the method.

SETBACKWARD()

void SETBACKWARD()

SETCLIPPING()

void SETCLIPPING()

SETFORWARD()

void SETFORWARD()

SETFPS(int)

Sets the animation speed (in frames per second).

void SETFPS(int fps)

Parameters

fps int

Remarks

The property overrides settings from a file.

See Also

SETFRAME(int)

Changes the currently displayed frame to the image identified by the given index.

void SETFRAME(int image_index)

Parameters

image_index int

Remarks

If any animation (a sequence of frames) is currently played, the image set by this method gets overwritten by the next update.

See Also

SETFRAME(string, int)

Changes the currently displayed frame to the one identified by the given index within the of name event_name.

void SETFRAME(string event_name, int frame_index)

Parameters

event_name string
frame_index int
See Also

SETFRAMENAME(string)

Changes the name of the current frame.

void SETFRAMENAME(string frame_name)

Parameters

frame_name string

The name to be set.

See Also

SETOPACITY(int)

Sets the general opacity of the animation.

void SETOPACITY(int opacity)

Parameters

opacity int

The opacity to be set.

See Also

SETPOSITION(int, int)

Sets the base position of the animation.

void SETPOSITION(int x, int y)

Parameters

x int

The horizontal position to be set (in pixels).

y int

The vertical position to be set (in pixels).

See Also

SETPRIORITY(int)

Sets the priority of the object.

void SETPRIORITY(int priority)

Parameters

priority int

The priority to be set.

See Also

SHOW()

Makes the object visible.

void SHOW()
See Also

STOP(bool)

Stops the animation (a sequence of frames) being currently played.

void STOP(bool emit_on_finished = true)

Parameters

emit_on_finished bool

Should the ONFINISHED signal be emitted?

Events

ONCLICK

A handler for the signal emitted when the object is in interactive mode and a mouse button is pressed over it.

SignalHandler? ONCLICK

Event Type

SignalHandler
See Also

ONCOLLISION

A handler for the signal emitted when the object is in collision with another object.

SignalHandler<other_name>? ONCOLLISION

Event Type

SignalHandler<other_name>

Remarks

Can be specialized using the other_name parameter which is the name of the object with which the current object collides.

See Also

ONFINISHED

A handler for the signal emitted when an animation has finished playing.

SignalHandler<event_name>? ONFINISHED

Event Type

SignalHandler<event_name>

Remarks

Can be specialized using the event_name parameter which is the name of the finished event.

See Also

ONFOCUSOFF

A handler for the signal emitted when the object is in interactive mode and the mouse cursors is moved outside its area.

SignalHandler? ONFOCUSOFF

Event Type

SignalHandler
See Also

ONFOCUSON

A handler for the signal emitted when the object is in interactive mode and the mouse cursors is moved onto it.

SignalHandler? ONFOCUSON

Event Type

SignalHandler
See Also

ONFRAMECHANGED

A handler for the signal emitted when the displayed frame changes as a result of an animation being played.

SignalHandler? ONFRAMECHANGED

Event Type

SignalHandler

Remarks

Can be specialized using the event_name parameter which is the name of the currently being played.

See Also

ONINIT

A handler for the signal emitted when the object is initialized.

SignalHandler? ONINIT

Event Type

SignalHandler

ONRELEASE

A handler for the signal emitted when the object is in interactive mode and a mouse button is released over it.

SignalHandler? ONRELEASE

Event Type

SignalHandler
See Also

ONSIGNAL

A handler for the signal emitted when a custom message is sent.

SignalHandler<signal_name>? ONSIGNAL

Event Type

SignalHandler<signal_name>

Remarks

Can be specialized using the event_name parameter which is the name of the currently being played.

ONSTARTED

A handler for the signal emitted when an animation has started playing.

SignalHandler<event_name>? ONSTARTED

Event Type

SignalHandler<event_name>

Remarks

Can be specialized using the event_name parameter which is the name of the started event.

See Also