quine shader cleanup and shorten to 100x200, 19484B
This commit is contained in:
parent
38ae53e9d8
commit
33e97fc07b
4 changed files with 257 additions and 129 deletions
File diff suppressed because one or more lines are too long
|
@ -41,17 +41,17 @@ fn main() {
|
|||
encoded_text.push(temp);
|
||||
}
|
||||
let mut out_string = String::new();
|
||||
out_string += "\t\t\t\tconst uint text[] = {";
|
||||
out_string += "\t\tconst uint text[] = {";
|
||||
for t in &encoded_text {
|
||||
out_string += &format!("{t:#010x},");
|
||||
}
|
||||
out_string += "};\n";
|
||||
out_string += &format!("\t\t\t\tconst uint text_len = {};\n", encoded_text.len());
|
||||
out_string += &format!("\t\t\t\tconst uint blob_start = {blob_start};\n");
|
||||
out_string += &format!("\t\tconst uint text_len = {};\n", encoded_text.len());
|
||||
out_string += &format!("\t\tconst uint blob_start = {blob_start};\n");
|
||||
|
||||
// font
|
||||
let img = ImageReader::open("vgafont.png").unwrap().decode().unwrap();
|
||||
let mut out = Vec::new();
|
||||
let mut encoded_font = Vec::new();
|
||||
for &c in FULL_CHARSET {
|
||||
let col = c as u32 & 0b1_1111;
|
||||
let row = (c as u32 >> 5) & 0b111;
|
||||
|
@ -67,16 +67,14 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
out.push(encoded);
|
||||
encoded_font.push(encoded);
|
||||
}
|
||||
|
||||
out_string += "\n\t\t\t\tconst uint font_a[48][4] = {";
|
||||
for (i, c) in out.iter().enumerate() {
|
||||
if i == 48 {
|
||||
out_string += &format!("}};\n\t\t\t\tconst uint font_b[{}][4] = {{", out.len() - 48);
|
||||
}
|
||||
out_string += &format!("\n\t\tconst uint font[{}][4] = {{", encoded_font.len());
|
||||
for c in encoded_font {
|
||||
out_string += &format!("{{{},{},{},{}}},", c[0], c[1], c[2], c[3]);
|
||||
}
|
||||
out_string.pop();
|
||||
out_string += "};\n";
|
||||
let mut file = File::create("out.h").unwrap();
|
||||
file.write_all(out_string.as_bytes()).unwrap();
|
||||
|
@ -132,7 +130,7 @@ fn golfed() {
|
|||
|
||||
// font
|
||||
let img = ImageReader::open("6x6.png").unwrap().decode().unwrap();
|
||||
let mut out = Vec::new();
|
||||
let mut encoded_font = Vec::new();
|
||||
for c in used_charset {
|
||||
let col = c as u32 & 0b1_1111;
|
||||
let row = (c as u32 >> 5) & 0b111;
|
||||
|
@ -146,11 +144,11 @@ fn golfed() {
|
|||
encoded |= pixel << offset;
|
||||
}
|
||||
}
|
||||
out.push(encoded);
|
||||
encoded_font.push(encoded);
|
||||
}
|
||||
|
||||
out_string += "const uint R[]={";
|
||||
for (_i, c) in out.iter().enumerate() {
|
||||
for c in encoded_font {
|
||||
out_string += &format!("{c},");
|
||||
}
|
||||
out_string.pop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue