RageDisplay_Null
This commit is contained in:
@@ -202,6 +202,7 @@ RageFileDriverZip.cpp RageFileDriverZip.h
|
||||
|
||||
Rage = $(Helpers) $(PCRE)\
|
||||
RageBitmapTexture.cpp RageBitmapTexture.h RageDisplay.cpp RageDisplay.h RageDisplay_OGL.cpp RageDisplay_OGL.h \
|
||||
RageDisplay_Null.cpp RageDisplay_Null.h \
|
||||
RageException.cpp RageException.h RageInput.cpp RageInput.h \
|
||||
RageInputDevice.cpp RageInputDevice.h RageLog.cpp RageLog.h RageMath.cpp RageMath.h RageModelGeometry.cpp RageModelGeometry.h RageSound.cpp RageSound.h \
|
||||
RageSoundManager.cpp RageSoundManager.h RageSoundReader.h RageSoundReader_FileReader.cpp RageSoundReader_FileReader.h \
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
#include "global.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: RageDisplay
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2004 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
Glenn Maynard
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "SDL_utils.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
#include "RageDisplay.h"
|
||||
#include "RageDisplay_Null.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageTimer.h"
|
||||
#include "RageTexture.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "RageMath.h"
|
||||
#include "RageTypes.h"
|
||||
#include "StepMania.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[RageDisplay::NUM_PIX_FORMATS] = {
|
||||
{
|
||||
/* R8G8B8A8 */
|
||||
32,
|
||||
{ 0xFF000000,
|
||||
0x00FF0000,
|
||||
0x0000FF00,
|
||||
0x000000FF }
|
||||
}, {
|
||||
/* R4G4B4A4 */
|
||||
16,
|
||||
{ 0xF000,
|
||||
0x0F00,
|
||||
0x00F0,
|
||||
0x000F },
|
||||
}, {
|
||||
/* R5G5B5A1 */
|
||||
16,
|
||||
{ 0xF800,
|
||||
0x07C0,
|
||||
0x003E,
|
||||
0x0001 },
|
||||
}, {
|
||||
/* R5G5B5 */
|
||||
16,
|
||||
{ 0xF800,
|
||||
0x07C0,
|
||||
0x003E,
|
||||
0x0000 },
|
||||
}, {
|
||||
/* R8G8B8 */
|
||||
24,
|
||||
{ 0xFF0000,
|
||||
0x00FF00,
|
||||
0x0000FF,
|
||||
0x000000 }
|
||||
}, {
|
||||
/* Paletted */
|
||||
8,
|
||||
{ 0,0,0,0 } /* N/A */
|
||||
}, {
|
||||
/* B8G8R8A8 */
|
||||
24,
|
||||
{ 0x0000FF,
|
||||
0x00FF00,
|
||||
0xFF0000,
|
||||
0x000000 }
|
||||
}, {
|
||||
/* A1B5G5R5 */
|
||||
16,
|
||||
{ 0x7C00,
|
||||
0x03E0,
|
||||
0x001F,
|
||||
0x8000 },
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
RageDisplay_Null::RageDisplay_Null()
|
||||
{
|
||||
LOG->MapLog("renderer", "Current renderer: null");
|
||||
}
|
||||
|
||||
SDL_Surface* RageDisplay_Null::CreateScreenshot()
|
||||
{
|
||||
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[FMT_RGB8];
|
||||
SDL_Surface *image = SDL_CreateRGBSurfaceSane(
|
||||
SDL_SWSURFACE, 640, 480,
|
||||
desc.bpp, desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
|
||||
|
||||
memset( image->pixels, 0, 480*image->pitch );
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
const RageDisplay::PixelFormatDesc *RageDisplay_Null::GetPixelFormatDesc(PixelFormat pf) const
|
||||
{
|
||||
ASSERT( pf < NUM_PIX_FORMATS );
|
||||
return &PIXEL_FORMAT_DESC[pf];
|
||||
}
|
||||
|
||||
|
||||
RageMatrix RageDisplay_Null::GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf )
|
||||
{
|
||||
RageMatrix m(
|
||||
2/(r-l), 0, 0, 0,
|
||||
0, 2/(t-b), 0, 0,
|
||||
0, 0, -2/(zf-zn), 0,
|
||||
-(r+l)/(r-l), -(t+b)/(t-b), -(zf+zn)/(zf-zn), 1 );
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
void RageDisplay_Null::EndFrame()
|
||||
{
|
||||
ProcessStatsOnFlip();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
#ifndef RAGEDISPLAY_NULL_H
|
||||
#define RAGEDISPLAY_NULL_H
|
||||
|
||||
class RageDisplay_Null: public RageDisplay
|
||||
{
|
||||
public:
|
||||
RageDisplay_Null();
|
||||
void Update( float fDeltaTime ) { }
|
||||
|
||||
bool IsSoftwareRenderer() { return false; }
|
||||
void ResolutionChanged() { }
|
||||
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
||||
|
||||
void BeginFrame() { }
|
||||
void EndFrame();
|
||||
VideoModeParams GetVideoModeParams() const { return m_Params; }
|
||||
void SetBlendMode( BlendMode mode ) { }
|
||||
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) { return true; }
|
||||
bool Supports4BitPalettes() { return true; }
|
||||
unsigned CreateTexture(
|
||||
PixelFormat pixfmt,
|
||||
SDL_Surface* img,
|
||||
bool bGenerateMipMaps ) { return 1; }
|
||||
void UpdateTexture(
|
||||
unsigned uTexHandle,
|
||||
SDL_Surface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
) { }
|
||||
void DeleteTexture( unsigned uTexHandle ) { }
|
||||
void ClearAllTextures() { }
|
||||
void SetTexture( int iTextureUnitIndex, RageTexture* pTexture ) { }
|
||||
void SetTextureModeModulate() { }
|
||||
void SetTextureModeGlow( GlowMode m=GLOW_WHITEN ) { }
|
||||
void SetTextureModeAdd() { }
|
||||
void SetTextureWrapping( bool b ) { }
|
||||
int GetMaxTextureSize() const { return 2048; }
|
||||
void SetTextureFiltering( bool b) { }
|
||||
bool IsZWriteEnabled() const { return false; }
|
||||
bool IsZTestEnabled() const { return false; }
|
||||
void SetZWrite( bool b ) { }
|
||||
void SetZTest( bool b ) { }
|
||||
void ClearZBuffer() { }
|
||||
void SetCullMode( CullMode mode ) { }
|
||||
void SetAlphaTest( bool b ) { }
|
||||
void SetMaterial(
|
||||
const RageColor &emissive,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
float shininess
|
||||
) { }
|
||||
void SetLighting( bool b ) { }
|
||||
void SetLightOff( int index ) { }
|
||||
void SetLightDirectional(
|
||||
int index,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
const RageVector3 &dir ) { }
|
||||
|
||||
void SetSphereEnironmentMapping( bool b ) { }
|
||||
|
||||
void DrawQuads( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||
void DrawFan( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||
void DrawStrip( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||
void DrawTriangles( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||
void DrawIndexedTriangles( const RageModelVertex v[], int iNumVerts, const Uint16* pIndices, int iNumIndices ) { }
|
||||
void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { }
|
||||
|
||||
protected:
|
||||
VideoModeParams m_Params;
|
||||
CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return ""; }
|
||||
SDL_Surface* CreateScreenshot();
|
||||
void SetViewport(int shift_left, int shift_down) { }
|
||||
RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
|
||||
bool SupportsSurfaceFormat( PixelFormat pixfmt ) { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -351,6 +351,8 @@ static void CheckSettings()
|
||||
#include "RageDisplay_OGL.h"
|
||||
#endif
|
||||
|
||||
#include "RageDisplay_Null.h"
|
||||
|
||||
#include "archutils/Win32/VideoDriverInfo.h"
|
||||
|
||||
static const CString D3DURL = "http://search.microsoft.com/gomsuri.asp?n=1&c=rp_BestBets&siteid=us&target=http://www.microsoft.com/downloads/details.aspx?FamilyID=a19bed22-0b25-4e5d-a584-6389d8a3dad0&displaylang=en";
|
||||
@@ -653,6 +655,8 @@ RageDisplay *CreateDisplay()
|
||||
};
|
||||
#endif
|
||||
}
|
||||
else if( sRenderer.CompareNoCase("null")==0 )
|
||||
return new RageDisplay_Null();
|
||||
else
|
||||
RageException::Throw("Unknown video renderer value: %s", sRenderer.c_str() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user