/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2012 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#include	"Webcam_binding.h"
#include	"webcam.h"
#include	"script_squirrel/legacy/binding_helpers.h"
#include	"scene3d/mitem.h"

#include	"script_squirrel/cobject/squirrel_bindings_utils.h"
#include	"Webcam_decl.h"
#include <assert.h>
#include	"squirrel/squirrel/sqobject.h"
#include	"squirrel/squirrel/sqvm.h"
#include	"squirrel/include/squirrel.h"
#include	"squirrel/squirrel/sqstate.h"
#include	"squirrel/squirrel/sqtable.h"
#include	"squirrel/squirrel/sqclass.h"

using namespace GS;
using namespace GS::Script;


SQInteger			WebcamSetFrame(HSQUIRRELVM vm)
{
	HSQUIRRELVM v = vm;
	__SQ_GETSTART(3)
		_GetTypedParam(w, __sq_stackpos, Webcam, WebcamScriptBinding)
		__SQ_GETUPDATESTACK

		__SQ_GETFLOAT(c)
		__SQ_GETSTRING(path)

	__SQ_GETEND
	__SQ_RETURNINT((int)(w->SetFrame(c,path)))
}

//----------------------------------------------
void		nWebcamPluginScriptBinding::RegisterBinding(Script::IVM &vm)
//----------------------------------------------
{
	if(String(vm.GetName()) != "Squirrel")
		return;
/*#
	Topic: Webcam binding
	Type: Webcam
#*/

	HSQUIRRELVM v = ((SquirrelVM&)(vm)).VM();

	_INIT_CLASS(v, WebcamScriptBinding)

	/*#
	Func: SetFrame
	Proto: bool:Webcam clock tex
	Desc: SetFrame
	#*/
	sq_register(v, WebcamSetFrame, "WebcamSetFrame", _SC(".xfs"));
}

//------------------------------------------------------------------------------
#ifdef	_GS_DLL_EXPORT
extern "C" GSEXPORT void setSharedSystems(GS::SharedSystems &shared)
{	shared.Set();	}
extern "C" GSEXPORT nWebcamPluginScriptBinding *createPluginInterface()
{	return new nWebcamPluginScriptBinding;	}
extern "C" GSEXPORT const char *getPluginClass()
{	return nWebcamPluginScriptBinding::GetPluginClass();	}
extern "C" GSEXPORT int getPluginVersion()
{	return nWebcamPluginScriptBinding::GetPluginVersion();	}

#endif