Create a grid image with all character directions and use an XML to load it. (sprites.xml)
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<sprite name="character">
<image file="./sprites/character.png">
<grid size="32,32" array="4,1" />
</image>
<rotation origin="center"/>
<translation origin="center"/>
<animation speed="50" loop="yes" pingpong="no" />
</sprite>
</resources>
Create a an enum or array for each direction as they correspond to the grid.
Code:
enum {chr_down, chr_left, chr_up, chr_right};
Create a class or struct to hold the character. You probably do this anyhow.
Code:
struct PLAYER
{
CL_Sprite mySprite;
};
Load the xml when your program inits'
Code:
CL_ResourceManager res_sprites("./assets/sprites.xml");
When you create a character who has his own sprite and direction...
Code:
PLAYER newPlayer;
newPlayer.mySprite = CL_Sprite(gc, "character", &resspritesui);
When you want to change the characters orientation / facing direction use the enums to set the frame.
Code:
newPlayer.mySprite.iSprite_cursor_normal.set_frame(chr_left);
I hope that helps, I'm no expert and I certainly didn't test this code. 
edit: I realize this isn't exactly what you wanted but you can just add x amount of sprites in the PLAYER struct for each direction.
Bookmarks