[Plib-cvs] plib/src/pw Makefile.am,NONE,1.1 pw.cxx,NONE,1.1 pw.h,NONE,1.1 pwMacOSX.cxx,NONE,1.1 pwWi
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-02-16 02:34:15
|
Update of /cvsroot/plib/plib/src/pw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20530/plib/src/pw Added Files: Makefile.am pw.cxx pw.h pwMacOSX.cxx pwWindows.cxx pwX11.cxx Log Message: Added the 'PW' library. Added some functionality to the ssgAux screen dump facility so you can dump to an array in memory as an alternative to dumping it straight to disk. --- NEW FILE: Makefile.am --- if BUILD_PW lib_LIBRARIES = libplibpw.a include_HEADERS = pw.h libplibpw_a_SOURCES = pw.cxx pwX11.cxx pwWindows.cxx pwMacOSX.cxx INCLUDES = -I$(top_srcdir)/src/util endif EXTRA_DIST = pw.dsp --- NEW FILE: pw.cxx --- #include "ul.h" #include "pw.h" /* This space intentionally left blank */ --- NEW FILE: pw.h --- #ifndef _PW_H_ #define _PW_H_ 1 typedef void pwResizeCB ( int w, int h ) ; typedef void pwExitCB () ; typedef void pwKeybdFunc ( int key, int updown, int x, int y ) ; typedef void pwMouseFunc ( int key, int updown, int x, int y ) ; typedef void pwMousePosFunc ( int x, int y ) ; void pwInit ( int multisample, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb = NULL, pwExitCB *ecb = NULL ) ; void pwInit ( int x, int y, int w, int h, int multisample, char *title, int border, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb = NULL, pwExitCB *ecb = NULL ) ; int pwGetModifiers () ; void pwSwapBuffers () ; void pwGetSize ( int *w, int *h ) ; void pwSetSizeOrigin ( int x, int y, int w, int h ) ; void pwSetSize ( int x, int y ) ; void pwSetOrigin ( int w, int h ) ; void pwSetCursor ( int c ) ; void pwCleanup () ; #define PW_CURSOR_NONE 0 #define PW_CURSOR_RIGHT 1 #define PW_CURSOR_LEFT 2 #define PW_CURSOR_QUERY 3 #define PW_CURSOR_AIM 4 #define PW_CURSOR_CIRCLE 5 #define PW_CURSOR_WAIT 6 #define PW_CURSOR_CROSS 7 #define PW_CURSOR_CUSTOM 8 /* WARNING: These have to be the same as PU_KEY_whatever. */ #define PW_KEY_SPECIAL_OFFSET 256 #define PW_KEY_F1 (1 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F2 (2 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F3 (3 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F4 (4 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F5 (5 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F6 (6 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F7 (7 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F8 (8 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F9 (9 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F10 (10 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F11 (11 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_F12 (12 + PW_KEY_SPECIAL_OFFSET) #define PW_KEY_LEFT (100+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_UP (101+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_RIGHT (102+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_DOWN (103+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_PAGE_UP (104+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_PAGE_DOWN (105+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_HOME (106+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_END (107+ PW_KEY_SPECIAL_OFFSET) #define PW_KEY_INSERT (108+ PW_KEY_SPECIAL_OFFSET) /* The three standard keyboard modifiers */ #define PW_SHIFT 1 #define PW_CTRL 2 #define PW_ALT 4 /* Whether a button has been pressed (DOWN) or released (UP) */ #define PW_DOWN 0 #define PW_UP 1 /* Mouse Buttons */ #define PW_LEFT_BUTTON 0 #define PW_MIDDLE_BUTTON 1 #define PW_RIGHT_BUTTON 2 #endif --- NEW FILE: pwMacOSX.cxx --- #include "ul.h" /* ONLY COMPILE THIS FILE FOR MAC-OS/X SYSTEMS */ #ifdef UL_MAC_OSX #include "pw.h" void defaultExitFunc () { pwCleanup () ; exit ( 0 ) ; } void pwInit ( int multisample, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb, pwExitCB *ecb ) { /* Open a full-screen window here please. */ fprintf ( stderr, "PW: ***** NOT IMPLEMENTED FOR OS-X YET!! *****\n" ) ; } void pwInit ( int x, int y, int w, int h, int multisample, char *title, int border, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb, pwExitCB *ecb ) { /* Open a regular window here please. */ fprintf ( stderr, "PW: ***** NOT IMPLEMENTED FOR OS-X YET!! *****\n" ) ; } void pwGetSize ( int *w, int *h ) { } void pwSetCursor ( int c ) { } void pwSetSize ( int w, int h ) { } void pwSetOrigin ( int x, int y ) { } void pwSetSizeOrigin ( int x, int y, int w, int h ) { } void pwSwapBuffers () { } void pwCleanup () { } #endif --- NEW FILE: pwWindows.cxx --- #include "ul.h" /* ONLY COMPILE THIS FILE FOR MS-WINDOWS SYSTEMS */ #ifdef UL_WIN32 #include "pw.h" void defaultExitFunc () { pwCleanup () ; exit ( 0 ) ; } void pwInit ( int multisample, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb, pwExitCB *ecb ) { /* Open a full-screen window here please. */ fprintf ( stderr, "PW: ***** NOT IMPLEMENTED FOR MS-WINDOWS YET!! *****\n" ) ; } void pwInit ( int x, int y, int w, int h, int multisample, char *title, int border, int num_samples, pwKeybdFunc *kb, pwMouseFunc *ms, pwMousePosFunc *mp, pwResizeCB *rcb, pwExitCB *ecb ) { /* Open a regular window here please. */ fprintf ( stderr, "PW: ***** NOT IMPLEMENTED FOR MS-WINDOWS YET!! *****\n" ) ; } void pwGetSize ( int *w, int *h ) { } void pwSetCursor ( int c ) { } void pwSetSize ( int w, int h ) { } void pwSetOrigin ( int x, int y ) { } void pwSetSizeOrigin ( int x, int y, int w, int h ) { } void pwSwapBuffers () { } void pwCleanup () { } #endif --- NEW FILE: pwX11.cxx --- #include "ul.h" /* ONLY COMPILE THIS FILE FOR GLX/X11 EQUIPPED SYSTEMS */ #ifdef UL_GLX #include "pw.h" #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <assert.h> extern "C" { #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/keysym.h> [...548 lines suppressed...] #ifdef NEED_GAMMA void pwSetGamma ( float g ) { XF86VidModeGamma gamma ; gamma.red = gamma.green = gamma.blue = g ; XF86VidModeSetGamma ( currDisplay, currScreen, & gamma ) ; } #endif void pwCleanup () { glXDestroyContext ( currDisplay, currContext ) ; XDestroyWindow ( currDisplay, currHandle ) ; XFlush ( currDisplay ) ; } #endif |