Update #57 - Particle Engine & UI Library

Hey, welcome. I hope you've been well. Here are the minor revisions:

  • Data serializer now supports List<T> serializing and parsing.
  • Wrote a quick-start guide on using the data serializer.
  • Extracted the particle engine from PoE into a separate class library.
  • Wrote a quick-start guide on using the particle engine.
  • Changed how positioning works in the UI library. It feels cleaner!
  • Camera origin can now be set (this is functionally the UI's origin).
  • Fixed elements not fading out properly. Silly me only reduced alpha, when all RGBA decreasing.
  • Added SliderElement.cs to the UI library.
  • Added TextElement.cs. One line strings.
  • Added CheckboxElement.cs, with support for radio.
  • Merged HoverBoxElement.cs with BoxElement.cs. One was used for drawing boxes, the other for collision detection.
  • Added ContainerElement.cs. Group other elements together for easy moving!
  • Added linear interpolation to the slider.
  • Added ScrollElement.cs, which gives the coder access to smooth scroller across both X and Y.
  • Tested UIs having a visual inactive state. Incredibly smooth!

Particle Engine

particleEngine.png

After extracting the old code from Pilgrimage of Embers into a class library, I had to update parts of it. It's now very extendable. Here are some cool demonstrations:

This is the most basic way to use the particle engine. Create a derived class from Emitter, add in custom behaviour, an texture sheet for animation, and you're good to go.

This uses a custom particle called ConnectParticle. Similar to the old ConnectParticle which connected particles via lines, except with a modified MonoGame.dll to allow texture corners to be connected. Add in some simple physics, and you've got elastic ribbons.


UI Library

Part of this code was actually written last year, but I postponed it to get back to working on the Pilgrimage of Ember's alpha. This is also the reason why I haven't started working on the new games launcher yet, as I wanted to use the UI library in it.

The features added so far include:

  • Elements. Image, AnimatedImage, ButtonBox, Box, Slider, Checkbox, Text, TextLine (almost), Container, Scroll.
  • Visuals.  Fade, zoom, rotate, shake, wobble, squish, and slide. These should be put in the minimize, maximize, inactive, or active methods.
  • Interaction. If two UIs are overlapping, clicking on an element in the front UI won't trigger any elements in the back UI. They play very well together... or rather, they don't!
  • Masking. Render a couple of backgrounds to define the mask, then draw the sprites like normal in the next parameter. The UI background in the above video is originally 1000 x 1000 pixels, but it's been cut out.

I'm aiming for flexibility, so the above is completely optional. If you don't want to use masking, skip it. If you don't like how I coded an Element type, make a derived class and code it better! As for what is next here, I'm going to add more elements in, such as semi-rich text boxes. I'd also like to make the elements control-neutral (with recommended methods), that way it is compatible with mouse, keyboard, gamepad, touchscreens, and anything else defined by the coder.


If you have any ideas, constructive criticism, or just want to tell me how much you dislike my projects, you can: Send me an email, tweet @TheShyyGuy, gab to @ShyyGuy, comment on the Facebook page, or respond in the comment section below.

Do you want to support the developer? Here's what you can do:

  1. Become a Patron here!
  2. Tell your friends and family about my projects!
  3. Retweetrepost, and share the content that you like!

Thank you for reading!

From Enckling, with love.