From 8f43d38e385451f2556a30d2ea1bd16d9abc4f9e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 17 May 2020 17:44:29 +0200 Subject: [PATCH] Style/visuals tweaks --- emigui/src/mesher.rs | 2 +- emigui/src/style.rs | 37 +++---------------------------------- example_glium/src/main.rs | 6 +++--- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/emigui/src/mesher.rs b/emigui/src/mesher.rs index f82d78a1..e7b70a70 100644 --- a/emigui/src/mesher.rs +++ b/emigui/src/mesher.rs @@ -159,7 +159,7 @@ impl Path { } pub fn add_circle(&mut self, center: Pos2, radius: f32) { - let n = (radius * 2.0).round() as i32; // TODO: tweak a bit more + let n = (radius * 4.0).round() as i32; // TODO: tweak a bit more let n = clamp(n, 4..=64); for i in 0..n { let angle = remap(i as f32, 0.0..=n as f32, 0.0..=TAU); diff --git a/emigui/src/style.rs b/emigui/src/style.rs index b85593c2..4f94cc1a 100644 --- a/emigui/src/style.rs +++ b/emigui/src/style.rs @@ -100,17 +100,17 @@ impl Default for Interact { fn default() -> Self { Self { active: WidgetStyle { - bg_fill_color: None, + bg_fill_color: Some(gray(0, 128)), fill_color: srgba(120, 120, 200, 255), stroke_color: WHITE, stroke_width: 2.0, - rect_outline: Some(Outline::new(1.0, WHITE)), + rect_outline: Some(Outline::new(2.0, WHITE)), corner_radius: 5.0, }, hovered: WidgetStyle { bg_fill_color: None, fill_color: srgba(100, 100, 150, 255), - stroke_color: WHITE, + stroke_color: gray(240, 255), stroke_width: 1.5, rect_outline: Some(Outline::new(1.0, WHITE)), corner_radius: 5.0, @@ -127,37 +127,6 @@ impl Default for Interact { } } -impl Interact { - pub fn classic() -> Self { - Self { - active: WidgetStyle { - bg_fill_color: Some(srgba(120, 120, 200, 255)), - fill_color: srgba(120, 120, 200, 255), - stroke_color: WHITE, - stroke_width: 2.0, - rect_outline: Some(Outline::new(2.0, WHITE)), - corner_radius: 5.0, - }, - hovered: WidgetStyle { - bg_fill_color: Some(srgba(100, 100, 150, 255)), - fill_color: srgba(100, 100, 150, 255), - stroke_color: WHITE, - stroke_width: 1.5, - rect_outline: None, - corner_radius: 5.0, - }, - inactive: WidgetStyle { - bg_fill_color: Some(srgba(60, 60, 80, 255)), - fill_color: srgba(60, 60, 80, 255), - stroke_color: gray(220, 255), // Mustn't look grayed out! - stroke_width: 1.0, - rect_outline: None, - corner_radius: 0.0, - }, - } - } -} - impl Interact { pub fn style(&self, interact: &InteractInfo) -> &WidgetStyle { if interact.active { diff --git a/example_glium/src/main.rs b/example_glium/src/main.rs index 8f0f87bf..064d1a1c 100644 --- a/example_glium/src/main.rs +++ b/example_glium/src/main.rs @@ -88,10 +88,10 @@ fn main() { while running { { - // Keep smooth frame rate. TODO: proper vsync + // Keep smooth frame rate because vsync doesn't work on mac let frame_duration = frame_start.elapsed(); - if frame_duration < Duration::from_millis(33) { - std::thread::sleep(Duration::from_millis(33) - frame_duration); + if frame_duration < Duration::from_millis(16) { + std::thread::sleep(Duration::from_millis(16) - frame_duration); } frame_start = Instant::now(); }