… | |
… | |
23 | while (my ($k, $v) = each %PLAYERINFO) { |
23 | while (my ($k, $v) = each %PLAYERINFO) { |
24 | my $label = (delete $old->{$k}) || do { |
24 | my $label = (delete $old->{$k}) || do { |
25 | my $label = $ws->new (Label => |
25 | my $label = $ws->new (Label => |
26 | text => $k, |
26 | text => $k, |
27 | fontsize => 0.2, |
27 | fontsize => 0.2, |
|
|
28 | ); |
|
|
29 | |
|
|
30 | my $marker = cf::face::find "res/map-arrow.png"; |
|
|
31 | $ws->{ns}->send_face ($marker); |
|
|
32 | $ws->{ns}->flush_fx; |
|
|
33 | $marker = $ws->new (Face => |
|
|
34 | size_w => undef, |
|
|
35 | size_h => undef, |
|
|
36 | face => $marker, |
|
|
37 | ); |
|
|
38 | my $children = [$label, $marker]; |
|
|
39 | |
|
|
40 | $ws->{canvas}->add (my $vbox = $ws->new (VBox => |
|
|
41 | children => $children, |
28 | c_halign => -.5, |
42 | c_halign => -.5, |
29 | c_valign => -1, |
43 | c_valign => -1, |
30 | ); |
44 | )); |
31 | $ws->{canvas}->add ($label); |
45 | $vbox->{children} = $children; |
|
|
46 | |
32 | $label |
47 | $vbox |
33 | }; |
48 | }; |
34 | |
49 | |
35 | $new->{$k} = $label; |
50 | $new->{$k} = $label; |
36 | |
51 | |
37 | if ($v != $label->{prevpos}) { |
52 | if ($v != $label->{prevpos}) { |
… | |
… | |
41 | if $k eq $name; |
56 | if $k eq $name; |
42 | } |
57 | } |
43 | } |
58 | } |
44 | |
59 | |
45 | $ws->{labels} = $new; |
60 | $ws->{labels} = $new; |
46 | |
|
|
47 | #$_->destroy for values %$old;#d# |
|
|
48 | } |
61 | } |
49 | |
62 | |
50 | sub create_widgets { |
63 | sub create_widgets { |
51 | my ($ns) = @_; |
64 | my ($ns) = @_; |
52 | |
65 | |
… | |
… | |
60 | x => "center", |
73 | x => "center", |
61 | y => "center", |
74 | y => "center", |
62 | has_close_button => 1, |
75 | has_close_button => 1, |
63 | on_delete => sub { shift->hide }, |
76 | on_delete => sub { shift->hide }, |
64 | on_visibility_change => sub { |
77 | on_visibility_change => sub { |
|
|
78 | warn "VCHANGE <@_>\n";#d# |
65 | $_[0]{visibility} = $_[1]; |
79 | $_[0]{visibility} = $_[1]; |
66 | update_worldmap $_[0]{ws} if $_[1]; |
80 | update_worldmap $_[0]{ws} if $_[1]; |
67 | }, |
81 | }, |
68 | ); |
82 | ); |
69 | |
83 | |