Page* Tapplication::PopPage(bool bRedrawUnderlying) { TRACE("Popping Page \n"); if ( pageCount > 0 ) { if ( pageCount == 1 ) { BlankScreen(); TAP_EnterNormal(); AfterEnterNormal(); } if (bRedrawUnderlying) { if (pageCount>1) { BlankScreen(); TRACE("Redrawing underlying page\n"); pageStack[pageCount-2]->Redraw(); TRACE("Redraw done\n"); } } return pageStack[ --pageCount ]; } return NULL; }
void Tapplication::HideUI(dword reshow_key) { m_reshowUIKey = reshow_key; BlankScreen(); DrawHiddenUIMessage(); TAP_EnterNormal(); AfterEnterNormal(); }
dword Tapplication::OnKeyWhenHidden( dword key, dword extKey ) { (extKey); if ((key == m_reshowUIKey) && IsNormalState()) { BeforeExitNormal(); TAP_ExitNormal(); BlankScreen(); ShowUI(); m_reshowUIKey = 0; return 0; } return key; }
void PlatformSpecificExitingMenus(void) { // just need to release the DD surface // lets leave the rects as valid, so we can // do lazy eval of the font char rects if we want int fadeLevel=65536; while(fadeLevel>=0) { /* fade screen to black */ SetPaletteFadeLevel(fadeLevel); fadeLevel-= 2048; } UnloadFont(&AvpFonts[MENU_FONT_1]); unload_rif(menu_rif);//get rid of File_Chunk menu_rif = INVALID_RIFFHANDLE; BlankScreen(); }
//***************************************************************************** // // A simple demonstration of the features of the TivaWare Graphics Library. // //***************************************************************************** int main(void) { clockInit(); // Set up the LCD Sharp96x96_initDisplay(); GrContextInit(&g_sContext, &g_sharp96x96LCD); GrContextFontSet(&g_sContext, &g_sFontFixed6x8); int step = -1; Sharp96x96_VCOM_count = 10; while(1) { if(Sharp96x96_VCOM_count < 4) { continue; } Sharp96x96_VCOM_count = 0; if(++step >= 5) { step = 0; } BlankScreen(); GrFlush(&g_sContext); switch(step) { case 0: // Intro Screen GrStringDrawCentered(&g_sContext, "How to use", AUTO_STRING_LENGTH, 48, 15, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "the TivaWare", AUTO_STRING_LENGTH, 48, 35, TRANSPARENT_TEXT); GrStringDraw(&g_sContext, "Graphics Library", AUTO_STRING_LENGTH, 1, 51, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "Primitives", AUTO_STRING_LENGTH, 48, 75, TRANSPARENT_TEXT); break; case 1: // Draw pixels and lines on the display GrStringDrawCentered(&g_sContext, "Draw Pixels", AUTO_STRING_LENGTH, 48, 5, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "& Lines", AUTO_STRING_LENGTH, 48, 15, TRANSPARENT_TEXT); GrPixelDraw(&g_sContext, 30, 30); GrPixelDraw(&g_sContext, 30, 32); GrPixelDraw(&g_sContext, 32, 32); GrPixelDraw(&g_sContext, 32, 30); GrLineDraw(&g_sContext, 35, 35, 90, 90); GrLineDraw(&g_sContext, 5, 80, 80, 20); GrLineDraw(&g_sContext, 0, GrContextDpyHeightGet(&g_sContext) - 1, GrContextDpyWidthGet(&g_sContext) - 1, GrContextDpyHeightGet(&g_sContext) - 1); break; case 2: // Draw circles on the display GrStringDraw(&g_sContext, "Draw Circles", AUTO_STRING_LENGTH, 10, 5, TRANSPARENT_TEXT); GrCircleDraw(&g_sContext, 30, 70, 20); GrCircleFill(&g_sContext, 60, 50, 30); break; case 3: // Draw rectangles on the display GrStringDrawCentered(&g_sContext, "Draw Rectangles", AUTO_STRING_LENGTH, 48, 5, TRANSPARENT_TEXT); GrRectDraw(&g_sContext, &myRectangle1); GrRectFill(&g_sContext, &myRectangle2); // Text below won't be visible on screen due to transparency // (foreground colors match) GrStringDrawCentered(&g_sContext, "Normal Text", AUTO_STRING_LENGTH, 50, 50, TRANSPARENT_TEXT); // Text below draws foreground and background for opacity GrStringDrawCentered(&g_sContext, "Opaque Text", AUTO_STRING_LENGTH, 50, 65, OPAQUE_TEXT); GrContextForegroundSet(&g_sContext, ClrWhite); GrContextBackgroundSet(&g_sContext, ClrBlack); GrStringDrawCentered(&g_sContext, "Invert Text", AUTO_STRING_LENGTH, 50, 80, TRANSPARENT_TEXT); break; case 4: // Invert the foreground and background colors GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrRectFill(&g_sContext, &myRectangle3); GrContextForegroundSet(&g_sContext, ClrWhite); GrContextBackgroundSet(&g_sContext, ClrBlack); GrStringDrawCentered(&g_sContext, "Invert Colors", AUTO_STRING_LENGTH, 48, 5, TRANSPARENT_TEXT); GrRectDraw(&g_sContext, &myRectangle1); GrRectFill(&g_sContext, &myRectangle2); // Text below won't be visible on screen due to // transparency (foreground colors match) GrStringDrawCentered(&g_sContext, "Normal Text", AUTO_STRING_LENGTH, 50, 50, TRANSPARENT_TEXT); // Text below draws foreground and background for opacity GrStringDrawCentered(&g_sContext, "Opaque Text", AUTO_STRING_LENGTH, 50, 65, OPAQUE_TEXT); // Text below draws with inverted foreground color to become visible GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrStringDrawCentered(&g_sContext, "Invert Text", AUTO_STRING_LENGTH, 50, 80, TRANSPARENT_TEXT); break; default: break; } GrFlush(&g_sContext); } }
int main() { // INT_IE |= ( 1 << 13 ); // cart-remove-interrupt (handled by crt0) // CST_ROM0_1ST_3WAIT | CST_ROM0_2ND_1WAIT | CST_PREFETCH_ENABLE // REG_WSCNT = ( 5 << 2 ) | ( 1 << 14 ); // set rom-timing irqInit(); irqSet( IRQ_TIMER1, kradInterrupt ); irqEnable( IRQ_TIMER1 ); // midi setup irqSet( IRQ_TIMER3, midiInterrupt ); irqEnable( IRQ_TIMER3 ); midiInit(); REG_IME = 1; SetMode( MODE_0 | BG1_ON ); // starting SetBG(10, 10, 0); // create the globals object globals = new GlobalData(); // starting SetBG(0, 10, 10); globals->LoadSongs(); // starting SetBG(10, 0, 10); u16 i = 0; Keys *keys = new Keys(); First *firstpage = new First(keys); Page *selected = firstpage; // init krawall kragInit( KRAG_INIT_STEREO ); // make it so we can see the background REG_BG1CNT = BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | BIT(12); // high priority, 256 colour, point the banks at the right place etc // load the splash screen DMA3COPY((void*)splash_tiles, (u16*)VideoBuffer, SPLASH_TILESIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)splash_palette, (u16*)&BG_PALETTE[5], SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // check keys while (keys->TestKey(keyA) != pressed) { keys->Jiffie(); } keys->Jiffie(); // load the krawall splash screen DMA3COPY((void*)krawall_splash_tiles, (u16*)VideoBuffer, KRAWALL_SPLASH_TILESIZE| DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)krawall_splash_palette, (u16*)&BG_PALETTE[5], KRAWALL_SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)krawall_splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // check keys while (keys->TestKey(keyA) != pressed) { keys->Jiffie(); } keys->Jiffie(); // load charset into memory as a demo tileset DMA3COPY((void*)font::tiles, (u16*)VideoBuffer, 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)font::tiles_color, (u16*)&VideoBuffer[3232], 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // set up the background palette for (i=0;i<7;i++) BG_PALETTE[i] = RGB(0, 0, 0); // this starts from 7 becuase the kludgy legacy converter used a 7-color offset (for parallax-starfield reasons) BG_PALETTE[7] = RGB(0x1F, 0x1F, 0x1F); BG_PALETTE[8] = RGB(0, 0, 0); // set the H and V offset of our background to zero // REG_BG1HOFS = 0; // REG_BG1VOFS = 0; // clear out the whole area BlankScreen(); while (1) { // this is zerosync SetBG(0, 0, 10); // figure out all our latest song positions globals->Tick(); // calculate audio stuff kramWorker(); // update midi progression midiUpdateBeat(globals->beat); // check keys keys->Jiffie(); // automatically cascades all pages and processes them firstpage->Process(); SetBG(0, 0, 0); // this is vsync //while( !REG_VCOUNT ); //while( REG_VCOUNT ); // try and fit the drawing stuff into the off-screen sync while(REG_VCOUNT != 160); SetBG(10, 0, 0); // do all the display shit in here BlankScreen(); selected = selected->Cycle(); selected->Draw(); SetBG(0, 0, 0); } return 1; }