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.89 by root, Sun May 21 00:02:01 2006 UTC vs.
Revision 1.93 by root, Tue May 23 18:54:37 2006 UTC

491void 491void
492SDL_PollEvent () 492SDL_PollEvent ()
493 PPCODE: 493 PPCODE:
494{ 494{
495 SDL_Event ev; 495 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 };
496 508
497 while (SDL_PollEvent (&ev)) 509 while (SDL_PollEvent (&ev))
498 { 510 {
499 HV *hv = newHV (); 511 HV *hv = newHV ();
500 hv_store (hv, "type", 4, newSViv (ev.type), 0); 512 hv_store (hv, "type", 4, newSViv (ev.type), 0);
501 513
502 switch (ev.type) 514 switch (ev.type)
503 { 515 {
504 case SDL_KEYDOWN: 516 case SDL_KEYDOWN:
505 case SDL_KEYUP: 517 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
506 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 529 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
507 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 530 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
508 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); 531 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0);
509 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 532 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
510 break; 533 break;
513 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 536 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
514 hv_store (hv, "state", 5, newSViv (ev.active.state), 0); 537 hv_store (hv, "state", 5, newSViv (ev.active.state), 0);
515 break; 538 break;
516 539
517 case SDL_MOUSEMOTION: 540 case SDL_MOUSEMOTION:
541 hv_store (hv, "mod", 3, newSViv (modifier), 0);
542
518 hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); 543 hv_store (hv, "state", 5, newSViv (ev.motion.state), 0);
519 hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); 544 hv_store (hv, "x", 1, newSViv (ev.motion.x), 0);
520 hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); 545 hv_store (hv, "y", 1, newSViv (ev.motion.y), 0);
521 hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); 546 hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0);
522 hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); 547 hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0);
523 break; 548 break;
524 549
525 case SDL_MOUSEBUTTONDOWN: 550 case SDL_MOUSEBUTTONDOWN:
526 case SDL_MOUSEBUTTONUP: 551 case SDL_MOUSEBUTTONUP:
552 hv_store (hv, "mod", 3, newSViv (modifier), 0);
553
527 hv_store (hv, "button", 6, newSViv (ev.button.button), 0); 554 hv_store (hv, "button", 6, newSViv (ev.button.button), 0);
528 hv_store (hv, "state", 5, newSViv (ev.button.state), 0); 555 hv_store (hv, "state", 5, newSViv (ev.button.state), 0);
529 hv_store (hv, "x", 1, newSViv (ev.button.x), 0); 556 hv_store (hv, "x", 1, newSViv (ev.button.x), 0);
530 hv_store (hv, "y", 1, newSViv (ev.button.y), 0); 557 hv_store (hv, "y", 1, newSViv (ev.button.y), 0);
531 break; 558 break;
557lowdelay (int fd, int val = 1) 584lowdelay (int fd, int val = 1)
558 CODE: 585 CODE:
559#ifndef _WIN32 586#ifndef _WIN32
560 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); 587 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val));
561#endif 588#endif
589
590char *
591gl_vendor ()
592 CODE:
593 RETVAL = (char *)glGetString (GL_VENDOR);
594 OUTPUT:
595 RETVAL
562 596
563char * 597char *
564gl_version () 598gl_version ()
565 CODE: 599 CODE:
566 RETVAL = (char *)glGetString (GL_VERSION); 600 RETVAL = (char *)glGetString (GL_VERSION);
1635 1669
1636void glPopMatrix () 1670void glPopMatrix ()
1637 1671
1638void glLoadIdentity () 1672void glLoadIdentity ()
1639 1673
1640# near and far are due to microsofts buggy c compiler 1674# near_ and far_ are due to microsofts buggy "c" compiler
1675void glFrustum (double left, double right, double bottom, double top, double near_, double far_)
1676
1677# near_ and far_ are due to microsofts buggy "c" compiler
1641void glOrtho (double left, double right, double bottom, double top, double near_, double far_) 1678void glOrtho (double left, double right, double bottom, double top, double near_, double far_)
1642 1679
1643void glViewport (int x, int y, int width, int height) 1680void glViewport (int x, int y, int width, int height)
1644 1681
1645void glScissor (int x, int y, int width, int height) 1682void glScissor (int x, int y, int width, int height)
1661void glEnd () 1698void glEnd ()
1662 1699
1663void glColor (float r, float g, float b, float a = 1.0) 1700void glColor (float r, float g, float b, float a = 1.0)
1664 PROTOTYPE: @ 1701 PROTOTYPE: @
1665 CODE: 1702 CODE:
1703 // microsoft visual "c" rounds instead of truncating...
1666 glColor4ub (MIN ((int)(r * 255.f), 255), 1704 glColor4ub (MIN ((int)(r * 255.f), 255),
1667 MIN ((int)(g * 255.f), 255), 1705 MIN ((int)(g * 255.f), 255),
1668 MIN ((int)(b * 255.f), 255), 1706 MIN ((int)(b * 255.f), 255),
1669 MIN ((int)(a * 255.f), 255)); 1707 MIN ((int)(a * 255.f), 255));
1670 1708
1672 1710
1673void glDrawElements (int mode, int count, int type, char *indices) 1711void glDrawElements (int mode, int count, int type, char *indices)
1674 1712
1675# 1.2 void glDrawRangeElements (int mode, int start, int end 1713# 1.2 void glDrawRangeElements (int mode, int start, int end
1676 1714
1715void glRasterPos (float x, float y, float z = 0.)
1716 CODE:
1717 glRasterPos3f (0, 0, z);
1718 glBitmap (0, 0, 0, 0, x, y, 0);
1719
1677void glVertex (float x, float y, float z = 0.) 1720void glVertex (float x, float y, float z = 0.)
1678 CODE: 1721 CODE:
1679 glVertex3f (x, y, z); 1722 glVertex3f (x, y, z);
1680 1723
1681void glTexCoord (float s, float t) 1724void glTexCoord (float s, float t)
1708 1751
1709void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) 1752void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data)
1710 1753
1711void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) 1754void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
1712 1755
1713void glRasterPos (int x, int y) 1756void glDrawPixels (int width, int height, int format, int type, char *pixels)
1714 CODE:
1715 glRasterPos2i (x, y);
1716 1757
1717void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) 1758void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR)
1718 1759
1719int glGenTexture () 1760int glGenTexture ()
1720 CODE: 1761 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines