forked from speed-dreams/speed-dreams-code
Re #195 (Problems with Display configuration menu) : Use SDL to detect supported color depths and screen sizes, may be different in Windowed and Full-screen mode, hard-coded list as a fallback + tgf/tgfclient API consistency improvements
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2831 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c258e69db3ed6abef61ffaad14da4ad644026677 Former-commit-id: 4661d482f43df57e9ad6c2a5a79d00d808af1e2a
This commit is contained in:
parent
67356061a3
commit
b6f55cba4f
15 changed files with 622 additions and 525 deletions
|
@ -2,6 +2,8 @@ INCLUDE(../../../cmake/macros.cmake)
|
||||||
|
|
||||||
#PROJECT(tgf)
|
#PROJECT(tgf)
|
||||||
|
|
||||||
|
ADD_SDL_INCLUDEDIR()
|
||||||
|
|
||||||
ADD_OSSPEC_INCLUDEDIR()
|
ADD_OSSPEC_INCLUDEDIR()
|
||||||
ADD_SDLIB_INCLUDEDIR(txml portability)
|
ADD_SDLIB_INCLUDEDIR(txml portability)
|
||||||
|
|
||||||
|
@ -27,6 +29,8 @@ ENDIF(CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
|
||||||
|
|
||||||
ADD_SDLIB_LIBRARY(tgf txml)
|
ADD_SDLIB_LIBRARY(tgf txml)
|
||||||
|
|
||||||
|
ADD_SDL_LIBRARY(tgf)
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SD_INSTALL_FILES(BIN TARGETS tgf)
|
SD_INSTALL_FILES(BIN TARGETS tgf)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
#include "tgf.h"
|
#include "tgf.h"
|
||||||
|
|
||||||
#include "portability.h"
|
#include "portability.h"
|
||||||
|
@ -410,7 +412,29 @@ char * _tgf_win_strdup(const char * str)
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
// Build a new path string compatible with current OS and usable as a command line arg.
|
||||||
|
static char* gfPathBuildCommandLineArg(const char *path)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
char *osPath = (char*)malloc(strlen(path)+3);
|
||||||
|
sprintf(osPath, "\"%s", path);
|
||||||
|
if (osPath[strlen(osPath)-1] == '/')
|
||||||
|
osPath[strlen(osPath)-1] = 0; // Remove trailing '/' for command line
|
||||||
|
strcat(osPath, "\"");
|
||||||
|
#else
|
||||||
|
char *osPath = strdup(path);
|
||||||
|
#endif //WIN32
|
||||||
|
|
||||||
|
GfPathMakeOSCompatible(osPath);
|
||||||
|
|
||||||
|
return osPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Initialize the gaming framework.
|
||||||
|
@ingroup tgf
|
||||||
|
@return None
|
||||||
|
*/
|
||||||
void GfInit(void)
|
void GfInit(void)
|
||||||
{
|
{
|
||||||
gfTraceInit();
|
gfTraceInit();
|
||||||
|
@ -418,9 +442,112 @@ void GfInit(void)
|
||||||
gfModInit();
|
gfModInit();
|
||||||
gfOsInit();
|
gfOsInit();
|
||||||
gfParamInit();
|
gfParamInit();
|
||||||
|
|
||||||
|
// Initialize SDL subsystems usefull for TGF.
|
||||||
|
if (SDL_Init(SDL_INIT_TIMER) < 0)
|
||||||
|
GfLogFatal("Couldn't initialize SDL(timer) (%s)\n", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Restart the gaming framework (restart the current process).
|
||||||
|
@ingroup tgf
|
||||||
|
@param sec Time to convert
|
||||||
|
@param plus String to display as the positive sign (+) for positive values of time.
|
||||||
|
@return None
|
||||||
|
@warning Never returns (retart the process).
|
||||||
|
*/
|
||||||
|
void GfRestart(bool bHardwareMouse, bool bMultiTexturing)
|
||||||
|
{
|
||||||
|
int retcode = 0;
|
||||||
|
static const int CMDSIZE = 1024;
|
||||||
|
char cmd[CMDSIZE];
|
||||||
|
|
||||||
|
char** args;
|
||||||
|
int i, nArgs;
|
||||||
|
int argInd;
|
||||||
|
|
||||||
|
// Command name.
|
||||||
|
sprintf(cmd, "%sspeed-dreams", GetBinDir());
|
||||||
|
#ifdef WIN32
|
||||||
|
strcat(cmd, ".exe");
|
||||||
|
#endif
|
||||||
|
GfPathMakeOSCompatible(cmd);
|
||||||
|
|
||||||
|
// Compute number of args.
|
||||||
|
nArgs = 1; // Executable is always the first arg.
|
||||||
|
|
||||||
|
if (bHardwareMouse)
|
||||||
|
nArgs += 1;
|
||||||
|
if (!bMultiTexturing)
|
||||||
|
nArgs += 1;
|
||||||
|
if (GetLocalDir() && strlen(GetLocalDir()))
|
||||||
|
nArgs += 2;
|
||||||
|
if (GetBinDir() && strlen(GetBinDir()))
|
||||||
|
nArgs += 2;
|
||||||
|
if (GetLibDir() && strlen(GetLibDir()))
|
||||||
|
nArgs += 2;
|
||||||
|
if (GetDataDir() && strlen(GetDataDir()))
|
||||||
|
nArgs += 2;
|
||||||
|
|
||||||
|
nArgs++; // Last arg must be a null pointer.
|
||||||
|
|
||||||
|
// Allocate args array.
|
||||||
|
args = (char**)malloc(sizeof(char*)*nArgs);
|
||||||
|
|
||||||
|
// First arg is the executable path-name.
|
||||||
|
argInd = 0;
|
||||||
|
args[argInd++] = gfPathBuildCommandLineArg(cmd);
|
||||||
|
|
||||||
|
// Then add subsequent args.
|
||||||
|
if (bHardwareMouse)
|
||||||
|
args[argInd++] = strdup("-m");
|
||||||
|
|
||||||
|
if (!bMultiTexturing)
|
||||||
|
args[argInd++] = strdup("-s");
|
||||||
|
|
||||||
|
if (GetLocalDir() && strlen(GetLocalDir()))
|
||||||
|
{
|
||||||
|
args[argInd++] = strdup("-l");
|
||||||
|
args[argInd++] = gfPathBuildCommandLineArg(GetLocalDir());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetBinDir() && strlen(GetBinDir()))
|
||||||
|
{
|
||||||
|
args[argInd++] = strdup("-B");
|
||||||
|
args[argInd++] = gfPathBuildCommandLineArg(GetBinDir());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetLibDir() && strlen(GetLibDir()))
|
||||||
|
{
|
||||||
|
args[argInd++] = strdup("-L");
|
||||||
|
args[argInd++] = gfPathBuildCommandLineArg(GetLibDir());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetDataDir() && strlen(GetDataDir()))
|
||||||
|
{
|
||||||
|
args[argInd++] = strdup("-D");
|
||||||
|
args[argInd++] = gfPathBuildCommandLineArg(GetDataDir ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, last null arg.
|
||||||
|
args[argInd] = 0;
|
||||||
|
|
||||||
|
// Exec the command : restart the game (simply replacing current process)
|
||||||
|
GfLogInfo("Restarting ");
|
||||||
|
for (i = 0; args[i]; i++)
|
||||||
|
GfLogInfo("%s ", args[i]);
|
||||||
|
GfLogInfo("...\n");
|
||||||
|
retcode = execvp(cmd, args);
|
||||||
|
|
||||||
|
// If successfull, we never get here ... but if failed ...
|
||||||
|
GfLogError("Failed to restart (exit code %d, %s)\n", retcode, strerror(errno));
|
||||||
|
for (i = 0; args[i]; i++)
|
||||||
|
free(args[i]);
|
||||||
|
free(args);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
void gfMeanReset(tdble v, tMeanVal *pvt)
|
void gfMeanReset(tdble v, tMeanVal *pvt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -460,7 +587,7 @@ tdble gfMean(tdble v, tMeanVal *pvt, int n, int w)
|
||||||
|
|
||||||
|
|
||||||
/** Convert a time in seconds (float) to an ascii string.
|
/** Convert a time in seconds (float) to an ascii string.
|
||||||
@ingroup screen
|
@ingroup tgf
|
||||||
@param sec Time to convert
|
@param sec Time to convert
|
||||||
@param plus String to display as the positive sign (+) for positive values of time.
|
@param plus String to display as the positive sign (+) for positive values of time.
|
||||||
@param zeros Flag to indicate if heading zeros are to be displayed or not.
|
@param zeros Flag to indicate if heading zeros are to be displayed or not.
|
||||||
|
@ -505,6 +632,23 @@ char* GfTime2Str(double sec, const char* plus, bool zeros, int prec)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** In-place convert internal file or dir path to an OS compatible path
|
||||||
|
@ingroup tgf
|
||||||
|
@param path The path to convert
|
||||||
|
@return The converted path.
|
||||||
|
*/
|
||||||
|
// In-place convert internal file or dir path to an OS compatible path
|
||||||
|
char* GfPathMakeOSCompatible(char* path)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < strlen(path); i++)
|
||||||
|
if (path[i] == '/')
|
||||||
|
path[i] = '\\';
|
||||||
|
#endif //WIN32
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine if a dir or file path is absolute or not.
|
// Determine if a dir or file path is absolute or not.
|
||||||
bool GfPathIsAbsolute(const char *pszPath)
|
bool GfPathIsAbsolute(const char *pszPath)
|
||||||
{
|
{
|
||||||
|
@ -733,21 +877,6 @@ const char* SetBinDir(const char *pszPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int singleTextureMode = 0;
|
|
||||||
|
|
||||||
|
|
||||||
int GetSingleTextureMode (void)
|
|
||||||
{
|
|
||||||
return singleTextureMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SetSingleTextureMode (void)
|
|
||||||
{
|
|
||||||
singleTextureMode = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Nearest power of 2 integer
|
// Nearest power of 2 integer
|
||||||
int GfNearestPow2 (int x)
|
int GfNearestPow2 (int x)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,10 +164,12 @@ typedef struct
|
||||||
t3Dd M; /**< Moments */
|
t3Dd M; /**< Moments */
|
||||||
} tForces;
|
} tForces;
|
||||||
|
|
||||||
/***********************************
|
/******************************
|
||||||
* Gaming framework initialization *
|
* Gaming framework managment *
|
||||||
***********************************/
|
******************************/
|
||||||
TGF_API void GfInit(void);
|
TGF_API void GfInit(void);
|
||||||
|
TGF_API void GfRestart(bool bHardwareMouse = false, bool bSingleTexturing = false);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Memory pools *
|
* Memory pools *
|
||||||
|
@ -262,6 +264,7 @@ TGF_API void GfDirFreeList(tFList *list, tfDirfreeUserData freeUserData, bool fr
|
||||||
|
|
||||||
TGF_API bool GfPathIsAbsolute(const char *pszPath);
|
TGF_API bool GfPathIsAbsolute(const char *pszPath);
|
||||||
TGF_API char* GfPathNormalizeDir(char* pszPath, size_t nMaxPathLen);
|
TGF_API char* GfPathNormalizeDir(char* pszPath, size_t nMaxPathLen);
|
||||||
|
TGF_API char* GfPathMakeOSCompatible(char* path);
|
||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* Interface For Parameter Files *
|
* Interface For Parameter Files *
|
||||||
|
@ -420,6 +423,11 @@ static inline void GfLogMessage(int nLevel, const char *pszFmt, ...) {};
|
||||||
TGF_API double GfTimeClock(void);
|
TGF_API double GfTimeClock(void);
|
||||||
TGF_API char *GfTime2Str(double sec, const char* plus="", bool zeros=true, int prec=3);
|
TGF_API char *GfTime2Str(double sec, const char* plus="", bool zeros=true, int prec=3);
|
||||||
|
|
||||||
|
/******************
|
||||||
|
* Miscellaneous. *
|
||||||
|
******************/
|
||||||
|
TGF_API int GfNearestPow2(int x);
|
||||||
|
|
||||||
/* Mean values */
|
/* Mean values */
|
||||||
#define GF_MEAN_MAX_VAL 5
|
#define GF_MEAN_MAX_VAL 5
|
||||||
|
|
||||||
|
@ -456,13 +464,9 @@ TGF_API const char *SetDataDir(const char *pszPath);
|
||||||
TGF_API const char *GetBinDir();
|
TGF_API const char *GetBinDir();
|
||||||
TGF_API const char *SetBinDir(const char *pszPath);
|
TGF_API const char *SetBinDir(const char *pszPath);
|
||||||
|
|
||||||
/* MISC */
|
/************************************************
|
||||||
TGF_API int GetSingleTextureMode();
|
* User settings files run-time update/install. *
|
||||||
TGF_API void SetSingleTextureMode();
|
************************************************/
|
||||||
|
|
||||||
TGF_API int GfNearestPow2(int x);
|
|
||||||
|
|
||||||
/* Settings files run-time setup */
|
|
||||||
TGF_API void GfFileSetup();
|
TGF_API void GfFileSetup();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,10 @@ ADD_PLIB_INCLUDEDIR()
|
||||||
SET(TGFCLIENT_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
SET(TGFCLIENT_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||||
guiimage.cpp guimenu.cpp guiscrollbar.cpp guitexture.cpp
|
guiimage.cpp guimenu.cpp guiscrollbar.cpp guitexture.cpp
|
||||||
tgfclient.cpp gui.cpp guiedit.cpp guihelp.cpp
|
tgfclient.cpp gui.cpp guiedit.cpp guihelp.cpp
|
||||||
guilabel.cpp guiobject.cpp guiscrollist.cpp guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
||||||
screen.cpp guieventloop.cpp glfeatures.h gui.h screen_properties.h
|
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
||||||
guimenu.h tgfclient.h guifont.h )
|
guiscreen.cpp guieventloop.cpp
|
||||||
|
glfeatures.h gui.h guiscreen.h guimenu.h tgfclient.h guifont.h )
|
||||||
|
|
||||||
#disable developer warning
|
#disable developer warning
|
||||||
IF (COMMAND CMAKE_POLICY)
|
IF (COMMAND CMAKE_POLICY)
|
||||||
|
@ -71,5 +72,5 @@ ENDIF(UNIX)
|
||||||
|
|
||||||
SD_INSTALL_FILES(DATA config USER config FILES screen.xml)
|
SD_INSTALL_FILES(DATA config USER config FILES screen.xml)
|
||||||
|
|
||||||
SD_INSTALL_FILES(INCLUDE FILES glfeatures.h screen_properties.h tgfclient.h)
|
SD_INSTALL_FILES(INCLUDE FILES glfeatures.h guiscreen.h tgfclient.h)
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,24 @@ int GfglGetUserTextureMaxSize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
----------------------- Multi-texturing (anti-aliasing) support.
|
||||||
|
*/
|
||||||
|
static bool bMultiTexturingEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
bool GfglIsMultiTexturingEnabled()
|
||||||
|
{
|
||||||
|
return bMultiTexturingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GfglEnableMultiTexturing(bool bEnable)
|
||||||
|
{
|
||||||
|
bMultiTexturingEnabled = bEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
----------------------- Non-power of 2 size texture support.
|
----------------------- Non-power of 2 size texture support.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -382,8 +382,6 @@ extern void gfuiScrollListPrevElt (tGfuiObject *object);
|
||||||
extern void gfuiReleaseImage(tGfuiObject *obj);
|
extern void gfuiReleaseImage(tGfuiObject *obj);
|
||||||
extern void gfuiDrawImage(tGfuiObject *obj);
|
extern void gfuiDrawImage(tGfuiObject *obj);
|
||||||
|
|
||||||
extern SDL_Surface* gfScrGetScreenSurface();
|
|
||||||
|
|
||||||
#endif /* _GUI_H__ */
|
#endif /* _GUI_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef struct
|
||||||
} tMnuCallbackInfo;
|
} tMnuCallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
|
extern void gfMenuInit(void);
|
||||||
|
|
||||||
#endif /* __MENU__H__ */
|
#endif /* __MENU__H__ */
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,10 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
file : screen_properties.h
|
file : guiscreen.h
|
||||||
created : Sat Apr 19 23:37:41 CEST 2003
|
created : Sat Apr 19 23:37:41 CEST 2003
|
||||||
copyright : (C) 2003 by Eric Espi<EFBFBD>
|
copyright : (C) 2003 by Eric Espie
|
||||||
email : eric.espie@torcs.org
|
email : eric.espie@torcs.org
|
||||||
version : $Id: screen_properties.h,v 1.4 2005/02/01 15:55:55 berniw Exp $
|
version : $Id$
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
@ -20,11 +20,14 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
@author <a href=mailto:torcs@free.fr>Eric Espie</a>
|
@author <a href=mailto:torcs@free.fr>Eric Espie</a>
|
||||||
@version $Id: screen_properties.h,v 1.4 2005/02/01 15:55:55 berniw Exp $
|
@version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCREEN_PROPERTIES_H_
|
#ifndef _GUISCREEN_H_
|
||||||
#define _SCREEN_PROPERTIES_H_
|
#define _GUISCREEN_H_
|
||||||
|
|
||||||
|
#include <SDL/SDL_video.h>
|
||||||
|
|
||||||
|
|
||||||
#define GFSCR_CONF_FILE "config/screen.xml"
|
#define GFSCR_CONF_FILE "config/screen.xml"
|
||||||
|
|
||||||
|
@ -83,7 +86,9 @@
|
||||||
#define GFSCR_ATTR_ALPHA "alpha"
|
#define GFSCR_ATTR_ALPHA "alpha"
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SCREEN_PROPERTIES_H_ */
|
SDL_Surface* gfScrGetScreenSurface();
|
||||||
|
|
||||||
|
#endif /* _GUISCREEN_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,10 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "tgfclient.h"
|
#include "guimenu.h"
|
||||||
|
|
||||||
extern void gfScreenInit(void);
|
void GfInitClient(void)
|
||||||
extern void gfMenuInit(void);
|
|
||||||
|
|
||||||
void
|
|
||||||
GfInitClient(void)
|
|
||||||
{
|
{
|
||||||
gfuiInit();
|
gfuiInit();
|
||||||
gfMenuInit();
|
gfMenuInit();
|
||||||
gfScreenInit();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,12 @@
|
||||||
@version $Id$
|
@version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __TGFCLIENT__H__
|
||||||
|
#define __TGFCLIENT__H__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef __TGFCLIENT__H__
|
|
||||||
#define __TGFCLIENT__H__
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
//Disable some MSVC warnings
|
//Disable some MSVC warnings
|
||||||
|
@ -47,11 +46,10 @@
|
||||||
# include <plib/js.h>
|
# include <plib/js.h>
|
||||||
#endif
|
#endif
|
||||||
#include <SDL/SDL_keysym.h>
|
#include <SDL/SDL_keysym.h>
|
||||||
#include <SDL/SDL_video.h>
|
|
||||||
|
|
||||||
#include <tgf.h>
|
#include <tgf.h>
|
||||||
|
|
||||||
#include "screen_properties.h"
|
#include "guiscreen.h"
|
||||||
|
|
||||||
|
|
||||||
// DLL exported symbols declarator for Windows.
|
// DLL exported symbols declarator for Windows.
|
||||||
|
@ -77,15 +75,23 @@ TGFCLIENT_API void GfInitClient(void);
|
||||||
* Screen Interface *
|
* Screen Interface *
|
||||||
********************/
|
********************/
|
||||||
|
|
||||||
|
typedef struct ScreenSize
|
||||||
|
{
|
||||||
|
int width; // Width in pixels.
|
||||||
|
int height; // Height in pixels.
|
||||||
|
} tScreenSize;
|
||||||
|
|
||||||
TGFCLIENT_API void GfScrInit(int argc, char *argv[]);
|
TGFCLIENT_API void GfScrInit(int argc, char *argv[]);
|
||||||
TGFCLIENT_API void GfScrShutdown(void);
|
TGFCLIENT_API void GfScrShutdown(void);
|
||||||
TGFCLIENT_API void *GfScrMenuInit(void *precMenu);
|
TGFCLIENT_API void *GfScrMenuInit(void *precMenu);
|
||||||
TGFCLIENT_API void GfScrGetSize(int *scrW, int *scrH, int *viewW, int *viewH);
|
TGFCLIENT_API void GfScrGetSize(int *scrW, int *scrH, int *viewW, int *viewH);
|
||||||
SDL_Surface* gfScrGetScreenSurface();
|
|
||||||
TGFCLIENT_API unsigned char* GfScrCaptureAsImage(int* viewW, int *viewH);
|
TGFCLIENT_API unsigned char* GfScrCaptureAsImage(int* viewW, int *viewH);
|
||||||
TGFCLIENT_API int GfScrCaptureAsPNG(const char *filename);
|
TGFCLIENT_API int GfScrCaptureAsPNG(const char *filename);
|
||||||
TGFCLIENT_API void GfScrReinit(void*);
|
TGFCLIENT_API void GfScrReinit(void*);
|
||||||
|
|
||||||
|
TGFCLIENT_API int* GfScrGetPossibleColorDepths(int* pnDepths);
|
||||||
|
TGFCLIENT_API tScreenSize* GfScrGetPossibleSizes(int nColorDepth, bool bFullScreen, int* pnSizes);
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
* GUI interface (low-level) *
|
* GUI interface (low-level) *
|
||||||
*****************************/
|
*****************************/
|
||||||
|
@ -593,6 +599,11 @@ TGFCLIENT_API void GfglUpdateUserTextureMaxSize(void);
|
||||||
TGFCLIENT_API bool GfglIsTextureRectangleARBAvailable(void); // In case mipmapping NOT needed.
|
TGFCLIENT_API bool GfglIsTextureRectangleARBAvailable(void); // In case mipmapping NOT needed.
|
||||||
TGFCLIENT_API bool GfglIsTextureNonPowerOf2ARBAvailable(void); // In case mipmapping needed.
|
TGFCLIENT_API bool GfglIsTextureNonPowerOf2ARBAvailable(void); // In case mipmapping needed.
|
||||||
|
|
||||||
|
// Multi-texturing support
|
||||||
|
TGFCLIENT_API bool GfglIsMultiTexturingEnabled();
|
||||||
|
TGFCLIENT_API void GfglEnableMultiTexturing(bool bEnable = true);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __TGFCLIENT__H__ */
|
#endif /* __TGFCLIENT__H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ init_args(int argc, char **argv)
|
||||||
// -s option : Single texture mode (= disable multi-texturing)
|
// -s option : Single texture mode (= disable multi-texturing)
|
||||||
else if (!strncmp(argv[i], "-s", 2))
|
else if (!strncmp(argv[i], "-s", 2))
|
||||||
{
|
{
|
||||||
SetSingleTextureMode ();
|
GfglEnableMultiTexturing(false);
|
||||||
}
|
}
|
||||||
// -m option : Allow the hardware mouse cursor
|
// -m option : Allow the hardware mouse cursor
|
||||||
else if (!strncmp(argv[i], "-m", 2))
|
else if (!strncmp(argv[i], "-m", 2))
|
||||||
|
|
|
@ -86,7 +86,7 @@ PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL;
|
||||||
// desc: sets up OpenGL for multitexturing support
|
// desc: sets up OpenGL for multitexturing support
|
||||||
bool InitMultiTex(void)
|
bool InitMultiTex(void)
|
||||||
{
|
{
|
||||||
if (GetSingleTextureMode ()) {
|
if (!GfglIsMultiTexturingEnabled()) {
|
||||||
maxTextureUnits = 1;
|
maxTextureUnits = 1;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,56 +53,6 @@ init_args(int argc, char **argv)
|
||||||
GfInitInstallDir(argv[0]);
|
GfInitInstallDir(argv[0]);
|
||||||
|
|
||||||
// Parse command line args.
|
// Parse command line args.
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
int i = 1;
|
|
||||||
while (i < argc)
|
|
||||||
{
|
|
||||||
// -l or /l option : User settings dir (named "local dir")
|
|
||||||
if (!strncmp(argv[i], "-l", 2) || !strncmp(argv[i], "/l", 2))
|
|
||||||
{
|
|
||||||
if (++i < argc)
|
|
||||||
localdir = SetLocalDir(argv[i]);
|
|
||||||
}
|
|
||||||
// -L or /L option : Libraries dir (root dir of the tree where loadable modules are installed)
|
|
||||||
else if (!strncmp(argv[i], "-L", 2) || !strncmp(argv[i], "/L", 2))
|
|
||||||
{
|
|
||||||
if (++i < argc)
|
|
||||||
libdir = SetLibDir(argv[i]);
|
|
||||||
}
|
|
||||||
// -D or /D option : Data dir (root dir of the data tree)
|
|
||||||
else if (!strncmp(argv[i], "-D", 2) || !strncmp(argv[i], "/D", 2))
|
|
||||||
{
|
|
||||||
if (++i < argc)
|
|
||||||
datadir = SetDataDir(argv[i]);
|
|
||||||
}
|
|
||||||
// -B or /B option : Binaries dir (the dir where Speed Dreams exe and DLLs are installed)
|
|
||||||
else if (!strncmp(argv[i], "-B", 2) || !strncmp(argv[i], "/B", 2))
|
|
||||||
{
|
|
||||||
if (++i < argc)
|
|
||||||
bindir = SetBinDir(argv[i]);
|
|
||||||
}
|
|
||||||
// -s or /s option : Single texture mode (= disable multi-texturing)
|
|
||||||
else if (!strncmp(argv[i], "-s", 2) || !strncmp(argv[i], "/s", 2))
|
|
||||||
{
|
|
||||||
SetSingleTextureMode ();
|
|
||||||
}
|
|
||||||
// -m or /m option : Allow the hardware mouse cursor
|
|
||||||
else if (!strncmp(argv[i], "-m", 2) || !strncmp(argv[i], "/m", 2))
|
|
||||||
{
|
|
||||||
GfuiMouseSetHWPresent();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_strMenuFile = argv[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next arg (even if current not recognized).
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i < argc)
|
while (i < argc)
|
||||||
{
|
{
|
||||||
|
@ -133,7 +83,7 @@ init_args(int argc, char **argv)
|
||||||
// -s option : Single texture mode (= disable multi-texturing)
|
// -s option : Single texture mode (= disable multi-texturing)
|
||||||
else if (!strncmp(argv[i], "-s", 2))
|
else if (!strncmp(argv[i], "-s", 2))
|
||||||
{
|
{
|
||||||
SetSingleTextureMode ();
|
GfglEnableMultiTexturing(false);
|
||||||
}
|
}
|
||||||
// -m option : Allow the hardware mouse cursor
|
// -m option : Allow the hardware mouse cursor
|
||||||
else if (!strncmp(argv[i], "-m", 2))
|
else if (!strncmp(argv[i], "-m", 2))
|
||||||
|
@ -148,7 +98,6 @@ init_args(int argc, char **argv)
|
||||||
// Next arg (even if current not recognized).
|
// Next arg (even if current not recognized).
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// If any of the Speed-Dreams dirs not run-time specified / empty,
|
// If any of the Speed-Dreams dirs not run-time specified / empty,
|
||||||
// use associated compile-time variable SD_XXDIR to get default value
|
// use associated compile-time variable SD_XXDIR to get default value
|
||||||
|
|
|
@ -70,7 +70,7 @@ init_args(int argc, char **argv)
|
||||||
// -s or /s option : Single texture mode (= disable multi-texturing)
|
// -s or /s option : Single texture mode (= disable multi-texturing)
|
||||||
else if (!strncmp(argv[i], "-s", 2) || !strncmp(argv[i], "/s", 2))
|
else if (!strncmp(argv[i], "-s", 2) || !strncmp(argv[i], "/s", 2))
|
||||||
{
|
{
|
||||||
SetSingleTextureMode ();
|
GfglEnableMultiTexturing(false);
|
||||||
}
|
}
|
||||||
// -m or /m option : Allow the hardware mouse cursor
|
// -m or /m option : Allow the hardware mouse cursor
|
||||||
else if (!strncmp(argv[i], "-m", 2) || !strncmp(argv[i], "/m", 2))
|
else if (!strncmp(argv[i], "-m", 2) || !strncmp(argv[i], "/m", 2))
|
||||||
|
|
Loading…
Reference in a new issue