c语言中 c2059错误是,错误c2059:语法错误:'('

Blackelfwolf

0

c++

goto

我不明白这个错误它在教程中编写完全相同,但我的错误.

#include "drawEngine.h"

#include

#include

using namespace std;

DrawEngine::DrawEngine(int xSize, int ySize)

{

screenWidth = xSize;

screenHeight = ySize;

//set cursor visibility to false

map = 0;

cursorVisibility(false);

}

DrawEngine::~DrawEngine()

{

//set cursor visibility to true

cursorVisibility(true);

}

int DrawEngine::createSprite(int index, char c)

{

if (index >= 0 && index < 16)

{

spriteImage[index] = c;

return index;

}

return -1;

}

void DrawEngine::deleteSprite(int index)

{

//in this implementation we don't need it

}

void DrawEngine::drawSprite(int index, int posx, int posy)

{

//go to the correct location

gotoxy(posx, posy);

//draw the image with cout

cout << spriteImage[index];

}

void DrawEngine::eraseSprite(int posx, int posy)

{

gotoxy(posx, posy);

cout << ' ';

}

void DrawEngine::setMap(char **data)

{

map = data;

}

void DrawEngine::createBackgroundTile(int index, char c)

{

if (index >= 0 && index < 16)

{

tileImage[index] = c;

}

}

void DrawEngine::drawBackground(void)

{

if (map)

{

for (int y = 0; y < screenHeight; y++)

{

goto(0, y); // This generates the error

for (int x = 0; x < screenWidth; x++)

{

cout << tileImage[map[x][y]];

}

}

}

}

void DrawEngine::gotoxy(int x, int y)

{

HANDLE output_handle;

COORD pos;

pos.X = x;

pos.Y = y;

output_handle = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleCursorPosition(output_handle, pos);

}

void DrawEngine::cursorVisibility(bool visibility)

{

HANDLE output_handle;

CONSOLE_CURSOR_INFO cciInfo;

cciInfo.dwSize = sizeof(CONSOLE_CURSOR_INFO);

cciInfo.bVisible = visibility;

output_handle = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleCursorInfo(output_handle, &cciInfo);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值