This commit is contained in:
Glenn Maynard
2007-03-24 00:39:49 +00:00
parent 6f71043cc9
commit 15feca28cf
2 changed files with 48 additions and 1 deletions
+44
View File
@@ -416,6 +416,21 @@ RageDisplay::RageDisplay()
g_ViewStack = MatrixStack();
g_WorldStack = MatrixStack();
g_TextureStack = MatrixStack();
// Register with Lua.
{
Lua *L = LUA->Get();
lua_pushstring( L, "DISPLAY" );
this->PushSelf( L );
lua_settable( L, LUA_GLOBALSINDEX );
LUA->Release( L );
}
}
RageDisplay::~RageDisplay()
{
// Unregister with Lua.
LUA->UnsetGlobal( "DISPLAY" );
}
const RageMatrix* RageDisplay::GetCentering() const
@@ -955,6 +970,35 @@ void RageCompiledGeometry::Set( const vector<msMesh> &vMeshes, bool bNeedsNormal
Change( vMeshes );
}
// lua start
#include "LuaBinding.h"
class LunaRageDisplay: public Luna<RageDisplay>
{
public:
static int GetDisplayWidth( T* p, lua_State *L )
{
VideoModeParams params = p->GetActualVideoModeParams();
LuaHelpers::Push( L, params.width );
return 1;
}
static int GetDisplayHeight( T* p, lua_State *L )
{
VideoModeParams params = p->GetActualVideoModeParams();
LuaHelpers::Push( L, params.height );
return 1;
}
LunaRageDisplay()
{
ADD_METHOD( GetDisplayWidth );
ADD_METHOD( GetDisplayHeight );
}
};
LUA_REGISTER_CLASS( RageDisplay )
// lua end
/*
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
+4 -1
View File
@@ -172,7 +172,7 @@ public:
virtual const PixelFormatDesc *GetPixelFormatDesc( PixelFormat pf ) const = 0;
RageDisplay();
virtual ~RageDisplay() { }
virtual ~RageDisplay();
virtual RString Init( const VideoModeParams &p, bool bAllowUnacceleratedRenderer ) = 0;
@@ -378,6 +378,9 @@ public:
RageSurface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask, bool realtime=false );
// Lua
void PushSelf( lua_State *L );
protected:
RageMatrix GetPerspectiveMatrix( float fovy, float aspect, float zNear, float zFar );