私は基本的にC++の初心者ですが、whileループにある文字列を更新する方法を調べていましたか?
現在、ループの反復ごとに、前のテキストの上にテキストが書き込まれますが、基本的には白い色のぼかしです。
これは私のループです:
while(!quit){
while( SDL_PollEvent( &event ) ){
switch(event.type){
case SDL_QUIT: quit = true; break;
case SDL_MOUSEMOTION: handle_mouse_position();
}
}
SDL_Rect offset;
offset.x = 400;
offset.y = 290;
std::stringstream s;
s << "Mouse xpos: " << mouseX << " Mouse ypos: " << mouseY;
font_surface = TTF_RenderText_Solid(font,s.str().c_str(),font_color);
SDL_BlitSurface(font_surface, NULL, screen, &offset);
//Update the screen
if( SDL_Flip( screen ) == -1 ) {
return 1;
}
}
以前のテキスト出力をクリアし、ループごとに更新して、マウスの位置を明確に表示する方法はありますか?