… | |
… | |
189 | $main->{status}->pop($context_id{$type}) if $context_id{$type}; |
189 | $main->{status}->pop($context_id{$type}) if $context_id{$type}; |
190 | $main->{status}->push($context_id{$type} ||= $main->{status}->get_context_id($type), $text) if $text; |
190 | $main->{status}->push($context_id{$type} ||= $main->{status}->get_context_id($type), $text) if $text; |
191 | } |
191 | } |
192 | } |
192 | } |
193 | |
193 | |
194 | if (0) { |
194 | if (1) { |
195 | use KGS::Constants; |
195 | use KGS::Constants; |
196 | |
196 | |
197 | for (19) { |
197 | for (19) { |
198 | my $board = new game %{Storable::retrieve "testboard.storable"}; |
198 | my $board = new game %{Storable::retrieve "testboard.storable"}; |
199 | |
199 | |
… | |
… | |
795 | $x += $w + $spacing; |
795 | $x += $w + $spacing; |
796 | } |
796 | } |
797 | } |
797 | } |
798 | } |
798 | } |
799 | |
799 | |
800 | my $black_pb; |
|
|
801 | |
|
|
802 | sub pixbuf_rect { |
800 | sub pixbuf_rect { |
803 | my ($pb, $x1, $y1, $x2, $y2) = @_; |
801 | my ($pb, $colour, $x1, $y1, $x2, $y2, $alpha) = @_; |
804 | # we fake lines by... an unspeakable method :/ |
802 | # we fake lines by... an unspeakable method :/ |
805 | unless ($black_pb) { |
|
|
806 | $black_pb = new_pixbuf 1, 1, 0, 0; |
803 | my $colour_pb = new_pixbuf 1, 1, 0, 0; |
807 | $black_pb->put_pixels ("\x44\x11\x11", 0, 0); |
804 | $colour_pb->put_pixels ($colour, 0, 0); |
808 | } |
|
|
809 | |
805 | |
810 | $black_pb->composite ($pb, $x1, $y1, $x2 - $x1 + 1, $y2 - $y1 + 1, $x1, $y1, 1, 1, INTERP_NEAREST, 192); |
806 | $colour_pb->composite ($pb, $x1, $y1, $x2 - $x1 + 1, $y2 - $y1 + 1, $x1, $y1, 1, 1, INTERP_NEAREST, $alpha); |
811 | } |
807 | } |
812 | |
808 | |
813 | sub repaint_board { |
809 | sub repaint_board { |
814 | my ($self) = @_; |
810 | my ($self) = @_; |
815 | my $canvas = $self->{canvas}; |
811 | my $canvas = $self->{canvas}; |
… | |
… | |
855 | $pixbuf = scale_pixbuf $::board_img, $s, $s, $::config->{speed} ? INTERP_NEAREST : INTERP_TILES; |
851 | $pixbuf = scale_pixbuf $::board_img, $s, $s, $::config->{speed} ? INTERP_NEAREST : INTERP_TILES; |
856 | } |
852 | } |
857 | |
853 | |
858 | my $linew = int ($s / 25 / $size); |
854 | my $linew = int ($s / 25 / $size); |
859 | |
855 | |
|
|
856 | # ornamental border... we have time to waste :/ |
|
|
857 | pixbuf_rect $pixbuf, "\xff\xcc\x77", 0, 0, $s-1, $linew, 255; |
|
|
858 | pixbuf_rect $pixbuf, "\xff\xcc\x77", 0, 0, $linew, $s-1, 255; |
|
|
859 | pixbuf_rect $pixbuf, "\xff\xcc\x77", $s-$linew-1, 0, $s-1, $s-1, 255; |
|
|
860 | pixbuf_rect $pixbuf, "\xff\xcc\x77", 0, $s-$linew-1, $s-1, $s-1, 255; |
|
|
861 | |
860 | for my $i (1 .. $size) { |
862 | for my $i (1 .. $size) { |
861 | pixbuf_rect $pixbuf, $k[$i] - $linew, $k[1] - $linew, $k[$i] + $linew, $k[$size] + $linew; |
863 | pixbuf_rect $pixbuf, "\x44\x11\x11", $k[$i] - $linew, $k[1] - $linew, $k[$i] + $linew, $k[$size] + $linew, 192; |
862 | pixbuf_rect $pixbuf, $k[1] - $linew, $k[$i] - $linew, $k[$size] + $linew, $k[$i] + $linew; |
864 | pixbuf_rect $pixbuf, "\x44\x11\x11", $k[1] - $linew, $k[$i] - $linew, $k[$size] + $linew, $k[$i] + $linew, 192; |
863 | |
865 | |
864 | # 38 max, but we allow a bit more |
866 | # 38 max, but we allow a bit more |
865 | my $label = (qw(- A B C D E F G H J K L M N O P Q R S T U V W X Y Z |
867 | my $label = (qw(- A B C D E F G H J K L M N O P Q R S T U V W X Y Z |
866 | AA BB CC DD EE FF GG HH JJ KK LL MM NN OO PP QQ RR SS TT UU VV WW XX YY ZZ))[$i]; |
868 | AA BB CC DD EE FF GG HH JJ KK LL MM NN OO PP QQ RR SS TT UU VV WW XX YY ZZ))[$i]; |
867 | |
869 | |