⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 raincom.h

📁 好用的键盘超人源代码
💻 H
字号:
#ifndef _RAINDEF_H
#define _RAINDEF_H

#define  STOPPED_MSG     "Press F2 to start Rain "
#define  STOPPING_MSG    "Here is the result !" 
#define  RUNNING_MSG     "Press the words, Just do it!"
#define  PAUSED_MSG      "Let's have a rest"
#define  CONNECTING_MSG  "Connecting to rain server "
#define  CONNECTED_MSG   "Connection establish, waiting for server to start rain"
#define  ACCEPTING_MSG   "Accepting connections from rain client"
#define  BEGINNING_MSG   "Rain starting !"

#define  RECORD_FILE     "c:\\rain.dat" 

#define  NORMAL_TITLE "Rain - Keyboard Superman"
#define  LOCAL_TITLE  "Rain - Keyboard Superman - [local]"
#define  CLIENT_TITLE "Rain - Keyboard Superman - [client]"
#define  SERVER_TITLE "Rain - Keyboard Superman - [server]"

#define  DEBUG_RAIN      1


#define  DFT_SOCK_PORT      1818
#define  DFT_CLIENT_NUM     3
#define  MAX_NAME_LEN       12+3+2
#define  BEGIN_TIME         5 
#define  CONNECT_TIME       2
#define  CLIENT_TIME        2

#define  DFT_TIMER          1000
#define  TICK_TIMER         50

#define  RAIN_X       60
#define  RAIN_Y       33
#define  MSG_Y        2 
#define  WINTOP       48 
#define  WINSIDE      10 
#define  STATE_WIDE   13

#define  CHARWIDTH     8
#define  CHARHEIGHT    10 

#define  DFT_TIMER_EVENT    1
#define  TICK_TIMER_EVENT   2
#define  STEP_TIMER_EVENT   3

#define  STR_FREE      0
#define  STR_USE       1
#define  STR_FREEING   2 
#define  STR_FREEING2  3
#define  STR_WAITING   4

#define  RT_CLIENT     0
#define  RT_SERVER     1
#define  RT_LOCAL      2 

#define  RS_RANDOM     0
#define  RS_FILE       1 

#define  RL_0     0
#define  RL_1     1
#define  RL_2     2
#define  RL_3     3
#define  RL_4     4
#define  RL_5     5
#define  RL_6     6
#define  RL_7     7
#define  RL_8     8
#define  RL_9     9
#define  RL_10    10
     
#define  RS_STOPPED     0
#define  RS_PAUSED      1
#define  RS_RUNNING     2
#define  RS_STOPPING    3
#define  RS_CONNECTING  4
#define  RS_CONNECTED   5
#define  RS_ACCEPTING   6
#define  RS_BEGINNING   7

#define  CONNECTION_LOST     0
#define  CONNECTION_SAFE     1 
#define  CONNECTION_DANGER   2 

#define  COM_S_REQ      0x1101
#define  COM_S_END      0x1102
#define  COM_S_STR      0x1103
#define  COM_S_BEGIN    0x1104      
#define  COM_C_ACK      0x1001
#define  COM_C_HIT      0x1003


struct command 
{
   USHORT type;
   union content
   {
      struct s_req
	  {
		struct usrInfo_t
		{
          ULONG  usrIP;
		  int    usrID;
	      char   usrName[MAX_NAME_LEN];
		  ULONG  hitStrSeq[RAIN_Y];
		  int    hitNumber;
		}usrInfo[DFT_CLIENT_NUM+1];
	    int   usrNumber;
	  }s_req;

      struct s_end
	  {
	    struct usrResult
        {
          ULONG  usrIP;
		  int    usrID;
	      char   usrName[MAX_NAME_LEN];
		  int    rightChar;
	      int    rightStr;      
		}usrResult[DFT_CLIENT_NUM+1];	
	    int     usrNumber;
		int     totalStr;   
        ULONG   totalTime; 
	  }s_end;
        
      struct s_str
	  {
	    char string[RAIN_X];
        int  strlen;
		int  whereX;
	    ULONG sequence;
	  }s_str;

	  struct s_begin
      {
		 int stepTime;
		 int usrID;    //server give usrID to client
	  }s_begin;

      struct c_ack
	  {
        ULONG  usrIP;
	    char   usrName[MAX_NAME_LEN];
	  }c_ack;
	  
	  struct c_hit
      {
		ULONG  hitStrSeq;  //hit string sequence
		ULONG  hitTickTimer;
		int    hitStrLen;
	  }c_hit;
   }content;
};

UINT MapRand(UINT max);
CString localHostIP();

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -