The latest version of FlatRedBall Desktop GL (the recommended replacement for FlatRedBall XNA) includes full support for all FlatRedBall color operations. Specifically, today’s release adds the following color operations which were previously unavailable:
These new color operations can be used to add more flexibility to how your sprites are rendered, and no longer requires custom code when moving from XNA to Desktop GL.
Using the Color Operations
Color operations can be previewed quickly through the Glue preview window (aka GlueView). The best way to learn about how these work is to create a sprite and test out different combinations of color operations and color values.
This change introduces a few minor breaking changes. If your project is experiencing any problems see the sections below for fixes.
Your project may have a crash when first running because of a missing file. The error message my look like:
Microsoft.Xna.Framework.Content.ContentLoadException: 'The content file was not found.' Inner Exception FileNotFoundException: Could not find file 'YourProjectDirectory\bin\DesktopGL\x86\Debug\Content\shader.xnb'.
The new color operations are implemented using a custom shader (the same shader file used in FlatRedBall XNA). Desktop GL projects created prior to this release will not have this file, so it needs to be added manually. To do this:
- Create a brand new DesktopGL project
- Open the new project’s Content folder
- Find the shader.xnb file
- Open your existing project in Visual Studio
- Drag+drop the shader.xnb file into your project’s content folder
- Change the newly-created file’s Build Action to Content
- Change Copy to Output Directory to Copy if newer
‘ColorOperation’ does not contain a definition for ‘None’
The (confusing) ColorOperation.None has been completely removed from FlatRedBall. Conceptually, every graphical object must have a color operation, and ColorOperation.None was internally treated as ColorOperation.Texture . If your code uses ColorOperation.None , you can either convert it to ColorOperation.Texture , or you can make the ColorOperation a nullable if you need to distinguish between a specifically set value and an uninitialized value.
The ColorOperation documentation provides additional information and examples. Check it out here to see what kind of visual effects you can add to your game.