cleanup of deps against display: tooltips do not need a display for most work

This commit is contained in:
Yann Dirson 2005-03-15 00:45:00 +00:00
parent c8e9141af1
commit 887f32d629
4 changed files with 12 additions and 11 deletions

View file

@ -32,7 +32,7 @@ namespace mp {
create::create(display& disp, const config &cfg, chat& c, config& gamelist) :
ui(disp, cfg, c, gamelist),
tooltip_manager_(disp),
tooltip_manager_(disp.video()),
map_selection_(-1),
maps_menu_(disp, std::vector<std::string>()),

View file

@ -389,7 +389,7 @@ LEVEL_RESULT play_level(game_data& gameinfo, const config& game_config,
}
const preferences::display_manager prefs_disp_manager(&gui);
const tooltips::manager tooltips_manager(gui);
const tooltips::manager tooltips_manager(gui.video());
LOG_NG << "b... " << (SDL_GetTicks() - ticks) << "\n";

View file

@ -1,10 +1,10 @@
#include "global.hpp"
#include "display.hpp"
#include "font.hpp"
#include "sdl_utils.hpp"
#include "show_dialog.hpp"
#include "tooltips.hpp"
#include "sdl_utils.hpp"
#include "video.hpp"
#include <vector>
@ -21,7 +21,7 @@ bool rectangles_overlap(const SDL_Rect& a, const SDL_Rect& b)
return xoverlap && yoverlap;
}
display* display_ = NULL;
CVideo* video_ = NULL;
struct tooltip
{
@ -59,14 +59,14 @@ void clear_tooltip()
void show_tooltip(const tooltip& tip)
{
if(display_ == NULL) {
if(video_ == NULL) {
return;
}
clear_tooltip();
const SDL_Color bgcolour = {0,0,0,128};
SDL_Rect area = display_->screen_area();
SDL_Rect area = screen_area();
tooltip_handle = font::add_floating_label(tip.message,font_size,font::NORMAL_COLOUR,
0,0,0,0,-1,area,font::LEFT_ALIGN,&bgcolour,10);
@ -93,16 +93,16 @@ void show_tooltip(const tooltip& tip)
namespace tooltips {
manager::manager(display& disp)
manager::manager(CVideo& video)
{
clear_tooltips();
display_ = &disp;
video_ = &video;
}
manager::~manager()
{
clear_tooltips();
display_ = NULL;
video_ = NULL;
}
void clear_tooltips()

View file

@ -1,6 +1,7 @@
#ifndef TOOLTIPS_HPP_INCLUDED
#define TOOLTIPS_HPP_INCLUDED
class CVideo;
class display;
#include "SDL.h"
@ -9,7 +10,7 @@ namespace tooltips {
struct manager
{
manager(display& disp);
manager(CVideo& disp);
~manager();
};