#include #include #include #include #include //basic print funcionality // #define MYBASE 8 // #define MYOFFSET 31 int main (void) { touchPosition touchXY; powerON (POWER_ALL); videoSetMode (MODE_5_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE); videoSetModeSub (0); vramSetBankA (VRAM_A_MAIN_BG); vramSetBankB (VRAM_B_MAIN_BG); int mybase = 0; int myoffset = 31; int i, j; while (1) { scanKeys (); if (keysDown () & KEY_A) { mybase++; // SUB_BG0_CR = BG_MAP_BASE (31); BG3_CR = BG_BMP16_256x256 | BG_PRIORITY_3; BG0_CR = BG_MAP_BASE (mybase + myoffset) | BG_TILE_BASE (mybase) | BG_PRIORITY_0; BG3_XDX = 1 << 8; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = 1 << 8; BG_PALETTE[255] = RGB15 (31, 31, 31); //by default font will be rendered with color 255 consoleInitDefault ((u16 *) SCREEN_BASE_BLOCK (mybase + myoffset), (u16 *) CHAR_BASE_BLOCK (mybase), 16); for (i = 0; i < 192; i++) { //BG_GFX[i] = RGB15(31,0,31); for (j = 0; j < 256; j++) { if (i == 20) BG_GFX[j + (256 * i)] = RGB15 (31, 31, 31) | BIT (15); else if (i == 172) BG_GFX[j + (256 * i)] = RGB15 (0, 0, 31) | BIT (15); else BG_GFX[j + (256 * i)] = RGB15 (0, 0, 31 - (int) (i * 0.16)) | BIT (15); } } touchXY = touchReadXY (); iprintf ("\x1b[10;0HTouch x = %04X, %04X\n", touchXY.x, touchXY.px); iprintf ("Touch y = %04X, %04X\n", touchXY.y, touchXY.py); } } return 0; }