From 442f6ee4901a9dcbb5fa63a087c145d423ceb38f Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Wed, 31 Jan 2001 16:31:14 +0000 Subject: [PATCH] OpenGL support under Cygwin/SDL --- arch/include/mouse.h | 9 ++++++--- configure.in | 13 +++++++++++++ include/pstypes.h | 2 ++ main/game.c | 10 +++++----- main/gamepal.h | 3 +++ video/ogl.c | 8 ++++++-- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/arch/include/mouse.h b/arch/include/mouse.h index 8cf33f50..941dee6e 100644 --- a/arch/include/mouse.h +++ b/arch/include/mouse.h @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/arch/include/mouse.h,v $ - * $Revision: 1.1 $ + * $Revision: 1.2 $ * $Author: bradleyb $ - * $Date: 2001-01-28 05:46:33 $ + * $Date: 2001-01-31 16:31:13 $ * * Header for mouse functions * * $Log: not supported by cvs2svn $ + * Revision 1.1 2001/01/28 05:46:33 bradleyb + * Unified arch headers + * */ #ifndef MOUSE_H @@ -30,7 +33,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MB_LEFT 0 -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) #undef MB_RIGHT #endif diff --git a/configure.in b/configure.in index 024c09f8..0cd05205 100644 --- a/configure.in +++ b/configure.in @@ -75,6 +75,18 @@ else esac],[opengl=false]) if test x$opengl = xtrue; then + if test "$host_os" = "cygwin"; then + AC_CHECK_LIB(GL, main, + OGL_LIBS="-lopengl32", + [AC_MSG_ERROR([GL not found, OpenGL cannot be built]) + opengl=false], + ) + AC_CHECK_LIB(GLU,main, + OGL_LIBS="${OGL_LIBS} -lglu32", + [AC_MSG_ERROR([GLU not found, OpenGL cannot be built]) + opengl=false], + -lGL) + else AC_CHECK_LIB(GL, main, OGL_LIBS="-lGL", [AC_MSG_ERROR([GL not found, OpenGL cannot be built]) @@ -85,6 +97,7 @@ else [AC_MSG_ERROR([GLU not found, OpenGL cannot be built]) opengl=false], -lGL) + fi fi AC_SUBST(OGL_LIBS) AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue) diff --git a/include/pstypes.h b/include/pstypes.h index 637d906f..ca0cdd20 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -25,7 +25,9 @@ typedef unsigned char ubyte; #if defined __CYGWIN__ # define _MAX_PATH 260 # define _MAX_DIR 256 +# undef min # define min(a,b) (((a)>(b))?(b):(a)) +# undef max # define max(a,b) (((a)<(b))?(b):(a)) typedef unsigned long ulong; #elif defined __ENV_LINUX__ diff --git a/main/game.c b/main/game.c index 03f38907..998c4a86 100644 --- a/main/game.c +++ b/main/game.c @@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -char game_rcsid[] = "$Id: game.c,v 1.6 2001-01-31 15:17:50 bradleyb Exp $"; +char game_rcsid[] = "$Id: game.c,v 1.7 2001-01-31 16:31:13 bradleyb Exp $"; #endif #ifdef WINDOWS @@ -38,6 +38,10 @@ char game_rcsid[] = "$Id: game.c,v 1.6 2001-01-31 15:17:50 bradleyb Exp $"; #include #endif +#ifdef OGL +#include "ogl_init.h" +#endif + #include "pstypes.h" #include "console.h" #include "pa_enabl.h" //$$POLY_ACC @@ -112,10 +116,6 @@ char game_rcsid[] = "$Id: game.c,v 1.6 2001-01-31 15:17:50 bradleyb Exp $"; #include "fix.h" #include "d_delay.h" -#ifdef OGL -#include "ogl_init.h" -#endif - int VGA_current_mode; #ifdef MWPROFILER diff --git a/main/gamepal.h b/main/gamepal.h index 609d615b..04584274 100644 --- a/main/gamepal.h +++ b/main/gamepal.h @@ -16,6 +16,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "inferno.h" +#ifdef __CYGWIN__ +#undef DEFAULT_PALETTE /* KLUDGE */ +#endif #define DEFAULT_PALETTE "default.256" #define MENU_PALETTE "default.256" diff --git a/video/ogl.c b/video/ogl.c index 69c94fae..2bbe9e76 100644 --- a/video/ogl.c +++ b/video/ogl.c @@ -1,12 +1,15 @@ /* * $Source: /cvs/cvsroot/d2x/video/ogl.c,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: bradleyb $ - * $Date: 2001-01-29 13:47:52 $ + * $Date: 2001-01-31 16:31:14 $ * * Graphics support functions for OpenGL. * * $Log: not supported by cvs2svn $ + * Revision 1.3 2001/01/29 13:47:52 bradleyb + * Fixed build, some minor cleanups. + * */ #ifdef HAVE_CONFIG_H @@ -22,6 +25,7 @@ #include #include #include + #include "ogl_init.h" #include "3d.h" #include "piggy.h" -- 2.39.2