This project is based on VS2019 and uses the C++ language.

This commit is contained in:
ren yi 2025-07-29 12:58:30 +08:00
parent a53814e9a2
commit d180029cc6
64 changed files with 1679 additions and 0 deletions

3
.vs/ProjectSettings.json Normal file
View File

@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "无配置"
}

BIN
.vs/Tetris/v16/.suo Normal file

Binary file not shown.

BIN
.vs/Tetris/v16/Browse.VC.db Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\Tetris"
],
"SelectedNode": "\\Tetris\\Tetris.cpp",
"PreviewInSolutionExplorer": true
}

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

BIN
Debug/Tetris.exe Normal file

Binary file not shown.

BIN
Debug/Tetris.pdb Normal file

Binary file not shown.

31
Tetris.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33529.622
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tetris", "Tetris\Tetris.vcxproj", "{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Debug|x64.ActiveCfg = Debug|x64
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Debug|x64.Build.0 = Debug|x64
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Debug|x86.ActiveCfg = Debug|Win32
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Debug|x86.Build.0 = Debug|Win32
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Release|x64.ActiveCfg = Release|x64
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Release|x64.Build.0 = Release|x64
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Release|x86.ActiveCfg = Release|Win32
{5DB4AE0D-A4BC-4F6E-BD1B-9683F8E1D90D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {76016C78-86E3-4ACB-84DD-47942CABA714}
EndGlobalSection
EndGlobal

18
Tetris/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "C:/env/MingW/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
Tetris/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "d:/Wrok/Homework/Tetris_bz/Tetris",
"program": "d:/Wrok/Homework/Tetris_bz/Tetris/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

59
Tetris/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Debug\Tetris.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

BIN
Tetris/Debug/Tetris.ilk Normal file

Binary file not shown.

18
Tetris/Debug/Tetris.log Normal file
View File

@ -0,0 +1,18 @@
 Tetris.cpp
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(231,24): warning C4244: “参数”: 从“float”转换到“UINT”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(438,26): warning C4244: “参数”: 从“float”转换到“UINT”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(443,26): warning C4244: “参数”: 从“float”转换到“UINT”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(448,26): warning C4244: “参数”: 从“float”转换到“UINT”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(218,6): warning C4101: “hdc”: 未引用的局部变量
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(217,14): warning C4101: “ps”: 未引用的局部变量
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(746,35): warning C4244: “参数”: 从“float”转换到“UINT”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(933,72): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(933,33): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(938,107): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(938,40): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(958,131): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(958,102): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(958,73): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Tetris\Tetris.cpp(958,44): warning C4244: “参数”: 从“double”转换到“int”可能丢失数据
LINK : 没有找到 C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Debug\Tetris.exe 或上一个增量链接没有生成它;正在执行完全链接
Tetris.vcxproj -> C:\Users\Lenovo\Desktop\Tetris_bz V1.5\Debug\Tetris.exe

BIN
Tetris/Debug/Tetris.obj Normal file

Binary file not shown.

BIN
Tetris/Debug/Tetris.res Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.22000.0:
Debug|Win32|C:\Users\Lenovo\Desktop\Tetris_bz V1.5\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Tetris/Debug/tetris.obj.enc Normal file

Binary file not shown.

BIN
Tetris/Debug/vc142.idb Normal file

Binary file not shown.

BIN
Tetris/Debug/vc142.pdb Normal file

Binary file not shown.

30
Tetris/Resource.h Normal file
View File

@ -0,0 +1,30 @@
//{{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

BIN
Tetris/Tetris.aps Normal file

Binary file not shown.

1000
Tetris/Tetris.cpp Normal file

File diff suppressed because it is too large Load Diff

226
Tetris/Tetris.h Normal file
View File

@ -0,0 +1,226 @@
#pragma once
#include "resource.h"
//add by zj
//
//
#include <time.h>
#include <mmsystem.h>
#pragma comment (lib, "winmm.lib")
// 定义一个点,用来表示方块的位置
struct Point {
int x;
int y;
};
int nType = 0; // 下一方块类型
int type = 0; // 当前方块类型
int state = 0; // 当前方块状态
int tScore = 0; // 当前得分
bool gameOverFlag = false; // 游戏已经结束
bool suspendFlag = false; // 暂停游戏
bool targetFlag = false; // 启用瞄准器
bool targetFlagIsOnWhileAnimating = false;
int workRegion[20][10] = { 0 }; // 工作区数据data[i][j]==0表示该位置没有被占用
HWND hWnd = nullptr;
bool isFlashing = false;
int flashCount = 0;
const int FLASH_COUNT = 5; // 闪烁次数
const int FLASH_INTERVAL = 200; // 闪烁间隔(毫秒)
Point point; // 当前方块的当前位置
Point target; // 当前方块目标位置,用于瞄准器
float speed = 1; //速度
// 定义7种方块类型
int bricks[7][4][4][4] = {
// I型方块
{
{{0, 0, 0, 0},
{1, 1, 1, 1},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 0, 1, 0},
{0, 0, 1, 0},
{0, 0, 1, 0},
{0, 0, 1, 0}},
{{0, 0, 0, 0},
{1, 1, 1, 1},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0}}
},
// J型方块
{
{{1, 0, 0, 0},
{1, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 1, 0},
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}},
{{0, 0, 0, 0},
{1, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0}}
},
// L型方块
{
{{0, 0, 1, 0},
{1, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0}},
{{0, 0, 0, 0},
{1, 1, 1, 0},
{1, 0, 0, 0},
{0, 0, 0, 0}},
{{1, 1, 0, 0},
{0, 1, 0, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}}
},
// O型方块
{
{{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{1, 1, 0, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}}
},
// S型方块
{
{{0, 1, 1, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0}},
{{0, 1, 1, 0},
{1, 1, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 1, 0},
{0, 0, 0, 0}}
},
// T型方块
{
{{0, 1, 0, 0},
{1, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{0, 1, 1, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}},
{{0, 0, 0, 0},
{1, 1, 1, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}},
{{0, 1, 0, 0},
{1, 1, 0, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}}
},
// Z型方块
{
{{1, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 0, 1, 0},
{0, 1, 1, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}},
{{1, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0}},
{{0, 0, 1, 0},
{0, 1, 1, 0},
{0, 1, 0, 0},
{0, 0, 0, 0}}
}
};
// 定义7种方块的颜色
COLORREF BrickColor[7] = {
RGB(255, 0, 0), // 红色
RGB(0, 255, 0), // 绿色
RGB(0, 0, 255), // 蓝色
RGB(255, 180, 0), // 黄色
RGB(255, 0, 255), // 紫色
RGB(0, 255, 255), // 青色
RGB(255, 165, 0) // 橙色
};
// 判断当前方块是否可以向上移动
bool CanMoveUp();
// 判断当前方块是否可以向下移动
bool CanMoveDown();
// 当前方块向上移动
void MoveUp();
// 当前方块向下移动
void MoveDown();
// 旋转当前方块
void Rotate();
// 将当前方块直接下落到最下面的位置
void DropDown();
// 将当前方块固定在当前位置&消行操作
void Fixing_DeleteLines();
// 判断游戏结束
bool GameOver();
// 计算瞄准器位置
void ComputeTarget();
// 重新开始
void Restart();
// 绘制屏幕
void TDrawScreen(HDC hdc, HWND hWnd);
bool CanRotate(int, int, int, int);
bool CanMoveRight();
bool CanMoveLeft();
void MoveLeft();
void MoveRight();

BIN
Tetris/Tetris.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

BIN
Tetris/Tetris.rc Normal file

Binary file not shown.

164
Tetris/Tetris.vcxproj Normal file
View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{5db4ae0d-a4bc-4f6e-bd1b-9683f8e1d90d}</ProjectGuid>
<RootNamespace>Tetris</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Tetris.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Tetris.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Tetris.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="background.bmp" />
<Image Include="small.ico" />
<Image Include="Tetris.ico" />
</ItemGroup>
<ItemGroup>
<Media Include="background.wav" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Tetris.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Tetris.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Tetris.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="small.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="Tetris.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="background.bmp">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Media Include="background.wav">
<Filter>资源文件</Filter>
</Media>
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

BIN
Tetris/background.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

BIN
Tetris/background.wav Normal file

Binary file not shown.

16
Tetris/framework.h Normal file
View File

@ -0,0 +1,16 @@
// header.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>

BIN
Tetris/small.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

BIN
Tetris/sucess.wav Normal file

Binary file not shown.

6
Tetris/targetver.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
// // 包含 SDKDDKVer.h 可定义可用的最高版本的 Windows 平台。
// 如果希望为之前的 Windows 平台构建应用程序,在包含 SDKDDKVer.h 之前请先包含 WinSDKVer.h 并
// 将 _WIN32_WINNT 宏设置为想要支持的平台。
#include <SDKDDKVer.h>