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.93 by root, Tue May 23 18:54:37 2006 UTC vs.
Revision 1.96 by root, Wed May 24 22:28:43 2006 UTC

486 RETVAL 486 RETVAL
487 487
488void 488void
489SDL_GL_SwapBuffers () 489SDL_GL_SwapBuffers ()
490 490
491char *
492SDL_GetKeyName (int sym)
493
491void 494void
492SDL_PollEvent () 495SDL_PollEvent ()
493 PPCODE: 496 PPCODE:
494{ 497{
495 SDL_Event ev; 498 SDL_Event ev;
496 int i;
497 static int modifier;
498 static int modkey[] = {
499 SDLK_RSHIFT, KMOD_RSHIFT,
500 SDLK_LSHIFT, KMOD_LSHIFT,
501 SDLK_RCTRL, KMOD_RCTRL,
502 SDLK_LCTRL, KMOD_LCTRL,
503 SDLK_RALT, KMOD_RALT,
504 SDLK_LALT, KMOD_LALT,
505 SDLK_RMETA, KMOD_RMETA,
506 SDLK_LMETA, KMOD_LMETA,
507 };
508 499
509 while (SDL_PollEvent (&ev)) 500 while (SDL_PollEvent (&ev))
510 { 501 {
511 HV *hv = newHV (); 502 HV *hv = newHV ();
512 hv_store (hv, "type", 4, newSViv (ev.type), 0); 503 hv_store (hv, "type", 4, newSViv (ev.type), 0);
513 504
514 switch (ev.type) 505 switch (ev.type)
515 { 506 {
516 case SDL_KEYDOWN: 507 case SDL_KEYDOWN:
517 case SDL_KEYUP: 508 case SDL_KEYUP:
518
519 for (i = 0; i < sizeof (modkey) / (sizeof (int) * 2); i++)
520 if (modkey [i * 2] == ev.key.keysym.sym)
521 {
522 if (ev.type == SDL_KEYDOWN)
523 modifier |= modkey [i * 2 + 1];
524 else
525 modifier &= ~modkey [i * 2 + 1];
526 break;
527 }
528
529 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 509 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
530 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 510 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
531 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); 511 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0);
532 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 512 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
533 break; 513 break;
536 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 516 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
537 hv_store (hv, "state", 5, newSViv (ev.active.state), 0); 517 hv_store (hv, "state", 5, newSViv (ev.active.state), 0);
538 break; 518 break;
539 519
540 case SDL_MOUSEMOTION: 520 case SDL_MOUSEMOTION:
541 hv_store (hv, "mod", 3, newSViv (modifier), 0); 521 hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0);
542 522
543 hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); 523 hv_store (hv, "state", 5, newSViv (ev.motion.state), 0);
544 hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); 524 hv_store (hv, "x", 1, newSViv (ev.motion.x), 0);
545 hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); 525 hv_store (hv, "y", 1, newSViv (ev.motion.y), 0);
546 hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); 526 hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0);
547 hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); 527 hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0);
548 break; 528 break;
549 529
550 case SDL_MOUSEBUTTONDOWN: 530 case SDL_MOUSEBUTTONDOWN:
551 case SDL_MOUSEBUTTONUP: 531 case SDL_MOUSEBUTTONUP:
552 hv_store (hv, "mod", 3, newSViv (modifier), 0); 532 hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0);
553 533
554 hv_store (hv, "button", 6, newSViv (ev.button.button), 0); 534 hv_store (hv, "button", 6, newSViv (ev.button.button), 0);
555 hv_store (hv, "state", 5, newSViv (ev.button.state), 0); 535 hv_store (hv, "state", 5, newSViv (ev.button.state), 0);
556 hv_store (hv, "x", 1, newSViv (ev.button.x), 0); 536 hv_store (hv, "x", 1, newSViv (ev.button.x), 0);
557 hv_store (hv, "y", 1, newSViv (ev.button.y), 0); 537 hv_store (hv, "y", 1, newSViv (ev.button.y), 0);
751 731
752CFClient::Layout 732CFClient::Layout
753new (SV *class, int rgba = 0) 733new (SV *class, int rgba = 0)
754 CODE: 734 CODE:
755#if _WIN32 735#if _WIN32
756 rgba = 0;//D 736 //rgba = 0;//D make stext nicer, breaks TextView
757#endif 737#endif
758 New (0, RETVAL, 1, struct cf_layout); 738 New (0, RETVAL, 1, struct cf_layout);
759 739
760 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); 740 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context);
761 RETVAL->rgba = rgba; 741 RETVAL->rgba = rgba;
1117 tex->r = r; 1097 tex->r = r;
1118 tex->g = g; 1098 tex->g = g;
1119 tex->b = b; 1099 tex->b = b;
1120 tex->a = a; 1100 tex->a = a;
1121 } 1101 }
1102
1103 // somewhat hackish, but for textures that require it, it really
1104 // improves the look, and most others don't suffer.
1105 glBindTexture (GL_TEXTURE_2D, name);
1106 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1107 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1122} 1108}
1123 1109
1124int 1110int
1125ox (CFClient::Map self) 1111ox (CFClient::Map self)
1126 ALIAS: 1112 ALIAS:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines