The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
Files | |
| file | SoSprite.c |
| file | SoSprite.h |
Data Structures | |
| struct | SoSprite |
| Structure representing a single sprite. More... | |
Functions | |
| void | SoSpriteDisable (SoSprite *a_This) |
| Disables rendering of this sprite. | |
| void | SoSpriteFlipHorizontal (SoSprite *a_This) |
| Flips the sprite horizontally. | |
| void | SoSpriteFlipVertical (SoSprite *a_This) |
| Flips the sprite vertically. | |
| u32 | SoSpriteGetWidth (SoSprite *a_This) |
| Returns the width of the sprite. | |
| u32 | SoSpriteGetHeight (SoSprite *a_This) |
| Returns the height of the sprite. | |
| void | SoSpriteSetTranslate (SoSprite *a_This, s32 a_X, s32 a_Y) |
| Sets the screen position of the top left corner of the sprite. | |
| void | SoSpriteSetMosaicEnable (SoSprite *a_This, bool a_Enable) |
| Enabs the mosaic for this sprite. | |
| void | SoSpriteSetSizeDoubleEnable (SoSprite *a_This, bool a_Enable) |
| Enables double size for the sprite. | |
| void | SoSpriteSetRotationAndScaleEnable (SoSprite *a_This, bool a_Enable) |
| Enables sprite rotation and scaling. | |
| void | SoSpriteSetRotationAndScaleIndex (SoSprite *a_This, u32 a_Index) |
| Sets the index used for sprite scale and rotation settings. | |
| void | SoSpriteSet256ColorMode (SoSprite *a_This, bool a_Enable) |
| Sets the sprite to 256 color palette mode instead of 16 color palettes. | |
| void | SoSpriteSetAnimationIndex (SoSprite *a_This, u32 a_Index) |
| Sets the animation (character-data) this sprite should use. | |
| u32 | SoSpriteGetAnimationIndex (SoSprite *a_This) |
| Returns the animation index the sprite is using. | |
| void | SoSpriteSetSize (SoSprite *a_This, u32 a_Width, u32 a_Height) |
| Sets the size of the sprite. | |
| void | SoSpriteSetPriority (SoSprite *a_This, u32 a_Priority) |
| changes the display priority for a particular sprite | |
| void | SoSpriteCopyPropertiesFromAnimation (SoSprite *a_This, const SoSpriteAnimation *a_Animation) |
| Copies the size and color attributes from a certain animation. | |
| void | SoSpriteSet16ColorPaletteIndex (SoSprite *a_This, u16 a_Index) |
| set the sprite to use one of the 16 palettes available in 16 color mode | |
This module contains all single sprite functionality. It works together with the SoSpriteManager and SoSpriteMemManager to create a complete sprite system. So before you start using SoSprite objects read about these other two modules too.
One other thing. Sometimes sprites are referred to as objects or OBJ's. This is all the same.
|
||||||||||||
|
Copies the size and color attributes from a certain animation.
// Include the animation data; #include "someAnimation.data"; // Request a location in OAM; SoSprite* sprite = SoSpriteManagerRequestSprite(); // Load the animation and assign it to the sprite; SoSpriteSetAnimationIndex( someSprite, SoSpriteMemManagerLoad( someAnimation ) ); // Copy the animation's properties. SoSpriteCopyPropertiesFromAnimation( someSprite, someAnimation ); |
|
|
Disables rendering of this sprite.
|
|
|
Flips the sprite horizontally.
|
|
|
Flips the sprite vertically.
|
|
|
Returns the animation index the sprite is using.
|
|
|
Returns the height of the sprite.
|
|
|
Returns the width of the sprite.
|
|
||||||||||||
|
set the sprite to use one of the 16 palettes available in 16 color mode
|
|
||||||||||||
|
Sets the sprite to 256 color palette mode instead of 16 color palettes.
SoSpriteCopyPropertiesFromAnimation( someSprite, someAnimation ); And the sprite will have the correct color mode. |
|
||||||||||||
|
Sets the animation (character-data) this sprite should use.
SoSprite* sprite = SoSpriteManagerRequestSprite(); SoSpriteSetAnimationIndex( someSprite, SoSpriteMemManagerLoad( someAnimation ) ); See the SoSpriteMemManagerLoad function for more information. But basically it loads a certain animation data in sprite character memory and returns the index in sprite character memory. If this is not clear, mail me. I'll update the docs. |
|
||||||||||||
|
Enabs the mosaic for this sprite.
|
|
||||||||||||
|
changes the display priority for a particular sprite
When the priority of two sprites is the same, the sprite with the lower index number is displayed on top. When the priority of a sprite is the same as the priority of a background, the sprite is displayed on top. |
|
||||||||||||
|
Enables sprite rotation and scaling.
|
|
||||||||||||
|
Sets the index used for sprite scale and rotation settings.
|
|
||||||||||||||||
|
Sets the size of the sprite.
8x8 16x16 32x32 64x64 8x16 8x32 16x32 32x64 16x8 32x8 32x16 64x32 In debug mode these values are asserted. Note that you will rarely use this function, cause you can deduce these values from the animation you want the sprite to use. So when you've loaded an animation, and you have a certain sprite, you can do the following:
SoSpriteCopyPropertiesFromAnimation( someSprite, someAnimation ); And the sprite will have the correct size. |
|
||||||||||||
|
Enables double size for the sprite.
|
|
||||||||||||||||
|
Sets the screen position of the top left corner of the sprite.
|