Skip to content
Permalink
Browse files

Use Color::Color when handling ROCKET_COLOR

  • Loading branch information...
mbasaglia committed Aug 13, 2015
1 parent 711f09f commit 8c1e6f511e5aee751793b2ac51b549c96da14169
Showing with 9 additions and 13 deletions.
  1. +5 −5 src/cgame/cg_rocket_draw.cpp
  2. +4 −8 src/cgame/rocket/rocket_element.cpp
@@ -42,12 +42,12 @@ Maryland 20850 USA.

static void CG_GetRocketElementColor( Color::Color& color )
{
Rocket_GetProperty( "color", color.ToArray(), color.ArrayBytes(), ROCKET_COLOR );
Rocket_GetProperty( "color", &color, sizeof(Color::Color), ROCKET_COLOR );
}

static void CG_GetRocketElementBGColor( Color::Color& bgColor )
{
Rocket_GetProperty( "background-color", bgColor.ToArray(), bgColor.ArrayBytes(), ROCKET_COLOR );
Rocket_GetProperty( "background-color", &bgColor, sizeof(Color::Color), ROCKET_COLOR );
}

static void CG_GetRocketElementRect( rectDef_t *rect )
@@ -2747,8 +2747,8 @@ static void CG_Rocket_DrawPlayerMomentumBar()
CG_GetRocketElementBGColor( backColor );
CG_GetRocketElementColor( foreColor );
Rocket_GetProperty( "border-width", &borderSize, sizeof( borderSize ), ROCKET_FLOAT );
Rocket_GetProperty( "locked-marker-color", lockedColor.ToArray(), lockedColor.ArrayBytes(), ROCKET_COLOR );
Rocket_GetProperty( "unlocked-marker-color", unlockedColor.ToArray(), unlockedColor.ArrayBytes(), ROCKET_COLOR );
Rocket_GetProperty( "locked-marker-color", &lockedColor, sizeof(Color::Color), ROCKET_COLOR );
Rocket_GetProperty( "unlocked-marker-color", &unlockedColor, sizeof(Color::Color), ROCKET_COLOR );


ps = &cg.predictedPlayerState;
@@ -2930,7 +2930,7 @@ static void CG_Rocket_DrawPlayerUnlockedItems()
} icon[ NUM_UNLOCKABLES ]; // more than enough(!)

CG_GetRocketElementRect( &rect );
Rocket_GetProperty( "cell-color", backColour.ToArray(), backColour.ArrayBytes(), ROCKET_COLOR );
Rocket_GetProperty( "cell-color", &backColour, sizeof(Color::Color), ROCKET_COLOR );
CG_GetRocketElementColor( foreColour );
Rocket_GetProperty( "border-width", &borderSize, sizeof( borderSize ), ROCKET_FLOAT );

@@ -279,17 +279,13 @@ void Rocket_GetProperty( const char *name, void *out, int len, rocketVarType_t t

case ROCKET_COLOR:
{
/// \todo (color) write to Color::Color (?)
vec_t *outColor = ( vec_t * ) out;

if ( len != sizeof( vec4_t ) )
if ( len == sizeof( Color::Color ) )
{
return;
Color::Color32Bit color ( property->Get<Rocket::Core::Colourb>() );
Color::Color* outColor = ( Color::Color* ) out;
*outColor = Color::Color( color );
}

Rocket::Core::Colourb color = property->Get<Rocket::Core::Colourb>();
outColor[ 0 ] = color.red, outColor[ 1 ] = color.green, outColor[ 2 ] = color.blue, outColor[ 3 ] = color.alpha;
Vector4Scale( outColor, 1 / 255.0f, outColor );
return;
}
}

0 comments on commit 8c1e6f5

Please sign in to comment.
You can’t perform that action at this time.