All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Window::set_inner_size
has been replaced withWindow::request_inner_size
. This function now matches winit's underlyingrequest_inner_size
behavior. The function returns an option containing the new size if the size was able to be applied before the function returns.This new function properly updates the
inner_size
andouter_size
when the underlying window is resized immediately. Notably, this happens on Wayland but may happen on some other platforms as well.Users who are using Kludgine directly should invoke
Kludgine::resize
to apply the new size. -
Window::winit
now returns anArc
-wrapped winit Window. -
WindowBehavior::render
no longer returns abool
. Closing the window can be done through theRunningWindow
parameter. -
DrawableExt::scale
now accepts a parameter that can be anf32
,(f32, f32)
, orPoint<f32>
. This change allows independent scaling of the x and y axis. -
Text
has made its fields private. -
wgpu
has been updated to23.0.0
-
StrokeOptions::upx_wide
returns stroke options for a given unsigned pixel stroke width. -
LazyTexture
,CollectedTexture
,AnyTexture
,TextureCollection
, andTexture
now implementPartialEq
. -
PendingApp::on_unrecoverable_error
is a new function that allows applications to take control when an unrecoverable error occurs. Previously, these errors would panic, and the provided implementation is a panic. -
App::execute
executes a closure on the main event loop thread. -
Shape has several new functions to create textured shapes:
Shape::textured_round_rect
Shape::textured_rect
Shape::textured_circle
-
Renderer::draw
is a new function that allows attaching arbitrary drawing operations to aDrawing
. The drawing calls will be clipped to the current clipping rectangle. -
Kludgine::texture_format
andKludgine::multisample_state
are new functions that return the configuration specified when Kludgine was initialized. -
RenderingGraphics::pass()
andRenderingGraphics::pass_mut()
give access to the underlying render pass. -
Text::align
allows specifying acosmic_text::Align
setting and a width to perform the alignment within. -
TextureCollection
now automatically adds padding when multisampling is enabled to ensure that multisampling does not sample neighboring pixels of other textures in the collection. -
Drawing::draw_measured_text
now uses the correct offset when usingTextOrigin::FirstBaseline
.
- Plotters integration now strokes paths offsetting by half of the stroke width to ensure proper subpixel alignment.
- Plotters integration text drawing now honors anchor positioning, rotation, and properly sets the line height based.
MeasuredText
's metrics are now more accurate. The wrong value for the baseline was being used, leading to slightly incorrect measurements.- Drawing text now rounds the line origin and translations to the nearest whole
pixel to avoid subpixel rendering of text. While this removes a level of
fidelity that was possible, it seems like the most commonly desired behavior.
If subpixel text rendering is desired, please open an issue as this could be
something that could be re-enabled on
Text
.
App
is a new type that replaces the previous type alias pointing toappit::App
. The previously exported type wasn't able to be used beyond passing it as a parameter for opening additional windows. This new type exposes additional winit information including monitor configurations.Window::ocluded
has had its spelling fixed and is nowWindow::occluded
.Window::position
has been renamed toWindow::outer_position
Window::set_position
has been renamed toWindow::set_outer_position
.
Window
now calls winit'spre_present_notify()
before presenting the surface.WindowHandle
'sClone
implementation no longer requires its generic parameter to implementClone
.- Temporarily worked around a Wayland-only issue where window resize events are not being generated from explicit window sizing requests.
PendingApp::on_startup
executes a callback once the event loop has begun executing.Monitors
,Monitor
, andVideoMode
are new types that offer information about the monitor configurations available to the application. This information can be retrieved from anApp
orExecutingApp
.WindowBehavior::moved
is invoked when the window is repositioned.Window::outer_size
is a new function that returns the window's size including decorations.Window::inner_position
returns the position of the top-left of the content area of the window.App::prevent_shutdown()
returns a guard that prevents the application from closing automatically when the final window is closed.WindowBehavior::initialized
is invoked once the window has been fully initialized.WindowBehavior::pre_initialize
is invoked before wgpu is initialized on the window.
-
Added Zoom setting to [
Kludgine
], allowing a second scaling factor to be applied to all scaled operations. This change has affected these APIs:- [
Kludgine::resize()
]: Now takes an additional parameterzoom
. - [
Kludgine::scale()
]: Now returns an effective scale combining zoom and DPI scaling. - [
Kludgine::dpi_scale()
]: A new function returning the currently set DPI scale. - [
Kludgine::zoom()
]: A new function returning the current zoom value. - [
Kludgine::set_zoom()
]: A new function setting just the zoom value. - [
Kludgine::set_dpi_scale()
]: A new function setting just the DPI scale. - [`Graphics::set_zoom()]: A new function setting the zoom level for a graphics context.
- [
CornerRadii
now implementsfigures::Round
.
wgpu
has been updated to22.0.0
.cosmic-text
has been updated to0.12.0
.
WindowBehavior::memory_hints
is a new trait function that controls the memory hintswgpu
is initialized with. The provided implementation returnswgpu::MemoryHints::default()
.
-
Frame::render_into
no longer takes aGraphics
parameter, but instead accepts thewgpu::Queue
andwgpu::Device
parameters directly. UsingGraphics
causes lifetime issues in some rendering workflows. -
The
render
module has been renamed todrawing
to match the type it contains. The old name was a remnant from whenDrawing
used to be namedRendering
, which was incredibly confusing withRenderer
types around as well. -
This crate now supports
wgpu
0.20.0. -
This crate now supports
cosmic-text
0.11.2. -
This crate now supports
image
0.25.1. -
These
WindowBehavior
functions have had a&Self::Context
parameter added to them, ensuring each function where Kludgine is requesting information from the implementor either receives an&self
or an&Self::Context
:WindowBehavior::power_preference()
WindowBehavior::limits()
WindowBehavior::multisample_count()
-
SpriteSheet::new()
now takes an additional parameter:gutter_size
. PassingSize::ZERO
will cause the returned sprite sheet to be the same as before this change.This new parameter allows using sprite sheets that have been exported with consistent spacing between each sprite.
-
These APIs now require exclusive references to the application:
WindowBehavior::open
WindowBehavior::open_with
-
These events have been renamed to match
winit
's nomenclature:WindowBehavior::touchpad_magnify
->WindowBehavior::pinch_gesture
WindowBehavior::smart_magnify
->WindowBehavior::double_tap_gesture
- All
&Appplication
bounds now are?Sized
, enabling&dyn Application
parameters. Color
now exposes its inneru32
as public.
WindowBeahvior::pan_gesture
is a new event provided bywinit
.Kludgine::id()
returns the instance's unique id.Kludgine::REQUIRED_FEATURES
specifies the `wgpu::Features`` that Kludgine uses.Kludgine::adjust_limits()
adjustswgpu::Limits
to ensure Kludgine will function.Texture::multisampled
allows creating aTexture
that can be used as a multisample render attachment.Texture::copy[_rect]_to_buffer
are convenience helpers for copying image data to awgpu::Buffer
.Texture::wgpu()
returns a handle to the underlyingwgpu::Texture
.Texture::view()
returns awgpu::TextureView
for the entire texture.- A new feature
plotters
enables integration with the excellent plotters crate.Renderer::as_plot_area()
is a new function that returns aplotters::DrawingArea
. Kludgine::rebuild_font_system()
is a new function that recreates thecosmic_text::FontSystem
, which has the net effect of clearing font-database related caches.WindowBehavior::present_mode()
allows a window to pick a different presentation mode. The default implementation returnswgpu::PresentMode::AutoVsync
.
Drawing::render()
no longer makes any assumptions about the current clipping rectangle when drawing is started.- Color correction for Srgb is now being done more accurately using the
palette
crate. This affects colors being applied to textures as tints and shape drawing, but the Srgb handling of textures themselves remain handled purely by wgpu. - Drawing text with an empty first line no longer panics.
UnwindSafe
has been removed from the bounds ofWindowBehavior::Context
, and various types may or may no longer implmementUnwindSafe
. The underlying requirement for this has been removed fromappit
.Texture::lazy_from_data
andTexture::lazy_from_image
have been refactored into constructors of a new type:LazyTexture::from_data
/LazyTexture::from_image
.include_texture!
now returns aLazyTexture
instead of aTexture
.SharedTexture::region()
has been removed.TextureRegion::new()
is the replacement API that allows creating a region for anyShareableTexture
.Sprite::load_aseprite_json
now acceptsimpl Into<ShareableTexture>
instead of&SharedTexture
. In theory, no code will break from this change due to trait implementations.SpriteSheet::texture
is now aShareableTexture
.
-
app::PendingApp
is a type that allows opening one or more windows before running an application. -
app::App
is a handle to a running application. -
app::Window::app()
returns a handle to the application of the window. -
WindowBehavior::open[_with]()
are new functions that allow opening a window into a reference of anApp
orPendingApp
. -
CanRenderTo::can_render_to()
is a new trait that checks if a resource can be rendered in a givenKludgine
instance.This is implemented by all types in Kludgine that utilize textures.
-
LazyTexture
is a new texture type that supports being shared across different windows/wgpu rendering contexts by loading its data on-demand.LazyTexture::upgrade()
loads aSharedTexture
that is compatible with the given graphics context. -
ShareableTexture
is a texture type that can resolve to aSharedTexture
. Currently this is either aSharedTexture
or aLazyTexture
. -
RunningWindow::close
is allows closing a window.
- Internally, text drawing now uses weak references for the glyph handles to
prevent
wgpu
resources from being freed if aMeasuredText
was being held. - Each window now has its own
wgpu::Instance
instead of sharing a single instance between windows. - Each
Window
frame now waits until it's fully rendered before yielding back to the windqow loop. - When a
Window
has a 0 dimension, it will no longer try to redraw. This presented as a panic when a window was minimized. - Subpixel alignment of text rendering is no longer accounted for twice. Additionally,
TextOrigin::Center
rounds the offset calculated to the nearest whole pixel. - A workaround has been added that caused clipping on the OpenGL backend to only use the final scissor rect.
- A panic "Unsupported uniform datatype! 0x1405" has been resolved that occurred on some devices where push constants were being emulated and only signed integers were unspported.
- #66: A rounding error has been fixed when calculating the text width would cause the line width to be rounded down in some cases.
- If
wgpu
reports aSurfaceError::Lost
, thecreate_surface()
call is now correctly made on the main thread rather than the window thread. Thanks to @Plecra for reviewing the unsafe code and noticing this issue. This review also led to further reductions in the amount of unsafe code and improved the safety comments.
This version is a complete rewrite. While some code was copied across, this
library now directly depends upon wgpu
instead of using easygpu
, and it has
an API inspired by wgpu
's Encapsulating Graphics Work
article.
set_always_on_top
/with_always_on_top
/always_top
have been replaced withset_window_level
/with_window_level
/window_level
respectively. This change was due to upgrading to the latestwinit
.- The MSRV has been updated to 1.64.0 due to nested dependency requirements.
- These feature flags have been renamed:
serialization
has becomeserde
tokio-rt
has becometokio
smol-rt
has becomesmol
- Updated
easygpu
to v0.5.0.wgpu
has been updated to v0.16.0
winit
has been updated to v0.28.3palette
has been updated to v0.7.1
- Returning a scale from
Window::additional_scale
now works. CloseResponse
is now exported.
Scene::set_additional_scale
has been added to set the scaling factor between Points and Scaled. This allows application-level scaling in addition to the DPI scaling Kludgine already does.
- Updated
easygpu
to 0.4.0:wgpu
has been updated to 0.15.0.
- Updated
rusttype
to 0.9.3:ttf-parser
has been updated to 0.15.2.- Versions of rusttype are now pinned to prevent transient dependency upgrades breaking compilation.
- Updated
easygpu
to 0.3.0:wgpu
has been updated to 0.14.0.winit
has been updated to 0.27.4.
- Updated
easygpu
to 0.2.0:- Updated
wgpu
to 0.13.1 - Updated
lyon_tessellation
to 1.0.1
- Updated
- Switching off of pre-release version numbering. They just add more pain than they're worth.
- Updated dependencies to
wgpu
0.12
- Fixed incompatibility with image crate update.
- Changed dependency versions to be less lenient.
- Fixed issue where render_one_frame would freeze in headless environments (#53).
- Updated dependencies for compatability with wgpu 0.11.1.
- Implemented Sprite alpha rendering. The APIs already existed, but the alpha value was being ignored.
Sprite::current_frame
immutably retrieves the current frame. This is equivalent to callingSprite::get_frame(None)
but can be used in non-mutable settings.
- Updated
easygpu
andeasygpu-lyon
, which moves Kludgine ontowgpu
0.11.
WindowCreator
andWindowBuilder
now support initial_position.
WindowCreator
andWindowBuilder
now usePoints
as the unit forinitial_size
. When creating the window, we now request the logical size rather than pixels, correspondingly.
- Redrawing while resizing is done with more expediency. Previously, we were waiting for the OS to ask for us to redraw after resizing, rather than forcing a resize.
- Added
WindowHandle
, which allows interacting with the window after it has been built. This parameter is passed into nearly allWindow
trait functions now. WindowCreator
now takes&self
parameter for all methods. There was no reason for these methods to be static, and it prevented a window from being able to control how it was built based on its initial configuration.
- Rendering a SpriteSource using a Point without specifying a Size now renders
it at
Scaled
resolution. This restores the behavior before the parameters were switched toDisplayable
.
- Removed all user interface code, and spun off a new user interface project, Cushy.
- Split Kludgine into three crates:
kludgine-core
: The rendering aspects of Kludgine. Can now be used for headless rendering as well.kludgine-app
: The windowing/event handling layer of Kludgine.kludgine
: An omnibus crate that marries the two with one crate include.
- Now uses
figures
for its math types. If you're using functionality that was ineuclid
but is no longer available infigures
, please submit an issue. We may not add all requested functionality, but as long as it extends one of the typesfigures
already has, it likely will be added upon request. - Introduced
unstable-apis
feature flag. The plan for this flag is to offer a way to provide APIs that are still under heavy development to be used without forcing semver updates when the APIs change. After 1.0, breaking changes tounstable-apis
will be one of the factors that causes minor version increments.