Style/visuals tweaks
This commit is contained in:
parent
d123d7e9c6
commit
8f43d38e38
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue