이제 키입력과 시간조정은 다 처리되었고, 시뮬레이션 코테 문제 풀듯이 하면 된다.

// 테트리스 Grid
vector<vector<int>> Grid;

Grid.clear();
Grid.resize(10, vector<int>(20));

현재까지 코드

void GameLogic() {
	// 화면 클리어
	system("cls");

	ShowGrid();
}

int main() {
	// 시간제어테스트

	// while 루프 안에 while루프를 또 만들어야 게임이 돌아갈듯

	int timer = 0;
	Grid.clear();
	Grid.resize(10, vector<int>(20, 0));

	// 출력을 빠르게
	std::ios::sync_with_stdio(false);

	// 시간을 체크하는 루프
	while (true) {
		timer++;

		if (GetKeyInput() == 75) {
			cout << "left key is pressed\\n";
		}

		if (GetKeyInput() == 77) {
			cout << "right key is pressed\\n";
		}

		if (timer >= 6000) {
			// 이 안에 게임로직을 돌려야한다.
			GameLogic();

			timer = 0;
		}
	}
}

image.png

	Grid.resize(20, vector<int>(10, 0));