add half-finished screen centering code (necessary for arcade and Xbox)

This commit is contained in:
Chris Danford
2003-10-11 01:51:36 +00:00
parent 9cf3f9b331
commit 70446551a9
12 changed files with 70 additions and 14 deletions
@@ -0,0 +1 @@
_options to options
@@ -0,0 +1 @@
_options to options
@@ -0,0 +1 @@
_shared footer
@@ -0,0 +1 @@
_shared menu header
+20 -10
View File
@@ -1747,6 +1747,11 @@ OddLineOut=stoptweening;accelerate,0.3;addx,640;
StyleIcon=0 StyleIcon=0
TimerSeconds=0 TimerSeconds=0
[ScreenCenterImage]
HelpText=Use arrow keys to navigate, ENTER to assign, SPACE to clear, ESCAPE when done.
StyleIcon=0
TimerSeconds=0
[HoldGhostArrow] [HoldGhostArrow]
WarmUpSeconds=0.25 WarmUpSeconds=0.25
@@ -2558,19 +2563,20 @@ OptionMenuFlags=together;forceallplayers;rows,11;smnavigation
# This NextScreen is only used for the "exit" choice. # This NextScreen is only used for the "exit" choice.
NextScreen=ScreenTitleMenu NextScreen=ScreenTitleMenu
PrevScreen=ScreenTitleMenu PrevScreen=ScreenTitleMenu
NumRows=12 NumRows=13
Line1=list,Appearance Options;title,; Line1=list,Appearance Options;title,;
Line2=list,Autogen Options;title,; Line2=list,Autogen Options;title,;
Line3=list,Background Options;title,; Line3=list,Background Options;title,;
Line4=list,Coin Options;title,; Line4=list,Center Image;title,;
Line5=list,Config Key/Joy Mappings;title,; Line5=list,Coin Options;title,;
Line6=list,Input Options;title,; Line6=list,Config Key/Joy Mappings;title,;
Line7=list,Gameplay Options;title,; Line7=list,Input Options;title,;
Line8=list,Graphic Options;title,; Line8=list,Gameplay Options;title,;
Line9=list,Machine Options;title,; Line9=list,Graphic Options;title,;
Line10=list,Sound Options;title,; Line10=list,Machine Options;title,;
Line11=list,Profile Options;title,; Line11=list,Sound Options;title,;
Line12=list,Reload Songs/Courses;title,; Line12=list,Profile Options;title,;
Line13=list,Reload Songs/Courses;title,;
[TextBanner] [TextBanner]
Width=180 Width=180
@@ -3059,6 +3065,10 @@ Background Options=1,together
Background OptionsDefault= Background OptionsDefault=
Background Options,1=screen,ScreenBackgroundOptions@ScreenOptionsMaster Background Options,1=screen,ScreenBackgroundOptions@ScreenOptionsMaster
Background OptionsName,1=Background Options Background OptionsName,1=Background Options
Center Image=1,together
Center ImageDefault=
Center Image,1=screen,ScreenCenterImage
Center ImageName,1=Center Image
Coin Options=1,together Coin Options=1,together
Coin OptionsDefault= Coin OptionsDefault=
Coin Options,1=screen,ScreenCoinOptions@ScreenOptionsMaster Coin Options,1=screen,ScreenCoinOptions@ScreenOptionsMaster
+20
View File
@@ -206,6 +206,7 @@ void RageDisplay::SetDefaultRenderStates()
SetBlendMode( BLEND_NORMAL ); SetBlendMode( BLEND_NORMAL );
SetTextureFiltering( true ); SetTextureFiltering( true );
LoadMenuPerspective(0, CENTER_X, CENTER_Y); // 0 FOV = ortho LoadMenuPerspective(0, CENTER_X, CENTER_Y); // 0 FOV = ortho
ResetCentering();
} }
@@ -619,3 +620,22 @@ RageMatrix RageDisplay::GetFrustumMatrix( float l, float r, float b, float t, fl
0, 0, D, 0 ); 0, 0, D, 0 );
return m; return m;
} }
void RageDisplay::ResetCentering()
{
RageMatrixIdentity( &m_Centering );
}
void RageDisplay::CenteringTranslate( float x, float y, float z )
{
RageMatrix m;
RageMatrixTranslation( &m, x, y, z );
RageMatrixMultiply( &m_Centering, &m, &m_Centering );
}
void RageDisplay::CenteringScale( float x, float y, float z )
{
RageMatrix m;
RageMatrixScaling( &m, x, y, z );
RageMatrixMultiply( &m_Centering, &m, &m_Centering );
}
+12
View File
@@ -247,6 +247,12 @@ public:
void LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY ); void LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY );
void LoadLookAt( float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up ); void LoadLookAt( float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up );
/* Centering matrix */
void CenteringTranslate( float x, float y, float z );
void CenteringScale( float x, float y, float z );
void ResetCentering();
SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch ); SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask ); PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask );
@@ -257,7 +263,13 @@ protected:
virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) = 0; virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) = 0;
virtual RageMatrix GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf ); virtual RageMatrix GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf );
//
// Matrix that adjusts position and scale of image on the screen
//
RageMatrix m_Centering;
// Called by the RageDisplay derivitives // Called by the RageDisplay derivitives
const RageMatrix* GetCentering() { return &m_Centering; }
const RageMatrix* GetProjectionTop(); const RageMatrix* GetProjectionTop();
const RageMatrix* GetViewTop(); const RageMatrix* GetViewTop();
const RageMatrix* GetWorldTop(); const RageMatrix* GetWorldTop();
+4 -3
View File
@@ -243,11 +243,12 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
LOG->Trace( LOG->Trace(
"Driver: %s\n" "Driver: %s\n"
"Description: %s\n" "Description: %s\n"
"Max texture size: %d\n", "Max texture size: %d\n"
"Alpha in palette: %s\n",
identifier.Driver, identifier.Driver,
identifier.Description, identifier.Description,
g_DeviceCaps.MaxTextureWidth g_DeviceCaps.MaxTextureWidth,
); (g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) ? "yes" : "no" );
LOG->Trace( "This display adaptor supports the following modes:" ); LOG->Trace( "This display adaptor supports the following modes:" );
D3DDISPLAYMODE mode; D3DDISPLAYMODE mode;
+2 -1
View File
@@ -741,7 +741,8 @@ static void SetupVertices( const RageSpriteVertex v[], int iNumVerts )
glMatrixMode( GL_PROJECTION ); \ glMatrixMode( GL_PROJECTION ); \
glLoadMatrixf( (const float*)GetProjectionTop() ); \ glLoadMatrixf( (const float*)GetProjectionTop() ); \
RageMatrix modelView; \ RageMatrix modelView; \
RageMatrixMultiply( &modelView, GetViewTop(), GetWorldTop() ); \ RageMatrixMultiply( &modelView, GetCentering(), GetViewTop() ); \
RageMatrixMultiply( &modelView, &modelView, GetWorldTop() ); \
glMatrixMode( GL_MODELVIEW ); \ glMatrixMode( GL_MODELVIEW ); \
glLoadMatrixf( (const float*)&modelView ); \ glLoadMatrixf( (const float*)&modelView ); \
+5
View File
@@ -96,6 +96,10 @@ RageMatrix RageMatrix::GetTranspose() const
void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB ) void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB )
{ {
//#if defined(_WINDOWS) || defined(_XBOX)
// // <30 cycles for theirs versus >100 for ours.
// D3DXMatrixMultiply( (D3DMATRIX*)pOut, (D3DMATRIX*)pA, (D3DMATRIX*)pB );
//#else
const RageMatrix &a = *pA; const RageMatrix &a = *pA;
const RageMatrix &b = *pB; const RageMatrix &b = *pB;
@@ -118,6 +122,7 @@ void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatri
b.m30*a.m03+b.m31*a.m13+b.m32*a.m23+b.m33*a.m33 b.m30*a.m03+b.m31*a.m13+b.m32*a.m23+b.m33*a.m33
); );
// phew! // phew!
//#endif
} }
void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z ) void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z )
+2
View File
@@ -288,6 +288,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
#include "ScreenAttract.h" #include "ScreenAttract.h"
#include "ScreenReloadSongs.h" #include "ScreenReloadSongs.h"
#include "ScreenOptionsMaster.h" #include "ScreenOptionsMaster.h"
#include "ScreenCenterImage.h"
Screen* Screen::Create( CString sClassName ) Screen* Screen::Create( CString sClassName )
{ {
@@ -385,6 +386,7 @@ Screen* Screen::Create( CString sClassName )
IF_RETURN( ScreenExit ); IF_RETURN( ScreenExit );
IF_RETURN( ScreenReloadSongs ); IF_RETURN( ScreenReloadSongs );
IF_RETURN( ScreenOptionsMaster ); IF_RETURN( ScreenOptionsMaster );
IF_RETURN( ScreenCenterImage );
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() ); RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
} }
+1
View File
@@ -21,6 +21,7 @@
#include "GameState.h" #include "GameState.h"
#include "RageSounds.h" #include "RageSounds.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageDisplay.h"
#define EVEN_LINE_IN THEME->GetMetric("ScreenMapControllers","EvenLineIn") #define EVEN_LINE_IN THEME->GetMetric("ScreenMapControllers","EvenLineIn")