Esempio n. 1
0
	bool InitialiseFramework( PyObject* a_pModule )
	{
		bool bSuccess = false;
		PyObject* pInitialise = GetHandleToPythonFunction( a_pModule, "PyInitialise" );
		if( pInitialise )
		{
			PyObject* pReturnValue = CallPythonFunction( pInitialise, nullptr );
			if( pReturnValue )
			{
				int iWidth; int iHeight; bool bFullscreen; char* windowTitle;

				if (!PyArg_ParseTuple(pReturnValue, "iibs", &iWidth, &iHeight, &bFullscreen, &windowTitle)) 
				{
					ParsePyTupleError( __func__, __LINE__ );
				}
				Py_DECREF(pReturnValue);

				int titleLength = strlen(windowTitle);
				g_pWindowTitle = new char[titleLength+1];
				memcpy(g_pWindowTitle, windowTitle, titleLength);
				g_pWindowTitle[titleLength] = '\0';
				bSuccess = ( Initialise( iWidth, iHeight, bFullscreen, g_pWindowTitle) == 0 );
			}
			Py_XDECREF(pInitialise);
			
		}
		return bSuccess;
	}
Esempio n. 2
0
	// Destroy The Particle
	PyObject* Python::B2D_DestroyParticle (PyObject* Self, PyObject* Args){

		// Create Variables
		int particleType, particleReference;

		// Look For Errors
    	if (!PyArg_ParseTuple (Args, "ii", &particleType, &particleReference)){
    		ParsePyTupleError (__func__, __LINE__);
    	}

		// Set Function
		if (particleType == 0){

			Python::particlePointList[particleReference].Destroy();

			// Remove From List
			Python::particlePointList.erase (Python::particlePointList.begin() + particleReference);
		}

		else{

			Python::particleLineList[particleReference].Destroy();

			// Remove From List
			Python::particleLineList.erase (Python::particleLineList.begin() + particleReference);
		}

		Py_RETURN_NONE;
	}
//--------------------------- Sound
 PyObject* LMF_SoundLoad     (PyObject *self, PyObject *args){
	char* cPath;
	if (!PyArg_ParseTuple(args, "s", &cPath)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	int SoundID = SoundLoad(cPath);
	return Py_BuildValue("i", SoundID);
}
 PyObject* LMF_CameraRotate(PyObject *self, PyObject *args){
	float fRot;
	if (!PyArg_ParseTuple(args, "f", &fRot)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	CameraRotate(fRot);
	Py_RETURN_NONE;
}
 PyObject* LMF_ControllerVibrate    (PyObject *self, PyObject *args){
	int iControllerID,iLVal,iRVal;
	if (!PyArg_ParseTuple(args, "iii", &iControllerID, &iLVal, &iRVal)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ControllerVibrate(iControllerID,iLVal,iRVal);
	Py_RETURN_NONE;
}
 PyObject* LMF_FrameworkBlendMode(PyObject *self, PyObject *args){
	int iBegin, iFinal, iEqu;
	if (!PyArg_ParseTuple(args, "iii", &iBegin, &iFinal, &iEqu)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	FrameworkBlendMode(iBegin,iFinal,iEqu);
	Py_RETURN_NONE;
}
 PyObject* LMF_ControllerRemove     (PyObject *self, PyObject *args){
	int iControllerID;
	if (!PyArg_ParseTuple(args, "i", &iControllerID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ControllerRemove(iControllerID);
	Py_RETURN_NONE;
}
 PyObject* LMF_SoundVolumeMain(PyObject *self, PyObject *args){
	float fVol;
	if (!PyArg_ParseTuple(args, "f", &fVol)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundVolumeMain(fVol);
	Py_RETURN_NONE;
}
 PyObject* LMF_ShaderUnload(PyObject *self, PyObject *args){
	int ShaderID;
	if (!PyArg_ParseTuple(args, "i", &ShaderID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ShaderUnload(ShaderID);
	Py_RETURN_NONE;
}
 PyObject* LMF_FontUnload(PyObject *self, PyObject *args){
	unsigned int FontID;
	if (!PyArg_ParseTuple(args, "i", &FontID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	FontUnload(FontID);
	Py_RETURN_NONE;
}
//--------------------------- Fonts
 PyObject* LMF_FontLoad(PyObject *self, PyObject *args){
	char* path;
	if (!PyArg_ParseTuple(args, "s", &path)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	unsigned int FontID = FontLoad(path);
	return Py_BuildValue("i", FontID);
}
 PyObject* LMF_ModelDraw(PyObject *self, PyObject *args){
	unsigned int ModelID, Camera0_world1;
	if (!PyArg_ParseTuple(args, "i", &ModelID, &Camera0_world1)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ModelDraw(ModelID, Camera0_world1);
	Py_RETURN_NONE;
}
 PyObject* LMF_ParticleEmitterDraw(PyObject *self, PyObject *args){
	unsigned int EmitterID, Camera0_world1;
	if (!PyArg_ParseTuple(args, "ii", &EmitterID, &Camera0_world1)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ParticleEmitterDraw(EmitterID, Camera0_world1);
	Py_RETURN_NONE;
}
 PyObject* LMF_ParticleEmitterUnload(PyObject *self, PyObject *args){
	unsigned int EmitterID;
	if (!PyArg_ParseTuple(args, "i", &EmitterID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	ParticleEmitterUnload(EmitterID);
	Py_RETURN_NONE;
}
//--------------------------- Particle Emitters
 PyObject* LMF_ParticleEmitterLoadEmpty(PyObject *self, PyObject *args){
	unsigned int SpriteID;
	if (!PyArg_ParseTuple(args, "i", &SpriteID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	unsigned int EmitterID = ParticleEmitterLoad(SpriteID);
	return Py_BuildValue("i", EmitterID);
}
 PyObject* LMF_FrameworkFullscreen(PyObject *self, PyObject *args){
	int fullscr;
	if (!PyArg_ParseTuple(args, "i", &fullscr)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	FrameworkFullscreen(fullscr);
	Py_RETURN_NONE;
}
//--------------------------- MISC
 PyObject* LMF_VSyncSet(PyObject *self, PyObject *args){
	int vSyncMode;
	if (!PyArg_ParseTuple(args, "i", &vSyncMode)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	VSyncSet(vSyncMode);
	Py_RETURN_NONE;
}
//--------------------------- Advanced features
 PyObject* LMF_SoundLoop      (PyObject *self, PyObject *args){
	int iSoundID;
	if (!PyArg_ParseTuple(args, "i", &iSoundID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundLoop(iSoundID);
	Py_RETURN_NONE;
}
 PyObject* LMF_FrameworkBGColour(PyObject *self, PyObject *args){
	float fR,fG,fB,fA;
	if (!PyArg_ParseTuple(args, "ffff", &fR,&fG,&fB,&fA)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	FrameworkBGColour(fR,fG,fB,fA);
	Py_RETURN_NONE;
}
 PyObject* LMF_SoundPauseAll  (PyObject *self, PyObject *args){
	int bPaused;
	if (!PyArg_ParseTuple(args, "i", &bPaused)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundPauseAll(bPaused);
	Py_RETURN_NONE;
}
 PyObject* LMF_KeyReleased(PyObject *self, PyObject *args){
	int iKeyCode;
	if (!PyArg_ParseTuple(args, "i", &iKeyCode)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	int iKeyUp = KeyReleased(iKeyCode);
	return Py_BuildValue("i", iKeyUp);
}
 PyObject* LMF_ControllerConnected  (PyObject *self, PyObject *args){
	int iControllerID;
	if (!PyArg_ParseTuple(args, "i", &iControllerID)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	int iBConConnected = ControllerConnected(iControllerID);
	return Py_BuildValue("i", iBConConnected);
}						    
 PyObject* LMF_MousePosSet(PyObject *self, PyObject *args){
	int iX,iY;
	if (!PyArg_ParseTuple(args, "ii", &iX, &iY)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	MousePosSet(iX,iY);
	Py_RETURN_NONE;
}
 PyObject* LMF_ControllerButton     (PyObject *self, PyObject *args){
	int iControllerID,iButton;
	if (!PyArg_ParseTuple(args, "ii", &iControllerID, &iButton)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	int iButtonValue = ControllerButton(iControllerID,iButton);
	return Py_BuildValue("i", iButtonValue);
}
 PyObject* LMF_FrameworkWindowResize(PyObject *self, PyObject *args){
	int width, height;
	if (!PyArg_ParseTuple(args, "ii", &width,&height)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	FrameworkWindowResize(width,height);
	Py_RETURN_NONE;
}
//--------------------------- Camera
 PyObject* LMF_CameraMove(PyObject *self, PyObject *args){
	float fX,fY;
	if (!PyArg_ParseTuple(args, "ff", &fX,&fY)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	CameraMove(fX,fY);
	Py_RETURN_NONE;
}
 PyObject* LMF_MouseReleased (PyObject *self, PyObject *args){
	int iMouseButton;
	if (!PyArg_ParseTuple(args, "i", &iMouseButton)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	int iMouseState = MouseReleased(iMouseButton);
	return Py_BuildValue("i", iMouseState);
}
 PyObject* LMF_SoundRestart  (PyObject *self, PyObject *args){
	int bManager;
	if (!PyArg_ParseTuple(args, "i", &bManager)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundRestart(bManager);
	Py_RETURN_NONE;
}
 PyObject* LMF_CameraZoom(PyObject *self, PyObject *args){
	float fValue;
	if (!PyArg_ParseTuple(args, "f", &fValue)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	CameraZoom(fValue);
	Py_RETURN_NONE;
}
 PyObject* LMF_SoundSpeed (PyObject *self, PyObject *args){
	int iSoundID;
	float fSpeed;
	if (!PyArg_ParseTuple(args, "if", &iSoundID, &fSpeed)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundSpeed(iSoundID,fSpeed);
	Py_RETURN_NONE;
}