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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.15 by elmex, Fri Apr 7 23:05:21 2006 UTC vs.
Revision 1.16 by root, Fri Apr 7 23:16:29 2006 UTC

327 327
328use strict; 328use strict;
329 329
330our @ISA = qw/Crossfire::Client::Widget/; 330our @ISA = qw/Crossfire::Client::Widget/;
331 331
332use SDL;
332use SDL::OpenGL; 333use SDL::OpenGL;
333use SDL::OpenGL::Constants; 334use SDL::OpenGL::Constants;
334 335
335sub key_down { 336sub key_down {
336 print "MAPKEYDOWN\n"; 337 print "MAPKEYDOWN\n";
372 373
373 glDisable GL_TEXTURE_2D; 374 glDisable GL_TEXTURE_2D;
374 glDisable GL_BLEND; 375 glDisable GL_BLEND;
375} 376}
376 377
378my %DIR = (
379 SDLK_KP8, [1, "north"],
380 SDLK_KP9, [2, "northest"],
381 SDLK_KP6, [3, "east"],
382 SDLK_KP3, [4, "southeast"],
383 SDLK_KP2, [5, "south"],
384 SDLK_KP1, [6, "southwest"],
385 SDLK_KP4, [7, "west"],
386 SDLK_KP7, [8, "northwest"],
387);
388
389sub key_down {
390 my ($self, $ev) = @_;
391
392 my $mod = $ev->key_mod;
393 my $sym = $ev->key_sym;
394
395 if ($sym == SDLK_KP5) {
396 $::CONN->send ("command stay fire");
397 } elsif (exists $DIR{$sym}) {
398 if ($mod & KMOD_SHIFT) {
399 $::CONN->send ("command fire $DIR{$sym}[0]");
400 } elsif ($mod & KMOD_CTRL) {
401 $::CONN->send ("command run $DIR{$sym}[0]");
402 } else {
403 }
404 }
405}
406
407sub key_up {
408 my ($self, $ev) = @_;
409
410 my $mod = $ev->key_mod;
411 my $sym = $ev->key_sym;
412
413 if (exists $DIR{$sym}) {
414 if ($mod & KMOD_SHIFT) {
415 $::CONN->send ("command fire_stop");
416 } else {
417 $::CONN->send ("command run_stop");
418 }
419 }
420}
421
3771; 4221;
378 423

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines