Releases: BenMakesGames/PlayPlayMini
7.2.0
Big changes
PlayPlayMini.UI is formally abandoned
- I haven't worked on this library, or even tested it, in forever
- I have no desire to use it in any of the games I'm working on
- if you liked this library, please feel free to fork it - take ownership, and start publishing your own NuGet packages! (it's fun!)
- a slimmer replacement library may come in the future, based on PlayPlayMini's
IRectangle<T>interface and its various extension methods
Added new PlayPlayMini.VN
- I have used this code, or an earlier version of it, in a few games which have been published on Steam
- ^ that said, I have published it as a release candidate (you will not see it in NuGet unless you check the box to see prerelease packages) because I have not extensively tested it in this new form
Small changes
- added a few more docblocks throughout PlayPlayMini and PlayPlayMini.GraphicsExtensions
- migrated many more extension methods to .NET 10's new extension block syntax
- added extension methods to PlayPlayMini.GraphicsExtensions for drawing text with outlines when using
spans
Known issues
- docfx does not yet support .NET 10's new extension block syntax (dotnet/docfx#10808); as a result, https://benmakesgames.github.io/PlayPlayMini/ is not up to date
7.1.0
- upgraded third-party dependencies, including Autofac
- added a few more docblocks
- migrated a few more extension methods to .NET 10's new extension block syntax
- added a new particle effect (
ShrinkingCircle) toGraphicsExtensions
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.
6.2.0
- Added alternative constructors for
*Metarecords, to support use-cases where keys and file paths are identical AssetCollection.GetAll<T>()now explicitly requiresTto be anIAsset- Added more docblocks
Alternate constructors for *Meta records
Suppose you load assets as follows:
.AddAssets([
new PictureMeta("Map", "Backgrounds/Map"),
new SpriteSheetMeta("SpellIcons", "Icons/Spells", 24, 24),
])The asset keys - "Map" and "SpellIcons" in this example - make it easier for devs to refer to pictures and other assets by name, rather than memorizing a path (a path which could change!) However, to help prevent dev mistakes, you may want to use consts, anyway, in which case the key and path may as well be the same since file paths are guaranteed unique:
.AddAssets([
new PictureMeta(Pictures.Map, Pictures.Map),
new SpriteSheetMeta(SpriteSheets.SpellIcons, SpriteSheets.SpellIcons, 24, 24),
])When taking this approach, repeating the same value/const for every asset is annoying. This update provides convenience constructors for when your key and path are the same:
.AddAssets([
new PictureMeta(Pictures.Map),
new SpriteSheetMeta(SpriteSheets.SpellIcons, 24, 24),
])6.1.0
- Upgraded to MonoGame 3.8.4
- Upgraded third-party dependencies (MS, Autofac, and others)
- Added a particle effect system to
BenMakesGames.PlayPlayMini.GraphicsExtensions
Particle Effect System
The particle effect system is one I've used in a few of my Steam games so far, including Word x Word. The particle effects that come bundled with BenMakesGames.PlayPlayMini.GraphicsExtensions were copy-pasted straight out of those games, with slight modifications to make them more general-purpose.
Here's an example of a game state that creates a tumbling "glass shard" particle when the mouse is clicked.
public sealed class MyGameState: GameState
{
private GraphicsManager Graphics { get; }
private MouseManager Mouse { get; }
private List<IParticle> Particles { get; } = new();
public MyGameState(GraphicsManager graphics, MouseManager mouse)
{
Graphics = graphics;
Mouse = mouse;
}
public override void Update(GameTime gameTime)
{
Particles.Update(gameTime);
if(Mouse.LeftClicked)
Particles.Add(new GlassShard(Mouse.X, Mouse.Y, Graphics.Height, Color.SkyBlue));
}
public override void Draw(GameTime gameTime)
{
Graphics.DrawParticles(Particles);
Mouse.Draw(gameTime);
}
}6.0.0
- Upgraded to MonoGame 3.8.3
- Upgraded to .NET 9.0
- Replaced FluentAssertions with Shouldly in automated tests
- Added
GraphicsManager.Clear()method (parameterless version ofGraphicsManager.Clear(Color c) - Added more docblocks
5.6.0
Added bool GameStateManager.ContainsAsset<T>(Func<T, bool> predicate) where T: IAsset, intended to facilitate automated testing.
5.5.0
- Can now call
AddServices&AddConfigurationon theGameStateManagerBuildermultiple times
5.4.0
- (Finally) deleted various
[Obsolete]methods - Added helper methods to
MouseManager:IsInRectangle,IsInWindow, andIsInCircle - Upgraded
Microsoft.Extensions.Logging.Abstractionsdependency from 8.0.1 to 8.0.2 - Added more docblocks
5.3.0
- Fixed a bug that caused pictures to be loaded twice during game startup
- Upgraded third-party NuGet packages, including System.Text.Json from 8.0.0 -> 8.0.5 to fix a DoS vulnerability (not likely to affect a desktop game, but still)