(360) 360/fonts.cpp - indenting nits

This commit is contained in:
Twinaphex 2012-04-14 05:01:26 +02:00
parent 76493d26d4
commit 233730d03b
1 changed files with 428 additions and 420 deletions

View File

@ -150,16 +150,17 @@ void xdk360_console_add( wchar_t wch )
else
{
// Try to append the character to the line
video_console.m_Lines[ video_console.m_nCurLine ]
[ video_console.m_cCurLineLength ] = wch;
video_console.m_Lines[ video_console.m_nCurLine ][ video_console.m_cCurLineLength ] = wch;
float fTextWidth, fTextHeight;
xdk360_video_font_get_text_width(&m_Font, video_console.m_Lines[ video_console.m_nCurLine ], &fTextWidth, &fTextHeight, 0);
xdk360_video_font_get_text_width(&m_Font, video_console.m_Lines[ video_console.m_nCurLine ], &fTextWidth,
&fTextHeight, 0);
if( fTextHeight > video_console.m_cxSafeArea )
{
// The line is too long, we need to wrap the character to the next line
video_console.m_Lines[video_console.m_nCurLine]
[ video_console.m_cCurLineLength ] = L'\0';
video_console.m_Lines[video_console.m_nCurLine][ video_console.m_cCurLineLength ] = L'\0';
bIncrementLine = TRUE;
}
}
@ -182,6 +183,7 @@ void xdk360_console_format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
{
video_console.m_nCurLine = 0;
video_console.m_cCurLineLength = 0;
memset( video_console.m_Buffer, 0,
video_console.m_cScreenHeightVirtual *
( video_console.m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
@ -200,7 +202,8 @@ void xdk360_console_format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
for( unsigned long i = 0; i < uStringLength; i++ )
{
wchar_t wch;
int ret = MultiByteToWideChar( CP_ACP, // ANSI code page
int ret = MultiByteToWideChar(
CP_ACP, // ANSI code page
0, // No flags
&strMessage[i], // Character to convert
1, // Convert one byte
@ -333,7 +336,8 @@ static HRESULT xdk360_video_font_create_shaders (xdk360_video_font_t * font)
{
// Use the do {} while(0); trick for a fake goto
// It simplies tear down on error conditions.
do{
do
{
// Step #1, create my vertex array with 16 bytes per entry
// Floats for the position,
@ -353,11 +357,12 @@ static HRESULT xdk360_video_font_create_shaders (xdk360_video_font_t * font)
D3DDevice *pd3dDevice = vid->xdk360_render_device;
hr = pd3dDevice->CreateVertexDeclaration( decl, &s_FontLocals.m_pFontVertexDecl );
if (SUCCEEDED(hr))
{
// Step #2, create my vertex shader
ID3DXBuffer* pShaderCode;
hr = D3DXCompileShader( g_strFontShader, sizeof(g_strFontShader)-1 ,
NULL, NULL, "FontVertexShader", "vs.2.0", 0,&pShaderCode, NULL, NULL );
if (SUCCEEDED(hr))
@ -385,14 +390,16 @@ static HRESULT xdk360_video_font_create_shaders (xdk360_video_font_t * font)
break; // Skip the teardown code
}
}
// If the code got to here, a fatal error has occured
// and a clean shutdown needs to be performed.
D3DResource_Release((D3DResource *)s_FontLocals.m_pFontVertexShader);
}
// Ensure the pointer is NULL
s_FontLocals.m_pFontVertexShader = NULL;
}
D3DResource_Release((D3DResource *)s_FontLocals.m_pFontVertexDecl);
}
// Ensure this pointer is NULL
@ -752,6 +759,7 @@ void xdk360_video_font_draw_text(xdk360_video_font_t * font, float fOriginX, flo
unsigned long dwNumChars = wcslen(strText);
HRESULT hr = pd3dDevice->BeginVertices( D3DPT_QUADLIST, 4 * dwNumChars, sizeof( XMFLOAT4 ) ,
( VOID** )&pVertex );
// The ring buffer may run out of space when tiling, doing z-prepasses,
// or using BeginCommandBuffer. If so, make the buffer larger.
if( FAILED( hr ) )