src/Network.hh
changeset 186 0738f2949a2b
parent 185 25becd2cb026
child 187 f41f894213ca
equal deleted inserted replaced
185:25becd2cb026 186:0738f2949a2b
     1 #ifndef NETWORK_HH
       
     2 #define NETWORK_HH
       
     3 
       
     4 #include "NetworkConfig.hh"
       
     5 #include "GameState.hh"
       
     6 
       
     7 #include <ClanLib/network.h>
       
     8 
       
     9 const int32_t COORDINATE_MAX = 1 << 30;
       
    10 
       
    11 class NetworkCore {
       
    12     protected:
       
    13         GameState &state;
       
    14 
       
    15         CL_SlotContainer slots;
       
    16 
       
    17         // constructor
       
    18         NetworkCore (GameState &state) : state(state) { }
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 };
       
    24 
       
    25 enum NetworkChannel {
       
    26     /*
       
    27      * Core channel used for NetworkSession
       
    28      */
       
    29     NETCHAN_CORE            = 0x01,
       
    30 };
       
    31 
       
    32 enum NetworkPhysicsFlags {
       
    33     NETWORK_PHYSICS_INAIR      = 0x01,
       
    34 };
       
    35 
       
    36 enum NetworkMessage {
       
    37     NETMSG_PACKET_INVALID   = 0x00,
       
    38 
       
    39     /*
       
    40      * You have joined the game:
       
    41      *
       
    42      *  Vector      initial_position
       
    43      */
       
    44     NETMSG_SERVER_HELLO = 0x0100,
       
    45 
       
    46     /*
       
    47      * New client has connected to server:
       
    48      *  
       
    49      *  Vector      initial_position
       
    50      */
       
    51     NETMSG_PLAYER_JOIN  = 0x0101,
       
    52 
       
    53     /*
       
    54      * Client has left server:
       
    55      *
       
    56      */
       
    57     NETMSG_PLAYER_QUIT  = 0x0102,
       
    58 
       
    59     /*
       
    60      * Client has moved
       
    61      *
       
    62      *  uint16_t    PlayerInput_Move
       
    63      */
       
    64     NETMSG_CLIENT_MOVE  = 0x0201,
       
    65     
       
    66     /*
       
    67      * Initial player info
       
    68      *
       
    69      *  Vector      initial_position
       
    70      */
       
    71     NETMSG_PLAYER_INFO  = 0x0300,
       
    72 
       
    73     /*
       
    74      * Player position update
       
    75      *
       
    76      * Vector   position
       
    77      * Vector   velocity
       
    78      * uint8_t  NetworkPhysicsFlags
       
    79      */
       
    80     NETMSG_PLAYER_POSITION  = 0x0301,
       
    81 };
       
    82 
       
    83 #endif