2017-03-30 02:02:15 +02:00
|
|
|
#ifndef GUARD_WINDOW_H
|
|
|
|
#define GUARD_WINDOW_H
|
|
|
|
|
2019-03-02 23:25:39 +01:00
|
|
|
#define PIXEL_FILL(num) ((num) | ((num) << 4))
|
2019-02-11 06:05:20 +01:00
|
|
|
|
2021-11-03 20:29:18 +01:00
|
|
|
enum {
|
2018-10-27 00:53:07 +02:00
|
|
|
WINDOW_BG,
|
2017-09-01 16:53:06 +02:00
|
|
|
WINDOW_TILEMAP_LEFT,
|
|
|
|
WINDOW_TILEMAP_TOP,
|
|
|
|
WINDOW_WIDTH,
|
|
|
|
WINDOW_HEIGHT,
|
|
|
|
WINDOW_PALETTE_NUM,
|
|
|
|
WINDOW_BASE_BLOCK,
|
|
|
|
WINDOW_TILE_DATA
|
|
|
|
};
|
|
|
|
|
2021-11-03 20:29:18 +01:00
|
|
|
// Mode for CopyWindowToVram, CopyWindowRectToVram and CopyWindowToVram8Bit
|
|
|
|
enum {
|
|
|
|
COPYWIN_NONE,
|
|
|
|
COPYWIN_MAP,
|
|
|
|
COPYWIN_GFX,
|
|
|
|
COPYWIN_FULL,
|
|
|
|
};
|
|
|
|
|
2017-03-30 02:02:15 +02:00
|
|
|
struct WindowTemplate
|
|
|
|
{
|
2018-10-27 00:53:07 +02:00
|
|
|
u8 bg;
|
2017-03-30 02:02:15 +02:00
|
|
|
u8 tilemapLeft;
|
|
|
|
u8 tilemapTop;
|
|
|
|
u8 width;
|
|
|
|
u8 height;
|
|
|
|
u8 paletteNum;
|
|
|
|
u16 baseBlock;
|
|
|
|
};
|
|
|
|
|
2017-09-19 14:27:46 +02:00
|
|
|
#define DUMMY_WIN_TEMPLATE \
|
|
|
|
{ \
|
2021-11-03 20:29:18 +01:00
|
|
|
.bg = 0xFF, \
|
2017-09-19 14:27:46 +02:00
|
|
|
}
|
|
|
|
|
2021-02-18 21:01:18 +01:00
|
|
|
#define WINDOW_NONE 0xFF
|
|
|
|
|
2017-03-30 02:02:15 +02:00
|
|
|
struct Window
|
|
|
|
{
|
|
|
|
struct WindowTemplate window;
|
|
|
|
u8 *tileData;
|
|
|
|
};
|
|
|
|
|
2017-09-18 18:36:05 +02:00
|
|
|
bool16 InitWindows(const struct WindowTemplate *templates);
|
2017-09-05 13:01:24 +02:00
|
|
|
u16 AddWindow(const struct WindowTemplate *template);
|
2017-10-07 03:59:47 +02:00
|
|
|
int AddWindowWithoutTileMap(const struct WindowTemplate *template);
|
2017-09-01 17:38:28 +02:00
|
|
|
void RemoveWindow(u8 windowId);
|
|
|
|
void FreeAllWindowBuffers(void);
|
|
|
|
void CopyWindowToVram(u8 windowId, u8 mode);
|
|
|
|
void CopyWindowRectToVram(u32 windowId, u32 mode, u32 x, u32 y, u32 w, u32 h);
|
|
|
|
void PutWindowTilemap(u8 windowId);
|
|
|
|
void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 palette);
|
|
|
|
void ClearWindowTilemap(u8 windowId);
|
|
|
|
void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height);
|
2018-02-06 21:35:23 +01:00
|
|
|
void BlitBitmapToWindow(u8 windowId, const u8 *pixels, u16 x, u16 y, u16 width, u16 height);
|
2017-09-01 17:38:28 +02:00
|
|
|
void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight);
|
|
|
|
void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
|
2018-10-21 09:24:57 +02:00
|
|
|
void CopyToWindowPixelBuffer(u8 windowId, const void *src, u16 size, u16 tileOffset);
|
2017-09-01 17:38:28 +02:00
|
|
|
void FillWindowPixelBuffer(u8 windowId, u8 fillValue);
|
|
|
|
void ScrollWindow(u8 windowId, u8 direction, u8 distance, u8 fillValue);
|
|
|
|
void CallWindowFunction(u8 windowId, void ( *func)(u8, u8, u8, u8, u8, u8));
|
|
|
|
bool8 SetWindowAttribute(u8 windowId, u8 attributeId, u32 value);
|
|
|
|
u32 GetWindowAttribute(u8 windowId, u8 attributeId);
|
2018-12-17 23:00:08 +01:00
|
|
|
u16 AddWindow8Bit(const struct WindowTemplate *template);
|
|
|
|
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue);
|
2017-09-01 17:38:28 +02:00
|
|
|
void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
|
2018-12-17 23:00:08 +01:00
|
|
|
void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum);
|
2017-09-01 17:38:28 +02:00
|
|
|
void CopyWindowToVram8Bit(u8 windowId, u8 mode);
|
|
|
|
|
|
|
|
extern struct Window gWindows[];
|
2021-02-18 16:00:07 +01:00
|
|
|
extern void* gWindowBgTilemapBuffers[];
|
|
|
|
extern u32 gUnusedWindowVar1;
|
|
|
|
extern u32 gUnusedWindowVar2;
|
|
|
|
extern u32 gUnusedWindowVar3;
|
2018-02-03 16:19:56 +01:00
|
|
|
|
2017-03-30 02:02:15 +02:00
|
|
|
#endif // GUARD_WINDOW_H
|