mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Minor API improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::{
|
||||
color::Color,
|
||||
fonts::TextStyle,
|
||||
math::{Rect, Vec2},
|
||||
mesher::Mesh,
|
||||
@@ -59,43 +60,6 @@ impl GuiInput {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// 0-255 sRGBA
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
pub struct Color {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
pub a: u8,
|
||||
}
|
||||
|
||||
impl Color {
|
||||
pub const WHITE: Color = srgba(255, 255, 255, 255);
|
||||
|
||||
pub fn transparent(self) -> Color {
|
||||
Color {
|
||||
r: self.r,
|
||||
g: self.g,
|
||||
b: self.b,
|
||||
a: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn srgba(r: u8, g: u8, b: u8, a: u8) -> Color {
|
||||
Color { r, g, b, a }
|
||||
}
|
||||
|
||||
pub const fn gray(l: u8, a: u8) -> Color {
|
||||
Color {
|
||||
r: l,
|
||||
g: l,
|
||||
b: l,
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Serialize)]
|
||||
pub struct InteractInfo {
|
||||
/// The mouse is hovering above this
|
||||
|
||||
Reference in New Issue
Block a user