Common.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:2k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #include <windows.h>
  3. #include "Socket.h"
  4. #include "Common.h"
  5. #include "WGS.h"
  6. #include "..XMudClient.h"
  7. #include "..FacePlate.h"
  8. #include "..MenuLoadOldPlay.h"
  9. #define DEFAULT_GAMESERVER_IP "0.0.0.0"
  10. extern rmfullglobals myglobs;
  11. extern int g_nGameState;
  12. extern CMenuLoadOldPlay m_MenuLoadOldPlay;
  13. extern D3DAppInfo* d3dapp;
  14. extern SOCKADDR_IN stRSvrName;
  15. extern int nSrvPort;
  16. extern CRITICAL_SECTION csMaplist;
  17. extern BOOL g_bInternConnect;
  18. extern BOOL bCloseSocket;
  19. TCHAR szDebugServer[]=DIRECTCONNECT;
  20. char szSendData[INPUT_SIZE];
  21. COLORREF colorEnable=RGB(0,255,0),colorDisable=RGB(128,128,255);
  22. extern SOCKET hLCltForRSvrSock;
  23. HFONT GetFont(int Height,char *Name,int Weight)
  24. {
  25. LOGFONT LogFont;
  26. HFONT font;
  27. ZeroMemory(&LogFont,sizeof(LOGFONT));
  28. LogFont.lfHeight =Height;
  29. LogFont.lfWidth =0;
  30. LogFont.lfWeight =Weight;
  31. LogFont.lfCharSet =CHINESEBIG5_CHARSET;
  32. LogFont.lfOutPrecision =OUT_STROKE_PRECIS;
  33. LogFont.lfClipPrecision =CLIP_STROKE_PRECIS;
  34. LogFont.lfQuality =DEFAULT_QUALITY;
  35. strcpy(LogFont.lfFaceName,Name);
  36. font=CreateFontIndirect(&LogFont);
  37. return font;
  38. }
  39. int LinkToWGS()
  40. {
  41. stRSvrName.sin_addr.s_addr=GetIPAddr(szDebugServer);
  42. stRSvrName.sin_family=PF_INET;
  43. stRSvrName.sin_port=htons(nSrvPort);
  44. wgs.AddMessage("硈絬い...");
  45. if(INVALID_SOCKET==
  46. (hLCltForRSvrSock=InitClient(&stRSvrName,myglobs.hWndMain,WSA_GAME))){
  47. wgs.AddMessage("既