PAlib
Backgrounds/Effects/Mode7/source/main.c
// Mode 7 example.
// Includes
#include <PA9.h>
#include "all_gfx.h"
int main(){
PA_Init();
PA_SetVideoMode(0, 2); //screen, mode
PA_SetVideoMode(1, 2); //screen, mode
// Yup, we use the standard bg load function!
PA_LoadBackground(0, //screen
3, // background number
&Rot); // background name in PAGfx
PA_LoadBackground(1, 3, &Rot);
// Wraparound (!)
PA_SetBgWrap(0, 3, 1);
PA_SetBgWrap(1, 3, 1);
u16 angle = 0;
u16 height = 8192;
while(true){
// Change the angle
angle += Pad.Held.Right - Pad.Held.Left;
angle &= 511;
PA_Mode7Angle(angle);
// Move left/right
PA_Mode7MoveLeftRight(Pad.Held.A - Pad.Held.Y);
// Move Forward/backward
PA_Mode7MoveForwardBack(Pad.Held.Up - Pad.Held.Down);
// Height
height += (Pad.Held.X - Pad.Held.B)<<7;
PA_Mode7Height(height);
PA_OutputText(1, 0, 0, "Angle : %d ", angle);
PA_OutputText(1, 0, 1, "Height : %d ", height);
}
}
static void PA_SetBgWrap(u8 screen, u8 bg, u8 wrap)
Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds)
Definition PA_BgTiles.h:963
void PA_LoadBackground(u8 screen, u8 bg_select, const PA_BgStruct *bg_name)
Load a background (EasyBg or RotBg).
void PA_SetVideoMode(u8 screen, u8 mode)
Change the video mode... Use this with caution.
static void PA_WaitForVBL()
Wait for the VBlank to occur.
Definition PA_General.h:286
static void PA_Mode7MoveLeftRight(s16 x_deplac)
Move lateraly, so left or right...
Definition PA_Mode7.h:120
static void PA_Mode7MoveForwardBack(s16 z_deplac)
Move forward or backwards.
Definition PA_Mode7.h:135
static void PA_Mode7Angle(s16 angle)
Define the current angle.
Definition PA_Mode7.h:103
void PA_InitMode7(u8 bg_select)
Initialize Mode 7 for a given background. You MUST be in video mode 1 or 2.
static void PA_Mode7Height(s16 mode7y)
Set the camera height.
Definition PA_Mode7.h:195
void PA_LoadDefaultText(u8 screen, u8 bg_select)
Load and initialize the default text. Works only in modes 0-2.
void PA_OutputText(u8 screen, u16 x, u16 y, const char *text,...)
Output text on the DS screen. Works only in modes 0-2.