ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/kgsueme/game.pl
(Generate patch)

Comparing kgsueme/kgsueme/game.pl (file contents):
Revision 1.31 by pcg, Mon Jun 2 12:39:20 2003 UTC vs.
Revision 1.33 by pcg, Mon Jun 2 14:36:10 2003 UTC

142 142
143 $vbox->add ($self->{name} = new Gtk2::Label $self->{name}); 143 $vbox->add ($self->{name} = new Gtk2::Label $self->{name});
144 $vbox->add ($self->{info} = new Gtk2::Label ""); 144 $vbox->add ($self->{info} = new Gtk2::Label "");
145 $vbox->add (($self->{clock} = new game::goclock)->widget); 145 $vbox->add (($self->{clock} = new game::goclock)->widget);
146 146
147 $vbox->add ($self->{imagebox} = new Gtk2::VBox);
148
147 $self; 149 $self;
148} 150}
149 151
150sub set_rules { 152sub set_rules {
151 my ($self, $rules) = @_; 153 my ($self, $rules) = @_;
152 154
153 if ($self->{name}->get_text ne $rules->{player}[$self->{colour}]) { 155 if ($self->{name}->get_text ne $rules->{player}[$self->{colour}]) {
154 $self->{name}->set_text ($rules->{player}[$self->{colour}]); 156 $self->{name}->set_text ($rules->{player}[$self->{colour}]);
155 157
158 $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children;
159 $self->{imagebox}->add (gtk::image_from_data undef);
160 $self->{imagebox}->show_all;
161
156 # the big picture... 162 # the big picture...
157 appwin::userpic ($rules->{player}[$self->{colour}], sub { 163 appwin::userpic ($rules->{player}[$self->{colour}], sub {
164 if ($_[0]) {
165 $self->{imagebox}->remove ($_) for $self->{imagebox}->get_children;
158 $self->{widget}->add (gtk::image_from_data $_[0]) if $_[0]; 166 $self->{imagebox}->add (gtk::image_from_data $_[0]);
159 $self->{widget}->show_all; 167 $self->{imagebox}->show_all;
160 # undef => show sth. funny 168 }
161 }); 169 });
162 } 170 }
163 171
164 $self->{clock}->set_rules (@{$rules->{rules}}{qw(timesys time interval count)}); 172 $self->{clock}->set_rules (@{$rules->{rules}}{qw(timesys time interval count)});
165} 173}
734 $self->{left}->remove ($_) for $self->{left}->get_children; 742 $self->{left}->remove ($_) for $self->{left}->get_children;
735 if ($self->is_valid) { 743 if ($self->is_valid) {
736 $self->{left}->add ($self->{boardbox}); 744 $self->{left}->add ($self->{boardbox});
737 (delete $self->{challenge})->destroy if $self->{challenge}; 745 (delete $self->{challenge})->destroy if $self->{challenge};
738 } else { 746 } else {
739 $self->{left}->add ($self->{challenge}); 747 $self->{left}->add ($self->{challenge}->widget);
740 } 748 }
741 $self->{left}->show_all; 749 $self->{left}->show_all;
742} 750}
743 751
744sub destroy { 752sub destroy {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines