#pragma once LPD3DXFONT g_pFont[ 3 ]; D3DXFONT_DESC FontDescription= { 50, 20, 999, 8, FALSE, 0, 0, 5, // CLEARTYPE_QUALITY 0, "georgia" }; void PrepareText() { FontDescription.Height= c_iRealScreenY / 12; FontDescription.Width= FontDescription.Height * 2 / 5; D3DXCreateFontIndirect( g_d3d_device, &FontDescription, &g_pFont[ 0 ] ); FontDescription.Height= c_iRealScreenY / 10; FontDescription.Width= FontDescription.Height * 2 / 5; D3DXCreateFontIndirect( g_d3d_device, &FontDescription, &g_pFont[ 1 ] ); } void RenderLoadingLine( int iPercent ) { int iLength= min( 50, ( 100 - iPercent ) * 50 / 100 ); //iLength= iLength * 2 + 1; if( iLength < 0 ) { return; } int iTextCount= 32; for( int i= 0; i < iTextCount; ++i ) { int iX= 0; int iY= 0; if( i != iTextCount ) { iX= (int) ( 4.0f * sin( c_2PI * (float)i / (float)iTextCount ) ); iY= (int) ( 4.0f * cos( c_2PI * (float)i / (float)iTextCount ) ); } RECT r= { 0 + iX, 0 + iY, c_iScreenSizeX + iX, c_iScreenSizeY + iY }; g_pFont[ 0 ]->DrawText( NULL, "--------------------------------------------------", //"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°", //"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", //"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 50, &r, DT_CENTER | DT_VCENTER, 0xff404040 ); } for( int i= 0; i < iTextCount; ++i ) { int iX= 0; int iY= 0; if( i != iTextCount ) { iX= (int) ( 4.0f * sin( c_2PI * (float)i / (float)iTextCount ) ); iY= (int) ( 2.0f * cos( c_2PI * (float)i / (float)iTextCount ) ); } RECT r= { 0 + iX, 0 + iY, c_iScreenSizeX + iX, c_iScreenSizeY + iY }; g_pFont[ 0 ]->DrawText( NULL, "--------------------------------------------------", //"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°", //"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", iLength, &r, DT_CENTER | DT_VCENTER, 0xffffffff ); } } void RenderLoading( int iPercent ) { g_d3d_device->BeginScene(); g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER , 0x80808080, 1.0f, 0 ); g_d3d_device->SetRenderState( D3DRS_ZENABLE, FALSE ); g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE ); g_d3d_device->SetRenderState( D3DRS_FOGENABLE, FALSE ); RenderLoadingLine( iPercent ); RenderBars(); g_d3d_device->EndScene(); g_d3d_device->Present( NULL, NULL, NULL, NULL ); } void RenderText( char* pcText, int wordbreak, float fX, float fY ) { if( wordbreak < 0 ) { return; } fX= fX / 1024.0f * (float)c_iScreenSizeX + c_iScreenSizeX * 0.5f; fY= fY / 1024.0f * (float)c_iScreenSizeX + c_iScreenSizeY * 0.5f; wordbreak*= 5; int iLength= 0; int iCount= 0; while( pcText[ iCount ] != 0 ) { iCount++; wordbreak--; if( pcText[ iCount ] == ' ' || pcText[ iCount ] == '\n'|| pcText[ iCount ] == 0 ) { iLength= iCount; if( wordbreak < 0 ) { break; } } } int iTextCount= 32; for( int i= 0; i < iTextCount; ++i ) { float fAngle= 0.7f + c_2PI * (float)i / (float)iTextCount; float fRadius= 5.0f + 5.0f + 3.0f * sin( fAngle - 2.0f ); fRadius*= (float)c_iScreenSizeX / 1024.0f; int iX= (int)fX; int iY= (int)fY; if( i != iTextCount ) { iX+= (int) ( fRadius * sin( fAngle ) ); iY+= (int) ( fRadius * cos( fAngle ) ); } RECT r= { 0 + iX, 0 + iY, c_iScreenSizeX + iX, c_iScreenSizeY + iY }; g_pFont[ 1 ]->DrawText( NULL, pcText, iLength, &r, DT_LEFT | DT_TOP, 0x40000000 ); } for( int i= 0; i < iTextCount; ++i ) { float fAngle= c_2PI * (float)i / (float)iTextCount; float fRadius= 5.0f; fRadius*= (float)c_iScreenSizeX / 1024.0f; int iX= (int)fX; int iY= (int)fY; if( i != iTextCount ) { iX+= (int) ( fRadius * sin( fAngle ) ); iY+= (int) ( fRadius * cos( fAngle ) ); } RECT r= { 0 + iX, 0 + iY, c_iScreenSizeX + iX, c_iScreenSizeY + iY }; g_pFont[ 1 ]->DrawText( NULL, pcText, iLength, &r, DT_LEFT | DT_TOP, 0xffffffff ); } { RECT r= { 0 + (int)fX, 0 + (int)fY, c_iScreenSizeX + (int)fX, c_iScreenSizeY + (int)fY }; g_pFont[ 1 ]->DrawText( NULL, pcText, iLength, &r, DT_LEFT | DT_TOP, 0xff000000 ); } }