游戏c++ rogue
2025-08-04 13:36:43
发布于:上海
有点做不下去,代码写得太烂了。我可能还会更新,大家有什么想法就说出来。
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<cstdlib>
#include <list>
#include <thread>
#include <Windows.h>
#include<conio.h>
#include<map>
#include<cmath>
// ▓▓▓▓↓↓↓☆☆☆
using namespace std;
char mapp[10001][10001], grid_player='.';
int map_depth[10001][10001] = {0};
int currentFloor = 1; // 当前楼层
int nScreenWidth=70,nScreenHeight=20,start_x,start_y, show_tips=0;
int player_x, player_y;
char button_pressed;
WORD colors[128] = {};
HANDLE hConsole;
CHAR_INFO* charBuffer;
COORD bufferSize;
COORD bufferCoord;
SMALL_RECT writeArea;
bool needShowPrompt = true;
//const string promptStr = "你要做什么? (按‘]’查看帮助)";
string promptStr = "你要做什么?按']'查看帮助";
string status_description = "状态: 普通 ////// 生命值:10 // 护甲:10 // 楼层:" + to_string(currentFloor);
string helpText[] = {
"===== 帮助 =====",
"移动: W(上) A(左) S(下) D(右)",
"攻击: 方向键(未实现)",
"符号说明:",
" m = 你自己",
" = = 墙壁",
" d = 门",
" s = 向上的楼梯",
" S = 已经走过的楼梯"
};
int helpLines = sizeof(helpText)/sizeof(helpText[0]); // 帮助文本行数
struct room{
int width;
int height;
}map_data[10001][10001];
void printTextWithEffect(const string& text, int delayMs = 50) {
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD charsWritten;
for (size_t i = 0; i < text.length(); i++) {
// 检查是否有按键(非阻塞方式)
if (GetAsyncKeyState(VK_RETURN) & 0x8000) {
// 打印剩余文字
WriteConsole(hConsole, &text[i], text.length() - i, &charsWritten, NULL);
while ((GetAsyncKeyState(VK_RETURN) & 0x8000))
{
Sleep(10);
}
break;
}
// 打印当前字符
WriteConsole(hConsole, &text[i], 1, &charsWritten, NULL);
Sleep(delayMs);
}
}
void initConsoleBuffer() {
colors['=']=0xF7;
colors['m']=0x09;
colors['d']=0x6B;
colors['s']=0xBC;
colors['S']=0xCB;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
bufferSize = { (short)nScreenWidth, (short)nScreenHeight };
bufferCoord = { 0, 0 };
writeArea = { 0, 0, (short)(nScreenWidth - 1), (short)(nScreenHeight - 1) };
charBuffer = new CHAR_INFO[nScreenWidth * nScreenHeight];
// 隐藏光标
CONSOLE_CURSOR_INFO cursorInfo = { 1, FALSE };
SetConsoleCursorInfo(hConsole, &cursorInfo);
}
bool check(int x,int y){
if(y >=0 && x >= 0 && mapp[y][x] != '='){
return true;
}
else{
return false;
}
}
int random_number(int minx, int maxx){
int Rand = minx + (rand() % (maxx - minx +1));
return Rand;
}
int make_room(int room_start_x, int room_start_y, int room_width_number, int room_height_number){
int i,j;
//cout << room_start_x << " " << room_start_y << endl;
for(j=room_start_x;j<=room_start_x + room_width_number;j++){
mapp[room_start_y][j] = '=';
mapp[room_start_y+room_height_number][j] = '=';
}
for(j=room_start_y;j<=room_start_y + room_height_number;j++){
mapp[j][room_start_x] = '=';
mapp[j][room_start_x+room_width_number] = '=';
}
if(room_start_y != 100) mapp[room_start_y + room_height_number][room_start_x + room_width_number / 2] = 'd';
if(room_start_y != 20) mapp[room_start_y][room_start_x + room_width_number / 2] = 'd';
if(room_start_x != 120) mapp[room_start_y + room_height_number / 2][room_start_x + room_width_number] = 'd';
if(room_start_x != 20) mapp[room_start_y + room_height_number / 2][room_start_x] = 'd';
}
void make_path(int room_x, int room_y, int room_width_number, int room_height_number){
int i,j;
int dir[4][2] = {0,1,1,0,0,-1,-1,0};
//cout << "make path:" << " ";
for(i=0;i<4;i++){
//cout << room_x + dir[i][0] << " " << room_y + dir[i][1] << endl;
if(room_x + dir[i][0] >= 0 && room_y + dir[i][1] >= 0 && map_depth[room_y - dir[i][1]][room_x + dir[i][0]] == 1){
int other_room_start_y = (room_y - dir[i][1]) * 20;//y越小越高
int other_room_height_number = map_data[room_y - dir[i][1]][room_x + dir[i][0]].height;
int other_room_start_x = (room_x + dir[i][0]) * 20;
int other_room_width_number = map_data[room_y - dir[i][1]][room_x + dir[i][0]].width;
int target_x, target_y, door_x, door_y;
int x_dir,y_dir;
if(i == 0){
door_x = room_x * 20 + room_width_number / 2;
door_y = room_y * 20;
target_x = other_room_start_x + other_room_width_number / 2;
target_y = other_room_start_y + other_room_height_number;
int half_way_to_target_y = ((door_y + target_y) / 2);
door_x += 1;
target_x += 1;
if(target_x > door_x){
x_dir = 1;
half_way_to_target_y += 1;
}
else{
x_dir = -1;
half_way_to_target_y -= 1;
}
y_dir = -1;
//cout << "door_y:" << door_y << " " << "target_y:" << target_y << " " <<(door_y+target_y) / 2 << endl;
for(int j=door_y;j>=half_way_to_target_y;j--){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << "/" << door_x << " " << (door_y + target_y) / 2 << endl;
}
if(x_dir == -1){
for(int j=door_x;j>= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
else{
for(int j=door_x;j<= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
for(int j=door_y;j>= target_y;j--){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << "/" << door_x << " " << (door_y + target_y) / 2 <<endl;
}
door_x = room_x * 20 + room_width_number / 2;
door_y = room_y * 20;
target_x = other_room_start_x + other_room_width_number / 2;
target_y = other_room_start_y + other_room_height_number;
half_way_to_target_y = ((door_y + target_y) / 2);
door_x -= 1;
target_x -= 1;
if(target_x > door_x){
x_dir = 1;
half_way_to_target_y -= 1;
}
else{
x_dir = -1;
half_way_to_target_y += 1;
}
y_dir = -1;
//cout << "door_y:" << door_y << " " << "target_y:" << target_y << " " <<(door_y+target_y) / 2 << endl;
for(int j=door_y;j>=half_way_to_target_y;j--){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << "/" << door_x << " " << (door_y + target_y) / 2 << endl;
}
if(x_dir == -1){
for(int j=door_x;j>= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
else{
for(int j=door_x;j<= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
for(int j=door_y;j>= target_y;j--){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << "/" << door_x << " " << (door_y + target_y) / 2 <<endl;
}
}
else if(i == 1){
door_x = room_x * 20 + room_width_number;
door_y = room_y * 20 + room_height_number / 2;
target_x = other_room_start_x;
target_y = other_room_start_y + other_room_height_number / 2;
x_dir = -1;
y_dir = 0;
door_y -= 1;
target_y -= 1;
int half_way_to_target_x = (door_x+target_x) / 2;
if(target_y > door_y){
y_dir = 1;
half_way_to_target_x += 1;
}
else{
y_dir = -1;
half_way_to_target_x -= 1;
}
for(int j=door_x;j<=half_way_to_target_x;j++){
door_x = j;
mapp[door_y][j] = '=';
}
if(y_dir == -1){
for(int j=door_y;j>= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
else{
for(int j=door_y;j<= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
for(int j=door_x;j<= target_x;j++){
door_x = j;
mapp[door_y][j] = '=';
}
door_x = room_x * 20 + room_width_number;
door_y = room_y * 20 + room_height_number / 2;
target_x = other_room_start_x;
target_y = other_room_start_y + other_room_height_number / 2;
x_dir = -1;
y_dir = 0;
door_y += 1;
target_y += 1;
half_way_to_target_x = (door_x+target_x) / 2;
if(target_y > door_y){
y_dir = 1;
half_way_to_target_x -= 1;
}
else{
y_dir = -1;
half_way_to_target_x += 1;
}
for(int j=door_x;j<=half_way_to_target_x;j++){
door_x = j;
mapp[door_y][j] = '=';
}
if(y_dir == -1){
for(int j=door_y;j>= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
else{
for(int j=door_y;j<= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
for(int j=door_x;j<= target_x;j++){
door_x = j;
mapp[door_y][j] = '=';
}
}
else if(i == 2){
door_x = room_x * 20 + room_width_number / 2;
door_y = room_y * 20 + room_height_number;
target_x = other_room_start_x + other_room_width_number / 2;
target_y = other_room_start_y;
x_dir = 0;
if(target_x > door_x) x_dir = 1;
else x_dir = -1;
y_dir = -1;
door_x -= 1;
target_x -= 1;
//cout << "door_y:" << door_y << " " << "target_y:" << target_y << " " <<(door_y+target_y) / 2 << endl;
int half_way_to_target_y = (door_y+target_y) / 2;
if(target_x > door_x){
x_dir = 1;
half_way_to_target_y += 1;
}
else{
x_dir = -1;
half_way_to_target_y -= 1;
}
for(int j=door_y;j<=half_way_to_target_y;j++){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << " " << door_x << endl;
}
if(x_dir == -1){
for(int j=door_x;j>= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
else{
for(int j=door_x;j<= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
for(int j=door_y;j<= target_y;j++){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << " " << door_x << endl;
}
door_x = room_x * 20 + room_width_number / 2;
door_y = room_y * 20 + room_height_number;
target_x = other_room_start_x + other_room_width_number / 2;
target_y = other_room_start_y;
x_dir = 0;
if(target_x > door_x) x_dir = 1;
else x_dir = -1;
y_dir = -1;
door_x += 1;
target_x += 1;
//cout << "door_y:" << door_y << " " << "target_y:" << target_y << " " <<(door_y+target_y) / 2 << endl;
half_way_to_target_y = (door_y+target_y) / 2;
if(target_x > door_x){
x_dir = 1;
half_way_to_target_y -= 1;
}
else{
x_dir = -1;
half_way_to_target_y += 1;
}
for(int j=door_y;j<=half_way_to_target_y;j++){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << " " << door_x << endl;
}
if(x_dir == -1){
for(int j=door_x;j>= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
else{
for(int j=door_x;j<= target_x;j+=x_dir){
door_x = j;
mapp[door_y][j] = '=';
//cout << door_y << " " << j << endl;
}
}
for(int j=door_y;j<= target_y;j++){
door_y = j;
mapp[j][door_x] = '=';
//cout << j << " " << door_x << endl;
}
}
else if(i == 3){
door_x = room_x * 20;
door_y = room_y * 20 + room_height_number / 2;
target_x = other_room_start_x + other_room_width_number;
target_y = other_room_start_y + other_room_height_number / 2;
door_y -= 1;
target_y -= 1;
int half_way_to_target_x = (door_x+target_x) / 2;
if(target_y > door_y){
y_dir = 1;
half_way_to_target_x -= 1;
}
else{
y_dir = -1;
half_way_to_target_x += 1;
}
for(int j=door_x;j>=half_way_to_target_x;j--){
door_x = j;
mapp[door_y][j] = '=';
}
if(y_dir == -1){
for(int j=door_y;j>= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
else{
for(int j=door_y;j<= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
for(int j=door_x;j>= target_x;j--){
door_x = j;
mapp[door_y][j] = '=';
}
door_x = room_x * 20;
door_y = room_y * 20 + room_height_number / 2;
target_x = other_room_start_x + other_room_width_number;
target_y = other_room_start_y + other_room_height_number / 2;
x_dir = -1;
y_dir = 0;
door_y += 1;
target_y += 1;
half_way_to_target_x = (door_x+target_x) / 2;
if(target_y > door_y){
y_dir = 1;
half_way_to_target_x += 1;
}
else{
y_dir = -1;
half_way_to_target_x -= 1;
}
for(int j=door_x;j>=half_way_to_target_x;j--){
door_x = j;
mapp[door_y][j] = '=';
}
if(y_dir == -1){
for(int j=door_y;j>= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
else{
for(int j=door_y;j<= target_y;j+=y_dir){
door_y = j;
mapp[j][door_x] = '=';
}
}
for(int j=door_x;j>= target_x;j--){
door_x = j;
mapp[door_y][j] = '=';
}
}
//mapp[door_y + y_dir][door_x + x_dir] = 'd';
}
}
}
int init_map(int n, int m, int maxx_room_width, int minn_room_width, int maxx_room_height, int minn_room_height, int minn_room_number, int max_room_number){
int k;
srand((int)time(0));
int i,j;
int random_integer;
if(minn_room_number < max_room_number)random_integer = random_number(minn_room_number,max_room_number);
else random_integer = minn_room_number;
int room_width_number = random_number(minn_room_width,maxx_room_width);
int room_height_number = random_number(minn_room_height,maxx_room_height);
int room_start_x = random_number(1,4)*20;
int room_start_y = random_number(1,4)*20;
map_depth[room_start_y / 20][room_start_x / 20] = 1;
map_data[room_start_y / 20][room_start_x / 20].width = room_width_number;
map_data[room_start_y / 20][room_start_x / 20].height = room_height_number;
//cout << room_start_x / 20 << " " << room_start_y / 20 << " " << room_width_number << " " << room_height_number;
//cout << map_depth[room_start_x / 20][room_start_y / 20] << endl;
start_x = room_start_x + room_width_number / 2;
start_y = room_start_y + room_height_number / 2;
make_room(room_start_x,room_start_y,room_width_number, room_height_number);
//结束的房间
room_width_number = random_number(minn_room_width,maxx_room_width);
room_height_number = random_number(minn_room_height,maxx_room_height);
int end_room_y;
//cout << (room_start_y / 20) <<endl;
if(random_number(0,1) == 1 && (room_start_y / 20) != 1) end_room_y = random_number(1,(room_start_y / 20)-1);
else if((room_start_y / 20) != 4) end_room_y = random_number((room_start_y / 20)+1,4);
else end_room_y = random_number(1,(room_start_y / 20)-1);
int end_room_x = random_number(1, 6) * 20;
end_room_y *= 20;
//cout << "end_room xy:" << end_room_x << " " << end_room_y <<endl;
map_depth[end_room_y / 20][end_room_x / 20] = 1;
map_data[end_room_y / 20][end_room_x / 20].width = room_width_number;
map_data[end_room_y / 20][end_room_x / 20].height = room_height_number;
make_path(end_room_x / 20, end_room_y / 20, room_width_number, room_height_number);
//cout << "end_room xy:" << end_room_x << " " << end_room_y <<endl;
//cout << endl;
//cout << end_room_y / 20 << " " << end_room_x / 20;
make_room(end_room_x, end_room_y, room_width_number, room_height_number);
mapp[end_room_y +(room_height_number) / 2][end_room_x + (room_width_number) / 2] = 's';
player_x = start_x;
player_y = start_y;
//cout << "end_room xy:" << end_room_x << " " << end_room_y <<endl;
for(i=1;i<=6;i++){
for(j=1;j<=5;j++){
if(map_depth[j][i] == 0){
//cout << map_depth[j][i] << " " << j << " " << i << endl;
room_width_number = random_number(minn_room_width,maxx_room_width);
room_height_number = random_number(minn_room_height,maxx_room_height);
make_room((i)*20, (j)*20, room_width_number, room_height_number);
map_depth[j][i] = 1;
map_data[j][i].width = room_width_number;
map_data[j][i].height = room_height_number;
make_path(i, j, room_width_number, room_height_number);
}
else{
//cout << j << " " << i << "/" << endl;
}
}
}
//cout << "end_room xy:" << end_room_x << " " << end_room_y <<endl;
return 0;
}
void generateNewFloor() {
// 1. 清空当前地图
memset(mapp, 0, sizeof(mapp));
memset(map_depth, 0, sizeof(map_depth));
// 2. 生成新地图
init_map(nScreenHeight, nScreenWidth, 15, 8, 15, 8, 1, 1);
// 3. 显示楼层过渡信息
//cout << "1" << endl;
for(int times = 0; times <= 110; times++){
//cout << "1.2" << endl;
string floorMsg = "进入第" + to_string(currentFloor) + "层..."; //to_string(currentFloor)
//cout << "1.3" << endl;
for(int t = 0; t < times; t++) floorMsg += "............";
//cout << "1.4" << endl;
for(int i=0; i<floorMsg.length(); i++) {
//cout << "1.5" << endl;
charBuffer[nScreenHeight/2 * nScreenWidth + nScreenWidth/2 - floorMsg.length()/2 + i].Char.AsciiChar = floorMsg[i];
charBuffer[nScreenHeight/2 * nScreenWidth + nScreenWidth/2 - floorMsg.length()/2 + i].Attributes = 0x0E;
}
//cout << "2" << endl;
WriteConsoleOutput(hConsole, charBuffer, bufferSize, bufferCoord, &writeArea);
//cout << "3" << endl;
if(times == 0) Sleep(1500);
Sleep(1); // 显示1.5秒
}
status_description = "状态: 普通 ////// 生命值:10 // 护甲:10 // 楼层:" + to_string(currentFloor);
}
void player_tick(char button_pressed){
mapp[player_y][player_x] = grid_player;
switch (button_pressed) {
case 'w': if (check(player_x,player_y-1)) player_y--; break;
case 's': if (check(player_x,player_y+1)) player_y++; break;
case 'a': if (check(player_x-1,player_y)) player_x--; break;
case 'd': if (check(player_x+1,player_y)) player_x++; break;
case ']': show_tips= !show_tips; break;
}
int current_room_width = map_data[player_y / 20][player_x / 20].width;
int current_room_height = map_data[player_y / 20][player_x / 20].height;
int in_room = 0;
if(player_x <= ((player_x / 20) * 20 + current_room_width) && player_y <= ((player_y / 20) * 20 + current_room_height)) in_room = 1;
promptStr = "room_width:" + to_string(current_room_width) + " room_height:" + to_string(current_room_height) + " in " + (in_room==1?"room":"corridor");
if(grid_player == 's') {
currentFloor++;
generateNewFloor(); // 生成新楼层
grid_player = 'S';
mapp[player_y][player_x] = 'm';
return; // 跳过本次位置设置
}
else grid_player = mapp[player_y][player_x];
mapp[player_y][player_x] = 'm';
}
char getPlayerInput() {
char input = 0;
if (_kbhit()) {
input = _getch();
needShowPrompt = true; // 收到输入后,下次需要显示提示
}
return input;
}
char fast_render(int n,int m,int tick){
int i,j;
// 计算视野范围(玩家居中)
int startX = player_x - nScreenWidth / 2;
int startY = player_y - nScreenHeight / 2;
// 填充缓冲区
// 先渲染帮助界面(如果开启)
if (show_tips) {
// 清屏为帮助界面背景
for (int y = 0; y < nScreenHeight; y++) {
for (int x = 0; x < nScreenWidth; x++) {
int bufPos = y * nScreenWidth + x;
charBuffer[bufPos].Char.AsciiChar = ' ';
charBuffer[bufPos].Attributes = 0x0E; // 黄色背景
}
}
// 渲染帮助文本
for (int y = 0; y < min(helpLines, nScreenHeight-1); y++) { // 保留最后一行给提示
for (int x = 0; x < helpText[y].length(); x++) {
int bufPos = y * nScreenWidth + x;
charBuffer[bufPos].Char.AsciiChar = helpText[y][x];
}
}
// 底部提示
string closeHint = "按']'继续...";
for (int x = 0; x < closeHint.length(); x++) {
int bufPos = (nScreenHeight-1)*nScreenWidth + x;
charBuffer[bufPos].Char.AsciiChar = closeHint[x];
charBuffer[bufPos].Attributes = 0x0C; // 红色
}
}
// 否则渲染游戏画面
else {
// 原有地图渲染逻辑...
for (int y = 0; y < nScreenHeight; y++) {
for (int x = 0; x < nScreenWidth; x++) {
int mapX = startX + x;
int mapY = startY + y;
charBuffer[y * nScreenWidth + x].Char.AsciiChar =
(mapX < 10001 && mapY < 10001 && mapp[mapY][mapX]) ? mapp[mapY][mapX] : '.';
charBuffer[y * nScreenWidth + x].Attributes =
(mapX < 10001 && mapY < 10001) ? colors[mapp[mapY][mapX]]: 0x07;
}
}
for (int x = 0; x < min((int)promptStr.length(), nScreenWidth); x++) {
int bufPos = (nScreenHeight-2)*nScreenWidth + x;
charBuffer[bufPos].Char.AsciiChar = promptStr[x];
charBuffer[bufPos].Attributes = 0x0F;
}
for (int x = 0; x < min((int)status_description.length(), nScreenWidth); x++) {
int bufPos = (nScreenHeight-1)*nScreenWidth + x;
charBuffer[bufPos].Char.AsciiChar = status_description[x];
charBuffer[bufPos].Attributes = 0x0F;
}
}
char input;
if(tick == 1){
input = getPlayerInput();
}
if(tick == 0){
system("pause");
}
// 写入控制台
WriteConsoleOutput(
hConsole,
charBuffer,
bufferSize,
bufferCoord,
&writeArea
);
return input;
}
int main(){
string story = "按Enter键开始你的故事!(enter可以提前结束说明)\n";
printTextWithEffect(story, 30); // 30ms的打印间隔
story = "很久很久以前,有一个训练营。\n";
printTextWithEffect(story, 30); // 30ms的打印间隔
story = "助教将你的手机收走,放在了10楼,也就是小码王大厦的顶端。\n";
printTextWithEffect(story, 30); // 30ms的打印间隔
story = "之后很久很久过去了";
printTextWithEffect(story, 30); // 30ms的打印间隔
story = "...\n";
printTextWithEffect(story, 300); // 30ms的打印间隔
story = "传说那些去找手机的孩子再也没有回来过\n";
printTextWithEffect(story, 30); // 30ms的打印间隔
story = "202X年,你决心去\n";
printTextWithEffect(story, 100);
story = "夺回你的手机\n";
printTextWithEffect(story, 300);
story = "按Enter键继续";
printTextWithEffect(story, 30); // 30ms的打印间隔
while ((GetAsyncKeyState(VK_RETURN) & 0x8000))
{
Sleep(10);
}
while (!(GetAsyncKeyState(VK_RETURN) & 0x8000))
{
Sleep(10);
}
system("cls");
delete[] charBuffer;
initConsoleBuffer();
init_map(nScreenHeight,nScreenWidth,15,8,15,8,1,1);
while(true){
button_pressed = fast_render(nScreenHeight,nScreenWidth,1);
if (button_pressed != 0) { // 只在有按键时移动
player_tick(button_pressed);
}
//Sleep(16); // 60FPS
}
cout << 1;
return 0;
}
这里空空如也
有帮助,赞一个