![]() | ![]() ![]() |
| Home · Downloads · Your Account · Submit News |
|
Documentation Homepage HAMLib reference Back to HAM Homepage |
|
Functions | |
| void | ham_ResetObj () |
| Reinitialize the complete Obj (Sprite) system. | |
| u8 | ham_CreateObjFromGfxSlot (u16 slot, u16 obj_shape, u16 obj_size, u16 obj_mode, u16 col_mode, u16 pal_no,u16 mosaic, u16 hflip, u16 vflip, u16 prio, u16 dbl_size, u16 x, u16 y) |
| advanced: create a new OBJ from Existing GFX slot | |
| u8 | ham_CreateObj (void *src, u16 obj_shape, u16 obj_size, u16 obj_mode, u16 col_mode, u16 pal_no,u16 mosaic, u16 hflip, u16 vflip, u16 prio, u16 dbl_size, u16 x, u16 y) |
| create a new Sprite in HAM | |
| u8 | ham_CreateObjFromBg (u8 bgno, u32 bg_tileno_x, u32 bg_tileno_y, u16 obj_shape, u16 obj_size, u32 erase_bg, u32 tileno_filler) |
| advanced: create a Sprite from a piece of a BG Map | |
| u16 | ham_CreateObjGfx (void *src, u16 obj_shape, u16 obj_size, u16 col_mode) |
| advanced: create new sprite GFX in OBJ memory for later use | |
| void | ham_DeleteObjGfx (u16 slotno) |
| advanced: deallocate previously allocated GFX from a slot | |
| void | ham_SetObjBefore (u8 objno, u8 objno_target) |
| change the Z Order of Sprites amongst each other | |
| void | ham_UpdateObjGfx (u8 objno, void *src) |
| replace the graphics of an existing Sprite with new ones | |
| u16 | ham_GetObjGfxSlot (u8 objno) |
| advanced: retrieve the graphics slot of a sprite | |
| u8 | ham_GetObjPal16 (u8 objno) |
| retrieve the palette number of a 16col Sprite | |
| void | ham_SetObjGfxSlot (u8 objno, u16 slotno, u8 palno) |
| advanced: change GFX slot number of sprite to other existing block | |
| void | ham_UpdateObjPal16 (u8 objno, u8 pal_no) |
| Update palette number of a 16 color sprite | |
| void | ham_DeleteObj (u8 entryno) |
| Unload and delete an initialized Sprite | |
| u8 | ham_CloneObj (u8 objno, u16 x, u16 y) |
| Clone an existing Sprite | |
| void | ham_SetObjMode (u8 objno, u16 obj_mode) |
| Set a Sprites OBJ Mode | |
| void | ham_SetObjX (u8 objno, u16 x) |
| Set a Sprites X Position on the screen | |
| void | ham_SetObjY (u8 objno, u16 y) |
| Set a Sprites Y Position on the screen | |
| void | ham_SetObjXY (u8 objno, u16 x, u16 y) |
| Set a Sprites X and Y Position on the screen | |
| void | ham_SetObjMosaic (u8 objno, u8 val) |
| Enable Mosaic Mode for a sprite | |
| void | ham_SetObjDblSize (u8 objno, u8 val) |
| set douvle size Mode for Rotating Sprites | |
| void | ham_SetObjHFlip (u8 objno, u8 val) |
| apply horizontal flipping for a Sprite | |
| void | ham_SetObjVFlip (u8 objno, u8 val) |
| apply vertical flipping for a Sprite | |
| void | ham_SetObjPrio (u8 objno, u8 val) |
| Set the BG priority for a Sprite | |
| void | ham_SetObjVisible (u8 objno, u8 val) |
| Hide/Display an initialized Sprite | |
| void | ham_SetObjRotEnable (u8 objno, u8 val) |
| Enable a Sprite for Rotation | |
| void | ham_SetObjRotSetSelect (u8 objno, u8 val) |
| Assign a Sprite to a Rotation Set | |
| void | ham_CopyObjToOAM () |
| Commit all changes in HAM Sprite System to the GBA Hardware | |
| u32 | ham_GetObjAvailable () |
| Return the number of available Sprites | |
In HAMlib, sprites are often referred to as OBJ.
The core features of the GBA's Sprite system are:
|
||||||||||||||||
|
Clone an existing Sprite
See also: ham_CreateObj() ham_CreateObjFromGfxSlot() ham_DeleteObj() ham_DeleteObjGfx() ham_CopyObjToOAM() |
|
|
Commit all changes in HAM Sprite System to the GBA Hardware
This function will update all changes made to the HAM Sprite System into the GBA hardware. You will only see your changes if you call this. Usually, you should call this in a vertical blank Interrupt, see ham_StartIntHandler() for more information about this. See also: ham_CreateObj() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
create a new Sprite in HAM
Note that this Sprite will not show up on the GBA screen until you run ham_CopyObjToOAM() . See also: ham_CloneObj() , ham_DeleteObj() , ham_SetObjXY() , ham_GetObjGfxSlot() ham_CopyObjToOAM() |
|
||||||||||||||||||||||||||||||||
|
advanced: create a Sprite from a piece of a BG Map
WARNING: This function currently assumes that your BG and OBJ palette are the same. It currently does NOT support automatic palette switching/altering. This means, if you have different palettes in OBJ and BG, your graphics might look weird after creating a sprite with this function. See also: ham_CreateObjFromGfxSlot() , ham_SetObjGfxSlot() , ham_GetObjGfxSlot() , ham_DeleteObjGfx() |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
advanced: create a new OBJ from Existing GFX slot
An example where this would be useful is when you have a puzzle game that has 3 different colored gems, that are used a lot of times. You could then upload the GFX for these three gems, and create sprites from these GFX without the need of reloading them. You could in addition change the color of the gem by pointing it to new GFX later using ham_SetObjGfxSlot() . Confused? :-) This function returns a handle of a completely operating OBJ (an objno), that can be used in subsequent calls in the HAM sprite system. See also: ham_CreateObj() , ham_CloneObj() , ham_CreateObjGfx() , ham_SetObjGfxSlot() , ham_GetObjGfxSlot() , ham_DeleteObjGfx() ham_CopyObjToOAM() |
|
||||||||||||||||||||
|
advanced: create new sprite GFX in OBJ memory for later use
See also: ham_CreateObjFromGfxSlot() , ham_SetObjGfxSlot() , ham_GetObjGfxSlot() , ham_DeleteObjGfx() ham_CopyObjToOAM() |
|
|
Unload and delete an initialized Sprite
See also: ham_CreateObj() ham_CreateObjFromGfxSlot() ham_CloneObj() |
|
|
advanced: deallocate previously allocated GFX from a slot
be very careful: calling this function when sprites are still using the gfx is dangerous, and calling it multiple times for a block can result in the sprite graphics getting deleted before all sprites are finished using it. This is a rather advanced function, please make sure you know what you are doing when deleting sprite gfx without deleting actual sprites. See also: ham_CreateObjFromGfxSlot() , ham_SetObjGfxSlot() , ham_GetObjGfxSlot() , ham_DeleteObjGfx() |
|
|
Return the number of available Sprites
This function will return the number of sprites that are currently available (not yet used). See also: ham_CreateObj() |
|
|
advanced: retrieve the graphics slot of a sprite
See also: ham_SetObjGfxSlot() , ham_CreateObjFromGfxSlot() ham_CopyObjToOAM() |
|
|
retrieve the palette number of a 16col Sprite
See also: ham_SetObjPal16() |
|
|
Reinitialize the complete Obj (Sprite) system.
This function will reset the Sprite system of HAMlib to its initial state. It will clear all sprite graphics, remove all sprite assignments and commit the changes to the hardware. Calling this results in the initial state of the OBJ system. See also: ham_CreateObj() ham_DeleteObj() ham_ResetBg() |
|
||||||||||||
|
change the Z Order of Sprites amongst each other
See also: ham_SetObjXY() , ham_SetObjPrio() |
|
||||||||||||
|
set douvle size Mode for Rotating Sprites
See also: ham_CreateObj() ham_SetObjVFlip() ham_CopyObjToOAM() |
|
||||||||||||||||
|
advanced: change GFX slot number of sprite to other existing block
See also: ham_GetObjGfxSlot() |
|
||||||||||||
|
apply horizontal flipping for a Sprite
See also: ham_CreateObj() ham_SetObjVFlip() ham_CopyObjToOAM() |
|
||||||||||||
|
Set a Sprites OBJ Mode
|
|
||||||||||||
|
Enable Mosaic Mode for a sprite
See also: ham_CreateObj() ham_CopyObjToOAM() |
|
||||||||||||
|
Set the BG priority for a Sprite
See also: ham_CreateObj() ham_InitBg() ham_CopyObjToOAM() |
|
||||||||||||
|
Enable a Sprite for Rotation
See also: ham_SetObjRotSetSelect() ham_CopyObjToOAM() |
|
||||||||||||
|
Assign a Sprite to a Rotation Set
See also: ham_SetObjRotEnable() ham_RotObjDefineSet() |
|
||||||||||||
|
apply vertical flipping for a Sprite
See also: ham_CreateObj() ham_SetObjHFlip() ham_CopyObjToOAM() |
|
||||||||||||
|
Hide/Display an initialized Sprite
|
|
||||||||||||
|
Set a Sprites X Position on the screen
See also: ham_SetObjXY() ham_SetObjY() ham_CopyObjToOAM() |
|
||||||||||||||||
|
Set a Sprites X and Y Position on the screen
See also: ham_SetObjXY() ham_SetObjY() ham_CopyObjToOAM() |
|
||||||||||||
|
Set a Sprites Y Position on the screen
See also: ham_SetObjXY() ham_SetObjX() ham_CopyObjToOAM() |
|
||||||||||||
|
replace the graphics of an existing Sprite with new ones
If you need to be more flexible or have performance issues with continously reloading Gfx for many sprites, consider using ham_CreateObjGfx() and ham_SetObjGfxSlot() instead, which is much cooler, but more dangerous... :) See also: ham_CreateObj() , ham_CloneObj() ham_CopyObjToOAM() |
|
||||||||||||
|
Update palette number of a 16 color sprite
See also: ham_CreateObj() ham_SetObjPal16() ham_CopyObjToOAM() |