golf more, down to 5623 chars, 75x75 grid
This commit is contained in:
parent
5b59f487e6
commit
549803f84c
5 changed files with 31 additions and 35 deletions
File diff suppressed because one or more lines are too long
BIN
text_shader/6x6.png
Normal file
BIN
text_shader/6x6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -92,7 +92,7 @@ fn golfed() {
|
|||
let mut blob_start = 0;
|
||||
let mut used_charset:Vec<_> = " 0123456789abcdefx,".chars().collect();
|
||||
for (index, char) in source_text.chars().enumerate() {
|
||||
if char == '?' {
|
||||
if char == '*' && blob_start==0 {
|
||||
blob_start = index;
|
||||
}
|
||||
temp <<= 8;
|
||||
|
@ -130,24 +130,24 @@ fn golfed() {
|
|||
for c in used_charset {
|
||||
let col = c as u32 & 0b1_1111;
|
||||
let row = (c as u32 >> 5) & 0b111;
|
||||
let mut encoded: [u32; 4] = [0; 4];
|
||||
for section in 0..4 {
|
||||
for y in 0..4 {
|
||||
for x in 0..8 {
|
||||
let px = col * 9 + x;
|
||||
let py = row * 16 + (16 - 1 - section * 4) - y;
|
||||
let pixel = (img.get_pixel(px, py).0[0] != 0) as u32;
|
||||
let offset = x + ((y & 3) << 3);
|
||||
encoded[section as usize] |= pixel << offset;
|
||||
}
|
||||
let mut encoded=0u32;
|
||||
for y in 0..6 {
|
||||
for x in 0..5 {
|
||||
let px = col * 6 + x;
|
||||
let py = row * 6 + 5 - y;
|
||||
let pixel = (img.get_pixel(px, py).0[0] >40) as u32;
|
||||
let offset = x + y * 5;
|
||||
// if offset < 32{
|
||||
encoded |= pixel << offset;
|
||||
// }
|
||||
}
|
||||
}
|
||||
out.push(encoded);
|
||||
}
|
||||
|
||||
out_string += "w A[][4]={";
|
||||
out_string += "w F[]={";
|
||||
for (_i, c) in out.iter().enumerate() {
|
||||
out_string += &format!("{{{},{},{},{}}},", c[0], c[1], c[2], c[3]);
|
||||
out_string += &format!("{c},");
|
||||
}
|
||||
out_string += "};\n";
|
||||
let mut file = File::create("out_golfed.h").unwrap();
|
||||
|
|
Loading…
Reference in a new issue