void COptionsAbout::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default frame ++; DrawScroller(NULL); CDialog::OnTimer(nIDEvent); }
void COptionsAbout::DrawAbout( HDC hdc ) { HDC hDC = hdc; if (!hdc ) hDC = ::GetDC( m_hWnd ); HDC hdcSrc = CreateCompatibleDC( hDC ); ::SelectObject( hdcSrc, pimgAbout->hBitmap ); RECT rc; GetWindowRect( &rc ); int x = (RECTW(rc)-pimgAbout->w)/2, y = (RECTH(rc)-pimgAbout->h)/2; TransparentBlt( hDC, x,y, pimgAbout->w, pimgAbout->h, hdcSrc, 0,0,pimgAbout->w, pimgAbout->h, RGB(255,255,255) ); DeleteDC( hdcSrc ); DrawScroller( hDC ); if ( !hdc ) ::ReleaseDC( m_hWnd, hDC ); }
u32 start_demo( const demo_init_t* pInfo ) { int i; int rotAngle = 0; int scalemin = 400; int scalemax = 800; int scale[8]; u8 scaleflag[8]; scale[0] = 400; scale[1] = 800; scaleflag[0] = 0; scaleflag[1] = 1; ///////////////////////////////////////////////////////////////////////////// // Setup screen PbScreenSetup( SCR_W, SCR_H, SCR_PSM ); PbPrimSetAlpha( 0, 1, 0, 1, 0x80 ); FlushCache(0); p_texture_font = PbTextureCreate32( font_tex, 1024, 128 ); p_texture_logo = PbTextureCreate32( logo_tex, 256, 256 ); p_texture_bg1 = PbTextureCreate32( bg1_tex, 256, 256 ); p_texture_bg2 = PbTextureCreate32( bg2_tex, 256, 256 ); ////////////////////////////////////////////////////////////////////////////// // Upload our texture to vram PbTextureUpload( p_texture_font ); PbTextureUpload( p_texture_logo ); PbTextureUpload( p_texture_bg1 ); PbTextureUpload( p_texture_bg2 ); PbDmaWait02(); PbSetLinearFiltering(); ///////////////////////////////////////////////////////////////////////////// // Loop of the demo (just clears the screen, vsync and flip buffer while( pInfo->time_count > 0 ) { #ifdef DEBUGMODE setBGColorRGB(0xFF,0,0); #endif PbScreenClear( 0x000000 ); PbPrimSprite( 0, 0, 640, 256, 1, 0x80000000); /////////////////////////////////////////////////////////////////////////// // Draws a sprite with texture PbPrimSetState( PB_ALPHA_BLENDING, PB_ENABLE ); /* PbPrimSpriteTexture( p_texture_font, 0<<4, 0<<4, 0<<4, 0<<4, 1024<<4, 128<<4, 1024<<4, 128<<4, 2, 0x80808080 ); PbPrimSpriteTexture( p_texture_bg1, 0<<4, 0<<4, 0<<4, 0<<4, 256<<4, 256<<4, 256<<4, 256<<4, 3, 0x80808080 ); */ RotateVertexZ(&VERTEXLIST_square[0], &VERTEXLIST_square_Trans[0], rotAngle%359); RotateVertexZ(&VERTEXLIST_square[1], &VERTEXLIST_square_Trans[1], rotAngle%359); RotateVertexZ(&VERTEXLIST_square[2], &VERTEXLIST_square_Trans[2], rotAngle%359); RotateVertexZ(&VERTEXLIST_square[3], &VERTEXLIST_square_Trans[3], rotAngle%359); PbPrimQuadTextureGouraud(p_texture_bg1, (offx+(int)(VERTEXLIST_square_Trans[0].x*xscale*scale[0]))<<4, (offy+(int)(VERTEXLIST_square_Trans[0].y*yscale*scale[0]))<<4, 0<<4, 0<<4, (offx+(int)(VERTEXLIST_square_Trans[1].x*xscale*scale[0]))<<4, (offy+(int)(VERTEXLIST_square_Trans[1].y*yscale*scale[0]))<<4, 0<<4, 256<<4, (offx+(int)(VERTEXLIST_square_Trans[2].x*xscale*scale[0]))<<4, (offy+(int)(VERTEXLIST_square_Trans[2].y*yscale*scale[0]))<<4, 256<<4, 0<<4, (offx+(int)(VERTEXLIST_square_Trans[3].x*xscale*scale[0]))<<4, (offy+(int)(VERTEXLIST_square_Trans[3].y*yscale*scale[0]))<<4, 256<<4, 256<<4, 3, 0x20808080, 0x20808080, 0x20808080, 0x20808080); RotateVertexZ(&VERTEXLIST_square[0], &VERTEXLIST_square_Trans[0], ABS((359-rotAngle)%359)); RotateVertexZ(&VERTEXLIST_square[1], &VERTEXLIST_square_Trans[1], ABS((359-rotAngle)%359)); RotateVertexZ(&VERTEXLIST_square[2], &VERTEXLIST_square_Trans[2], ABS((359-rotAngle)%359)); RotateVertexZ(&VERTEXLIST_square[3], &VERTEXLIST_square_Trans[3], ABS((359-rotAngle)%359)); PbPrimQuadTextureGouraud(p_texture_bg2, (offx+(int)(VERTEXLIST_square_Trans[0].x*xscale*scale[1]))<<4, (offy+(int)(VERTEXLIST_square_Trans[0].y*yscale*scale[1]))<<4, 0<<4, 256<<4, (offx+(int)(VERTEXLIST_square_Trans[1].x*xscale*scale[1]))<<4, (offy+(int)(VERTEXLIST_square_Trans[1].y*yscale*scale[1]))<<4, 0<<4, 0<<4, (offx+(int)(VERTEXLIST_square_Trans[2].x*xscale*scale[1]))<<4, (offy+(int)(VERTEXLIST_square_Trans[2].y*yscale*scale[1]))<<4, 256<<4, 256<<4, (offx+(int)(VERTEXLIST_square_Trans[3].x*xscale*scale[1]))<<4, (offy+(int)(VERTEXLIST_square_Trans[3].y*yscale*scale[1]))<<4, 256<<4, 0<<4, 4, 0x20808080, 0x20808080, 0x20808080, 0x20808080); DrawScroller(); PbPrimSpriteTexture( p_texture_logo, -30<<4, 3<<4, 0<<4, 0<<4, 226<<4, 259<<4, 256<<4, 256<<4, 100, 0x80808080 ); PbPrimSetState( PB_ALPHA_BLENDING, PB_DISABLE ); /////////////////////////////////////////////////////////////////////////// // Sync and flipscreen if (rotAngle<358) { rotAngle++; }else { rotAngle=0; } for (i=0; i<2; i++) { if (scaleflag[i]) { if (scale[i]<scalemax) { scale[i]++; }else{ scaleflag[i] = 0; } }else{ if (scale[i]>scalemin) { scale[i]--; }else{ scaleflag[i] = 1; } } } #ifdef DEBUGMODE setBGColorRGB(0x0,0,0); #endif PbScreenSyncFlip(); //printf("a: %d\n",rotAngle); } return pInfo->screen_mode; }