terom@5: #ifndef NETWORK_HH terom@5: #define NETWORK_HH terom@5: terom@21: #include "NetworkConfig.hh" terom@21: #include "GameState.hh" terom@21: terom@13: #include terom@5: terom@21: class NetworkCore { terom@24: protected: terom@24: GameState &state; terom@5: terom@24: CL_SlotContainer slots; terom@22: terom@24: CL_NetSession netsession; terom@24: terom@24: CL_NetObject_Controller netobjs; terom@24: terom@24: // constructor terom@24: NetworkCore (GameState &state) : state(state), netsession(NETWORK_APP_NAME), netobjs(&netsession, NETWORK_NETOBJ_CHAN) { } terom@22: }; terom@22: terom@22: enum NetworkMessage { terom@24: NETMSG_PACKET_INVALID = 0x00, terom@22: terom@24: /* terom@24: * You have joined the game: terom@24: * terom@24: * uint32_t x terom@24: * uint32_t y terom@24: */ terom@24: NETMSG_SERVER_HELLO = 0x0100, terom@22: terom@24: /* terom@24: * New client has connected to server: terom@24: * terom@24: * uint32_t x terom@24: * uint32_t y terom@24: */ terom@24: NETMSG_PLAYER_JOIN = 0x0101, terom@22: terom@24: /* terom@24: * Client has left server: terom@24: * terom@24: */ terom@24: NETMSG_PLAYER_QUIT = 0x0102, terom@24: terom@24: /* terom@24: * Client has moved terom@24: * terom@25: * int32_t dx terom@25: * int32_t dy terom@24: */ terom@24: NETMSG_CLIENT_MOVE = 0x0201, terom@24: terom@24: /* terom@24: * Initial player info terom@24: * terom@24: * uint32_t x terom@24: * uint32_t y terom@24: */ terom@24: NETMSG_PLAYER_INFO = 0x0300, terom@24: terom@24: /* terom@24: * Player position update terom@24: * terom@24: * uint32_t x terom@24: * uint32_t y terom@24: */ terom@24: NETMSG_PLAYER_POSITION = 0x0301, terom@5: }; terom@5: terom@5: #endif