IColorable
Introduction
Applying ColorOperations
// To reduce code, add the following #using statement to your Game class
using FlatRedBall.Graphics;
// Replace your Initialize method with the following:
protected override void Initialize()
{
FlatRedBallServices.InitializeFlatRedBall(this, this.graphics);
float xPosition = -3;
float spacing = 2;
Sprite regularSprite = SpriteManager.AddSprite("redball.bmp");
regularSprite.X = xPosition;
// uses default ColorOperation:
// FlatRedBall.Graphics.ColorOperation.Texture
xPosition += spacing;
Sprite blueAdded = SpriteManager.AddSprite("redball.bmp");
blueAdded.X = xPosition;
blueAdded.Blue = 1; // between 0 and 1
blueAdded.ColorOperation = ColorOperation.Add;
xPosition += spacing;
Sprite plainColor = SpriteManager.AddSprite("redball.bmp");
plainColor.X = xPosition;
plainColor.Green = .7f;
plainColor.Red = .8f;
// using the ColorOperation.Color rather than
// ColorOperation.ColorTextureAlpha will make the
// entire Sprite the specified color even where normally
// transparent.
plainColor.ColorOperation = ColorOperation.ColorTextureAlpha;
xPosition += spacing;
Sprite inverseColor = SpriteManager.AddSprite("redball.bmp");
inverseColor.X = xPosition;
inverseColor.ColorOperation = ColorOperation.InverseTexture;
base.Initialize();
}
Color Rates

Alpha and BlendOperation

AlphaRate
IColorable Members
Last updated
Was this helpful?