#include <results_menu.h>
Inheritance diagram for ResultsMenu:
Public Member Functions | |
ResultsMenu (const std::vector< TeamResults * > *v, const char *winner_name) | |
~ResultsMenu () | |
Private Member Functions | |
void | __sig_ok () |
void | __sig_cancel () |
void | SetResult (int i) |
void | OnClic (const Point2i &mousePosition, int button) |
void | Draw (const Point2i &mousePosition) |
Private Attributes | |
const std::vector< TeamResults * > * | results |
int | index |
int | total_width |
int | max_height |
Point2i | team_size |
Point2i | type_size |
Point2i | name_size |
Point2i | score_size |
Button * | bt_prev_team |
Button * | bt_next_team |
PictureWidget * | team_logo |
Label * | team_name |
HBox * | team_box |
ResultBox * | most_violent |
ResultBox * | most_usefull |
ResultBox * | most_useless |
ResultBox * | biggest_traitor |
Definition at line 32 of file results_menu.h.
ResultsMenu::ResultsMenu | ( | const std::vector< TeamResults * > * | v, | |
const char * | winner_name | |||
) |
Definition at line 104 of file results_menu.cpp.
00106 : Menu("menu/bg_play", vOk) 00107 , results(v) 00108 , index(0) 00109 , max_height(DEF_SIZE+3*DEF_BORDER) 00110 , team_size(360, 40) 00111 , type_size(160, 40) 00112 , name_size(250, 40) 00113 , score_size(60, 40) 00114 { 00115 Profile *res = resource_manager.LoadXMLProfile( "graphism.xml",false); 00116 Point2i pos (0, 0); 00117 Font* big_font = Font::GetInstance(Font::FONT_BIG); 00118 00119 // Center the boxes! 00120 uint x = 60; 00121 uint y = 60; 00122 00123 //Team selection 00124 team_box = new HBox(Rectanglei(x, y, total_width, max_height), true); 00125 team_box->SetMargin(DEF_MARGIN); 00126 team_box->SetBorder(Point2i(DEF_BORDER, DEF_BORDER)); 00127 00128 bt_prev_team = new Button(Rectanglei(pos, Point2i(DEF_SIZE, DEF_SIZE)), 00129 res, "menu/arrow-left"); 00130 team_box->AddWidget(bt_prev_team); 00131 00132 pos.SetValues(pos.GetX()+DEF_SIZE, pos.GetY()); 00133 00134 HBox* tmp_box = new HBox( Rectanglei(pos, team_size), true); 00135 team_logo = new PictureWidget( Rectanglei(0,0,48,48) ); 00136 tmp_box->AddWidget(team_logo); 00137 00138 pos.SetValues(pos.GetX()+team_logo->GetSizeX(),pos.GetY()); 00139 team_name = new Label("", Rectanglei(pos, team_size-48), *big_font); 00140 tmp_box->AddWidget(team_name); 00141 00142 team_box->AddWidget(tmp_box); 00143 pos.SetValues(pos.GetX()+team_size.GetX(), pos.GetY()); 00144 bt_next_team = new Button(Rectanglei(pos, Point2i(DEF_SIZE, DEF_SIZE)), 00145 res, "menu/arrow-right"); 00146 team_box->AddWidget(bt_next_team); 00147 00148 widgets.AddWidget(team_box); 00149 00150 resource_manager.UnLoadXMLProfile(res); 00151 00152 //Results 00153 most_violent = new ResultBox(Rectanglei(x, y+int(1.5*max_height), total_width, max_height), 00154 true, _("Most violent"), *big_font, 00155 type_size, name_size, score_size); 00156 widgets.AddWidget(most_violent); 00157 00158 most_usefull = new ResultBox(Rectanglei(x, y+3*max_height, total_width, max_height), 00159 true, _("Most useful"), *big_font, 00160 type_size, name_size, score_size); 00161 widgets.AddWidget(most_usefull); 00162 00163 most_useless = new ResultBox(Rectanglei(x, y+int(4.5*max_height), total_width, max_height), 00164 true, _("Most useless"), *big_font, 00165 type_size, name_size, score_size); 00166 widgets.AddWidget(most_useless); 00167 00168 biggest_traitor = new ResultBox(Rectanglei(x, y+6*max_height, total_width, max_height), 00169 true, _("Most sold-out"), *big_font, 00170 type_size, name_size, score_size); 00171 widgets.AddWidget(biggest_traitor); 00172 00173 SetResult(0); 00174 }
Here is the call graph for this function:
ResultsMenu::~ResultsMenu | ( | ) |
void ResultsMenu::__sig_cancel | ( | ) | [inline, private, virtual] |
void ResultsMenu::__sig_ok | ( | ) | [inline, private, virtual] |
void ResultsMenu::Draw | ( | const Point2i & | mousePosition | ) | [private, virtual] |
void ResultsMenu::OnClic | ( | const Point2i & | mousePosition, | |
int | button | |||
) | [private, virtual] |
Implements Menu.
Definition at line 233 of file results_menu.cpp.
00234 { 00235 if (bt_prev_team->Contains(mousePosition)) 00236 SetResult(index-1); 00237 else if ( bt_next_team->Contains(mousePosition)) 00238 SetResult(index+1); 00239 }
Here is the call graph for this function:
void ResultsMenu::SetResult | ( | int | i | ) | [private] |
Definition at line 180 of file results_menu.cpp.
00181 { 00182 const Character* player = NULL; 00183 const TeamResults* res = NULL; 00184 std::string name; 00185 00186 index = i; 00187 if (index < 0) index = results->size()-1; 00188 else if (index>(int)results->size()-1) index = 0; 00189 res = (*results)[index]; 00190 assert(res); 00191 00192 //Team header 00193 name = res->getTeamName(); 00194 if (res->getTeamLogo() == NULL) { 00195 team_logo->SetNoSurface(); 00196 } else { 00197 team_logo->SetSurface( *(res->getTeamLogo()) ); 00198 } 00199 printf("Now result %i/%i: team '%s'\n", 00200 index, (int)results->size(), name.c_str()); 00201 team_name->SetText(name); 00202 team_box->ForceRedraw(); 00203 00204 //Most violent 00205 player = res->getMostViolent(); 00206 if(player) 00207 most_violent->SetResult(player->GetName(), player->GetMostDamage()); 00208 else 00209 most_violent->SetResult(_("Nobody!"), 0); 00210 00211 //Most usefull 00212 player = res->getMostUsefull(); 00213 if(player) 00214 most_usefull->SetResult(player->GetName(), player->GetOtherDamage()); 00215 else 00216 most_usefull->SetResult(_("Nobody!"), 0); 00217 00218 //Most usefull 00219 player = res->getMostUseless(); 00220 if(player) 00221 most_useless->SetResult(player->GetName(), player->GetOtherDamage()); 00222 else 00223 most_useless->SetResult(_("Nobody!"), 0); 00224 00225 // Biggest sold-out 00226 player = res->getBiggestTraitor(); 00227 if(player) 00228 biggest_traitor->SetResult(player->GetName(), player->GetOwnDamage()); 00229 else 00230 biggest_traitor->SetResult(_("Nobody!"), 0); 00231 }
Here is the call graph for this function:
Here is the caller graph for this function:
ResultBox* ResultsMenu::biggest_traitor [private] |
Definition at line 56 of file results_menu.h.
Button* ResultsMenu::bt_next_team [private] |
Definition at line 48 of file results_menu.h.
Button* ResultsMenu::bt_prev_team [private] |
Definition at line 47 of file results_menu.h.
int ResultsMenu::index [private] |
Definition at line 36 of file results_menu.h.
int ResultsMenu::max_height [private] |
Definition at line 40 of file results_menu.h.
ResultBox* ResultsMenu::most_usefull [private] |
Definition at line 54 of file results_menu.h.
ResultBox* ResultsMenu::most_useless [private] |
Definition at line 55 of file results_menu.h.
ResultBox* ResultsMenu::most_violent [private] |
Definition at line 53 of file results_menu.h.
Point2i ResultsMenu::name_size [private] |
Definition at line 43 of file results_menu.h.
const std::vector<TeamResults*>* ResultsMenu::results [private] |
Definition at line 35 of file results_menu.h.
Point2i ResultsMenu::score_size [private] |
Definition at line 44 of file results_menu.h.
HBox* ResultsMenu::team_box [private] |
Definition at line 51 of file results_menu.h.
PictureWidget* ResultsMenu::team_logo [private] |
Definition at line 49 of file results_menu.h.
Label* ResultsMenu::team_name [private] |
Definition at line 50 of file results_menu.h.
Point2i ResultsMenu::team_size [private] |
Definition at line 41 of file results_menu.h.
int ResultsMenu::total_width [private] |
Definition at line 39 of file results_menu.h.
Point2i ResultsMenu::type_size [private] |
Definition at line 42 of file results_menu.h.