… | |
… | |
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_vendor () |
|
|
565 | CODE: |
|
|
566 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
567 | OUTPUT: |
|
|
568 | RETVAL |
|
|
569 | |
|
|
570 | char * |
|
|
571 | gl_version () |
|
|
572 | CODE: |
|
|
573 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
574 | OUTPUT: |
|
|
575 | RETVAL |
|
|
576 | |
|
|
577 | char * |
|
|
578 | gl_extensions () |
|
|
579 | CODE: |
|
|
580 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
581 | OUTPUT: |
|
|
582 | RETVAL |
|
|
583 | |
569 | |
584 | void |
570 | void |
585 | add_font (char *file) |
571 | add_font (char *file) |
586 | CODE: |
572 | CODE: |
587 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
573 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
… | |
… | |
724 | |
710 | |
725 | CFClient::Layout |
711 | CFClient::Layout |
726 | new (SV *class, int rgba = 0) |
712 | new (SV *class, int rgba = 0) |
727 | CODE: |
713 | CODE: |
728 | #if _WIN32 |
714 | #if _WIN32 |
729 | rgba = 0;//D |
715 | //rgba = 0;//D make stext nicer, breaks TextView |
730 | #endif |
716 | #endif |
731 | New (0, RETVAL, 1, struct cf_layout); |
717 | New (0, RETVAL, 1, struct cf_layout); |
732 | |
718 | |
733 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
719 | RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); |
734 | RETVAL->rgba = rgba; |
720 | RETVAL->rgba = rgba; |
… | |
… | |
981 | { |
967 | { |
982 | HV *hv = (HV *)SvRV (self); |
968 | HV *hv = (HV *)SvRV (self); |
983 | float s = SvNV (*hv_fetch (hv, "s", 1, 1)); |
969 | float s = SvNV (*hv_fetch (hv, "s", 1, 1)); |
984 | float t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
970 | float t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
985 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
971 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
986 | int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1)); |
|
|
987 | |
972 | |
988 | if (items < 5) |
973 | if (items < 5) |
989 | { |
974 | { |
990 | w = SvNV (*hv_fetch (hv, "w", 1, 1)); |
975 | w = SvNV (*hv_fetch (hv, "w", 1, 1)); |
991 | h = SvNV (*hv_fetch (hv, "h", 1, 1)); |
976 | h = SvNV (*hv_fetch (hv, "h", 1, 1)); |
… | |
… | |
998 | glEnable (GL_ALPHA_TEST); |
983 | glEnable (GL_ALPHA_TEST); |
999 | glAlphaFunc (GL_GREATER, 0.01f); |
984 | glAlphaFunc (GL_GREATER, 0.01f); |
1000 | } |
985 | } |
1001 | |
986 | |
1002 | glBindTexture (GL_TEXTURE_2D, name); |
987 | glBindTexture (GL_TEXTURE_2D, name); |
1003 | |
|
|
1004 | if (wrap_mode) |
|
|
1005 | { |
|
|
1006 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); |
|
|
1007 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); |
|
|
1008 | } |
|
|
1009 | |
988 | |
1010 | glBegin (GL_QUADS); |
989 | glBegin (GL_QUADS); |
1011 | glTexCoord2f (0, 0); glVertex2f (x , y ); |
990 | glTexCoord2f (0, 0); glVertex2f (x , y ); |
1012 | glTexCoord2f (0, t); glVertex2f (x , y + h); |
991 | glTexCoord2f (0, t); glVertex2f (x , y + h); |
1013 | glTexCoord2f (s, t); glVertex2f (x + w, y + h); |
992 | glTexCoord2f (s, t); glVertex2f (x + w, y + h); |
… | |
… | |
1090 | tex->r = r; |
1069 | tex->r = r; |
1091 | tex->g = g; |
1070 | tex->g = g; |
1092 | tex->b = b; |
1071 | tex->b = b; |
1093 | tex->a = a; |
1072 | tex->a = a; |
1094 | } |
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_CLAMP_TO_EDGE); |
|
|
1079 | //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
|
|
1080 | // use uglier nearest interpolation because linear suffers |
|
|
1081 | // from transparent color bleeding and ugly wrapping effects. |
|
|
1082 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1095 | } |
1083 | } |
1096 | |
1084 | |
1097 | int |
1085 | int |
1098 | ox (CFClient::Map self) |
1086 | ox (CFClient::Map self) |
1099 | ALIAS: |
1087 | ALIAS: |
1100 | oy = 1 |
1088 | oy = 1 |
|
|
1089 | x = 2 |
|
|
1090 | y = 3 |
|
|
1091 | w = 4 |
|
|
1092 | h = 5 |
1101 | CODE: |
1093 | CODE: |
1102 | switch (ix) |
1094 | switch (ix) |
1103 | { |
1095 | { |
1104 | case 0: RETVAL = self->ox; break; |
1096 | case 0: RETVAL = self->ox; break; |
1105 | case 1: RETVAL = self->oy; break; |
1097 | case 1: RETVAL = self->oy; break; |
|
|
1098 | case 2: RETVAL = self->x; break; |
|
|
1099 | case 3: RETVAL = self->y; break; |
|
|
1100 | case 4: RETVAL = self->w; break; |
|
|
1101 | case 5: RETVAL = self->h; break; |
1106 | } |
1102 | } |
1107 | OUTPUT: |
1103 | OUTPUT: |
1108 | RETVAL |
1104 | RETVAL |
1109 | |
1105 | |
1110 | void |
1106 | void |
… | |
… | |
1570 | const_iv (GL_TEXTURE_MAG_FILTER), |
1566 | const_iv (GL_TEXTURE_MAG_FILTER), |
1571 | const_iv (GL_TEXTURE_MIN_FILTER), |
1567 | const_iv (GL_TEXTURE_MIN_FILTER), |
1572 | const_iv (GL_TEXTURE_ENV_MODE), |
1568 | const_iv (GL_TEXTURE_ENV_MODE), |
1573 | const_iv (GL_TEXTURE_WRAP_S), |
1569 | const_iv (GL_TEXTURE_WRAP_S), |
1574 | const_iv (GL_TEXTURE_WRAP_T), |
1570 | const_iv (GL_TEXTURE_WRAP_T), |
|
|
1571 | const_iv (GL_REPEAT), |
1575 | const_iv (GL_CLAMP), |
1572 | const_iv (GL_CLAMP), |
1576 | const_iv (GL_REPEAT), |
1573 | const_iv (GL_CLAMP_TO_EDGE), |
1577 | const_iv (GL_NEAREST), |
1574 | const_iv (GL_NEAREST), |
1578 | const_iv (GL_LINEAR), |
1575 | const_iv (GL_LINEAR), |
1579 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1576 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
1580 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1577 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
1581 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
1578 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
… | |
… | |
1611 | |
1608 | |
1612 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1609 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1613 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1610 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1614 | } |
1611 | } |
1615 | |
1612 | |
|
|
1613 | char * |
|
|
1614 | gl_vendor () |
|
|
1615 | CODE: |
|
|
1616 | RETVAL = (char *)glGetString (GL_VENDOR); |
|
|
1617 | OUTPUT: |
|
|
1618 | RETVAL |
|
|
1619 | |
|
|
1620 | char * |
|
|
1621 | gl_version () |
|
|
1622 | CODE: |
|
|
1623 | RETVAL = (char *)glGetString (GL_VERSION); |
|
|
1624 | OUTPUT: |
|
|
1625 | RETVAL |
|
|
1626 | |
|
|
1627 | char * |
|
|
1628 | gl_extensions () |
|
|
1629 | CODE: |
|
|
1630 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
|
|
1631 | OUTPUT: |
|
|
1632 | RETVAL |
|
|
1633 | |
1616 | int glGetError () |
1634 | int glGetError () |
1617 | |
1635 | |
1618 | void glClear (int mask) |
1636 | void glClear (int mask) |
1619 | |
1637 | |
1620 | void glClearColor (float r, float g, float b, float a = 1.0) |
1638 | void glClearColor (float r, float g, float b, float a = 1.0) |
… | |
… | |
1672 | |
1690 | |
1673 | void glColor (float r, float g, float b, float a = 1.0) |
1691 | void glColor (float r, float g, float b, float a = 1.0) |
1674 | PROTOTYPE: @ |
1692 | PROTOTYPE: @ |
1675 | CODE: |
1693 | CODE: |
1676 | // microsoft visual "c" rounds instead of truncating... |
1694 | // microsoft visual "c" rounds instead of truncating... |
1677 | glColor4ub (MIN ((int)(r * 255.f), 255), |
1695 | glColor4ub (MIN ((int)(r * 256.f), 255), |
1678 | MIN ((int)(g * 255.f), 255), |
1696 | MIN ((int)(g * 256.f), 255), |
1679 | MIN ((int)(b * 255.f), 255), |
1697 | MIN ((int)(b * 256.f), 255), |
1680 | MIN ((int)(a * 255.f), 255)); |
1698 | MIN ((int)(a * 256.f), 255)); |
1681 | |
1699 | |
1682 | void glInterleavedArrays (int format, int stride, char *data) |
1700 | void glInterleavedArrays (int format, int stride, char *data) |
1683 | |
1701 | |
1684 | void glDrawElements (int mode, int count, int type, char *indices) |
1702 | void glDrawElements (int mode, int count, int type, char *indices) |
1685 | |
1703 | |