Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 24, 2008, 11:04:01 AM (17 years ago)
Author:
rgrieder
Message:
  • updated input branch to trunk state. Only Input system files should differ now.
  • this revision doesn't even compile, its just an 'svn save'
Location:
code/branches/input/src/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/core/CMakeLists.txt

    r1084 r1154  
    1 #get the created files
    2 AUX_SOURCE_DIRECTORY(tolua TOLUA_BIND_FILES)
    3 
    4 SET( CORE_SRC_FILES
     1SET(CORE_SRC_FILES
    52  OrxonoxClass.cc
    63  BaseObject.cc
     
    2926  Tickable.cc
    3027  Script.cc
    31   ${TOLUA_BIND_FILES}
     28  tolua/tolua_bind.cc
     29#tolua/tolua_bind.h
    3230)
    3331
    34 ADD_LIBRARY( core SHARED ${CORE_SRC_FILES})
     32#SET_SOURCE_FILES_PROPERTIES(tolua/tolua_bind.h
     33#  PROPERTIES
     34#  OBJECT_DEPENDS tolua/tolua_bind.h
     35#  OBJECT_DEPENDS tolua/tolua_bind.cc
     36#  GENERATED true
     37#  HEADER_FILE_ONLY true
     38#)
    3539
    36 TARGET_LINK_LIBRARIES( core
     40GET_TARGET_PROPERTY(TOLUA_EXE tolua LOCATION)
     41ADD_CUSTOM_COMMAND(
     42  OUTPUT tolua/tolua_bind.cc tolua/tolua_bind.h
     43  COMMAND ${TOLUA_EXE} -n core -o ../../src/core/tolua/tolua_bind.cc -H ../../src/core/tolua/tolua_bind.h ../../src/core/tolua/tolua.pkg
     44  DEPENDS tolua
     45  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
     46)
     47
     48ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
     49
     50TARGET_LINK_LIBRARIES(core
     51  ${Lua_LIBRARIES}
     52  ${OIS_LIBRARIES}
     53  ${OGRE_LIBRARIES}
    3754  util
    38   ${Lua_LIBRARIES}
    39   ${Lua_LIBRARY}
    40   ${OIS_LIBRARIES}
    4155)
  • code/branches/input/src/core/ConfigFileManager.h

    r1064 r1154  
    6363    {
    6464        public:
     65            virtual ~ConfigFileEntry() {};
    6566            virtual void setValue(const std::string& value) = 0;
    6667            virtual std::string getValue() const = 0;
  • code/branches/input/src/core/InputManager.cc

    r1118 r1154  
    125125    // create the handlers
    126126    this->handlerGUI_ = new InputHandlerGUI();
     127    this->handlerGUI_->initialise();
    127128    this->handlerGame_ = new InputHandlerGame();
    128     //this->handlerBuffer_ = new InputBuffer();
    129     this->handlerGame_->loadBindings();
    130 
    131     /*COUT(ORX_DEBUG) << "*** InputManager: Loading key bindings..." << std::endl;
    132     // load the key bindings
    133     InputEvent empty = {0, false, 0, 0, 0};
    134     for (int i = 0; i < this->numberOfKeys_; i++)
    135       this->bindingsKeyPressed_[i] = empty;
    136 
    137     //assign 'abort' to the escape key
    138     this->bindingsKeyPressed_[(int)OIS::KC_ESCAPE].id = 1;
     129    this->handlerGame_->initialise();
     130
    139131    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;*/
    140132
     
    159151    this->inputSystem_   = 0;
    160152
    161     if (this->handlerBuffer_)
    162       delete this->handlerBuffer_;
    163153    if (this->handlerGame_)
    164154      delete this->handlerGame_;
     
    166156      delete this->handlerGUI_;
    167157
    168     this->handlerBuffer_ = 0;
    169158    this->handlerGame_   = 0;
    170159    this->handlerGUI_    = 0;
     
    192181        this->keyboard_->setEventCallback(this->handlerGame_);
    193182        break;
    194       case IM_KEYBOARD:
    195         this->mouse_->setEventCallback(this->handlerGame_);
    196         this->keyboard_->setEventCallback(this->handlerBuffer_);
    197         break;
    198183      case IM_UNINIT:
    199184        this->mouse_->setEventCallback(0);
     
    211196
    212197    // Give the listeners the chance to do additional calculations
     198    this->currentHandler_->tick(dt);
    213199  }
    214200
  • code/branches/input/src/core/InputManager.h

    r1084 r1154  
    5151    IM_INGAME:   Normal game mode. Key bindings and mouse are active.
    5252  */
    53   enum InputMode
    54   {
    55     IM_GUI      = 0,
    56     IM_KEYBOARD = 1,
    57     IM_INGAME   = 2,
    58     IM_UNINIT   = 3,
    59   };
    6053
    6154  /**
     
    8376    static InputManager& getSingleton();
    8477    static InputManager* getSingletonPtr() { return &getSingleton(); }
    85     static void setInputMode(int mode);
     78
     79    static void setInputHandler(std::string& name);
    8680
    8781  private:
     
    9589    OIS::Mouse        *mouse_;          //!< OIS keyboard
    9690
    97     InputMode          currentMode_;    //!< Input mode currently used
    98     InputMode          setMode_;        //!< Input mode that has been set lately
    99     InputHandlerGUI   *handlerGUI_;     //!< Handles the input if in GUI mode
    100     // FIXME: insert the InputBuffer once merged with core2
    101     InputBuffer       *handlerBuffer_;  //!< Handles the input if in Buffer mode
    102     InputHandlerGame  *handlerGame_;    //!< Handles the input if in Game mode
     91    BaseInputHandler* currentHandler_;
     92    BaseInputHandler* switchToHandler_;
     93    //! Maps the names of the input handlers to their instance
     94    std::map<std::string, BaseInputHandler*> handlers_;
    10395
    104     //! Pointer to the instance of the singleton
    105     //static InputManager *singletonRef_s;
    10696  };
    10797}
  • code/branches/input/src/core/Loader.cc

    r1085 r1154  
    115115        Script::init(Script::getLuaState());
    116116        Script::run();*/
    117         //Script* lua = Script::getInstance();
    118         //lua->loadFile(level->getFile(), true);
    119         //lua->run();
     117        Script* lua = Script::getInstance();
     118        lua->loadFile(level->getFile(), true);
     119        lua->run();
    120120
    121121        try
     
    124124            COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
    125125
    126             ticpp::Document xmlfile(level->getFile());
    127             xmlfile.LoadFile();
     126            //ticpp::Document xmlfile(level->getFile());
     127            //xmlfile.LoadFile();
    128128            //ticpp::Element myelement(*Script::getFileString());
    129             //ticpp::Document xmlfile;
    130             xmlfile.ToDocument();
    131             //xmlfile.Parse(lua->getLuaOutput(), true);
     129            ticpp::Document xmlfile;
     130            //xmlfile.ToDocument();
     131            xmlfile.Parse(lua->getLuaOutput(), true);
    132132
    133133            ticpp::Element rootElement;
  • code/branches/input/src/core/Script.cc

    r1076 r1154  
    6060    luaopen_debug(luaState_);
    6161#endif
    62     tolua_orxonox_open(luaState_);
     62    tolua_core_open(luaState_);
    6363    output_ = "";
    6464  }
     
    102102  }
    103103
     104#if LUA_VERSION_NUM != 501
     105  const char * Script::lua_Chunkreader(lua_State *L, void *data, size_t *size)
     106  {
     107    LoadS* ls = ((LoadS*)data);
     108    if (ls->size == 0) return NULL;
     109    *size = ls->size;
     110    ls->size = 0;
     111    return ls->s;
     112  }
     113#endif
    104114  void Script::run()
    105115  {
     
    110120    error = luaL_loadstring(luaState_, init.c_str());
    111121#else
    112     error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, (void*)init.c_str(), "init");
     122    LoadS ls;
     123    ls.s = init.c_str();
     124    ls.size = init.size();
     125    error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, &ls, init.c_str());
    113126#endif
    114127    if (error == 0)
  • code/branches/input/src/core/Script.h

    r1056 r1154  
    5050  class _CoreExport Script // tolua_export
    5151  { // tolua_export
     52    struct LoadS {
     53      const char *s;
     54      size_t size;
     55    };
     56
    5257    public:
    5358      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
     
    6166
    6267#if LUA_VERSION_NUM != 501
    63     inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};
     68    static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
    6469#endif
    6570
Note: See TracChangeset for help on using the changeset viewer.