aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Xbox/Font
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Xbox/Font')
-rw-r--r--Minecraft.Client/Xbox/Font/XUI_Font.cpp32
-rw-r--r--Minecraft.Client/Xbox/Font/XUI_FontData.cpp16
-rw-r--r--Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp34
3 files changed, 41 insertions, 41 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();
diff --git a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp
index 7a70cdfb..88d77d09 100644
--- a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp
+++ b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp
@@ -68,7 +68,7 @@ float XUI_FontData::SChar::getMinX()
float XUI_FontData::SChar::getMaxX()
{
- return (float) m_parent->m_fontData->getFontData()->m_uiGlyphWidth;
+ return static_cast<float>(m_parent->m_fontData->getFontData()->m_uiGlyphWidth);
}
float XUI_FontData::SChar::getMinY()
@@ -83,7 +83,7 @@ float XUI_FontData::SChar::getMaxY()
float XUI_FontData::SChar::getAdvance()
{
- return (float) m_parent->m_fontData->getWidth(m_glyphId);
+ return static_cast<float>(m_parent->m_fontData->getWidth(m_glyphId));
}
int XUI_FontData::SChar::getGlyphId()
@@ -157,11 +157,11 @@ XUI_FontData::SChar XUI_FontData::getChar(const wchar_t strChar)
//--------------------------------------------------------------------------------------
XUI_FontData::XUI_FontData()
{
- m_pFontTexture = NULL;
+ m_pFontTexture = nullptr;
m_iFontTexture = -1;
m_dwNumGlyphs = 0L;
- m_Glyphs = NULL;
+ m_Glyphs = nullptr;
m_cMaxGlyph = 0;
@@ -201,12 +201,12 @@ HRESULT XUI_FontData::Create( SFontData &sfontdata )
m_fontData = new CFontData( sfontdata, rawPixels.data );
- if (rawPixels.data != NULL) delete [] rawPixels.data;
+ if (rawPixels.data != nullptr) delete [] rawPixels.data;
#if 0
{ // 4J-JEV: Load in FontData (ABC) file, and initialize member variables from it.
- const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
//wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/font/Mojangles_10.abc");
wsprintfW(szResourceLocator,L"section://%X,%s#%s%s%s",c_ModuleHandle,L"media", L"media/font/",strFontFileName.c_str(),L".abc");
@@ -349,7 +349,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData )
//--------------------------------------------------------------------------------------
VOID XUI_FontData::Destroy()
{
- if(m_pFontTexture!=NULL)
+ if(m_pFontTexture!=nullptr)
{
m_pFontTexture->Release();
delete m_pFontTexture;
@@ -357,7 +357,7 @@ VOID XUI_FontData::Destroy()
m_fontData->release();
- m_pFontTexture = NULL;
+ m_pFontTexture = nullptr;
m_dwNumGlyphs = 0L;
m_cMaxGlyph = 0;
diff --git a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp
index d708af79..f6619fd5 100644
--- a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp
+++ b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp
@@ -36,7 +36,7 @@ VOID XUI_FontRenderer::Term()
HRESULT XUI_FontRenderer::GetCaps( DWORD * pdwCaps )
{
- if( pdwCaps != NULL )
+ if( pdwCaps != nullptr )
{
// setting this means XUI calls the DrawCharsToDevice method
*pdwCaps = XUI_FONT_RENDERER_CAP_INTERNAL_GLYPH_CACHE | XUI_FONT_RENDERER_CAP_POINT_SIZE_RESPECTED | XUI_FONT_RENDERER_STYLE_DROPSHADOW;
@@ -50,7 +50,7 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
//float fXuiSize = fPointSize * ( 16.0f / 16.0f );
fXuiSize /= 4.0f;
fXuiSize = floor( fXuiSize );
- int xuiSize = (int)(fXuiSize * 4.0f);
+ int xuiSize = static_cast<int>(fXuiSize * 4.0f);
if( xuiSize < 1 ) xuiSize = 8;
// 4J Stu - We have fonts based on multiples of 8 or 12
@@ -60,8 +60,8 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
//app.DebugPrintf("point size is: %f, xuiSize is: %d\n", fPointSize, xuiSize);
- XUI_Font *font = NULL;
- XUI_FontData *fontData = NULL;
+ XUI_Font *font = nullptr;
+ XUI_FontData *fontData = nullptr;
FLOAT scale = 1;
eFontData efontdata;
@@ -77,17 +77,17 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
}
font = m_loadedFonts[efontdata][scale];
- if (font == NULL)
+ if (font == nullptr)
{
fontData = m_loadedFontData[efontdata];
- if (fontData == NULL)
+ if (fontData == nullptr)
{
SFontData *sfontdata;
switch (efontdata)
{
case eFontData_Mojangles_7: sfontdata = &SFontData::Mojangles_7; break;
case eFontData_Mojangles_11: sfontdata = &SFontData::Mojangles_11; break;
- default: sfontdata = NULL; break;
+ default: sfontdata = nullptr; break;
}
fontData = new XUI_FontData();
@@ -101,14 +101,14 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
}
font->IncRefCount();
- *phFont = (HFONTOBJ)font;
+ *phFont = static_cast<HFONTOBJ>(font);
return S_OK;
}
VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont )
{
- XUI_Font *xuiFont = (XUI_Font*) hFont;
- if (xuiFont != NULL)
+ XUI_Font *xuiFont = static_cast<XUI_Font *>(hFont);
+ if (xuiFont != nullptr)
{
xuiFont->DecRefCount();
if (xuiFont->refCount <= 0)
@@ -125,7 +125,7 @@ HRESULT XUI_FontRenderer::GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontM
{
if( hFont == 0 || pFontMetrics == 0 ) return E_INVALIDARG;
- XUI_Font *font = (XUI_Font *)hFont;
+ XUI_Font *font = static_cast<XUI_Font *>(hFont);
pFontMetrics->fLineHeight = (font->m_fontData->getFontYAdvance() + 1) * font->m_fYScaleFactor;
pFontMetrics->fMaxAscent = font->m_fontData->getMaxAscent() * font->m_fYScaleFactor;
@@ -142,7 +142,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr
{
if (hFont == 0 || pCharMetrics == 0) return E_INVALIDARG;
- XUI_Font *font = (XUI_Font *)hFont;
+ XUI_Font *font = static_cast<XUI_Font *>(hFont);
XUI_FontData::SChar sChar = font->m_fontData->getChar(wch);
pCharMetrics->fMinX = sChar.getMinX() * font->m_fYScaleFactor;
@@ -156,7 +156,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr
HRESULT XUI_FontRenderer::DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC, IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, UINT insetX, UINT insetY )
{
- if( hFont==0 || pTexture==NULL ) return E_INVALIDARG;
+ if( hFont==0 || pTexture==nullptr ) return E_INVALIDARG;
return( S_OK );
}
@@ -169,7 +169,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat
DWORD SamplerStateA[5];
XMVECTOR vconsts[20];
XMVECTOR pconsts[20];
- XUI_Font *font = (XUI_Font *)hFont;
+ XUI_Font *font = static_cast<XUI_Font *>(hFont);
// 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
if(!RenderManager.IsHiDef())
@@ -184,19 +184,19 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat
if(iScaleX%2==0)
{
int iWorldX=pWorldViewProj->_41;
- pWorldViewProj->_41 = (float)(iWorldX & -2);
+ pWorldViewProj->_41 = static_cast<float>(iWorldX & -2);
}
if(iScaleY%2==0)
{
int iWorldY=pWorldViewProj->_42;
- pWorldViewProj->_42 = (float)(iWorldY & -2);
+ pWorldViewProj->_42 = static_cast<float>(iWorldY & -2);
}
}
else
{
// make x an even number for 480 4:3
int iWorldX=pWorldViewProj->_41;
- pWorldViewProj->_41 = (float)(iWorldX & -2);
+ pWorldViewProj->_41 = static_cast<float>(iWorldX & -2);
// 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 iWorldY=pWorldViewProj->_42;