#108888 - outphase - Sun Nov 12, 2006 6:00 pm
I'm working on a project for school demonstrating assorted DS functions. I wanted to make a little touch screen notepad demo. Is there any way to speed this up so there is a continuous line? Thanks.
Code: |
int main(void) {
//--------------------------------------------------------------------------------- touchPosition touchXY; irqInit(); irqSet(IRQ_VBLANK, Vblank); irqEnable(IRQ_VBLANK); videoSetMode(MODE_FB0); //Text on main screen videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //Frame Buffer //vramSetBankC(VRAM_C_SUB_BG); vramSetMainBanks( VRAM_A_LCD, VRAM_B_LCD, VRAM_C_SUB_BG , VRAM_D_LCD); lcdSwap(); BG0_CR = BG_MAP_BASE(31);//use bg0 for the text BG_PALETTE[255] = RGB15(31,31,31);//by default font rendered with color 255 SUB_BG0_CR = BG_MAP_BASE(31); BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255 //consoleInit() is a lot more flexible but this gets you up and running quick consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); consoleClear(); iprintf("EE464 Project\nProof of Concept\nTouch Pad Demo\n\n"); iprintf("Press Start to clear screen\n"); iprintf("Press A to flood"); for(int i = 0; i < 256*192; i++) VRAM_A[i] = RGB15(0,0,0); while(1) { swiWaitForVBlank(); scanKeys(); touchXY=touchReadXY(); int held = keysHeld(); if(held&KEY_TOUCH) VRAM_A[(touchXY.px) + (touchXY.py) * 256]=RGB15(31,31,31); if(held&KEY_START) for(int i = 0; i < 256*192; i++) VRAM_A[i] = RGB15(0,0,0); if(held&KEY_A) for(int i = 0; i < 256*192; i++) VRAM_A[i] = RGB15(0,0,31); } return 0; } |