Added __screen__ special texture name. Added AMV:GetTexture, RageTexture:Reload, and Screen:SetNextScreenName lua functions.

This commit is contained in:
Kyzentun
2014-09-02 05:18:29 -06:00
parent aac32f81ad
commit 4f2b92a25a
10 changed files with 74 additions and 3 deletions
+3
View File
@@ -490,6 +490,7 @@
<Function name='GetDestFirstToDraw'/> <Function name='GetDestFirstToDraw'/>
<Function name='GetDestNumToDraw'/> <Function name='GetDestNumToDraw'/>
<Function name='GetNumVertices'/> <Function name='GetNumVertices'/>
<Function name='GetTexture'/>
<Function name='LoadTexture'/> <Function name='LoadTexture'/>
<Function name='SetDrawState'/> <Function name='SetDrawState'/>
<Function name='SetEffectMode'/> <Function name='SetEffectMode'/>
@@ -1297,6 +1298,7 @@
<Function name='loop'/> <Function name='loop'/>
<Function name='position'/> <Function name='position'/>
<Function name='rate'/> <Function name='rate'/>
<Function name='Reload'/>
</Class> </Class>
<Class base='RageTexture' name='RageTextureRenderTarget'> <Class base='RageTexture' name='RageTextureRenderTarget'>
<Function name='BeginRenderingTo'/> <Function name='BeginRenderingTo'/>
@@ -1316,6 +1318,7 @@
<Function name='Metric'/> <Function name='Metric'/>
<Function name='PostScreenMessage'/> <Function name='PostScreenMessage'/>
<Function name='RemoveInputCallback'/> <Function name='RemoveInputCallback'/>
<Function name='SetNextScreenName'/>
<Function name='String'/> <Function name='String'/>
<Function name='lockinput'/> <Function name='lockinput'/>
</Class> </Class>
+9
View File
@@ -1538,6 +1538,9 @@ save yourself some time, copy this for undocumented things:
<Function name='GetCurrNumToDraw' return='int' arguments='void'> <Function name='GetCurrNumToDraw' return='int' arguments='void'>
Get the NumToDraw of the current tween state. Get the NumToDraw of the current tween state.
</Function> </Function>
<Function name='GetTexture' return='RageTexture' arguments=''>
Returns the ActorMultiVertex's texture.
</Function>
<Function name='SetEffectMode' return='void' arguments='EffectMode em'> <Function name='SetEffectMode' return='void' arguments='EffectMode em'>
Sets the <Link class='ENUM' function='EffectMode'>EffectMode</Link> of the ActorMultiVertex. Sets the <Link class='ENUM' function='EffectMode'>EffectMode</Link> of the ActorMultiVertex.
</Function> </Function>
@@ -3724,6 +3727,9 @@ save yourself some time, copy this for undocumented things:
<Function name='rate' return='void' arguments='float fRate'> <Function name='rate' return='void' arguments='float fRate'>
Sets the animation or movie playback rate to <code>fRate</code>. Sets the animation or movie playback rate to <code>fRate</code>.
</Function> </Function>
<Function name='Reload' return='void' arguments=''>
Reloads the texture.
</Function>
</Class> </Class>
<Class name='RollingNumbers'> <Class name='RollingNumbers'>
<Function name='Load' return='void' arguments='string sGroupName'> <Function name='Load' return='void' arguments='string sGroupName'>
@@ -3779,6 +3785,9 @@ save yourself some time, copy this for undocumented things:
<Function name='RemoveInputCallback' return='void' arguments='function callback'> <Function name='RemoveInputCallback' return='void' arguments='function callback'>
This removes the callback from the list. This removes the callback from the list.
</Function> </Function>
<Function name='SetNextScreenName' return='void' arguments='string name'>
Sets the NextScreen value to name.
</Function>
<Function name='String' theme='_fallback' return='string' arguments='string sName'> <Function name='String' theme='_fallback' return='string' arguments='string sName'>
[02 Other.lua] Gets a string from the current Screen in the current language. [02 Other.lua] Gets a string from the current Screen in the current language.
</Function> </Function>
+14
View File
@@ -645,6 +645,19 @@ public:
p->SetTexture( Texture ); p->SetTexture( Texture );
return 0; return 0;
} }
static int GetTexture(T* p, lua_State *L)
{
RageTexture *texture = p->GetTexture();
if(texture != NULL)
{
texture->PushSelf(L);
}
else
{
lua_pushnil(L);
}
return 1;
}
LunaActorMultiVertex() LunaActorMultiVertex()
{ {
@@ -668,6 +681,7 @@ public:
// Copy from RageTexture // Copy from RageTexture
ADD_METHOD( SetTexture ); ADD_METHOD( SetTexture );
ADD_METHOD( GetTexture );
// Load from file path // Load from file path
ADD_METHOD( LoadTexture ); ADD_METHOD( LoadTexture );
} }
+1
View File
@@ -75,6 +75,7 @@ public:
void FinishTweening(); void FinishTweening();
void SetTexture( RageTexture *Texture ); void SetTexture( RageTexture *Texture );
RageTexture* GetTexture() { return _Texture; };
void LoadFromTexture( RageTextureID ID ); void LoadFromTexture( RageTextureID ID );
void UnloadTexture(); void UnloadTexture();
+10 -2
View File
@@ -65,7 +65,15 @@ void RageBitmapTexture::Create()
/* Load the image into a RageSurface. */ /* Load the image into a RageSurface. */
RString error; RString error;
RageSurface *pImg = RageSurfaceUtils::LoadFile( actualID.filename, error ); RageSurface *pImg= NULL;
if(actualID.filename == TEXTUREMAN->GetScreenTextureID().filename)
{
pImg= TEXTUREMAN->GetScreenSurface();
}
else
{
pImg= RageSurfaceUtils::LoadFile(actualID.filename, error);
}
/* Tolerate corrupt/unknown images. */ /* Tolerate corrupt/unknown images. */
if( pImg == NULL ) if( pImg == NULL )
@@ -122,7 +130,7 @@ void RageBitmapTexture::Create()
m_iSourceWidth = pImg->w; m_iSourceWidth = pImg->w;
m_iSourceHeight = pImg->h; m_iSourceHeight = pImg->h;
/* in-game imsage dimensions are the same as the source graphic */ /* in-game image dimensions are the same as the source graphic */
m_iImageWidth = m_iSourceWidth; m_iImageWidth = m_iSourceWidth;
m_iImageHeight = m_iSourceHeight; m_iImageHeight = m_iSourceHeight;
+6
View File
@@ -84,6 +84,11 @@ public:
lua_pushnumber(L, p->GetNumFrames()); lua_pushnumber(L, p->GetNumFrames());
return 1; return 1;
} }
static int Reload(T* p, lua_State* L)
{
p->Reload();
return 0;
}
LunaRageTexture() LunaRageTexture()
{ {
@@ -92,6 +97,7 @@ public:
ADD_METHOD( rate ); ADD_METHOD( rate );
ADD_METHOD( GetTextureCoordRect ); ADD_METHOD( GetTextureCoordRect );
ADD_METHOD( GetNumFrames ); ADD_METHOD( GetNumFrames );
ADD_METHOD( Reload );
} }
}; };
+20 -1
View File
@@ -100,6 +100,17 @@ RageTextureID RageTextureManager::GetDefaultTextureID()
return RageTextureID( g_sDefaultTextureName ); return RageTextureID( g_sDefaultTextureName );
} }
static const RString g_ScreenTextureName = "__screen__";
RageTextureID RageTextureManager::GetScreenTextureID()
{
return RageTextureID(g_ScreenTextureName);
}
RageSurface* RageTextureManager::GetScreenSurface()
{
return DISPLAY->CreateScreenshot();
}
class RageTexture_Default: public RageTexture class RageTexture_Default: public RageTexture
{ {
public: public:
@@ -141,11 +152,19 @@ RageTexture* RageTextureManager::LoadTextureInternal( RageTextureID ID )
RageTexture* pTexture; RageTexture* pTexture;
if( ID.filename == g_sDefaultTextureName ) if( ID.filename == g_sDefaultTextureName )
{
pTexture = new RageTexture_Default; pTexture = new RageTexture_Default;
else if( sExt == "ogv" || sExt == "avi" || sExt == "mpg" || sExt == "mpeg" || sExt == "mp4" || sExt == "mkv" || sExt == "mov" || sExt == "flv" || sExt == "f4v") }
else if(sExt == "ogv" || sExt == "avi" || sExt == "mpg" ||
sExt == "mpeg" || sExt == "mp4" || sExt == "mkv" || sExt == "mov" ||
sExt == "flv" || sExt == "f4v")
{
pTexture = RageMovieTexture::Create( ID ); pTexture = RageMovieTexture::Create( ID );
}
else else
{
pTexture = new RageBitmapTexture( ID ); pTexture = new RageBitmapTexture( ID );
}
m_mapPathToTexture[ID] = pTexture; m_mapPathToTexture[ID] = pTexture;
+3
View File
@@ -4,6 +4,7 @@
#define RAGE_TEXTURE_MANAGER_H #define RAGE_TEXTURE_MANAGER_H
#include "RageTexture.h" #include "RageTexture.h"
#include "RageSurface.h"
struct RageTextureManagerPrefs struct RageTextureManagerPrefs
{ {
@@ -81,6 +82,8 @@ public:
bool GetOddDimensionWarning() const { return m_iNoWarnAboutOddDimensions == 0; } bool GetOddDimensionWarning() const { return m_iNoWarnAboutOddDimensions == 0; }
RageTextureID GetDefaultTextureID(); RageTextureID GetDefaultTextureID();
RageTextureID GetScreenTextureID();
RageSurface* GetScreenSurface();
private: private:
void DeleteTexture( RageTexture *t ); void DeleteTexture( RageTexture *t );
+7
View File
@@ -268,6 +268,11 @@ RString Screen::GetNextScreenName() const
return NEXT_SCREEN; return NEXT_SCREEN;
} }
void Screen::SetNextScreenName(RString const& name)
{
m_sNextScreen= name;
}
RString Screen::GetPrevScreen() const RString Screen::GetPrevScreen() const
{ {
if( !m_sPrevScreen.empty() ) if( !m_sPrevScreen.empty() )
@@ -403,6 +408,7 @@ class LunaScreen: public Luna<Screen>
{ {
public: public:
static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; } static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; }
static int SetNextScreenName( T* p, lua_State *L ) { p->SetNextScreenName(SArg(1)); return 0; }
static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; } static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; }
static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; } static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; }
DEFINE_METHOD( GetScreenType, GetScreenType() ) DEFINE_METHOD( GetScreenType, GetScreenType() )
@@ -438,6 +444,7 @@ public:
LunaScreen() LunaScreen()
{ {
ADD_METHOD( GetNextScreenName ); ADD_METHOD( GetNextScreenName );
ADD_METHOD( SetNextScreenName );
ADD_METHOD( GetPrevScreenName ); ADD_METHOD( GetPrevScreenName );
ADD_METHOD( PostScreenMessage ); ADD_METHOD( PostScreenMessage );
ADD_METHOD( lockinput ); ADD_METHOD( lockinput );
+1
View File
@@ -123,6 +123,7 @@ protected:
public: public:
RString GetNextScreenName() const; RString GetNextScreenName() const;
RString GetPrevScreen() const; RString GetPrevScreen() const;
void SetNextScreenName(RString const& name);
bool PassInputToLua(const InputEventPlus& input); bool PassInputToLua(const InputEventPlus& input);
void AddInputCallbackFromStack(lua_State* L); void AddInputCallbackFromStack(lua_State* L);