求一起编头文件game,专注于编辑有关游戏的模块,感兴趣的私信,谢谢!
以下代码为目前30分钟出来的成果
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<string>
#define square ■
#define triangle ▲
#define hollow_square □
#define hollow_triangle △
#define circle ●
#define hollow_circle ○
using namespace std;
string to_string(int val){
string ret("");
for(int i=0;val!=0;i++){
int x=val%10;
val/=10;
ret+=x+'0';
}
reverse(ret.begin(),ret.end());
return ret;
}
class game{
public:
void close(void){
exit(0);
}
void bad_close(void){
exit(2147483647);
}
void set_window_size(const int cols,const int lines){
string s="mode con cols="+to_string(cols)+" lines="+to_string(lines);
system(s.data());
}
void slow_display(const char* text,const int space){
int l=strlen(text);
printf("%c",text[0]);
for(int i=1;i<l;i++){
Sleep(space);
printf("%c",text[i]);
}
}
void set_title(string title){
string s="title "+title;
system(s.data());
}
};