Version 0.5.0
Pre-release
Pre-release
[0.5.0] - 2021-11-27
Added
Core
log
facade added for logging support.- Added methods to
PixEngineBuilder
to control cache sizes. - Added
PixState::elapsed
method which returns the total elasped time since
application start. - A lot of documentation, examples, and README images.
UI
- Added
Theme
andThemeBuiilder
structs to customize UI theming for colors,
fonts, sizes, styles and spacing.PixEngineBuilder
updated with theme
customizing methods. Default is a dark theme. - Added several new UI widget rendering methods and a new
gui
example demoing
their usage. Cursor::no
method added.
Window
PixState
methods for getting and setting window dimensions changed to return
a result instead of panicking and will return the dimensions for the current
window target instead of only the primary window.PixState::save_canvas
andPixState::save_texture
methods.
Drawing
Color::from_hex_alpha
andColor::as_hex_alpha
added that take/return RGBA
values.Color::blended
method added.PixState::set_viewport
andPixState::clear_viewport
methods added to
control the rendering viewport.
Shapes
Rect::resized
andRect::resize_by
methods added.- Added various
offset
methods to shapes. Ellipse::diameter
method for circular ellipses.Ellipse::bounding_rect
method.Point::dist
method.Serialize
andDeserialize
added for shapes with const generics when the
serde
feature is enabled.
Changed
Core
- Several types changed to
must_use
. - Several optimizations and performance improvements regarding caching and
memory management.
UI
PixEngineBuilder::with_font
updated to take anything that can be turned into
aFont
struct which includes a path as before, but can now also take static
font data loaded frominclude_bytes!
for example.PixState::text
updated to return the bounding box of rendered text.- Added
PixState::wrap_width
andPixState::no_wrap
methods to control text
wrap width.
Drawing
- Many
Color
methods madeconst
. Color::set_levels
method added.- Changed shapes to use anti-aliasing where possible by default.
- Added
PixState::stroke_weight
method to draw thick lines.
Shapes
- Fixed radius handling in a circle
Ellipse
. Line::new
,Tri::new
, andQuad::new
updated to support different types
for each point parameter.Line
,Tri
, andQuad
macros updated to have better type inference.
Breaking
Core
core
module removed and all included modules moved up a level.PixResult
changed to returnanyhow::Error
, which can include a backtrace
on nightly. Many other types of errors returned now all return the same
PixResult
struct.AppState
methods that handle events changed to return abool
indicating
whether the event is to be consumed or not, and thus skipping any additional
handling the engine may have for said event.pix_engine::prelude::*
cleaned up by removing several type aliases which can
be imported frompix_engine::shape
.- Removed
PixEngineBuilder::asset_dir
method in favor of including assets
required by the library in the binary. PixEngineBuilder::build
now returns aPixResult
if any of the build
settings are invalid.math::constants::*
moved intomath
.
Textures
Texture
struct removed in favor ofTextureId
. All methods for getting or
updating textures now take aTextureId
instead.- Removed
unsafe
fromPixState::delete_texture
. Now it will simply return a
PixResult
if theTextureId
is invalid.
Shapes
- All shapes had their
values
method changed toas_array
andset_values
method removed in favor ofas_bytes_mut
. - All shapes now have
as_bytes
andas_bytes_mut
methods. - Removed
Button
struct and changedPixState::button
API to just return a
bool
if the button was clicked or not instead of having aclicked
method. UsePixState::hovered
method to check if the previously rendered
item was hovered.
UI
PixEngineBuilder::with_font
changed to not takesize
as a parameter. Added
an additionalPixEngineBuilder::with_font_size
method.PixState::primary_window_id
removed.
Drawing
Color::new
,Color::new_alpha
,Color::rgb
, andColor::rgba
changed to
takeu8
RGB/A values. Affectsrgb!
andcolor!
macros. RGBA setter
methods also updated to takeu8
.Color::levels
made non-const instead computing levels at run-time as needed.Color::from_raw
renamed toColor::from_levels
and removedunsafe
.Color::from_hex
andColor::as_hex
changed to take/return RGB
values with the topu32
bits being0x00
.Color::from_hex_alpha
and
Color::as_hex_alpha
added that take/return RGBA values.Color::rgb_channels
andColor::rgba_channels
removed in favor of
Color::channels
.- Color constants moved from the prelude to constants on
Color
. e.g.Color::RED
. PixState::polygon
andPixState::wireframe
changed to take a type that can
be converted intoIntoIterator<Item = Into<PointI2>>
.- All shape drawing methods have more strict requirements that types can be
converted intoi32
. - All shape drawing methods with floating point representations have had
floor
,ceil
,round
andtrunc
methods added.