[英]How to implement escape Sequence in SDL
我正在嘗試在SDL中使用STL庫。 但這給了我錯誤
"undeclared identifier"
有什么方法可以使用"\\n"
甚至cout<<endl;
將鼠標光標放在屏幕上所需位置的函數SDL_WarpMouse
可以幫我SDL_WarpMouse
? 因為我想在下一行序列上放置一個磁貼。
希望您能收到問題。 雖然這是一個非常模糊和混亂的問題(對不起)。
編輯:
void putMap(SDL_Surface* tile, SDL_Surface* screen)
{
for(int y = 0; y < 21; y++)
{
for(int x = 0; x < 60; x++)
{
if(maze[x][y] != '#')
{
apply_surface( x*10 , y*10 , tile, screen);
}
}
cout<<endl;
}
}
c:\\documents and settings\\administrator\\my documents\\visual studio 2008\\projects\\craptest\\craptest\\main.cpp(605) : error C2065: 'cout' : undeclared identifier
c:\\documents and settings\\administrator\\my documents\\visual studio 2008\\projects\\craptest\\craptest\\main.cpp(605) : error C2065: 'endl' : undeclared identifier
這是我的apply_surface函數。
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
{
//Make a temporary rectangle to hold the offsets
SDL_Rect offset;
//Give the offsets to the rectangle
offset.x = x;
offset.y = y;
//Blit the surface
SDL_BlitSurface( source, NULL, destination, &offset );
}
cout
和endl
在std
命名空間中,並且必須被限定:
std::cout << std::endl;
或者,您可以使用using聲明:
using std::cout;
using std::endl;
cout << endl;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.