cs sdk v 1.14 released

Home  |  Product  |  Documents  |  Tutorials  |  FAQ |   Download  |   Forum |   Contacts  |   Link  


  Cross Suit

 Cross Suit SDK

 Documents
      classes
 Starting...
           Tutorials

 LUA tutorials

   Support

  Forum
  q&a

 Product parts

 Virtual File system

 Virtual Render
 Virtual Machine
   

  Demo Games

   

 3D Engine

  gvSystem(dx9)

 Link

 

 

lua_ScriptEngine.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 
00004 extern "C" 
00005 {
00006 #include "./script_lua/lua_main/lua-5.1.2/src/lua.h"
00007 #include "./script_lua/lua_main/lua-5.1.2/src/lauxlib.h"
00008 #include "./script_lua/lua_main/lua-5.1.2/src/lualib.h"
00009 }
00010 #include "geSCRIPT.h"
00011 #include "lua_Singleton.h"
00012 
00013 
00014 
00015 
00016 class Script;
00017 class ScriptEngine : public Singleton<ScriptEngine>
00018 {
00019         lua_State* m_pLuaState;
00020 
00021         // This allows us to bind static functions to LUA
00022         typedef int pScriptFunction(lua_State*);
00023 //      std::map<gvStringc, pScriptFunction*> m_FunctionMap;
00024 
00025         // The list of executing scripts
00026         Script* m_pScriptList;
00027         Script* m_pBaseMainScript; // base script.
00028 
00029 public:
00030 
00031         ScriptEngine(void);
00032         ~ScriptEngine(void);
00033 
00034         lua_State* GetLua() const { return m_pLuaState; } // returns the LUA state
00035         int NumScripts() const; // returns how many scripts are in the list
00036 
00037         // Any classes that will be bound to LUA need to be registered with
00038         // the script engine
00039         void RegisterClass(const char* class_name);
00040         void RegisterScriptClasses();
00041 
00042         // This returns a properly linked script
00043         Script* Create();
00044         Script* GetBaseMainScript(void) { return m_pBaseMainScript; };
00045         // Remove a script from the list
00046         void UnlinkScript(Script* pScript);
00047 
00048         // Calls Update for every script on the list
00049         void Update(float fElapsed);
00050 
00051         // This initializes the script engine, you must call this before using 
00052         // the 
00053         bool Start();
00054 
00055 private:
00056 
00057         // This will destroy all scripts and close the LUA state
00058         void Stop();
00059 
00060 };
00061 
00062 extern ScriptEngine* gScriptEngine;
00063 extern ScriptEngine& GetScriptEngine();
00064 extern void ReleaseScriptEngine();
00065 
00066 
00067 

Copyright(C) gvSystem & GamePlus All Rights Reserved.