我常用的游戏模版1
2026-07-08 11:07:10
发布于:四川
#include<windows.h>
#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
//setSize:屏幕大小设置
void setSize(int col, int line){
char cmd[128];
sprintf(cmd, "mode con cols=%d lines=%d", col, line);
system(cmd);
}
//color:颜色设置
void color(const int &a){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
//notice:显示闪烁-金
void notice(string s){
for(int i=1;i<=10;i++){
color(14);cout<<s<<endl;Sleep(100);
system("cls");
color(6);cout<<s<<endl;Sleep(100);
system("cls");
}
color(15);
}
//hide & show:光标状态 (隐藏/显示)
void hide(){
CONSOLE_CURSOR_INFO cur={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cur);
}
void show(){
CONSOLE_CURSOR_INFO cur={1,1};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cur);
}
int main() {
srand((unsigned)time(NULL));
hide();setSize(35,15);
notice(">>Tips:请将输入法调至英文<<");
return 0;
}
这里空空如也














有帮助,赞一个