当前位置:网站首页>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();
边栏推荐
- Netdata mail alarm configuration
- Three best practices help enterprises improve supply chain security
- Learn from the official motor and BLDC control strategies, and make money as soon as you learn
- 开户可以在网上开么?能安全吗
- 服务器监控netdata面板配置邮件服务
- Memorized Function
- @Table爆红
- C language character function
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- leetcode 第 299场周赛
猜你喜欢

华为机器学习服务语音识别功能,让应用绘“声”绘色

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

Cvpr2022 𞓜 future transformer with long-term action expectation

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

Hystrix circuit breaker

【无标题】安装依赖报错:Refusing to install package with name “***“ under a package

matplotlib的imshow函数显示灰度图像要设置vmin和vmax2个参数

STK_ Gltf model

想做个答题类的微信小游戏?读这篇文章就够了

CVPR2022 | 弱监督多标签分类中的损失问题
随机推荐
C语言字符函数
成功解决ValueError: Only TF native optimizers are supported in Eager mode
Cvpr2022 | a convnet for the 2020s & how to design neural network Summary
3个最佳实践助力企业改善供应链安全
@Table爆红
@Table burst red
成功解决NotImplementedError: numpy() is only available when eager execution is enabled.
Principle and Simulation of bind
存算一体为何是造芯新方向?|对撞派 x 知存科技
Matlab to find the limit
Tutorial on building pytoch model from zero (V) writing training process -- some basic configurations
Tree array application (acwing 24224244)
iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务
Windbg调试工具介绍
CVPR2022 | 长期行动预期的Future Transformer
The role of each part of Neural Network & thoroughly understand neural network
leetcode 903. DI 序列的有效排列
clickhouse数据库使用jdbc存储毫秒和纳秒
Package folders as ISO
Learn from the official motor and BLDC control strategies, and make money as soon as you learn