-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameSetting.cpp
More file actions
31 lines (27 loc) · 884 Bytes
/
GameSetting.cpp
File metadata and controls
31 lines (27 loc) · 884 Bytes
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
#pragma once
#include <Windows.h>
#include<ctime>
#include "GameSetting.h"
#include <cstdio>
using namespace std;
void GameSetting::init()
{
CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); //隐藏输入符号
char buffer[32];
sprintf_s(buffer, "mode con cols=%d lines=%d", window_width + 2, window_height + 1);
system(buffer);
::SetConsoleOutputCP(936);
srand((unsigned int)time(0));
// 修改字体获得更好体验
CONSOLE_FONT_INFOEX font;
font.cbSize = sizeof(CONSOLE_FONT_INFOEX);
font.nFont = 0;
font.dwFontSize.X = 12;
font.dwFontSize.Y = 16;
font.FontWeight = 200;
wchar_t str[] = L"Terminal";
wcscpy_s(font.FaceName, str);
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetCurrentConsoleFontEx(handle, FALSE, &font);
}