22#pragma hdrstop
33
44#include " GameFont.h"
5+ #include " xrCore/Text/MbHelpers.h"
56#ifndef _EDITOR
67#include " Render.h"
78#endif
@@ -12,7 +13,7 @@ ENGINE_API Fvector2 g_current_font_scale = {1.0f, 1.0f};
1213#include " Include/xrRender/RenderFactory.h"
1314#include " Include/xrRender/FontRender.h"
1415
15- CGameFont::CGameFont (LPCSTR section, u32 flags)
16+ CGameFont::CGameFont (pcstr section, u32 flags)
1617{
1718 pFontRender = GEnv.RenderFactory ->CreateFontRender ();
1819 fCurrentHeight = 0 .0f ;
@@ -34,7 +35,7 @@ CGameFont::CGameFont(LPCSTR section, u32 flags)
3435 SetInterval (pSettings->r_fvector2 (section, " interval" ));
3536}
3637
37- CGameFont::CGameFont (LPCSTR shader, LPCSTR texture, u32 flags)
38+ CGameFont::CGameFont (pcstr shader, pcstr texture, u32 flags)
3839{
3940 pFontRender = GEnv.RenderFactory ->CreateFontRender ();
4041 fCurrentHeight = 0 .0f ;
@@ -46,7 +47,7 @@ CGameFont::CGameFont(LPCSTR shader, LPCSTR texture, u32 flags)
4647 Initialize (shader, texture);
4748}
4849
49- void CGameFont::Initialize (LPCSTR cShader, LPCSTR cTextureName)
50+ void CGameFont::Initialize (pcstr cShader, pcstr cTextureName)
5051{
5152 string_path cTexture;
5253
@@ -191,14 +192,14 @@ void CGameFont::OutSet(float x, float y)
191192}
192193
193194void CGameFont::OutSetI (float x, float y) { OutSet (DI2PX (x), DI2PY (y)); }
194- u32 CGameFont::smart_strlen (const char * S) { return (IsMultibyte () ? mbhMulti2Wide (NULL , NULL , 0 , S) : xr_strlen (S)); }
195+ u32 CGameFont::smart_strlen (pcstr S) { return (IsMultibyte () ? mbhMulti2Wide (NULL , NULL , 0 , S) : xr_strlen (S)); }
195196void CGameFont::OnRender ()
196197{
197198 pFontRender->OnRender (*this );
198199 strings.clear ();
199200}
200201
201- u16 CGameFont::GetCutLengthPos (float fTargetWidth , const char * pszText)
202+ u16 CGameFont::GetCutLengthPos (float fTargetWidth , pcstr pszText)
202203{
203204 VERIFY (pszText);
204205
@@ -224,7 +225,7 @@ u16 CGameFont::GetCutLengthPos(float fTargetWidth, const char* pszText)
224225 return wsPos[i - 1 ];
225226}
226227
227- u16 CGameFont::SplitByWidth (u16 * puBuffer, u16 uBufferSize, float fTargetWidth , const char * pszText)
228+ u16 CGameFont::SplitByWidth (u16 * puBuffer, u16 uBufferSize, float fTargetWidth , pcstr pszText)
228229{
229230 VERIFY (puBuffer && uBufferSize && pszText);
230231
@@ -261,8 +262,8 @@ u16 CGameFont::SplitByWidth(u16* puBuffer, u16 uBufferSize, float fTargetWidth,
261262 return nLines;
262263}
263264
264- void CGameFont::MasterOut (BOOL bCheckDevice, BOOL bUseCoords, BOOL bScaleCoords, BOOL bUseSkip, float _x, float _y,
265- float _skip, LPCSTR fmt, va_list p)
265+ void CGameFont::MasterOut (bool bCheckDevice, bool bUseCoords, bool bScaleCoords, bool bUseSkip, float _x, float _y,
266+ float _skip, pcstr fmt, va_list p)
266267{
267268 if (bCheckDevice && (!RDEVICE.b_is_Active ))
268269 return ;
@@ -300,18 +301,18 @@ void CGameFont::MasterOut(BOOL bCheckDevice, BOOL bUseCoords, BOOL bScaleCoords,
300301 \
301302}
302303
303- void __cdecl CGameFont::OutI (float _x, float _y, LPCSTR fmt, ...)
304+ void __cdecl CGameFont::OutI (float _x, float _y, pcstr fmt, ...)
304305{
305- MASTER_OUT (FALSE , TRUE , TRUE , FALSE , _x, _y, 0 .0f , fmt);
306+ MASTER_OUT (false , true , true , false , _x, _y, 0 .0f , fmt);
306307};
307308
308- void __cdecl CGameFont::Out (float _x, float _y, LPCSTR fmt, ...)
309+ void __cdecl CGameFont::Out (float _x, float _y, pcstr fmt, ...)
309310{
310- MASTER_OUT (TRUE , TRUE , FALSE , FALSE , _x, _y, 0 .0f , fmt);
311+ MASTER_OUT (true , true , false , false , _x, _y, 0 .0f , fmt);
311312};
312313
313- void __cdecl CGameFont::OutNext (LPCSTR fmt, ...) { MASTER_OUT (TRUE , FALSE , FALSE , TRUE , 0 .0f , 0 .0f , 1 .0f , fmt); };
314- void CGameFont::OutNextVA (const char * format, va_list args)
314+ void __cdecl CGameFont::OutNext (pcstr fmt, ...) { MASTER_OUT (TRUE , FALSE , FALSE , TRUE , 0 .0f , 0 .0f , 1 .0f , fmt); };
315+ void CGameFont::OutNextVA (pcstr format, va_list args)
315316{
316317 MasterOut (TRUE , FALSE , FALSE , TRUE , 0 .0f , 0 .0f , 1 .0f , format, args);
317318}
@@ -322,7 +323,7 @@ float CGameFont::SizeOf_(const char cChar)
322323 return (GetCharTC ((u16 )(u8 )(((IsMultibyte () && cChar == ' ' )) ? 0 : cChar)).z * vInterval.x );
323324}
324325
325- float CGameFont::SizeOf_ (LPCSTR s)
326+ float CGameFont::SizeOf_ (pcstr s)
326327{
327328 if (!(s && s[0 ]))
328329 return 0 ;
0 commit comments