开发者

SDL Render Text not showing up unless other surface cleared

I have a

timer = TTF_RenderText_Solid( tfont, timeStr.str().c_str(), txtColor ); 
applySurface(500, 30, timer, screen);

and on the 'screen' surf开发者_开发知识库ace I have also applied my character, and my wall. But for some reason I can't seem to see the timer unless I have already NULL the 'floorsurface' and the 'charsurface'. Am I doing something wrong?


Try putting timerUpdate() before SDL_Flip(screen). You are calling SDL_Flip, then you call timerUpdate(). So you think, OK, that's fine, next time the screen is flipped, I'll see the text. But what is happening is that you are blitting more surfaces on top before the screen is flipped again, and then you can't see the text because you blitted surfaces on top of it. All you need to do is change the order, so

timerUpdate();
if (SDL_Flip(screen) == -1) return 1; //Instead of the other way round

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜