2007-01-15 12:09:25 -08:00
/*
This file is part of Warzone 2100.
Copyright ( C ) 1999 - 2004 Eidos Interactive
2010-07-26 16:36:29 -07:00
Copyright ( C ) 2005 - 2010 Warzone 2100 Project
2007-01-15 12:09:25 -08:00
Warzone 2100 is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
Warzone 2100 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 General Public License for more details .
You should have received a copy of the GNU General Public License
along with Warzone 2100 ; if not , write to the Free Software
Foundation , Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 USA
*/
2006-09-25 09:46:28 -07:00
/*! \file frame.h
* \ brief The framework library initialisation and shutdown routines .
2007-06-28 10:47:08 -07:00
*/
# ifndef _frame_h
# define _frame_h
2007-08-21 05:30:00 -07:00
# include "wzglobal.h"
2007-04-10 05:44:50 -07:00
2008-04-17 13:55:46 -07:00
// Workaround X11 headers #defining Status
# ifdef Status
# undef Status
# endif
2008-03-15 20:10:05 -07:00
# include "types.h"
2009-02-14 22:09:24 -08:00
/**
* NOTE : the next two # include lines are needed by MSVC to override the default ,
* non C99 compliant routines , and redefinition ; different linkage errors
*/
# include "stdio_ext.h"
# include "string_ext.h"
2008-03-15 20:10:05 -07:00
2007-04-10 10:36:16 -07:00
# include "macros.h"
2007-06-28 10:47:08 -07:00
# include "debug.h"
2008-03-15 20:10:05 -07:00
# include "i18n.h"
2007-06-28 10:47:08 -07:00
# include "trig.h"
2008-03-30 07:11:33 -07:00
# include "cursors.h"
2008-03-15 04:40:35 -07:00
2010-01-18 11:10:17 -08:00
# ifdef __cplusplus
extern " C "
{
# endif //__cplusplus
2010-09-01 12:05:22 -07:00
extern uint32_t selectedPlayer ; ///< The player number corresponding to this client.
extern uint32_t realSelectedPlayer ; ///< The player number corresponding to this client (same as selectedPlayer, unless changing players in the debug menu).
2010-01-28 12:15:48 -08:00
# define MAX_PLAYERS 8 /**< Maximum number of players in the game. */
# define MAX_PLAYER_SLOTS 10 /**< 8 players, 1 baba and 1 reserved for features. */
2007-04-10 07:06:14 -07:00
2008-05-05 16:17:35 -07:00
/** Initialise the framework library
* @ param pWindowName the text to appear in the window title bar
* @ param width the display widget
* @ param height the display height
* @ param bitDepth the display bit depth
* @ param fullScreen whether to start full screen or windowed
2008-08-25 11:01:49 -07:00
* @ param vsync if to sync to the vertical blanking interval or not
2008-05-05 16:17:35 -07:00
*
* @ return true when the framework library is successfully initialised , false
* when a part of the initialisation failed .
*/
2010-02-14 13:31:09 -08:00
extern bool frameInitialise ( const char * pWindowName , UDWORD width , UDWORD height , UDWORD bitDepth , unsigned int fsaa , bool fullScreen , bool vsync ) ;
2007-06-28 10:47:08 -07:00
2008-03-30 07:36:11 -07:00
extern bool selfTest ;
2007-12-29 14:34:41 -08:00
/** Shut down the framework library.
2007-06-28 10:47:08 -07:00
* This clears up all the Direct Draw stuff and ensures
* that Windows gets restored properly after Full screen mode .
*/
extern void frameShutDown ( void ) ;
2008-01-05 05:50:34 -08:00
/*!
* Set the framerate limit
*
* \ param fpsLimit Desired framerate
*/
extern void setFramerateLimit ( int fpsLimit ) ;
/*!
* Get the framerate limit
*
* \ return Desired framerate
*/
extern int getFramerateLimit ( void ) ;
2007-06-28 10:47:08 -07:00
2007-12-29 14:34:41 -08:00
/** Call this each cycle to allow the framework to deal with
2007-06-28 10:47:08 -07:00
* windows messages , and do general house keeping .
*/
2007-05-12 14:47:06 -07:00
extern void frameUpdate ( void ) ;
2007-06-28 10:47:08 -07:00
2008-03-30 07:11:33 -07:00
extern void frameSetCursor ( CURSOR cur ) ;
2007-06-28 10:47:08 -07:00
2007-12-29 14:34:41 -08:00
/** Returns the current frame we're on - used to establish whats on screen. */
2007-05-12 16:41:29 -07:00
extern UDWORD frameGetFrameNumber ( void ) ;
2007-06-28 10:47:08 -07:00
2007-12-29 14:34:41 -08:00
/** Return average framerate of the last seconds. */
2006-08-27 12:01:34 -07:00
extern UDWORD frameGetAverageRate ( void ) ;
2007-06-28 10:47:08 -07:00
2008-03-16 05:39:08 -07:00
extern UDWORD HashString ( const char * String ) ;
extern UDWORD HashStringIgnoreCase ( const char * String ) ;
2007-06-28 10:47:08 -07:00
2010-01-18 11:10:17 -08:00
# ifdef __cplusplus
}
# endif //__cplusplus
2008-09-20 16:24:17 -07:00
# if defined(WZ_OS_WIN)
2009-05-03 08:00:49 -07:00
# include <winsock2.h> /* for struct timeval */
2008-09-20 16:42:48 -07:00
struct timezone ;
2008-09-20 16:24:17 -07:00
extern int gettimeofday ( struct timeval * tv , struct timezone * tz ) ;
# endif
2006-08-12 03:45:49 -07:00
2008-03-25 07:41:04 -07:00
static inline WZ_DECL_CONST const char * bool2string ( bool var )
{
return ( var ? " true " : " false " ) ;
}
2007-06-28 10:47:08 -07:00
# endif