Skip to content

Latest commit

 

History

History
226 lines (146 loc) · 10.5 KB

changelog.md

File metadata and controls

226 lines (146 loc) · 10.5 KB

In this file will be listed the changes, especially the breaking ones that one should be careful of when upgrading from a version of rust-sdl2 to another.

unreleased

PR #968 Pass SDL2 include directories to sdl2-sys's dependant crates through DEP_SDL2_INCLUDE.

v0.33

PR #956 + PR #960 + PR #951: Fix some build targets.

PR #948 + PR #957: Remove the num dependency.

PR #947: Upgraded the "bundled" version of SDL2 to 2.0.10

PR #940: Breaking change Removed the rand dependency for random colors. You will have to implement your own random colors from now on.

PR #933: Breaking change Removed AudioFormatNum::zero(), use AudioFormatNum::SILENCE constant instead.

PR #907: Changed the data type to i32 for the which field for the events ControllerDeviceAdded and JoyDeviceAdded.

PR #882: Ignore unknown bits in SDL_Keysym's mod field (key modifiers) when constructing Event::KeyDown and Event::KeyUp. Deprecate sdl2::event::Event::unwrap_keymod, which had been made public accidentally.

PR #898: Implements TryFrom<PixelFormatEnum> for PixelFormat

PR #962: Added raw-window-handle support for Windows, Linux (X11 and Wayland) and macOS.

v0.32.2

PR #868: Added inplace operations for rect::Point.

PR #827: Added 32-bit array pixelformats

PR #824: Added controller::set_rumble and joystick::set_rumble, wrappers for SDL_GameControllerRumble and SDL_JoystickRumble respectively.

PR #867: Added Window::opacity and Window::set_opacity, wrappers for SDL_GetWindowOpacity and SDL_SetWindowOpacity respectively. This bumps the minimum SDL2 version requirement from 2.0.4 to 2.0.5.

v0.32

PR #790: Added missing window_id field to Event::DropFile

PR #789: Audio Safety Fixes

PR #785: Vulkan Support

PR #782

  • Move ffi of features (mixer, ...) into sys
  • Updated SDL2's default version to 2.0.8

PR #780: Fixed a panic in keyboard::Mod

PR #775: Added get_platform

PR #774: add_timer is now must_use

PR #764: impl Hash for Point and Rect

PR #763: Allow -sys to build for windows-gnu target

PR #751: Breaking change gl_setswap_interval now returns a Result instead of a bool.

PR #759: Expose Joystick power level

PR #751

  • Fix memory leak in filesystem::base_path()
  • Fix memory leak on ClipboardUtil::clipboard_text()

PR #740: Implement Debug for Event

PR #737: Fix ClipboardUtil::set_clipboard_text to return an Ok when it went well.

PR #733: Add video::border_size -> Result<(u16, u16, u16, u16), String> equivalent of SDL_GetWindowBorderSize()

PR #732: Implemented From<(u8, u8, u8)> and From<(u8, u8, u8, u8)> for pixels::Color. Canvas.set_draw_color can now be called with tuples or other types which implements Into<pixels::Color>

PR #279

  • Breaking change set_video_minimize_on_focus_lost was renamed to …minimize_on_focus_loss, as it should be. As a bonus, it works now.
  • Although this is a breaking change, this function was not working in the first place, so this is hardly a true breaking change

v0.31

PR #693, PR #720

  • Adds feature "bundled" as well as "static-link". Entirely compatible wit hthe "use-bindgen" feature. Windows-gnu is not supported yet, any help is needed on that side, but every other major platform should be supported.

PR #711

  • Breaking change Change HatState::Leftdown casing into HatState::LeftDown to be consistent with naming.

PR #695

  • sdl2-sys can now be generated at compile time by bindgen (Opt-in required with "use-bindgen" feature)
  • The new sdl2-sys source code is generated by bindgen, hence almost everything that uses sdl2-sys will be broken. The fixes are small but still preset.

PR #673

  • Support Audio Capture in AudioCallbacks.

PR #684

  • Breaking change Make get_swap_interval return an enum instead of i32
  • The signature of set_swap_interval has been changed as well, but it shouldn't breaking existing code too much.

PR #683

  • Adds the unsafe_textures feature to this crate, allowing to get rid of the lifetimes in Textures in the render module.

PR #704

  • Adds the Music::from_static_bytes function, which creates a Music instance with the static lifetime from a buffer that also has a static lifetime.

PR #708

  • Makes the fields of the sdl2::mixer::Channel(i32) and sdl::mixer::Group(i32) structs public so they can be instantiated directly, and deprecates sdl2::mixer::channel(i32).

PR #714

  • Breaking change Updates the which fields of sdl2::Event::ControllerDeviceAdded and sdl2::Event::JoyDeviceAdded to be u32s so they can be used with sdl2::GameControllerSubsystem and sdl::JoystickSubsystem methods directly.
  • Breaking change Updates sdl2::HapticSubsystem::open_from_joystick_id to correctly advertise joystick_index as being a u32.
  • This should only mean removing type conversions which were previously needed to use these values, or changing incorrect assumptions in existing code.

v0.30

Re-exported sdl2_sys as sdl2::sys

PR #632

The path of soundness isn't an easy one; sometimes ease of use has to be sacrificed for soundness and safety! This change is a breaking change, and a huge one at that.

You will probably have to refactor some parts of your code, but this is the price to pay for soundness and runtime safety.

Breaking Changes:

  • Renderer has been renamed and split into Canvas and TextureCreator.
  • Canvas can store a Surface or a Window, and can be used to render into these as well. TextureCreator creates Textures and is used by Texture to make sure they don't live longer than expected.
  • set_render_target has been removed and has been replaced with Canvas::with_texture_canvas and Canvas::with_multiple_texture_canvas
  • Deleted WindowRef, it wasn't useful anymore.

Other Changes:

  • Added PixelFormatEnum::supports_alpha(&self) -> bool method.
  • A single Game Of Life example has been added to show the basic capabilities of the new Canvas and TextureCreator structs, as well as adding a very basic game to show how to handle input / game changes in a basic game.

You won't have to worry about what target your Renderer has at runtime anymore, everything is done at compile time now !

PR #628

  • Changed signature of Surface::fill_rects (old | new)
  • Changed various Option<T> parameters into Into<Option<T>> parameters. For instance, it is now possible to do this:
surface.blit(None,Rect::new(5,5,5,5)); // instead of surface.blit(None,Some(Rect::new(5,5,5,5)));

PR #639

  • Added hint-specific functions to sdl2::hint
sdl2::hint::set_video_minimize_on_focus_lost(bool) -> bool;
sdl2::hint::set_video_minimize_on_focus_lost_with_priority(bool, sdl2::hint::Hint) -> bool;
sdl2::hint::get_video_minimize_on_focus_lost() -> bool;

PR #629

  • Breaking Change: Changed Color to be a struct rather than an enum.
  • Takes less space, easier to use, old constructors are still available.
  • Matching is no longer necessary to read the component values.
  • Struct rather than variant construction is required in static initializers.
let color = Color { r: 255, g: 0, b: 0, a: 255 };
let color = Color::RGBA(255, 0, 0, 255);
let color = Color::RGB(255, 0, 0);
let (r, g, b) = color.rgb();
let (r, g, b, a) = color.rgba();

PR #651

  • VideoSystem::display_name now returns a Result<String, String> instead of a String.
  • This prevents a segfault when the requested display index is out of bounds

commit e9681a0fe

  • window.surface() has been changed and is now more intuitive to use.
  • The example in examples/no-renderer.rs shows how to use this feature.

PR #635

  • Deprecated Rect::contains, added Rect::contains_point and Rect::contains_rect. contains and contains_point are close but different ! See here