Files
EgtExecutor/LUA_Picture.cpp
T
Dario Sassi f33513bdc5 EgtExecutor 1.8l3 :
- aggiunte funzioni Exe e Lua AddPicture
- migliorie alla gestione di Photo.
2017-12-27 17:05:29 +00:00

60 lines
1.8 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2017-2017
//----------------------------------------------------------------------------
// File : LUA_Picture.cpp Data : 26.12.17 Versione : 1.8l3
// Contenuto : Funzioni sulla immagine per LUA.
//
//
//
// Modifiche : 26.12.17 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EgnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaAddPicture( lua_State* L)
{
// 5 o 6 parametri : nParentId, nome per la texture, path della immagine, dDimX, dDimY [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
string sName ;
LuaCheckParam( L, 2, sName)
string sPath ;
LuaCheckParam( L, 3, sPath)
double dDimX ;
LuaCheckParam( L, 4, dDimX)
double dDimY ;
LuaCheckParam( L, 5, dDimY)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// inserisco l'immagine
int nId = ExeAddPicture( nParentId, sName, sPath, dDimX, dDimY, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallPicture( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddPicture", LuaAddPicture) ;
return bOk ;
}