-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefine.h
More file actions
38 lines (33 loc) · 1.1 KB
/
define.h
File metadata and controls
38 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
// 引入所需的头文件
#include <iostream>
#include <chrono>
#include <thread>
#include <atomic>
#include <unordered_map>
#include <map>
#include <mutex>
#include <functional>
#include <windows.h>
#include <vector>
#include <array>
#include <string>
#include <utility>
#include <conio.h>
#include <random>
#include <cassert>
#include <limits>
#include "utils.h"
#include "terminal.h"
// #include "tetromino.h"
// 定义键盘按键状态宏
#define KEY_UP(vKey) ((GetAsyncKeyState(vKey) & 0x8000) ? 0 : 1)
#define KEY_DOWN(vKey) ((GetAsyncKeyState(vKey) & 0x8000) ? 1 : 0)
// 使用C++14的字面量运算符,可以直接使用时间单位,如1s、1ms等
using namespace std::chrono_literals;
// 定义矩阵类型,用于表示游戏区域
using Matrix = std::vector<std::vector<int>>;
using Matrix_ref = std::vector<std::vector<int>> &;
// // 定义俄罗斯方块类型,每个方块由4x4的数组表示,数组中的每个元素是一个坐标对
// using Tetromino = std::array<std::array<std::pair<int, int>, 4>, 4>;
// using Tetromino_ref = std::array<std::array<std::pair<int, int>, 4>, 4> &;