Adjusted PySFML to work with the current SFML2 branch.
Note that it's just compatible. A lot of the new functionality is still in the pipeline. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1308 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
fb7470cbc3
commit
839c80556d
29 changed files with 544 additions and 354 deletions
|
@ -27,32 +27,24 @@
|
|||
#include "compat.hpp"
|
||||
|
||||
|
||||
bool CustomSoundStream::OnStart()
|
||||
void CustomSoundStream::OnSeek(float TimeOffset)
|
||||
{
|
||||
PyGILState_STATE gstate;
|
||||
bool result = false;
|
||||
gstate = PyGILState_Ensure();
|
||||
if (PyObject_HasAttrString(SoundStream, "OnStart"))
|
||||
if (PyObject_HasAttrString(SoundStream, "OnSeek"))
|
||||
{
|
||||
PyObject *OnStart = PyObject_GetAttrString(SoundStream, "OnStart");
|
||||
if (OnStart != NULL)
|
||||
PyObject *OnSeek = PyObject_GetAttrString(SoundStream, "OnSeek");
|
||||
if (OnSeek != NULL)
|
||||
{
|
||||
PyObject *Result = PyObject_CallFunction(OnStart, NULL);
|
||||
if (Result != NULL)
|
||||
{
|
||||
result = PyBool_AsBool(Result);
|
||||
Py_CLEAR(Result);
|
||||
}
|
||||
Py_CLEAR(OnStart);
|
||||
PyObject_CallFunction(OnSeek, const_cast<char*>( "f" ), TimeOffset);
|
||||
Py_CLEAR(OnSeek);
|
||||
}
|
||||
}
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
PyErr_Print();
|
||||
result = false;
|
||||
}
|
||||
PyGILState_Release(gstate);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CustomSoundStream::OnGetData(Chunk& Data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue