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

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.166 by root, Fri Dec 8 15:07:08 2006 UTC vs.
Revision 1.168 by root, Sat Dec 9 21:26:45 2006 UTC

14 14
15#ifdef _WIN32 15#ifdef _WIN32
16# undef pipe 16# undef pipe
17#endif 17#endif
18 18
19#include <assert.h>
19#include <math.h> 20#include <math.h>
20#include <string.h> 21#include <string.h>
21#include <stdio.h> 22#include <stdio.h>
22#include <stdlib.h> 23#include <stdlib.h>
23 24
359 n |= n >> 16; 360 n |= n >> 16;
360 361
361 return n + 1; 362 return n + 1;
362} 363}
363 364
365/* SDL should provide this, really. */
366#define SDLK_MODIFIER_MIN 300
367#define SDLK_MODIFIER_MAX 314
368
364MODULE = CFPlus PACKAGE = CFPlus 369MODULE = CFPlus PACKAGE = CFPlus
365 370
366PROTOTYPES: ENABLE 371PROTOTYPES: ENABLE
367 372
368BOOT: 373BOOT:
371 static const struct { 376 static const struct {
372 const char *name; 377 const char *name;
373 IV iv; 378 IV iv;
374 } *civ, const_iv[] = { 379 } *civ, const_iv[] = {
375# define const_iv(name) { # name, (IV)name } 380# define const_iv(name) { # name, (IV)name }
381 const_iv (SDLK_MODIFIER_MIN),
382 const_iv (SDLK_MODIFIER_MAX),
383
376 const_iv (SDL_ACTIVEEVENT), 384 const_iv (SDL_ACTIVEEVENT),
377 const_iv (SDL_KEYDOWN), 385 const_iv (SDL_KEYDOWN),
378 const_iv (SDL_KEYUP), 386 const_iv (SDL_KEYUP),
379 const_iv (SDL_MOUSEMOTION), 387 const_iv (SDL_MOUSEMOTION),
380 const_iv (SDL_MOUSEBUTTONDOWN), 388 const_iv (SDL_MOUSEBUTTONDOWN),
389 const_iv (SDL_EVENT_RESERVEDA), 397 const_iv (SDL_EVENT_RESERVEDA),
390 const_iv (SDL_EVENT_RESERVEDB), 398 const_iv (SDL_EVENT_RESERVEDB),
391 const_iv (SDL_VIDEORESIZE), 399 const_iv (SDL_VIDEORESIZE),
392 const_iv (SDL_VIDEOEXPOSE), 400 const_iv (SDL_VIDEOEXPOSE),
393 const_iv (SDL_USEREVENT), 401 const_iv (SDL_USEREVENT),
402
403 const_iv (SDL_APPINPUTFOCUS),
404 const_iv (SDL_APPMOUSEFOCUS),
405 const_iv (SDL_APPACTIVE),
406
394 const_iv (SDLK_KP0), 407 const_iv (SDLK_KP0),
395 const_iv (SDLK_KP1), 408 const_iv (SDLK_KP1),
396 const_iv (SDLK_KP2), 409 const_iv (SDLK_KP2),
397 const_iv (SDLK_KP3), 410 const_iv (SDLK_KP3),
398 const_iv (SDLK_KP4), 411 const_iv (SDLK_KP4),
453 const_iv (SDLK_BREAK), 466 const_iv (SDLK_BREAK),
454 const_iv (SDLK_MENU), 467 const_iv (SDLK_MENU),
455 const_iv (SDLK_POWER), 468 const_iv (SDLK_POWER),
456 const_iv (SDLK_EURO), 469 const_iv (SDLK_EURO),
457 const_iv (SDLK_UNDO), 470 const_iv (SDLK_UNDO),
471
458 const_iv (KMOD_NONE), 472 const_iv (KMOD_NONE),
473 const_iv (KMOD_SHIFT),
459 const_iv (KMOD_LSHIFT), 474 const_iv (KMOD_LSHIFT),
460 const_iv (KMOD_RSHIFT), 475 const_iv (KMOD_RSHIFT),
476 const_iv (KMOD_CTRL),
461 const_iv (KMOD_LCTRL), 477 const_iv (KMOD_LCTRL),
462 const_iv (KMOD_RCTRL), 478 const_iv (KMOD_RCTRL),
479 const_iv (KMOD_ALT),
463 const_iv (KMOD_LALT), 480 const_iv (KMOD_LALT),
464 const_iv (KMOD_RALT), 481 const_iv (KMOD_RALT),
482 const_iv (KMOD_META),
465 const_iv (KMOD_LMETA), 483 const_iv (KMOD_LMETA),
466 const_iv (KMOD_RMETA), 484 const_iv (KMOD_RMETA),
467 const_iv (KMOD_NUM), 485 const_iv (KMOD_NUM),
468 const_iv (KMOD_CAPS), 486 const_iv (KMOD_CAPS),
469 const_iv (KMOD_MODE), 487 const_iv (KMOD_MODE),
470 const_iv (KMOD_CTRL),
471 const_iv (KMOD_SHIFT),
472 const_iv (KMOD_ALT),
473 const_iv (KMOD_META)
474# undef const_iv 488# undef const_iv
475 }; 489 };
476 490
477 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 491 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
478 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 492 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
493
494 assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK);
495 assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE);
479} 496}
497
498void
499weaken (SV *rv)
500 PROTOTYPE: $
501 CODE:
502 sv_rvweaken (rv);
480 503
481int 504int
482in_destruct () 505in_destruct ()
483 CODE: 506 CODE:
484 RETVAL = PL_main_cv == Nullcv; 507 RETVAL = PL_main_cv == Nullcv;
587 case SDL_KEYDOWN: 610 case SDL_KEYDOWN:
588 case SDL_KEYUP: 611 case SDL_KEYUP:
589 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 612 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
590 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 613 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
591 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); 614 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0);
615 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState ()), 0); /* current mode */
592 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 616 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
593 break; 617 break;
594 618
595 case SDL_ACTIVEEVENT: 619 case SDL_ACTIVEEVENT:
596 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 620 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines