Changeset 8711 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Jun 22, 2006, 1:09:20 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.h
r8490 r8711 103 103 /** @returns the absolute position */ 104 104 inline const Vector& getAbsCoor () const { return this->absCoordinate; }; 105 /** @returns the absolute X coordinate. */ 106 inline float getAbsCoorX() { return this->absCoordinate.x; }; 107 /** @returns the absolute Y Coordinate */ 108 inline float getAbsCoorY() { return this->absCoordinate.y; }; 109 /** @returns the absolute Z Coordinate */ 110 inline float getAbsCoorZ() { return this->absCoordinate.z; }; 111 105 112 /** @returns the absolute position */ 106 113 inline const Vector& getLastAbsCoor () const { return this->lastAbsCoordinate; }; 114 107 115 void shiftCoor (const Vector& shift); 108 116 void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); }; -
trunk/src/lib/gui/gl/glgui_handler.cc
r8450 r8711 23 23 24 24 #include "class_list.h" 25 #include <cassert> 25 26 26 27 #include <cassert> -
trunk/src/lib/script_engine/Makefile.am
r8408 r8711 16 16 script_manager.cc \ 17 17 script_class.cc \ 18 script_method.cc \ 19 \ 20 account.cc \ 21 object.cc 22 23 18 script_method.cc 19 24 20 AM_CPPFLAGS= @LUA_INCLUDES@ 25 21 -
trunk/src/lib/script_engine/lunartest2.lua
r8408 r8711 22 22 23 23 function main(arg) 24 io.write("hello i am main! ")24 io.write("hello i am main!\n") 25 25 -- use parameter 26 26 io.write("main received ", arg) 27 27 io.write(" as parameter\n") 28 28 29 o = Object() 30 o:printName() 29 31 30 --call member of an inserted object 32 31 Obj:printName() 33 32 34 33 --create object of a registered type 35 --o = Object()36 --o:printName()34 o = Object() 35 o:printName() 37 36 38 37 --take returnvalue from c -
trunk/src/lib/script_engine/script.cc
r8408 r8711 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Silvan Nellen 13 co-programmer: Benjamin Grauer 14 */ 15 1 16 #include "script.h" 2 17 #include "script_class.h" 3 18 #include "luaincl.h" 4 19 20 #include "util/loading/resource_manager.h" 5 21 6 22 #include "loading/load_param.h" … … 58 74 { 59 75 76 std::string filedest(ResourceManager::getInstance()->getDataDir()); 77 filedest += "scripts/" + filename; 78 60 79 if(currentFile.length() != 0) 61 80 { … … 64 83 } 65 84 66 int error = luaL_loadfile (luaState, file name.c_str());85 int error = luaL_loadfile (luaState, filedest.c_str()); 67 86 68 87 if(error == 0) 69 88 { 89 70 90 error = lua_pcall(luaState, 0, 0, 0); 71 91 … … 192 212 bool Script::pushParam(int param, std::string& toFunction) 193 213 { 194 if(currentFunction .compare(toFunction) == 0)214 if(currentFunction == toFunction) 195 215 { 196 216 lua_pushnumber(luaState, (lua_Number) param); 197 217 argumentCount++; 198 return true;218 return true; 199 219 } 200 220 else … … 267 287 returnCount--; 268 288 } 289 else 290 printf("ERROR: Form %s : trying to retreive non bolean value",this->currentFile.c_str()); 269 291 } 270 292 return returnValue; … … 313 335 } 314 336 337 bool Script::registerStandartClasses() 338 { 339 bool success = false; 340 341 //success = this->registerClass(std::string("Vector")); 342 343 return success; 344 } 345 346 347 bool Script::registerClass( const std::string& className) 348 { 349 BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS); 350 //printf("The script class for %s is at %p \n",className.c_str(),scriptClass); 351 WorldObject tmpObj; 352 if (scriptClass != NULL) 353 { 354 tmpObj.type = className; 355 if( !classIsRegistered(className) ) 356 { 357 static_cast<ScriptClass*>(scriptClass)->registerClass(this); 358 tmpObj.name = ""; 359 registeredObjects.push_back(tmpObj); 360 return true; 361 } 362 } 363 return false; 364 365 } 315 366 316 367 bool Script::classIsRegistered(const std::string& type) -
trunk/src/lib/script_engine/script.h
r8408 r8711 1 /*! 2 * @file scrip.h 3 * wrapper for a lua_State 4 */ 5 1 6 #ifndef _SCRIPT_H 2 7 #define _SCRIPT_H … … 58 63 59 64 int reportError(int error); //!< Get errormessage from the lua stack and print it. 65 bool registerStandartClasses(); //!< Register all the classes that the script might need 66 bool registerClass(const std::string& className); //!< Register a class but dont add any instances 60 67 bool classIsRegistered(const std::string& type); //!< Checks wheter the class "type" has already been registered with the script 61 68 bool objectIsAdded(const std::string& name); //!< Checks wheter the object "name" has already been added to the script -
trunk/src/lib/script_engine/script_class.cc
r8408 r8711 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ -
trunk/src/lib/script_engine/script_manager.cc
r8408 r8711 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Silvan Nellen 13 co-programmer: Benjamin Grauer 14 */ 15 16 1 17 #include <string> 2 18 #include <list> -
trunk/src/lib/script_engine/script_manager.h
r8271 r8711 1 /*! 2 * @file scrip_manager.h 3 * manages the scripts 4 */ 5 1 6 #ifndef _SCRIPT_MANAGER_H 2 7 #define _SCRIPT_MANAGER_H -
trunk/src/lib/script_engine/script_method.cc
r8413 r8711 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ -
trunk/src/lib/script_engine/script_method.h
r8413 r8711 1 1 /*! 2 * @file script_ class.h2 * @file script_method.h 3 3 * @brief Definition of ... 4 4 */ -
trunk/src/lib/util/executor/executor_lua.h
r8527 r8711 182 182 183 183 184 /////////// 185 //// 3 //// 186 /////////// 187 //! Executes a Function with a lua_State* parameter. 188 template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor 189 { 190 public: 191 /** 192 * @brief Constructor of a ExecutorXML 193 * @param function a Function to call 194 */ 195 ExecutorLua3(void(T::*function)(type0, type1, type2)) 196 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>()) 197 { 198 this->functionPointer = function; 199 this->functorType = Executor_Objective | Executor_NoLoadString; 200 } 201 202 /** 203 * @brief executes the Command on BaseObject 204 * @param object the BaseObject to execute this Executor on 205 * @param loadString ignored in this case 206 */ 207 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 208 { 209 PRINTF(1)("no usefull executor\n"); 210 } 211 212 virtual void operator()(BaseObject* object, int& count, void* values) const 213 { 214 lua_State* state = (lua_State*)values; 215 count = 0; 216 217 (dynamic_cast<T*>(object)->*(functionPointer))( 218 fromLua<type0>(state, 1), 219 fromLua<type1>(state, 2), 220 fromLua<type2>(state, 3) ); 221 } 222 223 /** 224 * @returns a _new_ Copy of this Executor 225 */ 226 virtual Executor* clone () const 227 { 228 return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer); 229 } 230 private: 231 void (T::*functionPointer)(type0, type1, type2); 232 }; 233 184 234 185 235 … … 209 259 this->functorType = Executor_Objective | Executor_NoLoadString; 210 260 } 211 261 212 262 /** 213 263 * @brief executes the Command on BaseObject
Note: See TracChangeset
for help on using the changeset viewer.