ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.49 by root, Sat Jun 3 22:50:48 2006 UTC vs.
Revision 1.51 by root, Thu Jun 8 01:51:32 2006 UTC

14 14
15 my $self = $class->SUPER::new ( 15 my $self = $class->SUPER::new (
16 z => -1, 16 z => -1,
17 can_focus => 1, 17 can_focus => 1,
18 list => glGenList, 18 list => glGenList,
19
20 smooth_matrix => [
21 0.05, 0.13, 0.05,
22 0.13, 0.30, 0.13,
23 0.05, 0.13, 0.05,
24 ],
25
19 @_ 26 @_
20 ); 27 );
21 28
22 $self->{completer} = new CFClient::MapWidget::Command:: 29 $self->{completer} = new CFClient::MapWidget::Command::
23 command => $self->{command}, 30 command => $self->{command},
57 my ($self, $ev, $x, $y) = @_; 64 my ($self, $ev, $x, $y) = @_;
58 65
59 $self->focus_in; 66 $self->focus_in;
60 67
61 if ($ev->{button} == 1) { 68 if ($ev->{button} == 1) {
62 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 69 my $sw = int $::WIDTH / (32 * $::CFG->{map_scale}) + 0.99;
70 my $sh = int $::HEIGHT / (32 * $::CFG->{map_scale}) + 0.99;
63 71
64 my $fx = int ((($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale})) + 0.99); 72 my $fx = int +($ev->{x} - $::CFG->{map_shift_x}) / (32 * $::CFG->{map_scale}) - 0.5 * $sw + 0.99;
65 my $fy = int ((($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale})) + 0.99); 73 my $fy = int +($ev->{y} - $::CFG->{map_shift_y}) / (32 * $::CFG->{map_scale}) - 0.5 * $sh + 0.99;
66 $fx += $::MAP->x;
67 $fy += $::MAP->y;
68 74
69 $::CONN->send (sprintf "lookat %d %d", $fx, $fy); 75 $::CONN->send (sprintf "lookat %d %d", $fx, $fy);
70 76
71 warn "FOOX: $fx (".$::MAP->ox.")\n";
72 warn "FOOY: $fy (".$::MAP->oy.")\n";
73 } elsif ($ev->{button} == 2) { 77 } elsif ($ev->{button} == 2) {
74 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 78 my ($ox, $oy) = ($ev->{x}, $ev->{y});
75 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y}); 79 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y});
76 80
77 $self->{motion} = sub { 81 $self->{motion} = sub {
255 glConvolutionFilter2D ( 259 glConvolutionFilter2D (
256 GL_CONVOLUTION_2D, 260 GL_CONVOLUTION_2D,
257 GL_ALPHA, 261 GL_ALPHA,
258 3, 3, 262 3, 3,
259 GL_ALPHA, GL_FLOAT, 263 GL_ALPHA, GL_FLOAT,
260 pack "f*", 264 (pack "f*", @{ $self->{smooth_matrix} }),
261 0.05, 0.13, 0.05,
262 0.13, 0.30, 0.13,
263 0.05, 0.13, 0.05,
264 ); 265 );
265 glEnable GL_CONVOLUTION_2D; 266 glEnable GL_CONVOLUTION_2D;
266 } 267 }
267 268
268 $self->{fow_texture_name} ||= glGenTexture; 269 $self->{fow_texture_name} ||= glGenTexture;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines