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.52 by root, Wed Apr 19 21:17:15 2006 UTC vs.
Revision 1.54 by root, Wed Apr 19 23:37:48 2006 UTC

386 386
387 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); 387 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
388 SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15); 388 SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15);
389 SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0); 389 SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0);
390 390
391 SDL_EnableUNICODE (1);
392 SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
393
391 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); 394 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL);
392 395
393 if (m && m != (SDL_Rect **)-1) 396 if (m && m != (SDL_Rect **)-1)
394 while (*m) 397 while (*m)
395 { 398 {
410 ); 413 );
411 SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); 414 SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+");
412 OUTPUT: 415 OUTPUT:
413 RETVAL 416 RETVAL
414 417
415int 418void
416Mix_VolumeMusic (int newvol = -1) 419SDL_GL_SwapBuffers ()
420
421void
422SDL_PollEvent ()
423 PPCODE:
424{
425 SDL_Event ev;
426
427 while (SDL_PollEvent (&ev))
428 {
429 HV *hv = newHV ();
430 hv_store (hv, "type", 4, newSViv (ev.type), 0);
431 switch (ev.type)
432 {
433 case SDL_KEYDOWN:
434 case SDL_KEYUP:
435 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
436 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
437 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0);
438 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
439 break;
440
441 case SDL_ACTIVEEVENT:
442 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
443 hv_store (hv, "state", 5, newSViv (ev.active.state), 0);
444 break;
445
446 case SDL_MOUSEMOTION:
447 hv_store (hv, "state", 5, newSViv (ev.motion.state), 0);
448 hv_store (hv, "x", 1, newSViv (ev.motion.x), 0);
449 hv_store (hv, "y", 1, newSViv (ev.motion.y), 0);
450 hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0);
451 hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0);
452 break;
453
454 case SDL_MOUSEBUTTONDOWN:
455 case SDL_MOUSEBUTTONUP:
456 hv_store (hv, "button", 6, newSViv (ev.button.button), 0);
457 hv_store (hv, "state", 5, newSViv (ev.button.state), 0);
458 hv_store (hv, "x", 1, newSViv (ev.button.x), 0);
459 hv_store (hv, "y", 1, newSViv (ev.button.y), 0);
460 }
461
462 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
463 }
464}
417 465
418int 466int
419Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) 467Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512)
420 468
421void 469void
1223 CODE: 1271 CODE:
1224 RETVAL = Mix_PlayMusic (self, loops); 1272 RETVAL = Mix_PlayMusic (self, loops);
1225 OUTPUT: 1273 OUTPUT:
1226 RETVAL 1274 RETVAL
1227 1275
1276MODULE = CFClient PACKAGE = CFClient::OpenGL
1277
1278BOOT:
1279{
1280 HV *stash = gv_stashpv ("CFClient::OpenGL", 1);
1281 static const struct {
1282 const char *name;
1283 IV iv;
1284 } *civ, const_iv[] = {
1285# define const_iv(name) { # name, (IV)name }
1286 const_iv (GL_COLOR_MATERIAL),
1287 const_iv (GL_SMOOTH),
1288 const_iv (GL_FLAT),
1289 const_iv (GL_BLEND),
1290 const_iv (GL_AND),
1291 const_iv (GL_SRC_ALPHA),
1292 const_iv (GL_ONE_MINUS_SRC_ALPHA),
1293 const_iv (GL_RGB),
1294 const_iv (GL_RGBA),
1295 const_iv (GL_UNSIGNED_BYTE),
1296 const_iv (GL_ALPHA4),
1297 const_iv (GL_ALPHA),
1298 const_iv (GL_FLOAT),
1299 const_iv (GL_UNSIGNED_INT_8_8_8_8_REV),
1300 const_iv (GL_COMPILE),
1301 const_iv (GL_TEXTURE_1D),
1302 const_iv (GL_TEXTURE_2D),
1303 const_iv (GL_TEXTURE_ENV),
1304 const_iv (GL_TEXTURE_MAG_FILTER),
1305 const_iv (GL_TEXTURE_MIN_FILTER),
1306 const_iv (GL_TEXTURE_ENV_MODE),
1307 const_iv (GL_TEXTURE_WRAP_S),
1308 const_iv (GL_TEXTURE_WRAP_T),
1309 const_iv (GL_CLAMP),
1310 const_iv (GL_REPEAT),
1311 const_iv (GL_NEAREST),
1312 const_iv (GL_LINEAR),
1313 const_iv (GL_MODULATE),
1314 const_iv (GL_REPLACE),
1315 const_iv (GL_COLOR_BUFFER_BIT),
1316 const_iv (GL_PROJECTION),
1317 const_iv (GL_MODELVIEW),
1318 const_iv (GL_COLOR_LOGIC_OP),
1319 const_iv (GL_CONVOLUTION_2D),
1320 const_iv (GL_CONVOLUTION_BORDER_MODE),
1321 const_iv (GL_CONSTANT_BORDER),
1322 const_iv (GL_LINES),
1323 const_iv (GL_QUADS),
1324 const_iv (GL_PERSPECTIVE_CORRECTION_HINT),
1325 const_iv (GL_FASTEST),
1326# undef const_iv
1327 };
1328
1329 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1330 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1331}
1332
1333int glGetError ()
1334
1335void glClear (int mask)
1336
1337void glClearColor (float r, float g, float b, float a = 1.0)
1338 PROTOTYPE: @
1339
1340void glEnable (int cap)
1341
1342void glDisable (int cap)
1343
1344void glShadeModel (int mode)
1345
1346void glHint (int target, int mode)
1347
1348void glBlendFunc (int sfactor, int dfactor)
1349
1350void glLogicOp (int opcode)
1351
1352void glMatrixMode (int mode)
1353
1354void glPushMatrix ()
1355
1356void glPopMatrix ()
1357
1358void glLoadIdentity ()
1359
1360void glOrtho (double left, double right, double bottom, double top, double near, double far)
1361
1362void glViewport (int x, int y, int width, int height)
1363
1364void glTranslate (float x, float y, float z = 0.)
1365 CODE:
1366 glTranslatef (x, y, z);
1367
1368void glScale (float x, float y, float z)
1369 CODE:
1370 glScalef (x, y, z);
1371
1372void glRotate (float angle, float x, float y, float z)
1373 CODE:
1374 glRotatef (angle, x, y, z);
1375
1376void glBegin (int mode)
1377
1378void glEnd ()
1379
1380void glColor (float r, float g, float b, float a = 1.0)
1381 PROTOTYPE: @
1382 CODE:
1383 glColor4f (r, g, b, a);
1384
1385void glVertex (float x, float y, float z = 0.)
1386 CODE:
1387 glVertex3f (x, y, z);
1388
1389void glTexCoord (float s, float t)
1390 CODE:
1391 glTexCoord2f (s, t);
1392
1393void glTexEnv (int target, int pname, float param)
1394 CODE:
1395 glTexEnvf (target, pname, param);
1396
1397void glTexParameter (int target, int pname, float param)
1398 CODE:
1399 glTexParameterf (target, pname, param);
1400
1401void glBindTexture (int target, int name)
1402
1403void glConvolutionParameter (int target, int pname, float params)
1404 CODE:
1405 glConvolutionParameterf (target, pname, params);
1406
1407void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data)
1408
1409void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data)
1410
1411void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
1412
1413int glGenTexture ()
1414 CODE:
1415{
1416 GLuint name;
1417 glGenTextures (1, &name);
1418 RETVAL = name;
1419}
1420 OUTPUT:
1421 RETVAL
1422
1423void glDeleteTexture (int name)
1424 CODE:
1425{
1426 GLuint name_ = name;
1427 glDeleteTextures (1, &name_);
1428}
1429
1430int glGenList ()
1431 CODE:
1432 RETVAL = glGenLists (1);
1433 OUTPUT:
1434 RETVAL
1435
1436void glDeleteList (int list)
1437 CODE:
1438 glDeleteLists (list, 1);
1439
1440void glNewList (int list, int mode = GL_COMPILE)
1441
1442void glEndList ()
1443
1444void glCallList (int list)
1445

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines