当前位置:网站首页>Win32 Tetris (essential for learning MFC)
Win32 Tetris (essential for learning MFC)
2022-06-29 13:32:00 【Johnny popcorn】
All relevant resources have been put here
link :https://pan.baidu.com/s/1X0VtagZ5ZEoAm63n7f8l-A?pwd=pbbm
Extraction code :pbbm
Introduction to game functions :
Accelerate the descent , Or so mobile , Press the up key to change the shape of the square , Space pause , The score shows .
Copy header files directly , The source file cannot run the game , Because there are also resource files , It's all on the net .
Content of header file
#include <Windows.h>
#include <time.h>
#include "resource.h"
#define WINDOW_WIDTH 520
#define WINDOW_HEIGHT 640
#define ID_DOWNTIME 1
// Background grid
int g_arrBackground[20][10] = {
0 };
// Tetris preview
int g_arrPreviewTetris[2][4] = {
0 };
// tetris
int g_arrTetris[2][4] = {
0 };
// Preview square shape
int g_nPreviewBlockType = 0;
// Current Tetris shape
int g_nTetrisBlockType = 0;
// Preview coordinates x: The transverse ;y: The longitudinal
POINT g_PreviewBlockPos = {
-1, -1 };
// Current square coordinates
POINT g_TetrisBlockPos = {
-1, -1 };
BOOL g_bGameing;
int g_nScore=0;
void CreateTetrisBlock();
void Draw(HDC hDC, HBITMAP hBitMap);
void OnCreate();
void OnPaint(HDC hDC);
void OnReturn(HWND hWnd);
void OnTimer(HWND hWnd);
// Copy Tetris to grid
void CopyTetrisBlock();
void BlockDown();
BOOL IsBottom();
void AdjustStatue();
BOOL OtherBlock();
BOOL IsGameOver(HWND hWnd);
void OnLeft();
void OnRight();
void OnDown(HWND hWnd);
void OnSpace(HWND hWnd);
void OnUp();
void StripChange();
void OnShape();
void CleanLine();
Source file content
#include <Windows.h>
#include <time.h>
#include "resource.h"
#define WINDOW_WIDTH 520
#define WINDOW_HEIGHT 640
#define ID_DOWNTIME 1
// Background grid
int g_arrBackground[20][10] = { 0 };
// Tetris preview
int g_arrPreviewTetris[2][4] = { 0 };
// tetris
int g_arrTetris[2][4] = { 0 };
// Preview square shape
int g_nPreviewBlockType = 0;
// Current Tetris shape
int g_nTetrisBlockType = 0;
// Preview coordinates x: The transverse ;y: The longitudinal
POINT g_PreviewBlockPos = { -1, -1 };
// Current square coordinates
POINT g_TetrisBlockPos = { -1, -1 };
BOOL g_bGameing;
int g_nScore=0;
void CreateTetrisBlock();
void Draw(HDC hDC, HBITMAP hBitMap);
void OnCreate();
void OnPaint(HDC hDC);
void OnReturn(HWND hWnd);
void OnTimer(HWND hWnd);
// Copy Tetris to grid
void CopyTetrisBlock();
void BlockDown();
BOOL IsBottom();
void AdjustStatue();
BOOL OtherBlock();
BOOL IsGameOver(HWND hWnd);
void OnLeft();
void OnRight();
void OnDown(HWND hWnd);
void OnSpace(HWND hWnd);
void OnUp();
void StripChange();
void OnShape();
void CleanLine();
边栏推荐
- C language character function
- Clickhouse database uses JDBC to store milliseconds and nanoseconds
- mybaits入门(含实例教程和源码)
- AcWing第57场周赛
- 极光 · 哈夫曼树の生成(线段树结构 非指针)(仿邻接表)
- RT-Thread内存管理
- leetcode 522. 最长特殊序列 II
- AOSP ~ logcat persistence
- clickhouse数据库使用jdbc存储毫秒和纳秒
- Equidistant segmentation of surface rivers in ArcGIS [gradient coloring, pollutant diffusion]
猜你喜欢

强大、优秀的文件管理软件评测:图片管理、书籍管理、文献管理

存算一体为何是造芯新方向?|对撞派 x 知存科技

LeCun用62页论文公布未来十年研究计划:AI自主智能

Pod security policy (PSP)

Autonomous and controllable city! Release of the first domestic artiq architecture quantum computing measurement and control system

The imshow function of Matplotlib displays grayscale images. Vmin and vmax2 parameters should be set

力扣:合并两个有序链表

AcWing 234 放弃测试

UI file introduction in QT

Cvpr2022 | panopticdepth: a unified framework for depth aware panoramic segmentation
随机推荐
Check yaml file security configuration: kubesec
Cnpm reports an error 'cnpm' is not an internal or external command, nor is it a runnable program or batch file
YOLO系列梳理(九)初尝新鲜出炉的YOLOv6
matplotlib的imshow函数显示灰度图像要设置vmin和vmax2个参数
运动App如何实现端侧后台保活,让运动记录更完整?
强大、优秀的文件管理软件评测:图片管理、书籍管理、文献管理
六月集训(第29天) —— 分而治之
B+ tree | MySQL index usage principle
Horizon development board configuration network segment
AOSP ~ logcat persistence
CVPR2022 | A ConvNet for the 2020s & 如何设计神经网络总结
How can the sports app keep the end-to-side background alive to make the sports record more complete?
PyGame flips the image
GEE——美国LANDFIRE火灾数据集
MySQL tuning
Mirror vulnerability scanner: trivy
如何统计项目代码(比如微信小程序等等)
pdb符号库文件详解
Redis deletion policy and eviction algorithm
Cvpr2022 𞓜 future transformer with long-term action expectation