PAlib
Macros | Functions
Window system

Macros

#define PA_SetWin1XY(screen, x1, y1, x2, y2)   do{WIN1X(screen) = x2 + ((x1) << 8); WIN1Y(screen) = y2 + ((y1) << 8);}while(0)
 Set the X et Y coordinates of the rectangular second window. You'll also have to use PA_SetWin1 to chose which Backgrounds are visible and if sprites are too...
 
#define PA_EnableWin0(screen, bg_sprites)   do{DISPCNTL(screen) |= WINDOW0; WININ(screen) &= 255; WININ(screen) |= (bg_sprites);}while(0)
 Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 0. You'll then have to configure it with PA_SetWin0XY.
 
#define PA_DisableWin0(screen)   DISPCNTL(screen) &= ~WINDOW0
 Disable the first window...
 
#define PA_EnableWin1(screen, bg_sprites)   do{DISPCNTL(screen) |= WINDOW1; WININ(screen) &= 255; WININ(screen) |= ((bg_sprites) << 8);}while(0)
 Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 1. You'll then have to configure it with PA_SetWin1XY.
 
#define PA_DisableWin1(screen)   DISPCNTL(screen) &= ~WINDOW1
 Disable the second window...
 
#define PA_DisableWinObj(screen)   DISPCNTL(screen) &= ~WINDOWOBJ
 Disable the object window...
 
#define PA_SetOutWin(screen, bg_sprites)   do{WINOUT(screen) &= ~255; WINOUT(screen) |= bg_sprites;}while(0)
 Set which backgrounds will be visible and whether sprites will too or not, outside of the windows.
 

Functions

static void PA_EnableWinObj (u8 screen, u16 bg_sprites)
 Enable and set which backgrounds will be visible and whether sprites will too or not, for Object Winodw (created from sprites in Window mode).
 
static void PA_WindowFade (u8 screen, u8 type, u8 time)
 This allows you to do fade in and out, using the window system.
 

Detailed Description

Set up 2 windows and a possible object window...

Macro Definition Documentation

◆ PA_SetWin1XY

#define PA_SetWin1XY (   screen,
  x1,
  y1,
  x2,
  y2 
)    do{WIN1X(screen) = x2 + ((x1) << 8); WIN1Y(screen) = y2 + ((y1) << 8);}while(0)

Set the X et Y coordinates of the rectangular second window. You'll also have to use PA_SetWin1 to chose which Backgrounds are visible and if sprites are too...

Parameters
screenScreen...
x1X coordinate of the top left point
y1Y coordinate of the top left point
x2X coordinate of the bottom right point
y2Y coordinate of the bottom right point

◆ PA_EnableWin0

#define PA_EnableWin0 (   screen,
  bg_sprites 
)    do{DISPCNTL(screen) |= WINDOW0; WININ(screen) &= 255; WININ(screen) |= (bg_sprites);}while(0)

Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 0. You'll then have to configure it with PA_SetWin0XY.

Parameters
screenScreen...
bg_spritesBackgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects)

◆ PA_DisableWin0

#define PA_DisableWin0 (   screen)    DISPCNTL(screen) &= ~WINDOW0

Disable the first window...

Parameters
screenScreen...

◆ PA_EnableWin1

#define PA_EnableWin1 (   screen,
  bg_sprites 
)    do{DISPCNTL(screen) |= WINDOW1; WININ(screen) &= 255; WININ(screen) |= ((bg_sprites) << 8);}while(0)

Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 1. You'll then have to configure it with PA_SetWin1XY.

Parameters
screenScreen...
bg_spritesBackgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects)

◆ PA_DisableWin1

#define PA_DisableWin1 (   screen)    DISPCNTL(screen) &= ~WINDOW1

Disable the second window...

Parameters
screenScreen...

◆ PA_DisableWinObj

#define PA_DisableWinObj (   screen)    DISPCNTL(screen) &= ~WINDOWOBJ

Disable the object window...

Parameters
screenScreen...

◆ PA_SetOutWin

#define PA_SetOutWin (   screen,
  bg_sprites 
)    do{WINOUT(screen) &= ~255; WINOUT(screen) |= bg_sprites;}while(0)

Set which backgrounds will be visible and whether sprites will too or not, outside of the windows.

Parameters
screenScreen...
bg_spritesBackgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ

Function Documentation

◆ PA_EnableWinObj()

static inline void PA_EnableWinObj ( u8  screen,
u16  bg_sprites 
)
inlinestatic

Enable and set which backgrounds will be visible and whether sprites will too or not, for Object Winodw (created from sprites in Window mode).

Parameters
screenScreen...
bg_spritesBackgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects)

◆ PA_WindowFade()

static inline void PA_WindowFade ( u8  screen,
u8  type,
u8  time 
)
inlinestatic

This allows you to do fade in and out, using the window system.

Parameters
screenScreen...
typeType... 8 different types are available (0-7)
timeTime, from 0 to 32 (included). 0 is a completely viewable screen, 32 is completely out