(360) Some improvements to font rendering

This commit is contained in:
TwinAphex51224 2012-02-16 16:14:31 +01:00
parent 1373ba167d
commit 52402d02c5
3 changed files with 14 additions and 26 deletions

View File

@ -22,6 +22,7 @@
#include "xdk360_video.h" #include "xdk360_video.h"
#include "../general.h" #include "../general.h"
#include "../message.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -283,9 +284,9 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
{ {
if(IS_TIMER_EXPIRED() || g_first_msg) if(IS_TIMER_EXPIRED() || g_first_msg)
{ {
g_screen_console.Format(true, msg); g_screen_console.Format(msg);
g_first_msg = 0; g_first_msg = 0;
SET_TIMER_EXPIRATION(60); SET_TIMER_EXPIRATION(30);
} }
g_screen_console.Render(); g_screen_console.Render();

View File

@ -204,8 +204,7 @@ void Console::Add( wchar_t wch )
m_Lines[ m_nCurLine ][0] = wch; m_Lines[ m_nCurLine ][0] = wch;
} }
if(IS_TIMER_EXPIRED()) m_cCurLineLength++;
m_cCurLineLength++;
} }
@ -213,40 +212,28 @@ void Console::Add( wchar_t wch )
// Name: Format() // Name: Format()
// Desc: Output a variable argument list using a format string // Desc: Output a variable argument list using a format string
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
void Console::Format(int clear_screen, _In_z_ _Printf_format_string_ LPCSTR strFormat, ... ) void Console::Format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... )
{ {
if(clear_screen) m_nCurLine = 0;
{ m_cCurLineLength = 0;
m_nCurLine = 0; memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
m_cCurLineLength = 0;
memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
}
va_list pArgList; va_list pArgList;
va_start( pArgList, strFormat ); va_start( pArgList, strFormat );
FormatV( strFormat, pArgList ); FormatV( strFormat, pArgList );
va_end( pArgList ); va_end( pArgList );
// Render the output
Render();
} }
void Console::Format(int clear_screen, _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... ) void Console::Format(_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... )
{ {
if(clear_screen) m_nCurLine = 0;
{ m_cCurLineLength = 0;
m_nCurLine = 0; memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
m_cCurLineLength = 0;
memset( m_Buffer, 0, m_cScreenHeightVirtual * ( m_cScreenWidth + 1 ) * sizeof( wchar_t ) );
}
va_list pArgList; va_list pArgList;
va_start( pArgList, wstrFormat ); va_start( pArgList, wstrFormat );
FormatV( wstrFormat, pArgList ); FormatV( wstrFormat, pArgList );
va_end( pArgList ); va_end( pArgList );
// Render the output
Render();
} }

View File

@ -47,8 +47,8 @@ public:
void Destroy(); void Destroy();
// Console output // Console output
void Format(int clear_screen, _In_z_ _Printf_format_string_ LPCSTR strFormat, ... ); void Format(_In_z_ _Printf_format_string_ LPCSTR strFormat, ... );
void Format(int clear_screen, _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... ); void Format(_In_z_ _Printf_format_string_ LPCWSTR wstrFormat, ... );
void FormatV( _In_z_ _Printf_format_string_ LPCSTR strFormat, va_list pArgList ); void FormatV( _In_z_ _Printf_format_string_ LPCSTR strFormat, va_list pArgList );
void FormatV( _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, va_list pArgList ); void FormatV( _In_z_ _Printf_format_string_ LPCWSTR wstrFormat, va_list pArgList );