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_sizehas been replaced withWindow::request_inner_size. This function now matches winit's underlyingrequest_inner_sizebehavior. 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_sizeandouter_sizewhen 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::resizeto apply the new size. -
Window::winitnow returns anArc-wrapped winit Window. -
WindowBehavior::renderno longer returns abool. Closing the window can be done through theRunningWindowparameter. -
DrawableExt::scalenow accepts a parameter that can be anf32,(f32, f32), orPoint<f32>. This change allows independent scaling of the x and y axis. -
Texthas made its fields private. -
wgpuhas been updated to24.0.1 -
The Minimum Supported Rust Version (MSRV) is now
1.81.0. -
Kludgine::set_wrap_strategyallows controlling the text wrapping strategy applied by Kludgine. The default strategy before this release wasWrap::WordOrGlyph, but the new default isWrap::Word.
-
StrokeOptions::upx_widereturns stroke options for a given unsigned pixel stroke width. -
LazyTexture,CollectedTexture,AnyTexture,TextureCollection, andTexturenow implementPartialEq. -
PendingApp::on_unrecoverable_erroris 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::executeexecutes a closure on the main event loop thread. -
Shape has several new functions to create textured shapes:
Shape::textured_round_rectShape::textured_rectShape::textured_circle
-
Renderer::drawis a new function that allows attaching arbitrary drawing operations to aDrawing. The drawing calls will be clipped to the current clipping rectangle. -
Kludgine::texture_formatandKludgine::multisample_stateare new functions that return the configuration specified when Kludgine was initialized. -
RenderingGraphics::pass()andRenderingGraphics::pass_mut()give access to the underlying render pass. -
Text::alignallows specifying acosmic_text::Alignsetting and a width to perform the alignment within. -
Drawing::draw_measured_textnow uses the correct offset when usingTextOrigin::FirstBaseline. -
Graphics::kludgineandGraphics::kludgine_mut()provide access to the underlyingKludgineinstance without usingDeref/DerefMut.
- 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.
Appis 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::ocludedhas had its spelling fixed and is nowWindow::occluded.Window::positionhas been renamed toWindow::outer_positionWindow::set_positionhas been renamed toWindow::set_outer_position.
Windownow calls winit'spre_present_notify()before presenting the surface.WindowHandle'sCloneimplementation 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_startupexecutes a callback once the event loop has begun executing.Monitors,Monitor, andVideoModeare new types that offer information about the monitor configurations available to the application. This information can be retrieved from anApporExecutingApp.WindowBehavior::movedis invoked when the window is repositioned.Window::outer_sizeis a new function that returns the window's size including decorations.Window::inner_positionreturns 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::initializedis invoked once the window has been fully initialized.WindowBehavior::pre_initializeis 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.
- [
CornerRadiinow implementsfigures::Round.
wgpuhas been updated to22.0.0.cosmic-texthas been updated to0.12.0.
WindowBehavior::memory_hintsis a new trait function that controls the memory hintswgpuis initialized with. The provided implementation returnswgpu::MemoryHints::default().
-
Frame::render_intono longer takes aGraphicsparameter, but instead accepts thewgpu::Queueandwgpu::Deviceparameters directly. UsingGraphicscauses lifetime issues in some rendering workflows. -
The
rendermodule has been renamed todrawingto match the type it contains. The old name was a remnant from whenDrawingused to be namedRendering, which was incredibly confusing withRenderertypes around as well. -
This crate now supports
wgpu0.20.0. -
This crate now supports
cosmic-text0.11.2. -
This crate now supports
image0.25.1. -
These
WindowBehaviorfunctions have had a&Self::Contextparameter added to them, ensuring each function where Kludgine is requesting information from the implementor either receives an&selfor an&Self::Context:WindowBehavior::power_preference()WindowBehavior::limits()WindowBehavior::multisample_count()
-
SpriteSheet::new()now takes an additional parameter:gutter_size. PassingSize::ZEROwill 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::openWindowBehavior::open_with
-
These events have been renamed to match
winit's nomenclature:WindowBehavior::touchpad_magnify->WindowBehavior::pinch_gestureWindowBehavior::smart_magnify->WindowBehavior::double_tap_gesture
- All
&Appplicationbounds now are?Sized, enabling&dyn Applicationparameters. Colornow exposes its inneru32as public.
WindowBeahvior::pan_gestureis a new event provided bywinit.Kludgine::id()returns the instance's unique id.Kludgine::REQUIRED_FEATURESspecifies the `wgpu::Features`` that Kludgine uses.Kludgine::adjust_limits()adjustswgpu::Limitsto ensure Kludgine will function.Texture::multisampledallows creating aTexturethat can be used as a multisample render attachment.Texture::copy[_rect]_to_bufferare convenience helpers for copying image data to awgpu::Buffer.Texture::wgpu()returns a handle to the underlyingwgpu::Texture.Texture::view()returns awgpu::TextureViewfor the entire texture.- A new feature
plottersenables 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
palettecrate. 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.
UnwindSafehas 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_dataandTexture::lazy_from_imagehave been refactored into constructors of a new type:LazyTexture::from_data/LazyTexture::from_image.include_texture!now returns aLazyTextureinstead of aTexture.SharedTexture::region()has been removed.TextureRegion::new()is the replacement API that allows creating a region for anyShareableTexture.Sprite::load_aseprite_jsonnow acceptsimpl Into<ShareableTexture>instead of&SharedTexture. In theory, no code will break from this change due to trait implementations.SpriteSheet::textureis now aShareableTexture.
-
app::PendingAppis a type that allows opening one or more windows before running an application. -
app::Appis 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 anApporPendingApp. -
CanRenderTo::can_render_to()is a new trait that checks if a resource can be rendered in a givenKludgineinstance.This is implemented by all types in Kludgine that utilize textures.
-
LazyTextureis a new texture type that supports being shared across different windows/wgpu rendering contexts by loading its data on-demand.LazyTexture::upgrade()loads aSharedTexturethat is compatible with the given graphics context. -
ShareableTextureis a texture type that can resolve to aSharedTexture. Currently this is either aSharedTextureor aLazyTexture. -
RunningWindow::closeis allows closing a window.
- Internally, text drawing now uses weak references for the glyph handles to
prevent
wgpuresources from being freed if aMeasuredTextwas being held. - Each window now has its own
wgpu::Instanceinstead of sharing a single instance between windows. - Each
Windowframe now waits until it's fully rendered before yielding back to the windqow loop. - When a
Windowhas 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::Centerrounds 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
wgpureports 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_tophave been replaced withset_window_level/with_window_level/window_levelrespectively. 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:
serializationhas becomeserdetokio-rthas becometokiosmol-rthas becomesmol
- Updated
easygputo v0.5.0.wgpuhas been updated to v0.16.0
winithas been updated to v0.28.3palettehas been updated to v0.7.1
- Returning a scale from
Window::additional_scalenow works. CloseResponseis now exported.
Scene::set_additional_scalehas 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
easygputo 0.4.0:wgpuhas been updated to 0.15.0.
- Updated
rusttypeto 0.9.3:ttf-parserhas been updated to 0.15.2.- Versions of rusttype are now pinned to prevent transient dependency upgrades breaking compilation.
- Updated
easygputo 0.3.0:wgpuhas been updated to 0.14.0.winithas been updated to 0.27.4.
- Updated
easygputo 0.2.0:- Updated
wgputo 0.13.1 - Updated
lyon_tessellationto 1.0.1
- Updated
- Switching off of pre-release version numbering. They just add more pain than they're worth.
- Updated dependencies to
wgpu0.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_frameimmutably retrieves the current frame. This is equivalent to callingSprite::get_frame(None)but can be used in non-mutable settings.
- Updated
easygpuandeasygpu-lyon, which moves Kludgine ontowgpu0.11.
WindowCreatorandWindowBuildernow support initial_position.
WindowCreatorandWindowBuildernow usePointsas 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 allWindowtrait functions now. WindowCreatornow takes&selfparameter 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
Scaledresolution. 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
figuresfor its math types. If you're using functionality that was ineuclidbut 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 typesfiguresalready has, it likely will be added upon request. - Introduced
unstable-apisfeature 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-apiswill be one of the factors that causes minor version increments.