重新细分项目结构
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "stdafx.h"
|
||||
#include <mmsystem.h>
|
||||
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
|
||||
constexpr int GRID = 30;
|
||||
constexpr int nGameWidth = 10;
|
||||
constexpr int nGameHeight = 20;
|
||||
constexpr int nWidth = 16;
|
||||
constexpr int nHeight = 22;
|
||||
|
||||
// 定义一个点,用来表示方块的位置
|
||||
struct Point
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
extern int nType; // 下一方块类型
|
||||
extern int type; // 当前方块类型
|
||||
extern int state; // 当前方块状态
|
||||
extern int tScore; // 当前得分
|
||||
extern bool gameOverFlag; // 游戏已经结束
|
||||
extern bool suspendFlag; // 暂停游戏
|
||||
extern bool targetFlag; // 启用瞄准器
|
||||
extern int workRegion[20][10]; // 工作区数据,0 表示该位置没有被占用
|
||||
extern Point point; // 当前方块的当前位置
|
||||
extern Point target; // 当前方块目标位置,用于瞄准器
|
||||
extern int bricks[7][4][4][4];
|
||||
extern COLORREF BrickColor[7];
|
||||
|
||||
// 游戏逻辑相关函数
|
||||
bool CanMoveDown();
|
||||
bool CanMoveLeft();
|
||||
bool CanMoveRight();
|
||||
void MoveDown();
|
||||
void MoveLeft();
|
||||
void MoveRight();
|
||||
void Rotate();
|
||||
void DropDown();
|
||||
void Fixing();
|
||||
void DeleteOneLine(int number);
|
||||
void DeleteLines();
|
||||
bool GameOver();
|
||||
void ComputeTarget();
|
||||
void Restart();
|
||||
|
||||
// 绘图函数
|
||||
void TDrawScreen(HDC hdc, HWND hWnd);
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ 生成的包含文件。
|
||||
// 供 Tetris.rc 使用
|
||||
//
|
||||
|
||||
#define IDS_APP_TITLE 103
|
||||
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDD_TETRIS_DIALOG 102
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_TETRIS 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_TETRIS 109
|
||||
#define IDC_MYICON 2
|
||||
|
||||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC -1
|
||||
#endif
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 130
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息
|
||||
// Windows 头文件:
|
||||
#include <windows.h>
|
||||
|
||||
// C 运行时头文件
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||
|
||||
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user