-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkManager.h
More file actions
76 lines (55 loc) · 2.23 KB
/
NetworkManager.h
File metadata and controls
76 lines (55 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef __PrimeEngineNetworkManager_H__
#define __PrimeEngineNetworkManager_H__
// API Abstraction
#include "PrimeEngine/APIAbstraction/APIAbstractionDefines.h"
// Outer-Engine includes
#include <assert.h>
#include <map>
// Inter-Engine includes
#include "PrimeEngine/Utils/Networkable.h"
#include "../Events/Component.h"
extern "C"
{
#include "../../luasocket_dist/src/socket.h"
};
// Sibling/Children includes
#include "NetworkContext.h"
namespace PE {
namespace Components {
struct NetworkManager : public Component, public Networkable
{
PE_DECLARE_CLASS(NetworkManager);
PE_DECLARE_NETWORKABLE_CLASS
// Constructor -------------------------------------------------------------
NetworkManager(PE::GameContext &context, PE::MemoryArena arena, Handle hMyself);
virtual ~NetworkManager();
// Methods -----------------------------------------------------------------
virtual void initNetwork();
// Component ------------------------------------------------------------
virtual void addDefaultComponents();
void registerNetworkableObject(Networkable *pNetworkable);
Networkable *getNetworkableObject(Networkable::NetworkId networkId);
// is created per single connection
virtual void createNetworkConnectionContext(t_socket sock, PE::NetworkContext *pNetContext);
// Individual events -------------------------------------------------------
PE_DECLARE_IMPLEMENT_EVENT_HANDLER_WRAPPER(do_UPDATE);
virtual void do_UPDATE(Events::Event *pEvt);
// Loading -----------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
// Skin Lua Interface
//////////////////////////////////////////////////////////////////////////
//
static void SetLuaFunctions(PE::Components::LuaEnvironment *pLuaEnv, lua_State *luaVM);
//
//static int l_GetSkin(lua_State *luaVM);
//
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Member variables
//////////////////////////////////////////////////////////////////////////
typedef std::map<Networkable::NetworkId, Networkable *> NetworkableMap;
NetworkableMap m_networkables;
};
}; // namespace Components
}; // namespace PE
#endif