BGE API cleanup: StateActuator.

This commit is contained in:
Benoit Bolsee 2009-04-09 21:15:44 +00:00
parent 09a5ffdf07
commit b0cca7de26
4 changed files with 23 additions and 3 deletions

@ -58,6 +58,7 @@
#include "KX_ConstraintActuator.h"
#include "KX_IpoActuator.h"
#include "KX_SoundActuator.h"
#include "KX_StateActuator.h"
#include "BL_ActionActuator.h"
#include "RAS_IRasterizer.h"
#include "RAS_ICanvas.h"
@ -1154,6 +1155,11 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_CPY, KX_StateActuator::OP_CPY);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_SET, KX_StateActuator::OP_SET);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_CLR, KX_StateActuator::OP_CLR);
KX_MACRO_addTypesToDict(d, KX_STATE_OP_NEG, KX_StateActuator::OP_NEG);
// Check for errors
if (PyErr_Occurred())

@ -138,14 +138,18 @@ KX_StateActuator::Parents[] = {
PyMethodDef
KX_StateActuator::Methods[] = {
// deprecated -->
{"setOperation", (PyCFunction) KX_StateActuator::sPySetOperation,
METH_VARARGS, (PY_METHODCHAR)SetOperation_doc},
{"setMask", (PyCFunction) KX_StateActuator::sPySetMask,
METH_VARARGS, (PY_METHODCHAR)SetMask_doc},
// <--
{NULL,NULL} //Sentinel
};
PyAttributeDef KX_StateActuator::Attributes[] = {
KX_PYATTRIBUTE_INT_RW("operation",KX_StateActuator::OP_NOP+1,KX_StateActuator::OP_COUNT-1,false,KX_StateActuator,m_operation),
KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask),
{ NULL } //Sentinel
};
@ -154,6 +158,10 @@ PyObject* KX_StateActuator::py_getattro(PyObject *attr)
py_getattro_up(SCA_IActuator);
};
int KX_StateActuator::py_setattro(PyObject *attr, PyObject* value)
{
py_setattro_up(SCA_IActuator);
}
/* set operation ---------------------------------------------------------- */
@ -168,6 +176,7 @@ PyObject*
KX_StateActuator::PySetOperation(PyObject* self,
PyObject* args,
PyObject* kwds) {
ShowDeprecationWarning("setOperation()", "the operation property");
int oper;
if(!PyArg_ParseTuple(args, "i", &oper)) {
@ -193,6 +202,7 @@ PyObject*
KX_StateActuator::PySetMask(PyObject* self,
PyObject* args,
PyObject* kwds) {
ShowDeprecationWarning("setMask()", "the mask property");
int mask;
if(!PyArg_ParseTuple(args, "i", &mask)) {

@ -39,13 +39,15 @@ class KX_StateActuator : public SCA_IActuator
/** Make visible? */
enum {
OP_NOP = -1,
OP_CPY = 0,
OP_SET,
OP_CLR,
OP_NEG
OP_NEG,
OP_COUNT
};
int m_operation;
unsigned int m_mask;
int m_mask;
public:
@ -74,6 +76,7 @@ class KX_StateActuator : public SCA_IActuator
/* --------------------------------------------------------------------- */
virtual PyObject* py_getattro(PyObject *attr);
virtual int py_setattro(PyObject *attr, PyObject* value);
//KX_PYMETHOD_DOC
KX_PYMETHOD_DOC(KX_StateActuator,SetOperation);
KX_PYMETHOD_DOC(KX_StateActuator,SetMask);

@ -7,7 +7,8 @@ class KX_SoundActuator(SCA_IActuator):
Sound Actuator.
The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
the actuator to be activated - they act instantly.
the actuator to be activated - they act instantly provided that the actuator has
been activated once at least.
@ivar filename: Sets the filename of the sound this actuator plays.
@type filename: string