forked from speed-dreams/speed-dreams-code
Fixed infinite loop in splash when image not found + code cleanup
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2277 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: dd5aceafd3d35723a4d03eb8c8b4c1cb15e520cd Former-commit-id: f779b01298d4b779151d3943f75b14cdc53113c0
This commit is contained in:
parent
407668c306
commit
2ffdd9d5ca
10 changed files with 40 additions and 46 deletions
|
@ -5,9 +5,10 @@ ENDIF(NOT DEFINED IN_SOURCETREE)
|
||||||
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(CMAKE_INSTALL_PREFIX "C:/Program files/speed-dreams-dev" CACHE PATH "Prefix prepended to install directories" FORCE)
|
SET(CMAKE_INSTALL_PREFIX "C:/Program files/speed-dreams-dev" CACHE PATH "Prefix prepended to install directories" FORCE)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(CMAKE_INSTALL_PREFIX "/usr/local/dev" CACHE PATH "Prefix prepended to install directories" FORCE)
|
SET(CMAKE_INSTALL_PREFIX "/usr/local/dev" CACHE PATH "Prefix prepended to install directories" FORCE)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
MESSAGE(STATUS "Default install prefix : $CMAKE_INSTALL_PREFIX")
|
||||||
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
|
||||||
IF(NOT SOURCE_DIR AND IN_SOURCETREE)
|
IF(NOT SOURCE_DIR AND IN_SOURCETREE)
|
||||||
|
|
|
@ -21,12 +21,7 @@
|
||||||
#ifndef _CLIENT_H_
|
#ifndef _CLIENT_H_
|
||||||
#define _CLIENT_H_
|
#define _CLIENT_H_
|
||||||
|
|
||||||
#if _WIN32
|
extern bool GameEntry(void);
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern void GameEntry(void);
|
|
||||||
|
|
||||||
#endif /* _CLIENT_H_ */
|
#endif /* _CLIENT_H_ */
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "client.h"
|
#include "tgfclient.h"
|
||||||
#include "mainmenu.h"
|
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -27,23 +26,23 @@
|
||||||
* GameEntry
|
* GameEntry
|
||||||
*
|
*
|
||||||
* Description
|
* Description
|
||||||
* entry point of the game
|
* Entry point of the game.
|
||||||
*
|
*
|
||||||
* Parameters
|
* Parameters
|
||||||
* none
|
* None
|
||||||
*
|
*
|
||||||
* Return
|
* Return
|
||||||
* none
|
* true on success, false in anything bad happened.
|
||||||
*
|
*
|
||||||
* Remarks
|
* Remarks
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
bool
|
||||||
GameEntry(void)
|
GameEntry(void)
|
||||||
{
|
{
|
||||||
// Initialize gaming framework.
|
// Initialize gaming framework.
|
||||||
GfInitClient();
|
GfInitClient();
|
||||||
|
|
||||||
// Open the splash screen, load menus in "backgroud" and finally open the main menu.
|
// Open the splash screen, load menus in "backgroud" and finally open the main menu.
|
||||||
SplashScreen();
|
return SplashScreen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,28 +240,29 @@ static void splashMouse(int /* b */, int s, int /* x */, int /* y */)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function
|
* Function
|
||||||
*
|
* SplashScreen
|
||||||
*
|
*
|
||||||
* Description
|
* Description
|
||||||
*
|
* Display the splash screen and load the main menus in the background.
|
||||||
|
* On mouse click or 7 second time-out, open the main menu.
|
||||||
*
|
*
|
||||||
* Parameters
|
* Parameters
|
||||||
*
|
* None
|
||||||
*
|
*
|
||||||
* Return
|
* Return
|
||||||
*
|
* true on success, false in anything bad happened.
|
||||||
*
|
*
|
||||||
* Remarks
|
* Remarks
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int SplashScreen(void)
|
bool SplashScreen(void)
|
||||||
{
|
{
|
||||||
void *handle;
|
void *handle;
|
||||||
float screen_gamma;
|
float screen_gamma;
|
||||||
//const char *filename = "data/img/splash.png";
|
//const char *filename = "data/img/splash.png";
|
||||||
const char *filename = "data/img/splash.jpg";
|
const char *filename = "data/img/splash.jpg";
|
||||||
|
|
||||||
if (s_texture != 0)
|
if (s_texture)
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &s_texture);
|
glDeleteTextures(1, &s_texture);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +277,7 @@ int SplashScreen(void)
|
||||||
{
|
{
|
||||||
GfParmReleaseHandle(handle);
|
GfParmReleaseHandle(handle);
|
||||||
GfTrace("Couldn't load splash screen image %s\n", filename);
|
GfTrace("Couldn't load splash screen image %s\n", filename);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &s_texture);
|
glGenTextures(1, &s_texture);
|
||||||
|
@ -294,6 +295,6 @@ int SplashScreen(void)
|
||||||
sdlMouseFunc(splashMouse);
|
sdlMouseFunc(splashMouse);
|
||||||
sdlIdleFunc(splashIdle);
|
sdlIdleFunc(splashIdle);
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,7 @@
|
||||||
#ifndef _SPLASH_H_
|
#ifndef _SPLASH_H_
|
||||||
#define _SPLASH_H_
|
#define _SPLASH_H_
|
||||||
|
|
||||||
#if _WIN32
|
extern bool SplashScreen(void);
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int SplashScreen(void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SPLASH_H_ */
|
#endif /* _SPLASH_H_ */
|
||||||
|
|
|
@ -1627,10 +1627,10 @@ GfParmWriteFile (const char *file, void *parmHandle, const char *name)
|
||||||
fputs (line, fout);
|
fputs (line, fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
GfOut ("GfParmWriteFile: %s file written\n", file);
|
|
||||||
|
|
||||||
fclose (fout);
|
fclose (fout);
|
||||||
|
|
||||||
|
GfOut ("Wrote %s (%p)\n", file, parmHandle);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef _GUI_H__
|
#ifndef _GUI_H__
|
||||||
#define _GUI_H__
|
#define _GUI_H__
|
||||||
|
|
||||||
|
#include "tgfclient.h"
|
||||||
#include "guifont.h"
|
#include "guifont.h"
|
||||||
|
|
||||||
#define GFUI_COLORNB 26
|
#define GFUI_COLORNB 26
|
||||||
|
|
|
@ -16,13 +16,8 @@
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
#include "tgfclient.h"
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "tgfclient.h"
|
||||||
|
|
||||||
extern void gfScreenInit(void);
|
extern void gfScreenInit(void);
|
||||||
extern void gfMenuInit(void);
|
extern void gfMenuInit(void);
|
||||||
|
|
|
@ -133,10 +133,13 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
GfScrInit(argc, argv); /* init screen */
|
GfScrInit(argc, argv); /* init screen */
|
||||||
|
|
||||||
GameEntry(); /* launch the game */
|
if (GameEntry()) /* launch the game */
|
||||||
|
{
|
||||||
|
sdlMainLoop(); /* Main event loop */
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
sdlMainLoop(); /* SDL event loop */
|
GfError("\nExiting from Speed Dreams for some fatal reason (see above).\n");
|
||||||
|
exit(1); /* If we got here, something bad happened ... */
|
||||||
return 0; /* just for the compiler, never reached */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,10 +180,13 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
GfScrInit(argc, argv); /* init screen */
|
GfScrInit(argc, argv); /* init screen */
|
||||||
|
|
||||||
GameEntry(); /* launch the game */
|
if (GameEntry()) /* launch the game */
|
||||||
|
{
|
||||||
sdlMainLoop(); /* event loop of sdl */
|
sdlMainLoop(); /* Main event loop */
|
||||||
|
exit(0);
|
||||||
return 0; /* just for the compiler, never reached */
|
}
|
||||||
|
|
||||||
|
GfError("\nExiting from Speed Dreams for some fatal reason (see above).\n");
|
||||||
|
exit(1); /* If we got here, something bad happened ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue