Changeset 1154 for code/branches
- Timestamp:
- Apr 24, 2008, 11:04:01 AM (17 years ago)
- Location:
- code/branches/input
- Files:
-
- 3 deleted
- 13 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/CMakeLists.txt
r1085 r1154 32 32 33 33 #set binary output directories 34 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_ BINARY_DIR}/bin)35 SET(LIBRARY_OUTPUT_PATH ${PROJECT_ BINARY_DIR}/bin/lib)34 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 35 SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/lib) 36 36 37 37 # global compiler/linker flags. force -O2! … … 43 43 SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") 44 44 45 #Create verbose makefile output when compiling 46 SET(CMAKE_VERBOSE_MAKEFILE TRUE) 45 #use 'cmake -D make_verb:1 path' to get verbose make output when compiling 46 IF (MAKE_VERB) 47 SET(CMAKE_VERBOSE_MAKEFILE TRUE) 48 ENDIF (MAKE_VERB) 47 49 48 50 … … 79 81 ${ENet_INCLUDE_DIR} 80 82 ${Boost_INCLUDE_DIRS} 81 ${OPENAL_INCLUDE_DIR} ${ALUT_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR} 83 ${OPENAL_INCLUDE_DIR} 84 ${ALUT_INCLUDE_DIR} 85 ${VORBIS_INCLUDE_DIR} 86 ${OGG_INCLUDE_DIR} 82 87 ${Lua_INCLUDE_DIR} 83 88 ) 84 85 86 ################ Source files ###################87 88 #At first, build lua89 MESSAGE(STATUS "\n******************* Building tolua... ******************\n\n")90 EXECUTE_PROCESS(COMMAND ./tolua-build)91 MESSAGE(STATUS "\n\n******************* Building tolua done ****************\n")92 93 #generate lua bind source files94 EXECUTE_PROCESS(COMMAND bin/./tolua-exec-script)95 89 96 90 #add main source dir -
code/branches/input/bin/levels/sample.oxw
r1089 r1154 38 38 39 39 40 < !--?lua40 <?lua 41 41 for i = 1, 226, 1 42 42 do ?> 43 <Model position="<?lua print(math.random(-19597, 18732))?>, <?lua print(math.random(-19597, 18732)) ?>, <?lua print(math.random(-19597, 18732)) ?>" scale="<?lua print(math.random( 20, 119)) ?>" mesh="ast<?lua print( i%6+ 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random(16, 44)) ?>" />43 <Model position="<?lua print(math.random(-19597, 18732))?>, <?lua print(math.random(-19597, 18732)) ?>, <?lua print(math.random(-19597, 18732)) ?>" scale="<?lua print(math.random( 20, 119)) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random(16, 44)) ?>" /> 44 44 <?lua 45 45 end 46 ? -->46 ?> -
code/branches/input/cmake/FindLua.cmake
r1076 r1154 1 # Find Lua includes and library1 # Find Lua header and library files 2 2 # 3 # This module defines4 # Lua_INCLUDE_DIR 5 # Lua_LIBRARIES , the libraries to link against to use Lua.6 # Lua_ LIB_DIR, the location of the libraries7 # Lua_ FOUND, If false, do not try to use Lua3 # When called, this script tries to define: 4 # Lua_INCLUDE_DIR Header files directory 5 # Lua_LIBRARIES library files (or file when using lua 5.1) 6 # Lua_FOUND defined (true) if lua was found 7 # Lua_VERSION either 5.1 or 5.0 or undefined 8 8 # 9 # Copyright © 2007, Matt Williams 10 # 11 # Redistribution and use is allowed according to the terms of the BSD license. 9 # authors: Benjamin Knecht, Reto Grieder 12 10 13 MESSAGE(STATUS "lua libs in cache: ${Lua_LIBRARIES}")14 11 IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) 15 SET(Lua_FIND_QUIETLY TRUE) # Already in cache, be silent 12 13 # Already in cache, be silent 14 SET(Lua_FOUND TRUE) 15 SET(Lua_FIND_QUIETLY TRUE) 16 MESSAGE(STATUS "Lua was found.") 17 18 ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR) 19 20 FIND_PATH(Lua_INCLUDE_DIR_51 lua.h 21 /usr/include/lua5.1 22 /usr/local/include/lua5.1 23 ../libs/lua-5.1.3/src) 24 25 FIND_PATH(Lua_INCLUDE_DIR_50 lua.h 26 /usr/include/lua50 27 /usr/local/include/lua50 28 /usr/pack/lua-5.0.3-sd/include) 29 30 FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS 31 /usr/lib 32 /usr/local/lib 33 ../libs/lua-5.1.3/lib) 34 35 FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS 36 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis 37 /usr/lib 38 /usr/local/lib) 39 40 FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS 41 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis 42 /usr/lib 43 /usr/local/lib) 44 45 46 IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) 47 48 # Found newer lua 5.1 libs 49 SET(Lua_FOUND TRUE) 50 SET(Lua_VERSION 5.1 CACHE STRING "") 51 SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "") 52 SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "") 53 54 ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50) 55 56 # Found older lua 5.0 libs 57 SET(Lua_FOUND TRUE) 58 SET(Lua_VERSION 5.0 CACHE STRING "") 59 SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "") 60 SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "") 61 62 ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51) 63 64 65 IF (Lua_FOUND) 66 MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}") 67 ELSE (Lua_FOUND) 68 IF (Lua_FIND_REQUIRED) 69 MESSAGE(FATAL_ERROR "Could not find Lua") 70 ENDIF (Lua_FIND_REQUIRED) 71 ENDIF (Lua_FOUND) 72 16 73 ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR) 17 74 18 FIND_PATH(Lua_INCLUDE_DIR lua.h19 /usr/include/lua5.120 /usr/local/include/lua5.121 ../libs/lua-5.1.3/src)22 23 FIND_LIBRARY(Lua_LIBRARIES lua5.124 /usr/lib25 /usr/local/lib26 ../libs/lua-5.1.3/lib)27 28 IF (NOT Lua_INCLUDE_DIR)29 FIND_PATH(Lua_INCLUDE_DIR lua.h30 /usr/include/lua5031 /usr/local/include/lua5032 /usr/pack/lua-5.0.3-sd/include)33 ENDIF (NOT Lua_INCLUDE_DIR)34 35 IF (NOT Lua_LIBRARIES)36 FIND_LIBRARY(Lua_LIBRARIES lua5037 /usr/lib38 /usr/local/lib)39 40 FIND_LIBRARY(Lua_LIBRARY lualib5041 /usr/lib42 /usr/local/lib)43 44 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})45 ENDIF (NOT Lua_LIBRARIES)46 47 #especially for tardis48 IF (NOT Lua_LIBRARIES)49 FIND_LIBRARY(Lua_LIBRARIES lua50 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)51 52 FIND_LIBRARY(Lua_LIBRARY lualib53 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)54 55 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})56 ENDIF (NOT Lua_LIBRARIES)57 58 IF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)59 SET(Lua_FOUND TRUE)60 ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)61 62 IF (Lua_FOUND)63 MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")64 MESSAGE(STATUS "Found Lua: ${Lua_LIBRARY}")65 ELSE (Lua_FOUND)66 IF (Lua_FIND_REQUIRED)67 MESSAGE(FATAL_ERROR "Could not find Lua")68 ENDIF (Lua_FIND_REQUIRED)69 ENDIF (Lua_FOUND) -
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 1 SET(CORE_SRC_FILES 5 2 OrxonoxClass.cc 6 3 BaseObject.cc … … 29 26 Tickable.cc 30 27 Script.cc 31 ${TOLUA_BIND_FILES} 28 tolua/tolua_bind.cc 29 #tolua/tolua_bind.h 32 30 ) 33 31 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 #) 35 39 36 TARGET_LINK_LIBRARIES( core 40 GET_TARGET_PROPERTY(TOLUA_EXE tolua LOCATION) 41 ADD_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 48 ADD_LIBRARY(core SHARED ${CORE_SRC_FILES}) 49 50 TARGET_LINK_LIBRARIES(core 51 ${Lua_LIBRARIES} 52 ${OIS_LIBRARIES} 53 ${OGRE_LIBRARIES} 37 54 util 38 ${Lua_LIBRARIES}39 ${Lua_LIBRARY}40 ${OIS_LIBRARIES}41 55 ) -
code/branches/input/src/core/ConfigFileManager.h
r1064 r1154 63 63 { 64 64 public: 65 virtual ~ConfigFileEntry() {}; 65 66 virtual void setValue(const std::string& value) = 0; 66 67 virtual std::string getValue() const = 0; -
code/branches/input/src/core/InputManager.cc
r1118 r1154 125 125 // create the handlers 126 126 this->handlerGUI_ = new InputHandlerGUI(); 127 this->handlerGUI_->initialise(); 127 128 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 139 131 COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;*/ 140 132 … … 159 151 this->inputSystem_ = 0; 160 152 161 if (this->handlerBuffer_)162 delete this->handlerBuffer_;163 153 if (this->handlerGame_) 164 154 delete this->handlerGame_; … … 166 156 delete this->handlerGUI_; 167 157 168 this->handlerBuffer_ = 0;169 158 this->handlerGame_ = 0; 170 159 this->handlerGUI_ = 0; … … 192 181 this->keyboard_->setEventCallback(this->handlerGame_); 193 182 break; 194 case IM_KEYBOARD:195 this->mouse_->setEventCallback(this->handlerGame_);196 this->keyboard_->setEventCallback(this->handlerBuffer_);197 break;198 183 case IM_UNINIT: 199 184 this->mouse_->setEventCallback(0); … … 211 196 212 197 // Give the listeners the chance to do additional calculations 198 this->currentHandler_->tick(dt); 213 199 } 214 200 -
code/branches/input/src/core/InputManager.h
r1084 r1154 51 51 IM_INGAME: Normal game mode. Key bindings and mouse are active. 52 52 */ 53 enum InputMode54 {55 IM_GUI = 0,56 IM_KEYBOARD = 1,57 IM_INGAME = 2,58 IM_UNINIT = 3,59 };60 53 61 54 /** … … 83 76 static InputManager& getSingleton(); 84 77 static InputManager* getSingletonPtr() { return &getSingleton(); } 85 static void setInputMode(int mode); 78 79 static void setInputHandler(std::string& name); 86 80 87 81 private: … … 95 89 OIS::Mouse *mouse_; //!< OIS keyboard 96 90 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_; 103 95 104 //! Pointer to the instance of the singleton105 //static InputManager *singletonRef_s;106 96 }; 107 97 } -
code/branches/input/src/core/Loader.cc
r1085 r1154 115 115 Script::init(Script::getLuaState()); 116 116 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(); 120 120 121 121 try … … 124 124 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl; 125 125 126 ticpp::Document xmlfile(level->getFile());127 xmlfile.LoadFile();126 //ticpp::Document xmlfile(level->getFile()); 127 //xmlfile.LoadFile(); 128 128 //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); 132 132 133 133 ticpp::Element rootElement; -
code/branches/input/src/core/Script.cc
r1076 r1154 60 60 luaopen_debug(luaState_); 61 61 #endif 62 tolua_ orxonox_open(luaState_);62 tolua_core_open(luaState_); 63 63 output_ = ""; 64 64 } … … 102 102 } 103 103 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 104 114 void Script::run() 105 115 { … … 110 120 error = luaL_loadstring(luaState_, init.c_str()); 111 121 #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()); 113 126 #endif 114 127 if (error == 0) -
code/branches/input/src/core/Script.h
r1056 r1154 50 50 class _CoreExport Script // tolua_export 51 51 { // tolua_export 52 struct LoadS { 53 const char *s; 54 size_t size; 55 }; 56 52 57 public: 53 58 inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export … … 61 66 62 67 #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); 64 69 #endif 65 70 -
code/branches/input/src/orxonox/CMakeLists.txt
r1070 r1154 30 30 # objects/weapon/BulletManager.cc 31 31 # objects/weapon/WeaponStation.cc 32 tolua/tolua_bind.cc 33 # tolua/tolua_bind.h 32 34 ) 33 35 36 #SET_SOURCE_FILES_PROPERTIES(tolua/tolua_bind.h 37 # PROPERTIES 38 # OBJECT_DEPENDS tolua/tolua_bind.h 39 # OBJECT_DEPENDS tolua/tolua_bind.cc 40 # GENERATED true 41 # HEADER_FILE_ONLY true 42 #) 43 44 GET_TARGET_PROPERTY(TOLUA_EXE tolua LOCATION) 45 ADD_CUSTOM_COMMAND( 46 OUTPUT tolua/tolua_bind.cc tolua/tolua_bind.h 47 COMMAND ${TOLUA_EXE} -n orxonox -o ../../src/orxonox/tolua/tolua_bind.cc -H ../../src/orxonox/tolua/tolua_bind.h ../../src/orxonox/tolua/tolua.pkg 48 DEPENDS tolua 49 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib 50 ) 51 34 52 ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} ) 35 53 -
code/branches/input/src/util/CMakeLists.txt
r1118 r1154 1 AUX_SOURCE_DIRECTORY(tinyxml TINYXML_SRC_FILES) 2 3 SET (UTIL_SRC_FILES 1 SET(UTIL_SRC_FILES 4 2 ArgReader.cc 3 Clipboard.cc 4 ExprParser.cc 5 5 Math.cc 6 String.cc7 Clipboard.cc8 SubString.cc9 ExprParser.cc10 6 MultiTypePrimitive.cc 11 7 MultiTypeString.cc 12 8 MultiTypeMath.cc 9 String.cc 10 SubString.cc 11 12 tinyxml/ticpp.cc 13 tinyxml/tinystr.cc 14 tinyxml/tinyxml.cc 15 tinyxml/tinyxmlerror.cc 16 tinyxml/tinyxmlparser.cc 17 13 18 tolua/tolua_event.c 14 19 tolua/tolua_is.c … … 16 21 tolua/tolua_push.c 17 22 tolua/tolua_to.c 18 ${TINYXML_SRC_FILES}19 23 ) 20 24 21 ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES})25 ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES}) 22 26 23 27 IF(TESTING_ENABLED) … … 25 29 ENDIF(TESTING_ENABLED) 26 30 27 TARGET_LINK_LIBRARIES( 31 TARGET_LINK_LIBRARIES(util 28 32 ${OGRE_LIBRARIES} 29 33 ${Lua_LIBRARIES} 30 ${Lua_LIBRARY}31 34 ) 32 35 36 ADD_SUBDIRECTORY(tolua) 37 -
code/branches/input/visual_studio/vc8/orxonox.vcproj
r1035 r1154 384 384 </File> 385 385 </Filter> 386 <Filter 387 Name="tolua" 388 > 389 <File 390 RelativePath="..\..\src\orxonox\tolua\tolua_bind.cc" 391 > 392 <FileConfiguration 393 Name="Debug|Win32" 394 > 395 <Tool 396 Name="VCCLCompilerTool" 397 UsePrecompiledHeader="0" 398 /> 399 </FileConfiguration> 400 </File> 401 </Filter> 386 402 </Filter> 387 403 <Filter … … 511 527 <File 512 528 RelativePath="..\..\src\orxonox\tools\Timer.h" 529 > 530 </File> 531 </Filter> 532 <Filter 533 Name="tolua" 534 > 535 <File 536 RelativePath="..\..\src\orxonox\tolua\tolua_bind.h" 513 537 > 514 538 </File>
Note: See TracChangeset
for help on using the changeset viewer.