1 | #include "EXTERN.h" |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
2 | #include "perl.h" |
3 | #include "XSUB.h" |
3 | #include "XSUB.h" |
4 | |
4 | |
5 | #include <string.h> |
5 | #include <string.h> |
|
|
6 | #include <stdio.h> |
6 | |
7 | |
7 | #include <SDL.h> |
8 | #include <SDL.h> |
|
|
9 | #include <SDL_image.h> |
8 | #include <SDL_opengl.h> |
10 | #include <SDL_opengl.h> |
9 | |
11 | |
10 | #include <pango/pango.h> |
12 | #include <pango/pango.h> |
11 | #include <pango/pangofc-fontmap.h> |
13 | #include <pango/pangofc-fontmap.h> |
12 | #include <pango/pangoft2.h> |
14 | #include <pango/pangoft2.h> |
… | |
… | |
82 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
84 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
83 | OUTPUT: |
85 | OUTPUT: |
84 | RETVAL |
86 | RETVAL |
85 | |
87 | |
86 | void |
88 | void |
|
|
89 | glConvolutionParameteri (U32 target, U32 name, I32 value) |
|
|
90 | |
|
|
91 | void |
|
|
92 | glConvolutionFilter2D (U32 target, U32 internalformat, I32 width, I32 height, U32 format, U32 type, char *image) |
|
|
93 | |
|
|
94 | void |
87 | add_font (char *file) |
95 | add_font (char *file) |
88 | CODE: |
96 | CODE: |
89 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
97 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ |
90 | |
98 | |
91 | void |
99 | void |
… | |
… | |
98 | FcPatternDestroy (pattern); |
106 | FcPatternDestroy (pattern); |
99 | pango_context_set_font_description (context, font); |
107 | pango_context_set_font_description (context, font); |
100 | } |
108 | } |
101 | |
109 | |
102 | void |
110 | void |
103 | wait_events (SV *rfd_, SV *wfd_) |
111 | load_image_inline (SV *image_) |
|
|
112 | ALIAS: |
|
|
113 | load_image_file = 1 |
104 | PPCODE: |
114 | PPCODE: |
105 | { |
115 | { |
|
|
116 | STRLEN image_len; |
|
|
117 | char *image = (char *)SvPVbyte (image_, image_len); |
|
|
118 | SDL_Surface *surface, *surface2; |
|
|
119 | SDL_PixelFormat fmt; |
|
|
120 | SDL_RWops *rw = ix |
|
|
121 | ? SDL_RWFromFile (image, "r") |
|
|
122 | : SDL_RWFromConstMem (image, image_len); |
|
|
123 | |
|
|
124 | if (!rw) |
|
|
125 | croak ("load_image: unable to open file"); |
|
|
126 | |
|
|
127 | surface = IMG_Load_RW (rw, 1); |
|
|
128 | if (!surface) |
|
|
129 | croak ("load_image: unable to read file"); |
|
|
130 | |
|
|
131 | fmt.palette = NULL; |
|
|
132 | fmt.BitsPerPixel = 32; |
|
|
133 | fmt.BytesPerPixel = 4; |
|
|
134 | fmt.Rmask = 0x000000ff; |
|
|
135 | fmt.Gmask = 0x0000ff00; |
|
|
136 | fmt.Bmask = 0x00ff0000; |
|
|
137 | fmt.Amask = 0xff000000; |
|
|
138 | fmt.Rloss = 0; |
|
|
139 | fmt.Gloss = 0; |
|
|
140 | fmt.Bloss = 0; |
|
|
141 | fmt.Aloss = 0; |
|
|
142 | fmt.Rshift = 0; |
|
|
143 | fmt.Gshift = 8; |
|
|
144 | fmt.Bshift = 16; |
|
|
145 | fmt.Ashift = 24; |
|
|
146 | fmt.colorkey = 0; |
|
|
147 | fmt.alpha = 0; |
|
|
148 | |
|
|
149 | surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); |
|
|
150 | |
|
|
151 | EXTEND (SP, 5); |
|
|
152 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
|
|
153 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
|
|
154 | SDL_LockSurface (surface2); |
|
|
155 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
|
|
156 | SDL_UnlockSurface (surface2); |
|
|
157 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
|
|
158 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
|
|
159 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_INT_8_8_8_8_REV))); |
|
|
160 | |
|
|
161 | SDL_FreeSurface (surface); |
|
|
162 | SDL_FreeSurface (surface2); |
106 | } |
163 | } |
|
|
164 | |
|
|
165 | void |
|
|
166 | fatal (char *message) |
|
|
167 | CODE: |
|
|
168 | #ifdef WIN32 |
|
|
169 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND); |
|
|
170 | #else |
|
|
171 | fprintf (stderr, "%s\n", message); |
|
|
172 | #endif |
|
|
173 | exit (1); |
107 | |
174 | |
108 | MODULE = CFClient PACKAGE = CFClient::Layout |
175 | MODULE = CFClient PACKAGE = CFClient::Layout |
109 | |
176 | |
110 | CFClient::Layout |
177 | CFClient::Layout |
111 | new (SV *class, int base_height = 10) |
178 | new (SV *class, int base_height = 10) |