home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / ReplicaNetFreewareV5_4.exe / data1.cab / Program_Executable_Files / Example4 / MyReplicaNet.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-30  |  1.4 KB  |  51 lines

  1. /* START_LICENSE_HEADER
  2.  
  3. Copyright (C) 2000 Martin Piper, original design and program code
  4. Copyright (C) 2001-2005 Replica Software
  5.  
  6. This program file is copyright (C) Replica Software and can only be used under license.
  7. For more information visit: http://www.replicanet.com/
  8. Or email: info@replicanet.com
  9.  
  10. END_LICENSE_HEADER */
  11. /*
  12. See MyReplicaNet.cpp
  13. */
  14. #ifndef _MYREPLICANET_H_
  15. #define _MYREPLICANET_H_
  16. #include <stdio.h>
  17. #include "RNReplicaNet/Inc/ReplicaNet.h"
  18.  
  19. // Create our own ReplicaNet derived class to implement compressed recordings.
  20. class MyReplicaNet : public RNReplicaNet::ReplicaNet
  21. {
  22. public:
  23.     MyReplicaNet();
  24.     virtual ~MyReplicaNet();
  25.  
  26.     /// Sets the file pointer used for the recording.
  27.     void SetRecordingFilePointer(FILE *fp);
  28.  
  29.     /// Forces any data in the buffer to be compressed and saved to the file.
  30.     void ForceCompress(void);
  31.  
  32.     /// The recording callbacks from ReplicaNet
  33.     virtual bool CallbackSessionRecord(const void *data,const int length);
  34.     virtual bool CallbackSessionPlayback(void *data,const int length);
  35.  
  36.  
  37.     enum
  38.     {
  39.         kBufferSize = 64 * 1024            // 64K of buffer
  40.     };
  41.  
  42. private:
  43.     FILE *mFP;
  44.     char mBuffer[kBufferSize];
  45.     size_t mOutBytesUsed;                // The number of output bytes used in the buffer.
  46.     size_t mInBytesUsed;                // The number of output bytes used in the buffer.
  47.     char *mInBufferPosition;            // The input buffer position pointer.
  48. };
  49.  
  50. #endif
  51.