… | |
… | |
203 | |
203 | |
204 | typedef uint16_t tileid; |
204 | typedef uint16_t tileid; |
205 | typedef uint16_t faceid; |
205 | typedef uint16_t faceid; |
206 | |
206 | |
207 | typedef struct { |
207 | typedef struct { |
208 | int name; |
208 | GLuint name; |
209 | int w, h; |
209 | int w, h; |
210 | float s, t; |
210 | float s, t; |
211 | uint8_t r, g, b, a; |
211 | uint8_t r, g, b, a; |
212 | tileid smoothtile; |
212 | tileid smoothtile; |
213 | uint8_t smoothlevel; |
213 | uint8_t smoothlevel; |
… | |
… | |
438 | n |= n >> 4; |
438 | n |= n >> 4; |
439 | n |= n >> 8; |
439 | n |= n >> 8; |
440 | n |= n >> 16; |
440 | n |= n >> 16; |
441 | |
441 | |
442 | return n + 1; |
442 | return n + 1; |
|
|
443 | } |
|
|
444 | |
|
|
445 | static unsigned int |
|
|
446 | popcount (unsigned int n) |
|
|
447 | { |
|
|
448 | n -= (n >> 1) & 0x55555555U; |
|
|
449 | n = ((n >> 2) & 0x33333333U) + (n & 0x33333333U); |
|
|
450 | n = ((n >> 4) + n) & 0x0f0f0f0fU; |
|
|
451 | n *= 0x01010101U; |
|
|
452 | |
|
|
453 | return n >> 24; |
443 | } |
454 | } |
444 | |
455 | |
445 | /* SDL should provide this, really. */ |
456 | /* SDL should provide this, really. */ |
446 | #define SDLK_MODIFIER_MIN 300 |
457 | #define SDLK_MODIFIER_MIN 300 |
447 | #define SDLK_MODIFIER_MAX 314 |
458 | #define SDLK_MODIFIER_MAX 314 |
… | |
… | |
525 | |
536 | |
526 | const_iv (SDL_APPINPUTFOCUS), |
537 | const_iv (SDL_APPINPUTFOCUS), |
527 | const_iv (SDL_APPMOUSEFOCUS), |
538 | const_iv (SDL_APPMOUSEFOCUS), |
528 | const_iv (SDL_APPACTIVE), |
539 | const_iv (SDL_APPACTIVE), |
529 | |
540 | |
|
|
541 | const_iv (SDLK_FIRST), |
|
|
542 | const_iv (SDLK_LAST), |
530 | const_iv (SDLK_KP0), |
543 | const_iv (SDLK_KP0), |
531 | const_iv (SDLK_KP1), |
544 | const_iv (SDLK_KP1), |
532 | const_iv (SDLK_KP2), |
545 | const_iv (SDLK_KP2), |
533 | const_iv (SDLK_KP3), |
546 | const_iv (SDLK_KP3), |
534 | const_iv (SDLK_KP4), |
547 | const_iv (SDLK_KP4), |
… | |
… | |
606 | const_iv (KMOD_LMETA), |
619 | const_iv (KMOD_LMETA), |
607 | const_iv (KMOD_RMETA), |
620 | const_iv (KMOD_RMETA), |
608 | const_iv (KMOD_NUM), |
621 | const_iv (KMOD_NUM), |
609 | const_iv (KMOD_CAPS), |
622 | const_iv (KMOD_CAPS), |
610 | const_iv (KMOD_MODE), |
623 | const_iv (KMOD_MODE), |
|
|
624 | |
|
|
625 | const_iv (MIX_DEFAULT_FORMAT), |
611 | # undef const_iv |
626 | # undef const_iv |
612 | }; |
627 | }; |
613 | |
628 | |
614 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
629 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
615 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
630 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
… | |
… | |
632 | RETVAL |
647 | RETVAL |
633 | |
648 | |
634 | NV floor (NV x) |
649 | NV floor (NV x) |
635 | |
650 | |
636 | NV ceil (NV x) |
651 | NV ceil (NV x) |
|
|
652 | |
|
|
653 | IV minpot (UV n) |
|
|
654 | |
|
|
655 | IV popcount (UV n) |
637 | |
656 | |
638 | void |
657 | void |
639 | pango_init () |
658 | pango_init () |
640 | CODE: |
659 | CODE: |
641 | { |
660 | { |
… | |
… | |
681 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
700 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
682 | |
701 | |
683 | if (m && m != (SDL_Rect **)-1) |
702 | if (m && m != (SDL_Rect **)-1) |
684 | while (*m) |
703 | while (*m) |
685 | { |
704 | { |
686 | if ((*m)->w >= 640 && (*m)->h >= 480) |
705 | if ((*m)->w >= 800 && (*m)->h >= 600) |
687 | { |
706 | { |
688 | AV *av = newAV (); |
707 | AV *av = newAV (); |
689 | av_push (av, newSViv ((*m)->w)); |
708 | av_push (av, newSViv ((*m)->w)); |
690 | av_push (av, newSViv ((*m)->h)); |
709 | av_push (av, newSViv ((*m)->h)); |
691 | av_push (av, newSViv (rgb)); |
710 | av_push (av, newSViv (rgb)); |
… | |
… | |
715 | |
734 | |
716 | if (RETVAL) |
735 | if (RETVAL) |
717 | { |
736 | { |
718 | av_clear (texture_av); |
737 | av_clear (texture_av); |
719 | |
738 | |
720 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
739 | SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra"); |
721 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
740 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
722 | #include "glfunc.h" |
741 | #include "glfunc.h" |
723 | #undef GL_FUNC |
742 | #undef GL_FUNC |
724 | } |
743 | } |
725 | } |
744 | } |
… | |
… | |
811 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
830 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
812 | } |
831 | } |
813 | } |
832 | } |
814 | |
833 | |
815 | int |
834 | int |
816 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 1024) |
835 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
817 | POSTCALL: |
836 | POSTCALL: |
818 | Mix_HookMusicFinished (music_finished); |
837 | Mix_HookMusicFinished (music_finished); |
819 | Mix_ChannelFinished (channel_finished); |
838 | Mix_ChannelFinished (channel_finished); |
|
|
839 | |
|
|
840 | void |
|
|
841 | Mix_QuerySpec () |
|
|
842 | PPCODE: |
|
|
843 | { |
|
|
844 | int freq, channels; |
|
|
845 | Uint16 format; |
|
|
846 | |
|
|
847 | if (Mix_QuerySpec (&freq, &format, &channels)) |
|
|
848 | { |
|
|
849 | EXTEND (SP, 3); |
|
|
850 | PUSHs (sv_2mortal (newSViv (freq))); |
|
|
851 | PUSHs (sv_2mortal (newSViv (format))); |
|
|
852 | PUSHs (sv_2mortal (newSViv (channels))); |
|
|
853 | } |
|
|
854 | } |
820 | |
855 | |
821 | void |
856 | void |
822 | Mix_CloseAudio () |
857 | Mix_CloseAudio () |
823 | |
858 | |
824 | int |
859 | int |
… | |
… | |
958 | void |
993 | void |
959 | error (char *message) |
994 | error (char *message) |
960 | CODE: |
995 | CODE: |
961 | fprintf (stderr, "ERROR: %s\n", message); |
996 | fprintf (stderr, "ERROR: %s\n", message); |
962 | #ifdef _WIN32 |
997 | #ifdef _WIN32 |
963 | MessageBox (0, message, "Crossfire+ Error", MB_OK | MB_ICONERROR); |
998 | MessageBox (0, message, "Deliantra Client Error", MB_OK | MB_ICONERROR); |
964 | #endif |
999 | #endif |
965 | |
1000 | |
966 | void |
1001 | void |
967 | fatal (char *message) |
1002 | fatal (char *message) |
968 | CODE: |
1003 | CODE: |
969 | fprintf (stderr, "FATAL: %s\n", message); |
1004 | fprintf (stderr, "FATAL: %s\n", message); |
970 | #ifdef _WIN32 |
1005 | #ifdef _WIN32 |
971 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
1006 | MessageBox (0, message, "Deliantra Client Fatal Error", MB_OK | MB_ICONERROR); |
972 | #endif |
1007 | #endif |
973 | _exit (1); |
1008 | _exit (1); |
974 | |
1009 | |
975 | void |
1010 | void |
976 | _exit (int retval = 0) |
1011 | _exit (int retval = 0) |
… | |
… | |
1020 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
1055 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
1021 | |
1056 | |
1022 | PROTOTYPES: DISABLE |
1057 | PROTOTYPES: DISABLE |
1023 | |
1058 | |
1024 | void |
1059 | void |
1025 | reset_glyph_cache () |
1060 | glyph_cache_backup () |
1026 | PROTOTYPE: |
1061 | PROTOTYPE: |
1027 | CODE: |
1062 | CODE: |
|
|
1063 | tc_backup (); |
|
|
1064 | |
|
|
1065 | void |
|
|
1066 | glyph_cache_restore () |
|
|
1067 | PROTOTYPE: |
|
|
1068 | CODE: |
1028 | tc_clear (); |
1069 | tc_restore (); |
1029 | |
1070 | |
1030 | CFPlus::Layout |
1071 | CFPlus::Layout |
1031 | new (SV *class) |
1072 | new (SV *class) |
1032 | CODE: |
1073 | CODE: |
1033 | New (0, RETVAL, 1, struct cf_layout); |
1074 | New (0, RETVAL, 1, struct cf_layout); |
… | |
… | |
1345 | } |
1386 | } |
1346 | |
1387 | |
1347 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1388 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1348 | |
1389 | |
1349 | PROTOTYPES: ENABLE |
1390 | PROTOTYPES: ENABLE |
1350 | |
|
|
1351 | int minpot (int n) |
|
|
1352 | |
1391 | |
1353 | void |
1392 | void |
1354 | pad (SV *data_, int ow, int oh, int nw, int nh) |
1393 | pad (SV *data_, int ow, int oh, int nw, int nh) |
1355 | CODE: |
1394 | CODE: |
1356 | { |
1395 | { |
… | |
… | |
1745 | { |
1784 | { |
1746 | int x, y, z; |
1785 | int x, y, z; |
1747 | |
1786 | |
1748 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
1787 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
1749 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
1788 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
1750 | static uint8_t smooth_max[256][256]; // egad, fats and wasteful on memory (64k) |
1789 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
1751 | smooth_key skey; |
1790 | smooth_key skey; |
1752 | |
1791 | |
1753 | rc_t *rc = rc_alloc (); |
1792 | rc_t *rc = rc_alloc (); |
1754 | rc_key_t key; |
1793 | rc_key_t key; |
1755 | rc_array_t *arr; |
1794 | rc_array_t *arr; |
… | |
… | |
1817 | if (tile) |
1856 | if (tile) |
1818 | { |
1857 | { |
1819 | maptex tex = self->tex [tile]; |
1858 | maptex tex = self->tex [tile]; |
1820 | int px, py; |
1859 | int px, py; |
1821 | |
1860 | |
1822 | // suppressing texture state switches here |
|
|
1823 | // is only moderately effective, but worth the extra effort |
|
|
1824 | if (key.texname != tex.name) |
1861 | if (key.texname != tex.name) |
1825 | { |
1862 | { |
1826 | if (!tex.name) |
1863 | if (!tex.name) |
1827 | tex = self->tex [2]; /* missing, replace by noface */ |
1864 | tex = self->tex [2]; /* missing, replace by noface */ |
1828 | |
1865 | |
… | |
… | |
1911 | // go through all smoothlevels, lowest to highest, then draw. |
1948 | // go through all smoothlevels, lowest to highest, then draw. |
1912 | // this is basically counting sort |
1949 | // this is basically counting sort |
1913 | { |
1950 | { |
1914 | int w, b; |
1951 | int w, b; |
1915 | |
1952 | |
|
|
1953 | glEnable (GL_TEXTURE_2D); |
|
|
1954 | glBegin (GL_QUADS); |
1916 | for (w = 0; w < 256 / 32; ++w) |
1955 | for (w = 0; w < 256 / 32; ++w) |
1917 | { |
1956 | { |
1918 | uint32_t smask = smooth_level [w]; |
1957 | uint32_t smask = smooth_level [w]; |
1919 | if (smask) |
1958 | if (smask) |
1920 | for (b = 0; b < 32; ++b) |
1959 | for (b = 0; b < 32; ++b) |
… | |
… | |
1945 | { |
1984 | { |
1946 | // this time avoiding texture state changes |
1985 | // this time avoiding texture state changes |
1947 | // save gobs of state changes. |
1986 | // save gobs of state changes. |
1948 | if (key.texname != tex.name) |
1987 | if (key.texname != tex.name) |
1949 | { |
1988 | { |
|
|
1989 | glEnd (); |
1950 | key.texname = tex.name; |
1990 | glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); |
1951 | arr = rc_array (rc, &key); |
1991 | glBegin (GL_QUADS); |
1952 | } |
1992 | } |
1953 | |
1993 | |
1954 | if (border) |
1994 | if (border) |
1955 | { |
1995 | { |
1956 | float ox = border * dx; |
1996 | float ox = border * dx; |
1957 | |
1997 | |
1958 | rc_t2f_v3f (arr, ox , 0.f , px , py , 0); |
1998 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
1959 | rc_t2f_v3f (arr, ox , dy , px , py + T, 0); |
1999 | glTexCoord2f (ox , dy ); glVertex2i (px , py + T); |
1960 | rc_t2f_v3f (arr, ox + dx, dy , px + T, py + T, 0); |
2000 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py + T); |
1961 | rc_t2f_v3f (arr, ox + dx, 0.f , px + T, py , 0); |
2001 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + T, py ); |
1962 | } |
2002 | } |
1963 | |
2003 | |
1964 | if (corner) |
2004 | if (corner) |
1965 | { |
2005 | { |
1966 | float ox = corner * dx; |
2006 | float ox = corner * dx; |
1967 | |
2007 | |
1968 | rc_t2f_v3f (arr, ox , dy , px , py , 0); |
2008 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
1969 | rc_t2f_v3f (arr, ox , dy * 2.f, px , py + T, 0); |
2009 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + T); |
1970 | rc_t2f_v3f (arr, ox + dx, dy * 2.f, px + T, py + T, 0); |
2010 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + T, py + T); |
1971 | rc_t2f_v3f (arr, ox + dx, dy , px + T, py , 0); |
2011 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py ); |
1972 | } |
2012 | } |
1973 | } |
2013 | } |
1974 | } |
2014 | } |
1975 | } |
2015 | } |
1976 | } |
2016 | } |
1977 | } |
2017 | } |
|
|
2018 | |
|
|
2019 | glEnd (); |
|
|
2020 | glDisable (GL_TEXTURE_2D); |
|
|
2021 | key.texname = -1; |
1978 | } |
2022 | } |
1979 | |
2023 | |
1980 | hv_clear (smooth); |
2024 | hv_clear (smooth); |
1981 | rc_draw (rc); |
|
|
1982 | rc_clear (rc); |
|
|
1983 | } |
2025 | } |
1984 | |
2026 | |
1985 | glDisable (GL_BLEND); |
2027 | glDisable (GL_BLEND); |
1986 | rc_free (rc); |
2028 | rc_free (rc); |
1987 | |
2029 | |
… | |
… | |
2240 | int x, y, z; |
2282 | int x, y, z; |
2241 | int w, h; |
2283 | int w, h; |
2242 | int x1, y1; |
2284 | int x1, y1; |
2243 | |
2285 | |
2244 | if (*data++ != 0) |
2286 | if (*data++ != 0) |
2245 | return; /* version mismatch */ |
2287 | XSRETURN_EMPTY; /* version mismatch */ |
2246 | |
2288 | |
2247 | w = *data++ << 8; w |= *data++; |
2289 | w = *data++ << 8; w |= *data++; |
2248 | h = *data++ << 8; h |= *data++; |
2290 | h = *data++ << 8; h |= *data++; |
2249 | |
2291 | |
2250 | // we need to do this 'cause we don't keep an absolute coord system for rows |
2292 | // we need to do this 'cause we don't keep an absolute coord system for rows |
… | |
… | |
2546 | const_iv (GL_INTENSITY), |
2588 | const_iv (GL_INTENSITY), |
2547 | const_iv (GL_LUMINANCE), |
2589 | const_iv (GL_LUMINANCE), |
2548 | const_iv (GL_LUMINANCE_ALPHA), |
2590 | const_iv (GL_LUMINANCE_ALPHA), |
2549 | const_iv (GL_FLOAT), |
2591 | const_iv (GL_FLOAT), |
2550 | const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), |
2592 | const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), |
|
|
2593 | const_iv (GL_COMPRESSED_ALPHA_ARB), |
|
|
2594 | const_iv (GL_COMPRESSED_LUMINANCE_ARB), |
|
|
2595 | const_iv (GL_COMPRESSED_LUMINANCE_ALPHA_ARB), |
|
|
2596 | const_iv (GL_COMPRESSED_INTENSITY_ARB), |
|
|
2597 | const_iv (GL_COMPRESSED_RGB_ARB), |
|
|
2598 | const_iv (GL_COMPRESSED_RGBA_ARB), |
2551 | const_iv (GL_COMPILE), |
2599 | const_iv (GL_COMPILE), |
2552 | const_iv (GL_PROXY_TEXTURE_1D), |
2600 | const_iv (GL_PROXY_TEXTURE_1D), |
2553 | const_iv (GL_PROXY_TEXTURE_2D), |
2601 | const_iv (GL_PROXY_TEXTURE_2D), |
2554 | const_iv (GL_TEXTURE_1D), |
2602 | const_iv (GL_TEXTURE_1D), |
2555 | const_iv (GL_TEXTURE_2D), |
2603 | const_iv (GL_TEXTURE_2D), |
… | |
… | |
2594 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
2642 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
2595 | const_iv (GL_POINT_SMOOTH_HINT), |
2643 | const_iv (GL_POINT_SMOOTH_HINT), |
2596 | const_iv (GL_LINE_SMOOTH_HINT), |
2644 | const_iv (GL_LINE_SMOOTH_HINT), |
2597 | const_iv (GL_POLYGON_SMOOTH_HINT), |
2645 | const_iv (GL_POLYGON_SMOOTH_HINT), |
2598 | const_iv (GL_GENERATE_MIPMAP_HINT), |
2646 | const_iv (GL_GENERATE_MIPMAP_HINT), |
|
|
2647 | const_iv (GL_TEXTURE_COMPRESSION_HINT), |
2599 | const_iv (GL_FASTEST), |
2648 | const_iv (GL_FASTEST), |
2600 | const_iv (GL_DONT_CARE), |
2649 | const_iv (GL_DONT_CARE), |
2601 | const_iv (GL_NICEST), |
2650 | const_iv (GL_NICEST), |
2602 | const_iv (GL_V2F), |
2651 | const_iv (GL_V2F), |
2603 | const_iv (GL_V3F), |
2652 | const_iv (GL_V3F), |
… | |
… | |
2611 | |
2660 | |
2612 | texture_av = newAV (); |
2661 | texture_av = newAV (); |
2613 | AvREAL_off (texture_av); |
2662 | AvREAL_off (texture_av); |
2614 | } |
2663 | } |
2615 | |
2664 | |
|
|
2665 | void |
|
|
2666 | disable_GL_EXT_blend_func_separate () |
|
|
2667 | CODE: |
|
|
2668 | gl.BlendFuncSeparate = 0; |
|
|
2669 | gl.BlendFuncSeparateEXT = 0; |
|
|
2670 | |
2616 | char * |
2671 | char * |
2617 | gl_vendor () |
2672 | gl_vendor () |
2618 | CODE: |
2673 | CODE: |
2619 | RETVAL = (char *)glGetString (GL_VENDOR); |
2674 | RETVAL = (char *)glGetString (GL_VENDOR); |
2620 | OUTPUT: |
2675 | OUTPUT: |
… | |
… | |
2741 | |
2796 | |
2742 | void glRect (float x1, float y1, float x2, float y2) |
2797 | void glRect (float x1, float y1, float x2, float y2) |
2743 | CODE: |
2798 | CODE: |
2744 | glRectf (x1, y1, x2, y2); |
2799 | glRectf (x1, y1, x2, y2); |
2745 | |
2800 | |
|
|
2801 | void glRect_lineloop (float x1, float y1, float x2, float y2) |
|
|
2802 | CODE: |
|
|
2803 | glBegin (GL_LINE_LOOP); |
|
|
2804 | glVertex2f (x1, y1); |
|
|
2805 | glVertex2f (x2, y1); |
|
|
2806 | glVertex2f (x2, y2); |
|
|
2807 | glVertex2f (x1, y2); |
|
|
2808 | glEnd (); |
|
|
2809 | |
2746 | PROTOTYPES: ENABLE |
2810 | PROTOTYPES: ENABLE |
2747 | |
2811 | |
2748 | void glBegin (int mode) |
2812 | void glBegin (int mode) |
2749 | |
2813 | |
2750 | void glEnd () |
2814 | void glEnd () |
… | |
… | |
2851 | NV x, y, w, h; |
2915 | NV x, y, w, h; |
2852 | SV *draw_x_sv = GvSV (draw_x_gv); |
2916 | SV *draw_x_sv = GvSV (draw_x_gv); |
2853 | SV *draw_y_sv = GvSV (draw_y_gv); |
2917 | SV *draw_y_sv = GvSV (draw_y_gv); |
2854 | SV *draw_w_sv = GvSV (draw_w_gv); |
2918 | SV *draw_w_sv = GvSV (draw_w_gv); |
2855 | SV *draw_h_sv = GvSV (draw_h_gv); |
2919 | SV *draw_h_sv = GvSV (draw_h_gv); |
2856 | SV *hover; |
|
|
2857 | double draw_x, draw_y, draw_w, draw_h; |
2920 | double draw_x, draw_y; |
2858 | |
2921 | |
2859 | if (!SvROK (self)) |
2922 | if (!SvROK (self)) |
2860 | croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); |
2923 | croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); |
2861 | |
2924 | |
2862 | hv = (HV *)SvRV (self); |
2925 | hv = (HV *)SvRV (self); |
… | |
… | |
2890 | { |
2953 | { |
2891 | svp = hv_fetch (hv, "can_hover", sizeof ("can_hover") - 1, 0); |
2954 | svp = hv_fetch (hv, "can_hover", sizeof ("can_hover") - 1, 0); |
2892 | |
2955 | |
2893 | if (svp && SvTRUE (*svp)) |
2956 | if (svp && SvTRUE (*svp)) |
2894 | { |
2957 | { |
2895 | glColor4f (1*0.2f, 0.8*0.2f, 0.5*0.2f, 0.2f); |
2958 | glColor4f (1.0f * 0.2f, 0.8f * 0.2f, 0.5f * 0.2f, 0.2f); |
2896 | glEnable (GL_BLEND); |
2959 | glEnable (GL_BLEND); |
2897 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2960 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2898 | glBegin (GL_QUADS); |
2961 | glBegin (GL_QUADS); |
2899 | glVertex2f (0, 0); |
2962 | glVertex2f (0, 0); |
2900 | glVertex2f (w, 0); |
2963 | glVertex2f (w, 0); |
… | |
… | |
2903 | glEnd (); |
2966 | glEnd (); |
2904 | glDisable (GL_BLEND); |
2967 | glDisable (GL_BLEND); |
2905 | } |
2968 | } |
2906 | } |
2969 | } |
2907 | #if 0 |
2970 | #if 0 |
2908 | if ($ENV{CFPLUS_DEBUG} & 1) { |
2971 | // draw borders, for debugging |
2909 | glPushMatrix; |
2972 | glPushMatrix (); |
2910 | glColor 1, 1, 0, 1; |
2973 | glColor4f (1., 1., 0., 1.); |
2911 | glTranslate 0.375, 0.375; |
2974 | glTranslatef (.5, .5, 0.); |
2912 | glBegin GL_LINE_LOOP; |
2975 | glBegin (GL_LINE_LOOP); |
2913 | glVertex 0 , 0; |
2976 | glVertex2f (0 , 0); |
2914 | glVertex $self->{w} - 1, 0; |
2977 | glVertex2f (w - 1, 0); |
2915 | glVertex $self->{w} - 1, $self->{h} - 1; |
2978 | glVertex2f (w - 1, h - 1); |
2916 | glVertex 0 , $self->{h} - 1; |
2979 | glVertex2f (0 , h - 1); |
2917 | glEnd; |
2980 | glEnd (); |
2918 | glPopMatrix; |
2981 | glPopMatrix (); |
2919 | #CFPlus::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; |
|
|
2920 | } |
|
|
2921 | #endif |
2982 | #endif |
2922 | PUSHMARK (SP); |
2983 | PUSHMARK (SP); |
2923 | XPUSHs (self); |
2984 | XPUSHs (self); |
2924 | PUTBACK; |
2985 | PUTBACK; |
2925 | call_method ("_draw", G_VOID | G_DISCARD); |
2986 | call_method ("_draw", G_VOID | G_DISCARD); |