mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 16:18:34 +00:00
Remove any old floating text when [print] is used.
This allows text to stay on screen until an event (which can do [print] text="" [/print] if it wants to merely clear it).
This commit is contained in:
parent
a1361fff00
commit
d30601fcc2
@ -54,7 +54,7 @@ std::vector<team>* teams = NULL;
|
||||
game_state* state_of_game = NULL;
|
||||
const game_data* game_data_ptr = NULL;
|
||||
gamestatus* status_ptr = NULL;
|
||||
|
||||
int floating_label = 0;
|
||||
} //end anonymous namespace
|
||||
|
||||
namespace game_events {
|
||||
@ -1124,10 +1124,15 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
||||
|
||||
SDL_Color colour = {red,green,blue,255};
|
||||
|
||||
//remove any old one.
|
||||
if (floating_label)
|
||||
font::remove_floating_label(floating_label);
|
||||
|
||||
const std::string& msg = text;
|
||||
if(msg != "") {
|
||||
const SDL_Rect rect = screen->map_area();
|
||||
font::add_floating_label(msg,size,colour,rect.w/2,rect.h/2,
|
||||
floating_label = font::add_floating_label(msg,size,colour,
|
||||
rect.w/2,rect.h/2,
|
||||
0.0,0.0,lifetime,rect,font::CENTER_ALIGN);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user