GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
affine_background.h File Reference

Utilities for affine background on GBA. More...

#include "graphic_utils.h"
#include <tonc.h>

Go to the source code of this file.

Macros

#define AFFINE_BG_IDX   2
 The index of the affine background BGCNT register etc.
 
#define AFFINE_BG_PAL_LEN   16
 Number of u16 colors available in the palette.
 
#define AFFINE_BG_PB   (PAL_ROW_LEN * 15)
 The starting index of the background palette.
 

Enumerations

enum  AffineBackgroundID { AFFINE_BG_NONE , AFFINE_BG_MAIN_MENU , AFFINE_BG_GAME }
 An ID to specify background rendering types. More...
 

Functions

void affine_background_init ()
 Initialize resources for affine background rendering.
 
IWRAM_CODE void affine_background_hblank ()
 Interrupt routine to update display on HBLANK.
 
IWRAM_CODE void affine_background_update ()
 Per-frame update of the affine background.
 
void affine_background_set_color (COLOR color)
 Update the affine background color.
 
void affine_background_load_palette (const u16 *src)
 Set the background palette.
 
void affine_background_change_background (enum AffineBackgroundID new_bg)
 Update the background id.
 

Detailed Description

Utilities for affine background on GBA.

Definition in file affine_background.h.

Macro Definition Documentation

◆ AFFINE_BG_IDX

#define AFFINE_BG_IDX   2

The index of the affine background BGCNT register etc.

Definition at line 17 of file affine_background.h.

◆ AFFINE_BG_PAL_LEN

#define AFFINE_BG_PAL_LEN   16

Number of u16 colors available in the palette.

Definition at line 23 of file affine_background.h.

◆ AFFINE_BG_PB

#define AFFINE_BG_PB   (PAL_ROW_LEN * 15)

The starting index of the background palette.

Definition at line 29 of file affine_background.h.

Enumeration Type Documentation

◆ AffineBackgroundID

An ID to specify background rendering types.

Enumerator
AFFINE_BG_NONE 

Display background for the initial splash screen.

Signifies that no background is currently in use.

AFFINE_BG_MAIN_MENU 

Display background for main menu.

Signifies which background to use and provides a higher quality affine mode to display when there is no game logic.

AFFINE_BG_GAME 

Display background for game play.

Signifies which background to use and provides a lower quality affine mode to keep resources down during play.

Definition at line 34 of file affine_background.h.

Function Documentation

◆ affine_background_change_background()

void affine_background_change_background ( enum AffineBackgroundID  new_bg)

Update the background id.

Update the background id by configuring display registers and loading the image and palette used for the specified id.

Parameters
new_bgAffineBackgrounID to set

Definition at line 81 of file affine_background.c.

◆ affine_background_hblank()

IWRAM_CODE void affine_background_hblank ( )

Interrupt routine to update display on HBLANK.

Definition at line 26 of file affine_background.c.

◆ affine_background_init()

void affine_background_init ( )

Initialize resources for affine background rendering.

Definition at line 19 of file affine_background.c.

◆ affine_background_load_palette()

void affine_background_load_palette ( const u16 *  src)

Set the background palette.

Must be called with an array of size at least AFFINE_BG_PAL_LEN

Parameters
srcpointer to palette to set

Definition at line 76 of file affine_background.c.

◆ affine_background_set_color()

void affine_background_set_color ( COLOR  color)

Update the affine background color.

Parameters
colorCOLOR to set

Definition at line 64 of file affine_background.c.

◆ affine_background_update()

IWRAM_CODE void affine_background_update ( )

Per-frame update of the affine background.

Definition at line 39 of file affine_background.c.