本文整理汇总了C++中CScriptArgReader::ReadVector2D方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::ReadVector2D方法的具体用法?C++ CScriptArgReader::ReadVector2D怎么用?C++ CScriptArgReader::ReadVector2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CScriptArgReader
的用法示例。
在下文中一共展示了CScriptArgReader::ReadVector2D方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetCursorPosition
int CLuaFunctionDefs::SetCursorPosition ( lua_State* luaVM )
{
CVector2D vecPosition;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecPosition );
if ( !argStream.HasErrors ( ) )
{
HWND hookedWindow = g_pCore->GetHookedWindow ();
tagPOINT windowPos = { 0 };
ClientToScreen( hookedWindow, &windowPos );
CVector2D vecResolution = g_pCore->GetGUI ()->GetResolution ();
if ( vecPosition.fX < 0 )
vecPosition.fX = 0.0f;
else if ( vecPosition.fX > vecResolution.fX )
vecPosition.fX = vecResolution.fX;
if ( vecPosition.fY < 0 )
vecPosition.fY = 0.0f;
else if ( vecPosition.fY > vecResolution.fY )
vecPosition.fY = vecResolution.fY;
g_pCore->CallSetCursorPos ( ( int ) vecPosition.fX + ( int ) windowPos.x, ( int ) vecPosition.fY + ( int ) windowPos.y );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例2: CreateColRectangle
int CLuaColShapeDefs::CreateColRectangle ( lua_State* luaVM )
{
CVector2D vecPosition;
CVector2D vecSize;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecPosition );
argStream.ReadVector2D ( vecSize );
if ( vecSize.fX < 0.0f )
{
vecSize.fX = 0.1f;
}
if ( vecSize.fY < 0.0f )
{
vecSize.fY = 0.1f;
}
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
// Create it and return it
CClientColRectangle* pShape = CStaticFunctionDefinitions::CreateColRectangle ( *pResource, vecPosition, vecSize );
if ( pShape )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( (CClientEntity*) pShape );
}
lua_pushelement ( luaVM, pShape );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例3: argStream
int CLuaVector2Defs::Create ( lua_State* luaVM )
{
CVector2D vector;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsTable () )
{
lua_pushvalue ( luaVM, 1 );
lua_pushstring ( luaVM, "x" );
lua_rawget ( luaVM, -2 );
if ( lua_isnumber ( luaVM, -1 ) )
{
vector.fX = ( float ) lua_tonumber ( luaVM, -1 );
lua_pop ( luaVM, 1 );
}
else
{
lua_pop ( luaVM, 1 );
lua_rawgeti ( luaVM, -1, 1 );
if ( lua_isnumber ( luaVM, -1 ) )
vector.fX = ( float ) lua_tonumber ( luaVM, -1 );
lua_pop ( luaVM, 1 );
}
lua_pushstring ( luaVM, "y" );
lua_rawget ( luaVM, -2 );
if ( lua_isnumber ( luaVM, -1 ) )
{
vector.fY = ( float ) lua_tonumber ( luaVM, -1 );
lua_pop ( luaVM, 1 );
}
else
{
lua_pop ( luaVM, 1 );
lua_rawgeti ( luaVM, -1, 2 );
if ( lua_isnumber ( luaVM, -1 ) )
vector.fY = ( float ) lua_tonumber ( luaVM, -1 );
lua_pop ( luaVM, 1 );
}
}
else if ( argStream.NextIsNumber () )
{
argStream.ReadNumber ( vector.fX );
if ( argStream.NextIsNumber () )
{
argStream.ReadNumber ( vector.fY );
}
}
else if ( argStream.NextIsVector2D () )
{
argStream.ReadVector2D ( vector );
}
lua_pushvector ( luaVM, vector );
return 1;
}
示例4: CreateColPolygon
int CLuaColShapeDefs::CreateColPolygon ( lua_State* luaVM )
{
CVector2D vecPosition;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecPosition );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
// Create it and return it
CClientColPolygon* pShape = CStaticFunctionDefinitions::CreateColPolygon ( *pResource, vecPosition );
if ( pShape )
{
// Get the points
while ( argStream.NextCouldBeNumber () && argStream.NextCouldBeNumber ( 1 ) )
{
argStream.ReadVector2D ( vecPosition );
pShape->AddPoint ( vecPosition );
}
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pShape );
}
lua_pushelement ( luaVM, pShape );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例5: CreateRadarArea
int CLuaRadarAreaDefs::CreateRadarArea ( lua_State* luaVM )
{
// radararea createRadarArea ( float leftX, float bottomY, float sizeX, float sizeY, [ int r = 255, int g = 0, int b = 0, int a = 255, element visibleTo = getRootElement() ] )
CVector2D vecPosition; CVector2D vecSize; float dRed; float dGreen; float dBlue; float dAlpha;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecPosition );
argStream.ReadVector2D ( vecSize );
argStream.ReadNumber ( dRed, 255 );
argStream.ReadNumber ( dGreen, 0 );
argStream.ReadNumber ( dBlue, 0 );
argStream.ReadNumber ( dAlpha, 255 );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
CResource* pResource = pLuaMain ? pLuaMain->GetResource () : NULL;
if ( pResource )
{
SColorARGB color ( dAlpha, dRed, dGreen, dBlue );
// Create it
CClientRadarArea* pRadarArea = CStaticFunctionDefinitions::CreateRadarArea ( *pResource, vecPosition, vecSize, color );
if ( pRadarArea )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( (CClientEntity*) pRadarArea );
}
lua_pushelement ( luaVM, pRadarArea );
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: CreateBrowser
int CLuaFunctionDefs::CreateBrowser ( lua_State* luaVM )
{
// texture createBrowser ( int width, int height, bool isLocal [, bool transparent = false] )
CVector2D vecSize; bool bIsLocal; bool bTransparent;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecSize );
argStream.ReadBool ( bIsLocal );
argStream.ReadBool ( bTransparent, false );
if ( !argStream.HasErrors () )
{
if ( !bIsLocal && !g_pCore->GetWebCore()->GetRemotePagesEnabled () )
{
lua_pushboolean ( luaVM, false );
return 1;
}
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pParentResource = pLuaMain->GetResource ();
CClientWebBrowser* pBrowserTexture = g_pClientGame->GetManager ()->GetRenderElementManager ()->CreateWebBrowser ( (int)vecSize.fX, (int)vecSize.fY, bIsLocal, bTransparent );
if ( pBrowserTexture )
{
// Make it a child of the resource's file root ** CHECK Should parent be pFileResource, and element added to pParentResource's ElementGroup? **
pBrowserTexture->SetParent ( pParentResource->GetResourceDynamicEntity () );
// Set our owner resource
pBrowserTexture->SetResource ( pParentResource );
}
lua_pushelement ( luaVM, pBrowserTexture );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例7: argStream
int CLuaFunctionDefs::GetDistanceBetweenPoints2D ( lua_State* luaVM )
{
CVector2D vecA, vecB;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecA );
argStream.ReadVector2D ( vecB );
if ( !argStream.HasErrors () )
{
lua_pushnumber ( luaVM, DistanceBetweenPoints2D ( vecA, vecB ) );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例8: InjectBrowserMouseMove
int CLuaFunctionDefs::InjectBrowserMouseMove ( lua_State* luaVM )
{
// bool injectBrowserMouseMove(browser webBrowser, int x, int y)
CClientWebBrowser* pWebBrowser; CVector2D vecPosition;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadVector2D ( vecPosition );
if ( !argStream.HasErrors () )
{
pWebBrowser->InjectMouseMove ( (int)vecPosition.fX, (int)vecPosition.fY );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例9: argStream
int CLuaFunctionDefs::GetDistanceBetweenPoints2D ( lua_State* luaVM )
{
// float getDistanceBetweenPoints2D ( float x1, float y1, float x2, float y2 )
CVector2D vecPointA; CVector2D vecPointB;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecPointA );
argStream.ReadVector2D ( vecPointB );
if ( !argStream.HasErrors () )
{
// Return the distance
lua_pushnumber ( luaVM, DistanceBetweenPoints2D ( vecPointA, vecPointB ) );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例10: SetRadarAreaSize
int CLuaRadarAreaDefs::SetRadarAreaSize ( lua_State* luaVM )
{
// bool setRadarAreaSize ( radararea theRadararea, float x, float y )
CClientRadarArea* pRadarArea; CVector2D vecSize;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pRadarArea );
argStream.ReadVector2D ( vecSize );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetRadarAreaSize ( pRadarArea, vecSize ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例11: IsInsideRadarArea
int CLuaRadarAreaDefs::IsInsideRadarArea ( lua_State* luaVM )
{
// bool isInsideRadarArea ( radararea theArea, float posX, float posY )
CClientRadarArea* pRadarArea; CVector2D vecPosition;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pRadarArea );
argStream.ReadVector2D ( vecPosition );
if ( !argStream.HasErrors () )
{
bool bInside = false;
if ( CStaticFunctionDefinitions::IsInsideRadarArea ( pRadarArea, vecPosition, bInside ) )
{
lua_pushboolean ( luaVM, bInside );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}