// ------------------------------------------
		PyObject* LoopServiceBinder::getLastFrameTime(PyObject* self, PyObject* args)
		{
			__PYTHON_EXCEPTION_GUARD_BEGIN_;
			LoopServicePtr o;

			if (!python_cast<LoopServicePtr>(self, &msType, &o))
				__PY_CONVERR_RET;

			return TypeInfo<long>::toPyObject(o->getLastFrameTime());
			__PYTHON_EXCEPTION_GUARD_END_;
		}
		// ------------------------------------------
		PyObject* LoopServiceBinder::run(PyObject* self, PyObject* args)
		{
			__PYTHON_EXCEPTION_GUARD_BEGIN_;
			PyObject *result = NULL;
			LoopServicePtr o;

			if (!python_cast<LoopServicePtr>(self, &msType, &o))
				__PY_CONVERR_RET;

			o->run();
			result = Py_None;
			Py_INCREF(result);
			return result;
			__PYTHON_EXCEPTION_GUARD_END_;
		}
Example #3
0
// -------------------------------------------------------
void Root::setupLoopModes() {
    // Loop modes are only setup if not masked by global service mask
    if (mServiceMask & SERVICE_ENGINE) {
        // Loop modes are hardcoded
        LoopServicePtr ls = GET_SERVICE(LoopService);
        // Create all the required loop services
        LoopModeDefinition def;

        // Loop mode that does no engine processing at all
        def.id = 1;
        def.name = "GUIOnlyLoopMode";
        def.mask = LOOPMODE_INPUT | LOOPMODE_RENDER;

        ls->createLoopMode(def);

        // Loop mode that runs all the loop clients
        def.id = 0xFF;
        def.name = "AllClientsLoopMode";
        def.mask = LOOPMODE_MASK_ALL_CLIENTS;

        ls->createLoopMode(def);
        ls->requestLoopMode("AllClientsLoopMode");
    }
}
		// ------------------------------------------
		PyObject* LoopServiceBinder::requestLoopMode(PyObject* self, PyObject* args)
		{
			__PYTHON_EXCEPTION_GUARD_BEGIN_;
			// Let's request a new loop mode. Python version only works for strings to make it simple
			PyObject *result = NULL;
			LoopServicePtr o;

			if (!python_cast<LoopServicePtr>(self, &msType, &o))
				__PY_CONVERR_RET;

			char* name;

			if (PyArg_ParseTuple(args, "s", &name)) {
				bool res = o->requestLoopMode(name);

				result = res ? Py_True : Py_False;
				Py_INCREF(result);
			} else {
				PyErr_SetString(PyExc_TypeError, "Expected a string parameter!");
			}

			return result;
			__PYTHON_EXCEPTION_GUARD_END_;
		}