vc项目日志,俄罗斯方块开发

                   ----July

mfc初学一个月时,所写的俄罗斯方块。共享下源码。

July、2010/10/21

-------------------------------------------------------------

此为View.h文件

view plain copy to clipboard print ?
  1. /*-------------------------------------
  2. View.h文件
  3. July/2010、10月
  4. --------------------------------------*/
  5. // skyjuly_RecTTView.h : interface of the CSkyjuly_RecTTView class
  6. //
  7. /
  8. #if !defined(AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_)
  9. #define AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif // _MSC_VER > 1000
  13. // 宏变量:白色和黑色
  14. #define WHITE RGB(255,255,255)
  15. #define BLACK RGB(0,0,0)
  16. #define BLUE RGB(0,0,255)
  17. //中断操作的运动趋势
  18. #define LEFT  0      //向左移动
  19. #define RIGHT 1      //向左移动
  20. #define UP    2     //向上(变形)
  21. #define DOWN  3      //向下移动(加速)
  22. //游戏区域地图最大限制
  23. #define  MAX_ROW    100     //地图的最大行数
  24. #define  MAX_COL    100      //地图的最大列数
  25. //地图状态
  26. #define MAP_STATE_EMPTY             0    //空(未被占据)
  27. #define MAP_STATE_NOT_EMPTY         1    //被占据
  28. class  CSkyjuly_RecTTView :  public  CView
  29. {
  30. protected :  // create from serialization only
  31. CSkyjuly_RecTTView();
  32. DECLARE_DYNCREATE(CSkyjuly_RecTTView)
  33. // Attributes
  34. public :
  35. CSkyjuly_RecTTDoc* GetDocument();
  36. // Operations
  37. public :
  38. // Overrides
  39. // ClassWizard generated virtual function overrides
  40. //{{AFX_VIRTUAL(CSkyblue_RectView)
  41. public :
  42. virtual   void  OnDraw(CDC* pDC);   // overridden to draw this view
  43. virtual   BOOL  PreCreateWindow(CREATESTRUCT& cs);
  44. //}}AFX_VIRTUAL
  45. // Implementation
  46. public :
  47. virtual  ~CSkyjuly_RecTTView();
  48. protected :
  49. int  m_nWidth;   //子窗口的宽度
  50. int  m_nHeight;  //子窗口的高度
  51. //列与行的数量
  52. int  m_iCol;
  53. int  m_iRow;
  54. //小方块的大小,它会随着行与列的不同而不同,具体为:
  55. // 12行10列,30个象素的正方形
  56. // 18行15列,20
  57. // 24行20列,15
  58. // 30行25列,12
  59. int  m_iLarge;
  60. //当前的级别,换算成速度的算法为:1500 - m_iLevel*200
  61. int  m_iLevel;
  62. //当前选择的方块显示样式
  63. int  m_iBlockSytle;
  64. //游戏区域左上角的坐标
  65. int  m_iStartX;
  66. int  m_iStartY;
  67. BOOL  IsLeftLimit();        //下坠物件是否可向左移动
  68. BOOL  IsRightLimit();
  69. //接触面二维数组,记录1~7种下坠物的1~4种形态的接触面信息
  70. //我们把该下坠物的某种形态种的4个方块,有接触面则记录方位,无则为-1标识。
  71. int  InterFace[74][4];
  72. //当前的方块形状
  73. int  m_currentRect;
  74. //判断当前方块是否到底
  75. void  IsBottom();
  76. //当前方块下降
  77. void  RectDown();
  78. //当前方块加速:UP,左移:LEFT,右移:RIGHT
  79. void  RectArrow( int  m_Type);
  80. //根据下坠物的类型映射出它的具体形态  功能组
  81. //根据旧的下一下坠物映射出当前激活状态下的下坠物形态
  82. void  RectStatusToActiveStatus( int  m_which);
  83. //根据下坠物形态映射出下一下坠物的形态
  84. void  RectStatusToNextStatus( int  m_which);
  85. //将当前的状态映射到地图游戏区域
  86. void  ActiveStatusToGameStatus();
  87. int  Random( int  MaxNumber);
  88. //标识方块已到底的变量,到底为TRUE
  89. BOOL  m_isBottom;
  90. //用于标志方块状态的数组,大小由横格与竖格数据决定,为1表示该方块显示,或者不显示
  91. //画形状只需要修改数组中相应元素的状态值即可
  92. //由时钟控制,定时在OnPaint函数中根据数组画方块
  93. int  GameStatus[MAX_ROW][MAX_COL];
  94. //用于保存当前方块的动态位置,4个小方块分别在大数组中的位置
  95. //存放位置为先左后右,每一列又遵循先上后下的原则
  96. int  ActiveStatus[4][2];
  97. //存入下一次要出来的方块的模样的数组
  98. int  NextStatus[4][2];
  99. // Generated message map functions
  100. protected :
  101. BOOL  m_bGamePaush;
  102. void  StopMid();
  103. void  PlayMid();
  104. void  CurrentAreaAndLevel();
  105. //用于记录当前区域大小与当前级别的字符串,用于显示在屏幕上提示用户当前状态
  106. CString m_strArea;
  107. CString m_strLevel;
  108. //当前的样式 ,下一个将会出现的样式
  109. int  m_icurrentStatus;
  110. int  m_inextStatus;
  111. //OnDraw中需要用到的设备名称
  112. CPen *m_pBlackPen;
  113. CBrush *m_pGrayBrush;
  114. CBrush *m_pBlackBrush;
  115. //是否画网格线
  116. BOOL  m_bDrawGrid;
  117. //是否插放背景音乐
  118. BOOL  m_bMusic;
  119. //游戏总成绩
  120. int  m_iPerformance;
  121. //游戏是否已结束,为FALSE表示开始,否则为结束
  122. BOOL  m_bGameEnd;
  123. //刷新指定的区域,它的大小为:四个小方块所在的正方形的大小
  124. void  InvalidateCurrent();
  125. //内存绘图设备的处理
  126. CDC m_memDC;                   //内存设备环境
  127. CBitmap m_memBmp;              //内存位图
  128. CDC m_memRectDC;       //方块内存设备环境
  129. HBITMAP  m_hMemRectBmp;   //方块内存位图句柄
  130. int  m_bFistPlay;                //是否是第一次开始游戏
  131. void  DcEnvInitial( void );
  132. void  DCEnvClear( void );
  133. void  DrawGame(CDC *pDC);
  134. // Generated message map functions
  135. protected :
  136. void  RectChange();
  137. //{{AFX_MSG(CSkyjuly_RecTTView)
  138. afx_msg void  OnGameStart();
  139. afx_msg void  OnGamePaush();
  140. afx_msg void  OnGameEnd();
  141. afx_msg void  OnGameExit();
  142. afx_msg void  OnGameOption();
  143. afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
  144. afx_msg void  OnTimer( UINT  nIDEvent);
  145. afx_msg void  OnKeyDown( UINT  nChar,  UINT  nRepCnt,  UINT  nFlags);
  146. //}}AFX_MSG
  147. DECLARE_MESSAGE_MAP()
  148. };
  149. #ifndef _DEBUG  // debug version in skyjuly_RecTTView.cpp
  150. inline  CSkyjuly_RecTTDoc* CSkyjuly_RecTTView::GetDocument()
  151. { return  (CSkyjuly_RecTTDoc*)m_pDocument; }
  152. #endif
  153. /
  154. //{{AFX_INSERT_LOCATION}}
  155. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  156. #endif // !defined(AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_)

/*------------------------------------- View.h文件 July/2010、10月 --------------------------------------*/ // skyjuly_RecTTView.h : interface of the CSkyjuly_RecTTView class // / #if !defined(AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_) #define AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // 宏变量:白色和黑色 #define WHITE RGB(255,255,255) #define BLACK RGB(0,0,0) #define BLUE RGB(0,0,255) //中断操作的运动趋势 #define LEFT 0 //向左移动 #define RIGHT 1 //向左移动 #define UP 2 //向上(变形) #define DOWN 3 //向下移动(加速) //游戏区域地图最大限制 #define MAX_ROW 100 //地图的最大行数 #define MAX_COL 100 //地图的最大列数 //地图状态 #define MAP_STATE_EMPTY 0 //空(未被占据) #define MAP_STATE_NOT_EMPTY 1 //被占据 class CSkyjuly_RecTTView : public CView { protected: // create from serialization only CSkyjuly_RecTTView(); DECLARE_DYNCREATE(CSkyjuly_RecTTView) // Attributes public: CSkyjuly_RecTTDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{​{AFX_VIRTUAL(CSkyblue_RectView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL // Implementation public: virtual ~CSkyjuly_RecTTView(); protected: int m_nWidth; //子窗口的宽度 int m_nHeight; //子窗口的高度 //列与行的数量 int m_iCol; int m_iRow; //小方块的大小,它会随着行与列的不同而不同,具体为: // 12行10列,30个象素的正方形 // 18行15列,20 // 24行20列,15 // 30行25列,12 int m_iLarge; //当前的级别,换算成速度的算法为:1500 - m_iLevel*200 int m_iLevel; //当前选择的方块显示样式 int m_iBlockSytle; //游戏区域左上角的坐标 int m_iStartX; int m_iStartY; BOOL IsLeftLimit(); //下坠物件是否可向左移动 BOOL IsRightLimit(); //接触面二维数组,记录1~7种下坠物的1~4种形态的接触面信息 //我们把该下坠物的某种形态种的4个方块,有接触面则记录方位,无则为-1标识。 int InterFace[74][4]; //当前的方块形状 int m_currentRect; //判断当前方块是否到底 void IsBottom(); //当前方块下降 void RectDown(); //当前方块加速:UP,左移:LEFT,右移:RIGHT void RectArrow(int m_Type); //根据下坠物的类型映射出它的具体形态 功能组 //根据旧的下一下坠物映射出当前激活状态下的下坠物形态 void RectStatusToActiveStatus(int m_which); //根据下坠物形态映射出下一下坠物的形态 void RectStatusToNextStatus(int m_which); //将当前的状态映射到地图游戏区域 void ActiveStatusToGameStatus(); int Random(int MaxNumber); //标识方块已到底的变量,到底为TRUE BOOL m_isBottom; //用于标志方块状态的数组,大小由横格与竖格数据决定,为1表示该方块显示,或者不显示 //画形状只需要修改数组中相应元素的状态值即可 //由时钟控制,定时在OnPaint函数中根据数组画方块 int GameStatus[MAX_ROW][MAX_COL]; //用于保存当前方块的动态位置,4个小方块分别在大数组中的位置 //存放位置为先左后右,每一列又遵循先上后下的原则 int ActiveStatus[4][2]; //存入下一次要出来的方块的模样的数组 int NextStatus[4][2]; // Generated message map functions protected: BOOL m_bGamePaush; void StopMid(); void PlayMid(); void CurrentAreaAndLevel(); //用于记录当前区域大小与当前级别的字符串,用于显示在屏幕上提示用户当前状态 CString m_strArea; CString m_strLevel; //当前的样式 ,下一个将会出现的样式 int m_icurrentStatus; int m_inextStatus; //OnDraw中需要用到的设备名称 CPen *m_pBlackPen; CBrush *m_pGrayBrush; CBrush *m_pBlackBrush; //是否画网格线 BOOL m_bDrawGrid; //是否插放背景音乐 BOOL m_bMusic; //游戏总成绩 int m_iPerformance; //游戏是否已结束,为FALSE表示开始,否则为结束 BOOL m_bGameEnd; //刷新指定的区域,它的大小为:四个小方块所在的正方形的大小 void InvalidateCurrent(); //内存绘图设备的处理 CDC m_memDC; //内存设备环境 CBitmap m_memBmp; //内存位图 CDC m_memRectDC; //方块内存设备环境 HBITMAP m_hMemRectBmp; //方块内存位图句柄 int m_bFistPlay; //是否是第一次开始游戏 void DcEnvInitial(void); void DCEnvClear(void); void DrawGame(CDC *pDC); // Generated message map functions protected: void RectChange(); //{​{AFX_MSG(CSkyjuly_RecTTView) afx_msg void OnGameStart(); afx_msg void OnGamePaush(); afx_msg void OnGameEnd(); afx_msg void OnGameExit(); afx_msg void OnGameOption(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in skyjuly_RecTTView.cpp inline CSkyjuly_RecTTDoc* CSkyjuly_RecTTView::GetDocument() { return (CSkyjuly_RecTTDoc*)m_pDocument; } #endif / //{​{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SKYJULY_RECTTVIEW_H__BBD13113_594E_4BE6_9DA5_1DAE3EC53ED8__INCLUDED_)

以下为View.cpp文件。

view plain copy to clipboard print ?
  1. /*--------------------------------------
  2. View.cpp文件。
  3. July、2010/10月
  4. --------------------------------------*/
  5. // skyjuly_RecTTView.cpp : implementation of the CSkyjuly_RecTTView class
  6. //
  7. #include "stdafx.h"
  8. #include "skyjuly_RecTT.h"
  9. #include "skyjuly_RecTTDoc.h"
  10. #include "skyjuly_RecTTView.h"
  11. #include "OptionDlg.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static   char  THIS_FILE[] = __FILE__;
  16. #endif
  17. /
  18. // CSkyjuly_RecTTView
  19. IMPLEMENT_DYNCREATE(CSkyjuly_RecTTView, CView)
  20. BEGIN_MESSAGE_MAP(CSkyjuly_RecTTView, CView)
  21. //{{AFX_MSG_MAP(CSkyjuly_RecTTView)
  22. ON_COMMAND(ID_GAME_START, OnGameStart)
  23. ON_COMMAND(ID_GAME_PAUSH, OnGamePaush)
  24. ON_COMMAND(ID_GAME_END, OnGameEnd)
  25. ON_COMMAND(ID_GAME_EXIT, OnGameExit)
  26. ON_COMMAND(ID_GAME_OPTION, OnGameOption)
  27. ON_WM_CREATE()
  28. ON_WM_TIMER()
  29. ON_WM_KEYDOWN()
  30. //}}AFX_MSG_MAP
  31. // Standard printing commands
  32. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  33. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  34. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  35. END_MESSAGE_MAP()
  36. /
  37. // CSkyjuly_RecTTView construction/destruction
  38. CSkyjuly_RecTTView::CSkyjuly_RecTTView()
  39. {
  40. // TODO: add construction code here
  41. //第一次开始游戏
  42. m_bFistPlay = TRUE;
  43. //缺省为不是游戏暂停状态
  44. m_bGamePaush = FALSE;
  45. //缺省为不插放背景音乐
  46. m_bMusic = FALSE;
  47. //缺省为画网格线
  48. m_bDrawGrid = TRUE;
  49. //总分值清零
  50. m_iPerformance = 0;
  51. //测试值:为12行,10列
  52. m_iRow = 12;
  53. m_iCol = 10;
  54. //左上角X,Y坐标
  55. m_iStartX = 10;
  56. m_iStartY = 10;
  57. //缺省级别为3级
  58. m_iLevel = 2;
  59. //第一种样式
  60. m_iBlockSytle = 0;
  61. //缺省方块大小为m_iLarge个象素
  62. m_iLarge = 30;
  63. //缺省游戏是结束的
  64. m_bGameEnd = TRUE;
  65. int  i,j;
  66. //赋初值
  67. for  (i=0;i<100;i++)
  68. for  (j=0;j<100;j++)
  69. GameStatus[i][j]=0;
  70. //各种形状方块的接触面数据,参见设计书的接触面表格,
  71. //如果某种形状的方块没有4个接触面,则后面的数据填-1
  72. for  (i=0;i<74;i++)
  73. for  (j=0;j<4;j++)
  74. InterFace[i][j] = -1;
  75. /*
  76. 1  ----
  77. */
  78. InterFace[1][0] = 3;
  79. InterFace[11][0] = 0;   InterFace[11][1] = 1;   InterFace[11][2] = 2;   InterFace[11][3] = 3;
  80. /*
  81. 2   --
  82. --
  83. */
  84. InterFace[2][0] = 1;    InterFace[2][1] = 3;
  85. /*
  86. 3   -
  87. ---
  88. */
  89. InterFace[3][0] = 0;    InterFace[3][1] = 2;    InterFace[3][2] = 3;
  90. InterFace[31][0] = 2;   InterFace[31][1] = 3;
  91. InterFace[32][0] = 0;   InterFace[32][1] = 2;   InterFace[32][2] = 3;
  92. InterFace[33][0] = 0;   InterFace[33][1] = 3;
  93. /*
  94. 4  --
  95. --
  96. */
  97. InterFace[4][0] = 1;    InterFace[4][1] = 3;
  98. InterFace[41][0] = 0;   InterFace[41][1] = 2;   InterFace[41][2] = 3;
  99. /*
  100. 5  --
  101. --
  102. */
  103. InterFace[5][0] = 1;    InterFace[5][1] = 3;
  104. InterFace[51][0] = 0;   InterFace[51][1] = 2;   InterFace[51][2] = 3;
  105. /*
  106. 6  --
  107. -
  108. -
  109. */
  110. InterFace[6][0] = 0;    InterFace[6][1] = 3;
  111. InterFace[61][0] = 1;   InterFace[61][1] = 2;   InterFace[61][2] = 3;
  112. InterFace[62][0] = 2;   InterFace[62][1] = 3;
  113. InterFace[63][0] = 0;   InterFace[63][1] = 1;   InterFace[63][2] = 3;
  114. /*
  115. 7  --
  116. -
  117. -
  118. */
  119. InterFace[7][0] = 2;    InterFace[7][1] = 3;
  120. InterFace[71][0] = 1;   InterFace[71][1] = 2;   InterFace[71][2] = 3;
  121. InterFace[72][0] = 0;   InterFace[72][1] = 3;
  122. InterFace[73][0] = 0;   InterFace[73][1] = 1;   InterFace[73][2] = 3;
  123. }
  124. CSkyjuly_RecTTView::~CSkyjuly_RecTTView()
  125. {
  126. }
  127. BOOL  CSkyjuly_RecTTView::PreCreateWindow(CREATESTRUCT& cs)
  128. {
  129. // TODO: Modify the Window class or styles here by modifying
  130. //  the CREATESTRUCT cs
  131. return  CView::PreCreateWindow(cs);
  132. }
  133. /
  134. // CSkyjuly_RecTTView drawing
  135. void  CSkyjuly_RecTTView::OnDraw(CDC* pDC)
  136. {
  137. /*CSkyjuly_RecTTDoc* pDoc = GetDocument();
  138. ASSERT_VALID(pDoc);*/
  139. // TODO: add draw code for native data here
  140. DcEnvInitial();
  141. DrawGame(&m_memDC);  //在内存位图的游戏区域绘制
  142. pDC->BitBlt(0,0,m_nWidth,m_nHeight,&m_memDC,0,0,SRCCOPY);
  143. }
  144. /
  145. // CSkyjuly_RecTTView diagnostics
  146. #ifdef _DEBUG
  147. #endif //_DEBUG
  148. /
  149. // CSkyjuly_RecTTView message handlers
  150. void  CSkyjuly_RecTTView::OnGameStart()
  151. {
  152. // TODO: Add your command handler code here
  153. if  (!m_bGamePaush)   //如果不是游戏暂停状态,则必须作些初始工作
  154. {
  155. m_bGameEnd = FALSE;
  156. //总分值清零, 并显示总分记分牌
  157. m_iPerformance = 0;
  158. //显示当前的区域及游戏级别的汉字描述
  159. //  CurrentAreaAndLevel();
  160. CRect rect(m_iStartY, m_iStartX, m_iStartY+440, m_iStartX+370);
  161. InvalidateRect(&rect);
  162. }
  163. m_bGamePaush = FALSE;
  164. SetTimer(1,1500-250*m_iLevel,NULL);
  165. }
  166. void  CSkyjuly_RecTTView::OnGamePaush()
  167. {
  168. // TODO: Add your command handler code here
  169. m_bGamePaush = TRUE;
  170. KillTimer(1);
  171. }
  172. void  CSkyjuly_RecTTView::OnGameEnd()
  173. {
  174. // TODO: Add your command handler code here
  175. m_bGameEnd = TRUE;
  176. int  i,j;
  177. for  (i=0;i<m_iRow;i++)
  178. for  (j=0;j<m_iCol;j++)
  179. GameStatus[i][j]=0;
  180. CRect rect(m_iStartY, m_iStartX, m_iStartY+440, m_iStartX+370);
  181. InvalidateRect(&rect);
  182. m_bGamePaush = FALSE;  //清除游戏暂停状态
  183. KillTimer(1);
  184. }
  185. void  CSkyjuly_RecTTView::OnGameExit()
  186. {
  187. // TODO: Add your command handler code here
  188. }
  189. void  CSkyjuly_RecTTView::OnGameOption()
  190. {
  191. // TODO: Add your command handler code here
  192. //参数顺序: 区域大小代码:0-3,分别为:12X10,18X15,24X20,m_iLargeX25
  193. //级别:0-5,分别为:1500,1200,1000,800,600,400
  194. //背景音乐:TRUE 或者 FALSE
  195. int  m_lsArea;
  196. /*  switch(m_iRow)
  197. {
  198. case 12:
  199. m_lsArea = 0;
  200. break;
  201. case 18:
  202. m_lsArea = 1;
  203. break;
  204. case 24:
  205. m_lsArea = 2;
  206. break;
  207. case 30:
  208. m_lsArea = 3;
  209. break;
  210. }*/
  211. COptionDlg dlg(m_lsArea,m_iLevel,m_iBlockSytle,m_bMusic,m_bDrawGrid);
  212. if  (dlg.DoModal()==IDOK)
  213. {
  214. //确定区域的大小
  215. /*  switch(dlg.m_iArea)
  216. {
  217. case 0:
  218. m_iRow = 12;
  219. m_iCol = 10;
  220. m_iLarge = 30;
  221. break;
  222. case 1:
  223. m_iRow = 18;
  224. m_iCol = 15;
  225. m_iLarge = 20;
  226. break;
  227. case 2:
  228. m_iRow = 24;
  229. m_iCol = 20;
  230. m_iLarge = 15;
  231. break;
  232. case 3:
  233. m_iRow = 30;
  234. m_iCol = 25;
  235. m_iLarge = 12;
  236. break;
  237. }
  238. //确定级别
  239. m_iLevel = dlg.m_iLevel;
  240. //选择的样式
  241. m_iBlockSytle = dlg.m_iBlockStyle;
  242. //确定是否绘网格背景
  243. m_bDrawGrid = dlg.m_bDrawGrid;
  244. //检查是否插放音乐
  245. m_bMusic = dlg.m_bMusic;
  246. //  if (m_bMusic)
  247. //          PlayMid();
  248. //  else
  249. //      StopMid();
  250. Invalidate();*/
  251. }
  252. }
  253. void  CSkyjuly_RecTTView::DrawGame(CDC *pDC)
  254. {
  255. int  i,j;
  256. //选用黑色画刷,绘制整个游戏所在窗口的背景
  257. pDC -> SelectObject(m_pBlackBrush);
  258. CRect rect;
  259. GetClientRect(&rect);
  260. pDC -> Rectangle(rect);
  261. //选用灰色画刷,绘制游戏区域的背景
  262. pDC -> SelectObject(m_pGrayBrush);
  263. pDC -> Rectangle(m_iStartY ,m_iStartX, m_iStartY + 301, m_iStartX + 360);
  264. pDC->SelectObject(m_pBlackPen);
  265. //画网格线
  266. if  (m_bDrawGrid)
  267. {
  268. //画横线
  269. for  (i=0;i<m_iRow;i++)
  270. {
  271. pDC->MoveTo(m_iStartY, m_iStartX + i*m_iLarge);
  272. pDC->LineTo(m_iStartY+300, m_iStartX +i*m_iLarge);
  273. }
  274. //画竖线
  275. for  (i=0;i<m_iCol;i++)
  276. {
  277. pDC->MoveTo(m_iStartY+i*m_iLarge, m_iStartX);
  278. pDC->LineTo(m_iStartY+i*m_iLarge, m_iStartX+360);
  279. }
  280. }
  281. int  x,y,nW,nH;
  282. //小方块的绘制
  283. for  (i=0;i<m_iRow;i++)
  284. for  (j=0;j<m_iCol;j++)
  285. {
  286. if  (GameStatus[i][j]==MAP_STATE_NOT_EMPTY)
  287. {
  288. //在游戏区域中状态为被占用状态的区域绘制小方块
  289. x = m_iStartY+j*m_iLarge +2;
  290. y = m_iStartX+i*m_iLarge +2;
  291. nW = m_iLarge-4;
  292. nH = m_iLarge-4;
  293. pDC->BitBlt(x,y,nW,nH,&m_memRectDC,m_iBlockSytle*30,0,SRCCOPY);
  294. }
  295. }
  296. //显示游戏区域及游戏级别的汉字描述
  297. if  (!m_bGameEnd)
  298. {
  299. pDC -> SetBkColor(BLACK);
  300. pDC -> SetTextColor(WHITE);
  301. pDC -> TextOut(m_iStartY+320, m_iStartX+220, "游戏区域大小:" );
  302. pDC -> TextOut(m_iStartY+320, m_iStartX+240,m_strArea);
  303. pDC -> TextOut(m_iStartY+320, m_iStartX+280, "游戏级别:" );
  304. pDC -> TextOut(m_iStartY+320, m_iStartX+300,m_strLevel);
  305. }
  306. //显示总分
  307. if  (!m_bGameEnd)
  308. {
  309. CString lsStr;
  310. lsStr.Format("总分为:%d 分" ,m_iPerformance);
  311. pDC -> SetBkColor(BLACK);
  312. pDC -> SetTextColor(WHITE);
  313. pDC -> TextOut(m_iStartY+320, m_iStartX+180,lsStr);
  314. }
  315. //画下一次将要出现的方块,用于提示用户
  316. if  (!m_bGameEnd)
  317. {
  318. pDC -> SetBkColor(BLACK);
  319. pDC -> SetTextColor(WHITE);
  320. pDC -> TextOut(m_iStartY+320, m_iStartX,"下一个方块:" );
  321. int  x,y,nW,nH;
  322. for  ( UINT  k=0;k<4;k++)
  323. {
  324. i = NextStatus[k][0];
  325. j = NextStatus[k][1];
  326. x = m_iStartY+j*30 +2+320;
  327. y = m_iStartX+i*30 +2+30;
  328. nW = m_iLarge-4;
  329. nH = m_iLarge-4;
  330. pDC->BitBlt(x,y,nW,nH,&m_memRectDC,m_iBlockSytle*30,0,SRCCOPY);
  331. }
  332. }
  333. }
  334. void  CSkyjuly_RecTTView::DcEnvInitial()
  335. {
  336. if (m_bFistPlay)
  337. {
  338. m_bFistPlay = FALSE;
  339. //用默认的参数,获取当前屏幕设备环境
  340. CDC *pWindowDC = GetDC();
  341. //1.用于映射屏幕的内存设备环境
  342. //获取游戏窗口的大小用于下面设置内存位图的尺寸
  343. CRect windowRect;
  344. GetClientRect(&windowRect);
  345. m_nWidth = windowRect.Width();
  346. m_nHeight = windowRect.Height();
  347. //内存设备环境与屏幕设备环境关联(兼容)
  348. m_memDC.CreateCompatibleDC(pWindowDC);
  349. //内存位图与与屏幕关联(兼容),大小为游戏窗口的尺寸
  350. m_memBmp.CreateCompatibleBitmap(pWindowDC,m_nWidth,m_nHeight);
  351. //内存设备环境与内存位图关联,以便通过m_memDC在内存位图上作画
  352. m_memDC.SelectObject(&m_memBmp);
  353. //2.存储方块位图的内存资源
  354. //内存设备环境与屏幕设备环境关联(兼容)
  355. m_memRectDC.CreateCompatibleDC(pWindowDC);
  356. //相当于将外部位图rect.bmp动态载入m_hMemRectBmp中
  357. m_hMemRectBmp=(HBITMAP )LoadImage(NULL, "rect.bmp" ,IMAGE_BITMAP,150,30,LR_LOADFROMFILE);
  358. //内存设备环境与内存位图关联,以便通过m_memDC在内存位图上作画
  359. SelectObject(m_memRectDC.m_hDC, m_hMemRectBmp);
  360. //黑色的黑笔
  361. m_pBlackPen  = new  CPen(PS_SOLID,1,BLACK);
  362. //画刷,
  363. m_pGrayBrush  = new  CBrush(RGB(0,60,0));
  364. m_pBlackBrush  = new  CBrush(BLACK);
  365. }
  366. }
  367. void  CSkyjuly_RecTTView::DCEnvClear()
  368. {
  369. //设备环境
  370. m_memDC.DeleteDC();
  371. m_memRectDC.DeleteDC();
  372. //位图资源
  373. DeleteObject(m_memBmp);
  374. DeleteObject(m_hMemRectBmp);
  375. delete (m_pBlackPen);
  376. delete (m_pGrayBrush);
  377. delete (m_pBlackBrush);
  378. }
  379. int  CSkyjuly_RecTTView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  380. {
  381. if  (CView::OnCreate(lpCreateStruct) == -1)
  382. return  -1;
  383. //决定第一次掉下来的方块的样式
  384. m_inextStatus = Random(7);
  385. return  0;
  386. }
  387. int  CSkyjuly_RecTTView::Random( int  MaxNumber)
  388. {
  389. //部下随机种子
  390. srand( (unsigned)time( NULL ) );
  391. //产生随机数
  392. int  random = rand() % MaxNumber;
  393. //保证非0
  394. if (random == 0 )
  395. random++;
  396. return  random;
  397. }
  398. void  CSkyjuly_RecTTView::RectDown()
  399. {
  400. IsBottom();
  401. if  (!m_isBottom)
  402. {
  403. //清除以前的方块
  404. int  x1,x2,x3,x4,y1,y2,y3,y4;
  405. x1 = ActiveStatus[0][0];
  406. x2 = ActiveStatus[1][0];
  407. x3 = ActiveStatus[2][0];
  408. x4 = ActiveStatus[3][0];
  409. y1 = ActiveStatus[0][1];
  410. y2 = ActiveStatus[1][1];
  411. y3 = ActiveStatus[2][1];
  412. y4 = ActiveStatus[3][1];
  413. GameStatus[x1][y1]=MAP_STATE_EMPTY;
  414. GameStatus[x2][y2]=MAP_STATE_EMPTY;
  415. GameStatus[x3][y3]=MAP_STATE_EMPTY;
  416. GameStatus[x4][y4]=MAP_STATE_EMPTY;
  417. InvalidateCurrent();
  418. //方块下落
  419. ActiveStatus[0][0] += 1;
  420. ActiveStatus[1][0] += 1;
  421. ActiveStatus[2][0] += 1;
  422. ActiveStatus[3][0] += 1;
  423. GameStatus[x1+1][y1]=MAP_STATE_NOT_EMPTY;
  424. GameStatus[x2+1][y2]=MAP_STATE_NOT_EMPTY;
  425. GameStatus[x3+1][y3]=MAP_STATE_NOT_EMPTY;
  426. GameStatus[x4+1][y4]=MAP_STATE_NOT_EMPTY;
  427. InvalidateCurrent();
  428. }
  429. }
  430. void  CSkyjuly_RecTTView::InvalidateCurrent()
  431. {
  432. int  i;
  433. for  (i=0;i<4;i++)
  434. {
  435. CRect rect(m_iStartX+ActiveStatus[i][1]*m_iLarge,
  436. m_iStartY+ActiveStatus[i][0]*m_iLarge,
  437. m_iStartX+(ActiveStatus[i][1]+1)*m_iLarge+5,
  438. m_iStartY+(ActiveStatus[i][0]+1)*m_iLarge);
  439. //InvalidateRect(&rect);
  440. Invalidate(FALSE);
  441. }
  442. }
  443. void  CSkyjuly_RecTTView::IsBottom()
  444. {
  445. //到底有两种概念:1是已到底部,2是下面碰到了另外的方块
  446. int  x1,x2,x3,x4;
  447. int  x,xx,yy,i;
  448. x1 = ActiveStatus[0][0];
  449. x2 = ActiveStatus[1][0];
  450. x3 = ActiveStatus[2][0];
  451. x4 = ActiveStatus[3][0];
  452. //是否为底部的判断
  453. //1。到达游戏区域的底部
  454. //2。与接触面正下方的小方块区域为被占用状态
  455. if  (x1>=m_iRow-1 || x2>=m_iRow-1 || x3>=m_iRow-1 || x4>=m_iRow-1)
  456. m_isBottom = TRUE;
  457. else
  458. {
  459. for  (i=0;i<4;i++)
  460. {
  461. if  (InterFace[m_currentRect][i] > -1)
  462. {//取当前下坠物有接触面的方块
  463. //获取有接触面的小方块的编号
  464. x=InterFace[m_currentRect][i];
  465. //根据编号获取ActiveStatus中该小方块的整下方的坐标
  466. xx=ActiveStatus[x][0]+1;
  467. yy=ActiveStatus[x][1];
  468. //判断该接触面整下方的小方块区域是否为被占用状态
  469. if  (GameStatus[xx][yy]==MAP_STATE_NOT_EMPTY)
  470. m_isBottom = TRUE;
  471. }
  472. }
  473. }
  474. BOOL  m_bIsSucced;
  475. int  k,j;
  476. int  m_iMuch=0;  //本次销掉的行数
  477. //计分规则:一次销掉一行,加100分,一次销掉两行,加400分,三行,900分
  478. //例如销掉x行,则分数为:x*(x*100)
  479. if  (m_isBottom)
  480. {
  481. //判断是否已得分
  482. for  (i=0;i<m_iRow;i++)
  483. {
  484. m_bIsSucced = TRUE;
  485. for  (j=0;j<m_iCol;j++)
  486. if  (GameStatus[i][j]==MAP_STATE_EMPTY)
  487. m_bIsSucced = FALSE;
  488. //如果得分,则销掉此行
  489. if  (m_bIsSucced)
  490. {
  491. for  (k=i;k>0;k--)
  492. for  (j=0;j<m_iCol;j++)
  493. GameStatus[k][j] = GameStatus[k-1][j];
  494. //第1行清零
  495. for  (j=0;j<m_iCol;j++)
  496. GameStatus[0][j]=MAP_STATE_EMPTY;
  497. m_iMuch += 1;
  498. }
  499. }
  500. if  (m_iMuch>0)
  501. {
  502. m_iPerformance += m_iMuch * m_iMuch * 100;
  503. //刷新游戏区域
  504. CRect rect1(m_iStartY, m_iStartX, m_iStartY+300, m_iStartX+360);
  505. //InvalidateRect(&rect1);
  506. //刷新分数区域
  507. CRect rect2(m_iStartY+320, m_iStartX+180, m_iStartY+440, m_iStartX+200);
  508. //InvalidateRect(&rect2);
  509. Invalidate(FALSE);
  510. }
  511. }
  512. }
  513. //映射下一个方快,显示下一个降落的方块
  514. void  CSkyjuly_RecTTView::RectStatusToActiveStatus( int  m_which)
  515. {
  516. switch (m_which)
  517. {
  518. case  1:
  519. ActiveStatus[0][0] = 0; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 1; ActiveStatus[1][1] = 5;
  520. ActiveStatus[2][0] = 2; ActiveStatus[2][1] = 5; ActiveStatus[3][0] = 3; ActiveStatus[3][1] = 5;
  521. break ;
  522. case  2:
  523. ActiveStatus[0][0] = 0; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 1; ActiveStatus[1][1] = 5;
  524. ActiveStatus[2][0] = 0; ActiveStatus[2][1] = 6; ActiveStatus[3][0] = 1; ActiveStatus[3][1] = 6;
  525. break ;
  526. case  3:
  527. ActiveStatus[0][0] = 1; ActiveStatus[0][1] = 4; ActiveStatus[1][0] = 0; ActiveStatus[1][1] = 5;
  528. ActiveStatus[2][0] = 1; ActiveStatus[2][1] = 5; ActiveStatus[3][0] = 1; ActiveStatus[3][1] = 6;
  529. break ;
  530. case  4:
  531. ActiveStatus[0][0] = 0; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 1; ActiveStatus[1][1] = 5;
  532. ActiveStatus[2][0] = 1; ActiveStatus[2][1] = 6; ActiveStatus[3][0] = 2; ActiveStatus[3][1] = 6;
  533. break ;
  534. case  5:
  535. ActiveStatus[0][0] = 1; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 2; ActiveStatus[1][1] = 5;
  536. ActiveStatus[2][0] = 0; ActiveStatus[2][1] = 6; ActiveStatus[3][0] = 1; ActiveStatus[3][1] = 6;
  537. break ;
  538. case  6:
  539. ActiveStatus[0][0] = 0; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 0; ActiveStatus[1][1] = 6;
  540. ActiveStatus[2][0] = 1; ActiveStatus[2][1] = 6; ActiveStatus[3][0] = 2; ActiveStatus[3][1] = 6;
  541. break ;
  542. case  7:
  543. ActiveStatus[0][0] = 0; ActiveStatus[0][1] = 5; ActiveStatus[1][0] = 1; ActiveStatus[1][1] = 5;
  544. ActiveStatus[2][0] = 2; ActiveStatus[2][1] = 5; ActiveStatus[3][0] = 0; ActiveStatus[3][1] = 6;
  545. break ;
  546. }
  547. }
  548. void  CSkyjuly_RecTTView::OnTimer( UINT  nIDEvent)
  549. {
  550. //如果原来的方块已到底或游戏刚开始,则掉下一个新的方块
  551. int  i,j,k;
  552. if  (m_isBottom)
  553. {
  554. //1.产生下一个随机下坠物
  555. m_icurrentStatus = m_inextStatus;
  556. m_inextStatus = Random(7);  //得到下一次的方块样式
  557. //  if (m_inextStatus==0) m_inextStatus++;
  558. //2.修改新的“下一下坠物”
  559. RectStatusToNextStatus( m_inextStatus );
  560. //  CRect rect(m_iStartY+320, m_iStartX, m_iStartY+440, m_iStartX+160);
  561. //  InvalidateRect(&rect);
  562. //  Invalidate(FALSE);
  563. //3.将旧的“下一下坠物”用作当前使用
  564. m_currentRect = m_icurrentStatus;
  565. //根据当前下坠物的形状去初始化激活状态下的下坠物坐标
  566. RectStatusToActiveStatus( m_icurrentStatus );
  567. //将当前动态数组中的数据反映到大数组中
  568. ActiveStatusToGameStatus();
  569. m_isBottom = FALSE;
  570. //4.判断当前方块是否已到底
  571. IsBottom();
  572. //5.判断游戏是否已结束: 碰了底,且第1行有小方块
  573. if  (m_isBottom)
  574. for  (i=0;i<m_iCol;i++)
  575. if  (GameStatus[0][i])
  576. {
  577. KillTimer(1);
  578. AfxMessageBox("游戏已结束!" );
  579. for  (j=0;j<m_iRow;j++)
  580. for  (k=0;k<m_iCol;k++)
  581. GameStatus[j][k]=0;
  582. Invalidate(FALSE);
  583. m_bGameEnd = TRUE;
  584. break ;
  585. }
  586. }
  587. else    //当前方块下降
  588. {
  589. RectDown();
  590. }
  591. CView::OnTimer(nIDEvent);
  592. }
  593. void  CSkyjuly_RecTTView::ActiveStatusToGameStatus()
  594. {
  595. int  x1,x2,x3,x4,y1,y2,y3,y4;
  596. x1 = ActiveStatus[0][0];
  597. x2 = ActiveStatus[1][0];
  598. x3 = ActiveStatus[2][0];
  599. x4 = ActiveStatus[3][0];
  600. y1 = ActiveStatus[0][1];
  601. y2 = ActiveStatus[1][1];
  602. y3 = ActiveStatus[2][1];
  603. y4 = ActiveStatus[3][1];
  604. GameStatus[x1][y1]=MAP_STATE_NOT_EMPTY;
  605. GameStatus[x2][y2]=MAP_STATE_NOT_EMPTY;
  606. GameStatus[x3][y3]=MAP_STATE_NOT_EMPTY;
  607. GameStatus[x4][y4]=MAP_STATE_NOT_EMPTY;
  608. }
  609. void  CSkyjuly_RecTTView::RectStatusToNextStatus( int  m_which)
  610. {
  611. switch (m_which)
  612. {
  613. case  1:
  614. NextStatus[0][0] = 0;   NextStatus[0][1] = 1;   NextStatus[1][0] = 1;   NextStatus[1][1] = 1;
  615. NextStatus[2][0] = 2;   NextStatus[2][1] = 1;   NextStatus[3][0] = 3;   NextStatus[3][1] = 1;
  616. break ;
  617. case  2:
  618. NextStatus[0][0] = 0;   NextStatus[0][1] = 1;   NextStatus[1][0] = 1;   NextStatus[1][1] = 1;
  619. NextStatus[2][0] = 0;   NextStatus[2][1] = 2;   NextStatus[3][0] = 1;   NextStatus[3][1] = 2;
  620. break ;
  621. case  3:
  622. NextStatus[0][0] = 1;   NextStatus[0][1] = 0;   NextStatus[1][0] = 0;   NextStatus[1][1] = 1;
  623. NextStatus[2][0] = 1;   NextStatus[2][1] = 1;   NextStatus[3][0] = 1;   NextStatus[3][1] = 2;
  624. break ;
  625. case  4:
  626. NextStatus[0][0] = 0;   NextStatus[0][1] = 1;   NextStatus[1][0] = 1;   NextStatus[1][1] = 1;
  627. NextStatus[2][0] = 1;   NextStatus[2][1] = 2;   NextStatus[3][0] = 2;   NextStatus[3][1] = 2;
  628. break ;
  629. case  5:
  630. NextStatus[0][0] = 1;   NextStatus[0][1] = 1;   NextStatus[1][0] = 2;   NextStatus[1][1] = 1;
  631. NextStatus[2][0] = 0;   NextStatus[2][1] = 2;   NextStatus[3][0] = 1;   NextStatus[3][1] = 2;
  632. break ;
  633. case  6:
  634. NextStatus[0][0] = 0;   NextStatus[0][1] = 1;   NextStatus[1][0] = 0;   NextStatus[1][1] = 2;
  635. NextStatus[2][0] = 1;   NextStatus[2][1] = 2;   NextStatus[3][0] = 2;   NextStatus[3][1] = 2;
  636. break ;
  637. case  7:
  638. NextStatus[0][0] = 0;   NextStatus[0][1] = 1;   NextStatus[1][0] = 1;   NextStatus[1][1] = 1;
  639. NextStatus[2][0] = 2;   NextStatus[2][1] = 1;   NextStatus[3][0] = 0;   NextStatus[3][1] = 2;
  640. break ;
  641. }
  642. }
  643. void  CSkyjuly_RecTTView::RectArrow( int  m_Type)
  644. {
  645. //获取当前下坠物4个小方块的位置坐标
  646. int  x1,x2,x3,x4,y1,y2,y3,y4;
  647. x1 = ActiveStatus[0][0];
  648. x2 = ActiveStatus[1][0];
  649. x3 = ActiveStatus[2][0];
  650. x4 = ActiveStatus[3][0];
  651. y1 = ActiveStatus[0][1];
  652. y2 = ActiveStatus[1][1];
  653. y3 = ActiveStatus[2][1];
  654. y4 = ActiveStatus[3][1];
  655. //对不同的移动命令指示进行分类实现
  656. switch (m_Type)
  657. {
  658. case  LEFT:
  659. //对每种不同的移动命令指示特性作相应的可移动分析
  660. if  ( (ActiveStatus[0][1]>0) && IsLeftLimit() && !m_isBottom)
  661. {
  662. //清原来的方块
  663. GameStatus[x1][y1]=MAP_STATE_EMPTY;
  664. GameStatus[x2][y2]=MAP_STATE_EMPTY;
  665. GameStatus[x3][y3]=MAP_STATE_EMPTY;
  666. GameStatus[x4][y4]=MAP_STATE_EMPTY;
  667. //  InvalidateCurrent();
  668. //添加新的移动后数据状态
  669. ActiveStatus[0][1] -= 1;
  670. ActiveStatus[1][1] -= 1;
  671. ActiveStatus[2][1] -= 1;
  672. ActiveStatus[3][1] -= 1;
  673. GameStatus[x1][y1-1]=MAP_STATE_NOT_EMPTY;
  674. GameStatus[x2][y2-1]=MAP_STATE_NOT_EMPTY;
  675. GameStatus[x3][y3-1]=MAP_STATE_NOT_EMPTY;
  676. GameStatus[x4][y4-1]=MAP_STATE_NOT_EMPTY;
  677. InvalidateCurrent();
  678. }
  679. break ;
  680. case  RIGHT:
  681. if  ( (ActiveStatus[3][1]< m_iCol-1) && IsRightLimit() && !m_isBottom)
  682. {
  683. //清原来的方块
  684. GameStatus[x1][y1]=MAP_STATE_EMPTY;
  685. GameStatus[x2][y2]=MAP_STATE_EMPTY;
  686. GameStatus[x3][y3]=MAP_STATE_EMPTY;
  687. GameStatus[x4][y4]=MAP_STATE_EMPTY;
  688. //  InvalidateCurrent();
  689. //添加新的移动后数据状态
  690. ActiveStatus[0][1] += 1;
  691. ActiveStatus[1][1] += 1;
  692. ActiveStatus[2][1] += 1;
  693. ActiveStatus[3][1] += 1;
  694. GameStatus[x1][y1+1]=MAP_STATE_NOT_EMPTY;
  695. GameStatus[x2][y2+1]=MAP_STATE_NOT_EMPTY;
  696. GameStatus[x3][y3+1]=MAP_STATE_NOT_EMPTY;
  697. GameStatus[x4][y4+1]=MAP_STATE_NOT_EMPTY;
  698. InvalidateCurrent();
  699. }
  700. break ;
  701. case  DOWN:
  702. RectDown();
  703. break ;
  704. }
  705. }
  706. void  CSkyjuly_RecTTView::OnKeyDown( UINT  nChar,  UINT  nRepCnt,  UINT  nFlags)
  707. {
  708. switch (nChar)
  709. {
  710. case  VK_LEFT:
  711. RectArrow(LEFT);
  712. break ;
  713. case  VK_RIGHT:
  714. RectArrow(RIGHT);
  715. break ;
  716. case  VK_UP:
  717. RectChange();
  718. break ;
  719. case  VK_DOWN:
  720. RectArrow(DOWN);
  721. break ;
  722. }
  723. CView::OnKeyDown(nChar, nRepCnt, nFlags);
  724. }
  725. BOOL  CSkyjuly_RecTTView::IsLeftLimit()
  726. {
  727. int  x1,x2,x3,x4,y1,y2,y3,y4;
  728. x1 = ActiveStatus[0][0];
  729. x2 = ActiveStatus[1][0];
  730. x3 = ActiveStatus[2][0];
  731. x4 = ActiveStatus[3][0];
  732. y1 = ActiveStatus[0][1];
  733. y2 = ActiveStatus[1][1];
  734. y3 = ActiveStatus[2][1];
  735. y4 = ActiveStatus[3][1];
  736. //根据当前下坠物的具体形态,分析判断其是否有向左移动的空间
  737. switch (m_currentRect)
  738. {
  739. // "1"字形形态类型,判断其四个方块的正左边都没有任何物件(空间没有被占据)
  740. case  1:
  741. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1] || GameStatus[x4][y4-1])
  742. return  FALSE;
  743. break ;
  744. case  11:
  745. if  (GameStatus[x1][y1-1])
  746. return  FALSE;
  747. break ;
  748. case  2:
  749. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1])
  750. return  FALSE;
  751. break ;
  752. case  3:
  753. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1])
  754. return  FALSE;
  755. break ;
  756. case  31:
  757. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1])
  758. return  FALSE;
  759. break ;
  760. case  32:
  761. if  (GameStatus[x1][y1-1] || GameStatus[x3][y3-1])
  762. return  FALSE;
  763. break ;
  764. case  33:
  765. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x4][y4-1])
  766. return  FALSE;
  767. break ;
  768. case  4:
  769. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x4][y4-1])
  770. return  FALSE;
  771. break ;
  772. case  41:
  773. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1])
  774. return  FALSE;
  775. break ;
  776. case  5:
  777. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1])
  778. return  FALSE;
  779. break ;
  780. case  51:
  781. if  (GameStatus[x1][y1-1] || GameStatus[x3][y3-1])
  782. return  FALSE;
  783. break ;
  784. case  6:
  785. if  (GameStatus[x1][y1-1] || GameStatus[x3][y3-1] || GameStatus[x4][y4-1])
  786. return  FALSE;
  787. break ;
  788. case  61:
  789. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1])
  790. return  FALSE;
  791. break ;
  792. case  62:
  793. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1])
  794. return  FALSE;
  795. break ;
  796. case  63:
  797. if  (GameStatus[x1][y1-1] || GameStatus[x3][y3-1])
  798. return  FALSE;
  799. break ;
  800. case  7:
  801. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1])
  802. return  FALSE;
  803. break ;
  804. case  71:
  805. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1])
  806. return  FALSE;
  807. break ;
  808. case  72:
  809. if  (GameStatus[x1][y1-1] || GameStatus[x2][y2-1] || GameStatus[x3][y3-1])
  810. return  FALSE;
  811. break ;
  812. case  73:
  813. if  (GameStatus[x1][y1-1] || GameStatus[x4][y4-1])
  814. return  FALSE;
  815. break ;
  816. }
  817. return  TRUE;
  818. }
  819. BOOL  CSkyjuly_RecTTView::IsRightLimit()
  820. {
  821. int  x1,x2,x3,x4,y1,y2,y3,y4;
  822. x1 = ActiveStatus[0][0];
  823. x2 = ActiveStatus[1][0];
  824. x3 = ActiveStatus[2][0];
  825. x4 = ActiveStatus[3][0];
  826. y1 = ActiveStatus[0][1];
  827. y2 = ActiveStatus[1][1];
  828. y3 = ActiveStatus[2][1];
  829. y4 = ActiveStatus[3][1];
  830. switch (m_currentRect)
  831. {
  832. case  1:
  833. if  (GameStatus[x1][y1+1] || GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  834. return  FALSE;
  835. break ;
  836. case  11:
  837. if  (GameStatus[x4][y4+1])
  838. return  FALSE;
  839. break ;
  840. case  2:
  841. if  (GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  842. return  FALSE;
  843. break ;
  844. case  3:
  845. if  (GameStatus[x2][y2+1] || GameStatus[x4][y4+1])
  846. return  FALSE;
  847. break ;
  848. case  31:
  849. if  (GameStatus[x1][y1+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  850. return  FALSE;
  851. break ;
  852. case  32:
  853. if  (GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  854. return  FALSE;
  855. break ;
  856. case  33:
  857. if  (GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  858. return  FALSE;
  859. break ;
  860. case  4:
  861. if  (GameStatus[x1][y1+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  862. return  FALSE;
  863. break ;
  864. case  41:
  865. if  (GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  866. return  FALSE;
  867. break ;
  868. case  5:
  869. if  (GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  870. return  FALSE;
  871. break ;
  872. case  51:
  873. if  (GameStatus[x2][y2+1] || GameStatus[x4][y4+1])
  874. return  FALSE;
  875. break ;
  876. case  6:
  877. if  (GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  878. return  FALSE;
  879. break ;
  880. case  61:
  881. if  (GameStatus[x2][y2+1] || GameStatus[x4][y4+1])
  882. return  FALSE;
  883. break ;
  884. case  62:
  885. if  (GameStatus[x1][y1+1] || GameStatus[x2][y2+1] || GameStatus[x4][y4+1])
  886. return  FALSE;
  887. break ;
  888. case  63:
  889. if  (GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  890. return  FALSE;
  891. break ;
  892. case  7:
  893. if  (GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  894. return  FALSE;
  895. break ;
  896. case  71:
  897. if  (GameStatus[x1][y1+1] || GameStatus[x4][y4+1])
  898. return  FALSE;
  899. break ;
  900. case  72:
  901. if  (GameStatus[x2][y2+1] || GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  902. return  FALSE;
  903. break ;
  904. case  73:
  905. if  (GameStatus[x3][y3+1] || GameStatus[x4][y4+1])
  906. return  FALSE;
  907. break ;
  908. }
  909. return  TRUE;
  910. }
  911. void  CSkyjuly_RecTTView::RectChange()
  912. {
  913. //先预先变形,然后判断变形后的方块是否有空间,如有足够空间,则进行实际变形,否则不变
  914. int  xx1,xx2,xx3,xx4,yy1,yy2,yy3,yy4;
  915. int  m_lscurrentRect;
  916. CString lsStr;
  917. int  x1,x2,x3,x4,y1,y2,y3,y4;
  918. x1 = ActiveStatus[0][0];
  919. x2 = ActiveStatus[1][0];
  920. x3 = ActiveStatus[2][0];
  921. x4 = ActiveStatus[3][0];
  922. y1 = ActiveStatus[0][1];
  923. y2 = ActiveStatus[1][1];
  924. y3 = ActiveStatus[2][1];
  925. y4 = ActiveStatus[3][1];
  926. //变形后位置在数组中的存放顺序仍需遵循先左后右,在同一列中先上后下
  927. xx1=x1; xx2=x2; xx3=x3; xx4=x4; yy1=y1; yy2=y2; yy3=y3; yy4=y4;
  928. switch (m_currentRect)
  929. {
  930. case  1:
  931. xx1=x1+1; yy1=y1-1; xx3=x3-1; yy3=y3+1; xx4=x4-2; yy4=y4+2;
  932. m_lscurrentRect = 11;
  933. break ;
  934. case  11:
  935. xx1=x1-1; yy1=y1+1; xx3=x3+1; yy3=y3-1; xx4=x4+2; yy4=y4-2;
  936. m_lscurrentRect = 1;
  937. break ;
  938. case  2:
  939. m_lscurrentRect=2;
  940. break ;
  941. case  3:
  942. xx1=x1-2; yy1=y1+1; xx4=x4-1; yy4=y4;
  943. m_lscurrentRect = 31;
  944. break ;
  945. case  31:
  946. xx1=x1+1; yy1=y1-1;
  947. m_lscurrentRect = 32;
  948. break ;
  949. case  32:
  950. xx1=x1+1; yy1=y1; xx4=x4+2; yy4=y4-1;
  951. m_lscurrentRect=33;
  952. break ;
  953. case  33:
  954. xx4=x4-1; yy4=y4+1;
  955. m_lscurrentRect=3;
  956. break ;
  957. case  4:
  958. xx1=x1+2; yy1=y1-1; xx3=x3+1; yy3=y3-1; xx4=x4-1;
  959. m_lscurrentRect = 41;
  960. break ;
  961. case  41:
  962. xx1=x1-2; yy1=y1+1; xx3=x3-1; yy3=y3+1; xx4=x4+1;
  963. m_lscurrentRect = 4;
  964. break ;
  965. case  5:
  966. xx1=x1-1; xx2=x2-2; yy2=y2+1; xx3=x3+1; yy4=y4+1;
  967. m_lscurrentRect = 51;
  968. break ;
  969. case  51:
  970. xx1=x1+1; xx2=x2+2; yy2=y2-1; xx3=x3-1; yy4=y4-1;
  971. m_lscurrentRect = 5;
  972. break ;
  973. case  6:
  974. xx2=x1+1; yy2=y2-1; xx3=x3-1; xx4=x4-2; yy4 = yy4+1;
  975. m_lscurrentRect = 61;
  976. break ;
  977. case  61:
  978. xx3=x3+2; yy3=y3-1; xx4=x4+2; yy4=y4-1;
  979. m_lscurrentRect = 62;
  980. break ;
  981. case  62:
  982. xx1=x1+1; yy1=y1-1; xx3=x3-2; yy3=y3+1; xx4=x4-1;
  983. m_lscurrentRect = 63;
  984. break ;
  985. case  63:
  986. xx1=x1-2; yy1=y1+1; xx2=x2-2; yy2=y2+1;
  987. m_lscurrentRect = 6;
  988. break ;
  989. case  7:
  990. xx3=x3-1; yy3=y3+1; xx4=x4+1; yy4=y4+1;
  991. m_lscurrentRect = 71;
  992. break ;
  993. case  71:
  994. xx1=x1+2; xx2=x2-1; yy2=y2+1; xx4=x4+1; yy4=y4-1;
  995. m_lscurrentRect = 72;
  996. break ;
  997. case  72:
  998. xx1=x1-2; xx3=x3-1; yy3=y3+1; xx4=x4-1; yy4=y4+1;
  999. m_lscurrentRect = 73;
  1000. break ;
  1001. case  73:
  1002. xx2=x2+1; yy2=y2-1; xx3=x3+2; yy3=y3-2; xx4=x4-1; yy4=y4-1;
  1003. m_lscurrentRect = 7;
  1004. break ;
  1005. }
  1006. //如果变形后所在的区域内无其他方块,则表示有足够空间,可以变形
  1007. //且不能超越边界
  1008. GameStatus[x1][y1] = MAP_STATE_EMPTY;
  1009. GameStatus[x2][y2] = MAP_STATE_EMPTY;
  1010. GameStatus[x3][y3] = MAP_STATE_EMPTY;
  1011. GameStatus[x4][y4] = MAP_STATE_EMPTY;
  1012. if  (GameStatus[xx1][yy1]==MAP_STATE_EMPTY &&
  1013. GameStatus[xx2][yy2]==MAP_STATE_EMPTY &&
  1014. GameStatus[xx3][yy3]==MAP_STATE_EMPTY &&
  1015. GameStatus[xx4][yy4]==MAP_STATE_EMPTY
  1016. && yy1>=0 && yy4<=m_iCol-1
  1017. && !(xx1<0 || xx2<0 || xx3<0 || xx4<0)
  1018. && !(xx1>m_iRow-1 || xx2>m_iRow-1 || xx3>m_iRow-1 || xx4>m_iRow-1) )
  1019. {
  1020. InvalidateCurrent();
  1021. ActiveStatus[0][0]=xx1;
  1022. ActiveStatus[1][0]=xx2;
  1023. ActiveStatus[2][0]=xx3;
  1024. ActiveStatus[3][0]=xx4;
  1025. ActiveStatus[0][1]=yy1;
  1026. ActiveStatus[1][1]=yy2;
  1027. ActiveStatus[2][1]=yy3;
  1028. ActiveStatus[3][1]=yy4;
  1029. GameStatus[xx1][yy1] = MAP_STATE_NOT_EMPTY;
  1030. GameStatus[xx2][yy2] = MAP_STATE_NOT_EMPTY;
  1031. GameStatus[xx3][yy3] = MAP_STATE_NOT_EMPTY;
  1032. GameStatus[xx4][yy4] = MAP_STATE_NOT_EMPTY;
  1033. InvalidateCurrent();
  1034. //改变形状代码
  1035. m_currentRect = m_lscurrentRect;
  1036. }
  1037. else
  1038. {//恢复原来状态
  1039. GameStatus[x1][y1] = MAP_STATE_NOT_EMPTY;
  1040. GameStatus[x2][y2] = MAP_STATE_NOT_EMPTY;
  1041. GameStatus[x3][y3] = MAP_STATE_NOT_EMPTY;
  1042. GameStatus[x4][y4] = MAP_STATE_NOT_EMPTY;
  1043. }
  1044. //判断是否已到底
  1045. IsBottom();
  1046. }

//给的注释已经够详尽了,我就不再写多余的分析了。

//July、2010/10月。

Dlg.h文件。

view plain copy to clipboard print ?
  1. #if !defined(AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_)
  2. #define AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // OptionDlg.h : header file
  7. //
  8. /
  9. // COptionDlg dialog
  10. class  COptionDlg :  public  CDialog
  11. {
  12. // Construction
  13. public :
  14. int  m_iBlockStyle;
  15. int  m_iLevel;
  16. int  m_iArea;
  17. COptionDlg(int  m_iArea,  int  m_iLevel, int  m_iBlockStyle,  BOOL  m_bMusic, BOOL  m_bDrawGrid, CWnd* pParent = NULL);
  18. // Dialog Data
  19. //{{AFX_DATA(COptionDlg)
  20. enum  { IDD = IDD_DLG_OPTION };
  21. BOOL     m_bDrawGrid;
  22. BOOL     m_bMusic;
  23. //}}AFX_DATA
  24. // Overrides
  25. // ClassWizard generated virtual function overrides
  26. //{{AFX_VIRTUAL(COptionDlg)
  27. protected :
  28. virtual   void  DoDataExchange(CDataExchange* pDX);     // DDX/DDV support
  29. //}}AFX_VIRTUAL
  30. // Implementation
  31. protected :
  32. int  m_oldArea;
  33. int  m_oldLevel;
  34. int  m_oldBlockSytle;
  35. BOOL  m_oldMusic;
  36. BOOL  m_oldDrawGrid;
  37. // Generated message map functions
  38. //{{AFX_MSG(COptionDlg)
  39. afx_msg void  OnCheckGrid();
  40. virtual   void  OnOK();
  41. virtual   BOOL  OnInitDialog();
  42. afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
  43. afx_msg void  OnGameOption();
  44. //}}AFX_MSG
  45. DECLARE_MESSAGE_MAP()
  46. };
  47. //{{AFX_INSERT_LOCATION}}
  48. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  49. #endif // !defined(AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_)

#if !defined(AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_) #define AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // OptionDlg.h : header file // / // COptionDlg dialog class COptionDlg : public CDialog { // Construction public: int m_iBlockStyle; int m_iLevel; int m_iArea; COptionDlg(int m_iArea, int m_iLevel,int m_iBlockStyle, BOOL m_bMusic,BOOL m_bDrawGrid, CWnd* pParent = NULL); // Dialog Data //{​{AFX_DATA(COptionDlg) enum { IDD = IDD_DLG_OPTION }; BOOL m_bDrawGrid; BOOL m_bMusic; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{​{AFX_VIRTUAL(COptionDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: int m_oldArea; int m_oldLevel; int m_oldBlockSytle; BOOL m_oldMusic; BOOL m_oldDrawGrid; // Generated message map functions //{​{AFX_MSG(COptionDlg) afx_msg void OnCheckGrid(); virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnGameOption(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{​{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_OPTIONDLG_H__570435A5_9237_4DE0_8215_48D075E106AD__INCLUDED_)

Dlg.cpp文件。

view plain copy to clipboard print ?
  1. // OptionDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "skyjuly_RecTT.h"
  5. #include "OptionDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static   char  THIS_FILE[] = __FILE__;
  10. #endif
  11. /
  12. // COptionDlg dialog
  13. COptionDlg::COptionDlg(int  m_iArea,  int  m_iLevel,  int  m_iBlockStyle, BOOL  m_bMusic,  BOOL  m_bDrawGrid, CWnd* pParent  /*=NULL*/ )
  14. : CDialog(COptionDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(COptionDlg)
  17. m_bDrawGrid = FALSE;
  18. m_bMusic = FALSE;
  19. //}}AFX_DATA_INIT
  20. }
  21. void  COptionDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(COptionDlg)
  25. DDX_Check(pDX, IDC_CHECK_GRID, m_bDrawGrid);
  26. DDX_Check(pDX, IDC_CHECK_MUSIC, m_bMusic);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(COptionDlg, CDialog)
  30. //{{AFX_MSG_MAP(COptionDlg)
  31. ON_BN_CLICKED(IDC_CHECK_GRID, OnCheckGrid)
  32. ON_WM_CREATE()
  33. ON_COMMAND(ID_GAME_OPTION, OnGameOption)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /
  37. // COptionDlg message handlers
  38. void  COptionDlg::OnCheckGrid()
  39. {
  40. // TODO: Add your control notification handler code here
  41. }
  42. void  COptionDlg::OnOK()
  43. {
  44. // TODO: Add extra validation here
  45. CDialog::OnOK();
  46. }
  47. BOOL  COptionDlg::OnInitDialog()
  48. {
  49. CDialog::OnInitDialog();
  50. // TODO: Add extra initialization here
  51. return  TRUE;   // return TRUE unless you set the focus to a control
  52. // EXCEPTION: OCX Property Pages should return FALSE
  53. }
  54. int  COptionDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
  55. {
  56. if  (CDialog::OnCreate(lpCreateStruct) == -1)
  57. return  -1;
  58. // TODO: Add your specialized creation code here
  59. return  0;
  60. }
  61. void  COptionDlg::OnGameOption()
  62. {
  63. // TODO: Add your command handler code here
  64. }

// OptionDlg.cpp : implementation file // #include "stdafx.h" #include "skyjuly_RecTT.h" #include "OptionDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif / // COptionDlg dialog COptionDlg::COptionDlg(int m_iArea, int m_iLevel, int m_iBlockStyle,BOOL m_bMusic, BOOL m_bDrawGrid, CWnd* pParent /*=NULL*/) : CDialog(COptionDlg::IDD, pParent) { //{​{AFX_DATA_INIT(COptionDlg) m_bDrawGrid = FALSE; m_bMusic = FALSE; //}}AFX_DATA_INIT } void COptionDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{​{AFX_DATA_MAP(COptionDlg) DDX_Check(pDX, IDC_CHECK_GRID, m_bDrawGrid); DDX_Check(pDX, IDC_CHECK_MUSIC, m_bMusic); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COptionDlg, CDialog) //{​{AFX_MSG_MAP(COptionDlg) ON_BN_CLICKED(IDC_CHECK_GRID, OnCheckGrid) ON_WM_CREATE() ON_COMMAND(ID_GAME_OPTION, OnGameOption) //}}AFX_MSG_MAP END_MESSAGE_MAP() / // COptionDlg message handlers void COptionDlg::OnCheckGrid() { // TODO: Add your control notification handler code here } void COptionDlg::OnOK() { // TODO: Add extra validation here CDialog::OnOK(); } BOOL COptionDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } int COptionDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here return 0; } void COptionDlg::OnGameOption() { // TODO: Add your command handler code here }

//至此,大部分源码,已经贴出,欢迎各位 就俄罗斯方块算法交流指正。

//曾经 单单玩这个游戏,便 玩了好几个月。;-)。

vc项目开发:俄罗斯方块制作日志相关推荐

  1. vc项目开发:俄罗斯方块制作日志 [上]

    vc项目日志,俄罗斯方块开发 ----July mfc初学一个月时,所写的俄罗斯方块.共享下源码. July.2010/10/21 ---------------------------------- ...

  2. iOS项目开发实战——制作视图的缩放动画

    视图的大小应该是随时可控的.今天我们就来实现对一个View的缩放动画.该动画的实现与位移动画,透明度动画稍有不同. 详细实现例如以下: import UIKitclass ScaleViewContr ...

  3. 深入c语言pdf,深入体验C语言项目开发1.pdf

    深入体验C 语言项目开发 薛小龙 清华大学出版社 2011 07 本丛书的主要编写人员有陈强.李佐彬.李淑芳.蒋凯. 王梦.王书鹏.张子言.张建敏.陈德春.李藏.关立勋. 秦雪薇.薛多鸯.李强.刘海洋 ...

  4. WPF 项目开发入门(二) WPF 页面布局

    WPF 项目开发入门(一) 安装运行 WPF 项目开发入门(二) WPF 页面布局 WPF 项目开发入门(三)WPF 窗体与页面 WPF 项目开发入门(四) MVVM 模式 与 TreeView树组件 ...

  5. iOS项目开发实战——设置视图的透明度改变动画

    在iOS中 ,透明度的改变可以让View视图以一种渐变的效果动态的出现或者消退,非常有意思.这里我们将会对一个View控件的色块执行透明度改变的动画.关于其他的动画效果可以参考我的其他几篇博客< ...

  6. 100个vc小项目开发:二、一步一点设计音乐播放器 [I]

    100个vc小项目开发:二.一步一点设计音乐播放器 [源码解读] 文章作者: July 软件来源:开源 ================== 1.有不正之处,恳请指正. 2.本文贴出的是关键实现代码部 ...

  7. uni-app项目开发-----初级入门教程(从0到1制作打包自己的app)

    uni-app项目开发-----初级入门教程(从0到1制作打包自己的app) uni-app实现了一套代码,同时运行到多个平台.支持iOS模拟器.Android模拟器.H5.微信开发者工具.支付宝小程 ...

  8. javaweb项目开发日志的原理,方式

    2019独角兽企业重金招聘Python工程师标准>>> 日志框架可以做什么? 日志框架可以帮助各类项目人员,,记录各种项目运行时信息; 以便其,通过日志信息,了解和监控项目的状态,解 ...

  9. vc/vs开发的应用程序添加dump崩溃日志转

    原贴地址:https://blog.csdn.net/wangkui1331/article/details/78029940 vc/vs开发的应用程序出现崩溃的时候,由于没有任何记录,导致开发人员很 ...

最新文章

  1. Conda安装Glossary词汇表
  2. HDU 1711 -Number Sequence(KMP)
  3. Nginx的rewrite案例之目录合并
  4. 低成本DIY视频预览遥控小车
  5. 最小,独立,可分发的跨平台Web服务器
  6. DeFi协议TrueFi:TRU/ETH流动性挖矿将从Uniswap迁移至SushiSwap
  7. easyui 控制某列显示不显示_实验八 LED数码管显示控制实验
  8. 按颜色分类:蓝紫色系(Purple Blue)
  9. 【AAAA级LED护眼学习台灯照明方案】PWM内部转模拟,调光深度1%,无频闪顾虑,低亮无抖动LED恒流驱动芯片FP7102/FP7103/FP7208/FP7209
  10. QT创建一个excel文件(通过save as 方法)
  11. 网络营销实战密码——策略、技巧、案例(修订版)
  12. 测试点击屏幕次数的软件_红蜘蛛5校色仪怎么用?显示器校色及测试色域和色彩精准度详细教程...
  13. android 平板重装系统,平板电脑系统重装方法
  14. 创文明城市在路上,信息报送有高招
  15. php 正则匹配座机号、手机号
  16. 2020中兴软件测试面经
  17. IESM项目实训四——Web Audio录音和字符串转拼音
  18. java 继承extends
  19. poi获取段落位置_apache poi word提取段落
  20. C#快递单号查询接口物流路由信息快递鸟api代码接入.Net

热门文章

  1. 基于git(分布式版本控制系统)的各种服务器权限工具对比 Gitlab服务器搭建 以及邮箱、LDAP配置 实现公司多人协同开发
  2. c语言判断两个字母相等,C语言:比较两个字符串是否相等
  3. 两电脑使用网线连接传文件方法
  4. 个人计算机全都是多媒体计算机系统组成,多媒体计算机系统组成
  5. Rest_Assured接口测试学习汇总
  6. 文章转载---西工大博士生文言文答辩致谢
  7. C语言分数相加并将最后结果化为最简分式(新手程序!!!)
  8. stata怎么画分类图_Stata中的图形制作(绝对自己总结)
  9. 每日算法 - 列出24点游戏的所有解法
  10. json批量转换成label图像