Beispiel #1
0
static PyObject *
PySfRenderWindow_SetActive(PySfRenderWindow *self, PyObject *args)
{
	PyObject*  Active( 0 );

	PyArg_ParseTuple( args, "|O", &Active );
	self->obj->SetActive( Active == 0 ? true : PyBool_AsBool( Active ) );

	Py_RETURN_NONE;
}
Beispiel #2
0
bool CustomSoundRecorder::OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount)
{
	bool result = false;
	if (PyObject_HasAttrString(SoundRecorder, "OnGetData"))
	{
		PyObject *OnGetData = PyObject_GetAttrString(SoundRecorder, "OnGetData");
		PyObject *Result = PyObject_CallFunction(OnGetData, (char *)"#s", (char *)Samples, SamplesCount*2);
		result = PyBool_AsBool(Result);
		Py_DECREF(OnGetData);
		Py_DECREF(Result);
	}
    return result;
}
Beispiel #3
0
bool CustomSoundRecorder::OnStart()
{
	bool result = false;
	if (PyObject_HasAttrString(SoundRecorder, "OnStart"))
	{
		PyObject *OnStart = PyObject_GetAttrString(SoundRecorder, "OnStart");
		PyObject *Result = PyObject_CallFunction(OnStart, NULL);
		result = PyBool_AsBool(Result);
		Py_DECREF(OnStart);
		Py_DECREF(Result);
	}
    return result;
}
Beispiel #4
0
static int
PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds)
{
	const char *kwlist[] = {"Buffer", "Loop", "Pitch", "Volume", "X", "Y", "Z", NULL};
	PySfSoundBuffer *Buffer=NULL;
	PyObject *Loop=NULL;
	float Pitch=1.f, Volume=100.f, X=0.f, Y=0.f, Z=0.f;
	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!Offfff:Sound.__new__", (char **)kwlist, &PySfSoundBufferType, &Buffer, &Loop, &Pitch, &Volume, &X, &Y, &Z))
		return -1;
	{
		if (Loop)
			self->obj->SetLoop(PyBool_AsBool(Loop));
		if (Buffer)
			self->obj->SetBuffer(*(Buffer->obj));
		self->obj->SetPitch(Pitch);
		self->obj->SetVolume(Volume);
		self->obj->SetPosition(X, Y, Z);
	}
	return 0;
}
Beispiel #5
0
static PyObject*
PySfSound_SetRelativeToListener(PySfSound *self, PyObject *args)
{
	self->obj->SetRelativeToListener(PyBool_AsBool(args));
	Py_RETURN_NONE;
}
Beispiel #6
0
static PyObject*
PySfSound_SetLoop(PySfSound *self, PyObject *args)
{
	self->obj->SetLoop(PyBool_AsBool(args));
	Py_RETURN_NONE;
}
Beispiel #7
0
static PyObject *
PySfSprite_FlipY(PySfSprite* self, PyObject *args)
{
	self->obj->FlipY(PyBool_AsBool(args));
	Py_RETURN_NONE;
}
Beispiel #8
0
static PyObject *
PySfImage_SetSmooth (PySfImage *self, PyObject *args)
{
	self->obj->SetSmooth(PyBool_AsBool(args));
	Py_RETURN_NONE;
}