6.3.0
- Added method overloads related to MonoGame's
Rectangleclass (for rectangle-drawing and.Containschecks) - Added an API for applying shaders to groups of
.Draw*calls (see below)
Shader API
As an example, suppose you have loaded a shader called "subtractive_plasma", which uses a time-based plasma effect (via a gameTime parameter) to omit parts of drawn objects:
public void DrawLayeredMonochromePlasma(GraphicsManager graphics, GameTime gameTime)
{
graphics.Clear(Color.Black);
// draw a blue rectangle, with plasma "holes" (via the subtractive_plasma shader)
using (graphics.WithShader("subtractive_plasma", s => {
s.Parameters["gameTime"].SetValue((float)gameTime.TotalGameTime.TotalSeconds);
}))
{
graphics.DrawFilledRectangle(0, 0, graphics.Width, graphics.Height, Color.DarkBlue);
}
// draw a dark gray rectangle, with plasma "holes" (via the subtractive_plasma shader)
using (graphics.WithShader("subtractive_plasma", s => {
s.Parameters["gameTime"].SetValue((float)gameTime.TotalGameTime.TotalSeconds * 1.5f);
}))
{
graphics.DrawFilledRectangle(0, 0, graphics.Width, graphics.Height, Color.DarkGray);
}
}of course, any number of .Draw* calls may be inside a using-.WithShader block; all will have the shader applied.