… | |
… | |
327 | |
327 | |
328 | use strict; |
328 | use strict; |
329 | |
329 | |
330 | our @ISA = qw/Crossfire::Client::Widget/; |
330 | our @ISA = qw/Crossfire::Client::Widget/; |
331 | |
331 | |
|
|
332 | use SDL; |
332 | use SDL::OpenGL; |
333 | use SDL::OpenGL; |
333 | use SDL::OpenGL::Constants; |
334 | use SDL::OpenGL::Constants; |
334 | |
335 | |
335 | sub key_down { |
336 | sub 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 | |
|
|
378 | my %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 | |
|
|
389 | sub 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 | |
|
|
407 | sub 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 | |
377 | 1; |
422 | 1; |
378 | |
423 | |