diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Xbox/Font/XUI_Font.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.Client/Xbox/Font/XUI_Font.cpp')
| -rw-r--r-- | Minecraft.Client/Xbox/Font/XUI_Font.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Minecraft.Client/Xbox/Font/XUI_Font.cpp b/Minecraft.Client/Xbox/Font/XUI_Font.cpp index 8b1a624b..2262f345 100644 --- a/Minecraft.Client/Xbox/Font/XUI_Font.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_Font.cpp @@ -53,8 +53,8 @@ XUI_Font::~XUI_Font() VOID XUI_Font::GetTextExtent( const WCHAR* strText, FLOAT* pWidth, FLOAT* pHeight, BOOL bFirstLineOnly ) const { - assert( pWidth != NULL ); - assert( pHeight != NULL ); + assert( pWidth != nullptr ); + assert( pHeight != nullptr ); // Set default text extent in output parameters int iWidth = 0; @@ -146,8 +146,8 @@ VOID XUI_Font::Begin() //m_pFontTexture->GetLevelDesc( 0, &TextureDesc ); // Get the description // Set render state - assert(m_fontData->m_pFontTexture != NULL || m_fontData->m_iFontTexture > 0); - if(m_fontData->m_pFontTexture != NULL) + assert(m_fontData->m_pFontTexture != nullptr || m_fontData->m_iFontTexture > 0); + if(m_fontData->m_pFontTexture != nullptr) { pD3dDevice->SetTexture( 0, m_fontData->m_pFontTexture ); } @@ -236,7 +236,7 @@ VOID XUI_Font::DrawShadowText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, DW VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, const WCHAR* strText, DWORD dwFlags, FLOAT fMaxPixelWidth, bool darken /*= false*/ ) { - if( NULL == strText ) return; + if( nullptr == strText ) return; if( L'\0' == strText[0] ) return; // 4J-PB - if we're in 480 widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple @@ -244,21 +244,21 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, { if(RenderManager.IsWidescreen()) { - int iScaleX=(int)m_fXScaleFactor; + int iScaleX=static_cast<int>(m_fXScaleFactor); int iOriginX; if(iScaleX%2==0) { - iOriginX=(int)fOriginX; + iOriginX=static_cast<int>(fOriginX); if(iOriginX%2==1) { fOriginX+=1.0f; } } - int iScaleY=(int)m_fYScaleFactor; + int iScaleY=static_cast<int>(m_fYScaleFactor); int iOriginY; if(iScaleY%2==0) { - iOriginY=(int)fOriginY; + iOriginY=static_cast<int>(fOriginY); if(iOriginY%2==1) { fOriginY+=1.0f; @@ -268,7 +268,7 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, else { // 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it - int iOriginY=(int)fOriginY; + int iOriginY=static_cast<int>(fOriginY); if(iOriginY%2==1) { fOriginY-=1.0f/3.0f; @@ -415,8 +415,8 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, // Translate unprintable characters XUI_FontData::SChar sChar = m_fontData->getChar( letter ); - FLOAT fOffset = m_fXScaleFactor * ( FLOAT )sChar.getOffset(); - FLOAT fAdvance = m_fXScaleFactor * ( FLOAT )sChar.getWAdvance(); + FLOAT fOffset = m_fXScaleFactor * static_cast<FLOAT>(sChar.getOffset()); + FLOAT fAdvance = m_fXScaleFactor * static_cast<FLOAT>(sChar.getWAdvance()); // 4J Use the font max width otherwise scaling doesnt look right FLOAT fWidth = m_fXScaleFactor * (sChar.tu2() - sChar.tu1());//( FLOAT )pGlyph->wWidth; FLOAT fHeight = m_fYScaleFactor * m_fontData->getFontHeight(); @@ -450,10 +450,10 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, // Add the vertices to draw this glyph - FLOAT tu1 = sChar.tu1() / (float)m_fontData->getImageWidth(); - FLOAT tv1 = sChar.tv1() / (float)m_fontData->getImageHeight(); - FLOAT tu2 = sChar.tu2() / (float)m_fontData->getImageWidth(); - FLOAT tv2 = sChar.tv2() / (float)m_fontData->getImageHeight(); + FLOAT tu1 = sChar.tu1() / static_cast<float>(m_fontData->getImageWidth()); + FLOAT tv1 = sChar.tv1() / static_cast<float>(m_fontData->getImageHeight()); + FLOAT tu2 = sChar.tu2() / static_cast<float>(m_fontData->getImageWidth()); + FLOAT tv2 = sChar.tv2() / static_cast<float>(m_fontData->getImageHeight()); Tesselator *t = Tesselator::getInstance(); t->begin(); |
