lugre_scripting.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LUGRE_SCRIPTING_H
00025 #define LUGRE_SCRIPTING_H
00026 #include "lugre_input.h"
00027 #include <list>
00028
00029
00030
00031
00032
00033
00034
00035 #define LUGRE_TRY \
00036 try {\
00037
00038 #define LUGRE_CATCH \
00039 } catch ( Ogre::Exception& e ) {\
00040 MyShowError((std::string("Ogre::exception occurred, see console\n") + e.getFullDescription()).c_str(),__FILE__,__LINE__,__FUNCTION__);\
00041 }\
00042
00043
00044
00045
00046
00047 class lua_State;
00048
00049 namespace Lugre {
00050
00051 class cScriptingPlugin { public:
00052 virtual void RegisterLua_GlobalFunctions (lua_State* L) {}
00053 virtual void RegisterLua_Classes (lua_State* L) {}
00054 };
00055
00056 class cScripting : public cInputListener { public:
00057 lua_State* L;
00058
00059 static void RegisterPlugin (cScriptingPlugin* pPlugin);
00060
00061 static cScripting* GetSingletonPtr (cScripting* p=0);
00062 cScripting ();
00063 ~cScripting ();
00064
00065 void Init ();
00066 int GetGlobal (const char* name);
00067 static void SetGlobal (lua_State *L,const char* name,int value);
00068 bool LuaCall (const char *func, const char *sig = "", ...);
00069
00070
00071 void InitLugreLuaEnvironment (lua_State* L);
00072
00073
00074 virtual void Notify_KeyPress (const unsigned char iKey,const int iLetter);
00075 virtual void Notify_KeyRepeat (const unsigned char iKey,const int iLetter);
00076 virtual void Notify_KeyRelease (const unsigned char iKey);
00077
00078 private:
00079 static std::list<cScriptingPlugin*> mlPlugins;
00080 };
00081
00082 };
00083
00084 #endif