Changelog History
-
v0.33.0 Changes
August 28, 2017๐ A new version of the Piston core is released and the ecosystem has been updated.
โก๏ธ It is strongly recommended to use event traits to handle events. Use
E: GenericEvent
in generic code. When following this pattern this update will simply require a version bump in "Cargo.toml".๐ This release includes the following improvements:
๐ Better lazy event loop
๐ฑ In some application modes that do not require animations, one can save CPU cycles by setting
EventSettings::lazy
totrue
. The event loop logic has been changed to a version that behaves better under heavy rendering loads. Instead of rendering on each input event, the event loop now waits for the first event and then polls the event queue empty before rendering. This makes applications more responsive.๐ The lazy event loop now also got support for benchmark mode. Since most benchmarks are measuring render + updates it is still recommended to disable
EventSettings::lazy
when measuring game engine performance. An alternative is to use a frame counter.๐ New button event
โก๏ธ You can now read scancodes from the window backend using
ButtonEvent
. This gives you aButtonArgs
struct similar to render and update events. Scancodes are stored insideButtonArgs
to preserve equality checks for theButton
enum.๐ The
PressEvent
andReleaseEvent
traits try to preserve the scancode when transforming an event. This makes it possible to write controllers for custom keyboard layouts, e.g. for testing globalization features. If you do not want this behavior, use theButtonEvent
trait when transforming the event.๐จ Refactoring
๐ Two new enums has been added:
Loop
andEvent
. Some variants was moved fromInput
toLoop
. The design is as following:pub enum Loop { Render(RenderArgs), AfterRender(AfterRenderArgs), Update(UpdateArgs), Idle(IdleArgs), }pub enum Event { Input(Input), Loop(Loop), Custom(EventId, Arc\<Any + Send + Sync\>), }
๐ This solves a design conflict to support custom events while cleanly separating
Input
. TheGenericEvent
trait is now only implemented forEvent
. To convert toInput
one can write:if let Some(input) = e.into() { call\_some\_input\_function(input); }
โก๏ธ To support custom events in a generic library, use a generic parameter
E: GenericEvent
. This allows custom window backends and event transformers to e.g. add hardware or network events and change application code without updating libraries.Serde integration
๐ With the deprecation of rustc-serialize, the Piston core is now using serde. Serialization is supported for
Input
andLoop
, but not forEvent
since custom events are not serializable. Use conversion traits when storing and loading events, for example when replaying user input. -
v0.23.0 Changes
June 02, 2016๐ This release adds some new functionality to
AdvancedWindow
to hide, show and change position of windows. A minor change was made to theBuildFromWindowSettings
trait to make it easier to reuse window settings when creating a new window.๐ For release notes, see #1092
-
v0.5.0
July 22, 2015