Skip to content
Newer
Older
100644 742 lines (629 sloc) 14.6 KB
95189b3 Import
paul authored Jul 29, 2007
1 #include "wl_def.h"
2
3 #include <sys/ipc.h>
4 #include <sys/shm.h>
5
6 #include <X11/Xlib.h>
7 #include <X11/keysym.h>
8 #include <X11/Xutil.h>
9 #include <X11/Xos.h>
10 #include <X11/cursorfont.h>
11 #include <X11/keysym.h>
12 #include <X11/keysymdef.h>
13 #include <X11/Xatom.h>
14 #include <X11/extensions/XShm.h>
15
16
17 byte *gfxbuf = NULL;
18 byte *disbuf = NULL;
19
20 Display *dpy;
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
21 myint screen;
95189b3 Import
paul authored Jul 29, 2007
22 Window root, win;
23 XVisualInfo *vi;
24 GC gc;
25 XImage *img;
26 Colormap cmap;
27 Atom wmDeleteWindow;
28
29 XShmSegmentInfo shminfo;
30 XColor clr[256];
31
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
32 myint indexmode;
33 myint shmmode;
95189b3 Import
paul authored Jul 29, 2007
34
35 static byte cpal[768];
36 static word spal[768];
37 static dword ipal[768];
38
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
39 static myint ByteOrder; /* 0 = LSBFirst, 1 = MSBFirst */
40 static myint NeedSwap;
95189b3 Import
paul authored Jul 29, 2007
41
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
42 myint MyDepth;
95189b3 Import
paul authored Jul 29, 2007
43
44 void GetVisual()
45 {
46 XVisualInfo vitemp;
47
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
48 myint i, numVisuals;
95189b3 Import
paul authored Jul 29, 2007
49
50 vitemp.screen = screen;
51 vitemp.depth = 8;
52 vitemp.class = PseudoColor;
53
54 vi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask |
55 VisualClassMask, &vitemp, &numVisuals);
56
57 if (vi && (numVisuals > 0)) {
58 indexmode = 1;
59
60 cmap = XCreateColormap(dpy, root, vi->visual, AllocAll);
61 for (i = 0; i < 256; i++) {
62 clr[i].pixel = i;
63 clr[i].flags = DoRed|DoGreen|DoBlue;
64 }
65
66 return;
67 }
68
69 vitemp.depth = 15;
70 vitemp.class = TrueColor;
71 vitemp.red_mask = 0x7C00;
72 vitemp.green_mask = 0x03E0;
73 vitemp.blue_mask = 0x001F;
74 vi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask |
75 VisualClassMask, &vitemp, &numVisuals);
76
77 if (vi && (numVisuals > 0)) {
78 indexmode = 0;
79
80 cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
81
82 return;
83 }
84
85 vitemp.depth = 16;
86 vitemp.red_mask = 0xF800;
87 vitemp.green_mask = 0x07E0;
88 vitemp.blue_mask = 0x001F;
89 vi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask |
90 VisualClassMask, &vitemp, &numVisuals);
91
92 if (vi && (numVisuals > 0)) {
93 indexmode = 0;
94
95 cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
96
97 return;
98 }
99
100 vitemp.depth = 24;
101 vitemp.red_mask = 0xFF0000;
102 vitemp.green_mask = 0x00FF00;
103 vitemp.blue_mask = 0x0000FF;
104 vi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask |
105 VisualClassMask, &vitemp, &numVisuals);
106
107 if (vi && (numVisuals > 0)) {
108 indexmode = 0;
109
110 cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
111
112 return;
113 }
114
115 vitemp.depth = 32;
116
117 vi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask |
118 VisualClassMask, &vitemp, &numVisuals);
119
120 if (vi && (numVisuals > 0)) {
121 indexmode = 0;
122
123 cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
124
125 return;
126 }
127
128 Quit("No usable visual found!");
129 }
130
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
131 myint GetBPP()
95189b3 Import
paul authored Jul 29, 2007
132 {
133 switch(img->depth) {
134 case 4:
135 break;
136 case 8:
137 if (img->bits_per_pixel == 8)
138 return 8;
139 break;
140 case 15:
141 if (img->bits_per_pixel == 16)
142 return 15;
143 break;
144 case 16:
145 if (img->bits_per_pixel == 16)
146 return 16;
147 break;
148 case 24:
149 if (img->bits_per_pixel == 24)
150 return 24;
151 else
152 return 32;
153 break;
154 case 32:
155 if (img->bits_per_pixel == 32)
156 return 32;
157 break;
158 }
159 fprintf(stderr, "Unsupported combination of depth %d and bits per pixel %d...\n", img->depth, img->bits_per_pixel);
160 fprintf(stderr, "pad = %d, unit = %d, bits = %d, bpl = %d, rgb = %d, depth = %d (%d)\n", img->bitmap_pad, img->bitmap_unit, img->bits_per_pixel, img->bytes_per_line, vi->bits_per_rgb, img->depth, vi->depth);
161 exit(EXIT_FAILURE);
162 }
163
164 void VL_Startup()
165 {
166 XSetWindowAttributes attr;
167 XSizeHints sizehints;
168 XGCValues gcvalues;
169 Pixmap bitmap;
170 Cursor cursor;
171 XColor bg = { 0 };
172 XColor fg = { 0 };
173 char data[8] = { 0x01 };
174
175 char *disp;
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
176 myint attrmask;
95189b3 Import
paul authored Jul 29, 2007
177
178 disp = getenv("DISPLAY");
179
180 dpy = XOpenDisplay(disp);
181
182 if (dpy == NULL) {
183 fprintf(stderr, "Unable to open display %s!\n", XDisplayName(disp));
184 exit(EXIT_FAILURE);
185 }
186
187 screen = DefaultScreen(dpy);
188
189 root = RootWindow(dpy, screen);
190
191 GetVisual();
192
193 attr.colormap = cmap;
194 attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask
195 | FocusChangeMask | StructureNotifyMask;
196 attrmask = CWColormap | CWEventMask;
197
079a926 Add Embedded mode.
paul authored Aug 4, 2007
198 win = XCreateWindow(dpy, root, 0, 0, vwidth, vheight, 0, CopyFromParent,
95189b3 Import
paul authored Jul 29, 2007
199 InputOutput, vi->visual, attrmask, &attr);
200
201 if (win == None) {
202 Quit("Unable to create window!");
203 }
204
205
206 gcvalues.foreground = BlackPixel(dpy, screen);
207 gcvalues.background = WhitePixel(dpy, screen);
208 gc = XCreateGC(dpy, win, GCForeground | GCBackground, &gcvalues);
209
079a926 Add Embedded mode.
paul authored Aug 4, 2007
210 sizehints.min_width = vwidth;
211 sizehints.min_height = vheight;
212 sizehints.max_width = vwidth;
213 sizehints.max_height = vheight;
214 sizehints.base_width = vwidth;
215 sizehints.base_height = vheight;
95189b3 Import
paul authored Jul 29, 2007
216 sizehints.flags = PMinSize | PMaxSize | PBaseSize;
217
218 XSetWMProperties(dpy, win, NULL, NULL, _argv, _argc, &sizehints, None, None);
219
220 XStoreName(dpy, win, GAMENAME);
221 XSetIconName(dpy, win, GAMENAME);
222
223 wmDeleteWindow = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
224 XSetWMProtocols(dpy, win, &wmDeleteWindow, 1);
225
226 bitmap = XCreateBitmapFromData(dpy, win, data, 8, 8);
227 cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &fg, &bg, 0, 0);
228 XDefineCursor(dpy, win, cursor);
229
230 shmmode = 0;
231
e4d1f64 Fix compile failure.
paul authored Aug 6, 2007
232 if (
233 #ifndef EMBEDDED
234 !MS_CheckParm("noshm") &&
235 #endif
236 (XShmQueryExtension(dpy) == True)) {
95189b3 Import
paul authored Jul 29, 2007
237 img = XShmCreateImage(dpy, vi->visual, vi->depth, ZPixmap,
079a926 Add Embedded mode.
paul authored Aug 4, 2007
238 NULL, &shminfo, vwidth, vheight);
95189b3 Import
paul authored Jul 29, 2007
239
240 shminfo.shmid = shmget(IPC_PRIVATE, img->bytes_per_line * img->height, IPC_CREAT | 0777);
241 shminfo.shmaddr = img->data = shmat(shminfo.shmid, 0, 0);
242 shminfo.readOnly = False;
243 disbuf = (byte *)img->data;
244
245 if (indexmode)
246 gfxbuf = disbuf;
247 else
248 gfxbuf = malloc(vwidth * vheight * 1);
249
250 if (XShmAttach(dpy, &shminfo) == True) {
251 printf("Using XShm Extension...\n");
252 shmmode = 1;
253
254 shmctl(shminfo.shmid, IPC_RMID, 0);
255 } else {
256 printf("Error with XShm...\n");
257 }
258 }
259
260 if (img == NULL) {
261 XImage *imgtmp;
262 char *gb;
263
264 printf("Falling back on XImage...\n");
265
266
267 gb = (char *)malloc(320);
268 imgtmp = XCreateImage(dpy, vi->visual, vi->depth, ZPixmap, 0,
269 gb, 16, 1, 8, 16*4);
270
271 if (gfxbuf == NULL)
272 gfxbuf = malloc(vwidth * vheight * 1);
273 if (indexmode)
274 disbuf = gfxbuf;
275 else
276 disbuf = malloc(vwidth * vheight * (imgtmp->bits_per_pixel / 8));
277
278 img = XCreateImage(dpy, vi->visual, vi->depth, ZPixmap, 0,
279 (char *)disbuf, vwidth, vheight, 8, 0 * (imgtmp->bits_per_pixel / 8));
280
281 if (img == NULL) {
282 Quit("XCreateImage returned NULL");
283 }
284
285 XInitImage(img);
286 XDestroyImage(imgtmp);
287 }
288
289 MyDepth = GetBPP();
290
291 #if BYTE_ORDER == BIG_ENDIAN
292 ByteOrder = 1;
293 #else
294 ByteOrder = 0;
295 #endif
296
297 NeedSwap = (ByteOrder != img->byte_order);
298
299 XMapRaised(dpy, win);
300 }
301
302 void VL_Shutdown()
303 {
304 if ( !shmmode && (gfxbuf != NULL) ) {
305 free(gfxbuf);
306 gfxbuf = NULL;
307 }
308
309 if ( shmmode && !indexmode && (gfxbuf != NULL) ) {
310 free(gfxbuf);
311 gfxbuf = NULL;
312 }
313
314 if (shmmode) {
315 XShmDetach(dpy, &shminfo);
316 XDestroyImage(img);
317 shmdt(shminfo.shmaddr);
318 shmctl(shminfo.shmid, IPC_RMID, 0);
319 } else if ( (indexmode == 0) && (disbuf != NULL) ) {
320 free(disbuf);
321 disbuf = NULL;
322 }
323 }
324
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
325 void VL_WaitVBL(myint vbls)
95189b3 Import
paul authored Jul 29, 2007
326 {
327 /* hack - but it works for me */
328 long last = get_TimeCount() + vbls;
329 while (last > get_TimeCount()) ;
330 }
331
332 void VW_UpdateScreen()
333 {
334 dword *ptri;
335 word *ptrs;
336 byte *ptrb;
079a926 Add Embedded mode.
paul authored Aug 4, 2007
337 int size;
95189b3 Import
paul authored Jul 29, 2007
338
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
339 myint i;
95189b3 Import
paul authored Jul 29, 2007
340
e2c2714 Precompile all sprites.
paul authored Aug 12, 2007
341 #if 0
342 for (i = 0; i < 64; i++) {
343 gfxbuf[i] = i;
344 gfxbuf[i*128 + 1] = i;
345 gfxbuf[i*128 + 2] = i;
346 gfxbuf[i*128 + 3] = i;
347 gfxbuf[i*128 + 4] = i + 0x40;
348 gfxbuf[i*128 + 5] = i + 0x40;
349 gfxbuf[i*128 + 6] = i + 0x40;
350 gfxbuf[i*128 + 7] = i + 0x40;
351 gfxbuf[i*128 + 8] = i + 0x80;
352 gfxbuf[i*128 + 9] = i + 0x80;
353 gfxbuf[i*128 + 10] = i + 0x80;
354 gfxbuf[i*128 + 11] = i + 0x80;
355 gfxbuf[i*128 + 12] = i + 0xc0;
356 gfxbuf[i*128 + 13] = i + 0xc0;
357 gfxbuf[i*128 + 14] = i + 0xc0;
358 gfxbuf[i*128 + 15] = i + 0xc0;
359 }
360 #endif
361 #if 0
362 for (i = 0; i < 128 * 64; i++) {
363 gfxbuf[i] = 0x1f - pal4bit[gfxbuf[i]];
364 }
365 #endif
079a926 Add Embedded mode.
paul authored Aug 4, 2007
366 size = vwidth * vheight;
95189b3 Import
paul authored Jul 29, 2007
367 if (indexmode == 0) {
368 switch(MyDepth) {
369 case 15:
370 case 16:
371 ptrs = (word *)disbuf;
372
079a926 Add Embedded mode.
paul authored Aug 4, 2007
373 for (i = 0; i < size; i++) {
95189b3 Import
paul authored Jul 29, 2007
374 *ptrs = spal[gfxbuf[i]];
375 ptrs++;
376 }
377 break;
378 case 24: /* Endian Safe? Untested. */
379 ptrb = disbuf;
079a926 Add Embedded mode.
paul authored Aug 4, 2007
380 for (i = 0; i < size; i++) {
95189b3 Import
paul authored Jul 29, 2007
381 *ptrb = cpal[gfxbuf[i]*3+2] << 2; ptrb++;
382 *ptrb = cpal[gfxbuf[i]*3+1] << 2; ptrb++;
383 *ptrb = cpal[gfxbuf[i]*3+0] << 2; ptrb++;
384 }
385 break;
386 case 32:
387 ptri = (dword *)disbuf;
388
079a926 Add Embedded mode.
paul authored Aug 4, 2007
389 for (i = 0; i < size; i++) {
95189b3 Import
paul authored Jul 29, 2007
390 *ptri = ipal[gfxbuf[i]];
391 ptri++;
392 }
393 break;
394 default:
395 break;
396 /* ... */
397 }
398 }
399
400 if (shmmode)
079a926 Add Embedded mode.
paul authored Aug 4, 2007
401 XShmPutImage(dpy, win, gc, img, 0, 0, 0, 0, vwidth, vheight, False);
95189b3 Import
paul authored Jul 29, 2007
402 else
079a926 Add Embedded mode.
paul authored Aug 4, 2007
403 XPutImage(dpy, win, gc, img, 0, 0, 0, 0, vwidth, vheight);
95189b3 Import
paul authored Jul 29, 2007
404 }
405
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
406 void keyboard_handler(myint code, myint press);
407 static myint XKeysymToScancode(KeySym keysym);
95189b3 Import
paul authored Jul 29, 2007
408
409 static void HandleXEvents()
410 {
411 XEvent event;
412
413 if (XPending(dpy)) {
414 do {
415 XNextEvent(dpy, &event);
416 switch(event.type) {
417 case KeyPress:
418 keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 1);
419 break;
420 case KeyRelease:
421 keyboard_handler(XKeysymToScancode(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)), 0);
422 break;
423 case Expose:
424 VW_UpdateScreen();
425 break;
426 case ClientMessage:
427 if (event.xclient.data.l[0] == wmDeleteWindow)
428 Quit(NULL);
429 break;
430 case ConfigureNotify:
431 break;
432 case FocusIn:
433 break;
434 case FocusOut:
435 break;
436 default:
437 break;
438 }
439 } while (XPending(dpy));
440 }
441 }
442
443 /* ======================================================================== */
444
445 /*
446 =================
447 =
448 = VL_SetPalette
449 =
450 =================
451 */
452
453 void VL_SetPalette(const byte *palette)
454 {
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
455 myint i;
95189b3 Import
paul authored Jul 29, 2007
456
457 VL_WaitVBL(1);
458
459 if (indexmode) {
460 for (i = 0; i < 256; i++) {
461 clr[i].red = palette[i*3+0] << 10;
462 clr[i].green = palette[i*3+1] << 10;
463 clr[i].blue = palette[i*3+2] << 10;
464 }
465 XStoreColors(dpy, cmap, clr, 256);
466 } else {
467 memcpy(cpal, palette, 768);
468 for (i = 0; i < 256; i++) {
469 /* TODO: this should really use the visual for creating the pixel */
470 switch(MyDepth) {
471 case 8:
472 break;
473 case 15: /* Endian Safe? Untested. */
474 spal[i] = ((palette[i*3+0] >> 1) << 10) | ((palette[i*3+1] >> 1) << 5) | ((palette[i*3+2] >> 1) << 0);
475 if (NeedSwap)
476 spal[i] = SwapInt16(spal[i]);
477 break;
478 case 16:
479 spal[i] = ((palette[i*3+0] >> 1) << 11) | ((palette[i*3+1] >> 0) << 5) | ((palette[i*3+2] >> 1) << 0);
480 if (NeedSwap)
481 spal[i] = SwapInt16(spal[i]);
482 break;
483 case 32:
484 ipal[i] = (palette[i*3+0] << 18) | (palette[i*3+1] << 10) | (palette[i*3+2] << 2);
485 if (NeedSwap)
486 ipal[i] = SwapInt32(ipal[i]);
487 break;
488 }
489 }
490 VW_UpdateScreen();
491 }
492 }
493
494 /*
495 =================
496 =
497 = VL_GetPalette
498 =
499 =================
500 */
501
502 void VL_GetPalette(byte *palette)
503 {
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
504 myint i;
95189b3 Import
paul authored Jul 29, 2007
505
506 if (indexmode) {
507 for (i = 0; i < 256; i++) {
508 palette[i*3+0] = clr[i].red >> 10;
509 palette[i*3+1] = clr[i].green >> 10;
510 palette[i*3+2] = clr[i].blue >> 10;
511 }
512 } else {
513 memcpy(palette, cpal, 768);
514 }
515 }
516
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
517 myint main(myint argc, char *argv[])
95189b3 Import
paul authored Jul 29, 2007
518 {
079a926 Add Embedded mode.
paul authored Aug 4, 2007
519 #ifdef EMBEDDED
520 vwidth = 128;
521 vheight = 96;
522 #else
95189b3 Import
paul authored Jul 29, 2007
523 vwidth = 320;
524 vheight = 200;
079a926 Add Embedded mode.
paul authored Aug 4, 2007
525 #endif
95189b3 Import
paul authored Jul 29, 2007
526
527 return WolfMain(argc, argv);
528 }
529
530 /*
531 ==========================
532 =
533 = Quit
534 =
535 ==========================
536 */
537
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
538 void DisplayTextSplash(const byte *text, myint l);
95189b3 Import
paul authored Jul 29, 2007
539
540 void Quit(const char *error)
541 {
542 memptr screen = NULL;
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
543 myint l = 0;
95189b3 Import
paul authored Jul 29, 2007
544
51805cf Localize grsegs.
paul authored Aug 2, 2007
545 #ifdef ENABLE_QUITMSG
95189b3 Import
paul authored Jul 29, 2007
546 if (!error || !*error) {
547 CA_CacheGrChunk(ORDERSCREEN);
548 screen = grsegs[ORDERSCREEN];
549 l = 24;
550 WriteConfig();
551 } else if (error) {
552 CA_CacheGrChunk(ERRORSCREEN);
553 screen = grsegs[ERRORSCREEN];
554 l = 7;
555 }
51805cf Localize grsegs.
paul authored Aug 2, 2007
556 #endif
95189b3 Import
paul authored Jul 29, 2007
557
558 ShutdownId();
559
412945d Freeze file extension.
paul authored Aug 12, 2007
560 #ifndef EMBEDDED
95189b3 Import
paul authored Jul 29, 2007
561 if (screen) {
562 DisplayTextSplash(screen, l);
563 }
412945d Freeze file extension.
paul authored Aug 12, 2007
564 #endif
95189b3 Import
paul authored Jul 29, 2007
565
566 if (error && *error) {
567 fprintf(stderr, "Quit: %s\n", error);
568 exit(EXIT_FAILURE);
569 }
570 exit(EXIT_SUCCESS);
571 }
572
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
573 static myint XKeysymToScancode(KeySym keysym)
95189b3 Import
paul authored Jul 29, 2007
574 {
575 switch (keysym) {
576 case XK_1:
577 return sc_1;
578 case XK_2:
579 return sc_2;
580 case XK_3:
581 return sc_3;
582 case XK_4:
583 return sc_4;
584 case XK_5:
585 return sc_5;
586 case XK_6:
587 return sc_6;
588 case XK_a:
589 return sc_A;
590 case XK_b:
591 return sc_B;
592 case XK_c:
593 return sc_C;
594 case XK_d:
595 return sc_D;
596 case XK_g:
597 return sc_G;
598 case XK_h:
599 return sc_H;
600 case XK_i:
601 return sc_I;
602 case XK_l:
603 return sc_L;
604 case XK_m:
605 return sc_M;
606 case XK_n:
607 return sc_N;
608 case XK_q:
609 return sc_Q;
610 case XK_s:
611 return sc_S;
612 case XK_t:
613 return sc_T;
614 case XK_y:
615 return sc_Y;
616 case XK_F1:
617 return sc_F1;
618 case XK_F2:
619 return sc_F2;
620 case XK_F3:
621 return sc_F3;
622 case XK_F10:
623 return sc_F10;
624 case XK_F11:
625 return sc_F11;
626 case XK_F12:
627 return sc_F12;
628 case XK_Left:
629 case XK_KP_Left:
630 return sc_LeftArrow;
631 case XK_Right:
632 case XK_KP_Right:
633 return sc_RightArrow;
634 case XK_Up:
635 case XK_KP_Up:
636 return sc_UpArrow;
637 case XK_Down:
638 case XK_KP_Down:
639 return sc_DownArrow;
640 case XK_Control_L:
641 case XK_Control_R:
642 return sc_Control;
643 case XK_Alt_L:
644 case XK_Alt_R:
645 return sc_Alt;
646 case XK_Shift_L:
647 return sc_LShift;
648 case XK_Shift_R:
649 return sc_RShift;
650 case XK_Escape:
651 return sc_Escape;
652 case XK_space:
653 case XK_KP_Space:
654 return sc_Space;
655 case XK_KP_Enter:
656 case XK_Return:
657 return sc_Enter;
658 case XK_Tab:
659 return sc_Tab;
660 case XK_BackSpace:
661 return sc_BackSpace;
662 case XK_Pause:
663 return 0xE1;
664 default:
665 printf("unknown: %s\n", XKeysymToString(keysym));
666 return sc_None;
667 }
668 }
669
670 byte IN_MouseButtons()
671 {
672 return 0;
673 }
674
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
675 void IN_GetMouseDelta(myint *dx, myint *dy)
95189b3 Import
paul authored Jul 29, 2007
676 {
677 }
678
46047c3 Embedded port.
paul authored Aug 5, 2007
679 #ifdef ENABLE_JOYSTICK
95189b3 Import
paul authored Jul 29, 2007
680 /*
681 ===================
682 =
683 = IN_JoyButtons
684 =
685 ===================
686 */
687
688 byte IN_JoyButtons()
689 {
690 return 0;
691 }
692
693 ///////////////////////////////////////////////////////////////////////////
694 //
695 // IN_GetJoyAbs() - Reads the absolute position of the specified joystick
696 //
697 ///////////////////////////////////////////////////////////////////////////
698 void IN_GetJoyAbs(word joy,word *xp,word *yp)
699 {
700 *xp = 0;
701 *yp = 0;
702 }
703
704 ///////////////////////////////////////////////////////////////////////////
705 //
706 // INL_GetJoyDelta() - Returns the relative movement of the specified
707 // joystick (from +/-127)
708 //
709 ///////////////////////////////////////////////////////////////////////////
0933d39 Reduce object memory use.
paul authored Jul 29, 2007
710 void INL_GetJoyDelta(word joy,myint *dx,myint *dy)
95189b3 Import
paul authored Jul 29, 2007
711 {
712 *dx = 0;
713 *dy = 0;
714 }
715
716 ///////////////////////////////////////////////////////////////////////////
717 //
718 // INL_GetJoyButtons() - Returns the button status of the specified
719 // joystick
720 //
721 ///////////////////////////////////////////////////////////////////////////
722 word INL_GetJoyButtons(word joy)
723 {
724 return 0;
725 }
726
727 ///////////////////////////////////////////////////////////////////////////
728 //
729 // IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()
730 // to set up scaling values
731 //
732 ///////////////////////////////////////////////////////////////////////////
733 void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
734 {
735 }
46047c3 Embedded port.
paul authored Aug 5, 2007
736 #endif
95189b3 Import
paul authored Jul 29, 2007
737
738 void INL_Update()
739 {
740 HandleXEvents();
741 }
Something went wrong with that request. Please try again.