Pass color value directly to game_display::float_label
This is to allow color values created using different util functions - ie, create_color() or string_to_color().
This commit is contained in:
parent
9eb6e66e7b
commit
5813eb0aad
6 changed files with 11 additions and 13 deletions
|
@ -261,7 +261,7 @@ private:
|
|||
}
|
||||
|
||||
void display_float(const map_location& location, const std::string& text) const{
|
||||
game_display::get_singleton()->float_label(location,text,255,0,0);
|
||||
game_display::get_singleton()->float_label(location, text, create_color(255,0,0));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -728,8 +728,7 @@ void game_display::set_route(const pathfind::marked_route *route)
|
|||
invalidate_route();
|
||||
}
|
||||
|
||||
void game_display::float_label(const map_location& loc, const std::string& text,
|
||||
int red, int green, int blue)
|
||||
void game_display::float_label(const map_location& loc, const std::string& text, const SDL_Color& color)
|
||||
{
|
||||
if(preferences::show_floating_labels() == false || fogged(loc)) {
|
||||
return;
|
||||
|
@ -737,7 +736,6 @@ void game_display::float_label(const map_location& loc, const std::string& text,
|
|||
|
||||
font::floating_label flabel(text);
|
||||
flabel.set_font_size(font::SIZE_XLARGE);
|
||||
const SDL_Color color = create_color(red, green, blue);
|
||||
flabel.set_color(color);
|
||||
flabel.set_position(get_location_x(loc)+zoom_/2, get_location_y(loc));
|
||||
flabel.set_move(0, -2 * turbo_speed());
|
||||
|
|
|
@ -116,8 +116,7 @@ public:
|
|||
void set_route(const pathfind::marked_route *route);
|
||||
|
||||
/** Function to float a label above a tile */
|
||||
void float_label(const map_location& loc, const std::string& text,
|
||||
int red, int green, int blue);
|
||||
void float_label(const map_location& loc, const std::string& text, const SDL_Color& color);
|
||||
|
||||
/** Draws the movement info (turns available) for a given location. */
|
||||
void draw_movement_info(const map_location& loc);
|
||||
|
|
|
@ -1342,7 +1342,7 @@ WML_HANDLER_FUNCTION(unstore_unit, /*event_info*/, cfg)
|
|||
if(!text.empty() && !controller->is_skipping_replay())
|
||||
{
|
||||
// Print floating label
|
||||
resources::screen->float_label(loc, text, cfg["red"], cfg["green"], cfg["blue"]);
|
||||
resources::screen->float_label(loc, text, create_color(cfg["red"], cfg["green"], cfg["blue"]));
|
||||
}
|
||||
if(advance) {
|
||||
advance_unit_at(advance_unit_params(loc)
|
||||
|
|
|
@ -2517,8 +2517,7 @@ int game_lua_kernel::intf_float_label(lua_State *L)
|
|||
|
||||
t_string text = luaW_checktstring(L, 3);
|
||||
if (game_display_) {
|
||||
game_display_->float_label(loc, text, font::LABEL_COLOR.r,
|
||||
font::LABEL_COLOR.g, font::LABEL_COLOR.b);
|
||||
game_display_->float_label(loc, text, font::LABEL_COLOR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -649,10 +649,12 @@ void unit_frame::redraw(const int frame_time,bool on_start_time,bool in_scope_of
|
|||
sound::play_sound(current_data.sound);
|
||||
}
|
||||
if(!current_data.text.empty() ) {
|
||||
game_display::get_singleton()->float_label(src,current_data.text,
|
||||
(current_data.text_color & 0x00FF0000) >> 16,
|
||||
(current_data.text_color & 0x0000FF00) >> 8,
|
||||
(current_data.text_color & 0x000000FF) >> 0);
|
||||
game_display::get_singleton()->float_label(src, current_data.text,
|
||||
create_color(
|
||||
(current_data.text_color & 0x00FF0000) >> 16,
|
||||
(current_data.text_color & 0x0000FF00) >> 8,
|
||||
(current_data.text_color & 0x000000FF) >> 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
image::locator image_loc;
|
||||
|
|
Loading…
Add table
Reference in a new issue