Commit 59c16862 authored by Romain Bignon's avatar Romain Bignon

new mena background image

parent a55448df
......@@ -238,7 +238,7 @@ void Config::WantAddServer(TObject* OkButton, void* configinst)
}
host = host + ":" + port;
conf->server_list.push_back(host);
form->ServerList->AddItem(true, host, host, black_color, true);
form->ServerList->AddItem(true, host, host, white_color, true);
form->NewServer->ClearString();
return;
}
......@@ -386,11 +386,11 @@ void Config::Configuration(bool first)
std::string p = *it;
std::string h = stringtok(p, ":");
ConfigForm->ServerList->AddItem((h == hostname && p == TypToStr(port)), *it, *it, black_color, true);
ConfigForm->ServerList->AddItem((h == hostname && p == TypToStr(port)), *it, *it, white_color, true);
if(h == hostname && p == TypToStr(port)) found = true;
}
if(!found)
ConfigForm->ServerList->AddItem(true, hostname + ":" + TypToStr(port), hostname, black_color, true);
ConfigForm->ServerList->AddItem(true, hostname + ":" + TypToStr(port), hostname, white_color, true);
want_quit_config = false;
do
......
......@@ -285,7 +285,7 @@ int LSMCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
GameInfosForm->RecvMapList = true;
GameInfosForm->MapList->ClearItems();
}
TListBoxItem* i = GameInfosForm->MapList->AddItem(false, parv[1] + " (" + parv[2] + "-" + parv[3] + ")", parv[1], black_color,
TListBoxItem* i = GameInfosForm->MapList->AddItem(false, parv[1] + " (" + parv[2] + "-" + parv[3] + ")", parv[1], white_color,
true);
if(parv.size() > 4)
i->SetHint(parv[4].c_str());
......@@ -318,7 +318,7 @@ int AMSGCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
{
me->LockScreen();
GameInfosForm->Chat->AddItem("[private] <" + parv[0] + "> " + parv[1],
strstr(parv[1].c_str(), me->GetNick().c_str()) ? red_color : black_color);
strstr(parv[1].c_str(), me->GetNick().c_str()) ? red_color : white_color);
me->UnlockScreen();
}
......@@ -337,7 +337,7 @@ int MSGCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
strstr(parv[1].c_str(), me->GetNick().c_str()) ? 0 : *(players.begin()));
else if(GameInfosForm)
GameInfosForm->Chat->AddItem("<" + parv[0] + "> " + parv[1],
strstr(parv[1].c_str(), me->GetNick().c_str()) ? red_color : black_color);
strstr(parv[1].c_str(), me->GetNick().c_str()) ? red_color : white_color);
me->UnlockScreen();
return 0;
......@@ -1055,7 +1055,7 @@ int JOICommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
(parv[0][0] == IA_CHAR));
if(GameInfosForm)
{
GameInfosForm->Chat->AddItem(StringF(_("*** %s has joined game"), parv[0].c_str()), green_color);
GameInfosForm->Chat->AddItem(StringF(_("*** %s has joined game"), parv[0].c_str()), fgreen_color);
TPlayerLine *pline;
GameInfosForm->Players->AddLine((pline = new TPlayerLine(pl)));
GameInfosForm->RecalcMemo();
......@@ -1117,7 +1117,7 @@ int LEACommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
if((*playersi)->Nation() && GameInfosForm->MyNation)
GameInfosForm->MyNation->Item((*playersi)->Nation())->SetEnabled();
GameInfosForm->Chat->AddItem(StringF(_("*** %s has leave game"), (*playersi)->GetNick()), green_color);
GameInfosForm->Chat->AddItem(StringF(_("*** %s has leave game"), (*playersi)->GetNick()), fgreen_color);
std::vector<TComponent*> plrs = GameInfosForm->Players->GetList();
for(std::vector<TComponent*>::iterator it=plrs.begin(); it!=plrs.end(); ++it)
{
......@@ -1248,7 +1248,7 @@ bool MenAreAntsApp::GameInfos(const char *cname, TForm* form, int flags)
/* Déclaration membres fixes */
GameInfosForm = new TGameInfosForm(Video::GetInstance()->Window(), client, (flags & G_MISSION));
GameInfosForm->Chat->AddItem(StringF(_("*** You have rejoin %s"), cname), green_color);
GameInfosForm->Chat->AddItem(StringF(_("*** You have rejoin %s"), cname), fgreen_color);
JOINED = 0;
if(create)
......@@ -1346,7 +1346,7 @@ void TGameInfosForm::OnKeyUp(SDL_keysym key)
if(SendMessage->Focused() && !SendMessage->Empty())
{
client->sendrpl(MSG_MSG, SendMessage->GetString());
Chat->AddItem("<" + client->GetNick() + "> " + SendMessage->GetString(), black_color);
Chat->AddItem("<" + client->GetNick() + "> " + SendMessage->GetString(), white_color);
SendMessage->ClearString();
}
break;
......
......@@ -525,7 +525,7 @@ TListServerForm::TListServerForm(ECImage* w)
ServerList->SetXY(Window()->GetWidth()/2 - ServerList->Width()/2 - 50, Window()->GetHeight()/2 - ServerList->Height()/2 + 70);
ServerList->SetGrayDisable(false);
Welcome = AddComponent(new TLabel(30,StringF(_("Men Are Ants is for YOU, %s!"), Config::GetInstance()->nick.c_str()),
Welcome = AddComponent(new TLabel(30,StringF(_("Welcome to Men Are Ants, %s!"), Config::GetInstance()->nick.c_str()),
white_color, Font::GetInstance(Width() <= 800 ? Font::Large : Font::Huge)));
Label1 = AddComponent(new TLabel(ServerList->Y()-60, _("Please select a server in this list:"), white_color, Font::GetInstance(Font::Big)));
......@@ -824,7 +824,7 @@ int MOTDCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
ConnectedForm->Motd->ClearItems();
}
ConnectedForm->Motd->AddItem(parv.size() > 1 ? parv[1] : "", black_color);
ConnectedForm->Motd->AddItem(parv.size() > 1 ? parv[1] : "", white_color);
return 0;
}
......@@ -874,16 +874,16 @@ int LSPCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
{
if(parv[4] == "0")
ConnectedForm->GList->AddItem(false, StringF("%-8s %2s", parv[1].c_str(), parv[3].c_str()), parv[1],
black_color, true);
white_color, true);
else if(parv.size() > 5)
ConnectedForm->GList->AddItem(false, StringF("%-8s %2s/%-2s %s", parv[1].c_str(), parv[3].c_str(),
parv[4].c_str(), parv[5].c_str()), parv[1],
enabled ? black_color : red_color,
enabled ? white_color : red_color,
enabled ? true : false);
else
ConnectedForm->GList->AddItem(false, StringF("%-8s %2s/%-2s", parv[1].c_str(), parv[3].c_str(),
parv[4].c_str()), parv[1],
enabled ? black_color : red_color,
enabled ? white_color : red_color,
enabled ? true : false);
}
else
......
......@@ -1312,7 +1312,7 @@ void TLoadMapFile::Refresh()
for(std::vector<std::string>::const_iterator it = file_list.begin(); it != file_list.end(); ++it)
MapsList->AddItem(false, it->substr(0, it->size() - 4), MenAreAntsApp::GetInstance()->GetPath() + *it,
black_color, true);
white_color, true);
}
TLoadMapFile::TLoadMapFile(ECImage* w)
......
......@@ -27,7 +27,7 @@
TComboBox::TComboBox(Font* f, int _x, int _y, uint _width)
: TListBox(Rectanglei(_x, _y, _width, f->GetHeight())), real_y(_y), opened(false), visible_len(0),
chaine(_x+5, _y, "", black_color, f), COMBOBOX_HEIGHT(f->GetHeight()), font(f)
chaine(_x+5, _y, "", white_color, f), COMBOBOX_HEIGHT(f->GetHeight()), font(f)
{
}
......@@ -45,13 +45,14 @@ void TComboBox::Init()
m_open.SetXY(X()+Width()-12, Y());
// FIXME: What does 13 mean ?
SDL_Rect r_back = {0,0,Width()-13,COMBOBOX_HEIGHT};
Rectanglei r(0, 0, Width()-13, COMBOBOX_HEIGHT);
edit_bg.SetImage(SDL_CreateRGBSurface( SDL_HWSURFACE|SDL_SRCALPHA, Width()-13, COMBOBOX_HEIGHT,
32, 0x000000ff, 0x0000ff00, 0x00ff0000,0xff000000));
edit_bg.FillRect(r_back, edit_bg.MapColor(BoxColor));
edit_bg.FillRect(r, edit_bg.MapColor(BoxColor));
edit_bg.RectangleColor(r, white_color);
box_color = Color(172, 183, 255, 255);
box_color = BoxColor;
TListBox::Init();
}
......
......@@ -51,7 +51,7 @@ public:
TListBoxItem* AddItem (bool selected,
const std::string &label,
const std::string &value,
const Color& _color = black_color,
const Color& _color = white_color,
bool _enabled = true,
Font& font = *Font::GetInstance(Font::Small),
const std::string& name = "");
......
......@@ -27,7 +27,7 @@
TEdit::TEdit (Font* f, int _x, int _y, uint _width, uint _maxlen, const char* av, bool _show_bg)
: TComponent(_x, _y, _width, f->GetHeight()), show_background(_show_bg), caret(0), have_redraw(true), font(f),
color(black_color), passwd(false)
color(white_color), passwd(false)
{
assert(font);
......@@ -46,11 +46,12 @@ void TEdit::Init()
if(!show_background) return;
SDL_Rect r_back = {0,0,Width(), Height()};
Rectanglei r(0, 0, Width(), Height());
background.SetImage(SDL_CreateRGBSurface( SDL_HWSURFACE|SDL_SRCALPHA, Width(), Height(),
32, 0x000000ff, 0x0000ff00, 0x00ff0000,0xff000000));
background.FillRect(r_back, background.MapColor(BoxColor));
background.FillRect(r, background.MapColor(BoxColor));
background.RectangleColor(r, white_color);
}
void TEdit::SetFocus()
......
......@@ -88,8 +88,14 @@ void TListBox::Init()
MyComponent(&m_down);
// Load images
m_up.SetImage (new ECSprite(Resources::UpButton(), Window()));
m_up.SetXY(X() + Width() - 12, Y() + 2);
m_down.SetImage (new ECSprite(Resources::DownButton(), Window()));
SetXY(X(), Y());
}
void TListBox::SetXY (int _x, int _y)
{
TComponent::SetXY(_x, _y);
m_up.SetXY(X() + Width() - 12, Y() + 2);
m_down.SetXY(X() + Width() - 12, Y() + Height() - 12);
}
......@@ -177,7 +183,6 @@ void TListBox::Draw(const Point2i &mousePosition)
// Draw border and bg color
Window()->BoxColor(rect, box_color);
//Window()->RectangleColor(rect, white_color);
if(scrolling)
{
......@@ -245,6 +250,7 @@ void TListBox::Draw(const Point2i &mousePosition)
}
else
m_down.Hide();
Window()->RectangleColor(rect, white_color);
}
Rectanglei TListBox::ScrollBarPos() const
......
......@@ -105,6 +105,7 @@ public:
void ScrollTo(uint id);
void ScrollTo(TListBoxItem* item);
void SetXY (int _x, int _y);
/* Attributs */
public:
......
......@@ -58,11 +58,13 @@ void TMemo::Init()
first_visible_item = m_items.size() - nb_visible_items;
SDL_Rect r_back = {0,0,Width(), show_background ? Height() : height_item};
Rectanglei r(0, 0, Width(), show_background ? Height() : height_item);
background.SetImage(SDL_CreateRGBSurface( SDL_HWSURFACE|SDL_SRCALPHA, Width(), show_background ? Height() : height_item,
32, 0x000000ff, 0x0000ff00, 0x00ff0000,0xff000000));
background.FillRect(r_back, show_background ? background.MapColor(BoxColor) : background.MapColor(BoxShadowColor));
background.FillRect(r, show_background ? background.MapColor(BoxColor) : background.MapColor(BoxShadowColor));
if (show_background)
background.RectangleColor(r, white_color);
}
......
......@@ -64,7 +64,7 @@ public:
void Init ();
void Draw (const Point2i& mouse);
bool Clic (const Point2i& mouse, int button);
void AddItem (const std::string &label, Color _color = black_color);
void AddItem (const std::string &label, Color _color = white_color);
void ScrollUp() { first_visible_item = 0; };
void RemoveItem (uint index);
uint NbItems() const { return m_items.size(); }
......
......@@ -196,7 +196,7 @@ void TMessageBox::SetText(std::string __s)
* MSGBOX_MAXWIDTH + 20 on coupe net.
*/
s[i] = '\0';
message.push_back(TLabel(x,y,s,black_color,Font::GetInstance(Font::Normal)));
message.push_back(TLabel(x,y,s,white_color,Font::GetInstance(Font::Normal)));
MyComponent(&(*(message.end()-1)));
i=0;
......@@ -233,20 +233,21 @@ void TMessageBox::Init(std::string s, bool transparence)
SetEdit();
SetButtons();
SDL_Rect r_back = {0,0,w,h};
Rectanglei r(0, 0, w, h);
if(transparence)
{
background.SetImage(SDL_CreateRGBSurface( SDL_HWSURFACE|SDL_SRCALPHA, w, h,
32, 0x000000ff, 0x0000ff00, 0x00ff0000,0xff000000));
background.FillRect(r_back, background.MapRGBA(172, 183, 255, 255*6/10));
background.FillRect(r, BoxShadowColor.WithAlpha(0xdd));
}
else
{
background.SetImage(SDL_CreateRGBSurface( SDL_HWSURFACE, w, h,
32, 0x000000ff, 0x0000ff00, 0x00ff0000,0xff000000));
background.FillRect(r_back, background.MapRGBA(172, 183, 255, 255));
background.FillRect(r, BoxColor.WithAlpha(0xff));
}
background.RectangleColor(r, white_color);
if(x == -1 && y == -1)
{
......
......@@ -93,8 +93,8 @@ const Color fwhite_color(0xcb, 0xcb, 0xcb, 0xff);
const Color fbrown_color(0x3b, 0x2b, 0x1e, 0xff);
const Color fblue_color(0x0e, 0x0e, 0x55, 0xff);
const Color BoxColor(172, 183, 255, 255*5/10);
const Color BoxShadowColor(172, 183, 255, 255*6/10);
const Color BoxColor(74, 79, 110, 255*5/10);
const Color BoxShadowColor(74, 79, 110, 255*6/10);
const Color BoxColorSelected(0, 0, 255*6/10, 255*8/10);
const Color BoxColorMoused(0, 0, 255*6/10, 255*4/10);
......
......@@ -733,6 +733,20 @@ int ECImage::FillRect(SDL_Rect &dstRect, const Color color)
return SDL_FillRect( Img, &dstRect, MapColor(color));
}
int ECImage::FillRect(const Rectanglei &dstRect, Uint32 color)
{
if(!Img) return 0;
SDL_Rect rect = GetSDLRect(dstRect);
return SDL_FillRect( Img, &rect, color);
}
int ECImage::FillRect(const Rectanglei &dstRect, const Color color)
{
if(!Img) return 0;
SDL_Rect rect = GetSDLRect(dstRect);
return SDL_FillRect( Img, &rect, MapColor(color));
}
void ECImage::NewSurface(const Point2i& size, Uint32 flags, bool useAlpha)
{
Uint32 alphaMask;
......
......@@ -252,6 +252,8 @@ public:
int Fill(const Color &color);
int FillRect(SDL_Rect &dstRect, Uint32 color);
int FillRect(SDL_Rect &dstRect, const Color color);
int FillRect(const Rectanglei &dstRect, Uint32 color);
int FillRect(const Rectanglei &dstRect, const Color color);
void NewSurface(const Point2i& size, Uint32 flags, bool useAlpha);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment