/************************************************/ /* Picture & Drawing */ /************************************************/ #include "gba.h" #include "picture.c" hword* sb = (hword*) VRAM; // VRAM base address void box(int, int, int, int, hword); int main() { int x, y, bgcol; // Coordinate data hword color1, color2; // Color data for orthogon // Bitmap displaying for (y = 0; y < 160; y++) { for (x = 0; x < 240; x++) { sb[y * 240 + x] = picture[bgcol = y * 240 + x]; } } // Box Drawing color1 = RGB(30, 27, 19); color2 = RGB(0, 24, 16); box(10, 60, 200, 70, color1); box(20, 30, 40, 90, color2); // LCD control register gba_reg(LCD_CTL) = LCD_BG2 | LCD_MODE3; // Loop while(1); } // void box(int x1,int y1, int x2, int y2, hword color) { int x, y; for (x = x1; x < x2; x++) { // Box drawing for (y = y1; y < y2; y++) sb[y*240+x] = color; } }