Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- my $string = "unsigned char pixels[] = {";
- my %facecolors = (
- a => "255, 0, 0",
- b => "0, 0, 255",
- c => "0, 255, 0",
- d => "255, 0, 255",
- e => "0, 255, 255",
- f => "255, 255, 0"
- );
- foreach my $color (sort keys %facecolors) {
- if (!($facecolors{$color} eq "255, 255, 0")) {
- for (my $i = 0; $i < 64; $i++) {
- if ($i % 3 == 0) {
- $string .= "\n\t";
- }
- $string .= qq[$facecolors{$color}, ];
- }
- $string .= "\n";
- } else {
- for (my $i = 0; $i < 63; $i++) {
- if ($i % 3 == 0) {
- $string .= "\n\t";
- }
- $string .= qq[$facecolors{$color}, ];
- }
- $string .= qq[\n\t$facecolors{$color}\n];
- }
- }
- $string .= "};\n";
- print $string;
Add Comment
Please, Sign In to add comment