System function reference

Actor list functions

Drawing functions

Mouse functions

Miscellaneous functions

resActorObject *resCreateActorObjectList( Actor *a )

Creates the linked lists for the drawable dynamic and static actors. This function is automatically called by Resolutionary, if resAddActorObject(); is trying to add an actor to an empty list.

Important
This function should not be called manually. Using the function incorrectly can lead to a memory leak.

Parameters

Return value

A pointer to the first actor object added to the new list, NULL on failure.

Example call

resCreateActorObjectList(&collide); // Add collide actor to the list as its first object

Back to top

resActorObject *resAddActorObject( Actor *a )

Adds an actor to the list of drawable actors.

Parameters

Return value

A pointer to the actor object added to the list, NULL on failure.

Example call

resAddActorObject(&collide); // Add collide actor to the list

Back to top

resActorObject *resSearchActorObject( Actor *a, resActorObject **prev )

Searches an actor object from the drawable actor list and also gives a pointer to the previous actor object in the list.

Important
This function returns two values. The second value, a pointer to the preceding object in the list, is returned via the argument prev.

Parameters

Return value

A pointer to the actor object that corresponds to the given actor, NULL if no match found. Also returns a pointer to the preceding object in the list, this pointer is returned via the argument prev.

Example call

resActorObject *del = NULL;  // Pointer to the actor object to delete
resActorObject *prev = NULL; // Pointer to the previous actor object in the list

del = resSearchActorObject(&getclone(clonename), &prev); // Find del and prev
resDeleteActorObjectByPointer(del, prev);                // Delete the actor object that represents the current actor

Back to top

int resDeleteActorObject( Actor *a )

Deletes a given actor's corresponding actor object from the list and frees the memory allocated for it.

Parameters

Return value

1 on success, 0 if no corresponding actor object was found for the given actor

Example call

resDeleteActorObject(&getclone(clonename)); // Delete the actor object that represents the current actor

Back to top

int resDeleteActorObjectByPointer( resActorObject *del, resActorObject *prev )

Deletes given actor object from the list and frees the memory allocated for it.

Parameters

Return value

1 on success, 0 if del is NULL

Example call

resActorObject *del = NULL;  // Pointer to the actor object to delete
resActorObject *prev = NULL; // Pointer to the previous actor object in the list

del = resSearchActorObject(&getclone(clonename), &prev); // Find del and prev
resDeleteActorObjectByPointer(del, prev);                // Delete the actor object that represents the current actor

Back to top

int resUnlinkActorObject( resActorObject *del, resActorObject *prev )

Removes an actor object's linking from the list. This function is called by Resolutionary when deleting an actor object.

Important
This function should not be called manually. Using the function incorrectly can lead to a memory leak.

Parameters

Return value

1 on success, 0 if del is NULL

Example call

resActorObject *del = NULL;  // Pointer to the actor object to delete
resActorObject *prev = NULL; // Pointer to the previous actor object in the list

del = resSearchActorObject(&getclone(clonename), &prev); // Find del and prev
resUnlinkActorObject(del, prev); // Unlink the actor object that represents the current actor

if (del)       // If a corresponding actor object was actually found
    free(del); // Free the memory allocated for the actor object that represents the current actor

del = NULL;    // Clear pointer

Back to top

void resDeleteActorObjectLists( void )

Deletes all actor objects in the lists and frees the memory allocated for them.

Example call

resDeleteActorObjectLists(); // Delete all actor objects and free all memory allocated for them

Back to top

void resDrawDynamicLayer( void )

Draws the dynamic layer.

Example call

resDrawDynamicLayer(); // Draw the dynamic layer

Back to top

void resDrawStaticLayer( void )

Draws the static layer.

Example call

resDrawStaticLayer(); // Draw the static layer

Back to top

void resSendStaticLayerActivationEvent( void )

Sends an activation event to the static layer canvas.

Example call

resSendStaticLayerActivationEvent(); // Send activation event to the static layer canvas

Back to top

void resHandleStaticLayerActivationEvent( void )

Handles the static layer canvas' activation events.

Example call

resSendStaticLayerActivationEvent(); // Handle the activation event

Back to top

void resDisplayDebugOverlay( void )

Draws the debug overlay that shows the following information:

Important
The debug overlay can only be drawn if the constant RES_DEBUG is 1.

Example call

resDisplayDebugOverlay(); // Display the debug overlay

Back to top

void resUpdateMouse( void )

Updates Resolutionary's mouse position. Also updates the variables resXmouse and resYmouse that should be used for reading mouse position instead of the usual xmouse and ymouse.

Example call

resUpdateMouse(); // Update Resolutionary's mouse

Back to top

int resUpdateMouseButtonDown( enum resMouseButtonsEnum mButtonNumber )

Updates the variable that holds the state of the given mouse button when the button is pressed down, and sends an activation event to all actors found in the current mouse actor position. The function also finds the actor with highest z depth at the mouse position, this information is used for allowing the system to simulate Game Editor's normal mouse behavior, where only the top actor can be clicked.

Parameters

Return value

0 on success, 1 if no actors in collision (i.e. nothing to click), 2 if memory allocation failed

Example call

resUpdateMouseButtonDown(RES_MOUSE_LEFT); // Update the status of left mouse button to pressed down

Back to top

void resUpdateMouseButtonUp( enum resMouseButtonsEnum mButtonNumber )

Updates the variable that holds the state of the given mouse button when the button is released, and sends an activation event to all actors that were found in the mouse actor's position when the button was pressed down.

Parameters

Example call

resUpdateMouseButtonUp(RES_MOUSE_LEFT); // Update the status of left mouse button to released

Back to top

int resSafeStrcat( char *destination, const char *source, int maxLen )

This function can be used to concatenate a string to another without having to worry about overflowing the destination string. If there's not enough space in the destination string, the function concatenates as many characters from the beginning of the source string as there is space for before the string has to be null terminated. Rest of the source string is cropped out of the concatenation.

Parameters

Return value

0 on success, 1 if some of the source string had to be cropped from concatenation

Example call

char myString[30] = "This is a string.";
char *addThis = " This is another string, a longer one.";

int cropOccured = 0;

cropOccured = resSafeStrcat(myString, addThis, sizeof myString); // Concatenate as much of addThis to myString as possible

sprintf(text, "myString: %s\ncropOccured: %i", myString, cropOccured);

// Will print:
//   myString: This is a string. This is ano
//   cropOccured: 1

Back to top

double resLimit( double value, double minVal, double maxVal )

Limits a value between given boundaries.

Parameters

Return value

If the given value is between the limit values, it is returned as it is, otherwise returns the exceeded limit value

Example call

x = resLimit(x, -100, 100); // Limit current actor's x between -100 and 100

Back to top

void resDisableMouseEvents( const char *actorName )

Disables all mouse events of a given actor.

Parameters

Example call

resDisableMouseEvents("Event Actor"); // Disable current actor's mouse events

Back to top

void resEnableMouseEvents( const char *actorName )

Enables all mouse events of a given actor.

Parameters

Example call

resEnableMouseEvents("Event Actor"); // Enable current actor's mouse events

Back to top

int resCheckActorExistence( const char *actorName )

Checks if an actor exists or not.

Parameters

Return value

1 if actor exists, 0 if not

Example call

if (!resCheckActorExistence("myActor")) // If myActor doesn't exist
{
    DestroyActor("Event Actor"); // Destroy current actor
}

Back to top

int resActorIsListed( Actor *a )

Checks if a given actor has already been added to either one of the drawable actor lists.

Parameters

Return value

1 if actor is on a list, 0 if not

Example call

if (!resActorIsListed(&collide)) // If collide actor is not listed yet
    resAddActorObject(&collide); // Add it

Back to top

This site uses Google code-prettify for syntax highlighting. Prettify is distributed under the Apache 2.0 License and is Copyright (C) 2011 Google Inc.