Made the background for chat messages and chat input more opaque,

as it was difficult to read it over snowy terrain
This commit is contained in:
Isaac Clerencia Perez 2004-11-13 00:27:26 +00:00
parent 82e0e9c142
commit 2b886a2cbe
4 changed files with 15 additions and 9 deletions

View File

@ -2239,8 +2239,8 @@ namespace {
const int chat_message_border = 5;
const int chat_message_x = 10;
const int chat_message_y = 10;
const SDL_Color chat_message_colour = {200,200,200,200};
const SDL_Color chat_message_bg = {0,0,0,100};
const SDL_Color chat_message_colour = {255,255,255,255};
const SDL_Color chat_message_bg = {0,0,0,140};
}
void display::add_chat_message(const std::string& speaker, int side, const std::string& message, display::MESSAGE_TYPE type)

View File

@ -2524,11 +2524,13 @@ void turn_info::create_textbox(floating_textbox::MODE mode, const std::string& l
const SDL_Rect& area = gui_.map_area();
const SDL_Color textbox_bg = {0,0,0,140};
const int border_size = 10;
const int ypos = area.y+area.h-30 - (textbox_.check != NULL ? textbox_.check->height() + border_size : 0);
textbox_.label = font::add_floating_label(label,font::SIZE_NORMAL,font::YELLOW_COLOUR,area.x+border_size,ypos,0,0,-1,
area,font::LEFT_ALIGN);
area,font::LEFT_ALIGN, &textbox_bg);
if(textbox_.label == 0) {
return;
}
@ -2541,7 +2543,7 @@ void turn_info::create_textbox(floating_textbox::MODE mode, const std::string& l
return;
}
textbox_.box.assign(new gui::textbox(gui_,textbox_width));
textbox_.box.assign(new gui::textbox(gui_,textbox_width,"",true,256,0.8,0.6));
textbox_.box->set_volatile(true);
textbox_.box->set_location(area.x + label_area.w + border_size*2,ypos);

View File

@ -28,12 +28,13 @@ namespace gui {
const int font_size = font::SIZE_PLUS;
textbox::textbox(display& d, int width, const std::string& text, bool editable, size_t max_size)
textbox::textbox(display& d, int width, const std::string& text, bool editable, size_t max_size, double alpha, double alpha_focus)
: scrollarea(d), max_size_(max_size), text_(string_to_wstring(text)),
cursor_(text_.size()), selstart_(-1), selend_(-1),
grabmouse_(false), text_pos_(0), editable_(editable),
show_cursor_(true), show_cursor_at_(0), text_image_(NULL),
wrap_(false), line_height_(0), yscroll_(0)
wrap_(false), line_height_(0), yscroll_(0), alpha_(alpha),
alpha_focus_(alpha_focus)
{
// static const SDL_Rect area = d.screen_area();
// const int height = font::draw_text(NULL,area,font_size,font::NORMAL_COLOUR,"ABCD",0,0).h;
@ -118,7 +119,7 @@ void textbox::draw_contents()
surface surf = disp().video().getSurface();
gui::draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0,
focus() ? 0.2 : 0.4, surf);
focus() ? alpha_focus_ : alpha_, surf);
SDL_Rect src;

View File

@ -28,7 +28,7 @@ namespace gui {
class textbox : public scrollarea
{
public:
textbox(display& d, int width, const std::string& text="", bool editable=true, size_t max_size = 256);
textbox(display& d, int width, const std::string& text="", bool editable=true, size_t max_size = 256, double alpha = 0.4, double alpha_focus = 0.2);
const std::string text() const;
void set_text(const std::string& text);
@ -52,7 +52,7 @@ private:
size_t max_size_;
wide_string text_;
// mutable unsigned int firstOnScreen_;
int cursor_;
int selstart_;
@ -77,6 +77,9 @@ private:
size_t line_height_, yscroll_;
double alpha_;
double alpha_focus_;
void handle_event(const SDL_Event& event);
void draw_cursor(int pos, display &disp) const;