Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

DebugActuator.h

Go to the documentation of this file.
00001 #ifndef __DEBUGACTUATOR
00002 #define __DEBUGACTUATOR
00003 
00004 #include <stdio.h>
00005 
00006 #include "SCA_IActuator.h"
00007 
00008 class DebugActuator : public SCA_IActuator
00009 {
00010 Py_Header;
00011 public:
00012         DebugActuator(CValue* gameobj, PyTypeObject* T=&Type)
00013                 : SCA_IActuator(gameobj, T) {};
00014         virtual ~DebugActuator() {}
00015         virtual bool Update(double curtime,double deltatime)

00016         {
00017                 static int numtriggered = 0;
00018                 static int numnegtriggered = 0;
00019                 numtriggered++;
00020 
00021                 if (IsNegativeEvent())
00022                 {
00023                         //printf("negative event on actuator: %d\n",numtriggered);
00024                         numnegtriggered++;
00025                 }
00026                 else
00027                         printf("positive event on actuator: %d\n",numtriggered);
00028                 return 0;
00029 
00030         }
00031         PyObject* PyDebug(PyObject* self, 
00032                                   PyObject* args, 
00033                                   PyObject* kwds)

00034     {
00035     char* debugtext;
00036      if (!PyArg_ParseTuple(args, "s", &debugtext))
00037     {
00038       Py_INCREF(Py_None);
00039       return Py_None;
00040     }
00041       printf("PyDebug() output:%s\n",debugtext);
00042       Py_INCREF(Py_None);
00043       return Py_None;
00044     }
00045         static PyObject* sPyDebug(PyObject* self, 
00046                                   PyObject* args, 
00047                                   PyObject* kwds)

00048     {
00049 //      printf("sPyDebug()\n");
00050       return ((DebugActuator*) self)->PyDebug(self, args, kwds);
00051     }
00052     virtual PyObject*  _getattr(char *attr);
00053 };
00054 
00055 #endif //__DEBUGACTUATOR

Generated at Thu Feb 1 13:03:01 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000