-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/AngelOnFira/aidan-christmas…
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::cmp::min; | ||
use std::fs; | ||
|
||
use super::{Pixel, TreeCanvas}; | ||
use serde::Deserialize; | ||
use serde_json; | ||
|
||
// Name: Red Wave | ||
// Description: A basic red wave across the screen | ||
// Author: Forest Anderson | ||
|
||
pub fn draw(tick: u64) -> TreeCanvas { | ||
let mut canvas = TreeCanvas::new(); | ||
|
||
let pixel_json = include_str!("jwst.json"); | ||
|
||
let pixel_data: Vec<Pixel> = serde_json::from_str(&pixel_json).unwrap(); | ||
|
||
let mut index = 0; | ||
for y in 0..75 { | ||
for x in 0..20 { | ||
let this_pixel = pixel_data.get(index).unwrap(); | ||
canvas.set_pixel(x, y, *this_pixel); | ||
index += 1; | ||
} | ||
} | ||
|
||
canvas | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters