page.h 1.73 KB
#ifndef __page_h__
#define __page_h__

#define MAX_COLUMN_COUNT        6
#define CELL_TYPE_TEXTURE       0
#define CELL_TYPE_STRING        1
#define CELL_TYPE_GAMETITLE     2 
#define CELL_TYPE_BNUM          3 
#define ROW_LAYOUT_VERTICAL     0
#define ROW_LAYOUT_HORIZONTAL   1
#define ROW_LAYOUT_CPAK         2

typedef void (* UiHiliteRowCB) (int idx);
typedef void (* UiSelectRowCB) (int idx, u32 button);

typedef struct {
    int      w, h;
    u16     *img;
} UiImage;

typedef struct {
    int type;
    u16 limit; 
    u16 remain;
    u8* title;
    UiImage* img;
} UiGameCell;

typedef struct {
    int      col_cnt;
    int      cell_h;
    int      cell_w [MAX_COLUMN_COUNT];
    int      cell_x [MAX_COLUMN_COUNT];
    int      cell_y [MAX_COLUMN_COUNT];
    int      type [MAX_COLUMN_COUNT];
    void    *data [MAX_COLUMN_COUNT];
    u16      txt_color;
    u16      bg_color;
    UiImage *bg;
} UiRow;

typedef struct {
   int            x, y;
   int            total_rows, screen_rows; 
   int            top_row, hilite_row;
   UiRow         *rows; 
   int            row_layout;
} UiTable;

extern int     gBgIdx; 
extern UiImage gBgImg[4];
extern int     gLogoCnt;

extern void colorTex(u16* stex, u16* dtex, int w, int h, u16 color);
extern void drawGameCell(UiGameCell *pCell, int posx, int posy, u16 color);
extern void updateRowHilite(UiTable *pTable);
extern void drawTable(UiTable *pTable, UiHiliteRowCB pHilite, UiSelectRowCB pSelect);
extern void drawFrame();
extern void drawGameInfo(UiRow* pRow, int posx, int posy);
extern void drawGameInfo2(UiRow* pRow, int posx, int posy);
extern void drawGameInfo3(UiRow* pRow, int posx, int posy);
extern void drawRecryptMeter(int cnt, int total);
extern void drawError(u8* str, int posx, int posy);
#endif