From 1a0d7d8a5a9408ddb529b2624ca4011e1dfd7a1e Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Sat, 29 Apr 2017 23:47:08 -0700 Subject: [PATCH] Add changelog details for #629 --- changelog.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 1be2fb42..e83bb2c1 100644 --- a/changelog.md +++ b/changelog.md @@ -20,4 +20,19 @@ surface.blit(None,Rect::new(5,5,5,5)); // instead of surface.blit(None,Some(Rect 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; -``` \ No newline at end of file +``` + +[PR #629](https://github.com/AngryLawyer/rust-sdl2/pull/629) + +* Breaking: 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. + +```rust +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(); +```