| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wx::App::Mastermind::Board::Peg; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2502
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
445
|
use Wx qw(wxSOLID wxTRANSPARENT_BRUSH wxBLACK_PEN); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %colors = |
|
9
|
|
|
|
|
|
|
( K => Wx::Colour->new( 0x00, 0x00, 0x00 ), |
|
10
|
|
|
|
|
|
|
B => Wx::Colour->new( 0x00, 0x00, 0xff ), |
|
11
|
|
|
|
|
|
|
G => Wx::Colour->new( 0x00, 0xff, 0x00 ), |
|
12
|
|
|
|
|
|
|
R => Wx::Colour->new( 0xff, 0x00, 0x00 ), |
|
13
|
|
|
|
|
|
|
Y => Wx::Colour->new( 0xff, 0xff, 0x00 ), |
|
14
|
|
|
|
|
|
|
W => Wx::Colour->new( 0xff, 0xff, 0xff ), |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub draw { |
|
18
|
|
|
|
|
|
|
my( $self, $dc, $x, $y, $width, $height, $peg, $selected ) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$dc->SetPen( wxBLACK_PEN ); |
|
21
|
|
|
|
|
|
|
if( $peg eq ' ' ) { |
|
22
|
|
|
|
|
|
|
$dc->SetBrush( wxTRANSPARENT_BRUSH ); |
|
23
|
|
|
|
|
|
|
$dc->DrawRectangle( $x, $y, $width, $height ); |
|
24
|
|
|
|
|
|
|
} else { |
|
25
|
|
|
|
|
|
|
$dc->SetBrush( Wx::Brush->new( $colors{$peg}, wxSOLID ) ); |
|
26
|
|
|
|
|
|
|
$dc->DrawRectangle( $x, $y, $width, $height ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
if( $selected ) { |
|
30
|
|
|
|
|
|
|
$dc->SetBrush( wxTRANSPARENT_BRUSH ); |
|
31
|
|
|
|
|
|
|
$dc->DrawRectangle( $x - 2, $y - 2, $width + 4, $height + 4 ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |