Beispiel #1
0
uint32 inline CRenderer::AddChar( uint32 c, int32 x, int32 y, uint32 flags )
{
	float tx1, ty1, tx2, ty2;
	uint32 w, h, spacing;
	colour_t col;
	rectangle_t r;

	CheckVertexBuffer( 12 );

	tx1 = renderFont->texCoords[c][0];
	tx2 = renderFont->texCoords[c][2];
	ty1 = 1.0f - renderFont->texCoords[c][1];
	ty2 = 1.0f - renderFont->texCoords[c][3];

	w = (uint32)( ( tx2 - tx1 ) * renderFont->width );
	h = (uint32)( ( ty1 - ty2 ) * renderFont->height );
	spacing = (uint32)renderFont->spacing * 2;

	r.x = (int16)x, r.y = (int16)y, r.w = (uint16)w, r.h = (uint16)h;

	if ( clipping && ( x < (int32)clip.x || (int32)(x+w) > (int32)clip.x+clip.w+spacing+1 || y < (int32)clip.y || (int32)(y+h) > (int32)clip.y+clip.h ) )
	{
		return ( w - spacing );
	}

	if ( flags & TFLAG_SHADOW )
	{
		colour_t shadowCol = colour_t( 0, 0, 0, drawColour.a );
		static const int32 shadowOffset = 1;

		col.hex = drawColour.hex;
		SetDrawColour( &shadowCol );

		AddVertexTextured( x+shadowOffset, y+shadowOffset, tx1, ty1 );
		AddVertexTextured( x+w+shadowOffset, y+shadowOffset, tx2, ty1 );
		AddVertexTextured( x+shadowOffset, y+h+shadowOffset, tx1, ty2 );

		AddVertexTextured( x+w+shadowOffset, y+shadowOffset, tx2, ty1 );
		AddVertexTextured( x+w+shadowOffset, y+h+shadowOffset, tx2, ty2 );
		AddVertexTextured( x+shadowOffset, y+h+shadowOffset, tx1, ty2 );

		SetDrawColour( &col );
	}

	AddVertexTextured( x, y, tx1, ty1 );
	AddVertexTextured( x+w, y, tx2, ty1 );
	AddVertexTextured( x, y+h, tx1, ty2 );

	AddVertexTextured( x+w, y, tx2, ty1 );
	AddVertexTextured( x+w, y+h, tx2, ty2 );
	AddVertexTextured( x, y+h, tx1, ty2 );

	return ( w - 2 * renderFont->spacing );
}
Beispiel #2
0
bool test_ref_111( colour_t& colour ){
    return colour == colour_t( 1, 1, 1);
}
Beispiel #3
0
bool test_cref_000( const colour_t& colour ){
    return colour == colour_t( 0, 0, 0);
}
Beispiel #4
0
bool test_val_010( colour_t colour ){
    return colour == colour_t( 0, 1, 0);
}
Beispiel #5
0
bool test_cptr_110( const colour_t* colour ){
    return colour && *colour == colour_t( 1, 1, 0);
}
Beispiel #6
0
bool test_ptr_101( colour_t* colour ){
    return colour && *colour == colour_t( 1, 0, 1);
}