scriptObjects.h
Engine/source/console/scriptObjects.h
Classes:
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SCRIPTOBJECTS_H_ 25#define _SCRIPTOBJECTS_H_ 26 27#ifndef _CONSOLEINTERNAL_H_ 28#include "console/consoleInternal.h" 29#endif 30 31#ifndef _ITICKABLE_H_ 32#include "core/iTickable.h" 33#endif 34 35//----------------------------------------------------------------------------- 36// ScriptObject 37//----------------------------------------------------------------------------- 38 39class ScriptObject : public SimObject 40{ 41 typedef SimObject Parent; 42 43public: 44 ScriptObject(); 45 bool onAdd(); 46 void onRemove(); 47 48 DECLARE_CONOBJECT(ScriptObject); 49 50 DECLARE_CALLBACK(void, onAdd, (SimObjectId ID) ); 51 DECLARE_CALLBACK(void, onRemove, (SimObjectId ID)); 52}; 53 54//----------------------------------------------------------------------------- 55// ScriptTickObject 56//----------------------------------------------------------------------------- 57 58class ScriptTickObject : public ScriptObject, public virtual ITickable 59{ 60 typedef ScriptObject Parent; 61 62protected: 63 bool mCallOnAdvanceTime; 64 65public: 66 ScriptTickObject(); 67 static void initPersistFields(); 68 bool onAdd(); 69 void onRemove(); 70 71 virtual void interpolateTick( F32 delta ); 72 virtual void processTick(); 73 virtual void advanceTime( F32 timeDelta ); 74 75 DECLARE_CONOBJECT(ScriptTickObject); 76 77 DECLARE_CALLBACK(void, onInterpolateTick, (F32 delta) ); 78 DECLARE_CALLBACK(void, onProcessTick, () ); 79 DECLARE_CALLBACK(void, onAdvanceTime, (F32 timeDelta) ); 80}; 81 82//----------------------------------------------------------------------------- 83// ScriptGroup 84//----------------------------------------------------------------------------- 85 86class ScriptGroup : public SimGroup 87{ 88 typedef SimGroup Parent; 89 90public: 91 ScriptGroup(); 92 bool onAdd(); 93 void onRemove(); 94 95 DECLARE_CONOBJECT(ScriptGroup); 96 97 DECLARE_CALLBACK(void, onAdd, (SimObjectId ID) ); 98 DECLARE_CALLBACK(void, onRemove, (SimObjectId ID)); 99}; 100 101#endif 102