diff options
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 89 |
1 files changed, 86 insertions, 3 deletions
diff --git a/src/render.rs b/src/render.rs index daf3658..d37545a 100644 --- a/src/render.rs +++ b/src/render.rs @@ -31,7 +31,9 @@ pub const START_BOUNCE: f64 = 0.5; pub const START_SIN: f64 = 12.0; pub const START_COMETOCOSIN: f64 = 18.0; #[cfg(not(feature = "32k"))] -pub const SCENE_GREETINGS: f64 = 30.0; +pub const SCENE_MOAR: f64 = 30.0; +#[cfg(not(feature = "32k"))] +pub const SCENE_GREETINGS: f64 = SCENE_MOAR + 33.0; #[cfg(not(feature = "32k"))] pub const JUST_DVD: f64 = SCENE_GREETINGS + 28.0; @@ -52,13 +54,17 @@ pub fn render( colourthing as u8 }; + #[cfg(not(feature = "logical"))] let win_size = canvas.window().drawable_size(); + #[cfg(feature = "logical")] + let win_size = canvas.logical_size(); canvas.set_draw_color(Color::RGB(12, 12, 12)); canvas.clear(); #[cfg(not(feature = "32k"))] - let is_dvd = time_seconds < SCENE_GREETINGS || time_seconds >= JUST_DVD; + let is_dvd = + (time_seconds < SCENE_GREETINGS && time_seconds < SCENE_MOAR) || time_seconds >= JUST_DVD; #[cfg(feature = "32k")] let is_dvd = true; @@ -122,11 +128,88 @@ pub fn render( #[cfg(feature = "32k")] let no_other_rendering = false; #[cfg(not(feature = "32k"))] + let is_moar_scene = time_seconds >= SCENE_MOAR && time_seconds < SCENE_GREETINGS; + #[cfg(feature = "32k")] + let is_moar_scene = false; + #[cfg(not(feature = "32k"))] let is_greetings_scene = time_seconds >= SCENE_GREETINGS; #[cfg(feature = "32k")] let is_greetings_scene = false; if no_other_rendering { // + } else if is_moar_scene { + #[cfg(not(feature = "32k"))] + { + let time_seconds = time_seconds - SCENE_MOAR; + // Greetings + let greeting_header_duration = 2.0; + { + let mut rng = rand::thread_rng(); + + let mut i = 0.0; + let strlen = 19; + let mut uwuoffset_x = 0.0; + for c in "Have some scrollers".chars() { + let char: crate::font::RenderableCharacter = FONT_GALMURI.get_char(c); + canvas + .copy( + &char + .to_texture( + texture_creator, + Color::RGB(colourthing, 64, 255 - colourthing), + ) + .unwrap(), + None, + char.to_rect( + uwuoffset_x as i32 + 18 + rng.gen_range(-2..2), + (24) + rng.gen_range(-3..3), + ), + ) + .unwrap(); + uwuoffset_x += char.advance_width; + i += 1.0; + if i > (time_seconds * (f64::from(strlen) / greeting_header_duration)).floor() { + break; + } + } + let mut offset_y = 36; + for line in [ + "Pls come to CoSin 2025 Credits", + " May 29th - June 1st 2025 UwU :3 ceemos", + " Villa Ritter 30CHF, paid on-site memdmp", + " Biel/Bienne https://cosin.ch fence", + " Switzerland /dev/urandom", + "", + "", + "", + " Matrix: #cosin:fairydust.space Mastodon: @CoSin@mastodon.social" + ] { + offset_y += 24; + let mut offset_x: f64 = f64::from(win_size.0) + - ((time_seconds - greeting_header_duration) * (f64::from(win_size.0) * 0.078125)); + + for c in line.chars() { + let char = FONT_GALMURI.get_char(c); + canvas + .copy( + &char + .to_texture( + texture_creator, + Color::RGB(colourthing, 64, 255 - colourthing), + ) + .unwrap(), + None, + char.to_rect( + offset_x as i32 + rng.gen_range(-2..2), + offset_y + rng.gen_range(-2..2), + ), + ) + .unwrap(); + offset_x += char.advance_width; + } + } + } + } } else if is_greetings_scene { #[cfg(not(feature = "32k"))] { @@ -317,7 +400,7 @@ pub fn render( f[idx + 3] = if out_of_frame { 0 } else if sin_y < y as usize { - let v: u16 = if idx % 5 == 0 { 255 } else { 122 }; + let v: u16 = if idx % 7 == 0 { 255 } else { 122 }; let v = if (sin_y + 3) < (y as usize) { v } else { |