diff --git a/360/main.c b/360/main.c index 4c6097e732..6f2955be48 100644 --- a/360/main.c +++ b/360/main.c @@ -340,14 +340,10 @@ static void ingame_menu (void) float ypos = 0.19f; float ypos_increment = 0.04f; - g_screen_console.m_Font.SetFontSize(3.0f, 3.0f); - vid->xdk360_render_device->Present(NULL, NULL, NULL, NULL); } }while(g_console.ingame_menu_enable); - g_screen_console.m_Font.SetFontSize(2.0f, 2.0f); - xdk360_unblock_swap(); } diff --git a/360/xdk360_video_debugfonts.cpp b/360/xdk360_video_debugfonts.cpp index 43fd436cdb..e9e02e1f0d 100644 --- a/360/xdk360_video_debugfonts.cpp +++ b/360/xdk360_video_debugfonts.cpp @@ -232,25 +232,6 @@ HRESULT XdkFont::CreateFontShaders() return hr; // Return the error code if any } -//-------------------------------------------------------------------------------------- -// Name: ReleaseFontShaders() -// Desc: Releases the font shaders by reference -//-------------------------------------------------------------------------------------- - -void XdkFont::ReleaseFontShaders() -{ - // Safely release shaders - // NOTE: They are released in reverse order of creation - // to make sure any interdependencies are dealt with - - if( ( s_AtgFontLocals.m_pFontPixelShader != NULL ) && ( s_AtgFontLocals.m_pFontPixelShader->Release() == 0 ) ) - s_AtgFontLocals.m_pFontPixelShader = NULL; - if( ( s_AtgFontLocals.m_pFontVertexShader != NULL ) && ( s_AtgFontLocals.m_pFontVertexShader->Release() == 0 ) ) - s_AtgFontLocals.m_pFontVertexShader = NULL; - if( ( s_AtgFontLocals.m_pFontVertexDecl != NULL ) && ( s_AtgFontLocals.m_pFontVertexDecl->Release() == 0 ) ) - s_AtgFontLocals.m_pFontVertexDecl = NULL; -} - //-------------------------------------------------------------------------------------- // Name: Font() // Desc: Constructor @@ -267,10 +248,6 @@ XdkFont::XdkFont() m_fXScaleFactor = 2.0f; m_fYScaleFactor = 2.0f; - m_fSlantFactor = 0.0f; - m_bRotate = FALSE; - m_dRotCos = cos( 0.0 ); - m_dRotSin = sin( 0.0 ); m_cMaxGlyph = 0; m_TranslatorTable = NULL; @@ -377,53 +354,20 @@ void XdkFont::Destroy() m_dwNestedBeginCount = 0L; // Safely release shaders - ReleaseFontShaders(); + // NOTE: They are released in reverse order of creation + // to make sure any interdependencies are dealt with + + if( ( s_AtgFontLocals.m_pFontPixelShader != NULL ) && ( s_AtgFontLocals.m_pFontPixelShader->Release() == 0 ) ) + s_AtgFontLocals.m_pFontPixelShader = NULL; + if( ( s_AtgFontLocals.m_pFontVertexShader != NULL ) && ( s_AtgFontLocals.m_pFontVertexShader->Release() == 0 ) ) + s_AtgFontLocals.m_pFontVertexShader = NULL; + if( ( s_AtgFontLocals.m_pFontVertexDecl != NULL ) && ( s_AtgFontLocals.m_pFontVertexDecl->Release() == 0 ) ) + s_AtgFontLocals.m_pFontVertexDecl = NULL; if( m_xprResource.m_bInitialized) m_xprResource.Destroy(); } - -//-------------------------------------------------------------------------------------- -// Name: SetWindow() -// Desc: Sets the and the bounds rect for drawing text and resets the cursor position -//-------------------------------------------------------------------------------------- -void XdkFont::SetWindow(const D3DRECT &rcWindow ) -{ - m_rcWindow.x1 = rcWindow.x1; - m_rcWindow.y1 = rcWindow.y1; - m_rcWindow.x2 = rcWindow.x2; - m_rcWindow.y2 = rcWindow.y2; - - m_fCursorX = 0.0f; - m_fCursorY = 0.0f; -} - - -//-------------------------------------------------------------------------------------- -// Name: SetWindow() -// Desc: Sets the and the bounds rect for drawing text and resets the cursor position -//-------------------------------------------------------------------------------------- -void XdkFont::SetWindow( long x1, long y1, long x2, long y2 ) -{ - m_rcWindow.x1 = x1; - m_rcWindow.y1 = y1; - m_rcWindow.x2 = x2; - m_rcWindow.y2 = y2; - - m_fCursorX = 0.0f; - m_fCursorY = 0.0f; -} - -//-------------------------------------------------------------------------------------- -// Name: GetWindow() -// Desc: Gets the current bounds rect for drawing -//-------------------------------------------------------------------------------------- -void XdkFont::GetWindow( D3DRECT &rcWindow ) const -{ - rcWindow = m_rcWindow; // NOTE: This is a structure copy -} - //-------------------------------------------------------------------------------------- // Name: SetCursorPosition() // Desc: Sets the cursor position for drawing text @@ -782,7 +726,7 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor, if( dwFlags & FONT_TRUNCATED ) { // Check if we will be exceeded the max allowed width - if( m_fCursorX + fOffset + fWidth + fEllipsesPixelWidth + m_fSlantFactor > fOriginX + fMaxPixelWidth ) + if( m_fCursorX + fOffset + fWidth + fEllipsesPixelWidth > fOriginX + fMaxPixelWidth ) { // Yup, draw the three ellipses dots instead dwNumEllipsesToDraw = 3; @@ -794,7 +738,7 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor, // Setup the screen coordinates m_fCursorX += fOffset; float X4 = m_fCursorX; - float X1 = X4 + m_fSlantFactor; + float X1 = X4; float X3 = X4 + fWidth; float X2 = X1 + fWidth; float Y1 = m_fCursorY; @@ -802,15 +746,6 @@ VOID XdkFont::DrawText( float fOriginX, float fOriginY, unsigned long dwColor, float Y2 = Y1; float Y4 = Y3; - // Rotate the points by the rotation factor - if( m_bRotate ) - { - RotatePoint( &X1, &Y1, fOriginX, fOriginY ); - RotatePoint( &X2, &Y2, fOriginX, fOriginY ); - RotatePoint( &X3, &Y3, fOriginX, fOriginY ); - RotatePoint( &X4, &Y4, fOriginX, fOriginY ); - } - m_fCursorX += fAdvance; // Select the RGBA channel that the compressed glyph is stored in @@ -951,19 +886,4 @@ VOID XdkFont::End() } PIXEndNamedEvent(); -} - -//-------------------------------------------------------------------------------------- -// Name: RotatePoint() -// Desc: Rotate a 2D point around the origin -//------------------------------------------------------------------------------------- -void XdkFont::RotatePoint( float * X, float * Y, double OriginX, double OriginY ) const -{ - double dTempX = *X - OriginX; - double dTempY = *Y - OriginY; - double dXprime = OriginX + ( m_dRotCos * dTempX - m_dRotSin * dTempY ); - double dYprime = OriginY + ( m_dRotSin * dTempX + m_dRotCos * dTempY ); - - *X = static_cast( dXprime ); - *Y = static_cast( dYprime ); } \ No newline at end of file diff --git a/360/xdk360_video_debugfonts.h b/360/xdk360_video_debugfonts.h index 64056d49ab..df0370e9e5 100644 --- a/360/xdk360_video_debugfonts.h +++ b/360/xdk360_video_debugfonts.h @@ -71,9 +71,6 @@ public: float m_fXScaleFactor; // Scaling constants float m_fYScaleFactor; - float m_fSlantFactor; // For italics - double m_dRotCos; // Precalculated sine and cosine for italic like rotation - double m_dRotSin; D3DRECT m_rcWindow; // Bounds rect if the text window, modify via accessors only! float m_fCursorX; // Current text cursor @@ -94,8 +91,6 @@ public: unsigned long m_dwSavedState[ SAVEDSTATE_COUNT ]; unsigned long m_dwNestedBeginCount; int m_bSaveState; - - int m_bRotate; public: XdkFont(); ~XdkFont(); @@ -108,10 +103,6 @@ public: void GetTextExtent( const wchar_t * strText, float * pWidth, float * pHeight, int bFirstLineOnly=FALSE ) const; float GetTextWidth( const wchar_t * strText ) const; - - void SetWindow(const D3DRECT &rcWindow ); - void SetWindow( long x1, long y1, long x2, long y2 ); - void GetWindow(D3DRECT &rcWindow) const; void SetCursorPosition( float fCursorX, float fCursorY ); void SetFontSize(float x, float y); @@ -128,8 +119,6 @@ public: private: // Internal helper functions HRESULT CreateFontShaders(); - void ReleaseFontShaders(); - void RotatePoint( float * X, float * Y, double OriginX, double OriginY ) const; }; #endif \ No newline at end of file diff --git a/360/xdk360_video_resources.cpp b/360/xdk360_video_resources.cpp index 356f78391c..104058f575 100644 --- a/360/xdk360_video_resources.cpp +++ b/360/xdk360_video_resources.cpp @@ -171,22 +171,6 @@ HRESULT PackedResource::Create( const char * strFilename ) return S_OK; } - -//-------------------------------------------------------------------------------------- -// Name: GetResourceTags -// Desc: Retrieves the resource tags -//-------------------------------------------------------------------------------------- -void PackedResource::GetResourceTags( unsigned long * pdwNumResourceTags, - RESOURCE** ppResourceTags ) const -{ - if( pdwNumResourceTags ) - ( *pdwNumResourceTags ) = m_dwNumResourceTags; - - if( ppResourceTags ) - ( *ppResourceTags ) = m_pResourceTags; -} - - //-------------------------------------------------------------------------------------- // Name: Destroy // Desc: Cleans up the packed resource data diff --git a/360/xdk360_video_resources.h b/360/xdk360_video_resources.h index 25a3cffaa8..a6988e1f94 100644 --- a/360/xdk360_video_resources.h +++ b/360/xdk360_video_resources.h @@ -69,10 +69,6 @@ public: void Destroy(); - // Retrieves the resource tags - void GetResourceTags( unsigned long * pdwNumResourceTags, - RESOURCE** ppResourceTags ) const; - // Helper function to make sure a resource is registered D3DResource* RegisterResource( D3DResource* pResource ) const {