[Plib-cvs] plib/src/pui puFLTK.h,NONE,1.1 puGLUT.h,NONE,1.1 puNative.h,NONE,1.1 puSDL.h,NONE,1.1 Mak
Brought to you by:
sjbaker
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7916 Modified Files: Makefile.am pu.cxx pu.h puFont.cxx puLocal.h puMenuBar.cxx pui.dsp Added Files: puFLTK.h puGLUT.h puNative.h puSDL.h Log Message: Removed dependence on the GLUT library. --- NEW FILE: puFLTK.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puFLTK.h,v 1.1 2004/02/16 13:49:03 stromberg Exp $ */ #ifndef _PU_FLTK_H_ #define _PU_FLTK_H_ #ifndef PU_USE_FLTK # define PU_USE_FLTK #endif #include "pu.h" #include <FL/Fl_Gl_Window.H> inline int puGetWindowFLTK () { return (int) Fl_Window::current () ; } inline void puSetWindowFLTK ( int window ) { ((Fl_Gl_Window *) window) -> make_current () ; } inline void puGetWindowSizeFLTK ( int *width, int *height ) { Fl_Window * window = Fl_Window::current () ; *width = window->w() ; *height = window->h() ; } inline void puSetWindowSizeFLTK ( int width, int height ) { Fl_Window * window = Fl_Window::current () ; window -> resize ( window->x(), window->y(), width, height ) ; } inline void puInitFLTK () { puSetWindowFuncs ( puGetWindowFLTK, puSetWindowFLTK, puGetWindowSizeFLTK, puSetWindowSizeFLTK ) ; puRealInit () ; } #endif --- NEW FILE: puGLUT.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puGLUT.h,v 1.1 2004/02/16 13:49:03 stromberg Exp $ */ #ifndef _PU_GLUT_H_ #define _PU_GLUT_H_ #ifndef PU_USE_GLUT # define PU_USE_GLUT #endif #include "pu.h" #ifdef UL_MAC_OSX # include <GLUT/glut.h> #else # include <GL/glut.h> #endif inline int puGetWindowGLUT() { return glutGetWindow () ; } inline void puSetWindowGLUT ( int window ) { glutSetWindow ( window ) ; } inline void puGetWindowSizeGLUT ( int *width, int *height ) { *width = glutGet ( (GLenum) GLUT_WINDOW_WIDTH ) ; *height = glutGet ( (GLenum) GLUT_WINDOW_HEIGHT ) ; } inline void puSetWindowSizeGLUT ( int width, int height ) { glutReshapeWindow ( width, height ) ; } inline void puInitGLUT () { puSetWindowFuncs ( puGetWindowGLUT, puSetWindowGLUT, puGetWindowSizeGLUT, puSetWindowSizeGLUT ) ; puRealInit () ; } #endif --- NEW FILE: puNative.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...62 lines suppressed...] GLint vp[4] ; glGetIntegerv ( GL_VIEWPORT, vp ) ; *width = vp[0] + vp[2] ; *height = vp[1] + vp[3] ; // Note: puSetOpenGLState calls glViewport(0, 0, w, h). #endif } inline void puInitNative () { puSetWindowFuncs ( puGetWindowNative, NULL, puGetWindowSizeNative, NULL ) ; puRealInit () ; } #endif --- NEW FILE: puSDL.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puSDL.h,v 1.1 2004/02/16 13:49:03 stromberg Exp $ */ #ifndef _PU_SDL_H_ #define _PU_SDL_H_ #ifndef PU_USE_SDL # define PU_USE_SDL #endif #include "pu.h" #include <SDL/SDL.h> inline int puGetWindowSDL () { return 0; } inline void puGetWindowSizeSDL ( int *width, int *height ) { SDL_Surface *display = SDL_GetVideoSurface () ; *width = display->w ; *height = display->h ; } inline void puInitSDL () { puSetWindowFuncs ( puGetWindowSDL, NULL, puGetWindowSizeSDL, NULL ) ; puRealInit () ; } #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/pui/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Makefile.am 27 Sep 2002 23:53:52 -0000 1.19 +++ Makefile.am 16 Feb 2004 13:49:02 -0000 1.20 @@ -2,7 +2,7 @@ lib_LIBRARIES = libplibpu.a -include_HEADERS = pu.h +include_HEADERS = pu.h puGLUT.h puFLTK.h puSDL.h puNative.h libplibpu_a_SOURCES = \ pu.cxx puBox.cxx puButton.cxx puButtonBox.cxx \ @@ -15,11 +15,9 @@ puFileSelector.cxx puComboBox.cxx puSelectBox.cxx puRange.cxx \ puSpinBox.cxx puScrollBar.cxx puInputBase.cxx -INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/fnt -INCLUDES += -I$(top_srcdir)/src/util +AM_CPPFLAGS = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/fnt +AM_CPPFLAGS += -I$(top_srcdir)/src/util -DPU_USE_NONE endif EXTRA_DIST = pui.dsp - - Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- pu.cxx 16 Feb 2004 02:26:28 -0000 1.65 +++ pu.cxx 16 Feb 2004 13:49:03 -0000 1.66 @@ -23,49 +23,80 @@ #include "puLocal.h" -#if defined(UL_MACINTOSH) +#if defined(UL_AGL) # include <agl.h> -#elif defined(UL_MAC_OSX) +#elif defined(UL_CGL) # include <OpenGL/CGLCurrent.h> -#elif defined(UL_WIN32) - /* Nothing */ [...203 lines suppressed...] - - return glutGet ( (GLenum) GLUT_WINDOW_HEIGHT ) ; -} - - -int puGetWindowWidth ( void ) +void puSetResizeMode ( int mode ) { - if ( openGLSize ) - return puWindowWidth ; - - return glutGet ( (GLenum) GLUT_WINDOW_WIDTH ) ; + static int last = 0; + if ( last == 0 && mode != 0 ) + ulSetError ( UL_WARNING, "puSetResizeMode is deprecated!" ) ; + last = mode ; } - -#endif - Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 --- pu.h 16 Feb 2004 02:26:28 -0000 1.142 +++ pu.h 16 Feb 2004 13:49:03 -0000 1.143 @@ -31,11 +31,6 @@ Configuration */ -#ifndef PU_NOT_USING_GLUT -#define _PU_USE_GLUT 1 -#define _PU_USE_GLUT_FONTS 1 -#endif - #define PU_NOBUTTON -1 #define PU_LEFT_BUTTON 0 #define PU_MIDDLE_BUTTON 1 [...153 lines suppressed...] + + +// Roll out the code and define puInit + +#if defined(PU_USE_GLUT) +# include "puGLUT.h" +# define puInit puInitGLUT +#elif defined(PU_USE_FLTK) +# include "puFLTK.h" +# define puInit puInitFLTK +#elif defined(PU_USE_SDL) +# include "puSDL.h" +# define puInit puInitSDL +#elif defined(PU_USE_NATIVE) +# include "puNative.h" +# define puInit puInitNative #endif + +#endif Index: puFont.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFont.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- puFont.cxx 19 Sep 2002 23:32:58 -0000 1.22 +++ puFont.cxx 16 Feb 2004 13:49:03 -0000 1.23 @@ -24,47 +24,21 @@ #include "puLocal.h" -#ifdef _PU_USE_GLUT_FONTS - -/* - A set of puFont's to implement the GLUT BitMap set... -*/ - -puFont PUFONT_8_BY_13 ( GLUT_BITMAP_8_BY_13 ) ; -puFont PUFONT_9_BY_15 ( GLUT_BITMAP_9_BY_15 ) ; [...140 lines suppressed...] - - while ( *str != '\0' ) - { - if (*str == '\n') - { - y -= getStringHeight () + getStringDescender () ; - glRasterPos2f( (float)x, (float)y ) ; - } - else - glutBitmapCharacter ( glut_font_handle, *str ) ; - - str++ ; - } - return ; - } -#endif // #ifdef _PU_USE_GLUT_FONTS - if ( fnt_font_handle != NULL ) { sgVec3 curpos ; Index: puLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLocal.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- puLocal.h 30 Nov 2002 00:41:49 -0000 1.12 +++ puLocal.h 16 Feb 2004 13:49:03 -0000 1.13 @@ -24,29 +24,6 @@ #include "pu.h" -/* - Include GLUT - */ - -#ifndef PU_NOT_USING_GLUT -# ifdef FREEGLUT_IS_PRESENT -# include <GL/freeglut.h> -# else -# ifdef UL_MAC_OSX -# include <GLUT/glut.h> -# else -# include <GL/glut.h> -# endif -# endif -#endif - - -#ifndef _PU_USE_GLUT_FONTS -extern fntTexFont _puCourierFont ; -extern fntTexFont _puTimesFont ; -extern fntTexFont _puHelveticaFont ; -#endif - void puSetPasteBuffer ( const char *ch ) ; char *puGetPasteBuffer () ; Index: puMenuBar.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puMenuBar.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- puMenuBar.cxx 7 Feb 2003 17:01:03 -0000 1.20 +++ puMenuBar.cxx 16 Feb 2004 13:49:03 -0000 1.21 @@ -46,13 +46,13 @@ // If the parent floats in its own window, and the submenu drops off the window, // expand the window to fit. -#ifndef PU_NOT_USING_GLUT +#if 1 puGroup *parent = p -> getParent () ; if ( ( parent != parent -> getParent () ) && parent -> getFloating () ) // DEPRECATED! -- we need to replace this code. { int temp_window = puGetWindow () ; - glutSetWindow ( parent -> getWindow () ) ; + puSetWindow ( parent -> getWindow () ) ; puBox *par_box = parent -> getBBox () ; puBox *cur_box = p -> getBBox () ; @@ -62,12 +62,11 @@ int y_min = (cur_box->min[1] < 0) ? par_box->min[1] + cur_box->min[1] : par_box->min[1] ; int y_max = (par_box->max[1] > par_box->min[1] + cur_box->max[1]) ? par_box->max[1] : par_box->min[1] + cur_box->max[1] ; - int x_siz = glutGet ( (GLenum)GLUT_WINDOW_WIDTH ) ; - int y_siz = glutGet ( (GLenum)GLUT_WINDOW_HEIGHT ) ; + int x_siz, y_siz; + puGetWindowSize ( &x_siz, &y_siz ) ; if ( x_siz < (x_max - x_min) ) x_siz = x_max - x_min ; // Adjust the present size if ( y_siz < (y_max - y_min) ) y_siz = y_max - y_min ; - - glutReshapeWindow ( x_siz, y_siz ) ; + puSetWindowSize ( x_siz, y_siz ) ; x_min = par_box->min[0] - x_min ; y_min = y_siz - ( par_box->max[1] - par_box->min[1] ) ; @@ -77,7 +76,7 @@ if (parent -> getVStatus () == 1) parent -> setPosition ( x_min, y_min ) ; - glutSetWindow ( temp_window ) ; + puSetWindow ( temp_window ) ; } #endif } Index: pui.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pui.dsp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- pui.dsp 27 Sep 2002 23:53:53 -0000 1.24 +++ pui.dsp 16 Feb 2004 13:49:03 -0000 1.25 @@ -41,7 +41,7 @@ # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\fnt" /I "..\sg" /I "..\util" /I "../../../glut/include" /I "../../glut/include" /I ".." /I "../glut/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "GLUT_IS_PRESENT" /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\fnt" /I "..\sg" /I "..\util" /I ".." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "PU_USE_NONE" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -70,7 +70,7 @@ # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I "..\fnt" /I "..\sg" /I "..\util" /I "../../../glut/include" /I "../../glut/include" /I ".." /I "../glut/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "GLUT_IS_PRESENT" /FR /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I "..\fnt" /I "..\sg" /I "..\util" /I ".." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "PU_USE_NONE" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -102,6 +102,22 @@ # End Source File # Begin Source File +SOURCE=.\puGLUT.h +# End Source File +# Begin Source File + +SOURCE=.\puFLTK.h +# End Source File +# Begin Source File + +SOURCE=.\puSDL.h +# End Source File +# Begin Source File + +SOURCE=.\puNative.h +# End Source File +# Begin Source File + SOURCE=.\puArrowButton.cxx # End Source File # Begin Source File |