Exemple #1
0
 /// <summary>
 /// Must be called for each player in the session (e.g. in a 3 player session, must be called 3 times).
 /// </summary>
 /// <param name="player">A GGPOPlayer struct used to describe the player.</param>
 /// <param name="handle">An out parameter to a handle used to identify this player in the future
 /// (e.g. in the on_event callbacks).</param>
 /// <returns></returns>
 public ErrorCode AddPlayer(ref GGPOPlayer player, out int handle)
 {
     unsafe
     {
         fixed(int *h = &handle)
         {
             return(ggpo_add_player(session, ref player, h));
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Utility function for creating a local player. Sets the type and size of the GGPOPlayer
        /// struct automatically.
        /// </summary>
        /// <param name="playerNum">The player number. Should be between 1 and the number of players in
        /// the game.</param>
        /// <returns></returns>
        public static GGPOPlayer CreateLocalPlayer(int playerNum)
        {
            GGPOPlayer player = new GGPOPlayer()
            {
                type      = PlayerType.GGPO_PLAYERTYPE_LOCAL,
                playerNum = playerNum,
            };

            player.size = Marshal.SizeOf(player);
            return(player);
        }
Exemple #3
0
        /// <summary>
        /// Utility function for creating a remote player. Sets the type and size of the GGPOPlayer
        /// struct automatically.
        /// </summary>
        /// <param name="playerNum">The player number. Should be between 1 and the number of players in
        /// the game.</param>
        /// <param name="ipAddress">IP address of the remote player.</param>
        /// <param name="port">The port where UDP packets should be sent to reach this player.</param>
        /// <returns></returns>
        public static GGPOPlayer CreateRemotePlayer(int playerNum, string ipAddress, short port)
        {
            GGPOPlayer player = new GGPOPlayer()
            {
                type      = PlayerType.GGPO_PLAYERTYPE_REMOTE,
                playerNum = playerNum,
                ipAddress = ipAddress,
                port      = port,
            };

            player.size = Marshal.SizeOf(player);
            return(player);
        }
Exemple #4
0
 /// <summary>
 /// Must be called for each player in the session (e.g. in a 3 player session, must
 /// be called 3 times).
 /// </summary>
 /// <param name="player">A <see cref="GGPOPlayer"/> used to describe the player.</param>
 /// <param name="playerHandle">An out parameter to a handle used to identify this player in the future.</param>
 /// <returns><see cref="GGPOErrorCode"/> result of the operation.</returns>
 public abstract GGPOErrorCode AddPlayer(GGPOPlayer player, out int playerHandle);
Exemple #5
0
 private static unsafe extern ErrorCode ggpo_add_player(GGPOSession *session,
                                                        ref GGPOPlayer player,
                                                        int *handle);