Skip to content

Commit

Permalink
Changed main()-function to only work as a starter for the python inte…
Browse files Browse the repository at this point in the history
…rpreter; added export definitions for all classes (win32); changed init.py to work standalone as main script; added some more windows file extensions to .gitignore.
  • Loading branch information
U-feelx-desktop\feelx committed Jan 4, 2013
1 parent 470b9fa commit 7ac3a88
Show file tree
Hide file tree
Showing 41 changed files with 80 additions and 60 deletions.
4 changes: 4 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ build/Explore
*.so
*.dll*
*.pdb
*.lib
*.exp
*.manifest
*.bin
*.pyc
*.pyd
CMakeFiles
CMakeCache.txt
CMakeLists.txt.*
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if( NOT WIN32 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic" )
endif()

project(Explore)
Expand Down
17 changes: 11 additions & 6 deletions build/init.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ def LOG( what ):
else:
LoggerSingleton.instance().log( str( what ) )

LOG( "== Importing init module ==" )
server = Explore.Instance.getExploreServer()
messenger = server.getNetworkMessenger()
if __name__ == "__main__":
LOG( "== Importing init module ==" )

ip = "127.0.0.1"
port = 6556
q = exit
Explore.Instance = Explore()
Explore.Instance.run()

server = Explore.Instance.getExploreServer()
messenger = server.getNetworkMessenger()

ip = "127.0.0.1"
port = 6556
q = exit
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,7 @@ set_target_properties( ExploreBind PROPERTIES
PREFIX "" )

if( WIN32 )
set_target_properties( ExploreBind PROPERTIES SUFFIX .pyd )
set_target_properties( Engine PROPERTIES COMPILE_FLAGS -DENGINE_EXPORTS )
set_target_properties( Explore PROPERTIES COMPILE_FLAGS -DENGINE_EXPORTS )
set_target_properties( ExploreBind PROPERTIES SUFFIX .pyd )
endif()
2 changes: 1 addition & 1 deletion src/engine/BulletSceneNodeAnimator.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <bullet/btBulletDynamicsCommon.h>
#include "EngineTypedefs.h"

class BulletSceneNodeAnimator : public irr::scene::ISceneNodeAnimator
class APIEXPORT BulletSceneNodeAnimator : public irr::scene::ISceneNodeAnimator
{
public:
BulletSceneNodeAnimator( BulletWorldPtr world, RigidBodyPtr body );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/BulletTools.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "EngineTypedefs.h"
#include <iostream>

class BulletTools
class APIEXPORT BulletTools
{
public:
static RigidBodyPtr createRigidBodyptr( BulletWorldPtr world, btRigidBody *body );
Expand Down
11 changes: 11 additions & 0 deletions src/engine/EngineTypedefs.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
#ifndef ENGINETYPEDEFS_H
#define ENGINETYPEDEFS_H

//Windows dll export/import define
#ifdef _WIN32
#ifdef ENGINE_EXPORTS
#define APIEXPORT __declspec(dllexport)
#else
#define APIEXPORT __declspec(dllimport)
#endif
#else //_WIN32
#define APIEXPORT
#endif

#include <boost/foreach.hpp>
#define foreach_ BOOST_FOREACH
#define foreach_r_ BOOST_REVERSE_FOREACH
Expand Down
2 changes: 1 addition & 1 deletion src/engine/Entity.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef boost::unordered::unordered_map<btRigidBody*, Entity*> BodyEntityMap;
typedef boost::unordered::unordered_map<irr::scene::ISceneNode*, Entity*> NodeEntityMap;
typedef boost::unordered::unordered_set<Entity*> EntitySet;

class Entity
class APIEXPORT Entity
{
public:

Expand Down
2 changes: 1 addition & 1 deletion src/engine/EntityContainer.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef boost::unordered::unordered_map<std::string,int> IDMap;
class EntityContainer;
typedef boost::shared_ptr<EntityContainer> EntityContainerPtr;

class EntityContainer
class APIEXPORT EntityContainer
{
public:
EntityContainer( IrrlichtDevicePtr device, BulletWorldPtr world,
Expand Down
2 changes: 1 addition & 1 deletion src/engine/EntityTools.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "EngineTypedefs.h"
#include "Entity.h"

class EntityTools
class APIEXPORT EntityTools
{
public:
static boost::optional<Entity*> getFirstEntityInRay( IrrlichtDevicePtr device,
Expand Down
2 changes: 1 addition & 1 deletion src/engine/EventReceiver.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "ScriptConsole.h"
#include <boost/unordered_map.hpp>

class EventReceiver : public irr::IEventReceiver
class APIEXPORT EventReceiver : public irr::IEventReceiver
{
public:
struct GUICallback
Expand Down
2 changes: 1 addition & 1 deletion src/engine/IrrlichtTools.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string>
#include <sstream>

class IrrlichtTools
class APIEXPORT IrrlichtTools
{
public:
static IrrlichtDevicePtr createIrrlichtDevicePtr( irr::IrrlichtDevice *device );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/LoggerSingleton.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define _LOG LoggerSingleton::instance().log

class LoggerSingleton
class APIEXPORT LoggerSingleton
{
public:
static LoggerSingleton& instance();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/NetworkMessenger.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class NetworkMessenger;
typedef boost::shared_ptr<NetworkMessenger> NetworkMessengerPtr;

class NetworkMessenger
class APIEXPORT NetworkMessenger
{
public:
NetworkMessenger( IOServicePtr ioService, PropTreePtr properties );
Expand Down
3 changes: 2 additions & 1 deletion src/engine/NetworkSyncable.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
#ifndef NETWORKSYNCABLE_H
#define NETWORKSYNCABLE_H

#include "EngineTypedefs.h"
#include "NetworkSyncablePacket.h"

#include <boost/optional.hpp>
#include <string>
#include <map>
#include <stdint.h>

class NetworkSyncable
class APIEXPORT NetworkSyncable
{
public:
struct UIDAlreadyUsedException
Expand Down
6 changes: 6 additions & 0 deletions src/engine/NetworkSyncablePacket.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ NetworkSyncablePacket::NetworkSyncablePacket( const NetworkSyncablePacket &other
mBody.write( other.getBody().data(), other.getBodySize() );
}

NetworkSyncablePacket& NetworkSyncablePacket::operator=( const NetworkSyncablePacket &other )
{
//FIXME:err...?
return NetworkSyncablePacket( other );
}

uint32_t NetworkSyncablePacket::getUID() const
{
return mUID;
Expand Down
5 changes: 4 additions & 1 deletion src/engine/NetworkSyncablePacket.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@
#ifndef NETWORKSYNCABLEPACKET_H
#define NETWORKSYNCABLEPACKET_H

#include "EngineTypedefs.h"
#include <string>
#include <sstream>
#include <stdint.h>
#include <boost/asio.hpp>

class NetworkSyncablePacket
class APIEXPORT NetworkSyncablePacket
{
public:
NetworkSyncablePacket( const std::string &data );
NetworkSyncablePacket( uint32_t uid, uint8_t typeID, uint8_t actionID,
const std::string &body );
NetworkSyncablePacket( const NetworkSyncablePacket &other );

NetworkSyncablePacket& operator=( const NetworkSyncablePacket &other );

uint32_t getUID() const;
uint8_t getTypeID() const;
uint8_t getActionID() const;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/PathTools.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

typedef std::vector<boost::filesystem::path> PathVector;

class PathTools
class APIEXPORT PathTools
{
public:
static std::string getAbsolutePath( const std::string &fileName,
Expand Down
2 changes: 1 addition & 1 deletion src/engine/PythonBinder.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class PythonBinder;
typedef boost::shared_ptr<PythonBinder> PythonBinderPtr;

class PythonBinder
class APIEXPORT PythonBinder
{
public:
PythonBinder( int prio = 0 );
Expand Down
3 changes: 2 additions & 1 deletion src/engine/PythonScript.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
#ifndef PYTHONSCRIPT_H
#define PYTHONSCRIPT_H

#include "EngineTypedefs.h"
#include "PythonTools.h"

class PythonScript;
typedef boost::shared_ptr<PythonScript> PythonScriptPtr;

class PythonScript
class APIEXPORT PythonScript
{
public:
PythonScript( std::string script, bool isFile = true,
Expand Down
3 changes: 2 additions & 1 deletion src/engine/PythonTools.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
#ifndef PYTHONTOOLS_H
#define PYTHONTOOLS_H

#include "EngineTypedefs.h"
#include <Python.h>
#include <boost/python.hpp>

class PythonTools
class APIEXPORT PythonTools
{
public:
static void initPython();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/QuaternionConverter.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "EngineTypedefs.h"

class QuaternionConverter
class APIEXPORT QuaternionConverter
{
public:
static btQuaternion bt( const irr::core::quaternion &irr );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/ScriptConsole.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class ScriptConsole;
typedef boost::shared_ptr<ScriptConsole> ScriptConsolePtr;

class ScriptConsole
class APIEXPORT ScriptConsole
{
public:
friend class EventReceiver;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/VectorConverter.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "EngineTypedefs.h"

struct VectorConverter
struct APIEXPORT VectorConverter
{
static irr::core::vector3df irr( const btVector3 &btVec );
static btVector3 bt( const irr::core::vector3df &irrVec );
Expand Down
10 changes: 0 additions & 10 deletions src/game/Explore.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Explore::Explore()
loadConfig();
initIrrlicht();
initBullet();
initPython();
initScriptConsole();
initMenu();
initGame();
Expand Down Expand Up @@ -298,15 +297,6 @@ void Explore::initBullet()
mBulletWorld->setDebugDrawer( mBulletDebugDrawer.get() );
}

void Explore::initPython()
{
PythonTools::initPython();

boost::python::api::object main( boost::python::import( "ExploreBind" ) );
boost::python::api::object globals = main.attr( "Explore" );
globals.attr( "Instance" ) = boost::python::ptr( this );
}

void Explore::initScriptConsole()
{
mScriptConsole.reset( new ScriptConsole( mDevice, mConfig ) );
Expand Down
5 changes: 2 additions & 3 deletions src/game/Explore.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef boost::shared_ptr<ExploreServer> ExploreServerPtr;

class EventReceiver;

class BulletIrrlichtDebugDrawer : public btIDebugDraw
class APIEXPORT BulletIrrlichtDebugDrawer : public btIDebugDraw
{
public:
irr::video::IVideoDriver *driver;
Expand Down Expand Up @@ -87,7 +87,7 @@ class BulletIrrlichtDebugDrawer : public btIDebugDraw
};


class Explore
class APIEXPORT Explore
{
public:

Expand Down Expand Up @@ -135,7 +135,6 @@ class Explore

void initIrrlicht();
void initBullet();
void initPython();
void initScriptConsole();
void initMenu();
void initGame();
Expand Down
2 changes: 1 addition & 1 deletion src/game/ExploreGame.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "players/WorldPlayer.h"
#include <engine/EngineTypedefs.h>

class ExploreGame
class APIEXPORT ExploreGame
{
public:
ExploreGame( ExplorePtr explore );
Expand Down
2 changes: 1 addition & 1 deletion src/game/ExploreMenu.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <engine/EngineTypedefs.h>
#include "GameState.h"

class ExploreMenu
class APIEXPORT ExploreMenu
{
public:
ExploreMenu( ExplorePtr explore );
Expand Down
2 changes: 1 addition & 1 deletion src/game/IPlayer.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef boost::weak_ptr<IPlayer> IPlayerWeakPtr;
typedef boost::unordered::unordered_map<Item*,ItemPtr> ItemMap;
typedef std::vector<IPlayerPtr> IPlayerVector;

class IPlayer : public NetworkSyncable
class APIEXPORT IPlayer : public NetworkSyncable
{
public:
IPlayer( ExplorePtr explore, IPlayerPtr parent );
Expand Down
2 changes: 1 addition & 1 deletion src/game/Item.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
typedef boost::unordered::unordered_map<uint8_t, PythonScriptPtr> ScriptMap;
typedef boost::unordered::unordered_map<Entity*, Item*> EntityItemMap;

class Item : public NetworkSyncable
class APIEXPORT Item : public NetworkSyncable
{
public:
template <class T>
Expand Down
2 changes: 1 addition & 1 deletion src/game/ItemCache.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ItemCache;
typedef boost::shared_ptr<ItemCache> ItemCachePtr;
typedef boost::unordered::unordered_map<std::string, PropTreePtr> PropMap;

class ItemCache
class APIEXPORT ItemCache
{
public:
static ItemCachePtr instance();
Expand Down
2 changes: 1 addition & 1 deletion src/game/ItemFactory.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct ItemCreator : public ItemCreatorBase
}
};

class ItemFactory
class APIEXPORT ItemFactory
{
public:

Expand Down
2 changes: 1 addition & 1 deletion src/game/items/SimpleForceGunItem.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "../Item.h"

class SimpleForceGunItem : public Item
class APIEXPORT SimpleForceGunItem : public Item
{
public:
SimpleForceGunItem( ExplorePtr explore, IPlayerPtr owner, PropTreePtr properties,
Expand Down
2 changes: 1 addition & 1 deletion src/game/items/SimpleGunItem.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "../Item.h"

class SimpleGunItem : public Item
class APIEXPORT SimpleGunItem : public Item
{
public:
SimpleGunItem(ExplorePtr explore, IPlayerPtr owner, PropTreePtr properties,
Expand Down
Loading

0 comments on commit 7ac3a88

Please sign in to comment.