mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 03:35:39 +00:00
Remove unused parameters and enum from font.cpp.
This commit is contained in:
parent
67fa0b0fc6
commit
d7b3e389b7
@ -384,7 +384,7 @@ void save_preview_pane::draw_contents()
|
||||
}
|
||||
}
|
||||
|
||||
font::draw_text(&disp(),area,font::SIZE_SMALL,font::NORMAL_COLOUR,str.str(),area.x,ypos,NULL,true);
|
||||
font::draw_text(&disp(), area, font::SIZE_SMALL, font::NORMAL_COLOUR, str.str(), area.x, ypos, true);
|
||||
}
|
||||
|
||||
} //end anon namespace
|
||||
|
19
src/font.cpp
19
src/font.cpp
@ -364,7 +364,7 @@ surface render_text(TTF_Font* font,const std::string& text, const SDL_Color& col
|
||||
for(std::vector< surface >::const_iterator i = surfaces.begin(),
|
||||
i_end = surfaces.end(); i != i_end; ++i) {
|
||||
SDL_SetAlpha(*i, 0, 0); // direct blit without alpha blending
|
||||
SDL_Rect dstrect = {0, ypos};
|
||||
SDL_Rect dstrect = {0, ypos, 0, 0};
|
||||
SDL_BlitSurface(*i, NULL, res, &dstrect);
|
||||
ypos += (*i)->h;
|
||||
}
|
||||
@ -442,7 +442,7 @@ surface get_rendered_text(const std::string& str, int size, const SDL_Color& col
|
||||
|
||||
SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
|
||||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, surface bg, bool use_tooltips, int style)
|
||||
int x, int y, bool use_tooltips, int style)
|
||||
{
|
||||
|
||||
TTF_Font* const font = get_font(size);
|
||||
@ -506,7 +506,7 @@ SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
|
||||
|
||||
SDL_Rect draw_text_line(display* gui, const SDL_Rect& area, int size,
|
||||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, surface bg, bool use_tooltips, int style)
|
||||
int x, int y, bool use_tooltips, int style)
|
||||
{
|
||||
surface surface;
|
||||
|
||||
@ -516,19 +516,18 @@ SDL_Rect draw_text_line(display* gui, const SDL_Rect& area, int size,
|
||||
surface = gui->video().getSurface();
|
||||
}
|
||||
|
||||
return draw_text_line(surface, area, size, colour, text, x, y, bg, use_tooltips, style);
|
||||
return draw_text_line(surface, area, size, colour, text, x, y, use_tooltips, style);
|
||||
}
|
||||
|
||||
SDL_Rect text_area(const std::string& text, int size, int style)
|
||||
{
|
||||
const SDL_Rect area = {0,0,10000,10000};
|
||||
return draw_text(NULL,area,size,font::NORMAL_COLOUR,text,0,0,NULL,false,USE_MARKUP,style);
|
||||
return draw_text(NULL, area, size, font::NORMAL_COLOUR, text, 0, 0, false, style);
|
||||
}
|
||||
|
||||
SDL_Rect draw_text(display* gui, const SDL_Rect& area, int size,
|
||||
const SDL_Color& colour, const std::string& txt,
|
||||
int x, int y, surface bg, bool use_tooltips,
|
||||
MARKUP use_markup, int style)
|
||||
int x, int y, bool use_tooltips, int style)
|
||||
{
|
||||
//make sure there's always at least a space, so we can ensure
|
||||
//that we can return a rectangle for height
|
||||
@ -555,7 +554,7 @@ SDL_Rect draw_text(display* gui, const SDL_Rect& area, int size,
|
||||
|
||||
config::unescape(new_string);
|
||||
|
||||
const SDL_Rect rect = draw_text_line(gui,area,sz,col,new_string,x,y,bg,use_tooltips,text_style);
|
||||
const SDL_Rect rect = draw_text_line(gui, area, sz, col, new_string, x, y, use_tooltips, text_style);
|
||||
if(rect.w > res.w) {
|
||||
res.w = rect.w;
|
||||
}
|
||||
@ -720,10 +719,10 @@ namespace font {
|
||||
|
||||
SDL_Rect draw_wrapped_text(display* gui, const SDL_Rect& area, int font_size,
|
||||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, int max_width, surface bg)
|
||||
int x, int y, int max_width)
|
||||
{
|
||||
std::string wrapped_text = word_wrap_text(text, font_size, max_width);
|
||||
return font::draw_text(gui, area, font_size, colour, wrapped_text, x, y, bg, false, NO_MARKUP);
|
||||
return font::draw_text(gui, area, font_size, colour, wrapped_text, x, y, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
10
src/font.hpp
10
src/font.hpp
@ -37,8 +37,6 @@ void set_font();
|
||||
extern const SDL_Color NORMAL_COLOUR, GOOD_COLOUR, BAD_COLOUR, BLACK_COLOUR,
|
||||
DARK_COLOUR, YELLOW_COLOUR, BUTTON_COLOUR, TITLE_COLOUR;
|
||||
|
||||
enum MARKUP { USE_MARKUP, NO_MARKUP };
|
||||
|
||||
//standard markups
|
||||
extern const char LARGE_TEXT, SMALL_TEXT, GOOD_TEXT, BAD_TEXT, NORMAL_TEXT, BLACK_TEXT, BOLD_TEXT, IMAGE, NULL_MARKUP;
|
||||
|
||||
@ -68,8 +66,7 @@ const int
|
||||
//at the end of it. If use_tooltips is true, then text with an ellipsis will
|
||||
//have a tooltip set for it equivalent to the entire contents of the text.
|
||||
//
|
||||
//if use_markup is equal to USE_MARKUP, then some very basic 'markup' will
|
||||
//be done on the text:
|
||||
//some very basic 'markup' will be done on the text:
|
||||
// - any line beginning in # will be displayed in BAD_COLOUR
|
||||
// - any line beginning in @ will be displayed in GOOD_COLOUR
|
||||
// - any line beginning in + will be displayed with size increased by 2
|
||||
@ -83,8 +80,7 @@ const int
|
||||
|
||||
SDL_Rect draw_text(display* gui, const SDL_Rect& area, int size,
|
||||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, surface bg=NULL,
|
||||
bool use_tooltips=false, MARKUP use_markup=USE_MARKUP, int style=0);
|
||||
int x, int y, bool use_tooltips = false, int style = 0);
|
||||
|
||||
//function which returns the size of text if it were to be drawn.
|
||||
SDL_Rect text_area(const std::string& text, int size, int style=0);
|
||||
@ -127,7 +123,7 @@ std::string make_text_ellipsis(const std::string& text, int font_size, int max_w
|
||||
///
|
||||
SDL_Rect draw_wrapped_text(display* gui, const SDL_Rect& area, int font_size,
|
||||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, int max_width, surface bg = NULL);
|
||||
int x, int y, int max_width);
|
||||
|
||||
|
||||
/// structure which will hide all current floating labels, and cause floating labels
|
||||
|
@ -245,8 +245,7 @@ bool show_intro_part(display& screen, const config& part,
|
||||
}
|
||||
const SDL_Rect rect = font::draw_text(NULL,screen.screen_area(),
|
||||
font::SIZE_PLUS,font::NORMAL_COLOUR,
|
||||
word,xpos,ypos,NULL,
|
||||
false,font::NO_MARKUP);
|
||||
word, xpos, ypos, false);
|
||||
|
||||
if(xpos + rect.w >= max_xpos) {
|
||||
xpos = textx;
|
||||
@ -260,7 +259,7 @@ bool show_intro_part(display& screen, const config& part,
|
||||
const SDL_Rect rect = font::draw_text(&screen,
|
||||
screen.screen_area(),font::SIZE_PLUS,
|
||||
font::NORMAL_COLOUR,*j,xpos,ypos,
|
||||
NULL,false,font::NO_MARKUP);
|
||||
false);
|
||||
|
||||
if(rect.h > height)
|
||||
height = rect.h;
|
||||
|
@ -205,7 +205,8 @@ SDL_Rect draw_dialog_title(int x, int y, display* disp, const std::string& text)
|
||||
rect = disp->screen_area();
|
||||
}
|
||||
|
||||
return font::draw_text(disp,rect,font::SIZE_LARGE,font::TITLE_COLOUR,text,x,y+5,NULL,false,font::USE_MARKUP,TTF_STYLE_BOLD);
|
||||
return font::draw_text(disp, rect, font::SIZE_LARGE, font::TITLE_COLOUR,
|
||||
text, x, y + 5, false, TTF_STYLE_BOLD);
|
||||
}
|
||||
|
||||
void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& title,
|
||||
@ -453,13 +454,13 @@ int show_dialog(display& disp, surface image,
|
||||
SDL_Rect text_size = { 0, 0, 0, 0 };
|
||||
if(!message.empty()) {
|
||||
text_size = font::draw_text(NULL, clipRect, message_font_size,
|
||||
font::NORMAL_COLOUR, message, 0, 0, NULL);
|
||||
font::NORMAL_COLOUR, message, 0, 0);
|
||||
}
|
||||
|
||||
SDL_Rect caption_size = { 0, 0, 0, 0 };
|
||||
if (!caption.empty() && image != NULL) {
|
||||
caption_size = font::draw_text(NULL, clipRect, caption_font_size,
|
||||
font::NORMAL_COLOUR,caption,0,0,NULL);
|
||||
font::NORMAL_COLOUR, caption, 0, 0);
|
||||
}
|
||||
|
||||
const char** button_list = NULL;
|
||||
@ -700,7 +701,7 @@ int show_dialog(display& disp, surface image,
|
||||
font::draw_text(&disp, clipRect, caption_font_size,
|
||||
font::NORMAL_COLOUR, caption,
|
||||
xloc+image_width+left_padding+image_h_padding,
|
||||
yloc+top_padding, NULL);
|
||||
yloc+top_padding);
|
||||
}
|
||||
|
||||
font::draw_text(&disp, clipRect, message_font_size,
|
||||
|
@ -251,7 +251,9 @@ TITLE_RESULT show_title(display& screen, config& tips_of_day, int* ntip)
|
||||
draw_dialog_frame(area.x,area.y,area.w,area.h,screen,&style);
|
||||
|
||||
font::draw_text(&screen,area,font::SIZE_NORMAL,font::NORMAL_COLOUR,tip_of_day,area.x+pad,area.y+pad);
|
||||
font::draw_text(&screen,area,font::SIZE_NORMAL,font::NORMAL_COLOUR,tome,area.x+area.w-tome_area.w-pad,next_tip_button.location().y-tome_area.h-pad,NULL,false,font::NO_MARKUP,TTF_STYLE_ITALIC);
|
||||
font::draw_text(&screen, area, font::SIZE_NORMAL, font::NORMAL_COLOUR,
|
||||
tome, area.x + area.w - tome_area.w - pad,
|
||||
next_tip_button.location().y - tome_area.h - pad, false, TTF_STYLE_ITALIC);
|
||||
}
|
||||
|
||||
events::raise_draw_event();
|
||||
|
Loading…
x
Reference in New Issue
Block a user