Thread: [Yake-svn] SF.net SVN: yake: [1623] trunk/yake (Page 3)
Status: Beta
Brought to you by:
psyclonist
From: <psy...@us...> - 2007-02-11 00:43:11
|
Revision: 1623 http://svn.sourceforge.net/yake/?rev=1623&view=rev Author: psyclonist Date: 2007-02-10 16:43:08 -0800 (Sat, 10 Feb 2007) Log Message: ----------- throw and catch exceptions in createChannel() / destroyChannel() Modified Paths: -------------- trunk/yake/src/netsvc/service/netServerCommService.cpp trunk/yake/yake/netsvc/service/netServerCommService.h Modified: trunk/yake/src/netsvc/service/netServerCommService.cpp =================================================================== --- trunk/yake/src/netsvc/service/netServerCommService.cpp 2007-02-11 00:42:23 UTC (rev 1622) +++ trunk/yake/src/netsvc/service/netServerCommService.cpp 2007-02-11 00:43:08 UTC (rev 1623) @@ -47,14 +47,16 @@ void ServerCommService::createChannel(const String& name, const String& description) { if (channels_.find( name ) != channels_.end()) - YAKE_EXCEPT("channel with this name already exists"); + throw AlreadyExistsException(String("channel '") + name + "' already exists"); channels_[ name ].description_ = description; YAKE_LOG_INFORMATION("server-comm", "server-comm: channel '" << name << "' created."); } void ServerCommService::destroyChannel(const String& name) { ChannelList::iterator it = channels_.find( name ); - if (it != channels_.end()) + if (it == channels_.end()) + throw NotFoundException(String("channel '") + name +"' cannot be destroyed as it doesn't exist, sweety."); + else { YAKE_FOR_EACH(UserList::const_iterator,itUser,it->second.users_) { @@ -107,7 +109,14 @@ YAKE_ASSERT( cmd.size() == 2 || cmd.size() == 3 )(cmd).warning("malformed command."); if (cmd.size() >= 2) { - this->createChannel( cmd.at(1), (cmd.size()>2) ? cmd.at(2) : "" ); + try { + this->createChannel( cmd.at(1), (cmd.size()>2) ? cmd.at(2) : "" ); + } + catch (AlreadyExistsException&) + { + s2cEvtCommMsg msg("#server","server","you","sweety, the channel '" + cmd.at(1) + "' already exists."); + evtConn_->sendEvent(pId, msg, SendOptions().channel(commChannelId_)); + } } } return; Modified: trunk/yake/yake/netsvc/service/netServerCommService.h =================================================================== --- trunk/yake/yake/netsvc/service/netServerCommService.h 2007-02-11 00:42:23 UTC (rev 1622) +++ trunk/yake/yake/netsvc/service/netServerCommService.h 2007-02-11 00:43:08 UTC (rev 1623) @@ -9,6 +9,16 @@ namespace yake { namespace net { + struct NETSVC_API NotFoundException : public Exception + { + NotFoundException(const String& msg) : Exception(msg) + {} + }; + struct NETSVC_API AlreadyExistsException : public Exception + { + AlreadyExistsException(const String& msg) : Exception(msg) + {} + }; struct NETSVC_API ServerCommService : public IService { @@ -17,7 +27,11 @@ virtual void onStop(IServiceHost&); void onClientConnected(const PeerId); void onClientDisconnected(const PeerId); + + /** @exception AlreadyExistsException */ void createChannel(const String& name, const String& description); + + /** @exception NotFoundException */ void destroyChannel(const String& name); private: void onProcessJoinRequest(const PeerId pId, const NetEvent& evt, const ChannelId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-12 21:01:29
|
Revision: 1630 http://svn.sourceforge.net/yake/?rev=1630&view=rev Author: psyclonist Date: 2007-03-12 14:01:27 -0700 (Mon, 12 Mar 2007) Log Message: ----------- added library 'task', refactored Lua binding organisation, improved premake based build scripts, various fixes Modified Paths: -------------- trunk/yake/scripts/msvc80/build.cmd trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/plugins.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/yake.lua trunk/yake/src/ent/object_mgr.cpp trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp trunk/yake/yake/base/yakePrerequisites.h trunk/yake/yake/ent/object_mgr.h trunk/yake/yake/physics/yakePhysicsPrerequisites.h trunk/yake/yake/physics/yakePhysicsShape.h trunk/yake/yake/scripting/yakeScriptingSystem.h Added Paths: ----------- trunk/yake/src/bindings.lua/ trunk/yake/src/bindings.lua/bindings.lua.cpp trunk/yake/src/bindings.lua/detail/ trunk/yake/src/bindings.lua/detail/base.lua.cpp trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/bindings.lua/detail/model.lua.cpp trunk/yake/src/bindings.lua/detail/task.lua.cpp trunk/yake/src/task/ trunk/yake/src/task/executor.cpp trunk/yake/src/task/task.cpp trunk/yake/yake/bindings.lua/ trunk/yake/yake/bindings.lua/bindings.lua.ent.h trunk/yake/yake/bindings.lua/bindings.lua.h trunk/yake/yake/bindings.lua/common/ trunk/yake/yake/bindings.lua/common/lua.helpers.cpp trunk/yake/yake/bindings.lua/common/lua.helpers.h trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp trunk/yake/yake/bindings.lua/common/vminfo.lua.h trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/common/yake.lua.common.h trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h trunk/yake/yake/bindings.lua/detail/ trunk/yake/yake/bindings.lua/detail/private.h trunk/yake/yake/bindings.lua/prerequisites.h trunk/yake/yake/task/ trunk/yake/yake/task/prerequisites.h trunk/yake/yake/task/task.h Modified: trunk/yake/scripts/msvc80/build.cmd =================================================================== --- trunk/yake/scripts/msvc80/build.cmd 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/scripts/msvc80/build.cmd 2007-03-12 21:01:27 UTC (rev 1630) @@ -1,7 +1,12 @@ @echo off pushd ..\premake +if not exist premake.exe ( + echo warning: premake.exe not found in yake/scripts/premake. + echo This file is expected to be found in yake/scripts/premake or in global path. +) setlocal set SOLUTION_TARGET_DIR=msvc80 premake --file yake.lua --target vs2005 popd -pause + +pause \ No newline at end of file Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/scripts/premake/config.lua 2007-03-12 21:01:27 UTC (rev 1630) @@ -21,6 +21,7 @@ -------------------------------------- -- !! UNUSED FOR NOW !! +--PLUGIN_SCRIPTING_LUA = true PLUGIN_AUDIO_OPENAL = true PLUGIN_GRAPHICS_OGRE = true PLUGIN_PHYSICS_ODE = true @@ -28,6 +29,21 @@ --GRAPHICSOGRE_USES_OSM = true +-- If set to true then the ENABLE_LUA_* settings are used. +-- If set to false then the ENABLE_LUA_* settings are ignored. +LUA_BINDINGS = true + +-- Enable/disable specific yake-lua bindings. +-- This only affects the code generation, not what actually gets +-- bound to a specific virtual machine instance! +-- For example, if you do *not* use yake::model then you can disable +-- the compilation of the binding code for this component and thereby +-- save compilation time. +ENABLE_LUA_BASE = true -- includes 'base' and 'math' binders +ENABLE_LUA_ENT = true -- 'ent' binder +ENABLE_LUA_MODEL = true -- 'model' binder +ENABLE_LUA_TASK = true -- 'task' binder (+executor) + -------------------------------------- -- Samples -------------------------------------- Modified: trunk/yake/scripts/premake/plugins.lua =================================================================== --- trunk/yake/scripts/premake/plugins.lua 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/scripts/premake/plugins.lua 2007-03-12 21:01:27 UTC (rev 1630) @@ -1,39 +1,39 @@ -------------------------------------- -- YAKE build file make script -------------------------------------- - -function addPkgConfigLib(package,lib) - local pkgexists = os.execute("pkg-config --exists "..lib) - print(pkgexists..lib) - if options.target == gnu and pkgexists then - local flags = os.execute("pkg-config --cflags "..lib) - print("flags "..flags) - local cflags = "`pkg-config --cflags " - if not cflags then - print("ERROR: Failed to acquire cflags for library '" .. lib .. "'!") - end - table.insert(package.buildoptions,"`pkg-config --cflags "..lib) - table.insert(package.linkoptions,"`pkg-config --libs "..lib) - else - local path = findlib(lib); - if not path then - print("ERROR: Failed to find library '" .. lib .. "'!") - end - print(path) - table.insert(package.linkoptions,path.."/"..lib) - end -end +function addPkgConfigLib(package,lib) + local pkgexists = os.execute("pkg-config --exists "..lib) + print(pkgexists..lib) + if options.target == gnu and pkgexists then + local flags = os.execute("pkg-config --cflags "..lib) + print("flags "..flags) + local cflags = "`pkg-config --cflags " + if not cflags then + print("ERROR: Failed to acquire cflags for library '" .. lib .. "'!") + end + table.insert(package.buildoptions,"`pkg-config --cflags "..lib) + table.insert(package.linkoptions,"`pkg-config --libs "..lib) + else + local path = findlib(lib); + if not path then + print("ERROR: Failed to find library '" .. lib .. "'!") + end + print(path) + table.insert(package.linkoptions,path.."/"..lib) + end +end + -------------------------------------- makeComponentPlugin("audioOpenAL","YAKE_AUDIO_OPENAL_EXPORTS") addDependency("base") addDependency("audio") - -if (windows) then - useDep("oalpp") -else - addPkgConfigLib(package,"libopenalpp.so") - --addPkgConfigLib(package,"openalpp") --@todo Why does this not pick up the correct lib to link to? + +if (windows) then + useDep("oalpp") +else + addPkgConfigLib(package,"libopenalpp.so") + --addPkgConfigLib(package,"openalpp") --@todo Why does this not pick up the correct lib to link to? end addIncludePath("dependencies/openalpp/include") @@ -41,12 +41,12 @@ makeComponentPlugin("scriptingLua","YAKE_SCRIPTINGLUA_EXPORTS") addDependency("base") addDependency("scripting") - + if (windows) then useDep("lua") - useDep("luabind") -else - addPkgConfigLib(package,"liblua50.so.5") + useDep("luabind") +else + addPkgConfigLib(package,"liblua50.so.5") end -------------------------------------- @@ -57,34 +57,6 @@ useDep("ode") -------------------------------------- -makeComponentPlugin("entLua","YAKE_ENTLUA_EXPORTS") -addDependency("base") -addDependency("ent") -addDependency("scripting") -addDependency("scriptingLua") - -if (windows) then - useDep("lua") - useDep("luabind") -else - addPkgConfigLib(package,"liblua50.so.5") -end - --------------------------------------- -makeComponentPlugin("modelLua","YAKE_MODELLUA_EXPORTS") -addDependency("base") -addDependency("model") -addDependency("scripting") -addDependency("scriptingLua") - -if (windows) then - useDep("lua") - useDep("luabind") -else - addPkgConfigLib(package,"liblua50.so.5") -end - --------------------------------------- makeComponentPlugin("ceguiOgreRendererAdapter","YAKE_CEGUIRENDERERADAPTER_OGRE_EXPORTS") addDependency("base") addDependency("graphics") Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/scripts/premake/samples.lua 2007-03-12 21:01:27 UTC (rev 1630) @@ -103,3 +103,19 @@ addIncludePath("dependencies/boost") addMatching("samples/net/roclient/roclient*") addMatching("samples/net/roserver/roserver*") + +-------------------------------------- +makeSample("sampleNetCommServer","samples/net/commserver") +useComponent("base") +useComponent("net") +useComponent("netsvc") +addIncludePath("dependencies/boost") +addMatching("samples/net/roserver/roserver*") + +-------------------------------------- +makeSample("sampleNetCommClient","samples/net/commclient") +useComponent("base") +useComponent("net") +useComponent("netsvc") +addIncludePath("dependencies/boost") +addMatching("samples/net/roclient/roclient*") Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/scripts/premake/yake.lua 2007-03-12 21:01:27 UTC (rev 1630) @@ -22,6 +22,43 @@ dofile("deps.lua") -------------------------------------- +-- create config.h +-------------------------------------- +function bool_to_int(var) + if var then + return 1 + else + return 0 + end +end +function make_config_h() + local filename = rootdir.."yake/config.h" + local f = io.open(filename, "w") + if not f then + print("ERROR: Unable to create [yake]/yake/config.h") + return false + end + f:write("// This file is auto-generated. Do not modify manually.\n") + f:write("\n") + f:write("#ifndef YAKE_CONFIG_H\n") + f:write("#define YAKE_CONFIG_H\n") + f:write("\n") + f:write("#define YAKE_DEBUG_DLL_SUFFIX \"" .. DEBUG_DLL_SUFFIX .. "\"\n") + f:write("#define YAKE_LIBFILE_PREFIX \"" .. LIBFILE_PREFIX .. "\"\n") + f:write("#define YAKE_LUA_BINDINGS " .. bool_to_int(LUA_BINDINGS) .. "\n") + f:write("#define YAKE_ENABLE_LUA_ENT " .. bool_to_int(ENABLE_LUA_ENT) .. "\n") + f:write("#define YAKE_ENABLE_LUA_MODEL " .. bool_to_int(ENABLE_LUA_MODEL) .. "\n") + f:write("#define YAKE_ENABLE_LUA_TASK " .. bool_to_int(ENABLE_LUA_TASK) .. "\n") + f:write("\n") + f:write("#endif\n") + io.close(f) + return true +end +if not make_config_h() then + return 2 +end + +-------------------------------------- -- create packages -------------------------------------- @@ -146,6 +183,32 @@ --addDependency("base") -------------------------------------- +makeComponent("task","YAKE_TASK_EXPORTS") +addDependency("base") + +-------------------------------------- +if LUA_BINDINGS then + makeComponent("bindings.lua","YAKE_BINDINGS_LUA_EXPORTS") + addDependency("base") + addDependency("scripting") + addDependency("scriptingLua") + if ENABLE_LUA_ENT then + addDependency("ent") + addDependency("model") + end + if ENABLE_LUA_MODEL then + addDependency("model") + end + if ENABLE_LUA_TASK then + addDependency("task") + end + if (windows) then + useDep("lua") + useDep("luabind") + end +end + +-------------------------------------- -- create plugins -------------------------------------- dofile("plugins.lua") Added: trunk/yake/src/bindings.lua/bindings.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/bindings.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/bindings.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,49 @@ +#include <yake/base/templates/yakeSmartAssert.h> +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> +#include <yake/bindings.lua/bindings.lua.h> +#include <yake/bindings.lua/common/yake.lua.common.h> + +#include <yake/bindings.lua/common/lua.helpers.h> +#include <yake/bindings.lua/common/lua.helpers.cpp> // define here + +#define YAKE_EXPORT_LUA_ANY_CONVERTER +#include <yake/bindings.lua/common/yake.lua.any_converter.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.cpp> + +namespace yake { + void bind_all(lua_State* L) + { + YAKE_ASSERT( L ); + + // + register_any_converter<int>(); + register_any_converter<float>(); + register_any_converter<double>(); + register_any_converter<bool>(); + register_any_converter<String>(); + + // + +#if YAKE_ENABLE_LUA_BASE == 1 + bind_base(L); + bind_math(L); +#endif +#if YAKE_ENABLE_LUA_TASK == 1 + bind_task(L); +#endif +#if YAKE_ENABLE_LUA_MODEL == 1 + bind_model(L); +#endif +#if YAKE_ENABLE_LUA_ENT == 1 + bind_ent(L); +#endif + } + void bind_all(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + if (luavm) + bind_all(luavm->getLuaState()); + } +} // namespace yake Added: trunk/yake/src/bindings.lua/detail/base.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/base.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,255 @@ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_BASE == 1 + +#include <yake/base/yake.h> + +#include <yake/bindings.lua/detail/private.h> +#include <yake/bindings.lua/common/lua.helpers.h> +#include <yake/bindings.lua/common/vminfo.lua.h> +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> + +namespace yake { +namespace math { + + void bind(lua_State* L) + { + YAKE_ASSERT(L); + if (!L) + return; + + using namespace luabind; +#define YAKE_MATH_MODULE L, "yake" + + ///TODO Bind most common operators! + + module( YAKE_MATH_MODULE ) + [ + class_<Color>("Color") + .def( constructor<>() ) + .def( constructor<real,real,real,real>() ) + .def( constructor< const Color& >() ) + //FIXME some strange members in anonymous union::struct + /* .def_readwrite( "r", &Color::r ) + .def_readwrite( "g", &Color::g ) + .def_readwrite( "b", &Color::b ) + .def_readwrite( "a", &Color::a )*/ + ]; + + //TODO Bind the whole math::Math class + // Math + module( YAKE_MATH_MODULE ) + [ + class_< Math >( "Math" ) + .enum_( "AngleUnit" ) + [ + value( "AU_DEGREE", 0 ), + value( "AU_RADIAN", 1 ) + ] + .def( constructor< unsigned int >() ) + //,def( "IAbs", &yake::math::Math::IAbs ) + ]; + + // Vector3 + module( YAKE_MATH_MODULE ) + [ + class_< Vector3 >( "Vector3" ) + .def_readwrite( "x", &yake::math::Vector3::x ) + .def_readwrite( "y", &yake::math::Vector3::y ) + .def_readwrite( "z", &yake::math::Vector3::z ) + .def( constructor< real, real, real >() ) + .def( constructor< const real* const >() ) + .def( constructor< Vector3 const& >() ) + .def( "length", &yake::math::Vector3::length ) + .def( "normalise", &yake::math::Vector3::normalise ) + .def( "crossProduct", &yake::math::Vector3::crossProduct ) + .def( "dotProduct", &yake::math::Vector3::dotProduct ) + .def( "reflect", &yake::math::Vector3::reflect ) + .def( "perpendicular", &yake::math::Vector3::perpendicular ) + .def( "getRotationTo", &yake::math::Vector3::getRotationTo ) + ]; + + // Vector4 + module( YAKE_MATH_MODULE ) + [ + class_< Vector4 >( "Vector4" ) + .def( constructor<>() ) + .def( constructor< real, real, real, real >() ) + .def( constructor< const real* const >() ) + .def( constructor< Vector4 const& >() ) + ]; + + // Matrix3 + module( YAKE_MATH_MODULE ) + [ + class_< Matrix3 >( "Matrix3" ) + .def( constructor<>() ) + .def( constructor< Matrix3 const& >() ) + .def( "getColumn", &yake::math::Matrix3::GetColumn ) + ]; + + // Quaternion + module( YAKE_MATH_MODULE ) + [ + class_< Quaternion >( "Quaternion" ) + .def_readwrite( "x", &yake::math::Quaternion::x ) + .def_readwrite( "y", &yake::math::Quaternion::y ) + .def_readwrite( "z", &yake::math::Quaternion::z ) + .def_readwrite( "w", &yake::math::Quaternion::w ) + .def( constructor< real, real, real, real >() ) + .def( constructor< Quaternion const& >() ) + ]; + + // RandomNumberGenerator + typedef RandomNumberGenerator rng_type; + module( YAKE_MATH_MODULE ) + [ + class_< rng_type >( "RandomNumberGenerator" ) + .def( constructor<>() ) + .def( "setSeed", &rng_type::setSeed ) + .def( "getSeed", &rng_type::getSeed ) + .def( "randInt", &rng_type::randInt ) + .def( "randReal", &rng_type::randReal ) + ]; + } + + YAKE_WRAP_BINDER(math,::yake::math::bind); + +} // namespace math +namespace base { + + // short cuts: + + void lua_log_warning(const char* msg) + { + logging::log(logging::S_WARNING, "lua", msg); + } + void lua_log_information(const char* msg) + { + logging::log(logging::S_INFORMATION, "lua", msg); + } + void lua_log_error(const char* msg) + { + logging::log(logging::S_ERROR, "lua", msg); + } + + void bind(lua_State* L) + { + YAKE_ASSERT(L); + if (!L) + return; + + using namespace luabind; +#define YAKE_BASE_MODULE L, "yake" + + module( YAKE_BASE_MODULE ) + [ + class_<Movable>( "Movable" ) + .def( "setPosition", &Movable::setPosition ) + .def( "setOrientation", &Movable::setOrientation ) + .def( "getPosition", &Movable::getPosition ) + .def( "getOrientation", &Movable::getOrientation ) + .def( "translate", &Movable::translate ) + ]; + + module( YAKE_BASE_MODULE ) + [ + class_< Version >( "Version" ) + .def(constructor<uint16,uint16,uint16>()) + .def("getMajor", &yake::Version::getMajor) + .def("getMinor", &yake::Version::getMinor) + .def("getSub", &yake::Version::getSub) + ]; + + // Library + module( YAKE_BASE_MODULE ) + [ + class_< Library >( "Library" ) + .def( constructor< String const& >() ) + //.def( "getSymbol", &yake::base::Library::getSymbol ) + ]; + + // Timer + module( YAKE_BASE_MODULE ) + [ + //def("createTimer", &yake::base::timer::createTimer()) + class_< Timer >( "Timer" ) + .def( "reset", &yake::Timer::reset ) + .def( "getMilliseconds", &yake::Timer::getMilliseconds ) + .def( "getSeconds", &yake::Timer::getSeconds ) + ]; + + module( YAKE_BASE_MODULE ) + [ + //def( "createTimer", &yake::base::timer::createTimer ) + def( "getTime", &yake::native::getTime ) + ]; + + // Log + module( YAKE_BASE_MODULE ) + [ + class_< logging::logger >( "Log" ) + .enum_( "Severity" ) + [ + value( "EMERGENCY", 0 ), + value( "ALERT", 1 ), + value( "CRITICAL", 2 ), + value( "ERROR", 3 ), + value( "WARNING", 4 ), + value( "NOTICE", 5 ), + value( "INFORMATION", 6 ), + value( "DEBUG", 7 ) + ] + .scope + [ + def( "log", (void(*)(const logging::severity_t, const char* logId, const char* msg))&logging::logger::log ), + def( "enableLog", logging::enableLog ), + def( "enableSeverity", logging::enableSeverity ), + def( "setProcessId", logging::setProcessId ) + //def( "addTarget", logging::addTarget ) + ] + ]; + + // Exporting log singleton as logger object + //@todo FIXME pL->execute( "logger = yake.Log.instance();" ); + + // Log shortcuts + module( YAKE_BASE_MODULE ) + [ + def( "log_warning", &yake::base::lua_log_warning ), + def( "log_information", &yake::base::lua_log_information ), + def( "log_error", &yake::base::lua_log_error ) + ]; + + // Plugin + module( YAKE_BASE_MODULE ) + [ + class_< Plugin >( "Plugin" ) + .def( "getName", &yake::base::Plugin::getName ) + .def( "initialise", &yake::base::Plugin::initialise ) + .def( "shutdown", &yake::base::Plugin::shutdown ) + ]; + + // uniqueName::create + module( YAKE_BASE_MODULE ) + [ + def( "createUniqueName", &uniqueName::create ) + ]; + } + + YAKE_WRAP_BINDER(base,::yake::base::bind); + +} // namespace base + void bind_base(lua_State* L) + { + YAKE_ASSERT( L ); + base::bind(L); + } + void bind_math(lua_State* L) + { + YAKE_ASSERT( L ); + math::bind(L); + } +} // namespace yake + +#endif // YAKE_ENABLE_LUA_BASE Added: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,210 @@ +/**------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright 2004 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ +*/ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_ENT == 1 + +#include <yake/base/templates/yakeSmartAssert.h> +#include <yake/bindings.lua/bindings.lua.ent.h> + +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> +#include <yake/bindings.lua/detail/private.h> +#include <yake/bindings.lua/bindings.lua.h> + +namespace yake { +namespace ent { + + //------------------------------------------------------------------------- + void bind( lua_State* L ) + { + YAKE_ASSERT( L ); + if (!L) + return; + + using namespace luabind; + using namespace yake::model; + +#define YAKE_MODEL_MODULE L, "yake" + + module( YAKE_MODEL_MODULE ) + [ + class_<Component>( "Component" ) + //.def( constructor<>() ) + ]; + + module( YAKE_MODEL_MODULE ) + [ + class_<Object>( "Object" ) + .def( constructor<>() ) + .def( "setId", &Object::setId ) + .def( "id", &Object::getId ) + ]; + + module( YAKE_MODEL_MODULE ) + [ + class_<Entity,Object>( "Entity" ) + .def( constructor<>() ) + + .def( "setModel", &Entity::setModel ) + .def( "getModel", &Entity::getModel ) + + .def( "addFsmState", &Entity::addFsmState ) + .def( "addFsmTransition", &Entity::addFsmTransition ) + .def( "setFsmState", &Entity::setFsmState ) + .def( "processFsmEvent", &Entity::processFsmEvent ) + .def( "getCurrentFsmState", &Entity::getCurrentFsmState ) + ]; + + module( YAKE_MODEL_MODULE ) + [ + class_<ObjectManager>( "ObjectManager" ) + .def( "makeObject", (Object*(ObjectManager::*)(const String&))&ObjectManager::makeObject ) + .def( "getObject", &ObjectManager::getObject ) + .def( "destroyObject", &ObjectManager::destroyObject ) + .def( "getClassNamesAndIds", &ObjectManager::getClassNamesAndIds ) + ]; + } + + //------------------------------------------------------------------------- + YAKE_WRAP_BINDER(ent,::yake::ent::bind); + + //------------------------------------------------------------------------- + namespace detail { + void executeOfTable_2(scripting::IVM& vm, const std::string& tbl1name, const std::string& tbl2name, const std::string& fn) + { + try { + scripting::LuaVM& luaVM = static_cast<scripting::LuaVM&>(vm); + lua_State* luaState = luaVM.getLuaState(); + YAKE_ASSERT( luaState ); + + luabind::object tbl1 = luabind::globals(luaState)[tbl1name.c_str()]; + if (luabind::type(tbl1) == LUA_TNIL) + //if (!tbl1) + { + std::cerr << "vm error: could not find table '" << tbl1name << "'.\n"; + return; + } + assert( luabind::type(tbl1) == LUA_TTABLE ); + + luabind::object tbl2 = tbl1[tbl2name.c_str()]; + if (luabind::type(tbl2) == LUA_TNIL) + //if (!tbl2) + { + std::cerr << "vm error: could not find table '" << tbl1name << "." << tbl2name << "'.\n"; + return; + } + assert( luabind::type(tbl2) == LUA_TTABLE ); + + luabind::object fnObj = tbl2[fn.c_str()]; + assert( luabind::type(fnObj) == LUA_TFUNCTION ); + + fnObj(); + } + catch (...) + { + YAKE_EXCEPT("executeOfTable_2(): Bad cast! VM is not a Lua VM!"); + } + } + } + + //------------------------------------------------------------------------- + namespace detail { + LuaFsmObjectListener::LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem) : + scriptingSystem_(scriptingSystem) + { + startScript_.reset( scriptingSystem_.createScriptFromFile("../../common/media/scripts/o_fsm_test.lua") ); + YAKE_ASSERT( startScript_.get() ); + } + void LuaFsmObjectListener::onInit(Object& obj) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + YAKE_ASSERT( ent->getFsmVM() ); + ent->getFsmVM()->execute("print('initializing...')"); + ent->getFsmVM()->execute( startScript_.get() ); + + ent->getFsmVM()->execute("c = coroutine.create(main)\ncoroutine.resume(c,1)"); + } + } + void LuaFsmObjectListener::onTick(Object& obj) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + ent->getFsmVM()->execute("event.on_tick()"); + ent->getFsmVM()->execute("state." + ent->getCurrentFsmState() + ".on_tick()"); + } + } + void LuaFsmObjectListener::onFsmEventHandled(Object& obj, const object_fsm&, const object_fsm::event_type& evt) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + ent->getFsmVM()->execute("event.on_" + evt + "()"); + } + } + void LuaFsmObjectListener::onFsmEnterState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + scripting::IVM* vm = ent->getFsmVM(); + YAKE_ASSERT( vm ); + detail::executeOfTable_2(*vm,"state",state,"on_enter"); + } + } + void LuaFsmObjectListener::onFsmExitState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + scripting::IVM* vm = ent->getFsmVM(); + YAKE_ASSERT( vm ); + detail::executeOfTable_2(*vm,"state",state,"on_exit"); + } + } + } // namespace detail + + //------------------------------------------------------------------------- + LuaObjectManagerListener::LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem) : + fsmListener_(scriptingSystem) + { + } + void LuaObjectManagerListener::onObjectCreated(Object* obj) + { + Entity* ent = Entity::cast(obj); + if (ent) + { + YAKE_ASSERT( ent ); + ent->attachListener( &fsmListener_, "lua_listener", ObjectListenerManager::kKeepOwnership ); + } + } + +} // namespace ent + //------------------------------------------------------------------------- + void bind_ent(lua_State* L) + { + YAKE_ASSERT(L); + ent::bind(L); + } +} // namespace yake +#endif // YAKE_ENABLE_LUA_ENT Added: trunk/yake/src/bindings.lua/detail/model.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/model.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,92 @@ +/**------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright 2004 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ +*/ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_MODEL == 1 + +#include <yake/base/templates/yakeSmartAssert.h> +#include <yake/base/yake.h> +#include <yake/model/model.h> +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> +#include <yake/bindings.lua/detail/private.h> + +namespace yake { +namespace model { + + void bind( lua_State* L ) + { + YAKE_ASSERT( L ); + if (!L) + return; + + using namespace luabind; + using namespace yake::model; + +#define YAKE_MODEL_MODULE L, "yake" + + module( YAKE_MODEL_MODULE ) + [ + class_<ModelComponent>( "ModelComponent" ) + //.def( constructor<>() ) + ]; + + module( YAKE_MODEL_MODULE ) + [ + class_<Graphical,ModelComponent>( "Graphical" ) + .def( constructor<>() ) + .def( "addSceneNode", &Graphical::addSceneNode ) + //.def( "getSceneNodes", &Graphical::getSceneNodes ) + .def( "getSceneNode", &Graphical::getSceneNode ) + .def( "getEntity", &Graphical::getEntity ) + .def( "getLight", &Graphical::getLight ) + .def( "translate", &Graphical::translate ) + ]; + + module( YAKE_MODEL_MODULE ) + [ + class_<Physical,ModelComponent>( "Physical" ) + .def( constructor<>() ) + .def( "addActor", &Physical::addActor ) + .def( "addBody", &Physical::addBody ) + .def( "addJoint", &Physical::addBody ) + .def( "addAffector", &Physical::addAffector ) + .def( "addAffectorTargetActor", &Physical::addAffectorTargetActor ) + //void addAffectorTargetBody(physics::IBodyAffector*,physics::IBody*); + //void addAffectorTargetBody(physics::IBodyAffector*,const String& bodyXPath); + .def( "getActor", &Physical::getActor ) + .def( "getBody", &Physical::getBody ) + .def( "getJoint", &Physical::getJoint ) + .def( "getAffector", &Physical::getAffector ) + //.def( "translate", &Physical::translate ) + .def( "updateAffectors", &Physical::updateAffectors ) + ]; + } + + YAKE_WRAP_BINDER(model,::yake::model::bind); + +} // namespace model + void bind_model(lua_State* L) + { + YAKE_ASSERT(L); + model::bind(L); + } +} // namespace yake +#endif // YAKE_ENABLE_LUA_MODEL Added: trunk/yake/src/bindings.lua/detail/task.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/task.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/task.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,66 @@ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_TASK == 1 + +#include <yake/base/templates/yakeSmartAssert.h> + +#include <yake/bindings.lua/detail/private.h> +#include <yake/bindings.lua/common/lua.helpers.h> +#include <yake/bindings.lua/common/vminfo.lua.h> +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> + +#include <yake/task/task.h> + +namespace yake { +namespace task { + + namespace detail { + void lua_revive(lua_State* L) + { + std::cout << "resuming..." << std::hex << L << "\n"; + std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; + luabind::resume<void>(L); + } + task_ptr lua_executor_add(executor& exec, luabind::object fn, int ms) + { + assert( fn.interpreter() ); + return exec.add( boost::bind(&lua_run,fn), ms ); + } + void lua_wait(executor& exec, const size_t ms, luabind::object interpreterContainer) + { + assert( interpreterContainer.interpreter() ); + exec.add( boost::bind(&lua_revive,interpreterContainer.interpreter()), ms ); + } + } // namespace detail + + void bind(lua_State* L) + { + assert(L); + if (!L) + return; + using namespace luabind; // we don't expect collisions. + module( L ) + [ + class_<task,task_ptr>("task") + .def("cancel",&task::cancel) + //.def("canceled",&task::canceled) + , + class_<executor,executor_ptr>("executor") + .def("time",&executor::time) + .def("add",&detail::lua_executor_add) + , + def("schedule_revive",&detail::lua_wait) + ]; + } + + YAKE_WRAP_BINDER(task,::yake::task::bind); + +} // namespace task + void bind_task(lua_State* L) + { + YAKE_ASSERT( L ); + task::bind(L); + } +} // namespace yake + +#endif // YAKE_ENABLE_LUA_TASK Modified: trunk/yake/src/ent/object_mgr.cpp =================================================================== --- trunk/yake/src/ent/object_mgr.cpp 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/src/ent/object_mgr.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -30,7 +30,7 @@ namespace yake { namespace ent { - Object* ObjectManager::makeObject(const std::string strClsId) + Object* ObjectManager::makeObject(const String& strClsId) { YAKE_ASSERT( !strClsId.empty() )(strClsId); std::pair<object::ResultCode,ClassId> ret = objMgr_.getClassId(strClsId); Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -25,14 +25,8 @@ ------------------------------------------------------------------------------------ */ #include <yake/plugins/scriptingLua/yakePCH.h> -extern "C" { -#include <lua.h> -#include <lualib.h> -#include <lauxlib.h> -} -#define LUABIND_NO_HEADERS_ONLY -#include <luabind/luabind.hpp> +#include <yake/bindings.lua/common/yake.lua.common.h> #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <fstream> Added: trunk/yake/src/task/executor.cpp =================================================================== --- trunk/yake/src/task/executor.cpp (rev 0) +++ trunk/yake/src/task/executor.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,39 @@ +#include <yake/task/task.h> +#include <iostream> // for debug output... //@todo remove + +namespace yake { +namespace task { + + task_ptr executor::add(const void_function& fn, const size_t delayMs) + { + const size_t targetTime = currTime_ + delayMs; + task_ptr t(new task(this->shared_from_this(),fn)); + jobs_[ targetTime ].push_back( t ); + return t; + } + void executor::update(const size_t elapsed) + { + currTime_ += elapsed; + std::cout << "sched @ " << currTime_ << "\n"; + while (true && !jobs_.empty()) + { + job_map::iterator it = jobs_.begin(); + if (it->first > currTime_) + break; + + { + const task_list& fns = jobs_.begin()->second; + for (task_list::const_iterator it = fns.begin(); it != fns.end(); ++it) + { + (*it)->run(); + // if (*it)->periodic() + // @todo reschedule + } + } + jobs_.erase( jobs_.begin() ); + } + //@todo remove canceled + } + +} // namespace task +} // namespace yake Added: trunk/yake/src/task/task.cpp =================================================================== --- trunk/yake/src/task/task.cpp (rev 0) +++ trunk/yake/src/task/task.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,24 @@ +#include <yake/task/task.h> + +namespace yake { +namespace task { + + task::task(executor_ptr owner, const void_function& fn) : owner_(owner), fn_(fn), canceled_(false) + { + } + void task::cancel() + { + canceled_ = true; + } + void task::run() + { + if (canceled_) + return; + //if (!periodic_) //@todo fixme + canceled_ = true; + if (fn_) + fn_(); + } + +} // namespace task +} // namespace yake Modified: trunk/yake/yake/base/yakePrerequisites.h =================================================================== --- trunk/yake/yake/base/yakePrerequisites.h 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/yake/base/yakePrerequisites.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -30,6 +30,7 @@ //============================================================================ // IMPLEMENTATION HEADERS //=========================================================================== +#include <yake/config.h> #include <yake/base/yakePlatform.h> #include <assert.h> #include <ctime> Added: trunk/yake/yake/bindings.lua/bindings.lua.ent.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.ent.h (rev 0) +++ trunk/yake/yake/bindings.lua/bindings.lua.ent.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,37 @@ +#ifndef YAKE_LUA_BINDINGS_ENT_H +#define YAKE_LUA_BINDINGS_ENT_H + +#include <yake/bindings.lua/prerequisites.h> +#include <yake/base/yake.h> +#include <yake/base/templates/yakePointer.h> +#include <yake/ent/ent.h> +#include <yake/scripting/yakeScriptingSystem.h> + +namespace yake { +namespace ent { + struct Object; + namespace detail { + struct YAKE_BINDINGS_LUA_API LuaFsmObjectListener : public ObjectListener + { + LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem); + virtual void onInit(Object& obj); + virtual void onTick(Object& obj); + virtual void onFsmEventHandled(Object& obj, const object_fsm&, const object_fsm::event_type& evt); + virtual void onFsmEnterState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state); + virtual void onFsmExitState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state); + private: + scripting::IScriptingSystem& scriptingSystem_; + boost::shared_ptr<scripting::IScript> startScript_; + }; + } // namespace detail + struct YAKE_BINDINGS_LUA_API LuaObjectManagerListener : public ObjectManagerListener + { + LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem); + virtual void onObjectCreated(Object* obj); + private: + detail::LuaFsmObjectListener fsmListener_; + }; +} // namespace ent +} // namespace yake + +#endif Added: trunk/yake/yake/bindings.lua/bindings.lua.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.h (rev 0) +++ trunk/yake/yake/bindings.lua/bindings.lua.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,25 @@ +#ifndef YAKE_LUA_BINDINGS_H +#define YAKE_LUA_BINDINGS_H + +#include <yake/bindings.lua/prerequisites.h> + +namespace yake { + YAKE_BINDINGS_LUA_API void bind_all(lua_State*); + YAKE_BINDINGS_LUA_API void bind_all(scripting::IVM*); + +#if YAKE_ENABLE_LUA_BASE == 1 + YAKE_BINDINGS_LUA_API void bind_base(lua_State*); + YAKE_BINDINGS_LUA_API void bind_math(lua_State*); +#endif +#if YAKE_ENABLE_LUA_TASK == 1 + YAKE_BINDINGS_LUA_API void bind_task(lua_State*); +#endif +#if YAKE_ENABLE_LUA_MODEL == 1 + YAKE_BINDINGS_LUA_API void bind_model(lua_State*); +#endif +#if YAKE_ENABLE_LUA_ENT == 1 + YAKE_BINDINGS_LUA_API void bind_ent(lua_State*); +#endif +} // namespace yake + +#endif Added: trunk/yake/yake/bindings.lua/common/lua.helpers.cpp =================================================================== --- trunk/yake/yake/bindings.lua/common/lua.helpers.cpp (rev 0) +++ trunk/yake/yake/bindings.lua/common/lua.helpers.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,21 @@ +#include <yake/bindings.lua/common/lua.helpers.h> + +#include <iostream> +namespace yake { + void lua_run(luabind::object fn) + { + lua_State* L = fn.interpreter(); + assert(L); + std::cout << "resuming (lua_run)..." << std::hex << L << " (create new thread? thread gc'd?)\n"; + std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; + luabind::call_function<void>(fn); // *NOT* resume! + } + void lua_run(luabind::object fn, const boost::any& arg0) + { + lua_State* L = fn.interpreter(); + assert(L); + std::cout << "(lua_run)..." << std::hex << L << "\n"; + //luabind::call_function<void>(fn,arg0); // *NOT* resume! + fn(arg0); + } +} // namespace yake Added: trunk/yake/yake/bindings.lua/common/lua.helpers.h =================================================================== --- trunk/yake/yake/bindings.lua/common/lua.helpers.h (rev 0) +++ trunk/yake/yake/bindings.lua/common/lua.helpers.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,28 @@ +#ifndef YAKE_LUA_HELPERS_H +#define YAKE_LUA_HELPERS_H + +#include <yake/bindings.lua/common/yake.lua.common.h> +#include <boost/any.hpp> + +namespace yake { + + void lua_run(luabind::object fn); + void lua_run(luabind::object fn, const boost::any& arg0); + +} // namespace yake + +#endif +#ifndef YAKE_LUA_HELPERS_H +#define YAKE_LUA_HELPERS_H + +#include <yake/bindings.lua/common/yake.lua.common.h> +#include <boost/any.hpp> + +namespace yake { + + void lua_run(luabind::object fn); + void lua_run(luabind::object fn, const boost::any& arg0); + +} // namespace yake + +#endif Added: trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp =================================================================== --- trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp (rev 0) +++ trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,104 @@ +#include "stdafx.h" +#include "vminfo.lua.h" + +// Lua and Luabind includes: +extern "C" { + #include "lua.h" + #include "lualib.h" + #include "lauxlib.h" +} +#pragma warning(push) +#pragma warning(disable: 4251) +#include <luabind/luabind.hpp> +#pragma warning(pop) + +// @todo autolink? +#pragma comment(lib,"luad.lib") +#pragma comment(lib,"luabindd.lib") + +// +namespace yake { +namespace vminfo_lua { + vm_info::vm_info(lua_State* L) : state(L) + {} + std::string vm_info::info() const + { + std::stringstream out; + this->print(out); + return out.str(); + } + void vm_info::print(std::ostream& out) const + { + out << "vm_info(" << std::hex << state << ")"; + } + void vm_info::print_to_cout() const + { + this->print(std::cout); + } + void bind(lua_State* L) + { + assert(L); + if (!L) + return; + using namespace luabind; // we don't expect collisions. + module( L ) + [ + class_<vm_info>("vm_info") + .def("print",&vm_info::print_to_cout) + .def("info",&vm_info::info) + ]; + } +} // namespace scheduler +} // namespace yake +#include "stdafx.h" +#include "vminfo.lua.h" + +// Lua and Luabind includes: +extern "C" { + #include "lua.h" + #include "lualib.h" + #include "lauxlib.h" +} +#pragma warning(push) +#pragma warning(disable: 4251) +#include <luabind/luabind.hpp> +#pragma warning(pop) + +// @todo autolink? +#pragma comment(lib,"luad.lib") +#pragma comment(lib,"luabindd.lib") + +// +namespace yake { +namespace vminfo_lua { + vm_info::vm_info(lua_State* L) : state(L) + {} + std::string vm_info::info() const + { + std::stringstream out; + this->print(out); + return out.str(); + } + void vm_info::print(std::ostream& out) const + { + out << "vm_info(" << std::hex << state << ")"; + } + void vm_info::print_to_cout() const + { + this->print(std::cout); + } + void bind(lua_State* L) + { + assert(L); + if (!L) + return; + using namespace luabind; // we don't expect collisions. + module( L ) + [ + class_<vm_info>("vm_info") + .def("print",&vm_info::print_to_cout) + .def("info",&vm_info::info) + ]; + } +} // namespace scheduler +} // namespace yake Added: trunk/yake/yake/bindings.lua/common/vminfo.lua.h =================================================================== --- trunk/yake/yake/bindings.lua/common/vminfo.lua.h (rev 0) +++ trunk/yake/yake/bindings.lua/common/vminfo.lua.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,46 @@ +#ifndef YAKE_VMINFO_LUA_H +#define YAKE_VMINFO_LUA_H + +struct lua_State; + +#include <sstream> // for vm_info::info() +#include <iostream> // for vm_info::print() + +namespace yake { +namespace vminfo_lua { + struct vm_info + { + vm_info(lua_State* L = 0); + std::string info() const; + void print(std::ostream& out) const; + void print_to_cout() const; + lua_State* state; + }; + void bind(lua_State* L); +} // namespace vminfo_lua +} // namespace yake + +#endif +#ifndef YAKE_VMINFO_LUA_H +#define YAKE_VMINFO_LUA_H + +struct lua_State; + +#include <sstream> // for vm_info::info() +#include <iostream> // for vm_info::print() + +namespace yake { +namespace vminfo_lua { + struct vm_info + { + vm_info(lua_State* L = 0); + std::string info() const; + void print(std::ostream& out) const; + void print_to_cout() const; + lua_State* state; + }; + void bind(lua_State* L); +} // namespace vminfo_lua +} // namespace yake + +#endif Added: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp (rev 0) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,96 @@ +#include <yake/bindings.lua/common/yake.lua.any_converter.h> + +any_converter_map& any_converters() +{ + static any_converter_map s_converters; + return s_converters; +} + + + +namespace luabind +{ + namespace converters + { + void convert_cpp_to_lua(lua_State* L, const boost::any& a) + { + typedef void(*conv_t)(lua_State* L, const boost::any&); + const type_info* ti = &a.type(); + + // special case: 'boost::any(void)' is converted to 'nil' + if (ti == &typeid(void)) + { + //std::cout << "(warning: converted void to nil)\n"; + lua_pushnil(L); + return; + } + // lookup converter & run (or bail out if no converter found) + any_converter_map::const_iterator it = any_converters().find(ti); + if (it == any_converters().end()) + throw std::runtime_error(std::string("convert_cpp_to_lua() failed to convert '") + ti->name() + "'."); + conv_t conv = it->second; + conv(L, a); + } + boost::any convert_lua_to_cpp(lua_State* L, by_value<boost::any>, int index) + { + object o(from_stack(L,index)); + switch (luabind::type(o)) + { + case LUA_TBOOLEAN: + return boost::any( object_cast<bool>(o) ); + case LUA_TNUMBER: + return boost::any( object_cast<int>(o) ); + case LUA_TSTRING: + return boost::any( object_cast<std::string>(o) ); //@todo fixme + default: + throw std::exception("encountered unsupported type in convert_lua_to_cpp()"); + } + throw std::exception("encountered unsupported type in convert_lua_to_cpp()"); + } + boost::any convert_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index) + { + object o(from_stack(L,index)); + switch (luabind::type(o)) + { + case LUA_TBOOLEAN: + return boost::any( object_cast<bool>(o) ); + case LUA_TNUMBER: + return boost::any( object_cast<int>(o) ); + case LUA_TSTRING: + return boost::any( object_cast<std::string>(o) ); //@todo fixme + default: + throw std::exception("encountered unsupported type in convert_lua_to_cpp()"); + } + throw std::exception("encountered unsupported type in convert_lua_to_cpp()"); + } + int match_lua_to_cpp(lua_State* L, by_value<boost::any>, int index) + { + object o(from_stack(L,index)); + switch (luabind::type(o)) + { + case LUA_TBOOLEAN: + case LUA_TNUMBER: + case LUA_TSTRING: + return 0; + default: + return -1; + } + return -1; + } + int match_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index) + { + object o(from_stack(L,index)); + switch (luabind::type(o)) + { + case LUA_TBOOLEAN: + case LUA_TNUMBER: + case LUA_TSTRING: + return 0; + default: + return -1; + } + return -1; + } + } +} + Added: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h (rev 0) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,114 @@ +#ifndef YAKE_LUA_ANYCONVERTER_H +#define YAKE_LUA_ANYCONVERTER_H + +// +#include <yake/base/yakePrerequisites.h> +#include <yake/bindings.lua/common/yake.lua.common.h> +#include <map> +#include <boost/any.hpp> + + // boost::any bindings + template<class T> + struct convert_any + { + static void convert(lua_State* L, const boost::any& a) + { + //typename luabind::detail::default_policy::template generate_converter<T, luabind::detail::cpp_to_lua>::type conv; + //conv.apply(L, *boost::any_cast<T>(&a)); + luabind::detail::convert_to_lua(L, *boost::any_cast<T>(&a)); + } + }; + + typedef std::map<const std::type_info*, void(*)(lua_State*, const boost::any&)> any_converter_map; + +#if defined(YAKE_EXPORT_LUA_ANY_CONVERTER) +# pragma message("dllexport") +# define YAKE_LUA_ANY_CONVERTER_API DLLEXPORT +#else +# pragma message("dllimport") +# define YAKE_LUA_ANY_CONVERTER_API DLLIMPORT +#endif + + YAKE_LUA_ANY_CONVERTER_API any_converter_map& any_converters(); + + //any_converter_map any_converters; + + template<class T> + void register_any_converter() + { + any_converters()[&typeid(T)] = convert_any<T>::convert; + } + + namespace luabind + { + namespace converters + { + yes_t is_user_defined(by_value<boost::any>); + yes_t is_user_defined(by_const_reference<boost::any>); + + YAKE_LUA_ANY_CONVERTER_API void convert_cpp_to_lua(lua_State* L, const boost::any& a); + YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); + } + } + +#endif +#ifndef YAKE_LUA_ANYCONVERTER_H +#define YAKE_LUA_ANYCONVERTER_H + +// +#include <yake/base/yakePrerequisites.h> +#include <yake/bindings.lua/common/yake.lua.common.h> +#include <map> +#include <boost/any.hpp> + + // boost::any bindings + template<class T> + struct convert_any + { + static void convert(lua_State* L, const boost::any& a) + { + //typename luabind::detail::default_policy::template generate_converter<T, luabind::detail::cpp_to_lua>::type conv; + //conv.apply(L, *boost::any_cast<T>(&a)); + luabind::detail::convert_to_lua(L, *boost::any_cast<T>(&a)); + } + }; + + typedef std::map<const std::type_info*, void(*)(lua_State*, const boost::any&)> any_converter_map; + +#if defined(YAKE_EXPORT_LUA_ANY_CONVERTER) +# pragma message("dllexport") +# define YAKE_LUA_ANY_CONVERTER_API DLLEXPORT +#else +# pragma message("dllimport") +# define YAKE_LUA_ANY_CONVERTER_API DLLIMPORT +#endif + + YAKE_LUA_ANY_CONVERTER_API any_converter_map& any_converters(); + + //any_converter_map any_converters; + + template<class T> + void register_any_converter() + { + any_converters()[&typeid(T)] = convert_any<T>::convert; + } + + namespace luabind + { + namespace converters + { + yes_t is_user_defined(by_value<boost::any>); + yes_t is_user_defined(by_const_reference<boost::any>); + + YAKE_LUA_ANY_CONVERTER_API void convert_cpp_to_lua(lua_State* L, const boost::any& a); + YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); + YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); + } + } + +#endif Added: trunk/yake/yake/bindings.lua/common/yake.lua.common.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.common.h (rev 0) +++ trunk/yake/yake/bindings.lua/common/yake.lua.common.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,32 @@ +#ifndef YAKE_BINDINGS_LUA_COMMON_H +#define YAKE_BINDINGS_LUA_COMMON_H + +// Lua and Luabind includes: +extern "C" { + #include "lua.h" + #include "lualib.h" + #include "lauxlib.h" +} +#pragma warning(push) +#pragma warning(disable: 4251) +#define LUABIND_NO_HEADERS_ONLY +#include <luabind/luabind.hpp> +#pragma warning(pop) + +#endif +#ifndef YAKE_BINDINGS_LUA_COMMON_H +#define YAKE_BINDINGS_LUA_COMMON_H + +// Lua and Luabind includes: +extern "C" { + #include "lua.h" + #include "lualib.h" + #include "lauxlib.h" +} +#pragma warning(push) +#pragma warning(disable: 4251) +#define LUABIND_NO_HEADERS_ONLY +#include <luabind/luabind.hpp> +#pragma warning(pop) + +#endif Added: trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h (rev 0) +++ trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,50 @@ +#ifndef YAKE_LUA_SHAREDPTR_BINDING_H +#define YAKE_LUA_SHAREDPTR_BINDING_H + +#include <boost/shared_ptr.hpp> + +// boost::shared_ptr bindings +namespace luabind { + template<class T> + T* get_pointer(boost::shared_ptr<T>& p) + { + return p.get(); + } + + //typedef boost::shared_ptr<ui::LuaStyleBatcher> LuaStyleBatcherPtr; + //typedef boost::shared_ptr<const ui::LuaStyleBatcher> ConstLuaStyleBatcherPtr; + + template<class A> + boost::shared_ptr<const A>* + get_const_holder(boost::shared_ptr<A>*) + { + return 0; + } +} // namespace luabind + +#endif +#ifndef YAKE_LUA_SHAREDPTR_BINDING_H +#define YAKE_LUA_SHAREDPTR_BINDING_H + +#include <boost/shared_ptr.hpp> + +// boost::shared_ptr bindings +namespace luabind { + template<class T> + T* get_pointer(boost::shared_ptr<T>& p) + { + return p.get(); + } + + //typedef boost::shared_ptr<ui::LuaStyleBatcher> LuaStyleBatcherPtr; + //typedef boost::shared_ptr<const ui::LuaStyleBatcher> ConstLuaStyleBatcherPtr; + + template<class A> + boost::shared_ptr<const A>* + get_const_holder(boost::shared_ptr<A>*) + { + return 0; + } +} // namespace luabind + +#endif Added: trunk/yake/yake/bindings.lua/detail/private.h =================================================================== --- trunk/yake/yake/bindings.lua/detail/private.h (rev 0) +++ trunk/yake/yake/bindings.lua/detail/private.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,42 @@ +#ifndef YAKE_LUA_BINDINGS_PRIVATE_H +#define YAKE_LUA_BINDINGS_PRIVATE_H + +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> + +#define YAKE_WRAP_BINDER(CLASS,BINDERFN) \ + struct binder_##CLASS : public scripting::IBinder \ + { \ + YAKE_DECLARE_CONCRETE(binder_##CLASS, #CLASS); \ + virtual void bind(scripting::IVM* vm) \ + { \ + YAKE_ASSERT(vm); \ + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); \ + lua_State* L = luavm->getLuaState(); \ + BINDERFN(L); \ + } \ + };\ + YAKE_REGISTER_CONCRETE(binder_##CLASS); + +#endif +#ifndef YAKE_LUA_BINDINGS_PRIVATE_H +#define YAKE_LUA_BINDINGS_PRIVATE_H + +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> + +#define YAKE_WRAP_BINDER(CLASS,BINDERFN) \ + struct binder_##CLASS : public scripting::IBinder \ + { \ + YAKE_DECLARE_CONCRETE(binder_##CLASS, #CLASS); \ + virtual void bind(scripting::IVM* vm) \ + { \ + YAKE_ASSERT(vm); \ + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); \ + lua_State* L = luavm->getLuaState(); \ + BINDERFN(L); \ + } \ + };\ + YAKE_REGISTER_CONCRETE(binder_##CLASS); + +#endif Added: trunk/yake/yake/bindings.lua/prerequisites.h =================================================================== --- trunk/yake/yake/bindings.lua/prerequisites.h (rev 0) +++ trunk/yake/yake/bindings.lua/prerequisites.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,21 @@ +#ifndef YAKE_LUA_BINDINGS_PREREQUISITES_H +#define YAKE_LUA_BINDINGS_PREREQUISITES_H + +#include <yake/config.h> +#include <yake/base/yakePrerequisites.h> + +#if defined(YAKE_BINDINGS_LUA_EXPORTS) +# define YAKE_BINDINGS_LUA_API DLLEXPORT +#else +# define YAKE_BINDINGS_LUA_API DLLIMPORT +#endif + +struct lua_State; + +namespace yake { + namespace scripting { + class IVM; + } // namespace scripting +} // namespace yake + +#endif Modified: trunk/yake/yake/ent/object_mgr.h =================================================================== --- trunk/yake/yake/ent/object_mgr.h 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/yake/ent/object_mgr.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -60,7 +60,7 @@ /** Creates an Object for the given clsId. If the ClassId isn't known (i.e. unregistered) then 0 is returned. */ - Object* makeObject(const String strClsId); + Object* makeObject(const String& strClsId); /** Destroys the given Object. */ void destroyObject(Object*); Modified: trunk/yake/yake/physics/yakePhysicsPrerequisites.h =================================================================== --- trunk/yake/yake/physics/yakePhysicsPrerequisites.h 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/yake/physics/yakePhysicsPrerequisites.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -30,6 +30,10 @@ #ifndef YAKE_BASE_PREREQUISITES_H # include <yake/base/yakePrerequisites.h> #endif +#include <yake/base/templates/yakeDeque.h> +#include <yake/base/math/yakeMath.h> +#include <yake/base/math/yakeVector3.h> +#include <yake/base/math/yakeMatrix4.h> // C O N F I G U R A T I O N Modified: trunk/yake/yake/physics/yakePhysicsShape.h =================================================================== --- trunk/yake/yake/physics/yakePhysicsShape.h 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/yake/physics/yakePhysicsShape.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -30,6 +30,7 @@ #ifndef YAKE_PHYSICS_PREQREQUISITES_H # include <yake/physics/yakePhysicsPrerequisites.h> #endif +#include <yake/base/yakeMovable.h> namespace yake { namespace physics { Modified: trunk/yake/yake/scripting/yakeScriptingSystem.h =================================================================== --- trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-03-12 20:59:12 UTC (rev 1629) +++ trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -28,6 +28,12 @@ #define YAKE_SCRIPTINGSYSTEM_H //#include <yakeBase/yake/yakeStableHeaders.h> +#include <yake/config.h> +#include <yake/base/yakePrerequisites.h> +#include <yake/base/yakePlugin.h> +#include <yake/base/templates/yakePointer.h> +#include <yake/base/templates/yakeManager.h> +#include <yake/base/templates/yakeRegistry.h> #if defined( YAKE_SCRIPTING_EXPORTS ) # pragma message("Exporting yake::scripting") Added: trunk/yake/yake/task/prerequisites.h =================================================================== --- trunk/yake/yake/task/prerequisites.h (rev 0) +++ trunk/yake/yake/task/prerequisites.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,24 @@ +#ifndef YAKE_TASK_PREREQUISITES_H +#define YAKE_TASK_PREREQUISITES_H + +#include <yake/base/yakePrerequisites.h> + +#if defined( YAKE_TASK_EXPORTS ) +# define YAKE_TASK_API DLLEXPORT +#else +# define YAKE_TASK_API DLLIMPORT +#endif + +#endif +#ifndef YAKE_TASK_PREREQUISITES_H +#define YAKE_TASK_PREREQUISITES_H + +#include <yake/base/yakePrerequisites.h> + +#if defined( YAKE_TASK_EXPORTS ) +# define YAKE_TASK_API DLLEXPORT +#else +# define YAKE_TASK_API DLLIMPORT +#endif + +#endif Added: trunk/yake/yake/task/task.h =================================================================== --- trunk/yake/yake/task/task.h (rev 0) +++ trunk/yake/yake/task/task.h 2007-03-12 21:01:27 UTC (rev 1630) @@ -0,0 +1,176 @@ +#ifndef YAKE_TASK_H +#define YAKE_TASK_H + +#include <yake/task/prerequisites.h> +#include <yake/base/templates/yakeFunction.h> +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> + +namespace yake { +namespace task { + + struct executor; + typedef boost::shared_ptr<executor> executor_ptr; + + /** Represents a task object which can... [truncated message content] |
From: <psy...@us...> - 2007-03-12 23:11:21
|
Revision: 1632 http://svn.sourceforge.net/yake/?rev=1632&view=rev Author: psyclonist Date: 2007-03-12 16:11:20 -0700 (Mon, 12 Mar 2007) Log Message: ----------- adjusted scripting demo 1, support post build commands in premake 3.3, catch exceptions in scriptingLua, remove an irritating define _ in define LIBRARY_EXTENSION Modified Paths: -------------- trunk/yake/samples/README.TXT trunk/yake/samples/base/scripting/lua/yakeDemo.cpp trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp trunk/yake/yake/base/prerequisites/yakePrerequisitesGCC.h trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h trunk/yake/yake/samples/common/configs.h Removed Paths: ------------- trunk/yake/yake/base/yakePrerequisites.h Modified: trunk/yake/samples/README.TXT =================================================================== --- trunk/yake/samples/README.TXT 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/samples/README.TXT 2007-03-12 23:11:20 UTC (rev 1632) @@ -13,6 +13,7 @@ ent/sampleEntFsm - entity scripting physics/demo - basic physics demo (multiple viewports, simplistic objects) vehicle - different vehicles can be controlled (car,jet, uses RAF, entities and models) +base/scripting/lua - basic scripting demo ---- in flux: (i.e. in process of being added to the main build scripts) Modified: trunk/yake/samples/base/scripting/lua/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-03-12 23:11:20 UTC (rev 1632) @@ -4,72 +4,63 @@ //** //**************************************************************************** -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ // Yake #include <yake/base/yake.h> -#include <yake/samples/common/yakeExampleApplication.h> +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/bindings.lua/bindings.lua.h> -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -using namespace yake::base::templates; -using namespace yake::scripting; +using namespace yake; // We don't expect collisions. -//============================================================================ -// Application -//============================================================================ +SharedPtr<base::Library> loadLib( const String & file ) +{ + SharedPtr<base::Library> pDynLib( new base::Library( file ) ); + YAKE_ASSERT( pDynLib ).debug( "Out of memory." ); + return pDynLib; +} -class TheApp : public yake::exapp::ExampleApplication +int main() { -public: - TheApp() : ExampleApplication( false, false, true, false, true, false ) + try { - } - virtual void run() - { - yake::scripting::IVM* pVM = getScriptingSystem().createVM(); - YAKE_ASSERT( pVM ); + SharedPtr<base::Library> lib = loadLib(YAKE_DYNLIB_NAME("scriptingLua")); + YAKE_ASSERT( lib ).debug("Cannot load Lua scripting plugin."); - getScriptingBindings().bind( pVM ); + SharedPtr<base::Library> binderLib = loadLib(YAKE_DYNLIB_NAME("bindings.lua")); + YAKE_ASSERT( binderLib ).debug("Cannot load Lua bindings."); + SharedPtr<scripting::IScriptingSystem> scriptingSys = templates::create_default<scripting::IScriptingSystem>(); + SharedPtr<scripting::IScriptingSystem> scriptingBindings = templates::create_default<scripting::IScriptingSystem>(); + + SharedPtr<scripting::IVM> vm( scriptingSys->createVM() ); + YAKE_ASSERT( vm ); + + bind_all( vm.get() ); + // This prints 'hello from lua scripting ;)' to stdout using // the Lua function print(). - pVM->execute("print('hello from lua scripting ;)');"); + vm->execute("print('hello from lua scripting ;)');"); // Execute a script created from a file. - yake::scripting::IScript* pScript = getScriptingSystem().createScriptFromFile("../../media/samples/scriptingLua/test.lua"); - pVM->execute( pScript ); - delete pScript; + { + SharedPtr<scripting::IScript> script( scriptingSys->createScriptFromFile("../../../common/media/samples/scriptingLua/test.lua") ); + YAKE_ASSERT( script ); + vm->execute( script.get() ); + } - delete pVM; + vm.reset(); + binderLib.reset(); + lib.reset(); } -}; - -//============================================================================ -// IMPLEMENTATION FUNCTIONS -//============================================================================ - -int main() -{ - try - { - TheApp theApp; - theApp.initialise(); - theApp.run(); - -#if defined( YAKE_DEBUG_BUILD ) - std::cout << std::endl << "Waiting for you..."; - std::cin.get(); -#endif - } catch ( yake::Exception & e ) { std::cout << "YAKE EXCEPTION: " << e.getSource() << std::endl; std::cout << "File: " << e.getFile() << " @ " << e.getLine() << std::endl; std::cout << "Reason: " << e.getMessage() << std::endl << std::endl; } +#if defined( YAKE_DEBUG_BUILD ) + std::cout << std::endl << "Waiting for you..."; + std::cin.get(); +#endif return 0; } Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/scripts/premake/config.lua 2007-03-12 23:11:20 UTC (rev 1632) @@ -16,6 +16,12 @@ LIBFILE_PREFIX = "yake_" EXEFILE_SUFFIX = "" +if windows then + DLL_EXTENSION = "dll" +else + DLL_EXTENSION = "so" +end + -------------------------------------- -- Plugins -------------------------------------- Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/scripts/premake/samples.lua 2007-03-12 23:11:20 UTC (rev 1632) @@ -119,3 +119,9 @@ useComponent("netsvc") addIncludePath("dependencies/boost") addMatching("samples/net/roclient/roclient*") + +-------------------------------------- +makeSample("sampleScripting1","samples/base/scripting/lua") +useComponent("base") +useComponent("scripting") +useComponent("bindings.lua") Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/scripts/premake/tools.lua 2007-03-12 23:11:20 UTC (rev 1632) @@ -33,6 +33,18 @@ tinsert(package.libpaths,rootdir..path) end end +function addPostBuildCommand(cmd) + if (cmd) then + tinsert(package.postbuildcommands,cmd) + end +end +function addPostBuildCopy(args) + if windows then + return "copy " .. args + else + return "cp " .. args + end +end function makeLibProject(name) project.name = name @@ -75,7 +87,7 @@ package.buildflags = {} package.includepaths = {rootdir} package.defines = {} - + if (windows) then addDefine("_CRT_SECURE_NO_DEPRECATE") addDefine("WIN32") @@ -90,6 +102,11 @@ debug.target = targetBaseDir.."debug/"..(LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) debug.defines = {"_DEBUG"} debug.buildflags = {} + if windows then + local args = debug.target .. "." .. DLL_EXTENSION .. " " .. rootdir .. "samples/bin/debug" + args = string.gsub(args,"/","\\") + debug.postbuildcommands = {"copy /Y " .. args} + end releaseWithSym = package.config.ReleaseWithSymbols releaseWithSym.target = targetBaseDir.."release_sym/"..(LIBFILE_PREFIX)..name.."_sym" @@ -106,6 +123,11 @@ "optimize-speed", "no-frame-pointer" } + if windows then + local args = release.target .. "." .. DLL_EXTENSION .. " " .. rootdir .. "samples/bin/release" + args = string.gsub(args,"/","\\") + release.postbuildcommands = {"copy /Y " .. args} + end debugLib = package.config.DebugLib debugLib.kind = "lib" Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/scripts/premake/yake.lua 2007-03-12 23:11:20 UTC (rev 1632) @@ -46,6 +46,7 @@ f:write("#define YAKE_DEBUG_DLL_SUFFIX \"" .. DEBUG_DLL_SUFFIX .. "\"\n") f:write("#define YAKE_LIBFILE_PREFIX \"" .. LIBFILE_PREFIX .. "\"\n") f:write("#define YAKE_LUA_BINDINGS " .. bool_to_int(LUA_BINDINGS) .. "\n") + f:write("#define YAKE_ENABLE_LUA_BASE " .. bool_to_int(ENABLE_LUA_BASE) .. "\n") f:write("#define YAKE_ENABLE_LUA_ENT " .. bool_to_int(ENABLE_LUA_ENT) .. "\n") f:write("#define YAKE_ENABLE_LUA_MODEL " .. bool_to_int(ENABLE_LUA_MODEL) .. "\n") f:write("#define YAKE_ENABLE_LUA_TASK " .. bool_to_int(ENABLE_LUA_TASK) .. "\n") Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-12 23:11:20 UTC (rev 1632) @@ -81,24 +81,56 @@ //------------------------------------------------------ void LuaVM::execute( const String & rData ) { - if (mLuaState) - luaL_dostring( mLuaState, rData.c_str() ); + try { + if (mLuaState) + luaL_dostring( mLuaState, rData.c_str() ); + } + catch (luabind::error& e) + { + throw Exception(String("LuaVM: caught Luabind error") + e.what()); + } + catch (luabind::cast_failed& e) + { + throw Exception(String("LuaVM: caught Luabind cast_failed") + e.what()); + } + catch (std::exception& e) + { + throw Exception(String("LuaVM: caught exception: ") + e.what()); + } } //------------------------------------------------------ void LuaVM::execute( scripting::IScript* pScript ) { - if ( ( pScript->getCreator()->getLanguage() != scripting::IScriptingSystem::L_LUA ) || - ( 0 == mLuaState ) ) - return; + try { + if ( ( pScript->getCreator()->getLanguage() != scripting::IScriptingSystem::L_LUA ) || + ( 0 == mLuaState ) ) + return; - LuaScript* pLuaScript = static_cast< LuaScript* > ( pScript ); + LuaScript* pLuaScript = static_cast< LuaScript* > ( pScript ); - const String& rFileName = pLuaScript->getData(); + const String& rFileName = pLuaScript->getData(); - const int err = luaL_dofile( mLuaState, rFileName.c_str() ); - if (err) - YAKE_EXCEPT("Failed to execute script! (Does file exist?)"); + const int err = luaL_dofile( mLuaState, rFileName.c_str() ); + if (err) + YAKE_EXCEPT("Failed to execute script! (Does file exist?)"); + } + catch (luabind::error& e) + { + throw Exception(String("LuaVM: caught Luabind error") + e.what()); + } + catch (luabind::cast_failed& e) + { + throw Exception(String("LuaVM: caught Luabind cast_failed") + e.what()); + } + catch (Exception& e) + { + throw; + } + catch (std::exception& e) + { + throw Exception(String("LuaVM: caught exception: ") + e.what()); + } } //------------------------------------------------------ Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesGCC.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesGCC.h 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesGCC.h 2007-03-12 23:11:20 UTC (rev 1632) @@ -102,7 +102,7 @@ #define DLLEXPORT #define DLLIMPORT -#define LIBRARY_EXTENSION _( "so" ) +#define LIBRARY_EXTENSION ( "so" ) #ifdef _DEBUG # define YAKE_DEBUG_BUILD Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-03-12 23:11:20 UTC (rev 1632) @@ -92,7 +92,7 @@ #define DLLEXPORT #define DLLIMPORT -#define LIBRARY_EXTENSION _( "so" ) +#define LIBRARY_EXTENSION ( "so" ) #ifdef _DEBUG # define YAKE_DEBUG_BUILD Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h 2007-03-12 23:11:20 UTC (rev 1632) @@ -71,8 +71,9 @@ #define DLLEXPORT __declspec( dllexport ) #define DLLIMPORT __declspec( dllimport ) -#define LIBRARY_EXTENSION _( "dll" ) +#define LIBRARY_EXTENSION ( "dll" ) + #ifdef _DEBUG # define YAKE_DEBUG_BUILD #endif Deleted: trunk/yake/yake/base/yakePrerequisites.h =================================================================== --- trunk/yake/yake/base/yakePrerequisites.h 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/yake/base/yakePrerequisites.h 2007-03-12 23:11:20 UTC (rev 1632) @@ -1,162 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright \xA9 2004 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_PREREQUISITES_H -#define YAKE_BASE_PREREQUISITES_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//=========================================================================== -#include <yake/config.h> -#include <yake/base/yakePlatform.h> -#include <assert.h> -#include <ctime> -#include <math.h> -#include <cmath> -// Undef min and max macros on Windows. They're defined in windef.h. -#if (YAKE_PLATFORM == PLATFORM_WIN32) - #ifdef min - #undef min - #endif - #ifdef max - #undef max - #endif -#endif -#include <limits> -#include <cstdio> -#include <stdio.h> -#include <stdarg.h> -#include <string> -#include <stdexcept> -#include <locale> -#include <algorithm> -#include <functional> -#include <vector> -#include <map> -#include <list> -#include <queue> -#include <set> -#include <iostream> -#include <sstream> - -#ifdef __SGI_STL -# include <iterator> -#endif - -// Include platform specific configuration files -#if (YAKE_PLATFORM == PLATFORM_WIN32) && (YAKE_COMPILER == COMPILER_MSVC) -# include <yake/base/prerequisites/yakePrerequisitesVC.h> -#elif (YAKE_PLATFORM == PLATFORM_WIN32) && (YAKE_COMPILER == COMPILER_GNUC) -# include <yake/base/prerequisites/yakePrerequisitesGCCWin.h> -#elif (YAKE_PLATFORM == PLATFORM_LINUX) && (YAKE_COMPILER == COMPILER_GNUC) -# include <yake/base/prerequisites/yakePrerequisitesGCC.h> -#else -# error("Yake: No configuration file set for the selected platform/compiler!") -#endif - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -// Yake - -// YAKE_BASE_API -#if defined( YAKE_BASE_EXPORTS ) -# define YAKE_BASE_API DLLEXPORT -#else -# define YAKE_BASE_API DLLIMPORT -#endif - -// YAKE_DEBUG -#if defined(_DEBUG) || defined(DEBUG) -# define YAKE_DEBUG -#endif - -// YAKE_UNICODE: Not supported at the moment! -//#define YAKE_UNICODE - -#if defined(YAKE_UNICODE) -# define __T(X) L ## X -#else -# define __T(X) X -#endif - -// _T(X) Macro for defining strings ( -#define _T(X) __T(X) - -// STL -#if defined(YAKE_DEBUG_BUILD) -//# define _STLP_DEBUG 1 -#endif -#define _STLP_USE_DYNAMIC_LIB - -// Boost / TTL -#if (YAKE_PLATFORM == PLATFORM_WIN32) && (YAKE_COMPILER == COMPILER_GNUC) - #define YAKE_SIGNALS_USE_BOOST -#else - #define YAKE_SIGNALS_USE_BOOST - //#define YAKE_SIGNALS_USE_TTL -#endif - -// YAKE_REAL_PRECISION -// Determines the type used for 'real'. -// YAKE_REAL_SINGLE_PRECISION = float -// YAKE_REAL_DOUBLE_PRECISION = double -//@todo move this into configuration header -#define YAKE_REAL_SINGLE_PRECISION 1 -#define YAKE_REAL_DOUBLE_PRECISION 2 -#define YAKE_REAL_PRECISION YAKE_REAL_SINGLE_PRECISION -#if YAKE_REAL_PRECISION == YAKE_REAL_SINGLE_PRECISION - typedef float real; -#elif YAKE_REAL_PRECISION == YAKE_REAL_DOUBLE_PRECISION - typedef double real; -#else -# pragma error("yake: Unknown type for 'real'!") -#endif - - -// Helper macros -// todo: remove, deprecated, use safe_delete(_array) -#define YAKE_SAFE_RELEASE(ptr) if(ptr) { ptr->release(); ptr = 0; } -#define YAKE_SAFE_DELETE(ptr) if(ptr) { delete ptr; ptr = 0; } -#define YAKE_SAFE_DELETE_ARRAY(ptr_array) if(ptr_array) { delete [] ptr_array; ptr_array = 0; } - -#define YAKE_DECLARE_CLASS(name) static const char * yake_private_currentClass() { return #name; } -#define YAKE_DECLARE_GLOBAL YAKE_DECLARE_CLASS( global ) -#define YAKE_DECLARE_FUNCTION(name) static const char * yake_private_currentFunction = #name "()"; - -#define YAKE_FOR_EACH(ITER_TYPE,ITER_NAME,CTR) \ - for (ITER_TYPE ITER_NAME = CTR.begin(); ITER_NAME != CTR.end(); ++ITER_NAME) - - -#ifdef YAKE_DEBUG -# define YAKE_DYNLIB_POSTFIX "_d" -#else -# define YAKE_DYNLIB_POSTFIX -#endif -#define YAKE_DYNLIB_NAME(X) \ - yake::String("yake_" X YAKE_DYNLIB_POSTFIX).c_str() - -#endif // YAKE_BASE_PREREQUISITES_H Modified: trunk/yake/yake/samples/common/configs.h =================================================================== --- trunk/yake/yake/samples/common/configs.h 2007-03-12 21:03:25 UTC (rev 1631) +++ trunk/yake/yake/samples/common/configs.h 2007-03-12 23:11:20 UTC (rev 1632) @@ -53,7 +53,7 @@ { typedef minimum_config config; - // todo: base::native::Load_Library should add YAKE_DLL_POSTFIX (".dll" and the linux equivalent) to the library name + // todo: base::native::Load_Library should add YAKE_DYNLIB_POSTFIX (".dll" and the linux equivalent) to the library name static std::vector<std::string> get_libraries() { return libraries() << "graphicsOGRE.dll"; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 14:28:52
|
Revision: 1642 http://svn.sourceforge.net/yake/?rev=1642&view=rev Author: psyclonist Date: 2007-03-15 07:28:16 -0700 (Thu, 15 Mar 2007) Log Message: ----------- updated license, added svn:eol-style property where it was missing Modified Paths: -------------- trunk/yake/common/bin/debug/rodemo.cfg trunk/yake/common/bin/debug/rodemo_client.cfg trunk/yake/common/bin/debug/rodemo_server.cfg trunk/yake/common/bin/debug/rodemo_serverclient.cfg trunk/yake/common/bin/release/rodemo.cfg trunk/yake/common/bin/release/rodemo_client.cfg trunk/yake/common/bin/release/rodemo_server.cfg trunk/yake/common/bin/release/rodemo_serverclient.cfg trunk/yake/common/media/gui/layouts/GUILayout.xsd trunk/yake/common/media/gui/layouts/VanillaConsole.layout trunk/yake/common/media/samples/character/demo.actionmap.txt trunk/yake/common/media/samples/net/server_defaults.txt trunk/yake/common/media/samples/net/server_user.txt trunk/yake/common/media/vehicles/demo.actionmap.txt trunk/yake/documentation/manual/yake-manual-license.txt trunk/yake/documentation/manual/yake-manual.css trunk/yake/documentation/manual/yake-manual.txt trunk/yake/samples/bin/debug/commclient.cfg trunk/yake/samples/bin/debug/commserver.cfg trunk/yake/samples/bin/debug/roclient.cfg trunk/yake/samples/bin/debug/rodemo.cfg trunk/yake/samples/bin/debug/roserver.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg trunk/yake/samples/net/commclient/demo.cpp trunk/yake/samples/net/commserver/demo.cpp trunk/yake/samples/net/inprocess/common.h trunk/yake/samples/net/inprocess/demo.cpp trunk/yake/samples/net/roclient/ROClient.h trunk/yake/samples/net/roserver/ROServer.h trunk/yake/samples/sampleLog/demo.cpp trunk/yake/samples/vehicle/yakeDemo.cpp trunk/yake/samples/vehicle/yakePCH.cpp trunk/yake/samples/vehicle/yakePCH.h trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/plugins.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua trunk/yake/src/audio/yakeAudio.cpp trunk/yake/src/audio/yakePCH.cpp trunk/yake/src/base/math/yakeMath.cpp trunk/yake/src/base/math/yakeMatrix3.cpp trunk/yake/src/base/math/yakeMatrix4.cpp trunk/yake/src/base/math/yakeQuaternion.cpp trunk/yake/src/base/math/yakeRand.cpp trunk/yake/src/base/math/yakeRay.cpp trunk/yake/src/base/math/yakeSimpleSpline.cpp trunk/yake/src/base/math/yakeVector3.cpp trunk/yake/src/base/native/Linux/yakeApplication.cpp trunk/yake/src/base/native/Linux/yakeCriticalSection.cpp trunk/yake/src/base/native/Linux/yakeDebug.cpp trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp trunk/yake/src/base/native/Linux/yakeTime.cpp trunk/yake/src/base/native/win32/yakeApplication.cpp trunk/yake/src/base/native/win32/yakeConfig.cpp trunk/yake/src/base/native/win32/yakeCriticalSection.cpp trunk/yake/src/base/native/win32/yakeDebug.cpp trunk/yake/src/base/native/win32/yakeNativeLibrary.cpp trunk/yake/src/base/native/win32/yakeProcessor.cpp trunk/yake/src/base/native/win32/yakeThreads.cpp trunk/yake/src/base/native/win32/yakeTime.cpp trunk/yake/src/base/templates/yakeSingleton.cpp trunk/yake/src/base/templates/yakeSmartAssert.cpp trunk/yake/src/base/templates/yakeSmartAssertHandlers.cpp trunk/yake/src/base/yake.cpp trunk/yake/src/base/yakeDataChunk.cpp trunk/yake/src/base/yakeException.cpp trunk/yake/src/base/yakeInputStream.cpp trunk/yake/src/base/yakeLibrary.cpp trunk/yake/src/base/yakeLog.cpp trunk/yake/src/base/yakeMimeTypeManager.cpp trunk/yake/src/base/yakeMovable.cpp trunk/yake/src/base/yakeOutputStream.cpp trunk/yake/src/base/yakePCH.cpp trunk/yake/src/base/yakeParamHolder.cpp trunk/yake/src/base/yakeString.cpp trunk/yake/src/base/yakeUniqueId.cpp trunk/yake/src/base/yakeUniqueName.cpp trunk/yake/src/bindings.lua/bindings.lua.cpp trunk/yake/src/bindings.lua/detail/base.lua.cpp trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/bindings.lua/detail/model.lua.cpp trunk/yake/src/bindings.lua/detail/task.lua.cpp trunk/yake/src/data/yakePCH.cpp trunk/yake/src/data/yakeXMLSerializer.cpp trunk/yake/src/ent/component.cpp trunk/yake/src/ent/component_holder.cpp trunk/yake/src/ent/entity.cpp trunk/yake/src/ent/object.cpp trunk/yake/src/ent/object_listener.cpp trunk/yake/src/ent/object_mgr.cpp trunk/yake/src/ent/object_mgr_listener.cpp trunk/yake/src/ent/pch.cpp trunk/yake/src/ent/vm_holder.cpp trunk/yake/src/graphics/yakeGraphicsSystem.cpp trunk/yake/src/graphics/yakePCH.cpp trunk/yake/src/gui/editor/edit_window_visitor.cpp trunk/yake/src/gui/editor/property_list_base.cpp trunk/yake/src/gui/gui_system_base.cpp trunk/yake/src/gui/lua/bind_gui_to_lua.cpp trunk/yake/src/gui/precompiled.cpp trunk/yake/src/gui/widgets/button_base.cpp trunk/yake/src/gui/widgets/multi_line_edit_box_base.cpp trunk/yake/src/gui/widgets/static_text_base.cpp trunk/yake/src/gui/window_base.cpp trunk/yake/src/input/yakeActionIds.cpp trunk/yake/src/input/yakeActionMap.cpp trunk/yake/src/input/yakeInput.cpp trunk/yake/src/input/yakeInputEventGenerator.cpp trunk/yake/src/input/yakeInputSystem.cpp trunk/yake/src/input/yakePCH.cpp trunk/yake/src/loader/pch.cpp trunk/yake/src/loader/yakeDotScene.cpp trunk/yake/src/loader/yakeXODEParser.cpp trunk/yake/src/model/pch.cpp trunk/yake/src/model/yakeComponentCreatorManager.cpp trunk/yake/src/model/yakeDotLinkLoader.cpp trunk/yake/src/model/yakeDotModelParser.cpp trunk/yake/src/model/yakeGraphical.cpp trunk/yake/src/model/yakeGraphicalCreator.cpp trunk/yake/src/model/yakeGraphicalDotSceneLoader.cpp trunk/yake/src/model/yakeLinkCreator.cpp trunk/yake/src/model/yakeModel.cpp trunk/yake/src/model/yakeModelComponent.cpp trunk/yake/src/model/yakeModelComponentContainer.cpp trunk/yake/src/model/yakeModelLink.cpp trunk/yake/src/model/yakeModelLinkContainer.cpp trunk/yake/src/model/yakeModelManager.cpp trunk/yake/src/model/yakeModelMovableLink.cpp trunk/yake/src/model/yakeModelTemplate.cpp trunk/yake/src/model/yakeModelTemplateManager.cpp trunk/yake/src/model/yakePhysical.cpp trunk/yake/src/model/yakePhysicalCreator.cpp trunk/yake/src/model/yakeXODEListener.cpp trunk/yake/src/net/detail/netCommon.cpp trunk/yake/src/net/detail/netDataChunk.cpp trunk/yake/src/net/detail/netEnetClientPacketConnection.cpp trunk/yake/src/net/detail/netEnetServerPacketConnection.cpp trunk/yake/src/net/detail/netEventConnection.cpp trunk/yake/src/net/detail/netInternal.cpp trunk/yake/src/net/detail/netPacket.cpp trunk/yake/src/net/net.cpp trunk/yake/src/net/pch.cpp trunk/yake/src/netrepsvc/netClientRepService.cpp trunk/yake/src/netrepsvc/netRepSvc.cpp trunk/yake/src/netrepsvc/netServerRepService.cpp trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp trunk/yake/src/netsvc/netService.cpp trunk/yake/src/netsvc/netServiceHost.cpp trunk/yake/src/netsvc/netSvc.cpp trunk/yake/src/netsvc/pch.cpp trunk/yake/src/netsvc/service/netClientCommService.cpp trunk/yake/src/netsvc/service/netClientTimeService.cpp trunk/yake/src/netsvc/service/netServerCommService.cpp trunk/yake/src/netsvc/service/netServerTimeService.cpp trunk/yake/src/physics/yakePCH.cpp trunk/yake/src/physics/yakePhysicsAffectorZone.cpp trunk/yake/src/physics/yakePhysicsAffectors.cpp trunk/yake/src/physics/yakePhysicsCommon.cpp trunk/yake/src/physics/yakePhysicsSystem.cpp trunk/yake/src/plugins/audioOpenAL/yakeAudioListenerOpenAL.cpp trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp trunk/yake/src/plugins/audioOpenAL/yakeAudioWorldOpenAL.cpp trunk/yake/src/plugins/audioOpenAL/yakePCH.cpp trunk/yake/src/plugins/baseLuaBindings/yakeLuaBinder.cpp trunk/yake/src/plugins/ceguiOgreRendererAdapter/pch.cpp trunk/yake/src/plugins/ceguiOgreRendererAdapter/plugin.cpp trunk/yake/src/plugins/graphicsLuaBindings/yakeLuaBinder.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreCamera.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreEntity.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreGeometryAccess.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreLight.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreParticleSystem.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreSkeleton.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreViewport.cpp trunk/yake/src/plugins/graphicsOgre/yakeGraphicsSystem.cpp trunk/yake/src/plugins/graphicsOgre/yakeGraphicsWorld.cpp trunk/yake/src/plugins/graphicsOgre/yakePCH.cpp trunk/yake/src/plugins/gui_cegui/editor/edit_widget.cpp trunk/yake/src/plugins/gui_cegui/editor/property_list.cpp trunk/yake/src/plugins/gui_cegui/precompiled.cpp trunk/yake/src/plugins/inputOgre/InputSystemOgre.cpp trunk/yake/src/plugins/inputOgre/yakePCH.cpp trunk/yake/src/plugins/physicsNX/NxPhysicsSystem.cpp trunk/yake/src/plugins/physicsNX/plugin.cpp trunk/yake/src/plugins/physicsNX/yakeActorNx.cpp trunk/yake/src/plugins/physicsNX/yakeAvatarNx.cpp trunk/yake/src/plugins/physicsNX/yakeBodyNx.cpp trunk/yake/src/plugins/physicsNX/yakeJointNx.cpp trunk/yake/src/plugins/physicsNX/yakeMaterialNx.cpp trunk/yake/src/plugins/physicsNX/yakePCH.cpp trunk/yake/src/plugins/physicsNX/yakePhysicsTrimeshNx.cpp trunk/yake/src/plugins/physicsNX/yakeShapeNx.cpp trunk/yake/src/plugins/physicsNX/yakeWorldNx.cpp trunk/yake/src/plugins/physicsODE/OdeActor.cpp trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp trunk/yake/src/plugins/physicsODE/OdeBallJoint.cpp trunk/yake/src/plugins/physicsODE/OdeBody.cpp trunk/yake/src/plugins/physicsODE/OdeFixedJoint.cpp trunk/yake/src/plugins/physicsODE/OdeHinge2Joint.cpp trunk/yake/src/plugins/physicsODE/OdeHingeJoint.cpp trunk/yake/src/plugins/physicsODE/OdeJoint.cpp trunk/yake/src/plugins/physicsODE/OdeMaterial.cpp trunk/yake/src/plugins/physicsODE/OdeRay.cpp trunk/yake/src/plugins/physicsODE/OdeShapes.cpp trunk/yake/src/plugins/physicsODE/OdeSliderJoint.cpp trunk/yake/src/plugins/physicsODE/OdeUniversalJoint.cpp trunk/yake/src/plugins/physicsODE/OdeWorld.cpp trunk/yake/src/plugins/physicsODE/PhysicsSystemODE.cpp trunk/yake/src/plugins/physicsODE/yakePCH.cpp trunk/yake/src/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.cpp trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp trunk/yake/src/plugins/scriptingLua/yakePCH.cpp trunk/yake/src/plugins/scriptingLuaBindings/pch.cpp trunk/yake/src/plugins/scriptingLuaBindings/yakeBinder.cpp trunk/yake/src/plugins/terrainPhysMgr/TerrainOdeActor.cpp trunk/yake/src/plugins/terrainPhysMgr/TerrainPhysicsManager.cpp trunk/yake/src/raf/pch.cpp trunk/yake/src/raf/yakeApplication.cpp trunk/yake/src/raf/yakeApplicationState.cpp trunk/yake/src/raf/yakeRaf.cpp trunk/yake/src/raf/yakeRtApplicationState.cpp trunk/yake/src/reflection/bind_lua/bind_lua.cpp trunk/yake/src/reflection/bind_lua/lua_handler_to_cpp.cpp trunk/yake/src/reflection/bind_lua/luabind_class_registration.cpp trunk/yake/src/reflection/bind_network/bind_network.cpp trunk/yake/src/reflection/events.cpp trunk/yake/src/reflection/main.cpp trunk/yake/src/reflection/reflection.cpp trunk/yake/src/scripting/yakeScriptingSystem.cpp trunk/yake/src/task/executor.cpp trunk/yake/src/task/task.cpp trunk/yake/src/thread/yakePCH.cpp trunk/yake/src/thread/yakeThread.cpp trunk/yake/src/vehicle/yakeDotVehicle.cpp trunk/yake/src/vehicle/yakeMountPoint.cpp trunk/yake/src/vehicle/yakeNativeOde.cpp trunk/yake/src/vehicle/yakeOdeEngine.cpp trunk/yake/src/vehicle/yakePCH.cpp trunk/yake/src/vehicle/yakeVehicle.cpp trunk/yake/src/vehicle/yakeVehicleModelComponent.cpp trunk/yake/src/vehicle/yakeVehicleModelComponentCreator.cpp trunk/yake/src/yappbase/event/yakeMessageId.cpp trunk/yake/src/yappbase/event/yakeMessageInstance.cpp trunk/yake/src/yappbase/event/yakeMessageManager.cpp trunk/yake/src/yappbase/event/yakeMessageQ.cpp trunk/yake/src/yappbase/yakeTask.cpp trunk/yake/src/yappbase/yapp.cpp trunk/yake/src/yappbase/yappPCH.cpp trunk/yake/src/yappmsg/yakeMessage.cpp trunk/yake/src/yappmsg/yakeMessageId.cpp trunk/yake/src/yappmsg/yakeMessageIdManager.cpp trunk/yake/src/yappmsg/yakeMessageManager.cpp trunk/yake/src/yappmsg/yakeMessageQ.cpp trunk/yake/src/yappmsg/yakeMsg.cpp trunk/yake/src/yappmsg/yakePCH.cpp trunk/yake/yake/audio/yakeAudible.h trunk/yake/yake/audio/yakeAudio.h trunk/yake/yake/audio/yakeAudioPrerequisites.h trunk/yake/yake/audio/yakeAudioSystem.h trunk/yake/yake/audio/yakePCH.h trunk/yake/yake/base/math/yakeAsmMath.h trunk/yake/yake/base/math/yakeAxisAlignedBox.h trunk/yake/yake/base/math/yakeColor.h trunk/yake/yake/base/math/yakeColor.inl trunk/yake/yake/base/math/yakeGeometry.h trunk/yake/yake/base/math/yakeInterpolator.h trunk/yake/yake/base/math/yakeMath.h trunk/yake/yake/base/math/yakeMatrix3.h trunk/yake/yake/base/math/yakeMatrix4.h trunk/yake/yake/base/math/yakeMersenneTwister.h trunk/yake/yake/base/math/yakePlane.h trunk/yake/yake/base/math/yakeQuaternion.h trunk/yake/yake/base/math/yakeRand.h trunk/yake/yake/base/math/yakeRay.h trunk/yake/yake/base/math/yakeSimpleSpline.h trunk/yake/yake/base/math/yakeVector3.h trunk/yake/yake/base/math/yakeVector4.h trunk/yake/yake/base/mpl/abstract_factory.h trunk/yake/yake/base/mpl/abstract_factory_pars.h trunk/yake/yake/base/mpl/compare_sequences.h trunk/yake/yake/base/mpl/dispatch_arbitrary_types.h trunk/yake/yake/base/mpl/get_type_or_null.h trunk/yake/yake/base/mpl/inherit_linear.h trunk/yake/yake/base/mpl/inherit_multiple.h trunk/yake/yake/base/mpl/lambda.h trunk/yake/yake/base/mpl/null_type.h trunk/yake/yake/base/mpl/sequences.h trunk/yake/yake/base/mpl/yakeAbstractFactory.h trunk/yake/yake/base/mpl/yakeAlgorithms.h trunk/yake/yake/base/mpl/yakeBuildArguments.h trunk/yake/yake/base/mpl/yakeBuildIteration.h trunk/yake/yake/base/mpl/yakeCast.h trunk/yake/yake/base/mpl/yakeCast.inl trunk/yake/yake/base/mpl/yakeFunctions.h trunk/yake/yake/base/mpl/yakeInheritLinear.h trunk/yake/yake/base/mpl/yakeInheritMultiple.h trunk/yake/yake/base/mpl/yakeLambda.h trunk/yake/yake/base/mpl/yakeSelect.h trunk/yake/yake/base/mpl/yakeStaticAssert.h trunk/yake/yake/base/mpl/yakeTraits.h trunk/yake/yake/base/native/win32/yakeConfig.h trunk/yake/yake/base/native/win32/yakeProcessor.h trunk/yake/yake/base/native/win32/yakeResource.h trunk/yake/yake/base/native/win32/yakeUndefine.h trunk/yake/yake/base/native/yakeNative.h trunk/yake/yake/base/native/yakeThreads.h trunk/yake/yake/base/prerequisites/yakePrerequisitesGCC.h trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC71Types.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC71Warnings.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC8Types.h trunk/yake/yake/base/prerequisites/yakePrerequisitesVC8Warnings.h trunk/yake/yake/base/prerequisites/yakeStringGCC.h trunk/yake/yake/base/prerequisites/yakeStringGCCWin.h trunk/yake/yake/base/prerequisites/yakeStringHashFun.h trunk/yake/yake/base/prerequisites/yakeStringVC71.h trunk/yake/yake/base/prerequisites/yakeStringVC8.h trunk/yake/yake/base/templates/delete.h trunk/yake/yake/base/templates/yakeAlgorithms.h trunk/yake/yake/base/templates/yakeAlgorithms.inl trunk/yake/yake/base/templates/yakeAssociator.h trunk/yake/yake/base/templates/yakeDeque.h trunk/yake/yake/base/templates/yakeFastMap.h trunk/yake/yake/base/templates/yakeFunction.h trunk/yake/yake/base/templates/yakeManager.h trunk/yake/yake/base/templates/yakeManager.inl trunk/yake/yake/base/templates/yakePointer.h trunk/yake/yake/base/templates/yakeRegistry.h trunk/yake/yake/base/templates/yakeSignals.h trunk/yake/yake/base/templates/yakeSingleton.cpp trunk/yake/yake/base/templates/yakeSingleton.h trunk/yake/yake/base/templates/yakeSmartAssert.h trunk/yake/yake/base/templates/yakeSmartAssertHandlers.h trunk/yake/yake/base/templates/yakeThreads.h trunk/yake/yake/base/templates/yakeVariant.h trunk/yake/yake/base/templates/yakeVector.h trunk/yake/yake/base/type_info.h trunk/yake/yake/base/yake.h trunk/yake/yake/base/yakeByteSwapInputStreamDecorator.h trunk/yake/yake/base/yakeByteSwapOutputStreamDecorator.h trunk/yake/yake/base/yakeConfigFile.h trunk/yake/yake/base/yakeDataChunk.h trunk/yake/yake/base/yakeDebugOutputStream.h trunk/yake/yake/base/yakeException.h trunk/yake/yake/base/yakeInputStream.h trunk/yake/yake/base/yakeInputStreamDecorator.h trunk/yake/yake/base/yakeLibrary.h trunk/yake/yake/base/yakeLog.h trunk/yake/yake/base/yakeMimeTypeManager.h trunk/yake/yake/base/yakeMovable.h trunk/yake/yake/base/yakeNoncopyable.h trunk/yake/yake/base/yakeOutputStream.h trunk/yake/yake/base/yakeOutputStreamDecorator.h trunk/yake/yake/base/yakePCH.h trunk/yake/yake/base/yakeParamHolder.h trunk/yake/yake/base/yakePlatform.h trunk/yake/yake/base/yakePlugin.h trunk/yake/yake/base/yakePrerequisites.h trunk/yake/yake/base/yakeProcessor.h trunk/yake/yake/base/yakeResource.h trunk/yake/yake/base/yakeString.h trunk/yake/yake/base/yakeTaggedListenerManager.h trunk/yake/yake/base/yakeTimer.h trunk/yake/yake/base/yakeUniqueId.h trunk/yake/yake/base/yakeUniqueName.h trunk/yake/yake/base/yakeVersion.h trunk/yake/yake/bindings.lua/bindings.lua.ent.h trunk/yake/yake/bindings.lua/bindings.lua.h trunk/yake/yake/bindings.lua/common/lua.helpers.cpp trunk/yake/yake/bindings.lua/common/lua.helpers.h trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp trunk/yake/yake/bindings.lua/common/vminfo.lua.h trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/common/yake.lua.common.h trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h trunk/yake/yake/bindings.lua/detail/private.h trunk/yake/yake/bindings.lua/prerequisites.h trunk/yake/yake/common/yakeCEGUIHelpers.h trunk/yake/yake/common/yakeCEGUIRendererAdapter.h trunk/yake/yake/common/yakeCameraControllers.h trunk/yake/yake/common/yakePawn.h trunk/yake/yake/common/yakePragmaAutoLink.h trunk/yake/yake/data/yakeData.h trunk/yake/yake/data/yakeDataPrerequisites.h trunk/yake/yake/data/yakeDataSerializer.h trunk/yake/yake/data/yakePCH.h trunk/yake/yake/data/yakeXMLSerializer.h trunk/yake/yake/ent/component.h trunk/yake/yake/ent/component_holder.h trunk/yake/yake/ent/ent.h trunk/yake/yake/ent/entity.h trunk/yake/yake/ent/object.h trunk/yake/yake/ent/object_listener.h trunk/yake/yake/ent/object_mgr.h trunk/yake/yake/ent/object_mgr_listener.h trunk/yake/yake/ent/pch.h trunk/yake/yake/ent/prerequisites.h trunk/yake/yake/ent/vm_holder.h trunk/yake/yake/file/common/src/exception.cpp trunk/yake/yake/file/common/src/path.cpp trunk/yake/yake/file/ftp_file_system/src/dll.cpp trunk/yake/yake/file/ftp_file_system/src/ftp_file.cpp trunk/yake/yake/file/ftp_file_system/src/ftp_file_system.cpp trunk/yake/yake/file/ftp_wrapper/src/ftp_client.cpp trunk/yake/yake/file/ftp_wrapper_test/ftp_wrapper_test.cpp trunk/yake/yake/file/native_file_system/src/dll.cpp trunk/yake/yake/file/native_file_system/src/native_file.cpp trunk/yake/yake/file/native_file_system/src/native_file_system.cpp trunk/yake/yake/file/nativefs/src/operations.cpp trunk/yake/yake/file/nativefs/src/root.cpp trunk/yake/yake/file/test/main.cpp trunk/yake/yake/file/test_io/src/test_io.cpp trunk/yake/yake/file/vfs_test/vfs_test.cpp trunk/yake/yake/file/virtual_file_system/src/dll.cpp trunk/yake/yake/file/virtual_file_system/src/virtual_archive.cpp trunk/yake/yake/file/virtual_file_system/src/virtual_file.cpp trunk/yake/yake/file/virtual_file_system/src/virtual_file_system.cpp trunk/yake/yake/file/virtualfs/inc/file.inl trunk/yake/yake/file/virtualfs/src/create_filebuf.cpp trunk/yake/yake/file/virtualfs/src/file_system.cpp trunk/yake/yake/file/virtualfs/src/filebuf.cpp trunk/yake/yake/file/virtualfs/src/ifstream.cpp trunk/yake/yake/file/virtualfs/src/operations.cpp trunk/yake/yake/file/virtualfs/src/resolve.cpp trunk/yake/yake/file/virtualfs/src/root.cpp trunk/yake/yake/graphics/yakeEntity.h trunk/yake/yake/graphics/yakeGeometryAccess.h trunk/yake/yake/graphics/yakeGraphicalWorld.h trunk/yake/yake/graphics/yakeGraphics.h trunk/yake/yake/graphics/yakeGraphicsEnvironment.h trunk/yake/yake/graphics/yakeGraphicsSystem.h trunk/yake/yake/graphics/yakePCH.h trunk/yake/yake/gui/config.h trunk/yake/yake/gui/container_control_base.h trunk/yake/yake/gui/control_base.h trunk/yake/yake/gui/default_window.h trunk/yake/yake/gui/editor/code_generator.h trunk/yake/yake/gui/editor/edit_widget.h trunk/yake/yake/gui/editor/edit_window_visitor.h trunk/yake/yake/gui/editor/property_list_base.h trunk/yake/yake/gui/editor/widget_editor.h trunk/yake/yake/gui/gui_system_base.h trunk/yake/yake/gui/lua/bind_gui_to_lua.h trunk/yake/yake/gui/point.h trunk/yake/yake/gui/precompiled.h trunk/yake/yake/gui/widgets/button_base.h trunk/yake/yake/gui/widgets/multi_line_edit_box_base.h trunk/yake/yake/gui/widgets/static_text_base.h trunk/yake/yake/gui/widgets.h trunk/yake/yake/gui/window_base.h trunk/yake/yake/gui_adapter/renderer_adapter_base.h trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIInputArea.h trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h trunk/yake/yake/gui_addons/console/yakeDefaultHistory.h trunk/yake/yake/gui_addons/console/yakeGenericConsole.h trunk/yake/yake/input/yakeActionMap.h trunk/yake/yake/input/yakeInput.h trunk/yake/yake/input/yakeInputEventGenerator.h trunk/yake/yake/input/yakeInputSystem.h trunk/yake/yake/input/yakePCH.h trunk/yake/yake/input/yakePrerequisites.h trunk/yake/yake/loader/loader.h trunk/yake/yake/loader/pch.h trunk/yake/yake/loader/prerequisites.h trunk/yake/yake/loader/yakeDotLinkLoader.h trunk/yake/yake/loader/yakeDotScene.h trunk/yake/yake/loader/yakeXODEParser.h trunk/yake/yake/model/model.h trunk/yake/yake/model/model_component.h trunk/yake/yake/model/model_dotmodel_parser.h trunk/yake/yake/model/model_graphical_dotscene_loader.h trunk/yake/yake/model/model_link.h trunk/yake/yake/model/model_link_dotlink_loader.h trunk/yake/yake/model/model_physical_xode_loader.h trunk/yake/yake/model/pch.h trunk/yake/yake/model/prerequisites.h trunk/yake/yake/msg/listener.h trunk/yake/yake/msg/listener_mgr.h trunk/yake/yake/msg/message.h trunk/yake/yake/msg/prerequisites.h trunk/yake/yake/msg/processors.h trunk/yake/yake/msg/router.h trunk/yake/yake/msg/yakeMessage.h trunk/yake/yake/net/detail/netEnetClientPacketConnection.h trunk/yake/yake/net/detail/netEnetServerPacketConnection.h trunk/yake/yake/net/detail/netEventConnection.h trunk/yake/yake/net/detail/netInternal.h trunk/yake/yake/net/net.h trunk/yake/yake/net/netBitstream.h trunk/yake/yake/net/netBitstream.inl trunk/yake/yake/net/netBitstreamAdapters.h trunk/yake/yake/net/netCommon.h trunk/yake/yake/net/netEvent.h trunk/yake/yake/net/netPacket.h trunk/yake/yake/net/netPrerequisites.h trunk/yake/yake/net/netTypes.h trunk/yake/yake/net/pch.h trunk/yake/yake/netrepsvc/netClientReplicationService.h trunk/yake/yake/netrepsvc/netEvents.h trunk/yake/yake/netrepsvc/netPrerequisites.h trunk/yake/yake/netrepsvc/netRepSvc.h trunk/yake/yake/netrepsvc/netServerReplicationService.h trunk/yake/yake/netsvc/detail/netPeerRttCalculator.h trunk/yake/yake/netsvc/netPrerequisites.h trunk/yake/yake/netsvc/netService.h trunk/yake/yake/netsvc/netServiceHost.h trunk/yake/yake/netsvc/netSvc.h trunk/yake/yake/netsvc/pch.h trunk/yake/yake/netsvc/service/netClientCommService.h trunk/yake/yake/netsvc/service/netClientTimeService.h trunk/yake/yake/netsvc/service/netCommServiceMessages.h trunk/yake/yake/netsvc/service/netServerCommService.h trunk/yake/yake/netsvc/service/netServerTimeService.h trunk/yake/yake/netsvc/service/netTimeServiceMessages.h trunk/yake/yake/object/ClassAndObjectIdManager.h trunk/yake/yake/object/ClassAndObjectIdManager.inl trunk/yake/yake/object/ObjectContainer.h trunk/yake/yake/object/ObjectId.h trunk/yake/yake/object/ObjectId.inl trunk/yake/yake/object/ObjectManager.h trunk/yake/yake/object/ObjectManager.inl trunk/yake/yake/object/common.h trunk/yake/yake/object/pch.h trunk/yake/yake/object/yakeObjects.h trunk/yake/yake/physics/yakeAffectorZone.h trunk/yake/yake/physics/yakePCH.h trunk/yake/yake/physics/yakePhysics.h trunk/yake/yake/physics/yakePhysicsActor.h trunk/yake/yake/physics/yakePhysicsAffectors.h trunk/yake/yake/physics/yakePhysicsAvatar.h trunk/yake/yake/physics/yakePhysicsBody.h trunk/yake/yake/physics/yakePhysicsBodyGroup.h trunk/yake/yake/physics/yakePhysicsCommon.h trunk/yake/yake/physics/yakePhysicsJoint.h trunk/yake/yake/physics/yakePhysicsMaterial.h trunk/yake/yake/physics/yakePhysicsMotors.h trunk/yake/yake/physics/yakePhysicsPrerequisites.h trunk/yake/yake/physics/yakePhysicsShape.h trunk/yake/yake/physics/yakePhysicsSystem.h trunk/yake/yake/physics/yakePhysicsWorld.h trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h trunk/yake/yake/plugins/audioOpenAL/yakePCH.h trunk/yake/yake/plugins/baseLuaBindings/yakeLuaBinder.h trunk/yake/yake/plugins/baseLuaBindings/yakePrerequisites.h trunk/yake/yake/plugins/ceguiOgreRendererAdapter/pch.h trunk/yake/yake/plugins/ceguiOgreRendererAdapter/plugin.h trunk/yake/yake/plugins/graphicsLuaBindings/yakeLuaBinder.h trunk/yake/yake/plugins/graphicsLuaBindings/yakePrerequisites.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCamera.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCore.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreEntity.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreGeometryAccess.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreLight.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreNode.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreParticleSystem.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreSkeleton.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreViewport.h trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsRegister.h trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsSystem.h trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsWorld.h trunk/yake/yake/plugins/graphicsOgre/yakePCH.h trunk/yake/yake/plugins/gui_cegui/config.h trunk/yake/yake/plugins/gui_cegui/controls.h trunk/yake/yake/plugins/gui_cegui/editor/edit_widget.h trunk/yake/yake/plugins/gui_cegui/editor/property_list.h trunk/yake/yake/plugins/gui_cegui/event_adaptor.h trunk/yake/yake/plugins/gui_cegui/gui_system.h trunk/yake/yake/plugins/gui_cegui/precompiled.h trunk/yake/yake/plugins/gui_cegui/util.h trunk/yake/yake/plugins/gui_cegui/widgets/button.h trunk/yake/yake/plugins/gui_cegui/widgets.h trunk/yake/yake/plugins/gui_cegui/window.h trunk/yake/yake/plugins/inputOgre/InputSystemOgre.h trunk/yake/yake/plugins/inputOgre/yakePCH.h trunk/yake/yake/plugins/physicsNX/NxPhysicsSystem.h trunk/yake/yake/plugins/physicsNX/plugin.h trunk/yake/yake/plugins/physicsNX/yakeActorNx.h trunk/yake/yake/plugins/physicsNX/yakeAvatarNx.h trunk/yake/yake/plugins/physicsNX/yakeBodyNx.h trunk/yake/yake/plugins/physicsNX/yakeJointNx.h trunk/yake/yake/plugins/physicsNX/yakeMaterialNx.h trunk/yake/yake/plugins/physicsNX/yakePCH.h trunk/yake/yake/plugins/physicsNX/yakePhysicsTrimeshNx.h trunk/yake/yake/plugins/physicsNX/yakeShapeNx.h trunk/yake/yake/plugins/physicsNX/yakeWorldNx.h trunk/yake/yake/plugins/physicsODE/OdeActor.h trunk/yake/yake/plugins/physicsODE/OdeAvatar.h trunk/yake/yake/plugins/physicsODE/OdeBody.h trunk/yake/yake/plugins/physicsODE/OdeJoint.h trunk/yake/yake/plugins/physicsODE/OdeMaterial.h trunk/yake/yake/plugins/physicsODE/OdeRay.h trunk/yake/yake/plugins/physicsODE/OdeShapes.h trunk/yake/yake/plugins/physicsODE/OdeWorld.h trunk/yake/yake/plugins/physicsODE/PhysicsSystemODE.h trunk/yake/yake/plugins/physicsODE/yakePCH.h trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h trunk/yake/yake/plugins/registryPluginConcrete/concrete.h trunk/yake/yake/plugins/registryPluginConcrete/register.h trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/register.h trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.h trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h trunk/yake/yake/plugins/scriptingLua/yakePCH.h trunk/yake/yake/plugins/scriptingLuaBindings/pch.h trunk/yake/yake/plugins/scriptingLuaBindings/yakeBinder.h trunk/yake/yake/prop/prerequisites.h trunk/yake/yake/prop/prop.h trunk/yake/yake/prop/prop_def.h trunk/yake/yake/prop/prop_holder.h trunk/yake/yake/prop/rtti_class.h trunk/yake/yake/prop/yakeProperty.h trunk/yake/yake/raf/pch.h trunk/yake/yake/raf/yakeApplication.h trunk/yake/yake/raf/yakeApplicationState.h trunk/yake/yake/raf/yakePrerequisites.h trunk/yake/yake/raf/yakeRaf.h trunk/yake/yake/raf/yakeRtApplicationState.h trunk/yake/yake/reflection/bind.h trunk/yake/yake/reflection/bind_lua/any_convertors.h trunk/yake/yake/reflection/bind_lua/bind_lua.h trunk/yake/yake/reflection/bind_lua/bind_to_lua.h trunk/yake/yake/reflection/bind_lua/do_string.h trunk/yake/yake/reflection/bind_lua/lua_handler_to_cpp.h trunk/yake/yake/reflection/bind_lua/luabind_class_registration.h trunk/yake/yake/reflection/bind_network/bind_network.h trunk/yake/yake/reflection/bind_serialization/bind_serialization.h trunk/yake/yake/reflection/callable.h trunk/yake/yake/reflection/class.h trunk/yake/yake/reflection/classregistry.h trunk/yake/yake/reflection/config.h trunk/yake/yake/reflection/event.h trunk/yake/yake/reflection/events.h trunk/yake/yake/reflection/exception.h trunk/yake/yake/reflection/field.h trunk/yake/yake/reflection/method.h trunk/yake/yake/reflection/object.h trunk/yake/yake/reflection/property.h trunk/yake/yake/reflection/reflection.h trunk/yake/yake/reflection/registered.h trunk/yake/yake/reflection/static_init.h trunk/yake/yake/reflection/staticfield.h trunk/yake/yake/reflection/staticmethod.h trunk/yake/yake/reflection/utility.h trunk/yake/yake/registryPluginInterface/interface.h trunk/yake/yake/samples/audio/demo1/pch.h trunk/yake/yake/samples/common/application.h trunk/yake/yake/samples/common/configs.h trunk/yake/yake/samples/common/ext_lib_man.h trunk/yake/yake/samples/common/init_gui.h trunk/yake/yake/samples/common/initialization.h trunk/yake/yake/samples/common/libraries.h trunk/yake/yake/samples/common/library_manager.h trunk/yake/yake/samples/common/load_libraries.h trunk/yake/yake/samples/common/yakeExampleApplication.h trunk/yake/yake/samples/graphics/pch.h trunk/yake/yake/samples/model/dotScene/pch.h trunk/yake/yake/samples/net/common/common.h trunk/yake/yake/samples/net/common/commonEvents.h trunk/yake/yake/samples/net/common/config.h trunk/yake/yake/samples/net/common/roCommon.h trunk/yake/yake/samples/net/packet/pch.h trunk/yake/yake/samples/net/roclient/ROClient.h trunk/yake/yake/samples/net/roclient/pch.h trunk/yake/yake/samples/net/roserver/ROServer.h trunk/yake/yake/samples/net/roserver/pch.h trunk/yake/yake/samples/physics/demo/pch.h trunk/yake/yake/samples/rx/basics/yakePCH.h trunk/yake/yake/scripting/yakeScriptingSystem.h trunk/yake/yake/statemachine/fsm_core.h trunk/yake/yake/statemachine/fsm_oo_machine.h trunk/yake/yake/task/prerequisites.h trunk/yake/yake/task/task.h trunk/yake/yake/thread/ZThreadMutexForwarder.h trunk/yake/yake/thread/ZThreadThreadForwarder.h trunk/yake/yake/thread/yakePCH.h trunk/yake/yake/thread/yakeThread.h trunk/yake/yake/thread/yakeThreadPrerequisites.h trunk/yake/yake/vehicle/yakeDotVehicle.h trunk/yake/yake/vehicle/yakeInterfaces.h trunk/yake/yake/vehicle/yakeMountPoint.h trunk/yake/yake/vehicle/yakeNativeOde.h trunk/yake/yake/vehicle/yakePCH.h trunk/yake/yake/vehicle/yakePrerequisites.h trunk/yake/yake/vehicle/yakeTemplates.h trunk/yake/yake/vehicle/yakeVehicle.h trunk/yake/yake/vehicle/yakeVehicleModelComponent.h trunk/yake/yake/vehicle/yakeVehicleSystem.h trunk/yake/yake/yappbase/event/yakeEvent.h trunk/yake/yake/yappbase/event/yakeMessageId.h trunk/yake/yake/yappbase/event/yakeMessageInstance.h trunk/yake/yake/yappbase/event/yakeMessageListener.h trunk/yake/yake/yappbase/event/yakeMessageManager.h trunk/yake/yake/yappbase/event/yakeMessageQ.h trunk/yake/yake/yappbase/yakeTask.h trunk/yake/yake/yappbase/yapp.h trunk/yake/yake/yappbase/yappPCH.h trunk/yake/yake/yappbase/yappPrerequisites.h trunk/yake/yake/yappmsg/yakeCommon.h trunk/yake/yake/yappmsg/yakeCommonIds.h trunk/yake/yake/yappmsg/yakeMessage.h trunk/yake/yake/yappmsg/yakeMessageHandler.h trunk/yake/yake/yappmsg/yakeMessageId.h trunk/yake/yake/yappmsg/yakeMessageIdManager.h trunk/yake/yake/yappmsg/yakeMessageManager.h trunk/yake/yake/yappmsg/yakeMessageQ.h trunk/yake/yake/yappmsg/yakeMsg.h trunk/yake/yake/yappmsg/yakePCH.h Property Changed: ---------------- trunk/yake/common/bin/debug/rodemo.cfg trunk/yake/common/bin/debug/rodemo_client.cfg trunk/yake/common/bin/debug/rodemo_server.cfg trunk/yake/common/bin/debug/rodemo_serverclient.cfg trunk/yake/common/bin/release/rodemo.cfg trunk/yake/common/bin/release/rodemo_client.cfg trunk/yake/common/bin/release/rodemo_server.cfg trunk/yake/common/bin/release/rodemo_serverclient.cfg trunk/yake/common/media/gui/layouts/GUILayout.xsd trunk/yake/common/media/gui/layouts/VanillaConsole.layout trunk/yake/common/media/samples/character/demo.actionmap.txt trunk/yake/common/media/samples/net/server_defaults.txt trunk/yake/common/media/samples/net/server_user.txt trunk/yake/common/media/vehicles/demo.actionmap.txt trunk/yake/documentation/manual/yake-manual-license.txt trunk/yake/documentation/manual/yake-manual.css trunk/yake/documentation/manual/yake-manual.txt trunk/yake/samples/bin/debug/commclient.cfg trunk/yake/samples/bin/debug/commserver.cfg trunk/yake/samples/bin/debug/roclient.cfg trunk/yake/samples/bin/debug/rodemo.cfg trunk/yake/samples/bin/debug/roserver.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg trunk/yake/samples/net/commclient/demo.cpp trunk/yake/samples/net/commserver/demo.cpp trunk/yake/samples/net/inprocess/common.h trunk/yake/samples/net/inprocess/demo.cpp trunk/yake/samples/net/roclient/ROClient.h trunk/yake/samples/net/roserver/ROServer.h trunk/yake/samples/sampleLog/demo.cpp trunk/yake/samples/vehicle/yakeDemo.cpp trunk/yake/samples/vehicle/yakePCH.cpp trunk/yake/samples/vehicle/yakePCH.h trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/plugins.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua trunk/yake/src/base/math/yakeRand.cpp trunk/yake/src/base/native/win32/yakeThreads.cpp trunk/yake/src/base/templates/yakeSmartAssertHandlers.cpp trunk/yake/src/base/yake.cpp trunk/yake/src/bindings.lua/bindings.lua.cpp trunk/yake/src/bindings.lua/detail/base.lua.cpp trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/bindings.lua/detail/model.lua.cpp trunk/yake/src/bindings.lua/detail/task.lua.cpp trunk/yake/src/net/detail/netDataChunk.cpp trunk/yake/src/net/detail/netPacket.cpp trunk/yake/src/netrepsvc/netClientRepService.cpp trunk/yake/src/netrepsvc/netRepSvc.cpp trunk/yake/src/netrepsvc/netServerRepService.cpp trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp trunk/yake/src/netsvc/netService.cpp trunk/yake/src/netsvc/netServiceHost.cpp trunk/yake/src/netsvc/netSvc.cpp trunk/yake/src/netsvc/pch.cpp trunk/yake/src/netsvc/service/netClientCommService.cpp trunk/yake/src/netsvc/service/netClientTimeService.cpp trunk/yake/src/netsvc/service/netServerCommService.cpp trunk/yake/src/netsvc/service/netServerTimeService.cpp trunk/yake/src/task/executor.cpp trunk/yake/src/task/task.cpp trunk/yake/yake/base/math/yakeMersenneTwister.h trunk/yake/yake/base/native/yakeThreads.h trunk/yake/yake/base/templates/yakeFunction.h trunk/yake/yake/base/templates/yakeSmartAssertHandlers.h trunk/yake/yake/base/yakeNoncopyable.h trunk/yake/yake/base/yakePrerequisites.h trunk/yake/yake/bindings.lua/bindings.lua.ent.h trunk/yake/yake/bindings.lua/bindings.lua.h trunk/yake/yake/bindings.lua/common/lua.helpers.cpp trunk/yake/yake/bindings.lua/common/lua.helpers.h trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp trunk/yake/yake/bindings.lua/common/vminfo.lua.h trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.cpp trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/common/yake.lua.common.h trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h trunk/yake/yake/bindings.lua/detail/private.h trunk/yake/yake/bindings.lua/prerequisites.h trunk/yake/yake/msg/listener_mgr.h trunk/yake/yake/msg/message.h trunk/yake/yake/msg/router.h trunk/yake/yake/netrepsvc/netClientReplicationService.h trunk/yake/yake/netrepsvc/netEvents.h trunk/yake/yake/netrepsvc/netPrerequisites.h trunk/yake/yake/netrepsvc/netRepSvc.h trunk/yake/yake/netrepsvc/netServerReplicationService.h trunk/yake/yake/netsvc/detail/netPeerRttCalculator.h trunk/yake/yake/netsvc/netPrerequisites.h trunk/yake/yake/netsvc/netService.h trunk/yake/yake/netsvc/netServiceHost.h trunk/yake/yake/netsvc/netSvc.h trunk/yake/yake/netsvc/pch.h trunk/yake/yake/netsvc/service/netClientCommService.h trunk/yake/yake/netsvc/service/netClientTimeService.h trunk/yake/yake/netsvc/service/netCommServiceMessages.h trunk/yake/yake/netsvc/service/netServerCommService.h trunk/yake/yake/netsvc/service/netServerTimeService.h trunk/yake/yake/netsvc/service/netTimeServiceMessages.h trunk/yake/yake/samples/net/common/roCommon.h trunk/yake/yake/task/prerequisites.h trunk/yake/yake/task/task.h Modified: trunk/yake/common/bin/debug/rodemo.cfg =================================================================== --- trunk/yake/common/bin/debug/rodemo.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/debug/rodemo.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,12 +1,12 @@ -rodemo -{ - server - { - start 1 - bind 192.168.1.33:40000 - } - client - { - count 0 - } -} +rodemo +{ + server + { + start 1 + bind 192.168.1.33:40000 + } + client + { + count 0 + } +} Property changes on: trunk/yake/common/bin/debug/rodemo.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/debug/rodemo_client.cfg =================================================================== --- trunk/yake/common/bin/debug/rodemo_client.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/debug/rodemo_client.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,12 +1,12 @@ -rodemo -{ - server - { - start 0 - } - client - { - server 192.168.1.33:40000 - count 1 - } -} +rodemo +{ + server + { + start 0 + } + client + { + server 192.168.1.33:40000 + count 1 + } +} Property changes on: trunk/yake/common/bin/debug/rodemo_client.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/debug/rodemo_server.cfg =================================================================== --- trunk/yake/common/bin/debug/rodemo_server.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/debug/rodemo_server.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,12 +1,12 @@ -rodemo -{ - server - { - start 1 - bind 192.168.1.234:40000 - } - client - { - count 0 - } -} +rodemo +{ + server + { + start 1 + bind 192.168.1.234:40000 + } + client + { + count 0 + } +} Property changes on: trunk/yake/common/bin/debug/rodemo_server.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/debug/rodemo_serverclient.cfg =================================================================== --- trunk/yake/common/bin/debug/rodemo_serverclient.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/debug/rodemo_serverclient.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -rodemo -{ - server - { - start 1 - } - client - { - count 1 - } -} +rodemo +{ + server + { + start 1 + } + client + { + count 1 + } +} Property changes on: trunk/yake/common/bin/debug/rodemo_serverclient.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/release/rodemo.cfg =================================================================== --- trunk/yake/common/bin/release/rodemo.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/release/rodemo.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -rodemo -{ - server - { - start 1 - } - client - { - count 0 - } -} +rodemo +{ + server + { + start 1 + } + client + { + count 0 + } +} Property changes on: trunk/yake/common/bin/release/rodemo.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/release/rodemo_client.cfg =================================================================== --- trunk/yake/common/bin/release/rodemo_client.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/release/rodemo_client.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -rodemo -{ - server - { - start 0 - } - client - { - count 1 - } -} +rodemo +{ + server + { + start 0 + } + client + { + count 1 + } +} Property changes on: trunk/yake/common/bin/release/rodemo_client.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/release/rodemo_server.cfg =================================================================== --- trunk/yake/common/bin/release/rodemo_server.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/release/rodemo_server.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -rodemo -{ - server - { - start 1 - } - client - { - count 0 - } -} +rodemo +{ + server + { + start 1 + } + client + { + count 0 + } +} Property changes on: trunk/yake/common/bin/release/rodemo_server.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/bin/release/rodemo_serverclient.cfg =================================================================== --- trunk/yake/common/bin/release/rodemo_serverclient.cfg 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/bin/release/rodemo_serverclient.cfg 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -rodemo -{ - server - { - start 1 - } - client - { - count 1 - } -} +rodemo +{ + server + { + start 1 + } + client + { + count 1 + } +} Property changes on: trunk/yake/common/bin/release/rodemo_serverclient.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/gui/layouts/GUILayout.xsd =================================================================== --- trunk/yake/common/media/gui/layouts/GUILayout.xsd 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/gui/layouts/GUILayout.xsd 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,63 +1,63 @@ -<?xml version="1.0"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> - - <xsd:element name="GUILayout" type="GUILayoutType"/> - - <xsd:complexType name="GUILayoutType"> - <xsd:sequence> - <xsd:element name="Window" type="WindowType" /> - </xsd:sequence> - <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/> - </xsd:complexType> - - <xsd:complexType name="WindowType"> - <xsd:sequence> - <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element name="Window" type="WindowType" /> - <xsd:element name="AutoWindow" type="AutoWindowType" /> - </xsd:choice> - <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> - </xsd:sequence> - <xsd:attribute name="Type" type="xsd:string" use="required"/> - <xsd:attribute name="Name" type="xsd:string" use="optional" default="" /> - </xsd:complexType> - - <xsd:complexType name="AutoWindowType"> - <xsd:sequence> - <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> - <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element name="Window" type="WindowType" /> - <xsd:element name="AutoWindow" type="AutoWindowType" /> - </xsd:choice> - <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> - </xsd:sequence> - <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/> - </xsd:complexType> - - <xsd:complexType name="PropertyType"> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="Name" type="xsd:string" use="required"/> - <xsd:attribute name="Value" type="xsd:string" use="optional"/> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - - <xsd:complexType name="LayoutImportType"> - <xsd:attribute name="Filename" type="xsd:string" use="required"/> - <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" /> - <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" /> - </xsd:complexType> - - <xsd:complexType name="EventType"> - <xsd:attribute name="Name" type="xsd:string" use="required"/> - <xsd:attribute name="Function" type="xsd:string" use="required"/> - </xsd:complexType> - -</xsd:schema> - +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + + <xsd:element name="GUILayout" type="GUILayoutType"/> + + <xsd:complexType name="GUILayoutType"> + <xsd:sequence> + <xsd:element name="Window" type="WindowType" /> + </xsd:sequence> + <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/> + </xsd:complexType> + + <xsd:complexType name="WindowType"> + <xsd:sequence> + <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Window" type="WindowType" /> + <xsd:element name="AutoWindow" type="AutoWindowType" /> + </xsd:choice> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="Type" type="xsd:string" use="required"/> + <xsd:attribute name="Name" type="xsd:string" use="optional" default="" /> + </xsd:complexType> + + <xsd:complexType name="AutoWindowType"> + <xsd:sequence> + <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Window" type="WindowType" /> + <xsd:element name="AutoWindow" type="AutoWindowType" /> + </xsd:choice> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/> + </xsd:complexType> + + <xsd:complexType name="PropertyType"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + <xsd:attribute name="Value" type="xsd:string" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <xsd:complexType name="LayoutImportType"> + <xsd:attribute name="Filename" type="xsd:string" use="required"/> + <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" /> + <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" /> + </xsd:complexType> + + <xsd:complexType name="EventType"> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + <xsd:attribute name="Function" type="xsd:string" use="required"/> + </xsd:complexType> + +</xsd:schema> + Property changes on: trunk/yake/common/media/gui/layouts/GUILayout.xsd ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/gui/layouts/VanillaConsole.layout =================================================================== --- trunk/yake/common/media/gui/layouts/VanillaConsole.layout 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/gui/layouts/VanillaConsole.layout 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,29 +1,29 @@ -<?xml version="1.0" ?> -<GUILayout> - <Window Type="Vanilla/FrameWindow" Name="/Console"> - <Property Name="AlwaysOnTop" Value="True" /> - <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" /> - <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" /> - <Property Name="UnifiedPosition" Value="{{0.5,0},{0.5,0}}" /> - <Property Name="UnifiedSize" Value="{{0.5,0},{0.45,0}}" /> - <Property Name="Text" Value="Console" /> - <Property Name="CloseButtonEnabled" Value="False" /> - - <Window Type="Vanilla/Editbox" Name="/Console/Wnd/Edit"> - <Property Name="ID" Value="2" /> - <Property Name="VerticalAlignment" Value="Bottom" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" /> - <Property Name="UnifiedSize" Value="{{1,-21},{0,30}}" /> - <Property Name="Text" Value="" /> - </Window> - - <Window Type="Vanilla/Listbox" Name="/Console/Wnd/History"> - <Property Name="ID" Value="3" /> - <Property Name="ReadOnly" Value="True" /> - <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> - <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" /> - <Property Name="UnifiedSize" Value="{{1,-14},{1,-75}}" /> - </Window> - </Window> -</GUILayout> +<?xml version="1.0" ?> +<GUILayout> + <Window Type="Vanilla/FrameWindow" Name="/Console"> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" /> + <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" /> + <Property Name="UnifiedPosition" Value="{{0.5,0},{0.5,0}}" /> + <Property Name="UnifiedSize" Value="{{0.5,0},{0.45,0}}" /> + <Property Name="Text" Value="Console" /> + <Property Name="CloseButtonEnabled" Value="False" /> + + <Window Type="Vanilla/Editbox" Name="/Console/Wnd/Edit"> + <Property Name="ID" Value="2" /> + <Property Name="VerticalAlignment" Value="Bottom" /> + <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> + <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" /> + <Property Name="UnifiedSize" Value="{{1,-21},{0,30}}" /> + <Property Name="Text" Value="" /> + </Window> + + <Window Type="Vanilla/Listbox" Name="/Console/Wnd/History"> + <Property Name="ID" Value="3" /> + <Property Name="ReadOnly" Value="True" /> + <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> + <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" /> + <Property Name="UnifiedSize" Value="{{1,-14},{1,-75}}" /> + </Window> + </Window> +</GUILayout> Property changes on: trunk/yake/common/media/gui/layouts/VanillaConsole.layout ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/samples/character/demo.actionmap.txt =================================================================== --- trunk/yake/common/media/samples/character/demo.actionmap.txt 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/samples/character/demo.actionmap.txt 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,11 +1,11 @@ -#pause=key_p,pressed -left=key_a,continuous -right=key_d,continuous -forward=key_w,continuous -reverse=key_s,continuous -up=key_space,pressed -down=key_c,pressed -up=key_pgup,continuous -down=key_pgdown,continuous -rotate_left=key_q,continuous -rotate_right=key_e,continuous +#pause=key_p,pressed +left=key_a,continuous +right=key_d,continuous +forward=key_w,continuous +reverse=key_s,continuous +up=key_space,pressed +down=key_c,pressed +up=key_pgup,continuous +down=key_pgdown,continuous +rotate_left=key_q,continuous +rotate_right=key_e,continuous Property changes on: trunk/yake/common/media/samples/character/demo.actionmap.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/samples/net/server_defaults.txt =================================================================== --- trunk/yake/common/media/samples/net/server_defaults.txt 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/samples/net/server_defaults.txt 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,8 +1,8 @@ -net -{ - server - { - bindport 4000 - max_clients 16 - } -} +net +{ + server + { + bindport 4000 + max_clients 16 + } +} Property changes on: trunk/yake/common/media/samples/net/server_defaults.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/samples/net/server_user.txt =================================================================== --- trunk/yake/common/media/samples/net/server_user.txt 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/samples/net/server_user.txt 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,29 +1,29 @@ -net -{ - server - { - //bindport 4000 - //max_clients 120 //tested - comm - { - channels - { - lobby - { - autocreate 1 - motd "Welcome to the NEW Lobby!\nNB This channel is unmonitored!" - } - mods - { - autocreate 1 - motd "Welcome to the moderator hangout!" - } - barter - { - autocreate 1 - motd "Buy & sell. What goods ya have, what goods ya need, matey?" - } - } - } - } -} +net +{ + server + { + //bindport 4000 + //max_clients 120 //tested + comm + { + channels + { + lobby + { + autocreate 1 + motd "Welcome to the NEW Lobby!\nNB This channel is unmonitored!" + } + mods + { + autocreate 1 + motd "Welcome to the moderator hangout!" + } + barter + { + autocreate 1 + motd "Buy & sell. What goods ya have, what goods ya need, matey?" + } + } + } + } +} Property changes on: trunk/yake/common/media/samples/net/server_user.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/common/media/vehicles/demo.actionmap.txt =================================================================== --- trunk/yake/common/media/vehicles/demo.actionmap.txt 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/common/media/vehicles/demo.actionmap.txt 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,9 +1,9 @@ -#pause=key_p,pressed -left=key_comma,continuous -right=key_period,continuous -strafe_left=key_left,continuous -strafe_right=key_right,continuous -forward=key_up,continuous -reverse=key_down,continuous -up=key_pgup,continuous -down=key_pgdown,continuous +#pause=key_p,pressed +left=key_comma,continuous +right=key_period,continuous +strafe_left=key_left,continuous +strafe_right=key_right,continuous +forward=key_up,continuous +reverse=key_down,continuous +up=key_pgup,continuous +down=key_pgdown,continuous Property changes on: trunk/yake/common/media/vehicles/demo.actionmap.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/yake/documentation/manual/yake-manual-license.txt =================================================================== --- trunk/yake/documentation/manual/yake-manual-license.txt 2007-03-14 08:04:51 UTC (rev 1641) +++ trunk/yake/documentation/manual/yake-manual-license.txt 2007-03-15 14:28:16 UTC (rev 1642) @@ -1,19 +1,19 @@ -This manual is licensed under the: - Attribution-NonCommercial-ShareAlike 2.0 Germany License... [truncated message content] |
From: <psy...@us...> - 2007-03-15 17:29:54
|
Revision: 1645 http://svn.sourceforge.net/yake/?rev=1645&view=rev Author: psyclonist Date: 2007-03-15 10:29:50 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added two demos (task/demo1 and task/lua1), claned up Lua bindings, added LuaThread, made scripting system uses smart pointers Modified Paths: -------------- trunk/yake/samples/README.TXT trunk/yake/scripts/premake/samples.lua trunk/yake/src/bindings.lua/detail/base.lua.cpp trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/bindings.lua/detail/model.lua.cpp trunk/yake/src/bindings.lua/detail/task.lua.cpp trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp trunk/yake/yake/base/yakePlugin.h trunk/yake/yake/bindings.lua/bindings.lua.h trunk/yake/yake/bindings.lua/common/lua.helpers.cpp trunk/yake/yake/bindings.lua/common/lua.helpers.h trunk/yake/yake/bindings.lua/common/vminfo.lua.h trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/common/yake.lua.common.h trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h trunk/yake/yake/bindings.lua/detail/private.h trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h trunk/yake/yake/scripting/yakeScriptingSystem.h Added Paths: ----------- trunk/yake/common/media/samples/task/ trunk/yake/common/media/samples/task/demo.lua trunk/yake/common/media/samples/task/events.lua trunk/yake/samples/task/ trunk/yake/samples/task/demo1/ trunk/yake/samples/task/demo1/demo.cpp trunk/yake/samples/task/lua1/ trunk/yake/samples/task/lua1/demo.cpp Added: trunk/yake/common/media/samples/task/demo.lua =================================================================== --- trunk/yake/common/media/samples/task/demo.lua (rev 0) +++ trunk/yake/common/media/samples/task/demo.lua 2007-03-15 17:29:50 UTC (rev 1645) @@ -0,0 +1,43 @@ +-- event callbacks/handlers +function onTick() + print("onTick() (time=" .. sched:time() .. ")") +end + +function test() + print("test: cancel task " .. " (current time: " .. sched:time() .. ")") + + -- schedule function to be called after 3 time steps: + sched:add(onTick,3) + + -- schedule anonymous function to be called after 3 time steps: + sched:add( + function() + print("hello from anonymous! (time=" .. sched:time() .. ")") + end, + 3) + + -- schedule task and cancel it before it can be executed + t = sched:add(onTick,3) + t:cancel() + + wait(4) --wait until tasks at time 3 have been executed... + + print("test done (time=" .. sched:time() ..")") + assert( sched:time() == 4 ) +end + +function test2() + --local waypoints = {"work", "the bar", "home"}; + local waypoints = {"work", "the bar"}; + + print("note: waiting 2 time steps between waypoints") + for i,next in pairs(waypoints) do + print(sched:time() .. " waypoint " .. tostring(i) .. ": going to " .. next) + wait(2) -- could be: walkTo(next) + + assert(i*2 == sched:time()) + end + print(tostring(sched:time()) .. " lua: staying some more...") + wait(1) + print(tostring(sched:time()) .. " lua: i'm dead :( no more waypoints") +end Added: trunk/yake/common/media/samples/task/events.lua =================================================================== --- trunk/yake/common/media/samples/task/events.lua (rev 0) +++ trunk/yake/common/media/samples/task/events.lua 2007-03-15 17:29:50 UTC (rev 1645) @@ -0,0 +1,26 @@ +-- boiler plate code: +print("lua: init task adapter code...") + +--@todo move this code out into 'entity.bind.lua' +function events(id) -- alias for: self:get(id) + if not id then + return self:events() + else + return self:events():get(id) + end +end + +function wait(delay) + if not delay then + return nil + end + schedule_revive(sched, delay, function() end) + print("lua: wait.yield...") + coroutine.yield() +end +task = { + add = function(fn,delayMs) + return sched:add(fn,delayMs) + end +} +print("lua: task adapter code initialised") \ No newline at end of file Modified: trunk/yake/samples/README.TXT =================================================================== --- trunk/yake/samples/README.TXT 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/samples/README.TXT 2007-03-15 17:29:50 UTC (rev 1645) @@ -12,8 +12,10 @@ raf/demo1 - initialisation of graphics and creation of a very basic scene ent/sampleEntFsm - entity scripting physics/demo - basic physics demo (multiple viewports, simplistic objects) -vehicle - different vehicles can be controlled (car,jet, uses RAF, entities and models) +vehicle - different vehicles can be controlled (car,jet). uses RAF, entities and models. base/scripting/lua - basic scripting demo +task/demo1 - basic task/executor demo +task/lua1 - Lua task/execution demo ---- in flux: (i.e. in process of being added to the main build scripts) Added: trunk/yake/samples/task/demo1/demo.cpp =================================================================== --- trunk/yake/samples/task/demo1/demo.cpp (rev 0) +++ trunk/yake/samples/task/demo1/demo.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -0,0 +1,34 @@ +#include <yake/task/task.h> +#include <boost/bind.hpp> + +void print(yake::task::executor_ptr exec, size_t t) +{ + std::cout << "running job (scheduled for t=" << t << ")\n"; + assert( exec->time() == t ); + + if (t == 3) // schedule a job at time 3 from within an executed task: + { + // schedule job to run at time=7: + size_t delay = 4; + exec->add( boost::bind(&print,exec,exec->time()+delay), delay ); + } +} + +void main() +{ + using namespace yake; + + task::executor_ptr exec( new task::executor() ); + + // schedule tasks + exec->add( boost::bind(&print,exec,2), 2 ); + exec->add( boost::bind(&print,exec,3), 3 ); + exec->add( boost::bind(&print,exec,5), 5 ); + + task::task_ptr t1 = exec->add( boost::bind(&print,exec,1), 1 ); + t1->cancel(); // cancel the task scheduled to run at time '1' + + // run executor + for (size_t t=0; t<10; ++t) + exec->update(1); +} Added: trunk/yake/samples/task/lua1/demo.cpp =================================================================== --- trunk/yake/samples/task/lua1/demo.cpp (rev 0) +++ trunk/yake/samples/task/lua1/demo.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -0,0 +1,59 @@ +#include <yake/task/task.h> +#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> +#include <yake/bindings.lua/bindings.lua.h> +#include <luabind/luabind.hpp> + +#pragma comment(lib,"luabindd.lib") +#pragma comment(lib,"luad.lib") +#pragma comment(lib,"yake_bindings.lua_d.lib") +#pragma comment(lib,"yake_scriptingLua_d.lib") + +void main() +{ + using namespace yake; + + try { + // init scripting VM + typedef scripting::ScriptingSystemLua scripting_t; + scripting_t scriptingSys; + + scripting::VMPtr vm( scriptingSys.createVM() ); + assert( vm ); + lua_State* L = static_cast<scripting::LuaVM*>(vm.get())->getLuaState(); + assert( L ); + + bind_base( L ); + bind_task( vm.get() ); + + // create task executor + task::executor_ptr exec( new task::executor() ); + + // store reference in VM + luabind::globals(L)["sched"] = exec; + + // run Lua script + scripting::ScriptPtr setupScript( scriptingSys.createScriptFromFile("../../../common/media/samples/task/events.lua") ); + scripting::ScriptPtr demoScript( scriptingSys.createScriptFromFile("../../../common/media/samples/task/demo.lua") ); + vm->execute( setupScript ); + vm->execute( demoScript ); + + // start Lua test function: + scripting::LuaThread t1(L); + { + lua_State* threadL = t1.interpreter(); + luabind::object fun = luabind::globals(threadL)["test"]; + luabind::resume_function<void>(fun); + } + + // run executor (which triggers Lua callbacks) + for (size_t t=0; t<10; ++t) + exec->update(1); + + // clean up + vm.reset(); + } + catch (Exception& ex) + { + std::cerr << "Exception: " << ex.what() << "\n"; + } +} Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/scripts/premake/samples.lua 2007-03-15 17:29:50 UTC (rev 1645) @@ -125,3 +125,17 @@ useComponent("base") useComponent("scripting") useComponent("bindings.lua") + +-------------------------------------- +makeSample("sampleTask1","samples/task/demo1") +useComponent("base") +useComponent("task") + +-------------------------------------- +if LUA_BINDINGS then + makeSample("sampleTaskLua1","samples/task/lua1") + useComponent("base") + useComponent("task") + useComponent("scripting") + useComponent("bindings.lua") +end Modified: trunk/yake/src/bindings.lua/detail/base.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -29,6 +29,8 @@ #include <yake/base/yake.h> +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + #include <yake/bindings.lua/detail/private.h> #include <yake/bindings.lua/common/lua.helpers.h> #include <yake/bindings.lua/common/vminfo.lua.h> @@ -274,11 +276,23 @@ YAKE_ASSERT( L ); base::bind(L); } + void bind_base(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_base(luavm->getLuaState()); + } void bind_math(lua_State* L) { YAKE_ASSERT( L ); math::bind(L); } + void bind_math(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_math(luavm->getLuaState()); + } } // namespace yake #endif // YAKE_ENABLE_LUA_BASE Modified: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -24,36 +24,17 @@ source code distribution. ------------------------------------------------------------------------------------ */ -/**------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright 2004 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ -*/ #include <yake/config.h> #if YAKE_ENABLE_LUA_ENT == 1 +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + #include <yake/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/bindings.lua.ent.h> #include <yake/bindings.lua/common/yake.lua.shared_ptr.h> #include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/bindings.lua.h> namespace yake { namespace ent { @@ -156,7 +137,7 @@ LuaFsmObjectListener::LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem) : scriptingSystem_(scriptingSystem) { - startScript_.reset( scriptingSystem_.createScriptFromFile("../../common/media/scripts/o_fsm_test.lua") ); + startScript_ = scriptingSystem_.createScriptFromFile("../../common/media/scripts/o_fsm_test.lua"); YAKE_ASSERT( startScript_.get() ); } void LuaFsmObjectListener::onInit(Object& obj) @@ -166,7 +147,7 @@ { YAKE_ASSERT( ent->getFsmVM() ); ent->getFsmVM()->execute("print('initializing...')"); - ent->getFsmVM()->execute( startScript_.get() ); + ent->getFsmVM()->execute( startScript_ ); ent->getFsmVM()->execute("c = coroutine.create(main)\ncoroutine.resume(c,1)"); } @@ -232,5 +213,11 @@ YAKE_ASSERT(L); ent::bind(L); } + void bind_ent(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_ent(luavm->getLuaState()); + } } // namespace yake #endif // YAKE_ENABLE_LUA_ENT Modified: trunk/yake/src/bindings.lua/detail/model.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -24,29 +24,11 @@ source code distribution. ------------------------------------------------------------------------------------ */ -/**------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright 2004 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ -*/ #include <yake/config.h> #if YAKE_ENABLE_LUA_MODEL == 1 +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/model/model.h> @@ -114,5 +96,11 @@ YAKE_ASSERT(L); model::bind(L); } + void bind_model(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_model(luavm->getLuaState()); + } } // namespace yake #endif // YAKE_ENABLE_LUA_MODEL Modified: trunk/yake/src/bindings.lua/detail/task.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/task.lua.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/src/bindings.lua/detail/task.lua.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -27,6 +27,8 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_TASK == 1 +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + #include <yake/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/detail/private.h> @@ -43,8 +45,8 @@ namespace detail { void lua_revive(lua_State* L) { - std::cout << "resuming..." << std::hex << L << "\n"; - std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; + //std::cout << "resuming..." << std::hex << L << "\n"; + //std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; luabind::resume<void>(L); } task_ptr lua_executor_add(executor& exec, luabind::object fn, int ms) @@ -87,6 +89,12 @@ YAKE_ASSERT( L ); task::bind(L); } + void bind_task(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_task(luavm->getLuaState()); + } } // namespace yake #endif // YAKE_ENABLE_LUA_TASK Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -35,6 +35,12 @@ namespace scripting { //----------------------------------------------------------------------- + int pcall_handler(lua_State* L) + { + return 1; + } + + //----------------------------------------------------------------------- YAKE_REGISTER_CONCRETE( ScriptingSystemLua ); //----------------------------------------------------------------------- @@ -100,20 +106,35 @@ } //------------------------------------------------------ - void LuaVM::execute( scripting::IScript* pScript ) + void LuaVM::execute( ScriptPtr pScript ) { + YAKE_ASSERT( pScript ); try { + YAKE_ASSERT( pScript->getCreator()->getLanguage() == scripting::IScriptingSystem::L_LUA ); if ( ( pScript->getCreator()->getLanguage() != scripting::IScriptingSystem::L_LUA ) || ( 0 == mLuaState ) ) return; - LuaScript* pLuaScript = static_cast< LuaScript* > ( pScript ); - + LuaScript* pLuaScript = static_cast<LuaScript*>( pScript.get() ); const String& rFileName = pLuaScript->getData(); - const int err = luaL_dofile( mLuaState, rFileName.c_str() ); - if (err) - YAKE_EXCEPT("Failed to execute script! (Does file exist?)"); + lua_pushcclosure(mLuaState, &pcall_handler, 0); + + if (luaL_loadfile(mLuaState, rFileName.c_str())) + { + std::string err(lua_tostring(mLuaState, -1)); + lua_pop(mLuaState, 2); // pop 2: cclosure and error string + throw Exception( err.c_str() ); + } + + if (lua_pcall(mLuaState, 0, 0, -2)) + { + std::string err(lua_tostring(mLuaState, -1)); + lua_pop(mLuaState, 2); + throw Exception( err.c_str() ); + } + + lua_pop(mLuaState, 1); } catch (luabind::error& e) { @@ -123,7 +144,7 @@ { throw Exception(String("LuaVM: caught Luabind cast_failed") + e.what()); } - catch (Exception& e) + catch (Exception&) { throw; } @@ -141,30 +162,27 @@ //------------------------------------------------------ ScriptingSystemLua::~ScriptingSystemLua() { - mVMs.clear(); } //------------------------------------------------------ - scripting::IVM* ScriptingSystemLua::createVM() + VMPtr ScriptingSystemLua::createVM() { - scripting::IVM* pVM = new LuaVM(this); - YAKE_ASSERT( pVM ).debug("could not create scripting VM"); - mVMs.push_back( pVM ); - return pVM; + VMPtr vm( new LuaVM(this/*this->shared_from_this()*/) ); + return vm; } //------------------------------------------------------ - scripting::IScript* ScriptingSystemLua::createScriptFromFile( const String & rFile ) + ScriptPtr ScriptingSystemLua::createScriptFromFile( const String & rFile ) { - LuaScript* pLuaScript = new LuaScript( this ); + ScriptPtr script( new LuaScript(this/*this->shared_from_this()*/) ); - pLuaScript->setData( rFile ); + script->setData( rFile ); - return pLuaScript; + return script; } //------------------------------------------------------ - LuaScript::LuaScript( scripting::IScriptingSystem* pCreator ) : mCreator( pCreator ) + LuaScript::LuaScript( ScriptingSystemLua* pCreator ) : mCreator( pCreator ) { YAKE_ASSERT( mCreator ).debug( "creator scripting system undefined!" ); } @@ -197,5 +215,28 @@ { return mFileName; } + + LuaThread::LuaThread(lua_State* parent) : parent_(parent), state_(0), parentRef_(-1) + { + parentRef_ = luaL_ref( parent, LUA_REGISTRYINDEX ); + state_ = lua_newthread(parent_); + } + LuaThread::~LuaThread() + { + if (state_) + { + // NB Only the main thread should be closed. + // Child threads are garbage collected... + //lua_close(state_); + state_ = 0; + } + if (parent_) + { + //@todo reenable unref? It seems to crash... + //luaL_unref( parent_, LUA_REGISTRYINDEX, parentRef_ ); + parent_ = 0; + parentRef_ = 0; + } + } } } Modified: trunk/yake/yake/base/yakePlugin.h =================================================================== --- trunk/yake/yake/base/yakePlugin.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/base/yakePlugin.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -31,6 +31,8 @@ #include <yake/base/yakePrerequisites.h> #endif +#include <yake/base/yakeString.h> + namespace yake { namespace base { Modified: trunk/yake/yake/bindings.lua/bindings.lua.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/bindings.lua.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -35,16 +35,22 @@ #if YAKE_ENABLE_LUA_BASE == 1 YAKE_BINDINGS_LUA_API void bind_base(lua_State*); + YAKE_BINDINGS_LUA_API void bind_base(scripting::IVM*); + YAKE_BINDINGS_LUA_API void bind_math(lua_State*); + YAKE_BINDINGS_LUA_API void bind_math(scripting::IVM*); #endif #if YAKE_ENABLE_LUA_TASK == 1 YAKE_BINDINGS_LUA_API void bind_task(lua_State*); + YAKE_BINDINGS_LUA_API void bind_task(scripting::IVM*); #endif #if YAKE_ENABLE_LUA_MODEL == 1 YAKE_BINDINGS_LUA_API void bind_model(lua_State*); + YAKE_BINDINGS_LUA_API void bind_model(scripting::IVM*); #endif #if YAKE_ENABLE_LUA_ENT == 1 YAKE_BINDINGS_LUA_API void bind_ent(lua_State*); + YAKE_BINDINGS_LUA_API void bind_ent(scripting::IVM*); #endif } // namespace yake Modified: trunk/yake/yake/bindings.lua/common/lua.helpers.cpp =================================================================== --- trunk/yake/yake/bindings.lua/common/lua.helpers.cpp 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/lua.helpers.cpp 2007-03-15 17:29:50 UTC (rev 1645) @@ -31,16 +31,16 @@ void lua_run(luabind::object fn) { lua_State* L = fn.interpreter(); - assert(L); - std::cout << "resuming (lua_run)..." << std::hex << L << " (create new thread? thread gc'd?)\n"; - std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; + YAKE_ASSERT(L).debug("lua_run(fn) expects a valid Lua state"); + //std::cout << "resuming (lua_run)..." << std::hex << L << " (create new thread? thread gc'd?)\n"; + //std::cout << "(current thread status: " << (lua_status(L)) << ")\n"; luabind::call_function<void>(fn); // *NOT* resume! } void lua_run(luabind::object fn, const boost::any& arg0) { lua_State* L = fn.interpreter(); - assert(L); - std::cout << "(lua_run)..." << std::hex << L << "\n"; + YAKE_ASSERT(L).debug("lua_run(fn,arg0) expects a valid Lua state"); + //std::cout << "(lua_run)..." << std::hex << L << "\n"; //luabind::call_function<void>(fn,arg0); // *NOT* resume! fn(arg0); } Modified: trunk/yake/yake/bindings.lua/common/lua.helpers.h =================================================================== --- trunk/yake/yake/bindings.lua/common/lua.helpers.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/lua.helpers.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -12,17 +12,3 @@ } // namespace yake #endif -#ifndef YAKE_LUA_HELPERS_H -#define YAKE_LUA_HELPERS_H - -#include <yake/bindings.lua/common/yake.lua.common.h> -#include <boost/any.hpp> - -namespace yake { - - void lua_run(luabind::object fn); - void lua_run(luabind::object fn, const boost::any& arg0); - -} // namespace yake - -#endif Modified: trunk/yake/yake/bindings.lua/common/vminfo.lua.h =================================================================== --- trunk/yake/yake/bindings.lua/common/vminfo.lua.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/vminfo.lua.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -47,26 +47,3 @@ } // namespace yake #endif -#ifndef YAKE_VMINFO_LUA_H -#define YAKE_VMINFO_LUA_H - -struct lua_State; - -#include <sstream> // for vm_info::info() -#include <iostream> // for vm_info::print() - -namespace yake { -namespace vminfo_lua { - struct vm_info - { - vm_info(lua_State* L = 0); - std::string info() const; - void print(std::ostream& out) const; - void print_to_cout() const; - lua_State* state; - }; - void bind(lua_State* L); -} // namespace vminfo_lua -} // namespace yake - -#endif Modified: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -81,60 +81,3 @@ } #endif -#ifndef YAKE_LUA_ANYCONVERTER_H -#define YAKE_LUA_ANYCONVERTER_H - -// -#include <yake/base/yakePrerequisites.h> -#include <yake/bindings.lua/common/yake.lua.common.h> -#include <map> -#include <boost/any.hpp> - - // boost::any bindings - template<class T> - struct convert_any - { - static void convert(lua_State* L, const boost::any& a) - { - //typename luabind::detail::default_policy::template generate_converter<T, luabind::detail::cpp_to_lua>::type conv; - //conv.apply(L, *boost::any_cast<T>(&a)); - luabind::detail::convert_to_lua(L, *boost::any_cast<T>(&a)); - } - }; - - typedef std::map<const std::type_info*, void(*)(lua_State*, const boost::any&)> any_converter_map; - -#if defined(YAKE_EXPORT_LUA_ANY_CONVERTER) -# pragma message("dllexport") -# define YAKE_LUA_ANY_CONVERTER_API DLLEXPORT -#else -# pragma message("dllimport") -# define YAKE_LUA_ANY_CONVERTER_API DLLIMPORT -#endif - - YAKE_LUA_ANY_CONVERTER_API any_converter_map& any_converters(); - - //any_converter_map any_converters; - - template<class T> - void register_any_converter() - { - any_converters()[&typeid(T)] = convert_any<T>::convert; - } - - namespace luabind - { - namespace converters - { - yes_t is_user_defined(by_value<boost::any>); - yes_t is_user_defined(by_const_reference<boost::any>); - - YAKE_LUA_ANY_CONVERTER_API void convert_cpp_to_lua(lua_State* L, const boost::any& a); - YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); - YAKE_LUA_ANY_CONVERTER_API boost::any convert_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); - YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_value<boost::any>, int index); - YAKE_LUA_ANY_CONVERTER_API int match_lua_to_cpp(lua_State* L, by_const_reference<boost::any>, int index); - } - } - -#endif Modified: trunk/yake/yake/bindings.lua/common/yake.lua.common.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.common.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/yake.lua.common.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -40,19 +40,3 @@ #pragma warning(pop) #endif -#ifndef YAKE_BINDINGS_LUA_COMMON_H -#define YAKE_BINDINGS_LUA_COMMON_H - -// Lua and Luabind includes: -extern "C" { - #include "lua.h" - #include "lualib.h" - #include "lauxlib.h" -} -#pragma warning(push) -#pragma warning(disable: 4251) -#define LUABIND_NO_HEADERS_ONLY -#include <luabind/luabind.hpp> -#pragma warning(pop) - -#endif Modified: trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/common/yake.lua.shared_ptr.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -49,28 +49,3 @@ } // namespace luabind #endif -#ifndef YAKE_LUA_SHAREDPTR_BINDING_H -#define YAKE_LUA_SHAREDPTR_BINDING_H - -#include <boost/shared_ptr.hpp> - -// boost::shared_ptr bindings -namespace luabind { - template<class T> - T* get_pointer(boost::shared_ptr<T>& p) - { - return p.get(); - } - - //typedef boost::shared_ptr<ui::LuaStyleBatcher> LuaStyleBatcherPtr; - //typedef boost::shared_ptr<const ui::LuaStyleBatcher> ConstLuaStyleBatcherPtr; - - template<class A> - boost::shared_ptr<const A>* - get_const_holder(boost::shared_ptr<A>*) - { - return 0; - } -} // namespace luabind - -#endif Modified: trunk/yake/yake/bindings.lua/detail/private.h =================================================================== --- trunk/yake/yake/bindings.lua/detail/private.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/bindings.lua/detail/private.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -30,35 +30,18 @@ #include <yake/scripting/yakeScriptingSystem.h> #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> -#define YAKE_WRAP_BINDER(CLASS,BINDERFN) \ - struct binder_##CLASS : public scripting::IBinder \ - { \ - YAKE_DECLARE_CONCRETE(binder_##CLASS, #CLASS); \ - virtual void bind(scripting::IVM* vm) \ - { \ - YAKE_ASSERT(vm); \ - scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); \ - lua_State* L = luavm->getLuaState(); \ - BINDERFN(L); \ - } \ - };\ - YAKE_REGISTER_CONCRETE(binder_##CLASS); +#define YAKE_STRINGIFY(x) #x -#endif -#ifndef YAKE_LUA_BINDINGS_PRIVATE_H -#define YAKE_LUA_BINDINGS_PRIVATE_H - -#include <yake/scripting/yakeScriptingSystem.h> -#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> - #define YAKE_WRAP_BINDER(CLASS,BINDERFN) \ struct binder_##CLASS : public scripting::IBinder \ { \ YAKE_DECLARE_CONCRETE(binder_##CLASS, #CLASS); \ - virtual void bind(scripting::IVM* vm) \ + virtual void bind(scripting::VMPtr vm) \ { \ YAKE_ASSERT(vm); \ - scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); \ + if (!vm) \ + throw Exception( YAKE_STRINGIFY( binder_##CLASS ) ": invalid vm passed to bind()" ); \ + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm.get()); \ lua_State* L = luavm->getLuaState(); \ BINDERFN(L); \ } \ Modified: trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h =================================================================== --- trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -27,6 +27,11 @@ #ifndef YAKE_SCRIPTINGSYSTEMLUA_H #define YAKE_SCRIPTINGSYSTEMLUA_H +#include <yake/scripting/yakeScriptingSystem.h> +#include <boost/enable_shared_from_this.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/noncopyable.hpp> + #if defined( YAKE_SCRIPTINGLUA_EXPORTS ) # define YAKE_SCRIPTINLUA_API DLLEXPORT #else @@ -38,7 +43,7 @@ namespace yake { namespace scripting { - class YAKE_SCRIPTINLUA_API ScriptingSystemLua : public scripting::IScriptingSystem + class YAKE_SCRIPTINLUA_API ScriptingSystemLua : public scripting::IScriptingSystem, public boost::enable_shared_from_this<ScriptingSystemLua> { YAKE_DECLARE_CONCRETE( ScriptingSystemLua, "lua" ); public: @@ -62,17 +67,17 @@ /** Create a scipting virtual machine. \see IScript */ - virtual scripting::IVM* createVM(); + virtual VMPtr createVM(); /** Create a script resource from a file. It can be executed by a virtual machine. \see IVM */ - virtual scripting::IScript* createScriptFromFile( const String & rFile ); + virtual ScriptPtr createScriptFromFile( const String & rFile ); protected: - typedef std::vector< scripting::IVM* > VMList; - VMList mVMs; + // not for pulic use: + using boost::enable_shared_from_this<ScriptingSystemLua>::shared_from_this; }; //----------------------------------------------------- @@ -85,9 +90,6 @@ class YAKE_SCRIPTINLUA_API LuaVM : public scripting::IVM { - protected: - ScriptingSystemLua * mCreator; - lua_State * mLuaState; public: LuaVM( ScriptingSystemLua* pSystem, uint32 libs = LUALIB_BASE|LUALIB_TABLE|LUALIB_STRING|LUALIB_MATH|LUALIB_IO ); virtual ~LuaVM(); @@ -96,9 +98,8 @@ { return mCreator; } virtual void execute( const String & rData ); + virtual void execute( ScriptPtr pScript ); - virtual void execute( scripting::IScript * pScript ); - lua_State* getLuaState() const { return mLuaState; } protected: /* @@ -136,12 +137,17 @@ { return &mPropInterface; }*/ + private: + //SharedPtr<ScriptingSystemLua> mCreator; // to avoid destruction of system when VMs are still active + ScriptingSystemLua* mCreator; + lua_State* mLuaState; }; + //---------------------------------------------------- class YAKE_SCRIPTINLUA_API LuaScript : public scripting::IScript { public: - LuaScript( IScriptingSystem* pCreator ); + LuaScript( ScriptingSystemLua* pCreator ); virtual ~LuaScript(); /** Get a pointer to the scripting system that created this IScript object. @@ -154,10 +160,27 @@ const String& getData() const; private: - String mFileName; - const IScriptingSystem* mCreator; + String mFileName; + //SharedPtr<ScriptingSystemLua> mCreator; // to avoid destruction of system when VMs are still active + ScriptingSystemLua* mCreator; }; + //---------------------------------------------------- + typedef int thread_reference; + struct YAKE_SCRIPTINLUA_API LuaThread : public boost::noncopyable + { + LuaThread(lua_State* parent); + ~LuaThread(); + lua_State* interpreter() + { + return state_; + } + private: + thread_reference parentRef_; + lua_State* parent_; + lua_State* state_; + }; + } // scripting } // yake #endif Modified: trunk/yake/yake/scripting/yakeScriptingSystem.h =================================================================== --- trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-03-15 15:30:15 UTC (rev 1644) +++ trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-03-15 17:29:50 UTC (rev 1645) @@ -68,6 +68,11 @@ class IScriptingSystem; class IVM; + class IScript; + class IBinder; + typedef SharedPtr<IVM> VMPtr; + typedef SharedPtr<IScript> ScriptPtr; + typedef SharedPtr<IBinder> BinderPtr; class YAKE_SCRIPTING_API IBinder { @@ -75,7 +80,7 @@ public: virtual ~IBinder() {} - virtual void bind( scripting::IVM* pVM ) = 0; + virtual void bind( VMPtr vm ) = 0; }; /** @@ -83,7 +88,7 @@ class YAKE_SCRIPTING_API ScriptingBindingsPlugin : public ::yake::base::Plugin { public: - virtual yake::SharedPtr<IBinder> createBinder() = 0; + virtual BinderPtr createBinder() = 0; }; /** A script that can be executed by a virtual machine. @@ -118,10 +123,10 @@ virtual const IScriptingSystem* getCreator() const = 0; /** Execute the script data contained in pScript. - \param pScript script object + \param script script object \remarks May throw an exception if the script could not be executed. */ - virtual void execute( IScript* pScript ) = 0; + virtual void execute( ScriptPtr script ) = 0; /** Execute the data contained in the string. \param data a string containing scripting data to execute. @@ -164,13 +169,13 @@ /** Create a scipting virtual machine. \see IScript */ - virtual IVM* createVM() = 0; + virtual VMPtr createVM() = 0; /** Create a script resource from a file. It can be executed by a virtual machine. \see IVM */ - virtual IScript* createScriptFromFile( const String & file ) = 0; + virtual ScriptPtr createScriptFromFile( const String & file ) = 0; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 17:39:14
|
Revision: 1656 http://svn.sourceforge.net/yake/?rev=1656&view=rev Author: psyclonist Date: 2007-03-15 10:38:43 -0700 (Thu, 15 Mar 2007) Log Message: ----------- moved files Added Paths: ----------- trunk/yake/samples/common/exapp/application.h trunk/yake/samples/common/exapp/configs.h trunk/yake/samples/common/exapp/ext_lib_man.h trunk/yake/samples/common/exapp/init_gui.h trunk/yake/samples/common/exapp/initialization.h trunk/yake/samples/common/exapp/libraries.h trunk/yake/samples/common/exapp/library_manager.h trunk/yake/samples/common/exapp/load_libraries.h trunk/yake/samples/common/exapp/yakeExampleApplication.h Removed Paths: ------------- trunk/yake/yake/samples/common/application.h trunk/yake/yake/samples/common/configs.h trunk/yake/yake/samples/common/ext_lib_man.h trunk/yake/yake/samples/common/init_gui.h trunk/yake/yake/samples/common/initialization.h trunk/yake/yake/samples/common/libraries.h trunk/yake/yake/samples/common/library_manager.h trunk/yake/yake/samples/common/load_libraries.h trunk/yake/yake/samples/common/yakeExampleApplication.h Copied: trunk/yake/samples/common/exapp/application.h (from rev 1653, trunk/yake/yake/samples/common/application.h) =================================================================== --- trunk/yake/samples/common/exapp/application.h (rev 0) +++ trunk/yake/samples/common/exapp/application.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,56 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_APPLICATION_H_ +#define _YAKE_SAMPLES_COMMON_APPLICATION_H_ + +#include <yake/base/mpl/null_type.h> + +namespace yake +{ +namespace samples +{ +namespace common +{ + +/* application */ +template <class Initialization, class Extension = yake::base::mpl::null_type> +struct application : Extension, Initialization +{}; + +// if there's no extension then don't inherit from it, otherwise we would have +// two bases null_type classes, because auto_init is using null_type as root for the +// inheritance +template <class Initialization> +struct application<Initialization, yake::base::mpl::null_type> : Initialization +{}; + + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_APPLICATION_H_ Copied: trunk/yake/samples/common/exapp/configs.h (from rev 1653, trunk/yake/yake/samples/common/configs.h) =================================================================== --- trunk/yake/samples/common/exapp/configs.h (rev 0) +++ trunk/yake/samples/common/exapp/configs.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,95 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_CONFIGS_H_ +#define _YAKE_SAMPLES_COMMON_CONFIGS_H_ + +// yake +#include <yake/base/mpl/sequences.h> +// local +#include "libraries.h" + +namespace yake +{ +namespace graphics +{ + struct IGraphicsSystem; +} +namespace samples +{ +namespace common +{ + +using namespace yake::base::mpl::sequences; + +// ----------------------------------------- +// system forward declares +struct gui_system; +struct input_system; +struct physics_system; + +// ----------------------------------------- +// libraries for a specific config +template <class Config> +struct config_libraries; + +// ----------------------------------------- +// basic config +typedef list<yake::graphics::IGraphicsSystem, gui_system, input_system, physics_system> basic_config; + +template <> +struct config_libraries<basic_config> +{ + typedef basic_config config; + + // todo + static std::vector<std::string> get_libraries() + { return libraries() << "graphicsOGRE.dll"; /*<< "cegui_plugin" << "ode_plugin"*/; } +}; + +// ----------------------------------------- +// minimum config +typedef list<yake::graphics::IGraphicsSystem, input_system> minimum_config; + +template <> +struct config_libraries<minimum_config> +{ + typedef minimum_config config; + + // todo: base::native::Load_Library should add YAKE_DYNLIB_POSTFIX (".dll" and the linux equivalent) to the library name + static std::vector<std::string> get_libraries() + { return libraries() << "graphicsOGRE.dll"; } +}; + +// ----------------------------------------- +// default config +typedef basic_config default_config; + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_CONFIGS_H_ Copied: trunk/yake/samples/common/exapp/ext_lib_man.h (from rev 1653, trunk/yake/yake/samples/common/ext_lib_man.h) =================================================================== --- trunk/yake/samples/common/exapp/ext_lib_man.h (rev 0) +++ trunk/yake/samples/common/exapp/ext_lib_man.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,57 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ +#define _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ + +// stl +#include <vector> +#include <string> +// local +#include "library_manager.h" + +namespace yake +{ +namespace samples +{ +namespace common +{ + +/* library manager extension */ +struct ext_lib_man +{ + library_manager & get_lib_man() + { return m_lib_man; } + +private: + library_manager m_lib_man; +}; + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ Copied: trunk/yake/samples/common/exapp/init_gui.h (from rev 1653, trunk/yake/yake/samples/common/init_gui.h) =================================================================== --- trunk/yake/samples/common/exapp/init_gui.h (rev 0) +++ trunk/yake/samples/common/exapp/init_gui.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,149 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_INIT_GUI_H_ +#define _YAKE_SAMPLES_COMMON_INIT_GUI_H_ + +// boost +#include <boost/shared_ptr.hpp> +// yake +#include <yake/base/yake.h> +#include <yake/graphics/yakeGraphicsSystem.h> +#include <yapp/gui/renderer_adapter_base.h> +// local +#include "initialization.h" + +namespace yake +{ +namespace samples +{ +namespace common +{ + +// todo: del +template <> +struct create_help <yake::graphics::IGraphicsSystem> +{ + static boost::shared_ptr<yake::graphics::IGraphicsSystem> create() + { return yake::templates::create_default<yake::graphics::IGraphicsSystem>(); } +}; + +using namespace yake::base; + + // system needs a pure virtual function get_type_info and concrete impl (plugin) needs to use return_type_info + // HOWEVER this is not really useful ... just define the pure virtual function within the interface and the impl + // within the plugin ... or? + template <class Parent> + struct return_type_info + { + virtual const std::type_info & get_type_info() + { return typeid(Parent); } + }; + + // todo: del + struct input_system {}; + struct physics_system {}; + + //struct graphics_system : return_type_info<graphics_system> {}; + struct gui_system : return_type_info<gui_system> {}; + + struct gui_renderer_adapter + { + typedef std::pair<base::type_info, base::type_info> identifier; + }; + + template <class System> + boost::shared_ptr<System> create(const gui_renderer_adapter::identifier & id) + { return boost::shared_ptr<System>(new gui_renderer_adapter()); } + +// ----------------------------------------- +/* automatic initialization */ +namespace // unnamed +{ + + // todo: del, just for constructor order test + template <class Parent> + struct auto_init_system_holder<input_system, Parent> + { + // the user can add an adapter for a gui/renderer combination without changing the code + auto_init_system_holder() + : m_system(create<input_system>()) + { + std::cout << "auto_init_system_holder<input_system, Parent>::auto_init_system_holder()\n"; + } + + boost::shared_ptr<input_system> get_system() + { return m_system; } + + boost::shared_ptr<input_system> m_system; + }; + + template <class Parent> + struct auto_init_system_holder<yake::graphics::IGraphicsSystem, Parent> + { + // the user can add an adapter for a gui/renderer combination without changing the code + auto_init_system_holder() + : m_system(create<yake::graphics::IGraphicsSystem>()) + { + std::cout << "auto_init_system_holder<yake::graphics::IGraphicsSystem, Parent>::auto_init_system_holder()\n"; + } + + boost::shared_ptr<yake::graphics::IGraphicsSystem> get_system() + { return m_system; } + + boost::shared_ptr<yake::graphics::IGraphicsSystem> m_system; + }; + + + // note: you cannot use gui without a graphics system (todo: for win32 gui fake graphics system needed?) + template <class Parent> + struct auto_init_system_holder<gui_system, Parent> + { + // the user can add an adapter for a gui/renderer combination without changing the code + auto_init_system_holder() + : m_system(create<gui_system>()), + m_gui_renderer_adapter( + create<gui_renderer_adapter>( + gui_renderer_adapter::identifier( + static_cast<Parent*>(this)->get_system<yake::graphics::IGraphicsSystem>()->get_type_info(), + m_system->get_type_info()))) + { + std::cout << "auto_init_system_holder<gui_system, Parent>::auto_init_system_holder()\n"; + } + + boost::shared_ptr<gui_system> get_system() + { return m_system; } + + boost::shared_ptr<gui_system> m_system; + boost::shared_ptr<gui_renderer_adapter> m_gui_renderer_adapter; + }; +} // namespace unnamed + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_INIT_GUI_H_ Copied: trunk/yake/samples/common/exapp/initialization.h (from rev 1653, trunk/yake/yake/samples/common/initialization.h) =================================================================== --- trunk/yake/samples/common/exapp/initialization.h (rev 0) +++ trunk/yake/samples/common/exapp/initialization.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,235 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_INITIALIZATION_H_ +#define _YAKE_SAMPLES_COMMON_INITIALIZATION_H_ + +// stl +#include <vector> +#include <string> +#include <iostream> +// boost +#include <boost/shared_ptr.hpp> +#include <boost/mpl/begin.hpp> +#include <boost/mpl/iterator_range.hpp> +#include <boost/mpl/find.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/next.hpp> +#include <boost/mpl/reverse.hpp> +#include <boost/mpl/lambda.hpp> +// yake +#include <yake/base/mpl/inherit_linear.h> +#include <yake/base/mpl/inherit_multiple.h> +// local +#include "load_libraries.h" + +namespace yake +{ +namespace samples +{ +namespace common +{ + +// todo: fix namespace chaos, if we do "using namespace boost::mpl" ::size_t collides with boost::mpl::size_t?! +using namespace yake::base; +using namespace yake::base::mpl; + +// todo: del +template <class System> +struct create_help +{ + static boost::shared_ptr<System> create() + { return boost::shared_ptr<System>(new System()); } +}; + +// todo: use yake registry +template <class System> +boost::shared_ptr<System> create() +{ return create_help<System>::create(); } + +template <class System> +boost::shared_ptr<System> create(const char * id) +{ return create_help<System>::create(); } + +// ----------------------------------------- +/* automatic initialization */ +namespace // unnamed +{ + // holds a reference to a system and makes it accessable + template <class System, class Parent> + struct auto_init_system_holder + { + auto_init_system_holder() + : m_system(create<System>()) + {} + + boost::shared_ptr<System> get_system() + { return m_system; } + + boost::shared_ptr<System> m_system; + }; +} // namespace unnamed + + +// loads the libraries, initializes the systems and makes them accessable +template <class Config = default_config> +struct auto_init : + private load_libraries<Config>, + private inherit_multiple + < + typename boost::mpl::reverse<Config>::type, // note: correcting initialization order, otherwise graphics system would be initialized after gui + typename boost::mpl::lambda< auto_init_system_holder<boost::mpl::_, auto_init> >::type + >::type +{ + template <class System> + boost::shared_ptr<System> get_system() + { return static_cast<auto_init_system_holder<System, auto_init>*>(this)->get_system(); } +}; + +// ----------------------------------------- +/* delayed automatic initialization */ +// loads the libraries, initializes the systems and makes them accessable (delayed) +template <class Config = default_config> +struct delayed_auto_init +{ +public: // types + typedef load_libraries<Config> Libraries; + typedef typename inherit_multiple + < + typename boost::mpl::reverse<Config>::type, // note: correcting initialization order, otherwise graphics system would be initialized after gui + typename boost::mpl::lambda< auto_init_system_holder<boost::mpl::_, delayed_auto_init> >::type + >::type Systems; + +public: // methods + void initialize() + { + m_libraries.reset(new Libraries()); + m_systems.reset(new Systems()); + } + + template <class System> + boost::shared_ptr<System> get_system() + { return static_cast<auto_init_system_holder<System, delayed_auto_init>*>(m_systems.get())->get_system(); } + +private: // data + boost::shared_ptr<Libraries> m_libraries; + boost::shared_ptr<Systems> m_systems; +}; + +// ----------------------------------------- +/* semi automatic initialization */ +namespace // unnamed +{ + struct semi_init_system_holder_root + { + virtual void load_systems() {} + }; + + template <class Base, class System> + struct semi_init_system_holder : Base + { + void load_systems() + { m_system = create<System>(); Base::load_systems(); } + + boost::shared_ptr<System> get_system() + { return m_system; } + + boost::shared_ptr<System> m_system; + }; +} // namespace unnamed + +template <class Parent, class Config = default_config> +struct semi_auto_init : + private inherit_linear + < + Config, + typename boost::mpl::lambda< semi_init_system_holder<boost::mpl::_, boost::mpl::_> >::type, + semi_init_system_holder_root + >::type +{ + semi_auto_init() + { + static_cast<Parent*>(this)->load_libraries(); + load_systems(); + } + + template <class System> + boost::shared_ptr<System> get_system() + { + // create list of bases + typedef boost::mpl::find<Config, System>::type last; + typedef boost::mpl::iterator_range<typename boost::mpl::begin<Config>::type, next<last>::type>::type bases; + // cast to base + inherit_linear + < + Config, + typename boost::mpl::lambda< semi_init_system_holder<boost::mpl::_, boost::mpl::_> >::type, + semi_init_system_holder_root + >::type & base = *this; + // get system + return base.get_system(); + } +}; + +// ----------------------------------------- +/* manual initialization */ +namespace // unnamed +{ + template <class System> + struct manual_init_system_holder + { + void set_system(boost::shared_ptr<System> system) + { m_system = system; } + + boost::shared_ptr<System> get_system() + { return m_system; } + + boost::shared_ptr<System> m_system; + }; +} // namspace unnamed + +template <class Systems> +struct manual_init : + private inherit_multiple + < + Systems, + typename boost::mpl::lambda< manual_init_system_holder<boost::mpl::_> >::type + >::type +{ + template <class System> + boost::shared_ptr<System> get_system() + { return static_cast<manual_init_system_holder<System>*>(this)->get_system(); } + + template <class System> + void load_system(const char * id) + { return static_cast<manual_init_system_holder<System>*>(this)->set_system(create<System>(id)); } +}; + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_INITIALIZATION_H_ Copied: trunk/yake/samples/common/exapp/libraries.h (from rev 1653, trunk/yake/yake/samples/common/libraries.h) =================================================================== --- trunk/yake/samples/common/exapp/libraries.h (rev 0) +++ trunk/yake/samples/common/exapp/libraries.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,57 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_LIBRARIES_H_ +#define _YAKE_SAMPLES_COMMON_LIBRARIES_H_ + +// stl +#include <vector> +#include <string> + +namespace yake +{ +namespace samples +{ +namespace common +{ + +struct libraries +{ + libraries & operator<<(const char * lib) + { m_libs.push_back(lib); return *this; } + + operator std::vector<std::string>() + { return m_libs; } + +private: + std::vector<std::string> m_libs; +}; + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_LIBRARIES_H_ Copied: trunk/yake/samples/common/exapp/library_manager.h (from rev 1653, trunk/yake/yake/samples/common/library_manager.h) =================================================================== --- trunk/yake/samples/common/exapp/library_manager.h (rev 0) +++ trunk/yake/samples/common/exapp/library_manager.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,64 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_LIBRARY_MANAGER_H_ +#define _YAKE_SAMPLES_COMMON_LIBRARY_MANAGER_H_ + +// stl +#include <vector> +#include <string> +// boost +#include <boost/shared_ptr.hpp> +// yake +#include <yake/base/yakeLibrary.h> + +namespace yake +{ +namespace samples +{ +namespace common +{ + +/* library manager */ +struct library_manager +{ + typedef std::vector< boost::shared_ptr<base::Library> > library_list; + + void load_library(const char * lib_name) + { m_library_list.push_back(boost::shared_ptr<base::Library>(new base::Library(lib_name))); } + + library_list m_library_list; +}; + +library_manager & operator<<(library_manager & lib_man, const char * lib_name) +{ lib_man.load_library(lib_name); return lib_man; } + + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_LIBRARY_MANAGER_H_ Copied: trunk/yake/samples/common/exapp/load_libraries.h (from rev 1653, trunk/yake/yake/samples/common/load_libraries.h) =================================================================== --- trunk/yake/samples/common/exapp/load_libraries.h (rev 0) +++ trunk/yake/samples/common/exapp/load_libraries.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,63 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef _YAKE_SAMPLES_COMMON_LOAD_LIBRARIES_H_ +#define _YAKE_SAMPLES_COMMON_LOAD_LIBRARIES_H_ + +// stl +#include <vector> +#include <string> +// local +#include "library_manager.h" + +namespace yake +{ +namespace samples +{ +namespace common +{ + +/* library manager */ +template <class Config> +struct load_libraries +{ + load_libraries() + { + std::vector<std::string> libs = config_libraries<Config>::get_libraries(); + for(std::vector<std::string>::const_iterator iter = libs.begin(); + iter != libs.end(); iter++) + { m_lib_man.load_library(iter->c_str()); } + } + +private: + library_manager m_lib_man; +}; + +} // namespace common +} // namespace samples +} // namespace yake + +#endif // _YAKE_SAMPLES_COMMON_LOAD_LIBRARIES_H_ Copied: trunk/yake/samples/common/exapp/yakeExampleApplication.h (from rev 1653, trunk/yake/yake/samples/common/yakeExampleApplication.h) =================================================================== --- trunk/yake/samples/common/exapp/yakeExampleApplication.h (rev 0) +++ trunk/yake/samples/common/exapp/yakeExampleApplication.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -0,0 +1,306 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_EXAMPLE_APPLICATION_H +#define YAKE_EXAMPLE_APPLICATION_H + +/** +*/ +#include <yake/graphics/yakeGraphics.h> +#include <yake/physics/yakePhysics.h> +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/input/yakeInput.h> +#include <yake/input/yakeInputEventGenerator.h> +#include <yake/audio/yakeAudio.h> +#include <iostream> + +namespace yake { + using namespace yake::templates; +namespace exapp { + +// todo: kick the plugin approach or combine it with class registry +// cleanup this subsystem mess + class ExampleApplication + { + private: + typedef Vector< base::Plugin* > PluginList; + PluginList mPlugins; + typedef Vector< SharedPtr<base::Library> > LibList; + LibList mLibs; + SharedPtr< graphics::IGraphicsSystem > mGraphicsSystem; + SharedPtr< physics::IPhysicsSystem > mPhysicsSystem; + SharedPtr< scripting::IScriptingSystem> mScriptingSystem; + SharedPtr< scripting::IBinder > mScriptingBindings; + SharedPtr< input::IInputSystem > mInputSystem; + SharedPtr< audio::IAudioSystem > mAudioSystem; + bool mShutdownRequested; + protected: + input::KeyboardEventGenerator mKeyboardEventGenerator; + input::MouseEventGenerator mMouseEventGenerator; + + // while yake can handle more than one keyboard or mouse we don't do that ... + input::KeyboardDevice* mKeyboard; + input::MouseDevice* mMouse; + + bool mLoadGraphicsSystem; + bool mLoadPhysicsSystem; + bool mLoadScriptingSystem; + bool mLoadInputSystem; + bool mLoadScriptingBindings; + bool mLoadAudioSystem; + public: + ExampleApplication(bool loadGraphics, bool loadPhysics, bool loadScripting, bool loadInput, bool loadScriptingBindings, bool loadAudio ) : + mShutdownRequested(false), + mLoadGraphicsSystem( loadGraphics ), + mLoadPhysicsSystem( loadPhysics ), + mLoadScriptingSystem( loadScripting ), + mLoadInputSystem( loadInput ), + mLoadScriptingBindings( loadScriptingBindings ), + mLoadAudioSystem( loadAudio ) + { + } + + virtual ~ExampleApplication() + { + destroyAllSystems(); + unloadAllPlugins(); + } + + void requestShutdown() + { + mShutdownRequested = true; + } + + bool shutdownRequested() const + { + return mShutdownRequested; + } + + const input::KeyboardDevice* getKeyboard() const + { + return mKeyboard; + } + + const input::MouseDevice* getMouse() const + { + return mMouse; + } + + graphics::IGraphicsSystem& getGraphicsSystem() const + { + if (!mGraphicsSystem) + YAKE_EXCEPT( "Don't have a graphics system!"); + return *mGraphicsSystem; + } + + scripting::IScriptingSystem& getScriptingSystem() const + { + if (!mScriptingSystem) + YAKE_EXCEPT( "Don't have a scripting system!" ); + return *mScriptingSystem; + } + + physics::IPhysicsSystem& getPhysicsSystem() const + { return *mPhysicsSystem; } + + scripting::IBinder& getScriptingBindings() const + { + if (!mScriptingBindings) + YAKE_EXCEPT( "Don't have scripting bindings!" ); + return *mScriptingBindings; + } + + input::IInputSystem& getInputSystem() const + { return *mInputSystem; } + + audio::IAudioSystem* getAudioSystem() const + { + YAKE_ASSERT( mAudioSystem.get() ); + return mAudioSystem.get(); + } + + virtual void initialise() + { + + // scripting + if ( mLoadScriptingSystem ) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("scriptingLua")); + YAKE_ASSERT( pLib ).debug("Cannot load scripting system"); + + mScriptingSystem = create_default< scripting::IScriptingSystem >(); + YAKE_ASSERT( mScriptingSystem ).error("Cannot create scripting system."); + } + + // scripting bindings + if ( mLoadScriptingBindings ) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("scriptingBindingsLua")); + YAKE_ASSERT( pLib ).debug("Cannot load scripting bindings plugin."); + + mScriptingBindings = create_default< scripting::IBinder >(); + YAKE_ASSERT( mScriptingBindings ).error("Cannot create scripting bindings object."); + } + + // graphics + if (mLoadGraphicsSystem) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("graphicsOgre" )); + YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); + + mGraphicsSystem = create_default< graphics::IGraphicsSystem >(); + // ... or alternatively we can create a graphics system by name: + //mGraphicsSystem = create< graphics::IGraphicsSystem >("ogre3d"); + + mGraphicsSystem->subscribeToShutdownSignal( boost::bind( &ExampleApplication::requestShutdown, this ) ); + } + + // physics + if (mLoadPhysicsSystem) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("physicsODE" )); + YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); + + mPhysicsSystem = create_default< physics::IPhysicsSystem >(); + YAKE_ASSERT( mPhysicsSystem ).error("Cannot create physics system."); + } + + // input + if (mLoadInputSystem) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("inputOgre" )); + YAKE_ASSERT( pLib ).debug("Cannot load input plugin."); + + mInputSystem = create_default< input::IInputSystem >(); + YAKE_ASSERT( mInputSystem ).error("Cannot create input system."); + + setupInput(); + } + + // audio + if (mLoadAudioSystem) + { + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("audioOpenAL" )); + YAKE_ASSERT( pLib ).debug("Cannot load audio plugin."); + + mAudioSystem = create_default< audio::IAudioSystem >(); + //OR: mAudioSystem.reset( create< audio::IAudioSystem >("openalpp") ); + } + } + + virtual void run() = 0; + + private: + void setupInput() + { + YAKE_ASSERT( mInputSystem ); + input::IInputSystem::DeviceEntryList devs; + devs = getInputSystem().getAvailableDevices(); + + for (input::IInputSystem::DeviceEntryList::const_iterator it = devs.begin(); it != devs.end(); ++it) + { + std::cout << "input device: " << (*it).name << std::endl; + if ((*it).type == input::IDT_KEYBOARD) + mKeyboard = static_cast<input::KeyboardDevice*>(getInputSystem().activateDevice( (*it).name )); + else if ((*it).type == input::IDT_MOUSE) + mMouse = static_cast<input::MouseDevice*>(getInputSystem().activateDevice( (*it).name )); + } + YAKE_ASSERT( mKeyboard ); + YAKE_ASSERT( mMouse ); + + mKeyboardEventGenerator.attachDevice( mKeyboard ); + mMouseEventGenerator.attachDevice( mMouse ); + } + protected: + /** @todo deprecated so remove: + template< class PluginType > + PluginType* loadPlugin( const String & file ) + { + yake::base::Library* pDynLib = new yake::base::Library( file ); + YAKE_ASSERT( pDynLib ).debug("Out of memory."); + + std::cout << "Loading plugin " << file << std::endl; + yake::base::YakeDynLibStartPluginFn pfnStartPlugin = (yake::base::YakeDynLibStartPluginFn)pDynLib->getSymbol("dynlibStartPlugin"); + YAKE_ASSERT( pfnStartPlugin ).debug("Cannot find export in dynamic library."); + + PluginType* pPlugin = static_cast<PluginType*>(pfnStartPlugin()); + YAKE_ASSERT( pPlugin ).debug("Plugin startup function failed."); + + // + bool bRet = pPlugin->initialise(); + YAKE_ASSERT( bRet ).debug("Plugin initialization failed."); + if (!bRet) + { + delete pPlugin; + return 0; + } + + mPlugins.push_back( pPlugin ); + + return pPlugin; + } + */ + + void unloadAllPlugins() + { + // better safe than sorry. + //YAKE_SAFE_DELETE( mScriptingBindings ); + destroyAllSystems(); + + // destroy plugins in reverse order of initialitation + for (PluginList::reverse_iterator it = mPlugins.rbegin(); it != mPlugins.rend(); ++it) + { + (*it)->shutdown(); + delete (*it); + } + mPlugins.clear(); + + mLibs.clear(); + } + + SharedPtr<base::Library> loadLib( const String & file ) + { + SharedPtr<base::Library> pDynLib( new base::Library( file ) ); + YAKE_ASSERT( pDynLib ).debug( "Out of memory." ); + mLibs.push_back( pDynLib ); + return pDynLib; + } + + void destroyAllSystems() + { + mScriptingBindings.reset(); + mScriptingSystem.reset(); + mInputSystem.reset(); + mGraphicsSystem.reset(); + mPhysicsSystem.reset(); + mAudioSystem.reset(); + } + }; + +} +} + +#endif Deleted: trunk/yake/yake/samples/common/application.h =================================================================== --- trunk/yake/yake/samples/common/application.h 2007-03-15 17:37:57 UTC (rev 1655) +++ trunk/yake/yake/samples/common/application.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -1,56 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef _YAKE_SAMPLES_COMMON_APPLICATION_H_ -#define _YAKE_SAMPLES_COMMON_APPLICATION_H_ - -#include <yake/base/mpl/null_type.h> - -namespace yake -{ -namespace samples -{ -namespace common -{ - -/* application */ -template <class Initialization, class Extension = yake::base::mpl::null_type> -struct application : Extension, Initialization -{}; - -// if there's no extension then don't inherit from it, otherwise we would have -// two bases null_type classes, because auto_init is using null_type as root for the -// inheritance -template <class Initialization> -struct application<Initialization, yake::base::mpl::null_type> : Initialization -{}; - - -} // namespace common -} // namespace samples -} // namespace yake - -#endif // _YAKE_SAMPLES_COMMON_APPLICATION_H_ Deleted: trunk/yake/yake/samples/common/configs.h =================================================================== --- trunk/yake/yake/samples/common/configs.h 2007-03-15 17:37:57 UTC (rev 1655) +++ trunk/yake/yake/samples/common/configs.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -1,95 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef _YAKE_SAMPLES_COMMON_CONFIGS_H_ -#define _YAKE_SAMPLES_COMMON_CONFIGS_H_ - -// yake -#include <yake/base/mpl/sequences.h> -// local -#include "libraries.h" - -namespace yake -{ -namespace graphics -{ - struct IGraphicsSystem; -} -namespace samples -{ -namespace common -{ - -using namespace yake::base::mpl::sequences; - -// ----------------------------------------- -// system forward declares -struct gui_system; -struct input_system; -struct physics_system; - -// ----------------------------------------- -// libraries for a specific config -template <class Config> -struct config_libraries; - -// ----------------------------------------- -// basic config -typedef list<yake::graphics::IGraphicsSystem, gui_system, input_system, physics_system> basic_config; - -template <> -struct config_libraries<basic_config> -{ - typedef basic_config config; - - // todo - static std::vector<std::string> get_libraries() - { return libraries() << "graphicsOGRE.dll"; /*<< "cegui_plugin" << "ode_plugin"*/; } -}; - -// ----------------------------------------- -// minimum config -typedef list<yake::graphics::IGraphicsSystem, input_system> minimum_config; - -template <> -struct config_libraries<minimum_config> -{ - typedef minimum_config config; - - // todo: base::native::Load_Library should add YAKE_DYNLIB_POSTFIX (".dll" and the linux equivalent) to the library name - static std::vector<std::string> get_libraries() - { return libraries() << "graphicsOGRE.dll"; } -}; - -// ----------------------------------------- -// default config -typedef basic_config default_config; - -} // namespace common -} // namespace samples -} // namespace yake - -#endif // _YAKE_SAMPLES_COMMON_CONFIGS_H_ Deleted: trunk/yake/yake/samples/common/ext_lib_man.h =================================================================== --- trunk/yake/yake/samples/common/ext_lib_man.h 2007-03-15 17:37:57 UTC (rev 1655) +++ trunk/yake/yake/samples/common/ext_lib_man.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -1,57 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ -#define _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ - -// stl -#include <vector> -#include <string> -// local -#include "library_manager.h" - -namespace yake -{ -namespace samples -{ -namespace common -{ - -/* library manager extension */ -struct ext_lib_man -{ - library_manager & get_lib_man() - { return m_lib_man; } - -private: - library_manager m_lib_man; -}; - -} // namespace common -} // namespace samples -} // namespace yake - -#endif // _YAKE_SAMPLES_COMMON_EXT_LIB_MAN_H_ Deleted: trunk/yake/yake/samples/common/init_gui.h =================================================================== --- trunk/yake/yake/samples/common/init_gui.h 2007-03-15 17:37:57 UTC (rev 1655) +++ trunk/yake/yake/samples/common/init_gui.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -1,149 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef _YAKE_SAMPLES_COMMON_INIT_GUI_H_ -#define _YAKE_SAMPLES_COMMON_INIT_GUI_H_ - -// boost -#include <boost/shared_ptr.hpp> -// yake -#include <yake/base/yake.h> -#include <yake/graphics/yakeGraphicsSystem.h> -#include <yapp/gui/renderer_adapter_base.h> -// local -#include "initialization.h" - -namespace yake -{ -namespace samples -{ -namespace common -{ - -// todo: del -template <> -struct create_help <yake::graphics::IGraphicsSystem> -{ - static boost::shared_ptr<yake::graphics::IGraphicsSystem> create() - { return yake::templates::create_default<yake::graphics::IGraphicsSystem>(); } -}; - -using namespace yake::base; - - // system needs a pure virtual function get_type_info and concrete impl (plugin) needs to use return_type_info - // HOWEVER this is not really useful ... just define the pure virtual function within the interface and the impl - // within the plugin ... or? - template <class Parent> - struct return_type_info - { - virtual const std::type_info & get_type_info() - { return typeid(Parent); } - }; - - // todo: del - struct input_system {}; - struct physics_system {}; - - //struct graphics_system : return_type_info<graphics_system> {}; - struct gui_system : return_type_info<gui_system> {}; - - struct gui_renderer_adapter - { - typedef std::pair<base::type_info, base::type_info> identifier; - }; - - template <class System> - boost::shared_ptr<System> create(const gui_renderer_adapter::identifier & id) - { return boost::shared_ptr<System>(new gui_renderer_adapter()); } - -// ----------------------------------------- -/* automatic initialization */ -namespace // unnamed -{ - - // todo: del, just for constructor order test - template <class Parent> - struct auto_init_system_holder<input_system, Parent> - { - // the user can add an adapter for a gui/renderer combination without changing the code - auto_init_system_holder() - : m_system(create<input_system>()) - { - std::cout << "auto_init_system_holder<input_system, Parent>::auto_init_system_holder()\n"; - } - - boost::shared_ptr<input_system> get_system() - { return m_system; } - - boost::shared_ptr<input_system> m_system; - }; - - template <class Parent> - struct auto_init_system_holder<yake::graphics::IGraphicsSystem, Parent> - { - // the user can add an adapter for a gui/renderer combination without changing the code - auto_init_system_holder() - : m_system(create<yake::graphics::IGraphicsSystem>()) - { - std::cout << "auto_init_system_holder<yake::graphics::IGraphicsSystem, Parent>::auto_init_system_holder()\n"; - } - - boost::shared_ptr<yake::graphics::IGraphicsSystem> get_system() - { return m_system; } - - boost::shared_ptr<yake::graphics::IGraphicsSystem> m_system; - }; - - - // note: you cannot use gui without a graphics system (todo: for win32 gui fake graphics system needed?) - template <class Parent> - struct auto_init_system_holder<gui_system, Parent> - { - // the user can add an adapter for a gui/renderer combination without changing the code - auto_init_system_holder() - : m_system(create<gui_system>()), - m_gui_renderer_adapter( - create<gui_renderer_adapter>( - gui_renderer_adapter::identifier( - static_cast<Parent*>(this)->get_system<yake::graphics::IGraphicsSystem>()->get_type_info(), - m_system->get_type_info()))) - { - std::cout << "auto_init_system_holder<gui_system, Parent>::auto_init_system_holder()\n"; - } - - boost::shared_ptr<gui_system> get_system() - { return m_system; } - - boost::shared_ptr<gui_system> m_system; - boost::shared_ptr<gui_renderer_adapter> m_gui_renderer_adapter; - }; -} // namespace unnamed - -} // namespace common -} // namespace samples -} // namespace yake - -#endif // _YAKE_SAMPLES_COMMON_INIT_GUI_H_ Deleted: trunk/yake/yake/samples/common/initialization.h =================================================================== --- trunk/yake/yake/samples/common/initialization.h 2007-03-15 17:37:57 UTC (rev 1655) +++ trunk/yake/yake/samples/common/initialization.h 2007-03-15 17:38:43 UTC (rev 1656) @@ -1,235 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef _YAKE_SAMPLES_COMMON_INITIALIZATION_H_ -#define _YAKE_SAMPLES_COMMON_INITIALIZATION_H_ - -// stl -#include <vector> -#include <string> -#include <iostream> -// boost -#include <boost/shared_ptr.hpp> -#include <boost/mpl/begin.hpp> -#include <boost/mpl/iterator_range.hpp> -#include <boost/mpl/find.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/next.hpp> -#include <boost/mpl/reverse.hpp> -#include <boost/mpl/lambda.hpp> -// yake -#include <yake/base/mpl/inherit_linear.h> -#include <yake/base/mpl/inherit_multiple.h> -// local -#include "load_libraries.h" - -namespace yake -{ -namespace samples -{ -namespace common -{ - -// todo: fix namespace chaos, if we do "using namespace boost::mpl" ::size_t collides with boost::mpl::size_t?! -using namespace yake::base; -using namespace yake::base::mpl; - -// todo: del -template <class System> -struct create_help -{ - static boost::shared_ptr<System> create() - { return boost::shared_ptr<System>(new System()); } -}; - -// todo: use yake registry -template <class System> -boost::shared_ptr<System> create() -{ return create_help<System>::create(); } - -template <class System> -boost::shared_ptr<System> create(const char * id) -{ return create_help<System>::create(); } - -// ----------------------------------------- -/* automatic initialization */ -namespace // unnamed -{ - // holds a reference to a system and makes it accessable - template <class System, class Parent> - struct auto_init_system_holder - { - auto_init_system_holder() - : m_system(create<System>()) - {} - - boost::shared_ptr<System> get_system() - { return m_system; } - - boost::shared_ptr<System> m_system; - }; -} // namespace unnamed - - -// loads the libraries, initializes the systems and makes them accessable -template <class Config = default_config> -struct auto_init : - private load_libraries<Config>, - private inherit_multiple - < - typename boost::mpl::reverse<Config>::type, // note: correcting initialization order, otherwise graphics system would be initialized after gui - typename boost::mpl::lambda< auto_init_system_holder<boost::mpl::_, auto_init> >::type - >::type -{ - template <class System> - boost::shared_ptr<System> get_system() - { return static_cast<auto_init_system_holder<System, auto_init>*>(this)->get_system(); } -}; - -// ----------------------------------------- -/* delayed automatic initialization */ -// loads the libraries, initializes the systems and makes them accessable (delayed) -template <class Config = default_config> -struct delayed_auto_init -{ -public: // types - typedef load_libraries<Config> Libraries; - typedef typename inherit_multiple - < - typename boost::mpl::reverse<Config>::type, // note: correcting initialization order, otherwise graphics system would be initialized after gui - typename boost::mpl::lambda< auto_init_system_holder<boost::mpl::_, delayed_auto_init> >::type - >::type Systems; - -public: // methods - void initialize() - { - m_libraries.reset(new Libraries()); - m_systems.reset(new Systems()); - } - - template <class System> - boost::shared_ptr<System> get_system() - { return static_cast<auto_init_system_holder<System, delayed_auto_init>*>(m_systems.get())->get_system(); } - -private: // data - boost::shared_ptr<Libraries> m_libraries; - boost::shared_ptr<Systems> m_systems; -}; - -// ----------------------------------------- -/* semi automatic initialization */ -namespace // unnamed -{ - struct semi_init_system_holder_root - { - virtual void load_systems() {} - }; - - template <class Base, class System> - struct semi_init_system_holder : Base - { - void load_systems() - { m_system = create<System>(); Base::load_systems(); } - - boost::shared_ptr<System> get_system() - { return m_system; } - - boost::shared_ptr<System> m_system; - }; -} // namespace unnamed - -template <class Parent, class Config = default_config> -struct semi_auto_init : - private inherit_linear - < - Config, - typename boost::mpl::lambda< semi_init_system_holder<boost::mpl::_, boost::mpl::_> >::ty... [truncated message content] |
From: <psy...@us...> - 2007-03-15 23:38:39
|
Revision: 1664 http://svn.sourceforge.net/yake/?rev=1664&view=rev Author: psyclonist Date: 2007-03-15 16:38:37 -0700 (Thu, 15 Mar 2007) Log Message: ----------- replaced 'function pointer' by 'listener' approach for logging targets, added two logging listeners (stderr_listener, file_listener), disabled default stderr/console logging target, updated samples due to interface changes Modified Paths: -------------- trunk/yake/samples/raf/minimal/yakeDemo.cpp trunk/yake/samples/sampleLog/demo.cpp trunk/yake/src/base/native/Linux/yakeDebug.cpp trunk/yake/src/base/native/win32/yakeDebug.cpp trunk/yake/src/base/yakeLog.cpp trunk/yake/yake/base/native/yakeNative.h trunk/yake/yake/base/yake.h trunk/yake/yake/base/yakeLog.h Added Paths: ----------- trunk/yake/samples/bin/release/ trunk/yake/src/base/yakeFileLog.cpp trunk/yake/src/base/yakeStderrLog.cpp trunk/yake/yake/base/yakeFileLog.h trunk/yake/yake/base/yakeStderrLog.h Modified: trunk/yake/samples/raf/minimal/yakeDemo.cpp =================================================================== --- trunk/yake/samples/raf/minimal/yakeDemo.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/samples/raf/minimal/yakeDemo.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -22,13 +22,12 @@ protected: virtual bool onRun() { - scripting::IVM* pVM = getScriptingSystem("lua")->createVM(); - YAKE_ASSERT( pVM ).debug("We need a valid VM!"); - if (!pVM) + scripting::VMPtr vm = getScriptingSystem("lua")->createVM(); + YAKE_ASSERT( vm ).debug("We need a valid VM!"); + if (!vm) return false; - pVM->execute("print('Hello from script!')"); - delete pVM; + vm->execute("print('Hello from script!')"); return true; } Modified: trunk/yake/samples/sampleLog/demo.cpp =================================================================== --- trunk/yake/samples/sampleLog/demo.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/samples/sampleLog/demo.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -6,6 +6,16 @@ { try { + typedef SharedPtr<logging::log_listener> log_listener_ptr; + + // create and attach log listeners + log_listener_ptr toStdErr( new yake::logging::stderr_listener() ); + yake::logging::addListener( toStdErr.get() ); + + log_listener_ptr toFile( new yake::logging::file_listener("sampleLog.log") ); + yake::logging::addListener( toFile.get() ); + + // log something: yake::logging::setProcessId("demo"); YAKE_LOG_INFORMATION("demo","aloha"); YAKE_LOG_WARNING("demo","aloha"); Modified: trunk/yake/src/base/native/Linux/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -42,6 +42,11 @@ namespace yake { namespace native { +bool debug_Log_available() +{ + return true; +} + void debug_Log( const std::string& what, logging::severity_t sev ) { if (sev <= logging::S_ERROR) Modified: trunk/yake/src/base/native/win32/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeDebug.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/native/win32/yakeDebug.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -139,13 +139,23 @@ void Print( const char * text, WORD wAttributes ) { - AllocConsole(); + //AllocConsole(); // this would actually open a console window... - SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), wAttributes ); + HANDLE outHandle = GetStdHandle( STD_ERROR_HANDLE ); + if (!outHandle) + return; + + CONSOLE_SCREEN_BUFFER_INFO csbiInfo; + ::GetConsoleScreenBufferInfo( outHandle, &csbiInfo ); + + SetConsoleTextAttribute( outHandle, wAttributes ); DWORD dwWritten; - int length = (int)strlen( text ); - ::BOOL bSuccess = WriteConsoleA( GetStdHandle( STD_OUTPUT_HANDLE ), text, ( DWORD )length, &dwWritten, 0 ); + int length = (int)strlen( text ); + ::BOOL bSuccess = WriteConsoleA( outHandle, text, ( DWORD )length, &dwWritten, 0 ); assert( bSuccess ); + + // restore settings + ::SetConsoleTextAttribute( outHandle, csbiInfo.wAttributes ); } private: @@ -153,12 +163,21 @@ static bool consoleApp_; } logConsole_g; +bool debug_Log_available() +{ + return (GetStdHandle( STD_ERROR_HANDLE ) != 0); +} + void debug_Log( const std::string& what, logging::severity_t sev ) { if (what.empty()) return; + //AllocConsole(); // this would actually open a console window... + // save settings HANDLE outHandle = GetStdHandle( STD_ERROR_HANDLE ); + if (!outHandle) + return; CONSOLE_SCREEN_BUFFER_INFO csbiInfo; ::GetConsoleScreenBufferInfo( outHandle, &csbiInfo ); Added: trunk/yake/src/base/yakeFileLog.cpp =================================================================== --- trunk/yake/src/base/yakeFileLog.cpp (rev 0) +++ trunk/yake/src/base/yakeFileLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,53 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#include <yake/base/yakePCH.h> +#include <yake/base/yakeLog.h> +#include <yake/base/yakeFileLog.h> +#include <boost/lexical_cast.hpp> + +namespace yake { +namespace logging { + + file_listener::file_listener(const std::string& fileName) + { + fp_.open(fileName.c_str()); + fp_ << "// format:\n"; + fp_ << "// [processId][logId][threadId] [logLevel] message\n"; + fp_.flush(); + } + file_listener::~file_listener() + { + fp_.close(); + } + void file_listener::write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) + { + formatLogMessage(fp_, sev, msg, logId, procId, threadId ); + fp_.flush(); + } + +} // logging +} // yake Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/yakeLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -31,30 +31,29 @@ namespace yake { namespace logging { - void toStdErr(const severity_t sev, const char* logId, const char* procId, threadid_t threadId, const char* msg) + log_listener::~log_listener() {} + + void formatLogMessage(std::ostream& out, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) { - std::ostringstream ss; - ss << "[" << (procId ? procId : "") << "]"; + out << "[" << (procId ? procId : "") << "]"; - ss << "[" << (logId ? logId : "") << "]"; + out << "[" << (logId ? logId : "") << "]"; - ss << "["; - ss << std::hex << threadId; - ss << "] "; + out << "["; + out << std::hex << threadId; + out << "] "; - ss << "["; - ss << toString(Severity(sev)); + out << "["; + out << toString(Severity(sev)); if (sev >= S_LAST) { - ss << "("; - ss << boost::lexical_cast<std::string>(sev); - ss << ")"; + out << "("; + out << boost::lexical_cast<std::string>(sev); + out << ")"; } - ss << "]"; + out << "]"; - ss << " " << msg << "\n"; - - native::debug_Log( ss.str(), sev ); + out << " " << msg << "\n"; } const char* toString(const Severity sev) @@ -84,19 +83,27 @@ void logger::enableSeverity(const severity_t sev, const bool on) { scoped_lock lock; - instance().enabledSeverities_[ sev ] = on; + this->enabledSeverities_[ sev ] = on; } void logger::enableLog(const char* logId, const bool on) { scoped_lock lock; instance().enabledLogs_[ std::string(logId ? logId : "") ] = on; } - int logger::addTarget(const LogFn fn) + void logger::addListener(log_listener* l) { + if (!l) + return; scoped_lock lock; - instance().targets_.push_back( fn ); - return 1; + instance().targets_.push_back( l ); } + void logger::removeListener(log_listener* l) + { + if (!l) + return; + scoped_lock lock; + instance().targets_.erase( std::find(instance().targets_.begin(), instance().targets_.end(), l) ); + } void logger::log(const severity_t sev, const char *logId, const char *msg) { instance().doLog(sev, logId, msg); @@ -114,10 +121,11 @@ return; const threadid_t threadId = native::getCurrentThreadId(); - TargetFnList::const_iterator itEnd = targets_.end(); - for (TargetFnList::const_iterator it = targets_.begin(); it != itEnd; ++it) + ListenerList::const_iterator itEnd = targets_.end(); + for (ListenerList::const_iterator it = targets_.begin(); it != itEnd; ++it) { - (**it)(sev,logId,instance().procId_.c_str(),threadId,msg); + (*it)->write(sev,msg,logId,procId_.c_str(),threadId); + //(**it)(sev,logId,instance().procId_.c_str(),threadId,msg); } } void logger::setProcessId(const String& pId) @@ -131,7 +139,7 @@ enableLog(0,true); for (severity_t i=0; i<S_LAST; ++i) enableSeverity( i, true ); - addTarget(&toStdErr); + //addTarget(&toStdErr); } } // logging Added: trunk/yake/src/base/yakeStderrLog.cpp =================================================================== --- trunk/yake/src/base/yakeStderrLog.cpp (rev 0) +++ trunk/yake/src/base/yakeStderrLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,54 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#include <yake/base/yakePCH.h> +#include <yake/base/yakeLog.h> +#include <yake/base/yakeStderrLog.h> +#include <yake/base/native/yakeNative.h> +#include <boost/lexical_cast.hpp> + +namespace yake { +namespace logging { + + stderr_listener::stderr_listener() + { + } + stderr_listener::~stderr_listener() + { + } + void stderr_listener::write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) + { + std::ostringstream ss; + formatLogMessage(ss, sev, msg, logId, procId, threadId ); + + if (native::debug_Log_available()) //@todo potential performance problem + native::debug_Log( ss.str(), sev ); + else + std::cerr << ss.str(); + } + +} // logging +} // yake Modified: trunk/yake/yake/base/native/yakeNative.h =================================================================== --- trunk/yake/yake/base/native/yakeNative.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/native/yakeNative.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -46,6 +46,7 @@ // Debugging Interface. YAKE_BASE_API bool debug_AssertFailed( const char* pszMessage, const char* pszCondition, const char* pszFile, int nLine, bool& rbIgnoreAlways ); + YAKE_BASE_API bool debug_Log_available(); YAKE_BASE_API void debug_Log( const std::string& what, logging::severity_t ); YAKE_BASE_API void debug_Print( const char* string ); Modified: trunk/yake/yake/base/yake.h =================================================================== --- trunk/yake/yake/base/yake.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/yake.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -52,6 +52,8 @@ #include "yakeString.h" #include "yakeException.h" #include "yakeLog.h" +#include "yakeStderrLog.h" +#include "yakeFileLog.h" #include "yakeOutputStream.h" #include "yakeUniqueName.h" #include "yakePlugin.h" Added: trunk/yake/yake/base/yakeFileLog.h =================================================================== --- trunk/yake/yake/base/yakeFileLog.h (rev 0) +++ trunk/yake/yake/base/yakeFileLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,48 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_LOGGING_FILE_LOG_H +#define YAKE_LOGGING_FILE_LOG_H + +#include <yake/base/yakeLog.h> +#include <fstream> + +namespace yake { +namespace logging { + + struct YAKE_BASE_API file_listener : public log_listener + { + file_listener(const std::string& fileName); + virtual ~file_listener(); + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + private: + std::ofstream fp_; + }; +} // namespace logging +} // namespace yake + +#endif // YAKE_LOGGING_FILE_LOG_H + Modified: trunk/yake/yake/base/yakeLog.h =================================================================== --- trunk/yake/yake/base/yakeLog.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/yakeLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -57,30 +57,41 @@ //helper: YAKE_BASE_API const char* toString(const Severity sev); + YAKE_BASE_API void formatLogMessage(std::ostream&, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); - /** severity, processId, threadId, message */ - typedef void(*LogFn)(const severity_t, const char*, const char*, threadid_t, const char*); + /** */ + struct YAKE_BASE_API log_listener : public boost::noncopyable + { + virtual ~log_listener() = 0; + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) = 0; + }; + + /** */ struct YAKE_BASE_API logger : public boost::noncopyable { //YAKE_BUILD_PHOENIX_SINGLETON(logger) //public private: //Make it private if PHOENIX is not used! logger(); - static logger& instance(); static logger instance_; public: + static logger& instance(); //static void log(const severity_t, const char* env, const char* src, const char* msg); - static void log(const severity_t, const char* logId, const char* msg); - static void setProcessId(const String&); - static int addTarget(const LogFn); - static void enableSeverity(const severity_t, const bool); - static void enableLog(const char* logId, const bool); + void log(const severity_t, const char* logId, const char* msg); + void setProcessId(const String&); + + /** @note Ownership is not transferred! */ + void addListener(log_listener*); + void removeListener(log_listener*); + + void enableSeverity(const severity_t, const bool); + void enableLog(const char* logId, const bool); private: //void doLog(const severity_t, const char* env, const char* msg); void doLog(const severity_t, const char* logId, const char* msg); private: String procId_; - typedef std::vector<LogFn> TargetFnList; - TargetFnList targets_; + typedef std::vector<log_listener*> ListenerList; + ListenerList targets_; typedef std::map<severity_t,bool> EnableMap; EnableMap enabledSeverities_; typedef std::map<std::string,bool> EnableLogIdMap; @@ -108,7 +119,7 @@ { std::stringstream ss; ss << LOG_TYPE(rhs); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2> inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2) @@ -116,7 +127,7 @@ std::stringstream ss; ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2, typename T3> inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2, const T3& rhs3) @@ -125,26 +136,30 @@ ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); ss << LOG_TYPE(rhs3); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } // short cuts inline void setProcessId(const String& procId) { - logger::setProcessId(procId); + logger::instance().setProcessId(procId); } inline void enableSeverity(const severity_t sev, const bool on) { - logger::enableSeverity(sev,on); + logger::instance().enableSeverity(sev,on); } inline void enableLog(const char* logId, const bool on) { - logger::enableLog(logId,on); + logger::instance().enableLog(logId,on); } - inline void addTarget(const LogFn fn) + inline void addListener(log_listener* l) { - logger::addTarget(fn); + logger::instance().addListener(l); } + inline void removeListener(log_listener* l) + { + logger::instance().removeListener(l); + } // helper stream operators inline std::ostream& operator << (std::ostream& out, const std::exception& rhs) Added: trunk/yake/yake/base/yakeStderrLog.h =================================================================== --- trunk/yake/yake/base/yakeStderrLog.h (rev 0) +++ trunk/yake/yake/base/yakeStderrLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,48 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_LOGGING_STDERR_LOG_H +#define YAKE_LOGGING_STDERR_LOG_H + +#include <yake/base/yakeLog.h> +#include <fstream> + +namespace yake { +namespace logging { + + /** */ + struct YAKE_BASE_API stderr_listener : public log_listener + { + stderr_listener(); + virtual ~stderr_listener(); + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + }; + +} // namespace logging +} // namespace yake + +#endif // YAKE_LOGGING_STDERR_LOG_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 00:02:22
|
Revision: 1673 http://svn.sourceforge.net/yake/?rev=1673&view=rev Author: psyclonist Date: 2007-03-15 17:02:15 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added default logging to file Modified Paths: -------------- trunk/yake/src/raf/yakeApplication.cpp trunk/yake/yake/raf/yakeApplication.h Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2007-03-15 23:53:24 UTC (rev 1672) +++ trunk/yake/src/raf/yakeApplication.cpp 2007-03-16 00:02:15 UTC (rev 1673) @@ -335,11 +335,20 @@ #endif bool Application::initialise() { + // register logging target + mLogListeners.push_back( log_listener_ptr( new logging::file_listener("raf.log") ) ); + logging::addListener( mLogListeners.back().get() ); + + YAKE_LOG_INFORMATION("raf","Initialising application..."); + + // + YAKE_LOG_INFORMATION("raf","loading configuration..."); ApplicationConfiguration& cfg = getConfiguration(); mUseExtGraphicsSystem = cfg.useExternalGraphicsSystem().get() != 0; // load libs + YAKE_LOG_INFORMATION("raf","loading libraries..."); StringVector libs = cfg.getLibraries(); ConstVectorIterator<StringVector> itLib( libs ); while (itLib.hasMoreElements()) @@ -348,6 +357,7 @@ } // load & init systems + YAKE_LOG_INFORMATION("raf","loading and initialising systems..."); loadAndInitSystems<scripting::IScriptingSystem>( cfg.getScriptingSystems(), mScriptingSystems ); loadAndInitSystems<audio::IAudioSystem>( cfg.getAudioSystems(), mAudioSystems ); if (mUseExtGraphicsSystem) @@ -370,18 +380,22 @@ #endif // application state machine + YAKE_LOG_INFORMATION("raf","initialising application machine..."); mMachine = new AppMachine(); YAKE_ASSERT( mMachine ); if (!mMachine) return false; + YAKE_LOG_INFORMATION("raf","creating main application state..."); mMainState = createMainState(); YAKE_ASSERT( mMainState ); if (!mMainState) return false; + YAKE_LOG_INFORMATION("raf","main application state created."); mMachine->addState( "main", mMainState ); mMachine->addState( "dead", new ApplicationState(*this) ); // user application init + YAKE_LOG_INFORMATION("raf","finalizing application initialisation..."); if (!onInitialise()) { // clean up @@ -391,8 +405,10 @@ } bool Application::shutdown() { + YAKE_LOG_INFORMATION("raf","shutting down..."); bool ret = onShutdown(); + YAKE_LOG_INFORMATION("raf","shutting down machine..."); YAKE_ASSERT( mMachine ); if (mMachine) { @@ -408,6 +424,7 @@ YAKE_SAFE_DELETE( mCeguiRendererAdapter ); } #endif + YAKE_LOG_INFORMATION("raf","shutting down systems..."); YAKE_SAFE_DELETE( mKeyboardEventGenerator ); YAKE_SAFE_DELETE( mMouseEventGenerator ); mInputSystems.clear(); @@ -417,6 +434,12 @@ mScriptingSystems.clear(); mLibs.clear(); + // + YAKE_LOG_INFORMATION("raf","removing logger."); + YAKE_FOR_EACH(LogListeners::iterator,itLogListener,mLogListeners) + logging::removeListener( (*itLogListener).get() ); + mLogListeners.clear(); + return ret; } bool Application::run() @@ -425,6 +448,7 @@ } bool Application::onRun() { + YAKE_LOG_INFORMATION("raf","Application::onRun()"); YAKE_ASSERT( mMachine ); if (!mMachine) return false; @@ -443,6 +467,7 @@ } base::Library* Application::loadLibrary( const String& file ) { + YAKE_LOG_INFORMATION("raf","attempting to load '" + file + "'..."); YAKE_ASSERT( !file.empty() ); if (file.empty()) return 0; @@ -453,6 +478,7 @@ return 0; mLibs.push_back( pDynLib ); + YAKE_LOG_INFORMATION("raf","'" + file + "' loaded."); return pDynLib.get(); } scripting::IScriptingSystem* Application::getScriptingSystem(const String& name) Modified: trunk/yake/yake/raf/yakeApplication.h =================================================================== --- trunk/yake/yake/raf/yakeApplication.h 2007-03-15 23:53:24 UTC (rev 1672) +++ trunk/yake/yake/raf/yakeApplication.h 2007-03-16 00:02:15 UTC (rev 1673) @@ -207,6 +207,9 @@ bool mCeguiMouseInputEnabled; bool mCeguiKeyboardInputEnabled; #endif + typedef SharedPtr<logging::log_listener> log_listener_ptr; + typedef std::deque<log_listener_ptr> LogListeners; + LogListeners mLogListeners; }; /** An example base application class provided for convenience. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:42:56
|
Revision: 1679 http://svn.sourceforge.net/yake/?rev=1679&view=rev Author: psyclonist Date: 2007-03-15 19:42:57 -0700 (Thu, 15 Mar 2007) Log Message: ----------- fixed various issues related to logging, DLL handling, exceptions Modified Paths: -------------- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp trunk/yake/samples/common/exapp/yakeExampleApplication.h trunk/yake/samples/gui/console/yakeConsoleDemo.cpp trunk/yake/samples/net/packet/demo.cpp trunk/yake/samples/physics/demo/yakeDemo.cpp trunk/yake/src/base/native/win32/yakeConfig.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h Removed Paths: ------------- trunk/yake/samples/net/packet/pch.cpp trunk/yake/samples/physics/demo/pch.cpp Modified: trunk/yake/samples/cmdrmayhem/yakeDemo.cpp =================================================================== --- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -247,8 +247,9 @@ using namespace input; // load key<->action bindings - ActionMap::loadFromFile( actionMap, "../../media/samples/character/demo.actionmap.txt", keyboard, - boost::bind(&ControllableCharacter::addInputConditionConnection,this,_1) ); + if (!ActionMap::loadFromFile( actionMap, "../../../common/media/samples/character/demo.actionmap.txt", keyboard, + boost::bind(&ControllableCharacter::addInputConditionConnection,this,_1) )) + throw Exception("could not load action map"); // bind functions/callbacks to input actions this->addInputSignalConnection( Modified: trunk/yake/samples/common/exapp/yakeExampleApplication.h =================================================================== --- trunk/yake/samples/common/exapp/yakeExampleApplication.h 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/common/exapp/yakeExampleApplication.h 2007-03-16 02:42:57 UTC (rev 1679) @@ -57,6 +57,7 @@ SharedPtr< input::IInputSystem > mInputSystem; SharedPtr< audio::IAudioSystem > mAudioSystem; bool mShutdownRequested; + SharedPtr< logging::log_listener > mFileLogger; protected: input::KeyboardEventGenerator mKeyboardEventGenerator; input::MouseEventGenerator mMouseEventGenerator; @@ -81,12 +82,16 @@ mLoadScriptingBindings( loadScriptingBindings ), mLoadAudioSystem( loadAudio ) { + mFileLogger.reset( new logging::file_listener("exapp.log") ); + logging::addListener( mFileLogger.get() ); } virtual ~ExampleApplication() { destroyAllSystems(); unloadAllPlugins(); + logging::removeListener( mFileLogger.get() ); + mFileLogger.reset(); } void requestShutdown() Modified: trunk/yake/samples/gui/console/yakeConsoleDemo.cpp =================================================================== --- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -40,15 +40,12 @@ // Yake #include <yake/base/yake.h> -#include <yake/base/yakeDebugOutputStream.h> -#include <yake/base/yakeLog.h> -#include <yake/base/yakeLibrary.h> #include <yake/scripting/yakeScriptingSystem.h> #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <yake/graphics/yakeGraphicsSystem.h> +#include <yake/data/yakeData.h> -#include <yake/samples/common/yakeExampleApplication.h> -#include <yake/data/yakeData.h> +#include <samples/common/exapp/yakeExampleApplication.h> #include <yake/common/yakeCEGUIRendererAdapter.h> #include <yake/common/yakeCEGUIHelpers.h> #include <yake/model/model.h> @@ -318,12 +315,12 @@ if (mListBox) mConsole.setOutputWidget( mListBox ); - yake::scripting::IVM* pVM = getScriptingSystem().createVM(); - YAKE_ASSERT( pVM ); + yake::scripting::VMPtr vm = getScriptingSystem().createVM(); + YAKE_ASSERT( vm ); - mConsole.setScriptingVirtualMachine( pVM ); + mConsole.setScriptingVirtualMachine( vm ); - scripting::LuaVM* pL = static_cast<scripting::LuaVM*>( pVM ); + scripting::LuaVM* pL = static_cast<scripting::LuaVM*>( vm.get() ); YAKE_ASSERT( pL ); if (!pL) return; @@ -350,8 +347,8 @@ // executing console initialisation script //pL->execute( "dofile( '../../../media/gui.addons.scripts/console_redirect.lua' );" ); - SharedPtr<scripting::IScript> script( getScriptingSystem().createScriptFromFile("../../../common/media/gui.addons.scripts/console_redirect.lua")); - pL->execute( script.get() ); + scripting::ScriptPtr script( getScriptingSystem().createScriptFromFile("../../../common/media/gui.addons.scripts/console_redirect.lua")); + pL->execute( script ); } /** @@ -503,11 +500,16 @@ theApp.initialise(); theApp.run(); } - catch ( const yake::Exception& rException ) + catch ( yake::Exception& rException ) { YAKE_LOG_ERROR( "demo", rException.what() ); std::cin.get(); } + catch ( ... ) + { + YAKE_LOG_ERROR( "demo", "Caught unhandled exception." ); + std::cin.get(); + } return 0; } Modified: trunk/yake/samples/net/packet/demo.cpp =================================================================== --- trunk/yake/samples/net/packet/demo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/net/packet/demo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1,7 +1,7 @@ -#include <yake/samples/net/packet/pch.h> +#include <yake/base/yakePrerequisites.h> #include <yake/net/net.h> #include <yake/base/yake.h> // for YAKE_ASSERT etc -#include <yake/samples/net/common/common.h> +#include <boost/bind.hpp> using namespace yake; @@ -111,8 +111,13 @@ YAKE_LOG_INFORMATION_X(" client " << peerId << " packet(size=" << pckt->payload().size() << ") on channel " << int(channel) << "\n"); } +#include <yake/base/yakeStderrLog.h> + int main(int argc, char* argv[]) { + SharedPtr<logging::log_listener> to_stderr( new logging::stderr_listener() ); + logging::addListener( to_stderr.get() ); + net::initialize(); // server @@ -136,9 +141,12 @@ //net::native::sleep(500); // unfortunately, this is still necessary... // main loop - YAKE_LOG("demo","waiting for key press..."); + YAKE_LOG("demo","(running for 5 seconds...)"); bool sentHello = false; - while (!_kbhit()) + size_t time = 0; + net::Timer t; + t.start(); + while (t.getTime() < 5.) { net::native::sleep(10); net::update(); @@ -150,8 +158,6 @@ sentHello = true; } } - if (_kbhit()) - _getch(); // cleanup YAKE_LOG("demo","stopping clients...\n"); Deleted: trunk/yake/samples/net/packet/pch.cpp =================================================================== --- trunk/yake/samples/net/packet/pch.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/net/packet/pch.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1 +0,0 @@ -#include <yake/samples/net/packet/pch.h> Deleted: trunk/yake/samples/physics/demo/pch.cpp =================================================================== --- trunk/yake/samples/physics/demo/pch.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/physics/demo/pch.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1 +0,0 @@ -#include <yake/samples/physics/demo/pch.h> Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1,4 +1,4 @@ -#include <yake/samples/physics/demo/pch.h> +#include <yake/base/yake.h> #include <yake/graphics/yakeGraphicsSystem.h> #include <yake/physics/yakePhysics.h> @@ -237,7 +237,7 @@ // physics 2 #ifdef USE_SECOND_PHYSICS_PLUGIN - pLib = loadLib("physicsNX" ); + SharedPtr<base::Library> pLib2 = loadLib("physicsNX" ); YAKE_ASSERT( pLib ).debug("Cannot load physics plugin 2."); mPhysics2 = templates::create< physics::IPhysicsSystem >("nx"); @@ -249,8 +249,8 @@ #endif // graphics - pLib = loadLib(YAKE_DYNLIB_NAME("graphicsOgre")); - YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); + SharedPtr<base::Library> pLibG = loadLib(YAKE_DYNLIB_NAME("graphicsOgre")); + YAKE_ASSERT( pLibG ).debug("Cannot load graphics plugin."); mGraphics = templates::create_default< graphics::IGraphicsSystem >(); YAKE_ASSERT( mGraphics ).debug("Cannot create graphics system."); @@ -482,7 +482,7 @@ #endif } -int main() +int main(int,char**) { try { Modified: trunk/yake/src/base/native/win32/yakeConfig.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeConfig.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/src/base/native/win32/yakeConfig.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -49,7 +49,6 @@ } // yake #pragma message("WARNING: g_hInstance is not set") -#if defined(_DLL) && 0 BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID ) { if( dwReason == DLL_PROCESS_ATTACH ) @@ -57,4 +56,3 @@ return TRUE; } -#endif Modified: trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -180,6 +180,7 @@ catch (Ogre::Exception& e) { mReady = false; + YAKE_LOG_ERROR("graphicsOgre",e.getFullDescription().c_str()); YAKE_GRAPHICS_EXCEPT2(e.getFullDescription().c_str(), "[yake.graphics.ogre] OGRE EXCEPTION"); } } Modified: trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h =================================================================== --- trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h 2007-03-16 02:42:57 UTC (rev 1679) @@ -48,7 +48,7 @@ * Set scripting virtual machine to use as input interpreter * @param pLuaVM Pointer to Lua virtual machine */ - void setScriptingVirtualMachine( yake::scripting::IVM* pLuaVM ) + void setScriptingVirtualMachine( yake::scripting::VMPtr pLuaVM ) { YAKE_ASSERT( pLuaVM != NULL ).error( "Oh no! How could you do that?!! Monster!" ); lua_ = pLuaVM; @@ -66,7 +66,7 @@ private: /// Pointer to Lua scripting VM - yake::scripting::IVM* lua_; + yake::scripting::VMPtr lua_; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:46:10
|
Revision: 1681 http://svn.sourceforge.net/yake/?rev=1681&view=rev Author: psyclonist Date: 2007-03-15 19:46:10 -0700 (Thu, 15 Mar 2007) Log Message: ----------- scons replaced by premake Removed Paths: ------------- trunk/yake/SConstruct trunk/yake/autogen.sh trunk/yake/build.py trunk/yake/buildspec.xml Deleted: trunk/yake/SConstruct =================================================================== --- trunk/yake/SConstruct 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/SConstruct 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,140 +0,0 @@ -print """ - ################################################# - # # - # SCons build system......... # - # # - # Project Yake @ www.yake.org # - # # - ################################################# - """ - -title = "Builder for Yake" -last_modified = "on 01/11/2005 by Nikita Buida (mj)" - - -print title -print 'This file was last modified ', last_modified - -Help( """ - Usage. - Issue - % scons - shell command. That will build all targets - defined in buildspec.xml - - To install libraries to LibInstallDir (see buildspec.xml) type - # scons install - as root. - - That's it. Enjoy. Find some bugs, improve program, send a patch ;) - -""" ) - -import build - -import os -import os.path -import sys -import glob - -cc_flags = '-DGCC_3_1 -DEXT_HASH -DYAKE_DEBUG -DYAKE_DEBUG_BUILD' - -# optimization flags -optimization_flags = ' -O3 ' - -# debug flag. -g[Level] -debug_flags = ' -g2 -O0' - -# if you want to profile with GNU gprof -profiler_flags = ' -pg ' - -# if you want to test code coverage with GNU gcov -code_coverage_flags = ' -fprofile-arcs -ftest-coverage ' - - -lib_includes = build.commonIncludes -build_dir = build.commonPaths['ObjectDir'] -bin_build_dir = build.commonPaths['ProgramInstallDir'] -lib_dir = build.commonPaths['LibDir'] -lib_install_dir = build.commonPaths['LibInstallDir'] - -print 'Common object dir is:', build.commonPaths['ObjectDir'] -print 'Build dir is', build_dir - -BuildDir( build_dir, '.', duplicate = 0 ) - -cc_flags += debug_flags - -env = Environment( CCFLAGS = cc_flags ) - -####################################################### -# utility functions -####################################################### -def CollectSources( path ): - sources = glob.glob( path + '/' + '*.cpp' ) - sources_build = [] - for src_name in sources: - sources_build.append( build_dir + '/' + src_name ) - return sources_build - -def BuildLibrary( name, path, link_to ): - """ Builds shared library """ - - lib_sources_build = CollectSources( path ) - lib_name = build_dir + '/' + name - return env.SharedLibrary( lib_name, lib_sources_build, CPPPATH = lib_includes, LIBS = link_to, LIBPATH = lib_dir ) - -def BuildProgram( name, path, link_to ): - bin_src = CollectSources( path ) - bin_name = bin_build_dir + '/' + name - return env.Program( bin_name, bin_src, CPPPATH = lib_includes, LIBS = link_to, LIBPATH = lib_dir ) - -###################################################### - -#Library add handling -libadds = {} - -def processLibadds( ent_libadd ): - result = [] - for la in ent_libadd: - if libadds.has_key( la ): - result = result + libadds[ la ] - else: - result.append( la ) - return result - - -# if command line target is specified -if len( COMMAND_LINE_TARGETS ) <> 0 and 'install' not in COMMAND_LINE_TARGETS: - print 'COMMAND_LINE_TARGETS: ', map(str, COMMAND_LINE_TARGETS) - object_name = str( COMMAND_LINE_TARGETS[0] ) - object = env.Object( build_dir + '/' + object_name, CPPPATH = lib_includes ) - env.Alias( object_name, object ) -else: - # else continue with normal build or install - #Collection of libraries to install - yakeLibs = [] - - - #reading shared libs - for name, buildentity in build.sharedLibs.iteritems(): - libadd = processLibadds( buildentity.libadd ) - ent_name = str(name) - yakeLibs.append( BuildLibrary( ent_name, str(buildentity.src), libadd )) - libadds[ ent_name ] = libadd + [ ent_name ] - - #reading programs libs - for name, buildentity in build.programs.iteritems(): - - if not build.quiet: - print name, buildentity, buildentity.src, buildentity.libadd - - libadd = processLibadds( buildentity.libadd ) - ent_name = str(name) - BuildProgram( ent_name, str(buildentity.src), libadd ) - - #handle install - env.Install( lib_install_dir, yakeLibs ) - env.Alias( 'install', lib_install_dir ) - - Deleted: trunk/yake/autogen.sh =================================================================== --- trunk/yake/autogen.sh 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/autogen.sh 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,8 +0,0 @@ -#!/bin/bash - -libtoolize --force --copy -aclocal -autoheader -automake -a -autoconf - Deleted: trunk/yake/build.py =================================================================== --- trunk/yake/build.py 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/build.py 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,206 +0,0 @@ -#!/usr/bin/python - -# global variable controlling verboseness -quiet = True - -# Dictionary with common paths -commonPaths = { 'ObjectDir':'obj' } - -commonIncludes = [] - -# Utility lists of strings are stored here -listsSet = {} - -# Dictionary containing all shared libs BuildEntities -sharedLibs = {} -programs = {} - -def setCommonLibInstallDir( dir ): - if not quiet: - print 'Setting common lib install dir to', dir - - commonPaths['LibInstallDir'] = str(dir) - - -def setCommonProgramInstallDir( dir ): - if not quiet: - print 'Setting common program install dir to', dir - - commonPaths['ProgramInstallDir'] = str(dir) - - -def setCommonObjectDir( dir ): - if not quiet: - print 'Setting common object dir to', dir - - commonPaths['ObjectDir'] = str(dir) - -def setCommonLibDir( dir ): - if not quiet: - print 'Setting common lib dir to', dir - - commonPaths['LibDir'] = str(dir) - -class BuildEntity: - """ Class representing build entity (program, lib, shared lib)""" - src = '' - libadd = [] - - def __init__( self ): - self.src = '' - self.libadd = [] - - -def readAllTextElemsToList( src_node, tagName ): - val_list = [] - elems = src_node.getElementsByTagName( tagName ) - for idx in range( elems.length ): - val = elems.item( idx ).firstChild.nodeValue - val_list.append( str(val) ) - if not quiet: - print val - return val_list - -def readListsFromElement( src_elem ): - """ Reads all lists defined as <List>...</List> into listsSet storage """ - if not quiet: - print 'Reading lists...' - - lists = src_elem.getElementsByTagName( 'List' ) - for idx in range( lists.length ): - lst = lists.item( idx ) - lst_name = lst.attributes.item(0).nodeValue #only one name - - if not quiet: - print 'Adding list', lst_name - - items = readAllTextElemsToList( lst, 'item' ) - listsSet[ lst_name ] = items - - -def readProgramInstructions( src_element ): - """ Reads program build instructions """ - - -def readSharedLibsInstructions( src_element ): - """ Reads shared libs build instructions """ - - if not quiet: - print 'Reading shared libs build instructions...' - - so_libs = src_element.getElementsByTagName( 'BuildSharedLibrary' ) - for idx in range( so_libs.length ): - so_lib = so_libs.item( idx ) - lib_name = '' - lib_src = '' - for at_idx in range( so_lib.attributes.length ): - attr = so_lib.attributes.item( at_idx ) - if attr.name == 'name': - lib_name = attr.nodeValue - if not quiet: - print 'Library:', lib_name - elif attr.name == 'src': - lib_src = attr.nodeValue - if not quiet: - print 'Library src:', lib_src - - libadds = [] - - libadds_spec = readAllTextElemsToList( so_lib, 'libadd' ) - - for la in libadds_spec: - if listsSet.has_key( la ): - if not quiet: - print 'Loading libadd from list', la, 'it is:', listsSet[ la ] - libadds = libadds + listsSet[ la ] - else: - libadds.append( la ) - - - lib = BuildEntity() - lib.src = lib_src - lib.libadd = libadds - #adding to dictionary - sharedLibs[ lib_name ] = lib - - -def readProgramInstructions( src_element ): - """ Reads program build instructions """ - - if not quiet: - print 'Reading program build instructions...' - - so_libs = src_element.getElementsByTagName( 'BuildProgram' ) - for idx in range( so_libs.length ): - so_lib = so_libs.item( idx ) - lib_name = '' - lib_src = '' - for at_idx in range( so_lib.attributes.length ): - attr = so_lib.attributes.item( at_idx ) - if attr.name == 'name': - lib_name = attr.nodeValue - if not quiet: - print 'Program:', lib_name - elif attr.name == 'src': - lib_src = attr.nodeValue - if not quiet: - print 'Program src:', lib_src - - libadds = [] - - libadds_spec = readAllTextElemsToList( so_lib, 'libadd' ) - - for la in libadds_spec: - if listsSet.has_key( la ): - if not quiet: - print 'Loading libadd from list', la, 'it is:', listsSet[ la ] - libadds = libadds + listsSet[ la ] - else: - libadds.append( la ) - - - lib = BuildEntity() - lib.src = lib_src - lib.libadd = libadds - #adding to dictionary - programs[ lib_name ] = lib - - -def readBuildInstructions( src_element ): - if not quiet: - print 'Reading build instructions...' - - readSharedLibsInstructions( src_element ) - readProgramInstructions( src_element ) - - - - -# Actual parsing occurs here -import xml.dom.minidom - -dom = xml.dom.minidom.parse( 'buildspec.xml' ) - -if not quiet: - print 'Reading root element', dom.documentElement.tagName - -common = dom.documentElement.getElementsByTagName( 'Common' )[0] #assuming only one Common - -commonAttribs = common.attributes - -for at_index in range( commonAttribs.length ): - at = commonAttribs.item( at_index ) - - if at.name == 'LibInstallDir': - setCommonLibInstallDir( at.nodeValue ) - elif at.name == 'ProgramInstallDir': - setCommonProgramInstallDir( at.nodeValue ) - elif at.name == 'ObjectDir': - setCommonObjectDir( at.nodeValue ) - elif at.name == 'LibDir': - setCommonLibDir( at.nodeValue ) - -commonIncludes = readAllTextElemsToList( common, 'include' ) -readListsFromElement( dom.documentElement ) -readBuildInstructions( dom.documentElement ) - Deleted: trunk/yake/buildspec.xml =================================================================== --- trunk/yake/buildspec.xml 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/buildspec.xml 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,466 +0,0 @@ -<BuildSpec> - <Common - LibInstallDir="/usr/local/lib" - ProgramInstallDir="common/bin" - ObjectDir="build" - LibDir="build" - > - - <include>dependencies</include> - <include>.</include> - <include>dependencies/OGRE</include> - <include>dependencies/PLSM</include> - <include>dependencies/ode/include</include> - <include>dependencies/luabind</include> - <include>/usr/include/CEGUI</include> - <include>/usr/local/include/CEGUI</include> - </Common> - - <!-- One can define lists of strings to be used later --> - <List name="dynamic_loader" > - <item>dl</item> - </List> - - <BuildSharedLibrary - name="yakeNative" - src="src/yake/base/native/Linux" - > - <libadd>dynamic_loader</libadd> - - </BuildSharedLibrary> - - <!-- YAKE core libraries... --> - <BuildSharedLibrary - name="yakeTemplates" - src="src/yake/base/templates" - > - <libadd>yakeNative</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeMath" - src="src/yake/base/math" - /> - - <BuildSharedLibrary - name="yakeBase" - src="src/yake/base" - > - <libadd>yakeNative</libadd> - <libadd>yakeTemplates</libadd> - <libadd>yakeMath</libadd> - <libadd>boost_signals</libadd> - - </BuildSharedLibrary> - - - <BuildSharedLibrary - name="yakeAudio" - src="src/yake/audio" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="depTinyXML" - src="dependencies/tinyxml" - > - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeData" - src="src/yake/data" - > - <libadd>yakeBase</libadd> - <libadd>depTinyXML</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeGraphics" - src="src/yake/graphics" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeInput" - src="src/yake/input" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakePhysics" - src="src/yake/physics" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeScripting" - src="src/yake/scripting" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> -<!--@todo yakeNet - <BuildSharedLibrary - name="yakeNet" - src="src/yake/net" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> ---> - <BuildSharedLibrary - name="yakeLoader" - src="src/yake/loader" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - - - <BuildSharedLibrary - name="yakeModel" - src="src/yake/model" - > - <libadd>yakeBase</libadd> - <libadd>yakeLoader</libadd> - </BuildSharedLibrary> - - - <!-- Uncomment if you want to use it :D - <BuildSharedLibrary - name="yakeThread" - src="src/yake/thread" - > - <libadd>yakeBase</libadd> - <libadd>ZThread</libadd> - </BuildSharedLibrary> - --> - - <!-- doesn't contain any files - <BuildSharedLibrary - name="yakeStatemachine" - src="src/yake/statemachine" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - --> - - <!-- doesn't contain any files - <BuildSharedLibrary - name="yakeObject" - src="src/yake/object" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yakeEnt" - src="src/yake/ent" - > - <libadd>yakeBase</libadd> - <!--<libadd>yakeObject</libadd>--> - <!--<libadd>yakeStatemachine</libadd>--> - </BuildSharedLibrary> - -<!-- - <BuildSharedLibrary - name="yakeEntLua" - src="src/yake/plugins/entLua" - > - <libadd>yakeBase</libadd> - <libadd>yakeEnt</libadd> - <libadd>lua</libadd> - <libadd>luabind</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeRx" - src="src/yake/rx" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> ---> -<!-- - <BuildSharedLibrary - name="yakeaudioOpenAL" - src="src/yake/plugins/audioOpenAL" - > - <libadd>openalpp</libadd> - <libadd>yakeAudio</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakegraphicsOgre" - src="src/yake/plugins/graphicsOgre" - > - <libadd>yakeGraphics</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeinputOgre" - src="src/yake/plugins/inputOgre" - > - <libadd>yakeInput</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> ---> - <BuildSharedLibrary - name="yakephysicsODE" - src="src/yake/plugins/physicsODE" - > - <libadd>yakePhysics</libadd> - <libadd>ode</libadd> - </BuildSharedLibrary> -<!-- - <BuildSharedLibrary - name="yakescriptingLua" - src="src/yake/plugins/scriptingLua" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> ---> - <!-- TODO Rename this thing? --> - <BuildSharedLibrary - name="yakescriptingBindingsLua" - src="src/yake/plugins/scriptingLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - - <!--@todo reenable. it just took so long to compile/link ... - <BuildSharedLibrary - name="yakegraphicsLuaBindings" - src="src/yake/plugins/graphicsLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yakebaseLuaBindings" - src="src/yake/plugins/baseLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappBase" - src="src/yapp/base" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeLoader" - src="src/yake/loader" - > - <libadd>yappBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeModel" - src="src/yake/model" - > - <libadd>yakeBase</libadd> - <libadd>yakeLoader</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yappMsg" - src="src/yapp/msg" - > - <libadd>yappBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappVehicle" - src="src/yapp/vehicle" - > - <libadd>yappBase</libadd> - <libadd>yakephysicsODE</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappraf" - src="src/yapp/raf" - > - <libadd>yappBase</libadd> - <!-- - <libadd>yakeCEGUIOgreAdapter</libadd> - <libadd>CEGUIOgreRenderer</libadd> - --> - </BuildSharedLibrary> -<!-- - <BuildSharedLibrary - name="yakeCEGUIOgreAdapter" - src="src/yapp/plugins/ceguiOgreRendererAdapter" - > - <libadd>CEGUIBase</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> ---> - <!--<BuildSharedLibrary - name="yappEntLua" - src="src/yapp/plugins/entLua" - > - <libadd>yappEnt</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappmodelLuaBindings" - src="src/yapp/plugins/modelLuaBindings" - > - <libadd>luabind</libadd> - </BuildSharedLibrary> - --> -<!-- - <BuildSharedLibrary - name="yappTerrainPhysicsManager" - src="src/yapp/plugins/terrainPhysMgr" - > - <libadd>PagingLandscape</libadd> - </BuildSharedLibrary> ---> -<!-- SAMPLES --> - <List name="common_libs"> - <item>yakeBase</item> - <item>yakeAudio</item> - <item>yakeGraphics</item> - <item>yakeInput</item> - <item>yakePhysics</item> - <item>yakeData</item> - <item>yakeScripting</item> - </List> - - <BuildProgram - name="DemoDebug" - src="src/yake/samples/base/debug" - > - <libadd>common_libs</libadd> - </BuildProgram> - -<!-- - <BuildProgram - name="GraphicsDemo" - src="src/yake/samples/graphics/demo" - > - <libadd>common_libs</libadd> - </BuildProgram> ---> - <!-- - <BuildProgram - name="DotSceneGraphicsDemo" - src="src/yapp/samples/graphics/dotScene" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - </BuildProgram> - - <BuildProgram - name="XODELoaderDemo" - src="src/yapp/samples/model/XODE" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappLoader</libadd> - </BuildProgram> - - <BuildProgram - name="dotLinkLoaderDemo" - src="src/yapp/samples/model/dotLink" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappLoader</libadd> - </BuildProgram> - --> - - <!-- - <BuildProgram - name="roserver" - src="src/yake/samples/net/roserver" - > - <libadd>common_libs</libadd> - </BuildProgram> - - <BuildProgram - name="roclient" - src="src/yake/samples/net/roclient" - > - <libadd>common_libs</libadd> - </BuildProgram> ---> -<!-- - <BuildProgram - name="VehicleDemo" - src="src/yapp/samples/base/vehicle" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - </BuildProgram> - - <BuildProgram - name="sampleEntFSM" - src="src/yake/samples/ent/sampleEntFsm" - > - <libadd>common_libs</libadd> - <libadd>yakeEnt</libadd> - <libadd>yakeEntLua</libadd> - <libadd>yakescriptingLua</libadd> - </BuildProgram> ---> - -<!-- - <BuildProgram - name="TerrainDemo" - src="src/yapp/samples/ode_terrain_demo" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappStatemachine</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - <libadd>PagingLandscape</libadd> - <libadd>yappTerrainPhysicsManager</libadd> - <libadd>dl</libadd> - </BuildProgram> - - <BuildProgram - name="consoleDemo" - src="src/yapp/samples/gui/console" - > - <libadd>common_libs</libadd> - <libadd>yakeCEGUIOgreAdapter</libadd> - <libadd>lua</libadd> - <libadd>luabind</libadd> - <libadd>CEGUIOgreRenderer</libadd> - </BuildProgram> - --> - <!--<BuildProgram - name="cmdrmayhem" - src="src/yapp/samples/misc/cmdrmayhem" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - </BuildProgram> - --> - -</BuildSpec> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:48:11
|
Revision: 1682 http://svn.sourceforge.net/yake/?rev=1682&view=rev Author: psyclonist Date: 2007-03-15 19:48:11 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added reference to manual Modified Paths: -------------- trunk/yake/BUILD trunk/yake/INSTALL Modified: trunk/yake/BUILD =================================================================== --- trunk/yake/BUILD 2007-03-16 02:46:10 UTC (rev 1681) +++ trunk/yake/BUILD 2007-03-16 02:48:11 UTC (rev 1682) @@ -26,6 +26,10 @@ You can find it here: http://www.yake.org/wiki/ . +The manual can be found here: http://www.yake.org/docs/manual/multi/ . +The sources to the manual can be found in this source release +in the 'documentation/manual' subdirectory. + For help visit the Forums: http://www.yake.org/forum/ . For reporting/tracking bugs visit http://bugs.yake.org/ . Modified: trunk/yake/INSTALL =================================================================== --- trunk/yake/INSTALL 2007-03-16 02:46:10 UTC (rev 1681) +++ trunk/yake/INSTALL 2007-03-16 02:48:11 UTC (rev 1682) @@ -4,6 +4,7 @@ For build instructions see BUILD. If you encounter problems visit: + the manual at http://www.yake.org/docs/manual/multi/ the forums at http://www.yake.org/forum/ the wiki at http://www.yake.org/wiki/ report/track bugs at http://bugs.yake.org/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:35:07
|
Revision: 1686 http://svn.sourceforge.net/yake/?rev=1686&view=rev Author: psyclonist Date: 2007-03-20 14:22:35 -0700 (Tue, 20 Mar 2007) Log Message: ----------- fixes Modified Paths: -------------- trunk/yake/samples/property/demo1/demo.cpp trunk/yake/src/base/yakeLog.cpp Modified: trunk/yake/samples/property/demo1/demo.cpp =================================================================== --- trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:21:04 UTC (rev 1685) +++ trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:22:35 UTC (rev 1686) @@ -3,6 +3,8 @@ using namespace yake; //------------------------------------------- +// primitive test harness: +//------------------------------------------- namespace yake { YAKE_DEFINE_EXCEPTION(TestFailedException); } // namespace yake @@ -53,12 +55,16 @@ property_container_t props_; String name_; }; + +//------------------------------------------- #include <yake/base/yakeStderrLog.h> +//#include <yake/base/yakeFileLog.h> //------------------------------------------- int main(int argc,char* argv[]) { logging::log_listener_ptr to_stderr = logging::stderr_listener::add(); + //logging::log_listener_ptr to_file = logging::file_listener::add("prop.log"); using namespace yake::property; // We don't expect collisions in this demo. Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-03-20 21:21:04 UTC (rev 1685) +++ trunk/yake/src/base/yakeLog.cpp 2007-03-20 21:22:35 UTC (rev 1686) @@ -31,7 +31,10 @@ namespace yake { namespace logging { - log_listener::~log_listener() {} + log_listener::~log_listener() + { + removeListener(this); + } void formatLogMessage(std::ostream& out, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:35:55
|
Revision: 1685 http://svn.sourceforge.net/yake/?rev=1685&view=rev Author: psyclonist Date: 2007-03-20 14:21:04 -0700 (Tue, 20 Mar 2007) Log Message: ----------- added library 'property' along with a C++ demo Modified Paths: -------------- trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/yake.lua Added Paths: ----------- trunk/yake/samples/property/ trunk/yake/samples/property/demo1/ trunk/yake/samples/property/demo1/demo.cpp trunk/yake/yake/property/ trunk/yake/yake/property/accessors.h trunk/yake/yake/property/detail/ trunk/yake/yake/property/detail/property.impl.h trunk/yake/yake/property/function_accessor.h trunk/yake/yake/property/prerequisites.h trunk/yake/yake/property/property.h trunk/yake/yake/property/property_container.h trunk/yake/yake/property/stream_operators.h Added: trunk/yake/samples/property/demo1/demo.cpp =================================================================== --- trunk/yake/samples/property/demo1/demo.cpp (rev 0) +++ trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,99 @@ +#include <yake/property/property.h> + +using namespace yake; + +//------------------------------------------- +namespace yake { + YAKE_DEFINE_EXCEPTION(TestFailedException); +} // namespace yake + +#define ASSERT_BOOL(OP,VALUE) \ + { \ + std::cout << "-----------------------------------------------------------[\n"; \ + std::cout << "TEST: " << String(# OP) << " == " << #VALUE << "\n"; \ + if (VALUE == (OP)) \ + std::cout << "=> TEST OK\n"; \ + else \ + std::cout << "=> TEST FAILED!\n"; \ + std::cout << "]-----------------------------------------------------------\n"; \ + } + +#define ASSERT_EXCEPTION(OP,EXCEPTION) \ + { \ + try { \ + std::cout << "-----------------------------------------------------------[\n"; \ + std::cout << "TEST TRY: " << String(# OP) << "\n"; \ + OP; \ + } \ + catch (EXCEPTION&) \ + { \ + std::cout << "=> TEST OK (Caught expected exception " << # EXCEPTION << ")\n"; \ + } \ + catch (...) \ + { \ + std::cerr << "=> TEST FAILED (Caught unexpected exception instead of " << # EXCEPTION << ")\n"; \ + throw TestFailedException("TEST FAILED (Caught unexpected exception)"); \ + } \ + std::cout << "]-----------------------------------------------------------\n"; \ + } + +//------------------------------------------- +struct object : public boost::noncopyable +{ + object() + { + properties().add("name",property::makePointerProperty<String>(&name_)); + } + typedef property::PropertyContainer<String> property_container_t; + property_container_t& properties() + { return props_; } + const property_container_t& properties() const + { return props_; } +private: + property_container_t props_; + String name_; +}; +#include <yake/base/yakeStderrLog.h> + +//------------------------------------------- +int main(int argc,char* argv[]) +{ + logging::log_listener_ptr to_stderr = logging::stderr_listener::add(); + + using namespace yake::property; // We don't expect collisions in this demo. + + try { + //property_def<int,storage_accessor> i_s(12); + //property<int> p_i(new storage_accessor<int>()); + + { + object o; + // indirect access via property_base and boost::any: + o.properties().get("name").setAny(String("o1")); + boost::any_cast<String>(o.properties().get("name").getAny()); + } + + { + PropertyContainer<String> props; + props.add("a", makeValueProperty<int>(33)); + //props += std::make_pair(String("a"),property_ptr(newValueProperty<int>(33))); + ASSERT_BOOL( props.has("a"), true ); + ASSERT_EXCEPTION(props.add("a",0),InvalidInputException); + ASSERT_EXCEPTION(props.add("a",makeValueProperty<int>(33)),AlreadyExistsException); + ASSERT_EXCEPTION(props.get("noname"),NotFoundException); + std::cout << "'a' : " << props.get("a") << "\n"; + try_cast_set<int>(props.get("a"),44); + try_cast<int>(props.get("a")).set(55); + ASSERT_EXCEPTION( try_cast_set<String>(props.get("a"),"66"), BadCastException ); + std::cout << props << "\n"; + } + } + catch (std::exception& ex) + { + std::cerr << "----------------------------------------------------\n"; + std::cerr << "EXCEPTION: " << ex.what() << "\n"; + std::cerr << "----------------------------------------------------\n"; + } + + return 0; +} Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-20 21:19:32 UTC (rev 1684) +++ trunk/yake/scripts/premake/samples.lua 2007-03-20 21:21:04 UTC (rev 1685) @@ -101,6 +101,11 @@ useDep("luabind") -------------------------------------- +makeSample("sampleProperty1","samples/property/demo1") +sampleUsesConsole() +useComponent("base") + +-------------------------------------- if SAMPLES_NET then makeSample("sampleNetPacket","samples/net/packet") sampleUsesConsole() Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-20 21:19:32 UTC (rev 1684) +++ trunk/yake/scripts/premake/yake.lua 2007-03-20 21:21:04 UTC (rev 1685) @@ -184,6 +184,10 @@ --addDependency("base") -------------------------------------- +makeComponent("property","YAKE_PROPERTY_EXPORTS") +addDependency("base") + +-------------------------------------- makeComponent("task","YAKE_TASK_EXPORTS") addDependency("base") Added: trunk/yake/yake/property/accessors.h =================================================================== --- trunk/yake/yake/property/accessors.h (rev 0) +++ trunk/yake/yake/property/accessors.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,105 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_ACCESSORS_H +#define YAKE_PROPERTY_ACCESSORS_H + +#include "prerequisites.h" +#include <boost/function.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + // accessors + //------------------------------------------- + + template<typename T> + struct AccessorBase + { + virtual ~AccessorBase() = 0; + virtual void set(const T&) = 0; + virtual T get() const = 0; + }; + template<typename T> + AccessorBase<T>::~AccessorBase() {} + + + // + + template<typename T> + class ValueHolder : public AccessorBase<T> + { + public: + ValueHolder() + {} + ValueHolder(const T& initialValue) : value_(initialValue) + {} + virtual void set(const T& rhs) + { value_ = rhs; } + virtual T get() const + { return value_; } + protected: + T value_; + }; + template<typename T, typename ArgT> + inline ValueHolder<T>* makeValueHolder(const ArgT& defaultValue = ArgT()) + { + return new ValueHolder<T>(defaultValue); + } + + template<typename T> + class PointerAccessor : public AccessorBase<T> + { + public: + typedef T* value_ptr; + PointerAccessor(value_ptr px) : px_(px) + { + assert( px_ ); + } + void set(const T& v) + { + assert( px_ ); + *px_ = v; + } + T get() const + { + assert( px_ ); + return *px_; + } + private: + value_ptr px_; + }; + template<typename T> + inline PointerAccessor<T>* makePointerAccessor(T* px) + { + return new PointerAccessor<T>(px); + } + +} // namespace prop +} // namespace yake + +#endif Added: trunk/yake/yake/property/detail/property.impl.h =================================================================== --- trunk/yake/yake/property/detail/property.impl.h (rev 0) +++ trunk/yake/yake/property/detail/property.impl.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,160 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_IMPL_H +#define YAKE_PROPERTY_IMPL_H + +#include "../prerequisites.h" +#include "../accessors.h" +#include "../function_accessor.h" +#include <yake/base/templates/yakeSignals.h> +#include <yake/base/templates/yakePointer.h> +#include <yake/base/templates/yakeSmartAssert.h> + +namespace yake { +namespace property { + + struct PropertyBase; + typedef SharedPtr<PropertyBase> PropertyPtr; + + /** */ + struct PropertyBase : public boost::noncopyable + { + PropertyBase(const String& type, const type_info* typeInfo) : typeName_(type), typeInfo_(typeInfo) + { + } + virtual ~PropertyBase() + { + } + + const String& type() const + { + return typeName_; + } + const type_info* typeinfo() const + { + return typeInfo_; + } + + // signals + typedef boost::signal<void(void)> ValueChanged; + ValueChanged valueChanged; + + // from/to boost::any + virtual void setAny(const boost::any& v) = 0; + virtual void getAny(boost::any& out) const = 0; + boost::any getAny() const + { + boost::any out; + this->getAny(out); + return out; + } + + // streams + void out(std::ostream& out) const + { + out << "property<" << typeName_ << ">"; + } + private: + String typeName_; + //property_def_base& def_; + const type_info* typeInfo_; + }; + + /** */ + template<typename T> + struct Property : public PropertyBase + { + typedef AccessorBase<T> accessor_t; + + template<template <typename> class AccT> + Property(AccT<T>* a) : PropertyBase(getCleanTypeName<T>(),&typeid(T)), acc(a) + { + } + virtual ~Property() + { + } + void set(const T& v) + { + acc->set(v); + } + T get() const + { + return acc->get(); + } + // with boost::any support: + virtual void setAny(const boost::any& v) + { + try { + acc->set( boost::any_cast<T>(v) ); + } + catch (boost::bad_any_cast&) + { + throw; + } + } + virtual void getAny(boost::any& out) const + { + out = acc->get(); + } + private: + SharedPtr<accessor_t> acc; + }; + + template<typename T> + Property<T>& try_cast(PropertyBase& prop) + { + //YAKE_ASSERT( &typeid(T) == prop.typeinfo() ); + if (&typeid(T) != prop.typeinfo()) + throw BadCastException(String("try_cast<> failed: '") + getCleanTypeName<T>() + + "' to '" + prop.typeinfo()->name() + "'."); + typedef Property<T> to_t; + return static_cast<to_t&>(prop); + } + template<typename T/*, template <typename> class AccT*/> + void try_cast_set(PropertyBase& prop, const T& newValue) + { + typedef Property<T> to_t; + to_t& propCasted = try_cast<T>(prop); + propCasted.set( newValue ); + } + template<typename T> + void try_cast_set_from_any(PropertyBase& prop, const boost::any& rhs) + { + //YAKE_ASSERT( &typeid(T) == rhs.typeinfo() ); + if (&typeid(T) != rhs.typeinfo()) + throw BadCastException(String("try_cast_set_from_any<> failed: bad cast")); + //safe: + //prop.setAny(rhs); // from any + + //fast: + try_cast_set<T>(prop, boost::any_cast<T>(rhs)); // may throw! + } +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/function_accessor.h =================================================================== --- trunk/yake/yake/property/function_accessor.h (rev 0) +++ trunk/yake/yake/property/function_accessor.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,69 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_FUNCTION_ACCESSOR_H +#define YAKE_PROPERTY_FUNCTION_ACCESSOR_H + +#include "accessors.h" +#include <boost/function.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + // SetGetAccessor + //------------------------------------------- + + template<typename T> + struct FunctionAccessor : public AccessorBase<T> + { + typedef boost::function<void(const T&)> SetT; + typedef boost::function<T(void)> GetT; + FunctionAccessor(const SetT& setFn, const GetT& getFn) : setFn_(setFn), getFn_(getFn) + { + } + virtual void set(const T& v) + { + setFn_(v); + } + virtual T get() const + { + return getFn_(); + } + private: + SetT setFn_; + GetT getFn_; + }; + template<typename T> + inline FunctionAccessor<T>* makeFunctionAccessor(const typename FunctionAccessor<T>::SetT& setFn, const typename FunctionAccessor<T>::GetT& getFn) + { + return new FunctionAccessor<T>(setFn,getFn); + } + +} // namespace property +} // namespace yake + +#endif Added: trunk/yake/yake/property/prerequisites.h =================================================================== --- trunk/yake/yake/property/prerequisites.h (rev 0) +++ trunk/yake/yake/property/prerequisites.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,56 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_PREREQUISITES_H +#define YAKE_PROPERTY_PREREQUISITES_H + +#include <yake/base/yakePrerequisites.h> +#include <yake/base/yakeException.h> + +#include <map> +#include <deque> +#include <boost/any.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + template<typename T> + inline String getCleanTypeName() + { + return typeid(T).name(); + } + template<> + inline String getCleanTypeName<String>() + { + return "String"; + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/property.h =================================================================== --- trunk/yake/yake/property/property.h (rev 0) +++ trunk/yake/yake/property/property.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,56 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_H +#define YAKE_PROPERTY_H + +#include "prerequisites.h" +#include "accessors.h" +#include "function_accessor.h" +#include "detail/property.impl.h" //@todo exclude by default? +#include "property_container.h" //@todo exclude by default? + +#include "stream_operators.h" //@todo exclude by default? + +namespace yake { +namespace property { + + template<typename T> + inline Property<T>* makePointerProperty(T* px) + { + return new Property<T>(makePointerAccessor(px)); + } + template<typename T, typename ArgT> + inline Property<T>* makeValueProperty(const ArgT& defaultValue = ArgT()) + { + return new Property<T>(makeValueHolder<T>(defaultValue)); + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/property_container.h =================================================================== --- trunk/yake/yake/property/property_container.h (rev 0) +++ trunk/yake/yake/property/property_container.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,135 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_CONTAINER_H +#define YAKE_PROPERTY_CONTAINER_H + +#include "prerequisites.h" +#include "detail/property.impl.h" + +namespace yake { +namespace property { + + //------------------------------------------- + template<typename Kt> + struct DefaultErrorPolicy + { + void onNotFound(const Kt& key) + { + throw NotFoundException("id/key not found"); + } + void onInvalidInput(const String& msg) + { + throw InvalidInputException(msg); + } + void onAlreadyExists(const Kt& id) + { + throw AlreadyExistsException("id/key already exists"); + } + }; + /* + template<typename T> + struct OperatorPolicy + { + T& operator += (const property_ptr prop) + { + T::addProperty(prop); + return static_cast<T&>(*this); + } + }; + */ + template<typename Kt, template <typename> class ErrorPolicy = DefaultErrorPolicy> + struct PropertyContainer : public boost::noncopyable, public ErrorPolicy<Kt>//, public OperatorPolicy<PropertyContainer<Kt,ErrorPolicy> > + { + typedef ErrorPolicy<Kt> error_policy_t; + typedef Kt key_type; + void add(const key_type& id, PropertyBase* prop); + const PropertyBase& get(const key_type& id) const; + PropertyBase& get(const key_type& id); + bool has(const key_type& id) const; + + private: + typedef std::map<key_type,PropertyPtr> PropertyMap; + public: + typedef typename PropertyMap::const_iterator const_property_iterator; + const_property_iterator begin() const + { return properties_.begin(); } + const_property_iterator end() const + { return properties_.end(); } + + private: + PropertyMap properties_; + }; + template<typename Kt, template <typename> class ErrorPolicy> + void PropertyContainer<Kt,ErrorPolicy>::add(const key_type &id, PropertyBase *prop) + { + if (!prop) + { + this->onInvalidInput("null pointer"); + return; + } + PropertyMap::const_iterator it = properties_.find( id ); + if (it != properties_.end()) + { + this->onAlreadyExists(id); //@todo possible memory leak if client doesn't clean up "prop" + return; + } + properties_.insert( std::make_pair(id,PropertyPtr(prop)) ); + } + template<typename Kt, template <typename> class ErrorPolicy> + const PropertyBase& PropertyContainer<Kt,ErrorPolicy>::get(const key_type& id) const + { + PropertyMap::const_iterator it = properties_.find( id ); + if (it == properties_.end()) + { + this->onNotFound(id); // should throw! + throw NotFoundException("property with this id not found"); // fallback if error handler doesn't throw + } + return *it->second; + } + template<typename Kt, template <typename> class ErrorPolicy> + PropertyBase& PropertyContainer<Kt,ErrorPolicy>::get(const key_type& id) + { + PropertyMap::const_iterator it = properties_.find( id ); + if (it == properties_.end()) + { + this->onNotFound(id); // should throw! + throw NotFoundException("property with this id not found"); // fallback if error handler doesn't throw + } + return *it->second; + } + template<typename Kt, template <typename> class ErrorPolicy> + bool PropertyContainer<Kt,ErrorPolicy>::has(const key_type& id) const + { + PropertyMap::const_iterator it = properties_.find( id ); + return (it != properties_.end()); + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/stream_operators.h =================================================================== --- trunk/yake/yake/property/stream_operators.h (rev 0) +++ trunk/yake/yake/property/stream_operators.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,72 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_PROPERTY_STREAM_OPERATORS_H +#define YAKE_PROPERTY_STREAM_OPERATORS_H + +#include <iostream> + +#include "prerequisites.h" +#include "accessors.h" +#include "function_accessor.h" +#include "property.h" +#include "detail/property.impl.h" +#include "property_container.h" + +namespace yake { +namespace property { + + inline std::ostream& operator << (std::ostream& out, const PropertyBase& rhs) + { + rhs.out(out); + return out; + } + + template<typename T> + inline std::ostream& operator << (std::ostream& out, const Property<T>& rhs) + { + out << "property<" << rhs.type() << ">(" << rhs.get() << ")"; + return out; + } + + template<typename Kt, typename ErrorPolicy> + inline std::ostream& operator << (std::ostream& out, const PropertyContainer<Kt,ErrorPolicy>& rhs) + { + typedef PropertyContainer<Kt,ErrorPolicy> cont_t; + out << "PropertyContainer<Kt=" << getCleanTypeName<Kt>() << ",ErrorPolicy=..." /*<< getCleanTypeName<typename cont_t::error_policy_t>() <<*/ ">(\n"; + for (cont_t::const_property_iterator it = rhs.begin(); it != rhs.end(); ++it) + { + out << " '" << it->first << "': " << *it->second << "\n"; + } + out << " )\n"; + return out; + } + +} // namespace property +} // namespace yake + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:36:29
|
Revision: 1684 http://svn.sourceforge.net/yake/?rev=1684&view=rev Author: psyclonist Date: 2007-03-20 14:19:32 -0700 (Tue, 20 Mar 2007) Log Message: ----------- provided static add() function for easy log listener registration, made destructor of log_listener auto-deregister listener Modified Paths: -------------- trunk/yake/src/base/yakeFileLog.cpp trunk/yake/src/base/yakeStderrLog.cpp trunk/yake/yake/base/yakeFileLog.h trunk/yake/yake/base/yakeLog.h trunk/yake/yake/base/yakeStderrLog.h Modified: trunk/yake/src/base/yakeFileLog.cpp =================================================================== --- trunk/yake/src/base/yakeFileLog.cpp 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/src/base/yakeFileLog.cpp 2007-03-20 21:19:32 UTC (rev 1684) @@ -48,6 +48,12 @@ formatLogMessage(fp_, sev, msg, logId, procId, threadId ); fp_.flush(); } + log_listener_ptr file_listener::add(const std::string& fileName) + { + log_listener_ptr l( new file_listener(fileName) ); + addListener( l.get() ); + return l; + } } // logging } // yake Modified: trunk/yake/src/base/yakeStderrLog.cpp =================================================================== --- trunk/yake/src/base/yakeStderrLog.cpp 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/src/base/yakeStderrLog.cpp 2007-03-20 21:19:32 UTC (rev 1684) @@ -49,6 +49,12 @@ else std::cerr << ss.str(); } + log_listener_ptr stderr_listener::add() + { + log_listener_ptr l( new stderr_listener() ); + addListener( l.get() ); + return l; + } } // logging } // yake Modified: trunk/yake/yake/base/yakeFileLog.h =================================================================== --- trunk/yake/yake/base/yakeFileLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeFileLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -38,6 +38,8 @@ file_listener(const std::string& fileName); virtual ~file_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + + static log_listener_ptr add(const std::string& fileName); private: std::ofstream fp_; }; Modified: trunk/yake/yake/base/yakeLog.h =================================================================== --- trunk/yake/yake/base/yakeLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -33,6 +33,7 @@ #include <yake/base/yakeNoncopyable.h> #include <yake/base/yakeString.h> #include <yake/base/templates/yakeSingleton.h> +#include <yake/base/templates/yakePointer.h> #include <yake/base/native/yakeThreads.h> #include <boost/thread/mutex.hpp> @@ -62,9 +63,10 @@ /** */ struct YAKE_BASE_API log_listener : public boost::noncopyable { - virtual ~log_listener() = 0; + virtual ~log_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) = 0; }; + typedef SharedPtr<log_listener> log_listener_ptr; /** */ struct YAKE_BASE_API logger : public boost::noncopyable Modified: trunk/yake/yake/base/yakeStderrLog.h =================================================================== --- trunk/yake/yake/base/yakeStderrLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeStderrLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -39,6 +39,8 @@ stderr_listener(); virtual ~stderr_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + + static log_listener_ptr add(); }; } // namespace logging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-28 15:27:09
|
Revision: 1696 http://svn.sourceforge.net/yake/?rev=1696&view=rev Author: psyclonist Date: 2007-03-28 08:27:09 -0700 (Wed, 28 Mar 2007) Log Message: ----------- fixed static-vs-static actor bug (patch), improved exception safety, new parameters for OdeWorld: num_iterations, ERP, CFM (patch) Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeWorld.cpp trunk/yake/yake/plugins/physicsODE/OdeWorld.h Modified: trunk/yake/src/plugins/physicsODE/OdeWorld.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeWorld.cpp 2007-03-28 15:24:23 UTC (rev 1695) +++ trunk/yake/src/plugins/physicsODE/OdeWorld.cpp 2007-03-28 15:27:09 UTC (rev 1696) @@ -43,30 +43,29 @@ //----------------------------------------------------- OdeWorld::OdeWorld() : mNextMeshId( 0 ), mTimeOverflow(0.) { - //TODO make these settings configurable for user //simulation mStepSize = real( 1./50. ); - mOdeWorld = new dWorld(); - YAKE_ASSERT( mOdeWorld ); + mOdeWorld.reset( new dWorld() ); - mOdeSpace = new dSimpleSpace( 0 ); - YAKE_ASSERT( mOdeSpace ); + //mOdeSpace.reset( new dSimpleSpace( 0 ) ); + mOdeSpace.reset( new dHashSpace( 0 ) ); + //dHashSpaceSetLevels (mOdeSpace->id(),10, 20); - mOdeContactGroup = new dJointGroup( 0 ); + mOdeContactGroup.reset( new dJointGroup( 0 ) ); mOdeWorld->setAutoDisableFlag( 1 ); mOdeWorld->setAutoDisableAngularThreshold( dReal(0.01) ); // ODE default: 0.01 mOdeWorld->setAutoDisableLinearThreshold( dReal(0.01) ); // ODE default: 0.01 mOdeWorld->setAutoDisableSteps( 10 ); // ODE default: 10 - mOdeWorld->setAutoDisableTime( 0 ); // ODE default: 0. (= ignore time) + mOdeWorld->setAutoDisableTime( 0 ); // ODE default: 0. (= ignore time)*/ // We do not set any default gravity setting // as we don't want to enforce a specific coordinate system. // mOdeWorld->setGravity( 0., -9.81, 0. ); - // Global ERP and CFM values should be configurable via some (properties?) interface + // Global ERP and CFM values are configurable via the properties interface // Individual values ( for joints and such ) should also be accessable // perhaps via direct_ode access. mOdeWorld->setCFM( dReal(0.001) ); @@ -77,7 +76,6 @@ dWorldSetContactMaxCorrectingVel( mOdeWorld->id(), dReal(2.) ); dWorldSetContactSurfaceLayer( mOdeWorld->id(), dReal(0.01) ); - mTime = real(0.); mMaterials["default"] = SharedPtr<OdeMaterial>(new OdeMaterial("default")); @@ -103,9 +101,9 @@ YAKE_SAFE_DELETE_ARRAY( mesh_data.normals ); } - YAKE_SAFE_DELETE( mOdeContactGroup ); - YAKE_SAFE_DELETE( mOdeSpace ); - YAKE_SAFE_DELETE( mOdeWorld ); + mOdeContactGroup.reset(); + mOdeSpace.reset(); + mOdeWorld.reset(); } //----------------------------------------------------- @@ -210,6 +208,18 @@ { mStepSize = boost::any_cast<real>(rValue); } + else if (rName == "num_iterations") + { + dWorldSetQuickStepNumIterations( mOdeWorld->id(), boost::any_cast<int>(rValue)); + } + else if (rName == "ERP") + { + mOdeWorld->setERP(boost::any_cast<real>(rValue)); + } + else if (rName == "CFM") + { + mOdeWorld->setCFM(boost::any_cast<real>(rValue)); + } } catch (boost::bad_any_cast& e) { YAKE_EXCEPT(String("Failed to set solver parameter! (") + e.what() + ")"); @@ -516,6 +526,8 @@ if ( b1 && b2 && dAreConnected( b1, b2 ) ) return; + + void* data1 = dGeomGetData( o1 ); void* data2 = dGeomGetData( o2 ); @@ -533,12 +545,12 @@ { OdeActor* pA = static_cast<OdeGeom*>( data1 )->getOwner(); OdeActor* pB = static_cast<OdeGeom*>( data2 )->getOwner(); - + if (!pA || !pB) return; // collision between two static objects: do nothing - if ((pA->getType() == ACTOR_STATIC) && (pA->getType() == ACTOR_STATIC)) + if ((pA->getType() == ACTOR_STATIC) && (pB->getType() == ACTOR_STATIC)) { return; } Modified: trunk/yake/yake/plugins/physicsODE/OdeWorld.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/OdeWorld.h 2007-03-28 15:24:23 UTC (rev 1695) +++ trunk/yake/yake/plugins/physicsODE/OdeWorld.h 2007-03-28 15:27:09 UTC (rev 1696) @@ -88,10 +88,10 @@ // helpers dWorldID _getOdeID() const; dJointGroup* _getOdeContactJointGroup() const - { return mOdeContactGroup; } + { return mOdeContactGroup.get(); } dSpace* _getOdeSpace() const - { return mOdeSpace; } + { return mOdeSpace.get(); } dSpaceID _getOdeSpaceID() const { return mOdeSpace->id(); } @@ -110,9 +110,9 @@ real mTimeOverflow; real mTime; real mStepSize; - dWorld* mOdeWorld; - dJointGroup* mOdeContactGroup; - dSpace* mOdeSpace; + SharedPtr<dWorld> mOdeWorld; + SharedPtr<dJointGroup> mOdeContactGroup; + SharedPtr<dSpace> mOdeSpace; typedef std::vector< OdeBody* > BodyList; BodyList mBodies; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-28 15:32:45
|
Revision: 1697 http://svn.sourceforge.net/yake/?rev=1697&view=rev Author: psyclonist Date: 2007-03-28 08:32:45 -0700 (Wed, 28 Mar 2007) Log Message: ----------- physicsOde: ray stores reference to hit actor (modified patch #19) Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeRay.cpp trunk/yake/yake/plugins/physicsODE/OdeRay.h Modified: trunk/yake/src/plugins/physicsODE/OdeRay.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeRay.cpp 2007-03-28 15:27:09 UTC (rev 1696) +++ trunk/yake/src/plugins/physicsODE/OdeRay.cpp 2007-03-28 15:32:45 UTC (rev 1697) @@ -27,6 +27,7 @@ #include <yake/plugins/physicsODE/yakePCH.h> #include <yake/plugins/physicsODE/OdeWorld.h> #include <yake/plugins/physicsODE/OdeRay.h> +#include <yake/plugins/physicsODE/OdeActor.h> namespace yake { namespace physics { @@ -35,7 +36,8 @@ //----------------------------------------------------- OdeRay::OdeRay(OdeWorld* world, const real length) : mWorld(world), - mLength(length) + mLength(length), + mIntersectionActor(0) { YAKE_ASSERT( mWorld ); YAKE_ASSERT( length > 0 ); @@ -71,6 +73,9 @@ // As we have passed dCollide the ray as the first parameter, the normal // is oriented correctly for ray deflection from the surface. mIntersectionNormal = Vector3( real(contact.geom.normal[0]), real(contact.geom.normal[1]), real(contact.geom.normal[2]) ); + //Store the actor the ray collide with. + void* data = dGeomGetData( geomOther ); + mIntersectionActor = data ? static_cast<OdeGeom*>( data )->getOwner() : 0; } } real OdeRay::length() const @@ -132,6 +137,10 @@ } return Quaternion::kIdentity; } + IActor* OdeRay::intersectionActor() const + { + return mIntersectionActor; + } } // physics } // yake Modified: trunk/yake/yake/plugins/physicsODE/OdeRay.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/OdeRay.h 2007-03-28 15:27:09 UTC (rev 1696) +++ trunk/yake/yake/plugins/physicsODE/OdeRay.h 2007-03-28 15:32:45 UTC (rev 1697) @@ -48,6 +48,7 @@ real intersectionDepth() const; math::Vector3 intersectionPoint() const; math::Vector3 intersectionNormal() const; + IActor* intersectionActor() const; virtual void setPosition( math::Vector3 const& rPosition); virtual math::Vector3 getPosition() const; @@ -86,6 +87,8 @@ typedef std::deque<dGeomID> GeomIdList; GeomIdList mIgnoreGeoms; + + OdeActor* mIntersectionActor; }; } // physics This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-12 16:04:54
|
Revision: 1702 http://svn.sourceforge.net/yake/?rev=1702&view=rev Author: psyclonist Date: 2007-04-12 09:04:41 -0700 (Thu, 12 Apr 2007) Log Message: ----------- updated documentation and scripts Modified Paths: -------------- trunk/yake/documentation/api/Doxyfile Added Paths: ----------- trunk/yake/documentation/index.html trunk/yake/scripts/tools/ trunk/yake/scripts/tools/make_api.pl Modified: trunk/yake/documentation/api/Doxyfile =================================================================== --- trunk/yake/documentation/api/Doxyfile 2007-04-03 15:09:18 UTC (rev 1701) +++ trunk/yake/documentation/api/Doxyfile 2007-04-12 16:04:41 UTC (rev 1702) @@ -1,4 +1,4 @@ -# Doxyfile 1.5.1-p1 +# Doxyfile 1.5.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -14,6 +14,14 @@ # Project related configuration options #--------------------------------------------------------------------------- +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. @@ -53,16 +61,6 @@ OUTPUT_LANGUAGE = English -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = YES - # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). @@ -214,6 +212,11 @@ BUILTIN_STL_SUPPORT = NO +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default @@ -471,6 +474,13 @@ INPUT = yake +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left @@ -514,7 +524,10 @@ # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = yake/reflection yake/samples yake/thread yake/yappmsg +EXCLUDE = yake/reflection \ + yake/samples \ + yake/thread \ + yake/yappmsg # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -530,6 +543,13 @@ EXCLUDE_PATTERNS = +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). @@ -1119,6 +1139,14 @@ CLASS_DIAGRAMS = YES +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. @@ -1213,7 +1241,7 @@ # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. -DOT_PATH = +DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the @@ -1221,34 +1249,14 @@ DOTFILE_DIRS = -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen will always +# show the root nodes and its direct children regardless of this setting. -MAX_DOT_GRAPH_WIDTH = 1024 +DOT_GRAPH_MAX_NODES = 50 -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 1000 - # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to Added: trunk/yake/documentation/index.html =================================================================== --- trunk/yake/documentation/index.html (rev 0) +++ trunk/yake/documentation/index.html 2007-04-12 16:04:41 UTC (rev 1702) @@ -0,0 +1,19 @@ +<html> + <head> + <title>Yake Documentation Overview</title> + <link type="text/css" href="manual/yake-manual.css" rel="stylesheet"> + </head> + <body> + <h1>Documentation</h1> + <p>If this is a source release package (as downloaded from the Yake website) + or if you have generated the documentation yourself then you can use the + following two links to navigate to the main documentation items. + </p> + <p> + <ul> + <li><a style="font-weight:bold" href="manual/yake-manual.html">Manual</a></li> + <li><a style="font-weight:bold" href="api/html/index.html">API Reference</a></li> + </ul> + </p> + </body> +</html> Added: trunk/yake/scripts/tools/make_api.pl =================================================================== --- trunk/yake/scripts/tools/make_api.pl (rev 0) +++ trunk/yake/scripts/tools/make_api.pl 2007-04-12 16:04:41 UTC (rev 1702) @@ -0,0 +1,14 @@ +print "Generating API reference...\n\n"; + +# Windows: where returns 256 for 'not found' and 0 for 'found'. +`where /q doxygen`; +if ($? == 256) +{ + print("Error: Could not locate doxygen. Bailing out.\n"); + exit +} + +`cd ../.. && doxygen documentation/api/doxyfile`; +print $? . " \n" + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-13 17:08:41
|
Revision: 1703 http://svn.sourceforge.net/yake/?rev=1703&view=rev Author: psyclonist Date: 2007-04-13 10:08:41 -0700 (Fri, 13 Apr 2007) Log Message: ----------- logging related fixes Modified Paths: -------------- trunk/yake/samples/physics/demo/yakeDemo.cpp trunk/yake/src/base/yakeLog.cpp trunk/yake/src/raf/yakeApplication.cpp Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-04-12 16:04:41 UTC (rev 1702) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-04-13 17:08:41 UTC (rev 1703) @@ -484,8 +484,12 @@ int main(int,char**) { + typedef SharedPtr<logging::log_listener> log_listener_ptr; + log_listener_ptr toFile( new yake::logging::file_listener("yake.log") ); + yake::logging::addListener( toFile.get() ); try { + std::cout << std::endl << "A simple demo :) provided for YAKE by Stephan Kaiser" << std::endl; std::cout << "For a more sophisticated demo have a look at the Yapp demos," << std::endl << "'sync1' and 'dotLink' and 'dotModel'." << std::endl; @@ -496,12 +500,13 @@ } catch (const yake::Exception & e) { - std::cout << std::endl << e.what() << std::endl; + YAKE_LOG_WARNING("demo", e.what()); + std::cerr << std::endl << e.what() << std::endl; } catch (...) { - //YAKE_LOG_ERROR("YAKE catched an unhandled exception"); - std::cout << std::endl << "YAKE catched an unhandled exception." << std::endl; + YAKE_LOG_ERROR("demo","YAKE caught an unhandled exception"); + std::cout << std::endl << "YAKE caught an unhandled exception." << std::endl; } #if defined( YAKE_DEBUG_BUILD ) std::cout << std::endl << "Waiting for you..."; Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-04-12 16:04:41 UTC (rev 1702) +++ trunk/yake/src/base/yakeLog.cpp 2007-04-13 17:08:41 UTC (rev 1703) @@ -105,6 +105,8 @@ if (!l) return; scoped_lock lock; + if (instance().targets_.empty()) + return; instance().targets_.erase( std::find(instance().targets_.begin(), instance().targets_.end(), l) ); } void logger::log(const severity_t sev, const char *logId, const char *msg) Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2007-04-12 16:04:41 UTC (rev 1702) +++ trunk/yake/src/raf/yakeApplication.cpp 2007-04-13 17:08:41 UTC (rev 1703) @@ -435,9 +435,7 @@ mLibs.clear(); // - YAKE_LOG_INFORMATION("raf","removing logger."); - YAKE_FOR_EACH(LogListeners::iterator,itLogListener,mLogListeners) - logging::removeListener( (*itLogListener).get() ); + YAKE_LOG_INFORMATION("raf","removing logger(s)."); mLogListeners.clear(); return ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-15 17:18:12
|
Revision: 1704 http://svn.sourceforge.net/yake/?rev=1704&view=rev Author: psyclonist Date: 2007-04-15 10:18:06 -0700 (Sun, 15 Apr 2007) Log Message: ----------- added proper DLL export for graphicsOgre classes Modified Paths: -------------- trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCamera.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreEntity.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreGeometryAccess.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreLight.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreNode.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreParticleSystem.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreSkeleton.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreViewport.h trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsSystem.h trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsWorld.h trunk/yake/yake/plugins/physicsODE/OdeAvatar.h Added Paths: ----------- trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h Modified: trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp 2007-04-15 17:18:06 UTC (rev 1704) @@ -307,15 +307,15 @@ OgreLight* pL = static_cast<OgreLight*>( pLight ); try { - mSceneNode->getAttachedObject( pL->getLight_()->getName() ); + mSceneNode->attachObject( pL->getLight_() ); + //mSceneNode->getAttachedObject( pL->getLight_()->getName() ); } catch (Ogre::Exception& e) { - if (e.getNumber() != Ogre::Exception::ERR_ITEM_NOT_FOUND) + //if (e.getNumber() != Ogre::Exception::ERR_ITEM_NOT_FOUND) { YAKE_EXCEPT(String("Caught OGRE exception: ") + e.getFullDescription().c_str()); } - mSceneNode->attachObject( pL->getLight_() ); } mLights.push_back( pLight ); } Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCamera.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCamera.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCamera.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,11 +27,13 @@ #ifndef INC_YAKE_GRAPHICOGRECAMERA_H #define INC_YAKE_GRAPHICOGRECAMERA_H +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> + namespace yake { namespace graphics { namespace ogre3d { - class OgreCamera : public ICamera + class YAKE_GRAPHICS_CONCRETE_API OgreCamera : public ICamera { OgreCamera(); OgreCamera( const OgreCamera & ); Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreEntity.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreEntity.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreEntity.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -32,7 +32,7 @@ namespace ogre3d { class OgreNode; - class OgreEntity : public graphics::IEntity + class YAKE_GRAPHICS_CONCRETE_API OgreEntity : public graphics::IEntity { OgreEntity(); OgreEntity( const OgreEntity& ); Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreGeometryAccess.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreGeometryAccess.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreGeometryAccess.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -34,7 +34,7 @@ namespace graphics { namespace ogre3d { - class OgreMeshGeometryAccess : public IMeshGeometryAccess + class YAKE_GRAPHICS_CONCRETE_API OgreMeshGeometryAccess : public IMeshGeometryAccess { private: Ogre::MeshPtr mMesh; Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreLight.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreLight.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreLight.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -31,7 +31,7 @@ namespace graphics { namespace ogre3d { - class OgreLight : public graphics::ILight + class YAKE_GRAPHICS_CONCRETE_API OgreLight : public graphics::ILight { public: OgreLight( Ogre::SceneManager* sceneMgr ); Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreNode.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreNode.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreNode.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,13 +27,15 @@ #ifndef INC_YAKE_GRAPHICOGRENODE_H #define INC_YAKE_GRAPHICOGRENODE_H +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> + namespace yake { namespace graphics { namespace ogre3d { class OgreEntity; class GraphicalWorld; - class OgreNode : public graphics::ISceneNode + class YAKE_GRAPHICS_CONCRETE_API OgreNode : public graphics::ISceneNode { public: OgreNode( GraphicalWorld& owningWorld, Ogre::SceneManager * sceneMgr, const String& name = "" ); Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreParticleSystem.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreParticleSystem.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreParticleSystem.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,10 +27,12 @@ #ifndef INC_YAKE_GRAPHICOGREPARTICLESYSTEM_H #define INC_YAKE_GRAPHICOGREPARTICLESYSTEM_H +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> + namespace yake { namespace graphics { - class OgreParticleSystem : public graphics::IParticleSystem + class YAKE_GRAPHICS_CONCRETE_API OgreParticleSystem : public graphics::IParticleSystem { public: // for Ogre 1.1.0 "Dagon" compatibility Added: trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h (rev 0) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -0,0 +1,44 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_GRAPHICS_OGRE_PREREQUISITES_H +#define YAKE_GRAPHICS_OGRE_PREREQUISITES_H + +#if defined( YAKE_GRAPHICSCONCRETEAPI_EXPORTS ) +# define YAKE_GRAPHICS_CONCRETE_API DLLEXPORT +#else +# define YAKE_GRAPHICS_CONCRETE_API DLLIMPORT +#endif + +#if YAKE_PLATFORM == PLATFORM_WIN32 +# define YAKE_USE_OSM +# pragma message("Compiling graphicsOGRE with OSM support.") +#else +# pragma message("Compiling graphicsOGRE without OSM support.") +#endif + +#endif + Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreSkeleton.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreSkeleton.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreSkeleton.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,11 +27,13 @@ #ifndef INC_YAKE_GRAPHICSOGRESKELETON_H #define INC_YAKE_GRAPHICSOGRESKELETON_H +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> + namespace yake { namespace graphics { namespace ogre3d { - class OgreSkeleton : public graphics::ISkeleton + class YAKE_GRAPHICS_CONCRETE_API OgreSkeleton : public graphics::ISkeleton { public: OgreSkeleton( Ogre::Entity& rEntity ); Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreViewport.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreViewport.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreViewport.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,13 +27,15 @@ #ifndef INC_YAKE_GRAPHICOGREVIEWPORT_H #define INC_YAKE_GRAPHICOGREVIEWPORT_H +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> + namespace yake { namespace graphics { namespace ogre3d { class OgreCore; class OgreCamera; - class OgreViewport : public graphics::IViewport + class YAKE_GRAPHICS_CONCRETE_API OgreViewport : public graphics::IViewport { public: OgreViewport( OgreCore* pCore, OgreCamera* pCamera ); Modified: trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsSystem.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsSystem.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsSystem.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -27,26 +27,9 @@ #ifndef YAKE_PLUGINS_GRAPHICSSYSTEM_H #define YAKE_PLUGINS_GRAPHICSSYSTEM_H -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> #include <yake/graphics/yakeGraphicsSystem.h> #include <yake/graphics/yakeGraphicalWorld.h> - -#if defined( YAKE_GRAPHICSCONCRETEAPI_EXPORTS ) -# define YAKE_GRAPHICS_CONCRETE_API DLLEXPORT -#else -# define YAKE_GRAPHICS_CONCRETE_API DLLIMPORT -#endif - -#if YAKE_PLATFORM == PLATFORM_WIN32 -# define YAKE_USE_OSM -# pragma message("Compiling graphicsOGRE with OSM support.") -#else -# pragma message("Compiling graphicsOGRE without OSM support.") -#endif - - #include <yake/plugins/graphicsOgre/yakeGraphicsWorld.h> //============================================================================ Modified: trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsWorld.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsWorld.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/graphicsOgre/yakeGraphicsWorld.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -28,14 +28,11 @@ #define YAKE_PLUGINS_GRAPHICSWORLD_H //============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> #include <yake/graphics/yakeGraphicalWorld.h> #include <yake/plugins/graphicsOgre/yakeGraphicsSystem.h> //============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ namespace Ogre { class MeshPtr; class RaySceneQuery; Modified: trunk/yake/yake/plugins/physicsODE/OdeAvatar.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/OdeAvatar.h 2007-04-13 17:08:41 UTC (rev 1703) +++ trunk/yake/yake/plugins/physicsODE/OdeAvatar.h 2007-04-15 17:18:06 UTC (rev 1704) @@ -68,6 +68,19 @@ virtual IWorld& getCreator() const; + virtual void setSpeed(const real speed) + { mSpeed = speed; } + virtual real getSpeed() const + { return mSpeed; } + + virtual void setAcceleration(const real acc) + { mAcceleration = acc; } + + virtual real getAcceleration() const + { return mAcceleration; } + + virtual void getShapeSize(real& radius, real& height); + YAKE_MEMBERSIGNAL_VIRTUALIMPL(public, void(bool), OnJump) YAKE_MEMBERSIGNAL_FIRE_FN1(public, OnJump, jumping, bool) @@ -99,6 +112,7 @@ bool mDucking; OdeActor* mActor; + OdeGeom* mShape; OdeWorld* mOdeWorld; OdeRay* mRay; double mRayLength; @@ -107,10 +121,15 @@ double mSphereRadius; Vector3 mSphereOffset; + real mCapsuleHeight; + real mCapsuleHeightDuck; real mHeightAboveGround; real mHeightAboveGroundDuck; + real mSpeed; + real mAcceleration; + yake::SignalConnection mPreStepConn; yake::SignalConnection mPostStepConn; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-16 16:52:07
|
Revision: 1706 http://svn.sourceforge.net/yake/?rev=1706&view=rev Author: psyclonist Date: 2007-04-16 09:50:25 -0700 (Mon, 16 Apr 2007) Log Message: ----------- new audio sample, improved audio interfaces, fixed small include order issues, moved YAKE_LIB define Modified Paths: -------------- trunk/yake/documentation/manual/yake-manual.txt trunk/yake/samples/audio/demo1/demo.cpp trunk/yake/scripts/premake/samples.lua trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp trunk/yake/src/plugins/audioOpenAL/yakeAudioWorldOpenAL.cpp trunk/yake/yake/audio/yakeAudioPrerequisites.h trunk/yake/yake/audio/yakeAudioSystem.h trunk/yake/yake/base/templates/yakeManager.h trunk/yake/yake/base/yakeLibrary.h trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h trunk/yake/yake/raf/yakeApplication.h Removed Paths: ------------- trunk/yake/samples/audio/demo1/pch.cpp Modified: trunk/yake/documentation/manual/yake-manual.txt =================================================================== --- trunk/yake/documentation/manual/yake-manual.txt 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/documentation/manual/yake-manual.txt 2007-04-16 16:50:25 UTC (rev 1706) @@ -91,7 +91,7 @@ For specific components/plugins additional dependencies may be required. -1. ODE 0.6/0.7 for physicsODE +1. ODE 0.7/0.8 for physicsODE #. OGRE 1.2.x+ for graphicsOGRE #. Lua 5.x for scriptingLua, entLua etc #. Luabind 0.7+ for scriptingLua, entLua etc Modified: trunk/yake/samples/audio/demo1/demo.cpp =================================================================== --- trunk/yake/samples/audio/demo1/demo.cpp 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/samples/audio/demo1/demo.cpp 2007-04-16 16:50:25 UTC (rev 1706) @@ -1,4 +1,5 @@ -#include <yake/samples/audio/demo1/pch.h> +#include <yake/audio/yakeAudio.h> +#include <yake/base/yakeLibrary.h> int main(int argc,char* argv[]) { @@ -7,44 +8,58 @@ // loading & starting plugin using namespace yake; - SharedPtr<base::Library> pLib( new base::Library( "audioOpenAL" ) ); + SharedPtr<base::Library> pLib( new base::Library( YAKE_LIB("audioOpenAL") ) ); SharedPtr<audio::IAudioSystem> pAudio = templates::create_default<audio::IAudioSystem>(); // create world - SharedPtr<audio::IWorld> pWorld; - pWorld.reset( pAudio->createWorld() ); + audio::WorldPtr world = pAudio->createWorld(); + /* // init listener - SharedPtr<audio::IListener> pListener; - pListener.reset( pWorld->createListener() ); - pWorld->setActiveListener( pListener.get() ); + audio::ListenerPtr listener = world->createListener(); + world->setActiveListener( listener ); // load audio data - SharedPtr<audio::ISource> pSource1; - pSource1.reset( pWorld->createSource() ); + //audio::SourcePtr source = world->createSource(); + audio::SourcePtr sourceSong = world->createSource(); // create sound souce & attach audio data - SharedPtr<audio::ISoundData> pData1; - pData1.reset( pWorld->createSoundDataFromFile("../../media/audio/Forest1.L.wav") ); + //audio::SoundDataPtr sound1 = world->createSoundDataFromFile("../../../common/media/audio/voice.wav"); + //sound1->setLoopMode( audio::ISoundData::SLM_LOOP_OFF ); + //std::cin.get(); + //audio::SoundDataPtr song = world->createSoundDataFromFile("../../../common/media/audio/stop.ogg",true); + audio::SoundDataPtr song = world->createSoundDataFromFile("../../../common/media/audio/test1.ogg",true); - pSource1->setSoundData( pData1.get() ); + //std::cin.get(); + sourceSong->setSoundData( song ); + //source->setSoundData( sound1 ); + + //std::cin.get(); + // start playing - pSource1->play(); + //source->play(); + sourceSong->play(); + std::cout << "waiting for play...\n"; + while (sourceSong->getState() != audio::ISource::Playing) + //usleep(1000); + Sleep(0); // wait for stop std::cout << "running...\npress a key to stop...\n"; - while (!_kbhit()) - ::Sleep(10); - _getch(); + std::cin.get(); - pSource1.reset(); - pData1.reset(); - pListener.reset(); - pWorld.reset(); + song.reset(); + //sound1.reset(); + //source.reset(); + sourceSong.reset(); + listener.reset(); + world.reset(); pAudio.reset(); pLib.reset(); - } catch (yake::Exception& e) + */ + } + catch (yake::Exception& e) { std::cerr << "Caught YAKE Exception:\n" << e.what(); } Deleted: trunk/yake/samples/audio/demo1/pch.cpp =================================================================== --- trunk/yake/samples/audio/demo1/pch.cpp 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/samples/audio/demo1/pch.cpp 2007-04-16 16:50:25 UTC (rev 1706) @@ -1 +0,0 @@ -#include <yake/samples/audio/demo1/pch.h> Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/scripts/premake/samples.lua 2007-04-16 16:50:25 UTC (rev 1706) @@ -46,6 +46,13 @@ useComponent("entLua") -------------------------------------- +makeSample("sampleAudio1","samples/audio/demo1") +sampleUsesConsole() +useComponent("base") +useComponent("audio") +--useComponent("audioOpenAL") + +-------------------------------------- makeSample("samplePhysics1","samples/physics/demo") useComponent("base") useComponent("physics") Modified: trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp =================================================================== --- trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp 2007-04-16 16:50:25 UTC (rev 1706) @@ -42,6 +42,19 @@ YAKE_EXCEPT(String("Caught OpenAL++ exception:\n") + e.what()); } } + SoundDataStream::SoundDataStream(const String & filename) : + SoundDataOpenALBase(kStream,SLM_LOOP_OFF) + { + try { + mSoundData = new openalpp::FileStream( filename.c_str() ); + openalpp::FileStream* fs = static_cast<openalpp::FileStream*>( mSoundData.get() ); + YAKE_ASSERT( mSoundData.valid() ); + } + catch (const openalpp::Error& e) + { + YAKE_EXCEPT(String("Caught OpenAL++ exception:\n") + e.what()); + } + } SourceOpenAL::SourceOpenAL() : mSoundData( 0 ) { @@ -91,23 +104,38 @@ return Vector3( x, y, z ); } - void SourceOpenAL::setSoundData( ISoundData* pSoundData ) + void SourceOpenAL::setSoundData( SoundDataPtr pSoundData ) { - YAKE_ASSERT( pSoundData ).debug("Need a valid pointer to sound data!"); if (!pSoundData) + { + this->stop(); + mSoundDataPtr.reset(); + mSoundData = 0; return; - mSoundData = static_cast< SoundDataOpenALBase* >( pSoundData ); + } + + mSoundDataPtr = pSoundData; + mSoundData = static_cast< SoundDataOpenALBase* >( pSoundData.get() ); YAKE_ASSERT( mSoundData ).debug("Very bad! Need sound data matching to audio system!"); if (!mSoundData) return; YAKE_ASSERT( mSource.valid() ); + openalpp::Source* source = static_cast<openalpp::Source*>(mSource.get()); if (mSoundData->getType_() == SoundDataOpenALBase::kStream) - static_cast<openalpp::Source*>(mSource.get())->setSound( static_cast< openalpp::Stream* >( mSoundData->getSoundData_().get() ) ); + { + source->setSound( static_cast< openalpp::Stream* >( mSoundData->getSoundData_().get() ) ); + source->setAmbient( true ); //@todo make configurable via interface + } else + { if (mSoundData->getType_() == SoundDataOpenALBase::kSample) - static_cast<openalpp::Source*>(mSource.get())->setSound( static_cast< openalpp::Sample* >( mSoundData->getSoundData_().get() ) ); + { + source->setSound( static_cast< openalpp::Sample* >( mSoundData->getSoundData_().get() ) ); + source->setAmbient( false ); //@todo make configurable via interface + } + } if (mSoundData->getLoopMode() == ISoundData::SLM_LOOP_ON) mSource->setLooping( true ); Modified: trunk/yake/src/plugins/audioOpenAL/yakeAudioWorldOpenAL.cpp =================================================================== --- trunk/yake/src/plugins/audioOpenAL/yakeAudioWorldOpenAL.cpp 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/src/plugins/audioOpenAL/yakeAudioWorldOpenAL.cpp 2007-04-16 16:50:25 UTC (rev 1706) @@ -39,9 +39,9 @@ AudioSystemOpenAL::~AudioSystemOpenAL() { } - IWorld* AudioSystemOpenAL::createWorld() + WorldPtr AudioSystemOpenAL::createWorld() { - return new WorldOpenAL(); + return WorldPtr( new WorldOpenAL() ); } WorldOpenAL::WorldOpenAL() : mEnv(0) @@ -63,9 +63,9 @@ { } - ISoundData* WorldOpenAL::createSoundDataFromFile( const String & filename ) + SoundDataPtr WorldOpenAL::createSoundDataFromFile( const String & filename, const bool streaming /*= false*/ ) { - return new SoundDataFile( filename ); + return streaming ? SoundDataPtr( new SoundDataStream( filename ) ) : SoundDataPtr( new SoundDataFile( filename ) ); } /* @@ -79,18 +79,19 @@ return 0; }*/ - IListener* WorldOpenAL::createListener() + ListenerPtr WorldOpenAL::createListener() { - return new ListenerOpenAL(); + return ListenerPtr( new ListenerOpenAL() ); } - ISource* WorldOpenAL::createSource() + SourcePtr WorldOpenAL::createSource() { - return new SourceOpenAL(); + return SourcePtr( new SourceOpenAL() ); } - void WorldOpenAL::setActiveListener( IListener* pListener ) + void WorldOpenAL::setActiveListener( ListenerPtr pListener ) { + YAKE_ASSERT( false ).warning("setActiveListener: not supported"); } void WorldOpenAL::setDopplerFactor( real factor ) Modified: trunk/yake/yake/audio/yakeAudioPrerequisites.h =================================================================== --- trunk/yake/yake/audio/yakeAudioPrerequisites.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/audio/yakeAudioPrerequisites.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -27,6 +27,8 @@ #ifndef YAKE_AUDIOPREREQUISITES_H #define YAKE_AUDIOPREREQUISITES_H +#include <yake/base/yakePrerequisites.h> + #ifdef YAKE_AUDIO_EXPORTS # pragma message("Exporting yake::audio") # define YAKE_AUDIO_API DLLEXPORT Modified: trunk/yake/yake/audio/yakeAudioSystem.h =================================================================== --- trunk/yake/yake/audio/yakeAudioSystem.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/audio/yakeAudioSystem.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -28,6 +28,11 @@ #define INC_YAKE_AUDIOSYSTEM_H #include <yake/audio/yakeAudioPrerequisites.h> +#include <yake/base/yakeMovable.h> +#include <yake/base/yakeString.h> +#include <yake/base/templates/yakeManager.h> +#include <yake/base/templates/yakeRegistry.h> +#include <yake/base/templates/yakePointer.h> namespace yake { namespace audio { @@ -68,6 +73,7 @@ //virtual getChannelMode() const = 0; //virtual getDataMode() const = 0; }; + typedef SharedPtr<ISoundData> SoundDataPtr; /** Represents an emitter of sound. */ @@ -78,7 +84,7 @@ virtual void setVelocity( const math::Vector3 & velocity ) = 0; virtual math::Vector3 getVelocity() const = 0; - virtual void setSoundData( ISoundData* pSoundData ) = 0; + virtual void setSoundData( SoundDataPtr pSoundData ) = 0; //virtual void setSoundData( const String & resourceName ) = 0; virtual void play() = 0; virtual void stop() = 0; @@ -96,6 +102,7 @@ virtual Quaternion getDerivedOrientation() const { return this->getOrientation(); } }; + typedef SharedPtr<ISource> SourcePtr; /** A listener in a world. */ @@ -111,6 +118,7 @@ virtual Quaternion getDerivedOrientation() const { return this->getOrientation(); } }; + typedef SharedPtr<IListener> ListenerPtr; /** Represents an environment in which an audio simulation takes place. It also is responsible for creating and managing audio sources and listeners. @@ -120,7 +128,7 @@ public: virtual ~IWorld() {} - virtual ISoundData* createSoundDataFromFile( const String & filename ) = 0; + virtual SoundDataPtr createSoundDataFromFile( const String & filename, const bool streaming = false ) = 0; /*virtual ISoundData* createSoundData( bool b3D, ISoundData::LoopMode loopMode = ISoundData::SLM_LOOP_OFF, ISoundData::ChannelMode channelMode = ISoundData::SCM_AUTOSELECT, @@ -128,17 +136,18 @@ /** Create a listener and return a pointer to it. Ownership remains with the creator. */ - virtual IListener* createListener() = 0; + virtual ListenerPtr createListener() = 0; /** Create an audio source. Ownership remains with the creator. */ - virtual ISource* createSource() = 0; + virtual SourcePtr createSource() = 0; - virtual void setActiveListener( IListener* pListener ) = 0; + virtual void setActiveListener( ListenerPtr pListener ) = 0; virtual void setDopplerFactor( real factor ) = 0; virtual void setSoundVelocity( real velocity ) = 0; }; + typedef SharedPtr<IWorld> WorldPtr; /** Audio system interface. */ @@ -146,7 +155,7 @@ { public: virtual ~IAudioSystem(); - virtual IWorld* createWorld() = 0; + virtual WorldPtr createWorld() = 0; YAKE_DECLARE_REGISTRY_0( IAudioSystem, yake::String ) }; Modified: trunk/yake/yake/base/templates/yakeManager.h =================================================================== --- trunk/yake/yake/base/templates/yakeManager.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/base/templates/yakeManager.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -37,6 +37,7 @@ // Yake #include <yake/base/templates/yakeFastMap.h> #include <yake/base/mpl/null_type.h> +#include <yake/base/yakeException.h> //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES Modified: trunk/yake/yake/base/yakeLibrary.h =================================================================== --- trunk/yake/yake/base/yakeLibrary.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/base/yakeLibrary.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -28,9 +28,6 @@ #define YAKE_BASE_LIBRARY_H //============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers #include <yake/base/yakePrerequisites.h> // Yake #include <yake/base/yakeString.h> @@ -38,8 +35,15 @@ #include <yake/base/native/yakeNative.h> //============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ + +// Define YAKE_LIB() to be used by Configuration objects. +#if defined(YAKE_DEBUG) +# define YAKE_LIB_SUFFIX "_d" +#else +# define YAKE_LIB_SUFFIX "" +#endif +#define YAKE_LIB(NAME) String(String("yake_")+NAME+YAKE_LIB_SUFFIX) + namespace yake { namespace base { Modified: trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h =================================================================== --- trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -83,6 +83,11 @@ public: SoundDataFile( const String & filename ); }; + class SoundDataStream : public SoundDataOpenALBase + { + public: + SoundDataStream( const String & source ); + }; class SourceOpenAL : public ISource { @@ -92,7 +97,7 @@ virtual void setVelocity( const Vector3 & velocity ); virtual Vector3 getVelocity() const; - virtual void setSoundData( ISoundData* pSoundData ); + virtual void setSoundData( SoundDataPtr pSoundData ); //virtual void setSoundData( const String & resourceName ); virtual void play(); virtual void stop(); @@ -107,6 +112,7 @@ protected: openalpp::ref_ptr<openalpp::SourceBase> mSource; SoundDataOpenALBase* mSoundData; + SoundDataPtr mSoundDataPtr; Quaternion mOrientation; }; @@ -134,17 +140,17 @@ WorldOpenAL(); virtual ~WorldOpenAL(); - virtual ISoundData* createSoundDataFromFile( const String & filename ); - /*virtual ISoundData* createSoundData( bool b3D, + virtual SoundDataPtr createSoundDataFromFile( const String & filename, const bool streaming = false ); + /*virtual SoundDataPtr createSoundData( bool b3D, ISoundData::LoopMode loopMode = ISoundData::SLM_LOOP_OFF, ISoundData::ChannelMode channelMode = ISoundData::SCM_AUTOSELECT, ISoundData::DataMode dataMode = ISoundData::SDM_16BITS);*/ - virtual IListener* createListener(); + virtual ListenerPtr createListener(); - virtual ISource* createSource(); + virtual SourcePtr createSource(); - virtual void setActiveListener( IListener* pListener ); + virtual void setActiveListener( ListenerPtr listener ); virtual void setDopplerFactor( real factor ); virtual void setSoundVelocity( real velocity ); @@ -158,7 +164,7 @@ public: AudioSystemOpenAL(); virtual ~AudioSystemOpenAL(); - virtual IWorld* createWorld(); + virtual WorldPtr createWorld(); YAKE_DECLARE_CONCRETE( AudioSystemOpenAL, "openalpp" ) }; Modified: trunk/yake/yake/raf/yakeApplication.h =================================================================== --- trunk/yake/yake/raf/yakeApplication.h 2007-04-15 17:24:40 UTC (rev 1705) +++ trunk/yake/yake/raf/yakeApplication.h 2007-04-16 16:50:25 UTC (rev 1706) @@ -27,15 +27,8 @@ #ifndef YAKE_RAF_APPLICATION_H #define YAKE_RAF_APPLICATION_H -// Define YAKE_LIB() to be used by Configuration objects. -#if defined(YAKE_DEBUG) -# define YAKE_LIB_SUFFIX "_d" -#else -# define YAKE_LIB_SUFFIX "" -#endif -#define YAKE_LIB(NAME) String(String("yake_")+NAME+YAKE_LIB_SUFFIX) +#include <yake/base/yakeLibrary.h> - namespace yake { namespace audio { class IAudioSystem; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-17 01:01:34
|
Revision: 1708 http://svn.sourceforge.net/yake/?rev=1708&view=rev Author: psyclonist Date: 2007-04-16 18:01:34 -0700 (Mon, 16 Apr 2007) Log Message: ----------- fixed static build targets Modified Paths: -------------- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp trunk/yake/scripts/premake/deps.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/tools/make_api.pl trunk/yake/yake/audio/yakeAudioPrerequisites.h trunk/yake/yake/base/yakePrerequisites.h trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/prerequisites.h trunk/yake/yake/data/yakeDataPrerequisites.h trunk/yake/yake/ent/prerequisites.h trunk/yake/yake/file/ftp_file_system/inc/config.hpp trunk/yake/yake/file/native_file_system/inc/config.hpp trunk/yake/yake/file/virtual_file_system/inc/config.hpp trunk/yake/yake/file/virtualfs/inc/config.hpp trunk/yake/yake/graphics/yakeGraphics.h trunk/yake/yake/gui/config.h trunk/yake/yake/gui_adapter/renderer_adapter_base.h trunk/yake/yake/input/yakePrerequisites.h trunk/yake/yake/loader/prerequisites.h trunk/yake/yake/model/prerequisites.h trunk/yake/yake/net/netPrerequisites.h trunk/yake/yake/netrepsvc/netEvents.h trunk/yake/yake/netrepsvc/netPrerequisites.h trunk/yake/yake/netsvc/netPrerequisites.h trunk/yake/yake/physics/yakePhysicsPrerequisites.h trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h trunk/yake/yake/plugins/ceguiOgreRendererAdapter/plugin.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCore.h trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h trunk/yake/yake/plugins/gui_cegui/config.h trunk/yake/yake/plugins/physicsNX/plugin.h trunk/yake/yake/plugins/physicsNX/yakePCH.h trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h trunk/yake/yake/plugins/registryPluginConcrete/concrete.h trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.h trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h trunk/yake/yake/raf/yakePrerequisites.h trunk/yake/yake/reflection/config.h trunk/yake/yake/registryPluginInterface/interface.h trunk/yake/yake/scripting/yakeScriptingSystem.h trunk/yake/yake/task/prerequisites.h trunk/yake/yake/thread/yakeThreadPrerequisites.h trunk/yake/yake/vehicle/yakePrerequisites.h trunk/yake/yake/yappbase/yappPrerequisites.h trunk/yake/yake/yappmsg/yakeCommon.h Modified: trunk/yake/samples/cmdrmayhem/yakeDemo.cpp =================================================================== --- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-04-17 01:01:34 UTC (rev 1708) @@ -460,6 +460,9 @@ // dirMediaRoot+sceneBaseName+".scene", dirMediaRoot+sceneBaseName+".xode", dirMediaRoot+sceneBaseName+".link" ); // create player/avatar + YAKE_ASSERT( getGraphicalWorld() ); + YAKE_ASSERT( getPhysicalWorld() ); + YAKE_ASSERT( this ); mPlayer.reset( new ControllableCharacter(*this,*getGraphicalWorld(),*getPhysicalWorld()) ); //mPlayer->setPosition( Point3(0,-52,0) ); // 2 meters above the 50 m radius sphere mPlayer->setPosition( Point3(-25.967,44.376,0.9326) ); Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/scripts/premake/deps.lua 2007-04-17 01:01:34 UTC (rev 1708) @@ -72,7 +72,9 @@ defDepLibraryPath("lua","dependencies/lua/lib") defDepLibrary("lua","lua","Release") defDepLibrary("lua","lua","ReleaseWithSymbols") +defDepLibrary("lua","lua","ReleaseLib") defDepLibrary("lua","luad","Debug") +defDepLibrary("lua","luad","DebugLib") -------------------------------------- -- Dependency package Luabind @@ -81,8 +83,10 @@ defDepIncludePath("luabind", "dependencies/luabind") defDepLibraryPath("luabind","dependencies/luabind/lib") defDepLibrary("luabind","luabind","Release") +defDepLibrary("luabind","luabind","ReleaseLib") defDepLibrary("luabind","luabind","ReleaseWithSymbols") defDepLibrary("luabind","luabindd","Debug") +defDepLibrary("luabind","luabindd","DebugLib") -------------------------------------- -- Dependency package OpenAL++ Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/scripts/premake/samples.lua 2007-04-17 01:01:34 UTC (rev 1708) @@ -24,6 +24,8 @@ "Debug", "ReleaseWithSymbols", "Release", + "DebugLib", + "ReleaseLib", } end @@ -186,3 +188,6 @@ useDep("luabind") end end + + +priv_finishSample() Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/scripts/premake/tools.lua 2007-04-17 01:01:34 UTC (rev 1708) @@ -4,6 +4,38 @@ -------------------------------------- -------------------------------------- +-- INTERNAL +-------------------------------------- +g_libs = {} +function store_current_lib() + --this just references: g_libs[package.name] = package + -- we have to 'copy' (!) to avoid a yake.vcproj and other junk. + + g_libs[package.name] = {} + g_libs[package.name].links = {} + g_libs[package.name].config = {} + + for k,lib in package.links do + table.insert( g_libs[package.name].links, lib ) + end + + --print("LIB " .. package.name) + for cfg,v in pairs(package.config) do + if type(cfg) == "string" then + table.insert( g_libs[package.name].config, cfg ) + + g_libs[package.name].config[cfg] = {} + g_libs[package.name].config[cfg].links = {} + if package.config[cfg].links then + for k,lib in pairs(package.config[cfg].links) do + table.insert( g_libs[package.name].config[cfg].links, lib ) + end + end + end + end +end + +-------------------------------------- -- PUBLIC -------------------------------------- @@ -73,10 +105,28 @@ "Debug", "ReleaseWithSymbols", "Release", + "DebugLib", + "ReleaseLib" } end +local g_first_package = true function makePackage(name) + + -- The following test is very important. + -- If 'package' is referenced (e.g. via print(package.name)) + -- then this results automatically in a yake.vcproj + -- being generated (on msvc). + -- So we want to run store_current_lib() for every one of + -- our libraries/components but we ignore the very first + -- one called "yake" as that seems to be a premake dummy component. + --if name ~= "base" then + if g_first_package then + g_first_package = false + else + store_current_lib() + end + package = newpackage() package.name = name package.kind = "dll" @@ -145,13 +195,13 @@ debugLib = package.config.DebugLib debugLib.kind = "lib" debugLib.target = (LIBFILE_PREFIX)..name.."_s"..(DEBUG_DLL_SUFFIX) - debugLib.defines = {"_DEBUG"} + debugLib.defines = {"_DEBUG","YAKE_STATIC"} debugLib.buildflags = {} releaseLib = package.config.ReleaseLib releaseLib.kind = "lib" releaseLib.target = (LIBFILE_PREFIX)..name.."_s" - releaseLib.defines = {} + releaseLib.defines = {"YAKE_STATIC"} releaseLib.buildflags = { "no-symbols", "optimize-speed", @@ -277,10 +327,86 @@ -------------------------------------- function sampleUsesConsole() if windows then - package.kind = "exe" + package.kind = "exe" -- "exe" is the console application, "winexe" the one without the console end end + +-- In case of static EXE targets we have to link to the +-- dependencies of the immediate dependencies, too. +-- For example, it's necessary to link to lua.lib if the +-- EXE project depends on 'scriptingLua'. +-- Therefore, this function searches these libraries and +-- adds them as dependencies to the EXE project for the given target. +function priv_finishSample_Target(target) + --print(" TARGET " .. package.name .. " " .. target) + + local linkscopy = {} + for k,v in pairs(package.links) do + linkscopy[v] = v + end + if package.config[target] and package.config[target].links then + for k,v in pairs(package.config[target].links) do + linkscopy[v] = v + end + end + + local linksdone = {} + + for k,lib in pairs(linkscopy) do + if linksdone[lib] then + --print(" skipping " .. lib) + else + --print(" applying " .. lib) + linksdone[lib] = true + + if g_libs[lib] then -- it's a Yake library + if g_libs[lib].config[target] and g_libs[lib].config[target].links then + for a,b in g_libs[lib].config[target].links do + if not g_libs[b] and not linksdone[b] then -- only non-Yake libraries as Yake libraries are already bound. + --print(" dep " .. b) + --addDependency(b,target) + linksdone[b] = true + end + end + end + for a,b in g_libs[lib].links do + if not g_libs[b] and not linksdone[b] then -- only non-Yake libraries as Yake libraries are already bound. + --print(" dep " .. b) + addDependency(b,target) + linksdone[b] = true + end + end + else -- it's an external lib + --print(" depx " .. lib) + addDependency(lib,target) + linksdone[lib] = true + end + end + end +end +function priv_finishSample() + -- for static link targets only + priv_finishSample_Target("DebugLib") + priv_finishSample_Target("ReleaseLib") +end + +local g_first_sample = true function makeSample(name,path) + -- See makePackage() for more details on this hack! + if g_first_sample then + g_first_sample = false + else + if package then + if package.kind == "lib" or package.kind == "dll" then + store_current_lib() + end + if package.kind == "exe" or package.kind == "winexe" then + priv_finishSample() + end + end + end + + -- create the package package = newpackage() package.name = name if windows then @@ -307,8 +433,8 @@ end - package.config.DebugLib = nil - package.config.ReleaseLib = nil + --package.config.DebugLib = nil + --package.config.ReleaseLib = nil debug = package.config.Debug debug.target = rootdir.."samples/bin/debug/"..name.."_d"..(EXEFILE_SUFFIX) @@ -331,6 +457,16 @@ "no-frame-pointer" } + debugLib = package.config.DebugLib + debugLib.target = rootdir.."samples/bin/debug/"..name.."_s_d"..(EXEFILE_SUFFIX) + debugLib.defines = {"_DEBUG","YAKE_STATIC"} + debugLib.buildflags = {} + + releaseLib = package.config.ReleaseLib + releaseLib.target = rootdir.."samples/bin/release/"..name.."_s"..(EXEFILE_SUFFIX) + releaseLib.defines = {"YAKE_STATIC"} + releaseLib.buildflags = {} + -- add sources addMatching(path.."/*.cpp") addMatching(path.."/*.h") @@ -338,6 +474,7 @@ -- core dependencies useDep("boost") + end -- Mostly used in samples.lua and custom.lua Modified: trunk/yake/scripts/tools/make_api.pl =================================================================== --- trunk/yake/scripts/tools/make_api.pl 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/scripts/tools/make_api.pl 2007-04-17 01:01:34 UTC (rev 1708) @@ -1,14 +1,6 @@ print "Generating API reference...\n\n"; -# Windows: where returns 256 for 'not found' and 0 for 'found'. -`where /q doxygen`; -if ($? == 256) -{ - print("Error: Could not locate doxygen. Bailing out.\n"); - exit -} - +#`cd ../..` or die("Error: could not change directory."); +#`doxygen documentation/api/doxyfile` or die("Error: Failed to run doxygen.") `cd ../.. && doxygen documentation/api/doxyfile`; -print $? . " \n" - Modified: trunk/yake/yake/audio/yakeAudioPrerequisites.h =================================================================== --- trunk/yake/yake/audio/yakeAudioPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/audio/yakeAudioPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -30,11 +30,9 @@ #include <yake/base/yakePrerequisites.h> #ifdef YAKE_AUDIO_EXPORTS -# pragma message("Exporting yake::audio") -# define YAKE_AUDIO_API DLLEXPORT +# define YAKE_AUDIO_API YAKE_EXPORT_API #else -# pragma message("Importing yake::audio") -# define YAKE_AUDIO_API DLLIMPORT +# define YAKE_AUDIO_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/base/yakePrerequisites.h =================================================================== --- trunk/yake/yake/base/yakePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/base/yakePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -82,11 +82,21 @@ //============================================================================ // Yake +// YAKE_IMPORT_API and YAKE_EXPORT_API +#if defined(YAKE_STATIC) +# define YAKE_IMPORT_API +# define YAKE_EXPORT_API +#else +# define YAKE_IMPORT_API DLLIMPORT +# define YAKE_EXPORT_API DLLEXPORT +#endif + // YAKE_BASE_API + #if defined( YAKE_BASE_EXPORTS ) -# define YAKE_BASE_API DLLEXPORT +# define YAKE_BASE_API YAKE_EXPORT_API #else -# define YAKE_BASE_API DLLIMPORT +# define YAKE_BASE_API YAKE_IMPORT_API #endif // YAKE_DEBUG Modified: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -48,11 +48,9 @@ typedef std::map<const std::type_info*, void(*)(lua_State*, const boost::any&)> any_converter_map; #if defined(YAKE_EXPORT_LUA_ANY_CONVERTER) -# pragma message("dllexport") -# define YAKE_LUA_ANY_CONVERTER_API DLLEXPORT +# define YAKE_LUA_ANY_CONVERTER_API YAKE_EXPORT_API #else -# pragma message("dllimport") -# define YAKE_LUA_ANY_CONVERTER_API DLLIMPORT +# define YAKE_LUA_ANY_CONVERTER_API YAKE_IMPORT_API #endif YAKE_LUA_ANY_CONVERTER_API any_converter_map& any_converters(); Modified: trunk/yake/yake/bindings.lua/prerequisites.h =================================================================== --- trunk/yake/yake/bindings.lua/prerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/bindings.lua/prerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -31,9 +31,9 @@ #include <yake/base/yakePrerequisites.h> #if defined(YAKE_BINDINGS_LUA_EXPORTS) -# define YAKE_BINDINGS_LUA_API DLLEXPORT +# define YAKE_BINDINGS_LUA_API YAKE_EXPORT_API #else -# define YAKE_BINDINGS_LUA_API DLLIMPORT +# define YAKE_BINDINGS_LUA_API YAKE_IMPORT_API #endif struct lua_State; Modified: trunk/yake/yake/data/yakeDataPrerequisites.h =================================================================== --- trunk/yake/yake/data/yakeDataPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/data/yakeDataPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,13 +27,12 @@ #ifndef YAKE_DATA_PREREQUISITES_H #define YAKE_DATA_PREREQUISITES_H +#include <yake/base/yakePrerequisites.h> + #ifdef YAKE_DATA_EXPORTS -# define YAKE_DATA_API DLLEXPORT +# define YAKE_DATA_API YAKE_EXPORT_API #else -# define YAKE_DATA_API DLLIMPORT -# if YAKE_PLATFORM == PLATFORM_WIN32 -//# pragma comment( lib, "data" ) -# endif +# define YAKE_DATA_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/ent/prerequisites.h =================================================================== --- trunk/yake/yake/ent/prerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/ent/prerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -35,9 +35,9 @@ #include "yake/object/yakeObjects.h" #if defined(YAKE_ENT_EXPORTS) -# define YAKE_ENT_API DLLEXPORT +# define YAKE_ENT_API YAKE_EXPORT_API #else -# define YAKE_ENT_API DLLIMPORT +# define YAKE_ENT_API YAKE_IMPORT_API #endif namespace yake { Modified: trunk/yake/yake/file/ftp_file_system/inc/config.hpp =================================================================== --- trunk/yake/yake/file/ftp_file_system/inc/config.hpp 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/file/ftp_file_system/inc/config.hpp 2007-04-17 01:01:34 UTC (rev 1708) @@ -4,9 +4,9 @@ #include <yake/base/yakePrerequisites.h> #if defined( YAKE_FTP_EXPORTS ) -# define YAKE_FTP_API DLLEXPORT +# define YAKE_FTP_API YAKE_EXPORT_API #else -# define YAKE_FTP_API DLLIMPORT +# define YAKE_FTP_API YAKE_IMPORT_API #endif namespace filesystem Modified: trunk/yake/yake/file/native_file_system/inc/config.hpp =================================================================== --- trunk/yake/yake/file/native_file_system/inc/config.hpp 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/file/native_file_system/inc/config.hpp 2007-04-17 01:01:34 UTC (rev 1708) @@ -5,9 +5,9 @@ #include <yake/base/templates/yakePointer.h> #if defined( YAKE_NFS_EXPORTS ) -# define YAKE_NFS_API DLLEXPORT +# define YAKE_NFS_API YAKE_EXPORT_API #else -# define YAKE_NFS_API DLLIMPORT +# define YAKE_NFS_API YAKE_IMPORT_API #endif namespace filesystem Modified: trunk/yake/yake/file/virtual_file_system/inc/config.hpp =================================================================== --- trunk/yake/yake/file/virtual_file_system/inc/config.hpp 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/file/virtual_file_system/inc/config.hpp 2007-04-17 01:01:34 UTC (rev 1708) @@ -8,9 +8,9 @@ #include <yake/base/templates/yakePointer.h> #if defined( YAKE_VFS_EXPORTS ) -# define YAKE_VFS_API DLLEXPORT +# define YAKE_VFS_API YAKE_EXPORT_API #else -# define YAKE_VFS_API DLLIMPORT +# define YAKE_VFS_API YAKE_IMPORT_API #endif namespace filesystem Modified: trunk/yake/yake/file/virtualfs/inc/config.hpp =================================================================== --- trunk/yake/yake/file/virtualfs/inc/config.hpp 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/file/virtualfs/inc/config.hpp 2007-04-17 01:01:34 UTC (rev 1708) @@ -20,9 +20,9 @@ #include <yake/base/yakePrerequisites.h> #if defined( YAKE_VIRTUALFS_EXPORTS ) -# define YAKE_VIRTUALFS_API DLLEXPORT +# define YAKE_VIRTUALFS_API YAKE_EXPORT_API #else -# define YAKE_VIRTUALFS_API DLLIMPORT +# define YAKE_VIRTUALFS_API YAKE_IMPORT_API #endif //============================================================================ Modified: trunk/yake/yake/graphics/yakeGraphics.h =================================================================== --- trunk/yake/yake/graphics/yakeGraphics.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/graphics/yakeGraphics.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,16 +27,11 @@ #ifndef YAKE_GRAPHICS_H #define YAKE_GRAPHICS_H -#if YAKE_PLATFORM == PLATFORM_WIN32 #if defined( YAKE_GRAPHICSINTERFACE_EXPORTS ) -# define YAKE_GRAPHICS_INTERFACE_API DLLEXPORT +# define YAKE_GRAPHICS_INTERFACE_API YAKE_EXPORT_API #else -# define YAKE_GRAPHICS_INTERFACE_API DLLIMPORT -//# pragma comment( lib, "graphics" ) +# define YAKE_GRAPHICS_INTERFACE_API YAKE_IMPORT_API #endif -#else -# define YAKE_GRAPHICS_INTERFACE_API -#endif #ifndef YAKE_BASE_PREREQUISITES_H #include <yake/base/yakePrerequisites.h> Modified: trunk/yake/yake/gui/config.h =================================================================== --- trunk/yake/yake/gui/config.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/gui/config.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -30,9 +30,9 @@ /* compile time flags */ // dll import/export #if defined(YAPP_GUI_EXPORTS) -# define YAPP_GUI_API DLLEXPORT +# define YAPP_GUI_API YAKE_EXPORT_API #else -# define YAPP_GUI_API DLLIMPORT +# define YAPP_GUI_API YAKE_IMPORT_API #endif Modified: trunk/yake/yake/gui_adapter/renderer_adapter_base.h =================================================================== --- trunk/yake/yake/gui_adapter/renderer_adapter_base.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/gui_adapter/renderer_adapter_base.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,9 +33,9 @@ #include <yapp/gui/config.h> #if defined(YAPP_GUI_RENDERER_ADAPTER_BASE_EXPORTS) -# define YAPP_GUI_ADAPTER_API DLLEXPORT +# define YAPP_GUI_ADAPTER_API YAKE_EXPORT_API #else -# define YAPP_GUI_ADAPTER_API DLLIMPORT +# define YAPP_GUI_ADAPTER_API YAKE_IMPORT_API #endif namespace yake Modified: trunk/yake/yake/input/yakePrerequisites.h =================================================================== --- trunk/yake/yake/input/yakePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/input/yakePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,9 +28,9 @@ #define YAKE_INPUT_PREREQUISITES_H #if defined( YAKE_INPUT_EXPORTS ) -# define YAKE_INPUT_API DLLEXPORT +# define YAKE_INPUT_API YAKE_EXPORT_API #else -# define YAKE_INPUT_API DLLIMPORT +# define YAKE_INPUT_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/loader/prerequisites.h =================================================================== --- trunk/yake/yake/loader/prerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/loader/prerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,15 +27,13 @@ #ifndef YAKE_LOADER_PREREQUISITES_H #define YAKE_LOADER_PREREQUISITES_H -#if (YAKE_PLATFORM == PLATFORM_WIN32) +#include <yake/base/yakePrerequisites.h> + #if defined(YAKE_LOADER_EXPORTS) -# define YAKE_LOADER_API DLLEXPORT +# define YAKE_LOADER_API YAKE_EXPORT_API #else -# define YAKE_LOADER_API DLLIMPORT +# define YAKE_LOADER_API YAKE_IMPORT_API #endif -#else -# define YAKE_LOADER_API -#endif #if (YAKE_PLATFORM == PLATFORM_WIN32) && !defined(YAKE_LOADER_EXPORTS) //#pragma comment(lib,"loader.lib") Modified: trunk/yake/yake/model/prerequisites.h =================================================================== --- trunk/yake/yake/model/prerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/model/prerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,9 +28,9 @@ #define YAKE_MODEL_PREREQUISITES_H #if defined(YAKE_MODEL_EXPORTS) -# define YAKE_MODEL_API DLLEXPORT +# define YAKE_MODEL_API YAKE_EXPORT_API #else -# define YAKE_MODEL_API DLLIMPORT +# define YAKE_MODEL_API YAKE_IMPORT_API #endif #if (YAKE_PLATFORM == PLATFORM_WIN32) && !defined(YAKE_MODEL_EXPORTS) Modified: trunk/yake/yake/net/netPrerequisites.h =================================================================== --- trunk/yake/yake/net/netPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/net/netPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,22 +33,9 @@ #define YAKE_NET_DLL #ifdef YAKE_NET_EXPORTS -# ifdef YAKE_NET_DLL -# define NET_API DLLEXPORT -# else -# define NET_API -# endif +# define NET_API YAKE_EXPORT_API #else -# ifdef YAKE_NET_DLL -# define NET_API DLLIMPORT -# else -# define NET_API -# endif -# if defined( _DEBUG ) -//# pragma comment(lib,"yake_net-vc80-d.lib") -# else -//# pragma comment(lib,"yake_net-vc80.lib") -# endif +# define NET_API YAKE_IMPORT_API #endif #include <cassert> Modified: trunk/yake/yake/netrepsvc/netEvents.h =================================================================== --- trunk/yake/yake/netrepsvc/netEvents.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/netrepsvc/netEvents.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -35,69 +35,84 @@ namespace yake { namespace net { - struct NETREPSVC_API s2cEvtClassTable : public yake::net::NetEvent + struct NETREPSVC_API s2cEvtClassTable : public NetEvent { DECLARE_EVENT( s2cEvtClassTable, 10 ); - virtual bool pack(yake::net::obitstream& out) const + virtual bool pack(obitstream& out) const { - std::map<int,int> c; - c[1] = 2; - c[3] = 46; - out << c; out << globalClassIds_; return true; } - virtual bool unpack(yake::net::ibitstream& in) + virtual bool unpack(ibitstream& in) { - std::map<int,int> c; - in >> c; in >> globalClassIds_; return true; } //uint8 numClassIdBits_; - std::map<std::string,yake::ent::ClassId> globalClassIds_; + std::map<std::string,ent::ClassId> globalClassIds_; void copyTo(s2cEvtClassTable& other) const { if (&other != this) other.globalClassIds_ = this->globalClassIds_; } }; - struct NETREPSVC_API s2cEvtCreateObject : public yake::net::NetEvent + struct NETREPSVC_API s2cEvtCreateObject : public NetEvent { DECLARE_EVENT( s2cEvtCreateObject, 20 ); - virtual bool pack(yake::net::obitstream& out) const + virtual bool pack(obitstream& out) const { out << objId_.classId() << objId_.serialNo(); + //@todo out << initialUpdate_; return true; } - virtual bool unpack(yake::net::ibitstream& in) + virtual bool unpack(ibitstream& in) { - yake::ent::ObjectId::ClassId clsId; - yake::ent::ObjectId::SerialNo serNo; + ent::ObjectId::ClassId clsId; + ent::ObjectId::SerialNo serNo; in >> clsId >> serNo; - objId_ = yake::ent::ObjectId(clsId,serNo); + objId_ = ent::ObjectId(clsId,serNo); + //@todo in >> initialUpdate_; return true; } - yake::ent::ObjectId objId_; + ent::ObjectId objId_; + //@todo bitchunk initialUpdate_; //length+data }; - struct s2cEvtDestroyObject : public yake::net::NetEvent + struct s2cEvtDestroyObject : public NetEvent { DECLARE_EVENT( s2cEvtDestroyObject, 21 ); - virtual bool pack(yake::net::obitstream& out) const + virtual bool pack(obitstream& out) const { out << objId_.classId() << objId_.serialNo(); return true; } - virtual bool unpack(yake::net::ibitstream& in) + virtual bool unpack(ibitstream& in) { - yake::ent::ObjectId::ClassId clsId; - yake::ent::ObjectId::SerialNo serNo; + ent::ObjectId::ClassId clsId; + ent::ObjectId::SerialNo serNo; in >> clsId >> serNo; - objId_ = yake::ent::ObjectId(clsId,serNo); + objId_ = ent::ObjectId(clsId,serNo); return true; } - yake::ent::ObjectId objId_; + ent::ObjectId objId_; }; + struct s2cEvtUpdateObject : public NetEvent + { + DECLARE_EVENT( s2cEvtUpdateObject, 22 ); + virtual bool pack(obitstream& out) const + { + out << objId_.classId() << objId_.serialNo(); + return true; + } + virtual bool unpack(ibitstream& in) + { + ent::ObjectId::ClassId clsId; + ent::ObjectId::SerialNo serNo; + in >> clsId >> serNo; + objId_ = ent::ObjectId(clsId,serNo); + return true; + } + ent::ObjectId objId_; + }; } // namespace net } // namespace yake Modified: trunk/yake/yake/netrepsvc/netPrerequisites.h =================================================================== --- trunk/yake/yake/netrepsvc/netPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/netrepsvc/netPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,24 +33,10 @@ #include <yake/netsvc/netSvc.h> #include <yake/ent/ent.h> -#if YAKE_PLATFORM == PLATFORM_WIN32 && defined(_USRDLL) -# define YAKE_NETREPSVC_DLL -#endif - #ifdef YAKE_NETREPSVC_EXPORTS -# ifdef YAKE_NETREPSVC_DLL -# pragma message("dllexport") -# define NETREPSVC_API DLLEXPORT -# else -# pragma message("lib") -# define NETREPSVC_API -# endif +# define NETREPSVC_API YAKE_EXPORT_API #else -# ifdef YAKE_NETREPSVC_DLL -# define NETREPSVC_API DLLIMPORT -# else -# define NETREPSVC_API -# endif +# define NETREPSVC_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/netsvc/netPrerequisites.h =================================================================== --- trunk/yake/yake/netsvc/netPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/netsvc/netPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -34,22 +34,9 @@ #define YAKE_NETSVC_DLL #ifdef YAKE_NETSVC_EXPORTS -# ifdef YAKE_NETSVC_DLL -# define NETSVC_API DLLEXPORT -# else -# define NETSVC_API -# endif +# define NETSVC_API YAKE_EXPORT_API #else -# ifdef YAKE_NETSVC_DLL -# define NETSVC_API DLLIMPORT -# else -# define NETSVC_API -# endif -# if defined( _DEBUG ) -//# pragma comment(lib,"yake_netsvc-vc80-d.lib") -# else -//# pragma comment(lib,"yake_netsvc-vc80.lib") -# endif +# define NETSVC_API YAKE_IMPORT_API #endif /** @todo move out */ Modified: trunk/yake/yake/physics/yakePhysicsPrerequisites.h =================================================================== --- trunk/yake/yake/physics/yakePhysicsPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/physics/yakePhysicsPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -43,9 +43,9 @@ // -- #if defined( YAKE_PHYSICS_EXPORTS ) -# define YAKE_PHYSICS_API DLLEXPORT +# define YAKE_PHYSICS_API YAKE_EXPORT_API #else -# define YAKE_PHYSICS_API DLLIMPORT +# define YAKE_PHYSICS_API YAKE_IMPORT_API #endif #include <boost/any.hpp> Modified: trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h =================================================================== --- trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -29,10 +29,10 @@ #ifdef YAKE_AUDIO_OPENAL_EXPORTS # pragma message("Exporting yake::audio::openalpp") -# define YAKE_AUDIO_OPENAL_API DLLEXPORT +# define YAKE_AUDIO_OPENAL_API YAKE_EXPORT_API #else # pragma message("Importing yake::audio::openalpp") -# define YAKE_AUDIO_OPENAL_API DLLIMPORT +# define YAKE_AUDIO_OPENAL_API YAKE_IMPORT_API #endif namespace yake { Modified: trunk/yake/yake/plugins/ceguiOgreRendererAdapter/plugin.h =================================================================== --- trunk/yake/yake/plugins/ceguiOgreRendererAdapter/plugin.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/ceguiOgreRendererAdapter/plugin.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -25,9 +25,9 @@ ------------------------------------------------------------------------------------ */ #ifdef YAKE_CEGUIRENDERERADAPTER_OGRE_EXPORTS -#define CEGUIADAPTEROGRE_API DLLEXPORT +#define CEGUIADAPTEROGRE_API YAKE_EXPORT_API #else -#define CEGUIADAPTEROGRE_API DLLIMPORT +#define CEGUIADAPTEROGRE_API YAKE_IMPORT_API #endif extern "C" Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCore.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCore.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgreCore.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,11 +27,7 @@ #ifndef YAKE_GRAPHICSSYSTEMOGRE_CORE_H #define YAKE_GRAPHICSSYSTEMOGRE_CORE_H -#if defined( YAKE_GRAPHICSCONCRETEAPI_EXPORTS ) -# define YAKE_GRAPHICS_CONCRETE_API DLLEXPORT -#else -# define YAKE_GRAPHICS_CONCRETE_API DLLIMPORT -#endif +#include <yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h> namespace Ogre { class SceneManager; Modified: trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h =================================================================== --- trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/graphicsOgre/graphicsOgrePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,9 +28,9 @@ #define YAKE_GRAPHICS_OGRE_PREREQUISITES_H #if defined( YAKE_GRAPHICSCONCRETEAPI_EXPORTS ) -# define YAKE_GRAPHICS_CONCRETE_API DLLEXPORT +# define YAKE_GRAPHICS_CONCRETE_API YAKE_EXPORT_API #else -# define YAKE_GRAPHICS_CONCRETE_API DLLIMPORT +# define YAKE_GRAPHICS_CONCRETE_API YAKE_IMPORT_API #endif #if YAKE_PLATFORM == PLATFORM_WIN32 Modified: trunk/yake/yake/plugins/gui_cegui/config.h =================================================================== --- trunk/yake/yake/plugins/gui_cegui/config.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/gui_cegui/config.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -30,9 +30,9 @@ /* compile time flags */ // dll import/export #if defined(YAPP_GUI_CEGUI_EXPORTS) -# define YAPP_GUI_CEGUI_API DLLEXPORT +# define YAPP_GUI_CEGUI_API YAKE_EXPORT_API #else -# define YAPP_GUI_CEGUI_API DLLIMPORT +# define YAPP_GUI_CEGUI_API YAKE_IMPORT_API #endif #endif // _YAPP_GUI_CEGUI_CONFIG_H_ Modified: trunk/yake/yake/plugins/physicsNX/plugin.h =================================================================== --- trunk/yake/yake/plugins/physicsNX/plugin.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/physicsNX/plugin.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -31,9 +31,9 @@ // SCRIPTINGLUA_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. #ifdef YAKE_PHYSICS_NX_EXPORTS -# define PHYSICSODE_API DLLEXPORT +# define PHYSICSODE_API YAKE_EXPORT_API #else -# define PHYSICSODE_API DLLIMPORT +# define PHYSICSODE_API YAKE_IMPORT_API #endif #include <yake/plugins/physicsODE/PhysicsSystemODE.h> Modified: trunk/yake/yake/plugins/physicsNX/yakePCH.h =================================================================== --- trunk/yake/yake/plugins/physicsNX/yakePCH.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/physicsNX/yakePCH.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -36,9 +36,9 @@ #include <yake/physics/yakePhysics.h> #ifdef YAKE_PHYSICS_NX_EXPORTS -# define YAKE_PHYSICSNX_API DLLEXPORT +# define YAKE_PHYSICSNX_API YAKE_EXPORT_API #else -# define YAKE_PHYSICSNX_API DLLIMPORT +# define YAKE_PHYSICSNX_API YAKE_IMPORT_API #endif namespace yake { Modified: trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,13 +28,9 @@ #define YAKE_PHYSICS_ODE_PREREQUISITES_H #ifdef YAKEPHYSICSODE_EXPORTS -# define YAKE_PHYSICSODE_API DLLEXPORT +# define YAKE_PHYSICSODE_API YAKE_EXPORT_API #else -# pragma message("Importing yake::physicsOde") -# define YAKE_PHYSICSODE_API DLLIMPORT -# if YAKE_PLATFORM == PLATFORM_WIN32 -//# pragma comment(lib,"physicsODE") -# endif +# define YAKE_PHYSICSODE_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/plugins/registryPluginConcrete/concrete.h =================================================================== --- trunk/yake/yake/plugins/registryPluginConcrete/concrete.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/registryPluginConcrete/concrete.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,9 +33,9 @@ #include <yake/registryPluginInterface/interface.h> #if defined( YAKE_REGISTRYPLUGINCONCRETE_EXPORTS ) -# define YAKE_REGISTRY_PLUGIN_CONCRETE_API DLLEXPORT +# define YAKE_REGISTRY_PLUGIN_CONCRETE_API YAKE_EXPORT_API #else -# define YAKE_REGISTRY_PLUGIN_CONCRETE_API DLLIMPORT +# define YAKE_REGISTRY_PLUGIN_CONCRETE_API YAKE_IMPORT_API #endif //============================================================================ Modified: trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.h =================================================================== --- trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/renderer_adapter_cegui_ogre/renderer_adapter_cegui_ogre.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -35,9 +35,9 @@ #include <yapp/plugins/gui_cegui/gui_system.h> #ifdef YAPP_CONCRETE_GUI_ADAPTER_EXPORTS -# define YAPP_CONCRETE_GUI_ADAPTER_API DLLEXPORT +# define YAPP_CONCRETE_GUI_ADAPTER_API YAKE_EXPORT_API #else -# define YAPP_CONCRETE_GUI_ADAPTER_API DLLIMPORT +# define YAPP_CONCRETE_GUI_ADAPTER_API YAKE_IMPORT_API #endif namespace yake Modified: trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h =================================================================== --- trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,9 +33,9 @@ #include <boost/noncopyable.hpp> #if defined( YAKE_SCRIPTINGLUA_EXPORTS ) -# define YAKE_SCRIPTINLUA_API DLLEXPORT +# define YAKE_SCRIPTINLUA_API YAKE_EXPORT_API #else -# define YAKE_SCRIPTINLUA_API DLLIMPORT +# define YAKE_SCRIPTINLUA_API YAKE_IMPORT_API #endif struct lua_State; Modified: trunk/yake/yake/raf/yakePrerequisites.h =================================================================== --- trunk/yake/yake/raf/yakePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/raf/yakePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,17 +27,10 @@ #ifndef YAKE_RAF_PREREQUISITES_H #define YAKE_RAF_PREREQUISITES_H -#if YAKE_PLATFORM == PLATFORM_WIN32 -# if defined(YAKE_RAF_EXPORTS) -# define YAKE_RAF_API DLLEXPORT -# else -# define YAKE_RAF_API DLLIMPORT -# if YAKE_PLATFORM == PLATFORM_WIN32 -//# pragma comment(lib,"raf.lib") -# endif -# endif +#if defined(YAKE_RAF_EXPORTS) +# define YAKE_RAF_API YAKE_EXPORT_API #else -# define YAKE_RAF_API +# define YAKE_RAF_API YAKE_IMPORT_API #endif // configuration Modified: trunk/yake/yake/reflection/config.h =================================================================== --- trunk/yake/yake/reflection/config.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/reflection/config.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -36,9 +36,9 @@ /* compile time flags */ // dll import/export #if defined( YAKE_REFLECTION_EXPORTS ) -# define YAKE_REFLECTION_API DLLEXPORT +# define YAKE_REFLECTION_API YAKE_EXPORT_API #else -# define YAKE_REFLECTION_API DLLIMPORT +# define YAKE_REFLECTION_API YAKE_IMPORT_API #endif // luabind versions Modified: trunk/yake/yake/registryPluginInterface/interface.h =================================================================== --- trunk/yake/yake/registryPluginInterface/interface.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/registryPluginInterface/interface.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -33,9 +33,9 @@ #include <yake/base/yakePCH.h> #if defined( YAKE_REGISTRYPLUGININTERFACE_EXPORTS ) -# define YAKE_REGISTRY_PLUGIN_INTERFACE_API DLLEXPORT +# define YAKE_REGISTRY_PLUGIN_INTERFACE_API YAKE_EXPORT_API #else -# define YAKE_REGISTRY_PLUGIN_INTERFACE_API DLLIMPORT +# define YAKE_REGISTRY_PLUGIN_INTERFACE_API YAKE_IMPORT_API #endif //============================================================================ Modified: trunk/yake/yake/scripting/yakeScriptingSystem.h =================================================================== --- trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/scripting/yakeScriptingSystem.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -36,11 +36,9 @@ #include <yake/base/templates/yakeRegistry.h> #if defined( YAKE_SCRIPTING_EXPORTS ) -# pragma message("Exporting yake::scripting") -# define YAKE_SCRIPTING_API DLLEXPORT +# define YAKE_SCRIPTING_API YAKE_EXPORT_API #else -# pragma message("Importing yake::scripting") -# define YAKE_SCRIPTING_API DLLIMPORT +# define YAKE_SCRIPTING_API YAKE_IMPORT_API #endif namespace yake { Modified: trunk/yake/yake/task/prerequisites.h =================================================================== --- trunk/yake/yake/task/prerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/task/prerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -30,9 +30,9 @@ #include <yake/base/yakePrerequisites.h> #if defined( YAKE_TASK_EXPORTS ) -# define YAKE_TASK_API DLLEXPORT +# define YAKE_TASK_API YAKE_EXPORT_API #else -# define YAKE_TASK_API DLLIMPORT +# define YAKE_TASK_API YAKE_IMPORT_API #endif #endif Modified: trunk/yake/yake/thread/yakeThreadPrerequisites.h =================================================================== --- trunk/yake/yake/thread/yakeThreadPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/thread/yakeThreadPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,9 +28,9 @@ #define YAKE_THREAD_PREREQUISITES_H #ifdef YAKE_THREAD_EXPORTS -# define YAKE_THREAD_API DLLEXPORT +# define YAKE_THREAD_API YAKE_EXPORT_API #else -# define YAKE_THREAD_API DLLIMPORT +# define YAKE_THREAD_API YAKE_IMPORT_API #endif #define YAKE_THREAD_COMMON_POINTERS( CLASS ) \ Modified: trunk/yake/yake/vehicle/yakePrerequisites.h =================================================================== --- trunk/yake/yake/vehicle/yakePrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/vehicle/yakePrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,9 +28,9 @@ #define YAKE_VEHICLE_PREREQUISITES_H #if defined(YAKE_VEHICLE_EXPORTS) -# define YAKE_VEH_API DLLEXPORT +# define YAKE_VEH_API YAKE_EXPORT_API #else -# define YAKE_VEH_API DLLIMPORT +# define YAKE_VEH_API YAKE_IMPORT_API #endif #include <yake/model/model.h> Modified: trunk/yake/yake/yappbase/yappPrerequisites.h =================================================================== --- trunk/yake/yake/yappbase/yappPrerequisites.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/yappbase/yappPrerequisites.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -28,15 +28,15 @@ #define YAPP_PREREQUISITES_H #if defined(YAPP_BASE_EXPORTS) -# define YAPP_BASE_API DLLEXPORT +# define YAPP_BASE_API YAKE_EXPORT_API #else -# define YAPP_BASE_API DLLIMPORT +# define YAPP_BASE_API YAKE_IMPORT_API #endif #if defined(YAPP_GUI_EXPORTS) -# define YAPP_GUI_API DLLEXPORT +# define YAPP_GUI_API YAKE_EXPORT_API #else -# define YAPP_GUI_API DLLIMPORT +# define YAPP_GUI_API YAKE_IMPORT_API #endif #define YAKE_MEMBER_SIGNAL( NAME, TYPE, ACCESS ) \ Modified: trunk/yake/yake/yappmsg/yakeCommon.h =================================================================== --- trunk/yake/yake/yappmsg/yakeCommon.h 2007-04-16 20:43:47 UTC (rev 1707) +++ trunk/yake/yake/yappmsg/yakeCommon.h 2007-04-17 01:01:34 UTC (rev 1708) @@ -27,15 +27,10 @@ #ifndef YAKE_MSG_COMMON_H #define YAKE_MSG_COMMON_H -#if YAKE_PLATFORM == PLATFORM_WIN32 -# if defined(YAKE_MSG_EXPORTS) -# define YAKE_MSG_API DLLEXPORT -# else -# define YAKE_MSG_API DLLIMPORT -//# pragma comment(lib, "msg.lib") -# endif +#if defined(YAKE_MSG_EXPORTS) +# define YAKE_MSG_API YAKE_EXPORT_API #else -# define YAKE_MSG_API +# define YAKE_MSG_API YAKE_IMPORT_API #endif namespace yake { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-17 22:38:47
|
Revision: 1709 http://svn.sourceforge.net/yake/?rev=1709&view=rev Author: psyclonist Date: 2007-04-17 15:38:33 -0700 (Tue, 17 Apr 2007) Log Message: ----------- updated docs Modified Paths: -------------- trunk/yake/BUILD trunk/yake/documentation/manual/yake-manual.txt Modified: trunk/yake/BUILD =================================================================== --- trunk/yake/BUILD 2007-04-17 01:01:34 UTC (rev 1708) +++ trunk/yake/BUILD 2007-04-17 22:38:33 UTC (rev 1709) @@ -75,14 +75,14 @@ 1.1.3 Requirements ---------------------------------------------------------- - * a recent C++ compiler (MSVC7.1+ or GCC 3.3+) + * a recent C++ compiler (MSVC7.1/8.0+ or GCC 3.3/3.4/4.x+) * a good standard template library (STL) - * boost 1.32.x or above (not all libraries are needed) + * boost 1.33.x or above (not all libraries are needed) For specific components additional dependencies are required. These include: * ODE 0.6/0.7 for physicsODE - * OGRE 1.2.x+ for graphicsOGRE + * OGRE 1.4.x+ for graphicsOGRE * Lua 5.x for scriptingLua, entLua etc * Luabind 0.7+ for scriptingLua, entLua etc * CEGUI 0.5.x @@ -140,6 +140,8 @@ 2.1 Building Yake with premake ------------------------------------------ +* Choose a distribution + * Install premake Note: The build script generation below expects the 'premake' executable @@ -199,50 +201,13 @@ dependencies dir as it is described in Yake forums to avoid string redefinition ( just comment out Ogre's definitions of additional operators ). -Next, you have 2 options for building Yake. -Way 1. SCons [RECOMMENDED] -Install SCons build system. Just 'emerge scons' if you are on Gentoo like me, or go to www.scons.org or search for -package for your distro. +Open a console and navigate to Yake's root directory. -Then go to yake root dir and run: -# scons + # cd scripts/linux + # ./build.sh + # make -That will build everything. After that as root: -# scons install -That installs libraries. -Update dynamic loader cache (as root): -# ldconfig - -Now you will find all demos in common/bin directory ;) - -ATTENTION! This is my preferred way to build Yake. It is best supported by me from now on ( 10/2005 ). - -Way 2. KDevelop/automake -#. Execute autogen.sh script - it will create various missing scripts needed for automake & friends. - -Now there are two ways of building Yake: automated-command-line and IDE-wise ;) -If you want command line build then do as usual: - ./configure - make - make install - -Else, KDevelop'ers could do: -#. Run KDevelop and open project file from yake root dir. -#. Run automake and friends from KDevelop Build menu. -#. Run configure from Build menu. - -#. You can start building libraries now. -You can just build the whole project. - -# Install all built libraries (with root rights). They are all installed in /usr/local/lib by default - -# In Project settings change run options. There are absolute paths to the program to run. You should change that -according to your configuration. - -# From now on you're able to run the demos. -You will need to set up working dir for demo, e.g. create config files and have Ogre's media. - 3 BUILD INSTRUCTIONS FOR CUSTOM PROJECTS ---------------------------------------- Modified: trunk/yake/documentation/manual/yake-manual.txt =================================================================== --- trunk/yake/documentation/manual/yake-manual.txt 2007-04-17 01:01:34 UTC (rev 1708) +++ trunk/yake/documentation/manual/yake-manual.txt 2007-04-17 22:38:33 UTC (rev 1709) @@ -92,14 +92,14 @@ For specific components/plugins additional dependencies may be required. 1. ODE 0.7/0.8 for physicsODE -#. OGRE 1.2.x+ for graphicsOGRE +#. OGRE 1.3/1.4 for graphicsOGRE #. Lua 5.x for scriptingLua, entLua etc #. Luabind 0.7+ for scriptingLua, entLua etc #. CEGUI 0.5.x for graphical UI #. OpenAL 1.1 SDK for audioOpenAL #. OpenAL++ for audioOpenAL -#. TinyXML for data -#. Enet 1.x for networking +#. TinyXML 2.5.x for data +#. Enet 1.0.x for networking Supported platforms: @@ -187,7 +187,8 @@ .. note:: The build scripts for the various platforms and compilers are generated from - premake scripts. + premake scripts. You either have to install premake yourself. The official + dependency packages for Yake ship with the executable already in place. Configuration ~~~~~~~~~~~~~ @@ -201,8 +202,8 @@ By default, the configuration is set to build all libraries and demos thereby maximizing the available feature set. -Building with Microsoft Visual C++ 7.1/8.0 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Building with Microsoft Visual C++ 2003/2005 (7.1/8.0) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Obtain the sources via one of the methods listed previously. #. Provide dependencies. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-20 15:48:21
|
Revision: 1716 http://svn.sourceforge.net/yake/?rev=1716&view=rev Author: psyclonist Date: 2007-04-20 08:48:21 -0700 (Fri, 20 Apr 2007) Log Message: ----------- fixes because of interface change in yake::scripting Modified Paths: -------------- trunk/yake/samples/ent/sampleEntFsm/demo.cpp trunk/yake/scripts/premake/samples.lua trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/ent/entity.cpp trunk/yake/src/ent/vm_holder.cpp trunk/yake/yake/ent/entity.h trunk/yake/yake/ent/vm_holder.h Added Paths: ----------- trunk/yake/yake/scripting/scripting.h Modified: trunk/yake/samples/ent/sampleEntFsm/demo.cpp =================================================================== --- trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2007-04-20 15:48:21 UTC (rev 1716) @@ -1,7 +1,9 @@ //#include "yake/base/yakePrerequisites.h" #include "yake/base/yake.h" #include "yake/ent/ent.h" -#include "yake/plugins/entLua/entLua.h" +#include "yake/scripting/scripting.h" +#include "yake/bindings.lua/bindings.lua.h" +#include "yake/bindings.lua/bindings.lua.ent.h" using namespace yake; @@ -22,8 +24,9 @@ { YAKE_LOG( "exappOML", "onObjectCreated: class is '" + obj->isA()->name() + "'" ); - scripting::IVM* vm = scriptingSys_.createVM(); + scripting::VMPtr vm = scriptingSys_.createVM(); YAKE_ASSERT( vm ); + bind_all( vm.get() ); ent::Entity* ent = ent::Entity::cast(obj); YAKE_ASSERT( ent ); @@ -34,9 +37,9 @@ ent::Entity* ent = ent::Entity::cast(obj); YAKE_ASSERT( ent ); - scripting::IVM* vm = ent->detachVM("main"); + scripting::VMPtr vm = ent->detachVM("main"); YAKE_ASSERT( vm ); - delete vm; + // vm will destruct when scope is left. } virtual void onObjectInitialized(ent::Object* obj) { Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/scripts/premake/samples.lua 2007-04-20 15:48:21 UTC (rev 1716) @@ -45,7 +45,7 @@ useComponent("base") useComponent("scripting") useComponent("ent") -useComponent("entLua") +useComponent("bindings.lua") -------------------------------------- makeSample("sampleAudio1","samples/audio/demo1") Modified: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-04-20 15:48:21 UTC (rev 1716) @@ -174,7 +174,7 @@ Entity* ent = Entity::cast(&obj); if (ent) { - scripting::IVM* vm = ent->getFsmVM(); + scripting::VMPtr vm = ent->getFsmVM(); YAKE_ASSERT( vm ); detail::executeOfTable_2(*vm,"state",state,"on_enter"); } @@ -184,7 +184,7 @@ Entity* ent = Entity::cast(&obj); if (ent) { - scripting::IVM* vm = ent->getFsmVM(); + scripting::VMPtr vm = ent->getFsmVM(); YAKE_ASSERT( vm ); detail::executeOfTable_2(*vm,"state",state,"on_exit"); } Modified: trunk/yake/src/ent/entity.cpp =================================================================== --- trunk/yake/src/ent/entity.cpp 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/src/ent/entity.cpp 2007-04-20 15:48:21 UTC (rev 1716) @@ -76,18 +76,22 @@ { return vms_.subscribeToVmDetached(slot); } - bool Entity::attachVM(scripting::IVM* vm,const String& tag) + bool Entity::attachVM(scripting::VMPtr vm,const String& tag) { return vms_.attachVM(vm,tag); } - scripting::IVM* Entity::detachVM(const String& tag) + scripting::VMPtr Entity::detachVM(const String& tag) { return vms_.detachVM(tag); } - scripting::IVM* Entity::getVM(const String& tag) const + scripting::VMPtr Entity::getVM(const String& tag) const { return vms_.getVM(tag); } + scripting::VMPtr Entity::getFsmVM() const + { + return this->getVM("main"); + } void Entity::setModel(ModelPtr modelPtr) { model_ = modelPtr; Modified: trunk/yake/src/ent/vm_holder.cpp =================================================================== --- trunk/yake/src/ent/vm_holder.cpp 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/src/ent/vm_holder.cpp 2007-04-20 15:48:21 UTC (rev 1716) @@ -44,7 +44,7 @@ */ vms_.clear(); } - bool VMHolder::attachVM(scripting::IVM* vm,const String& tag) + bool VMHolder::attachVM(scripting::VMPtr vm,const String& tag) { YAKE_ASSERT(vm)(tag).debug("null vm"); if (!vm) @@ -60,29 +60,29 @@ sigAttached_(tag,vm); return true; } - scripting::IVM* VMHolder::detachVM(const String &tag) + scripting::VMPtr VMHolder::detachVM(const String &tag) { YAKE_ASSERT( !tag.empty() )(tag).debug("invalid tag"); if (tag.empty()) - return 0; + return scripting::VMPtr(); VmMap::iterator it = vms_.find(tag); YAKE_ASSERT( it != vms_.end() )(tag).debug("tag not found."); if (vms_.end() == it) - return 0; - scripting::IVM* vm = it->second; + return scripting::VMPtr(); + scripting::VMPtr vm = it->second; vms_.erase(tag); sigAttached_(tag,vm); return vm; } - scripting::IVM* VMHolder::getVM(const String &tag) const + scripting::VMPtr VMHolder::getVM(const String &tag) const { YAKE_ASSERT( !tag.empty() )(tag).debug("invalid tag"); if (tag.empty()) - return 0; + return scripting::VMPtr(); VmMap::const_iterator it = vms_.find(tag); YAKE_ASSERT( it != vms_.end() )(tag).debug("tag not found."); if (vms_.end() == it) - return 0; + return scripting::VMPtr(); return it->second; } SignalConnection VMHolder::subsribeToVmAttached(const VmAttachedSignal::slot_type& slot) Modified: trunk/yake/yake/ent/entity.h =================================================================== --- trunk/yake/yake/ent/entity.h 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/yake/ent/entity.h 2007-04-20 15:48:21 UTC (rev 1716) @@ -60,14 +60,11 @@ SignalConnection subsribeToVmAttached(const VMHolder::VmAttachedSignal::slot_type&); SignalConnection subscribeToVmDetached(const VMHolder::VmDetachedSignal::slot_type&); - bool attachVM(scripting::IVM*,const String& tag); - scripting::IVM* detachVM(const String& tag); - scripting::IVM* getVM(const String& tag) const; + bool attachVM(scripting::VMPtr,const String& tag); + scripting::VMPtr detachVM(const String& tag); + scripting::VMPtr getVM(const String& tag) const; - scripting::IVM* getFsmVM() const - { - return this->getVM("main"); - } + scripting::VMPtr getFsmVM() const; void setModel(ModelPtr); ModelPtr getModel() const; @@ -94,7 +91,7 @@ #endif // signals - typedef boost::signal<void(const String&,scripting::IVM*)> VmInitializedSignal; + typedef boost::signal<void(const String&,scripting::VMPtr)> VmInitializedSignal; boost::signals::connection subscribeToVmInitialized(const VmInitializedSignal::slot_type&); private: Modified: trunk/yake/yake/ent/vm_holder.h =================================================================== --- trunk/yake/yake/ent/vm_holder.h 2007-04-20 15:25:55 UTC (rev 1715) +++ trunk/yake/yake/ent/vm_holder.h 2007-04-20 15:48:21 UTC (rev 1716) @@ -29,12 +29,9 @@ #include "yake/ent/prerequisites.h" #include "yake/ent/object_listener.h" +#include "yake/scripting/scripting.h" namespace yake { -namespace scripting { - class IVM; - class IScriptingSystem; -} namespace ent { /** Container for scripting machines with optional tags for identification. @@ -50,19 +47,19 @@ // operations /** @note Currently ownership is not transferred! */ - bool attachVM(scripting::IVM*,const String& tag); - scripting::IVM* detachVM(const String& tag); - scripting::IVM* getVM(const String& tag) const; + bool attachVM(scripting::VMPtr,const String& tag); + scripting::VMPtr detachVM(const String& tag); + scripting::VMPtr getVM(const String& tag) const; // signals - typedef SignalX<void(const String&,scripting::IVM*)> VmAttachedSignal; + typedef SignalX<void(const String&,scripting::VMPtr)> VmAttachedSignal; SignalConnection subsribeToVmAttached(const VmAttachedSignal::slot_type&); - typedef SignalX<void(const String&,scripting::IVM*)> VmDetachedSignal; + typedef SignalX<void(const String&,scripting::VMPtr)> VmDetachedSignal; SignalConnection subscribeToVmDetached(const VmDetachedSignal::slot_type&); private: VmAttachedSignal sigAttached_; VmDetachedSignal sigDetached_; - typedef std::map<String,scripting::IVM*> VmMap; + typedef std::map<String,scripting::VMPtr> VmMap; VmMap vms_; }; Added: trunk/yake/yake/scripting/scripting.h =================================================================== --- trunk/yake/yake/scripting/scripting.h (rev 0) +++ trunk/yake/yake/scripting/scripting.h 2007-04-20 15:48:21 UTC (rev 1716) @@ -0,0 +1,33 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_SCRIPTING_H +#define YAKE_SCRIPTING_H + +#include <yake/scripting/yakeScriptingSystem.h> + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-20 19:51:24
|
Revision: 1718 http://svn.sourceforge.net/yake/?rev=1718&view=rev Author: psyclonist Date: 2007-04-20 12:51:21 -0700 (Fri, 20 Apr 2007) Log Message: ----------- added getShapeSize() Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp trunk/yake/yake/plugins/physicsODE/OdeAvatar.h Modified: trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-04-20 15:48:31 UTC (rev 1717) +++ trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-04-20 19:51:21 UTC (rev 1718) @@ -353,5 +353,11 @@ mUp = -rkGravityDirection.normalisedCopy(); } + //----------------------------------------------------- + void OdeAvatar::getShapeSize(real& radius, real& height) const + { + radius = mDimensions.x; + radius = mDimensions.y; + } } // physics } // yake Modified: trunk/yake/yake/plugins/physicsODE/OdeAvatar.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/OdeAvatar.h 2007-04-20 15:48:31 UTC (rev 1717) +++ trunk/yake/yake/plugins/physicsODE/OdeAvatar.h 2007-04-20 19:51:21 UTC (rev 1718) @@ -79,7 +79,7 @@ virtual real getAcceleration() const { return mAcceleration; } - virtual void getShapeSize(real& radius, real& height); + virtual void getShapeSize(real& radius, real& height) const; YAKE_MEMBERSIGNAL_VIRTUALIMPL(public, void(bool), OnJump) YAKE_MEMBERSIGNAL_FIRE_FN1(public, OnJump, jumping, bool) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-04-20 19:55:36
|
Revision: 1720 http://svn.sourceforge.net/yake/?rev=1720&view=rev Author: psyclonist Date: 2007-04-20 12:55:27 -0700 (Fri, 20 Apr 2007) Log Message: ----------- applied avatar patch Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeActor.cpp trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp trunk/yake/yake/physics/yakePhysicsAvatar.h Modified: trunk/yake/src/plugins/physicsODE/OdeActor.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeActor.cpp 2007-04-20 19:52:28 UTC (rev 1719) +++ trunk/yake/src/plugins/physicsODE/OdeActor.cpp 2007-04-20 19:55:27 UTC (rev 1720) @@ -126,7 +126,10 @@ { OdeSphere* pSphere = new OdeSphere( currentSpace, this, pSphereDesc->radius ); - result = createTransformGeom( pSphere, rShapeDesc.position, rShapeDesc.orientation ); + if (this->type_ == ACTOR_DYNAMIC) + result = createTransformGeom( pSphere, rShapeDesc.position, rShapeDesc.orientation ); + else + result = pSphere; } else if ( const IShape::BoxDesc* pBoxDesc = dynamic_cast<const IShape::BoxDesc*>( pShapeDesc ) ) { @@ -135,7 +138,10 @@ pBoxDesc->dimensions.x, pBoxDesc->dimensions.y, pBoxDesc->dimensions.z ); - result = createTransformGeom( pBox, rShapeDesc.position, rShapeDesc.orientation ); + if (this->type_ == ACTOR_DYNAMIC) + result = createTransformGeom( pBox, rShapeDesc.position, rShapeDesc.orientation ); + else + result = pBox; } else if ( const IShape::PlaneDesc* pPlaneDesc = dynamic_cast<const IShape::PlaneDesc*>( pShapeDesc ) ) { @@ -160,7 +166,11 @@ this, pCapsuleDesc->radius, pCapsuleDesc->height ); - result = createTransformGeom( pCapsule, rShapeDesc.position, rShapeDesc.orientation ); + if (this->type_ == ACTOR_DYNAMIC) + result = createTransformGeom( pCapsule, rShapeDesc.position, rShapeDesc.orientation ); + else + result = pCapsule; + } else if ( const IShape::TriMeshDesc* pTriMeshDesc = dynamic_cast<const IShape::TriMeshDesc*>( pShapeDesc ) ) { @@ -175,8 +185,11 @@ OdeTriMesh* pMesh = new OdeTriMesh( currentSpace, this, data.id ); YAKE_ASSERT( pMesh ).error( "Mesh with such id wasn't found!" ); + if (this->type_ == ACTOR_DYNAMIC) + result = createTransformGeom( pMesh, rShapeDesc.position, rShapeDesc.orientation ); + else + result = pMesh; - result = createTransformGeom( pMesh, rShapeDesc.position, rShapeDesc.orientation ); } YAKE_ASSERT( result != 0 ).error( "Unsupported shape type!" ); @@ -196,8 +209,8 @@ // result->setOrientation( pShapeDesc->orientation ); // } - if( mShapes.size() > 1) - addGeomToSpace( result);// it's time to create space for shapes + //if( mShapes.size() > 1) + //addGeomToSpace( result);// it's time to create space for shapes } return result; @@ -464,6 +477,8 @@ YAKE_ASSERT( pShape ); YAKE_ASSERT( mBody || !(massOrDensity) ).warning( "Attempt to set mass on nonexistant body!" ); + + if (mBody) { dGeomSetBody( pShape->_getOdeGeomID(), mBody->_getOdeBody()->id() ); @@ -472,7 +487,14 @@ { mBody->_applyMassDescFromShapeDesc( rShapeDesc, massOrDensity, type ); } + dGeomSetCategoryBits (pShape->_getOdeGeomID(),0x2); + dGeomSetCollideBits (pShape->_getOdeGeomID(),0xFFFFFFFF); } + else + { + dGeomSetCategoryBits (pShape->_getOdeGeomID(),0x1); + dGeomSetCollideBits (pShape->_getOdeGeomID(),0xFFFFFFFE); + } return pShape; } Modified: trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-04-20 19:52:28 UTC (rev 1719) +++ trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-04-20 19:55:27 UTC (rev 1720) @@ -33,6 +33,7 @@ #include <yake/plugins/physicsODE/OdeShapes.h> #include <yake/plugins/physicsODE/OdeRay.h> + namespace yake { namespace physics { @@ -54,8 +55,12 @@ mJumpApplies(0), mJumpTime(real(0.)), mCurrDirection(Vector3::kUnitZ), - mUp(Vector3::kUnitY) + mUp(Vector3::kUnitY), + mSpeed (real(15.)), + mAcceleration (real (5.)) { + YAKE_ASSERT( mOdeWorld ); + mUp = mOdeWorld ? mOdeWorld->getGlobalGravity().normalisedCopy() : Vector3::kUnitY; } //----------------------------------------------------- @@ -83,37 +88,66 @@ mOrientation = desc.orientation; mDimensions = desc.dimensions; - mHeightAboveGround = mDimensions.y*real(0.75); + mHeightAboveGround = mDimensions.y; mHeightAboveGroundDuck = real(0.5) * mHeightAboveGround; + mCapsuleHeight = mDimensions.z; + mCapsuleHeightDuck = real(0.5) * mCapsuleHeight; + mSphereRadius = mDimensions.x * real(0.5); mSphereOffset = Vector3(0,mHeightAboveGround,0); + + + //check if the height above ground is too low. + if (mHeightAboveGround < (mSphereRadius + mCapsuleHeight * 0.5)) + mHeightAboveGround = (mSphereRadius + (mCapsuleHeight * 0.5)) + real (0.1); + + if (mHeightAboveGroundDuck < (mSphereRadius + mCapsuleHeightDuck * 0.5)) + mHeightAboveGroundDuck = (mSphereRadius + (mCapsuleHeightDuck * 0.5)) + real (0.1); + + //configure ray mRayLength = 100.; // set to expected maximum height above ground... or better... mTopRayLength = 100.; + //create actor mActor = static_cast<OdeActor*>(static_cast<IWorld*>(mOdeWorld)->createActor( ACTOR_DYNAMIC )); YAKE_ASSERT( mActor ); - OdeGeom* pShape = static_cast<OdeGeom*>(mActor->createShape( IShape::SphereDesc( real(mSphereRadius) ) )); + + //Check if mCapsuleHeight is null. If it is, create a sphere if not, create a capsule. + + if (mCapsuleHeight == real(0)) + mShape = static_cast<OdeGeom*>(mActor->createShape( IShape::SphereDesc( real(mSphereRadius) ) )); + else + mShape = static_cast<OdeGeom*>(mActor->createShape( IShape::CapsuleDesc (real(mCapsuleHeight),real(mSphereRadius) ) )); + YAKE_ASSERT (mShape); + + //Set position / orientation of the Avatar. mActor->setPosition( mPosition + mSphereOffset ); mActor->setOrientation( mOrientation ); - mActor->getBody().setMass( 1 ); + //Set avatar mass. + mActor->getBody().setMass( IBody::CapsuleMassDesc (mSphereRadius,mCapsuleHeight,1) ); + + //Setup rays. mRay = new OdeRay( mOdeWorld, real(mRayLength) ); mRay->setDirection( -mUp ); - mRay->ignore( pShape->_getOdeGeomID() ); + mRay->ignore( mShape->_getOdeGeomID() ); mTopRay = new OdeRay( mOdeWorld, real(mTopRayLength) ); mTopRay->setDirection( mUp ); - mTopRay->ignore( pShape->_getOdeGeomID() ); + mTopRay->ignore( mShape->_getOdeGeomID() ); mPreStepConn = mOdeWorld->subscribeToPreStepInternal( boost::bind(&OdeAvatar::onPreStepInternal,this,_1) ); mPostStepConn = mOdeWorld->subscribeToPostStepInternal( boost::bind(&OdeAvatar::onPostStepInternal,this,_1) ); #ifdef YAKE_DEBUG std::cout << "ACTOR\n"; - std::cout << " dim = " << mDimensions << "\n"; + std::cout << " radius = " << mSphereRadius << "\n"; + std::cout << " height = " << mCapsuleHeight << "\n"; + std::cout << " height duck = " << mCapsuleHeightDuck << "\n"; std::cout << " pos = " << mPosition << "\n"; std::cout << " heightAboveGround = " << mHeightAboveGround << "\n"; + std::cout << " heightAboveGround duck= " << mHeightAboveGroundDuck << "\n"; std::cout << " sphereOffset = " << mSphereOffset << "\n"; std::cout << "\n"; #endif @@ -141,7 +175,7 @@ if (mJumpStartInProgress) { - mActor->getBody().addForce( Force( mUp * 40, RF_GLOBAL, mJumpTime) ); + mActor->getBody().addForce( Force( mUp * 40 * mActor->getBody().getMass(), RF_GLOBAL, mJumpTime) ); mJumpStartInProgress = false; return; } @@ -155,6 +189,9 @@ const Vector3 localCurrLinVel = mOrientation.Inverse() * currLinVel; const real currUpVel = localCurrLinVel.y; + const real gravL = mOdeWorld->getGlobalGravity().length(); + const Vector3 gravA = mUp * gravL; // + // const real targetHeightAboveGround = mDucking ? mHeightAboveGroundDuck : mHeightAboveGround; if (mRay->intersects()) @@ -167,41 +204,55 @@ if (!mJumping) { const Point3 intPoint = mRay->intersectionPoint(); - + // this is the 'ideal position' const Point3 targetPoint = intPoint + mUp * targetHeightAboveGround; + // determine current height above ground/object const Vector3 vCurrHeightAboveGround = (mPosition - intPoint); + + const real currHeightAboveGround = fabs((mOrientation.Inverse() * vCurrHeightAboveGround).y); - + // distToTarget < 0 if player is above ideal position // distToTarget > 0 if player is beneath ideal position const real distToTarget = targetHeightAboveGround - currHeightAboveGround; - - if (distToTarget < 0.) // if above ideal position - do nothing + + if (distToTarget < (targetHeightAboveGround * real(-0.1))) // if above ideal position + 10%, just let the gravity do the job. {} - else if (distToTarget > 0.) // if below ideal position - correct + else // if below ideal position - correct { //@todo make all this spring and damping stuff configurable... - const real k = real(1.1); - const real f1 = k * real(20.) * distToTarget; - const real f2 = k * real(10.) * currUpVel; + const real k = real(10.); + const real f1 = k * real(50.) * distToTarget; + const real f2 = k * real(5.) * currUpVel; + real f = (f1 - f2); - // upwards force to keep the avatar floating - real f = (f1 - f2); - if (f > 0.001) - { - mActor->getBody().addForce( Force(mUp * f, RF_GLOBAL) ); - } + + // upwards force to keep the avatar floating. + // gravity force is removed/countered. + const Vector3 forceOnBodyBelow((- gravA * mActor->getBody().getMass())+(mUp * f)); + + //Apply force. + mActor->getBody().addForce(Force(forceOnBodyBelow, RF_GLOBAL)); + } + //Add the avatar weight to the object below. + + IActor * actor = mRay->intersectionActor (); + if (actor && (actor->getType() == ACTOR_DYNAMIC)) + { + actor->getBody().addForce(Force(gravA * mActor->getBody().getMass(),RF_GLOBAL,mRay->intersectionPoint(),RF_GLOBAL)); + } + } } // velocity/forces in avatar's movement plane: - Vector3 localTargetVel = mCurrMoveInPlane * 15./*maxVel*/; //@todo make configurable - localTargetVel = (localTargetVel - localCurrLinVel); + Vector3 localTargetVel = mCurrMoveInPlane * mSpeed; + localTargetVel = mAcceleration *(localTargetVel - localCurrLinVel); localTargetVel.y = 0.; if (mJumping) localTargetVel *= real(0.2); // player is less able to control direction during jump - so scale influence @@ -291,7 +342,7 @@ { if (mJumping) return; - mDucking = false; + duck(false); mJumpApplies = 0; mJumpTime = real(0.2); mJumping = true; @@ -308,6 +359,14 @@ void OdeAvatar::duck(const bool yes) { mDucking = yes; + + //Check if we are using a capsule. + if (mShape && mShape->getType() == ST_CYLINDER) + { + //Change the capsule size. + const real newHeight = mDucking ? mCapsuleHeightDuck : mCapsuleHeight; + dGeomCapsuleSetParams (dGeomTransformGetGeom (mShape->_getOdeGeomID()), mSphereRadius, newHeight); + } } //----------------------------------------------------- @@ -329,7 +388,8 @@ { YAKE_ASSERT( mActor ); mOrientation = rOrientation; - mActor->setOrientation( mOrientation ); + //Set actor orientation. The actor is rotated 90\xB0 around the X axis to set the top of the capsule on Y axis. TODO: do it as a function of mUp. + mActor->setOrientation( mOrientation * Quaternion (sqrt(0.5),sqrt(0.5),0,0) ); mCurrDirection = mOrientation * Vector3::kUnitZ; } @@ -344,7 +404,7 @@ //----------------------------------------------------- Quaternion OdeAvatar::getOrientation() const { - return mOrientation; + return mOrientation ; } //----------------------------------------------------- @@ -353,11 +413,19 @@ mUp = -rkGravityDirection.normalisedCopy(); } - //----------------------------------------------------- - void OdeAvatar::getShapeSize(real& radius, real& height) const - { - radius = mDimensions.x; - radius = mDimensions.y; - } + //----------------------------------------------------- + void OdeAvatar::getShapeSize( real& radius, real& height ) + { + if (mShape->getType() == ST_CYLINDER) + { + dGeomCapsuleGetParams (dGeomTransformGetGeom (mShape->_getOdeGeomID()), &radius, &height); + } + else + { + radius = mSphereRadius; + height = real(0); //@todo should we return 2*radius here? + } + } + } // physics } // yake Modified: trunk/yake/yake/physics/yakePhysicsAvatar.h =================================================================== --- trunk/yake/yake/physics/yakePhysicsAvatar.h 2007-04-20 19:52:28 UTC (rev 1719) +++ trunk/yake/yake/physics/yakePhysicsAvatar.h 2007-04-20 19:55:27 UTC (rev 1720) @@ -74,7 +74,14 @@ virtual void setGravityDirection( const Vector3& rkGravityDirection ) = 0; //virtual void setTargetVelocity( const Vector3 & rkTargetVelocity ) = 0; - //@todo should actually be a Vector2! in plane of current player. y ("up") is ignored. + virtual void setSpeed(const real speed) = 0; + virtual real getSpeed() const = 0; + virtual void setAcceleration(const real acc) = 0; + virtual real getAcceleration() const = 0; + /** @remarks depends on implementation... */ + virtual void getShapeSize(real& radius, real& height) = 0; + + //@todo should actually be a Vector2! in plane of current avatar. y ("up") is ignored. virtual void move( const Vector3& ) = 0; // max values [-1,+1] virtual void jump() = 0; virtual bool isJumping() const = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |