From 9ab7c47dc7d834ee73bc068f9f34eea4d6946436 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 31 Dec 2019 21:35:42 +0100 Subject: Add `border_width` and `border_color` to `Quad` --- core/src/color.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/src') diff --git a/core/src/color.rs b/core/src/color.rs index c28e784f..d72651d9 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -25,6 +25,14 @@ impl Color { a: 1.0, }; + /// A color with no opacity. + pub const TRANSPARENT: Color = Color { + r: 0.0, + g: 0.0, + b: 0.0, + a: 0.0, + }; + /// Creates a [`Color`] from its RGB8 components. /// /// [`Color`]: struct.Color.html -- cgit From 1a0effa961344677daf17b4192243423a154f1bf Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 5 Jan 2020 19:29:12 +0100 Subject: Add border and shadow styling to `Button` --- core/src/vector.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src') diff --git a/core/src/vector.rs b/core/src/vector.rs index 7d87343a..1c09ee3e 100644 --- a/core/src/vector.rs +++ b/core/src/vector.rs @@ -31,3 +31,15 @@ where Self::new(self.x + b.x, self.y + b.y) } } + +impl Default for Vector +where + T: Default, +{ + fn default() -> Self { + Self { + x: T::default(), + y: T::default(), + } + } +} -- cgit From 2bbd395d5dcdf9c92ffb354b8b05444478e4b344 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 6 Jan 2020 18:44:45 +0100 Subject: Draft `styling` example --- core/src/vector.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/src') diff --git a/core/src/vector.rs b/core/src/vector.rs index 1c09ee3e..75c77dbd 100644 --- a/core/src/vector.rs +++ b/core/src/vector.rs @@ -32,6 +32,17 @@ where } } +impl std::ops::Mul for Vector +where + T: std::ops::Mul, +{ + type Output = Self; + + fn mul(self, b: Self) -> Self { + Self::new(self.x * b.x, self.y * b.y) + } +} + impl Default for Vector where T: Default, -- cgit From fce89d0ffe36111cdbf42480c28e67811afb42e6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jan 2020 01:17:32 +0100 Subject: Use constants for colors in `styling` example --- core/src/color.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/src') diff --git a/core/src/color.rs b/core/src/color.rs index d72651d9..d6bdd365 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -33,6 +33,13 @@ impl Color { a: 0.0, }; + /// Creates a [`Color`] from its RGB components. + /// + /// [`Color`]: struct.Color.html + pub const fn from_rgb(r: f32, g: f32, b: f32) -> Color { + Color { r, g, b, a: 1.0 } + } + /// Creates a [`Color`] from its RGB8 components. /// /// [`Color`]: struct.Color.html @@ -45,13 +52,6 @@ impl Color { } } - /// Creates a [`Color`] from its RGB components. - /// - /// [`Color`]: struct.Color.html - pub fn from_rgb(r: f32, g: f32, b: f32) -> Color { - Color { r, g, b, a: 1.0 } - } - /// Converts the [`Color`] into its linear values. /// /// [`Color`]: struct.Color.html -- cgit From f7a8b6983c2af491803bf84f341d8069045ffb5e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jan 2020 04:56:32 +0100 Subject: Remove `Mul` implementation for `Vector` --- core/src/vector.rs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'core/src') diff --git a/core/src/vector.rs b/core/src/vector.rs index 75c77dbd..1c09ee3e 100644 --- a/core/src/vector.rs +++ b/core/src/vector.rs @@ -32,17 +32,6 @@ where } } -impl std::ops::Mul for Vector -where - T: std::ops::Mul, -{ - type Output = Self; - - fn mul(self, b: Self) -> Self { - Self::new(self.x * b.x, self.y * b.y) - } -} - impl Default for Vector where T: Default, -- cgit