|
@@ -67,7 +67,7 @@ static const unsigned CTRL_BACK = 2;
|
|
|
static const unsigned CTRL_LEFT = 4;
|
|
static const unsigned CTRL_LEFT = 4;
|
|
|
static const unsigned CTRL_RIGHT = 8;
|
|
static const unsigned CTRL_RIGHT = 8;
|
|
|
|
|
|
|
|
-DEFINE_APPLICATION_MAIN(SceneReplication)
|
|
|
|
|
|
|
+URHO3D_DEFINE_APPLICATION_MAIN(SceneReplication)
|
|
|
|
|
|
|
|
SceneReplication::SceneReplication(Context* context) :
|
|
SceneReplication::SceneReplication(Context* context) :
|
|
|
Sample(context)
|
|
Sample(context)
|
|
@@ -211,26 +211,26 @@ void SceneReplication::SetupViewport()
|
|
|
void SceneReplication::SubscribeToEvents()
|
|
void SceneReplication::SubscribeToEvents()
|
|
|
{
|
|
{
|
|
|
// Subscribe to fixed timestep physics updates for setting or applying controls
|
|
// Subscribe to fixed timestep physics updates for setting or applying controls
|
|
|
- SubscribeToEvent(E_PHYSICSPRESTEP, HANDLER(SceneReplication, HandlePhysicsPreStep));
|
|
|
|
|
|
|
+ SubscribeToEvent(E_PHYSICSPRESTEP, URHO3D_HANDLER(SceneReplication, HandlePhysicsPreStep));
|
|
|
|
|
|
|
|
// Subscribe HandlePostUpdate() method for processing update events. Subscribe to PostUpdate instead
|
|
// Subscribe HandlePostUpdate() method for processing update events. Subscribe to PostUpdate instead
|
|
|
// of the usual Update so that physics simulation has already proceeded for the frame, and can
|
|
// of the usual Update so that physics simulation has already proceeded for the frame, and can
|
|
|
// accurately follow the object with the camera
|
|
// accurately follow the object with the camera
|
|
|
- SubscribeToEvent(E_POSTUPDATE, HANDLER(SceneReplication, HandlePostUpdate));
|
|
|
|
|
|
|
+ SubscribeToEvent(E_POSTUPDATE, URHO3D_HANDLER(SceneReplication, HandlePostUpdate));
|
|
|
|
|
|
|
|
// Subscribe to button actions
|
|
// Subscribe to button actions
|
|
|
- SubscribeToEvent(connectButton_, E_RELEASED, HANDLER(SceneReplication, HandleConnect));
|
|
|
|
|
- SubscribeToEvent(disconnectButton_, E_RELEASED, HANDLER(SceneReplication, HandleDisconnect));
|
|
|
|
|
- SubscribeToEvent(startServerButton_, E_RELEASED, HANDLER(SceneReplication, HandleStartServer));
|
|
|
|
|
|
|
+ SubscribeToEvent(connectButton_, E_RELEASED, URHO3D_HANDLER(SceneReplication, HandleConnect));
|
|
|
|
|
+ SubscribeToEvent(disconnectButton_, E_RELEASED, URHO3D_HANDLER(SceneReplication, HandleDisconnect));
|
|
|
|
|
+ SubscribeToEvent(startServerButton_, E_RELEASED, URHO3D_HANDLER(SceneReplication, HandleStartServer));
|
|
|
|
|
|
|
|
// Subscribe to network events
|
|
// Subscribe to network events
|
|
|
- SubscribeToEvent(E_SERVERCONNECTED, HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
- SubscribeToEvent(E_SERVERDISCONNECTED, HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
- SubscribeToEvent(E_CONNECTFAILED, HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
- SubscribeToEvent(E_CLIENTCONNECTED, HANDLER(SceneReplication, HandleClientConnected));
|
|
|
|
|
- SubscribeToEvent(E_CLIENTDISCONNECTED, HANDLER(SceneReplication, HandleClientDisconnected));
|
|
|
|
|
|
|
+ SubscribeToEvent(E_SERVERCONNECTED, URHO3D_HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
+ SubscribeToEvent(E_SERVERDISCONNECTED, URHO3D_HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
+ SubscribeToEvent(E_CONNECTFAILED, URHO3D_HANDLER(SceneReplication, HandleConnectionStatus));
|
|
|
|
|
+ SubscribeToEvent(E_CLIENTCONNECTED, URHO3D_HANDLER(SceneReplication, HandleClientConnected));
|
|
|
|
|
+ SubscribeToEvent(E_CLIENTDISCONNECTED, URHO3D_HANDLER(SceneReplication, HandleClientDisconnected));
|
|
|
// This is a custom event, sent from the server to the client. It tells the node ID of the object the client should control
|
|
// This is a custom event, sent from the server to the client. It tells the node ID of the object the client should control
|
|
|
- SubscribeToEvent(E_CLIENTOBJECTID, HANDLER(SceneReplication, HandleClientObjectID));
|
|
|
|
|
|
|
+ SubscribeToEvent(E_CLIENTOBJECTID, URHO3D_HANDLER(SceneReplication, HandleClientObjectID));
|
|
|
// Events sent between client & server (remote events) must be explicitly registered or else they are not allowed to be received
|
|
// Events sent between client & server (remote events) must be explicitly registered or else they are not allowed to be received
|
|
|
GetSubsystem<Network>()->RegisterRemoteEvent(E_CLIENTOBJECTID);
|
|
GetSubsystem<Network>()->RegisterRemoteEvent(E_CLIENTOBJECTID);
|
|
|
}
|
|
}
|