NightFox’s Lib
|
Functions to load and manage bitmap backgrounds. More...
Data Structures | |
struct | NF_TYPE_BG16B_INFO |
Struct that holds information about 16-bit bitmap backgrounds. More... | |
struct | NF_TYPE_BG8B_INFO |
Struct that holds information about 8-bit bitmap backgrounds. More... | |
struct | NF_TYPE_BB8B_INFO |
Information of a backbuffer of 8 bit. More... | |
Macros | |
#define | NF_SLOTS_BG16B 16 |
Maximum number of slots of 16-bit bitmap backgrounds. | |
#define | NF_SLOTS_BG8B 16 |
Maximum number of slots of 8-bit bitmap backgrounds. | |
Functions | |
void | NF_Init16bitsBgBuffers (void) |
Initialize buffers to store 16-bit bitmap backgrounds. More... | |
void | NF_Reset16bitsBgBuffers (void) |
Resets all 16 bit background buffers and clears them. More... | |
void | NF_Init16bitsBackBuffer (int screen) |
Initialize the 16 bit background backbuffer of the selected screen. More... | |
void | NF_Enable16bitsBackBuffer (int screen) |
Enables the 16-bit backbuffer of the selected screen. More... | |
void | NF_Disble16bitsBackBuffer (int screen) |
Disables the 16-bit backbuffer of selected screen. More... | |
void | NF_Flip16bitsBackBuffer (int screen) |
Sends the 16-bit backbuffer to the VRAM of the selected screen. More... | |
void | NF_InitBitmapBgSys (int screen, u32 mode) |
Initializes the selected screen in "bitmap" mode. More... | |
void | NF_Load16bitsBg (const char *file, u32 slot) |
Loads a 16-bit bitmap from the filesystem. More... | |
void | NF_Load16bitsImage (const char *file, u32 slot, u32 size_x, u32 size_y) |
Loads a 16 bits image into a RAM slot. More... | |
void | NF_Unload16bitsBg (u32 slot) |
Deletes from RAM the 16-bit image stored in the selected slot. More... | |
void | NF_Copy16bitsBuffer (int screen, int destination, u32 slot) |
Copy the selected 16-bit slot to VRAM or the backbuffer. More... | |
void | NF_Draw16bitsImage (int screen, u32 slot, s32 x, s32 y, bool alpha) |
Draws the image in a slot into the backbuffer of the selected screen. More... | |
void | NF_Init8bitsBgBuffers (void) |
Initialize buffers to store 8-bit bitmap backgrounds. More... | |
void | NF_Reset8bitsBgBuffers (void) |
Resets all 8 bit background buffers and clears them. More... | |
void | NF_Load8bitsBg (const char *file, u32 slot) |
Loads a 8-bit bitmap from the filesystem. More... | |
void | NF_Unload8bitsBg (u32 slot) |
Deletes from RAM the 8-bit image stored in the selected slot. More... | |
void | NF_Copy8bitsBuffer (int screen, int destination, u32 slot) |
Copy the selected 8-bit slot to VRAM or the backbuffer. More... | |
void | NF_Init8bitsBackBuffer (int screen) |
Initialize the 8 bit background backbuffer of the selected screen. More... | |
void | NF_Enable8bitsBackBuffer (int screen) |
Enables the 8-bit backbuffer of the selected screen. More... | |
void | NF_Disble8bitsBackBuffer (int screen) |
Disables the 8-bit backbuffer of selected screen. More... | |
void | NF_Flip8bitsBackBuffer (int screen, int destination) |
Sends the 8-bit backbuffer to the VRAM of the selected screen. More... | |
Variables | |
NF_TYPE_BG16B_INFO | NF_BG16B [NF_SLOTS_BG16B] |
Information of all 16-bit bitmap backgrounds. | |
NF_TYPE_BG8B_INFO | NF_BG8B [NF_SLOTS_BG8B] |
Information of all 8-bit bitmap backgrounds. | |
NF_TYPE_BB8B_INFO | NF_8BITS_BACKBUFFER [2] |
Backbuffer of 8 bit of each screen. | |
Functions to load and manage bitmap backgrounds.
void NF_Copy16bitsBuffer | ( | int | screen, |
int | destination, | ||
u32 | slot | ||
) |
Copy the selected 16-bit slot to VRAM or the backbuffer.
Example:
screen | Screen (0 - 1). |
destination | Use 0 for VRAM or 1 for backbuffer. |
slot | Slot number (0 - 15). |
void NF_Copy8bitsBuffer | ( | int | screen, |
int | destination, | ||
u32 | slot | ||
) |
Copy the selected 8-bit slot to VRAM or the backbuffer.
Example:
screen | Screen (0 - 1). |
destination | Use 0 for VRAM or 1 for backbuffer. |
slot | Slot number (0 - 15). |
void NF_Disble16bitsBackBuffer | ( | int | screen | ) |
Disables the 16-bit backbuffer of selected screen.
It frees the RAM used by it (128 KB).
screen | Screen (0 - 1). |
void NF_Disble8bitsBackBuffer | ( | int | screen | ) |
Disables the 8-bit backbuffer of selected screen.
It frees the RAM used by it (64 KB).
screen | Screen (0 - 1). |
void NF_Draw16bitsImage | ( | int | screen, |
u32 | slot, | ||
s32 | x, | ||
s32 | y, | ||
bool | alpha | ||
) |
Draws the image in a slot into the backbuffer of the selected screen.
You can specify the coordinates where the image is drawn.
If "alpha" is set to true, all magenta pixels (0xFF00FF) won't be drawn.
Example:
screen | Screen (0 - 1). |
slot | Slot number (0 - 15). |
x | X coordinate. |
y | Y coordinate. |
alpha | True to make magenta pixels transparent. |
void NF_Enable16bitsBackBuffer | ( | int | screen | ) |
Enables the 16-bit backbuffer of the selected screen.
If the backbuffer is already enabled, the contents are cleared.
screen | Screen (0 - 1). |
void NF_Enable8bitsBackBuffer | ( | int | screen | ) |
Enables the 8-bit backbuffer of the selected screen.
If the backbuffer is already enabled, the contents are cleared.
screen | Screen (0 - 1). |
void NF_Flip16bitsBackBuffer | ( | int | screen | ) |
Sends the 16-bit backbuffer to the VRAM of the selected screen.
Use it to edit the image in the backbuffer and to update the image displayed on the screen without showing the drawing process (which may be very slow).
screen | Screen (0 - 1). |
void NF_Flip8bitsBackBuffer | ( | int | screen, |
int | destination | ||
) |
Sends the 8-bit backbuffer to the VRAM of the selected screen.
Use it to edit the image in the backbuffer and to update the image displayed on the screen without showing the drawing process (which may be very slow).
You can send it to layer 2 (0) or layer 3 (1).
screen | Screen (0 - 1). |
destination | Destination layer (0: layer 2, 1: layer 3). |
void NF_Init16bitsBackBuffer | ( | int | screen | ) |
Initialize the 16 bit background backbuffer of the selected screen.
Use this function once before using the backbuffer.
screen | Screen (0 - 1). |
void NF_Init16bitsBgBuffers | ( | void | ) |
Initialize buffers to store 16-bit bitmap backgrounds.
You must call this function once in you code before loading any 16-bit bitmap.
void NF_Init8bitsBackBuffer | ( | int | screen | ) |
Initialize the 8 bit background backbuffer of the selected screen.
Use this function once before using the backbuffer.
screen | Screen (0 - 1). |
void NF_Init8bitsBgBuffers | ( | void | ) |
Initialize buffers to store 8-bit bitmap backgrounds.
You must call this function once in you code before loading any 8-bit bitmap.
void NF_InitBitmapBgSys | ( | int | screen, |
u32 | mode | ||
) |
Initializes the selected screen in "bitmap" mode.
The color depth of the bitmap can be 8 or 16 bits.
The DS 2D engine must be set to video mode 5.
Example:
screen | Screen (0 - 1). |
mode | Depth mode (0: 8 bits / 256 colors; 1: 16 bits) |
void NF_Load16bitsBg | ( | const char * | file, |
u32 | slot | ||
) |
Loads a 16-bit bitmap from the filesystem.
The file must be in binary format ".img", and its max size is 256x256 pixels (128 KB).
You can convert the file using this GRIT command line:
You can load as many files as defined in NF_SLOTS_BG16B.
Example:
file | File name without extension. |
slot | Slot number (0 - 15). |
void NF_Load16bitsImage | ( | const char * | file, |
u32 | slot, | ||
u32 | size_x, | ||
u32 | size_y | ||
) |
Loads a 16 bits image into a RAM slot.
The image must be in ".img" format, and it has a max size of 256x256 pixels You must also specify the size of the image. The image will be loaded into the specified 16-bits bitmap background slot.
Use NF_Unload16bitsBg() to remove it from RAM.
Example:
Any magenta pixel (0xFF00FF) will be transparent.
file | File name without extension. |
slot | Slot number (0 - 15). |
size_x | Width in pixels. |
size_y | Height in pixels. |
void NF_Load8bitsBg | ( | const char * | file, |
u32 | slot | ||
) |
Loads a 8-bit bitmap from the filesystem.
The file must be in binary format ".img", and its max size is 256x256 pixels (64 KB). It will also load its palette in ".pal" format.
You can convert the file using this GRIT command line:
If you want to share the palette with a different background:
If you want to display 2 8-bit backgrounds on same screen they must share the palette.
You can load as many files as defined in NF_SLOTS_BG8B.
Example:
file | File name without extension. |
slot | Slot number (0 - 15). |
void NF_Reset16bitsBgBuffers | ( | void | ) |
Resets all 16 bit background buffers and clears them.
Useful when changing game levels, for example.
void NF_Reset8bitsBgBuffers | ( | void | ) |
Resets all 8 bit background buffers and clears them.
Useful when changing game levels, for example.
void NF_Unload16bitsBg | ( | u32 | slot | ) |
Deletes from RAM the 16-bit image stored in the selected slot.
This is useful, for example, when the image has been copied to VRAM so it is no longer needed in RAM.
Example:
slot | Slot number (0 - 15). |
void NF_Unload8bitsBg | ( | u32 | slot | ) |
Deletes from RAM the 8-bit image stored in the selected slot.
This is useful, for example, when the image has been copied to VRAM so it is no longer needed in RAM.
Example:
slot | Slot number (0 - 15). |