PAlib: PA_Window.h Source File

Main Page | Modules | File List | Globals | Search for

# PA_Window.h

Go to the documentation of this file.

    00001 #ifndef _PA_Window
    00002 #define _PA_Window
    00003
    00004
    00012 // utilisé pour activer ou non les fenetres...
    00013 #define WIN_BG0 1
    00014 #define WIN_BG1 2
    00015 #define WIN_BG2 4
    00016 #define WIN_BG3 8
    00017 #define WIN_OBJ 16
    00018 #define WIN_SFX 32
    00019
    00020
    00021 #define DISPCNTL(screen) _REG16(0x04000000 + (screen * 0x1000))
    00022 #define DISPCNTH(screen) _REG16(0x04000002 + (screen * 0x1000))
    00023
    00024 #define WINDOW0 (1 << 13)
    00025 #define WINDOW1 (1 << 14)
    00026 #define WINDOWOBJ (1 << 15)
    00027
    00028
    00029
    00030 #define WIN0X(screen) _REG16(0x04000040 + (screen * 0x1000))
    00031 #define WIN0Y(screen) _REG16(0x04000044 + (screen * 0x1000))
    00032 #define WIN1X(screen) _REG16(0x04000042 + (screen * 0x1000))
    00033 #define WIN1Y(screen) _REG16(0x04000046 + (screen * 0x1000))
    00034
    00035
    00036
    00037 #define WININ(screen) _REG16(0x04000048 + (screen * 0x1000))
    00038 #define WINOUT(screen) _REG16(0x0400004A + (screen * 0x1000))
    00039
    00040
    00041 extern const s16 winfades[][4];
    00042
    00043
    00044
    00071 extern inline void PA_SetWin0XY(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) {
    00072        WIN0X(screen) = x2 + ((x1) << 8);
    00073        WIN0Y(screen) = y2 + ((y1) << 8);
    00074 }
    00075
    00076
    00077
    00098 #define PA_SetWin1XY(screen, x1, y1, x2, y2) {WIN1X(screen) = x2 + ((x1) << 8); WIN1Y(screen) = y2 + ((y1) << 8);}
    00099
    00100
    00101
    00113 #define PA_EnableWin0(screen, bg_sprites) {DISPCNTL(screen) |= WINDOW0; WININ(screen) &= 255; WININ(screen) |= bg_sprites;}
    00114
    00123 #define PA_DisableWin0(screen) DISPCNTL(screen) &= ~WINDOW0
    00124
    00125
    00137 #define PA_EnableWin1(screen, bg_sprites) {DISPCNTL(screen) |= WINDOW1; WININ(screen) &= 255; WININ(screen) |= (bg_sprites << 8);}
    00138
    00139
    00148 #define PA_DisableWin1(screen) DISPCNTL(screen) &= ~WINDOW1
    00149
    00150
    00162 #define PA_EnableWinObj(screen, bg_sprites) {DISPCNTL(screen) |= WINDOWOBJ; WINOUT(screen) &= 255; WINOUT |= (bg_sprites << 8);}
    00163
    00164
    00173 #define PA_DisableWinObj(screen) DISPCNTL(screen) &= ~WINDOWOBJ
    00174
    00175
    00187 #define PA_SetOutWin(screen, bg_sprites) {WINOUT(screen) &= ~255; WINOUT(screen) |= bg_sprites;}
    00188
    00189
    00190
    00191
    00192
    00207 extern inline void PA_WindowFade(u8 screen, u8 type, u8 time){
    00208        PA_EnableWin0(screen, WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ);
    00209        PA_SetWin0XY(screen, (time*winfades[type][0]),
    00210                                           (time*winfades[type][1]),
    00211                                           (time*winfades[type][2]) + 256,
    00212                                           (time*winfades[type][3]) + 192);
    00213        if (time == 0) PA_DisableWin0(screen);
    00214 }
    00215
    00216
    00217
    00218
    00219
    00220
    00221
    00222
    00223
    00224
    00225
    00226
    00227  // end of Window
    00230
    00231
    00232
    00233 #endif
    00234