From a0f037c9cdca2fdd83a041cff5f46a629974a76d Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Sun, 3 Nov 2024 13:36:35 -0500 Subject: [PATCH] Fix up broken parts fo cyberpunk-splash --- cyberpunk-splash/src/main.rs | 11 ++++++----- cyberpunk/src/lib.rs | 18 +++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cyberpunk-splash/src/main.rs b/cyberpunk-splash/src/main.rs index 6fd42d9..0a7214c 100644 --- a/cyberpunk-splash/src/main.rs +++ b/cyberpunk-splash/src/main.rs @@ -2,6 +2,7 @@ use cairo::{ Context, FontSlant, FontWeight, Format, ImageSurface, LineCap, LinearGradient, Pattern, TextExtents, }; +use cyberpunk::{AsymLine, AsymLineCutout, GlowPen, Pen, SlashMeter}; use glib::Object; use gtk::{prelude::*, subclass::prelude::*, EventControllerKey}; use std::{ @@ -171,7 +172,7 @@ impl SplashPrivate { start_y: extents.height() + 10., start_length: 0., height: extents.height() / 2., - total_length: extents.width() + extents.height() / 2., + end_length: 0., invert: false, } .draw(&pen); @@ -183,7 +184,7 @@ impl SplashPrivate { start_y: extents.height() + 60., start_length: extents.width(), height: extents.height() / 2., - total_length: extents.width() + extents.height() / 2., + end_length: 0., invert: false, } .draw(&pen); @@ -208,7 +209,7 @@ impl SplashPrivate { start_x: 20., start_y: center_y - 20. - title_height / 2., start_length, - total_length: *self.width.borrow() as f64 - 120., + end_length: *self.width.borrow() as f64 - 120. - start_length, cutout_length: title_width, height: title_height, invert: false, @@ -243,7 +244,7 @@ impl SplashPrivate { start_y: *self.height.borrow() as f64 / 2. + 100., start_length: 400., height: 50., - total_length: 650., + end_length: 0., invert: true, } .draw(&pen); @@ -258,7 +259,7 @@ impl SplashPrivate { start_y: *self.height.borrow() as f64 / 2. + 200., start_length: 600., height: 50., - total_length: 650., + end_length: 0., invert: false, } .draw(&pen); diff --git a/cyberpunk/src/lib.rs b/cyberpunk/src/lib.rs index db04dea..6697e49 100644 --- a/cyberpunk/src/lib.rs +++ b/cyberpunk/src/lib.rs @@ -134,18 +134,18 @@ impl AsymLine { } } -struct SlashMeter { - orientation: gtk::Orientation, - start_x: f64, - start_y: f64, - count: u8, - fill_count: u8, - height: f64, - length: f64, +pub struct SlashMeter { + pub orientation: gtk::Orientation, + pub start_x: f64, + pub start_y: f64, + pub count: u8, + pub fill_count: u8, + pub height: f64, + pub length: f64, } impl SlashMeter { - fn draw(&self, context: &Context) { + pub fn draw(&self, context: &Context) { match self.orientation { gtk::Orientation::Horizontal => { let angle: f64 = 0.8;