… | |
… | |
486 | RETVAL |
486 | RETVAL |
487 | |
487 | |
488 | void |
488 | void |
489 | SDL_GL_SwapBuffers () |
489 | SDL_GL_SwapBuffers () |
490 | |
490 | |
|
|
491 | char * |
|
|
492 | SDL_GetKeyName (int sym) |
|
|
493 | |
491 | void |
494 | void |
492 | SDL_PollEvent () |
495 | SDL_PollEvent () |
493 | PPCODE: |
496 | PPCODE: |
494 | { |
497 | { |
495 | SDL_Event ev; |
498 | SDL_Event ev; |
… | |
… | |
513 | hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); |
516 | hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); |
514 | hv_store (hv, "state", 5, newSViv (ev.active.state), 0); |
517 | hv_store (hv, "state", 5, newSViv (ev.active.state), 0); |
515 | break; |
518 | break; |
516 | |
519 | |
517 | case SDL_MOUSEMOTION: |
520 | case SDL_MOUSEMOTION: |
|
|
521 | hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); |
|
|
522 | |
518 | hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); |
523 | hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); |
519 | hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); |
524 | hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); |
520 | hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); |
525 | hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); |
521 | hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); |
526 | hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); |
522 | hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); |
527 | hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); |
523 | break; |
528 | break; |
524 | |
529 | |
525 | case SDL_MOUSEBUTTONDOWN: |
530 | case SDL_MOUSEBUTTONDOWN: |
526 | case SDL_MOUSEBUTTONUP: |
531 | case SDL_MOUSEBUTTONUP: |
|
|
532 | hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); |
|
|
533 | |
527 | hv_store (hv, "button", 6, newSViv (ev.button.button), 0); |
534 | hv_store (hv, "button", 6, newSViv (ev.button.button), 0); |
528 | hv_store (hv, "state", 5, newSViv (ev.button.state), 0); |
535 | hv_store (hv, "state", 5, newSViv (ev.button.state), 0); |
529 | hv_store (hv, "x", 1, newSViv (ev.button.x), 0); |
536 | hv_store (hv, "x", 1, newSViv (ev.button.x), 0); |
530 | hv_store (hv, "y", 1, newSViv (ev.button.y), 0); |
537 | hv_store (hv, "y", 1, newSViv (ev.button.y), 0); |
531 | break; |
538 | break; |
… | |
… | |
557 | lowdelay (int fd, int val = 1) |
564 | lowdelay (int fd, int val = 1) |
558 | CODE: |
565 | CODE: |
559 | #ifndef _WIN32 |
566 | #ifndef _WIN32 |
560 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
567 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
561 | #endif |
568 | #endif |
562 | |
|
|
563 | char * |
|
|
564 | gl_version () |
|
|
565 | CODE: |
|
|
566 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
567 | OUTPUT: |
|
|
568 | RETVAL |
|
|
569 | |
|
|
570 | char * |
|
|
571 | gl_extensions () |
|
|
572 | CODE: |
|
|
573 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
574 | OUTPUT: |
|
|
575 | RETVAL |
|
|
576 | |
569 | |
577 | void |
570 | void |
578 | add_font (char *file) |
571 | add_font (char *file) |
579 | CODE: |
572 | CODE: |
580 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
573 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
… | |
… | |
717 | |
710 | |
718 | CFClient::Layout |
711 | CFClient::Layout |
719 | new (SV *class, int rgba = 0) |
712 | new (SV *class, int rgba = 0) |
720 | CODE: |
713 | CODE: |
721 | #if _WIN32 |
714 | #if _WIN32 |
722 | rgba = 0;//D |
715 | //rgba = 0;//D make stext nicer, breaks TextView |
723 | #endif |
716 | #endif |
724 | New (0, RETVAL, 1, struct cf_layout); |
717 | New (0, RETVAL, 1, struct cf_layout); |
725 | |
718 | |
726 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
719 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
727 | RETVAL->rgba = rgba; |
720 | RETVAL->rgba = rgba; |
… | |
… | |
974 | { |
967 | { |
975 | HV *hv = (HV *)SvRV (self); |
968 | HV *hv = (HV *)SvRV (self); |
976 | float s = SvNV (*hv_fetch (hv, "s", 1, 1)); |
969 | float s = SvNV (*hv_fetch (hv, "s", 1, 1)); |
977 | float t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
970 | float t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
978 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
971 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
979 | int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1)); |
|
|
980 | |
972 | |
981 | if (items < 5) |
973 | if (items < 5) |
982 | { |
974 | { |
983 | w = SvNV (*hv_fetch (hv, "w", 1, 1)); |
975 | w = SvNV (*hv_fetch (hv, "w", 1, 1)); |
984 | h = SvNV (*hv_fetch (hv, "h", 1, 1)); |
976 | h = SvNV (*hv_fetch (hv, "h", 1, 1)); |
… | |
… | |
991 | glEnable (GL_ALPHA_TEST); |
983 | glEnable (GL_ALPHA_TEST); |
992 | glAlphaFunc (GL_GREATER, 0.01f); |
984 | glAlphaFunc (GL_GREATER, 0.01f); |
993 | } |
985 | } |
994 | |
986 | |
995 | glBindTexture (GL_TEXTURE_2D, name); |
987 | glBindTexture (GL_TEXTURE_2D, name); |
996 | |
|
|
997 | if (wrap_mode) |
|
|
998 | { |
|
|
999 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); |
|
|
1000 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); |
|
|
1001 | } |
|
|
1002 | |
988 | |
1003 | glBegin (GL_QUADS); |
989 | glBegin (GL_QUADS); |
1004 | glTexCoord2f (0, 0); glVertex2f (x , y ); |
990 | glTexCoord2f (0, 0); glVertex2f (x , y ); |
1005 | glTexCoord2f (0, t); glVertex2f (x , y + h); |
991 | glTexCoord2f (0, t); glVertex2f (x , y + h); |
1006 | glTexCoord2f (s, t); glVertex2f (x + w, y + h); |
992 | glTexCoord2f (s, t); glVertex2f (x + w, y + h); |
… | |
… | |
1083 | tex->r = r; |
1069 | tex->r = r; |
1084 | tex->g = g; |
1070 | tex->g = g; |
1085 | tex->b = b; |
1071 | tex->b = b; |
1086 | tex->a = a; |
1072 | tex->a = a; |
1087 | } |
1073 | } |
|
|
1074 | |
|
|
1075 | // somewhat hackish, but for textures that require it, it really |
|
|
1076 | // improves the look, and most others don't suffer. |
|
|
1077 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
1078 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); |
|
|
1079 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); |
1088 | } |
1080 | } |
1089 | |
1081 | |
1090 | int |
1082 | int |
1091 | ox (CFClient::Map self) |
1083 | ox (CFClient::Map self) |
1092 | ALIAS: |
1084 | ALIAS: |
… | |
… | |
1563 | const_iv (GL_TEXTURE_MAG_FILTER), |
1555 | const_iv (GL_TEXTURE_MAG_FILTER), |
1564 | const_iv (GL_TEXTURE_MIN_FILTER), |
1556 | const_iv (GL_TEXTURE_MIN_FILTER), |
1565 | const_iv (GL_TEXTURE_ENV_MODE), |
1557 | const_iv (GL_TEXTURE_ENV_MODE), |
1566 | const_iv (GL_TEXTURE_WRAP_S), |
1558 | const_iv (GL_TEXTURE_WRAP_S), |
1567 | const_iv (GL_TEXTURE_WRAP_T), |
1559 | const_iv (GL_TEXTURE_WRAP_T), |
|
|
1560 | const_iv (GL_REPEAT), |
1568 | const_iv (GL_CLAMP), |
1561 | const_iv (GL_CLAMP), |
1569 | const_iv (GL_REPEAT), |
1562 | const_iv (GL_CLAMP_TO_EDGE), |
1570 | const_iv (GL_NEAREST), |
1563 | const_iv (GL_NEAREST), |
1571 | const_iv (GL_LINEAR), |
1564 | const_iv (GL_LINEAR), |
1572 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1565 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1573 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1566 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1574 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
1567 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
… | |
… | |
1604 | |
1597 | |
1605 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1598 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1606 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1599 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1607 | } |
1600 | } |
1608 | |
1601 | |
|
|
1602 | char * |
|
|
1603 | gl_vendor () |
|
|
1604 | CODE: |
|
|
1605 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
1606 | OUTPUT: |
|
|
1607 | RETVAL |
|
|
1608 | |
|
|
1609 | char * |
|
|
1610 | gl_version () |
|
|
1611 | CODE: |
|
|
1612 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
1613 | OUTPUT: |
|
|
1614 | RETVAL |
|
|
1615 | |
|
|
1616 | char * |
|
|
1617 | gl_extensions () |
|
|
1618 | CODE: |
|
|
1619 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
1620 | OUTPUT: |
|
|
1621 | RETVAL |
|
|
1622 | |
1609 | int glGetError () |
1623 | int glGetError () |
1610 | |
1624 | |
1611 | void glClear (int mask) |
1625 | void glClear (int mask) |
1612 | |
1626 | |
1613 | void glClearColor (float r, float g, float b, float a = 1.0) |
1627 | void glClearColor (float r, float g, float b, float a = 1.0) |
… | |
… | |
1635 | |
1649 | |
1636 | void glPopMatrix () |
1650 | void glPopMatrix () |
1637 | |
1651 | |
1638 | void glLoadIdentity () |
1652 | void glLoadIdentity () |
1639 | |
1653 | |
1640 | # near and far are due to microsofts buggy c compiler |
1654 | # near_ and far_ are due to microsofts buggy "c" compiler |
|
|
1655 | void glFrustum (double left, double right, double bottom, double top, double near_, double far_) |
|
|
1656 | |
|
|
1657 | # near_ and far_ are due to microsofts buggy "c" compiler |
1641 | void glOrtho (double left, double right, double bottom, double top, double near_, double far_) |
1658 | void glOrtho (double left, double right, double bottom, double top, double near_, double far_) |
1642 | |
1659 | |
1643 | void glViewport (int x, int y, int width, int height) |
1660 | void glViewport (int x, int y, int width, int height) |
1644 | |
1661 | |
1645 | void glScissor (int x, int y, int width, int height) |
1662 | void glScissor (int x, int y, int width, int height) |
… | |
… | |
1661 | void glEnd () |
1678 | void glEnd () |
1662 | |
1679 | |
1663 | void glColor (float r, float g, float b, float a = 1.0) |
1680 | void glColor (float r, float g, float b, float a = 1.0) |
1664 | PROTOTYPE: @ |
1681 | PROTOTYPE: @ |
1665 | CODE: |
1682 | CODE: |
|
|
1683 | // microsoft visual "c" rounds instead of truncating... |
1666 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1684 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1667 | MIN ((int)(g * 255.f), 255), |
1685 | MIN ((int)(g * 255.f), 255), |
1668 | MIN ((int)(b * 255.f), 255), |
1686 | MIN ((int)(b * 255.f), 255), |
1669 | MIN ((int)(a * 255.f), 255)); |
1687 | MIN ((int)(a * 255.f), 255)); |
1670 | |
1688 | |
… | |
… | |
1672 | |
1690 | |
1673 | void glDrawElements (int mode, int count, int type, char *indices) |
1691 | void glDrawElements (int mode, int count, int type, char *indices) |
1674 | |
1692 | |
1675 | # 1.2 void glDrawRangeElements (int mode, int start, int end |
1693 | # 1.2 void glDrawRangeElements (int mode, int start, int end |
1676 | |
1694 | |
|
|
1695 | void glRasterPos (float x, float y, float z = 0.) |
|
|
1696 | CODE: |
|
|
1697 | glRasterPos3f (0, 0, z); |
|
|
1698 | glBitmap (0, 0, 0, 0, x, y, 0); |
|
|
1699 | |
1677 | void glVertex (float x, float y, float z = 0.) |
1700 | void glVertex (float x, float y, float z = 0.) |
1678 | CODE: |
1701 | CODE: |
1679 | glVertex3f (x, y, z); |
1702 | glVertex3f (x, y, z); |
1680 | |
1703 | |
1681 | void glTexCoord (float s, float t) |
1704 | void glTexCoord (float s, float t) |
… | |
… | |
1708 | |
1731 | |
1709 | void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) |
1732 | void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) |
1710 | |
1733 | |
1711 | void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) |
1734 | void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) |
1712 | |
1735 | |
1713 | void glRasterPos (int x, int y) |
1736 | void glDrawPixels (int width, int height, int format, int type, char *pixels) |
1714 | CODE: |
|
|
1715 | glRasterPos2i (x, y); |
|
|
1716 | |
1737 | |
1717 | void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) |
1738 | void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR) |
1718 | |
1739 | |
1719 | int glGenTexture () |
1740 | int glGenTexture () |
1720 | CODE: |
1741 | CODE: |