mirror of
https://github.com/tribes2/engine.git
synced 2026-03-03 20:40:26 +00:00
t2 engine svn checkout
This commit is contained in:
commit
ff569bd2ae
988 changed files with 394180 additions and 0 deletions
159
platform/platformVideo.h
Normal file
159
platform/platformVideo.h
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// V12 Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PLATFORMVIDEO_H_
|
||||
#define _PLATFORMVIDEO_H_
|
||||
|
||||
#ifndef _TYPES_H_
|
||||
#include "Platform/types.h"
|
||||
#endif
|
||||
#ifndef _TVECTOR_H_
|
||||
#include "Core/tVector.h"
|
||||
#endif
|
||||
#ifndef _PLATFORMASSERT_H_
|
||||
#include "Platform/platformAssert.h"
|
||||
#endif
|
||||
|
||||
enum devices
|
||||
{
|
||||
NO_DEVICE = -1,
|
||||
OPENGL_DEVICE,
|
||||
VOODOO2_DEVICE,
|
||||
N_DEVICES
|
||||
};
|
||||
|
||||
struct Resolution;
|
||||
class DisplayDevice;
|
||||
|
||||
|
||||
class Video
|
||||
{
|
||||
private:
|
||||
static Vector<DisplayDevice *> smDeviceList;
|
||||
static DisplayDevice* smCurrentDevice;
|
||||
static bool smCritical;
|
||||
|
||||
public:
|
||||
static bool smNeedResurrect;
|
||||
|
||||
static void init(); // enumerate all the devices
|
||||
static void destroy(); // clean up and shut down
|
||||
static bool installDevice( DisplayDevice *dev );
|
||||
static bool setDevice( const char *renderName, U32 width, U32 height, U32 bpp, bool fullScreen ); // set the current display device
|
||||
static bool setScreenMode( U32 width, U32 height, U32 bpp, bool fullScreen );
|
||||
static void deactivate(); // deactivate current display device
|
||||
static void reactivate(); // reactivate current display device
|
||||
static bool setResolution( U32 width, U32 height, U32 bpp ); // set the current resolution
|
||||
static bool toggleFullScreen(); // toggle full screen mode
|
||||
static DisplayDevice* getDevice( const char* renderName );
|
||||
static const char* getDeviceList(); // get a tab-separated list of all the installed display devices
|
||||
static const char* getResolutionList(); // get a tab-separated list of all the available resolutions for the current device
|
||||
static const char* getDriverInfo(); // get info about the current display device driver
|
||||
static bool prevRes(); // switch to the next smaller available resolution with the same bit depth
|
||||
static bool nextRes(); // switch to the next larger available resolution with the same bit depth
|
||||
static Resolution getResolution(); // get the current resolution
|
||||
//static GFXSurface *getSurface(); // get a renderable surface (can return NULL if the window is minimized)
|
||||
static bool isFullScreen(); // return the current screen state
|
||||
static void swapBuffers(); // page flip
|
||||
static bool getGammaCorrection(F32 &g); // get gamma correction
|
||||
static bool setGammaCorrection(F32 g); // set gamma correction
|
||||
static bool setVerticalSync( bool on ); // enable/disable vertical sync
|
||||
};
|
||||
|
||||
|
||||
struct Resolution
|
||||
{
|
||||
U32 w, h, bpp;
|
||||
|
||||
Resolution( U32 _w = 0, U32 _h = 0, U32 _bpp = 0 )
|
||||
{
|
||||
w = _w;
|
||||
h = _h;
|
||||
bpp = _bpp;
|
||||
}
|
||||
|
||||
bool operator==( const Resolution& otherRes ) const
|
||||
{
|
||||
return ( ( w == otherRes.w ) && ( h == otherRes.h ) && ( bpp == otherRes.bpp ) );
|
||||
}
|
||||
|
||||
void operator=( const Resolution& otherRes )
|
||||
{
|
||||
w = otherRes.w;
|
||||
h = otherRes.h;
|
||||
bpp = otherRes.bpp;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DisplayDevice
|
||||
{
|
||||
public:
|
||||
const char* mDeviceName;
|
||||
|
||||
protected:
|
||||
static Resolution smCurrentRes;
|
||||
static bool smIsFullScreen;
|
||||
|
||||
Vector<Resolution> mResolutionList;
|
||||
bool mFullScreenOnly;
|
||||
|
||||
public:
|
||||
DisplayDevice();
|
||||
|
||||
virtual void initDevice() = NULL;
|
||||
virtual bool activate( U32 width, U32 height, U32 bpp, bool fullScreen ) = NULL;
|
||||
virtual void shutdown() = NULL;
|
||||
|
||||
virtual bool setScreenMode( U32 width, U32 height, U32 bpp, bool fullScreen, bool forceIt = false, bool repaint = true ) = NULL;
|
||||
virtual bool setResolution( U32 width, U32 height, U32 bpp );
|
||||
virtual bool toggleFullScreen();
|
||||
virtual void swapBuffers() = NULL;
|
||||
virtual const char* getDriverInfo() = NULL;
|
||||
virtual bool getGammaCorrection(F32 &g) = NULL;
|
||||
virtual bool setGammaCorrection(F32 g) = NULL;
|
||||
virtual bool setVerticalSync( bool on ) = NULL;
|
||||
|
||||
bool prevRes();
|
||||
bool nextRes();
|
||||
const char* getResolutionList();
|
||||
bool isFullScreenOnly() { return( mFullScreenOnly ); }
|
||||
|
||||
static void init();
|
||||
static Resolution getResolution();
|
||||
static bool isFullScreen();
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline bool DisplayDevice::setResolution( U32 width, U32 height, U32 bpp )
|
||||
{
|
||||
return setScreenMode( width, height, bpp, smIsFullScreen );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline bool DisplayDevice::toggleFullScreen()
|
||||
{
|
||||
return setScreenMode( smCurrentRes.w, smCurrentRes.h, smCurrentRes.bpp, !smIsFullScreen );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline Resolution DisplayDevice::getResolution()
|
||||
{
|
||||
return smCurrentRes;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline bool DisplayDevice::isFullScreen()
|
||||
{
|
||||
return smIsFullScreen;
|
||||
}
|
||||
|
||||
#endif // _H_PLATFORMVIDEO
|
||||
Loading…
Add table
Add a link
Reference in a new issue