示例#1
0
文件: cl_game.c 项目: tenght/qfusion
/*
* CL_GameModule_TranslateString
*/
const char *CL_GameModule_L10n_TranslateString( const char *string )
{
	return L10n_TranslateString( CGAME_L10N_DOMAIN, string );
}
示例#2
0
/*
* Con_DrawNotify
*
* Draws the last few lines of output transparently over the game top
*/
void Con_DrawNotify( void )
{
    int v;
    char *text;
    const char *say;
    const char *translated;
    int i;
    int time;
    char *s;

    v = 0;
    if( con_drawNotify->integer )
    {
        for( i = min( NUM_CON_TIMES, con.numlines ) - 1; i >= 0; i-- )
        {
            time = con.times[i];
            if( time == 0 )
                continue;
            time = cls.realtime - time;
            if( time > con_notifytime->value*1000 )
                continue;
            text = con.text[i] ? con.text[i] : "";

            SCR_DrawString( 8, v, ALIGN_LEFT_TOP, text, cls.fontSystemSmall, colorWhite );

            v += SCR_strHeight( cls.fontSystemSmall );
        }
    }

    if( cls.key_dest == key_message )
    {
        int x, y;
        int width, prewidth;
        int promptwidth, cursorwidth;
        struct qfontface_s *font = NULL;

        if( con_chatCGame->integer )
        {
            width = con_chatWidth->integer;

            if( *con_chatFontFamily->string && con_chatFontSize->integer ) {
                font = SCR_RegisterFont( con_chatFontFamily->string, con_chatFontStyle->integer, con_chatFontSize->integer );
            }
            if( !font )
                font = cls.fontSystemSmall;

            x = con_chatX->integer;
            y = con_chatY->integer;
        }
        else
        {
            width = viddef.width;
            x = 8;
            y = v;
            font = cls.fontSystemSmall;
        }

        // 48 is an arbitrary offset for not overlapping the FPS and clock prints
        width -= 48;
        cursorwidth = SCR_strWidth( "_", font, 0 );

        if( chat_team )
        {
            say = "say_team:";
        }
        else
        {
            say = "say:";
        }

        translated = L10n_TranslateString( "common", say );
        if( !translated ) {
            translated = say;
        }
        SCR_DrawString( x, y, ALIGN_LEFT_TOP, translated, font, colorWhite );
        promptwidth = SCR_strWidth( translated, font, 0 ) + SCR_strWidth( " ", font, 0 );

        s = chat_buffer;
        prewidth = chat_linepos ? SCR_strWidth( s, font, chat_linepos ) : 0;

        // don't let the cursor go beyond the left screen edge
        clamp_high( chat_prestep, prewidth );

        // don't let it go beyond the right screen edge
        clamp_low( chat_prestep, prewidth - ( width - promptwidth - cursorwidth ) );

        // FIXME: we double the font height to compensate for alignment issues
        SCR_DrawClampString( x + promptwidth - chat_prestep,
                             y, s, x + promptwidth, y,
                             x + width, y + SCR_strHeight( font ) * 2, font, colorWhite );

        if( (int)( cls.realtime>>8 )&1 )
            SCR_DrawRawChar( x + promptwidth + prewidth - chat_prestep, y, '_',
                             font, colorWhite );
    }