Redesign the network and game info menus

This commit is contained in:
simon.kagstrom 2010-02-23 20:10:45 +00:00
parent a3a9e1ce0d
commit 8e77843d81
8 changed files with 25 additions and 23 deletions

View File

@ -209,5 +209,5 @@ void DiscView::draw(SDL_Surface *where)
SDL_BlitSurface(Gui::gui->disc_info, NULL, where, &dst); SDL_BlitSurface(Gui::gui->disc_info, NULL, where, &dst);
this->menu->draw(where, 50, 70, 280, 375); this->menu->draw(where, 50, 70, 280, 375);
this->gameInfo->draw(where, 360, 55, 262, 447); this->gameInfo->draw(where, 390, 55, 242, 447);
} }

View File

@ -61,32 +61,28 @@ public:
dst = (SDL_Rect){x + w / 2 - this->gi->screenshot->w / 2, y, w, h}; dst = (SDL_Rect){x + w / 2 - this->gi->screenshot->w / 2, y, w, h};
SDL_BlitSurface(this->gi->screenshot, NULL, where, &dst); SDL_BlitSurface(this->gi->screenshot, NULL, where, &dst);
Menu::draw(where, x, y + this->gi->screenshot->h + 10, Menu::draw(where, x + 20, y + this->gi->screenshot->h + 10,
w, h - this->gi->screenshot->h - 10); w - 20, h - this->gi->screenshot->h - 10);
} }
else else
Menu::draw(where, x, y + 10, w, h - 10); Menu::draw(where, x + 20, y + 288 / 2 + 2, w - 20, h - 10);
} }
void updateMessages() void updateMessages()
{ {
this->setText(NULL); this->setText(NULL);
memset(this->gi_messages, 0, sizeof(this->gi_messages));
this->gi_messages[0] = "Game:"; for (unsigned i = 0; i < ARRAY_SIZE(this->gi_messages) - 1; i++)
this->gi_messages[1] = " "; this->gi_messages[i] = " ";
this->gi_messages[2] = "Author:"; this->gi_messages[ARRAY_SIZE(this->gi_messages) - 1] = NULL;
this->gi_messages[3] = " ";
this->gi_messages[4] = "Year:";
this->gi_messages[5] = " ";
if (this->gi) if (this->gi)
{ {
snprintf(this->year, sizeof(this->year), "%d", this->gi->year); snprintf(this->year, sizeof(this->year), "%d", this->gi->year);
this->gi_messages[1] = this->gi->name ? this->gi->name : " "; this->gi_messages[0] = this->gi->name ? this->gi->name : " ";
this->gi_messages[3] = this->gi->author ? this->gi->author : " "; this->gi_messages[3] = this->gi->author ? this->gi->author : " ";
this->gi_messages[5] = year;
} }
this->gi_messages[6] = year;
this->setText(this->gi_messages); this->setText(this->gi_messages);
} }

View File

@ -139,7 +139,7 @@ public:
SDL_BlitSurface(Gui::gui->disc_info, NULL, where, &dst); SDL_BlitSurface(Gui::gui->disc_info, NULL, where, &dst);
this->menu->draw(where, 50, 70, 280, 375); this->menu->draw(where, 50, 70, 280, 375);
this->gameInfo->draw(where, 360, 55, 262, 447); this->gameInfo->draw(where, 390, 55, 242, 447);
} }
protected: protected:

View File

@ -84,6 +84,7 @@ Gui::Gui()
this->keyboard = NULL; this->keyboard = NULL;
this->default_font = NULL; this->default_font = NULL;
this->dialogue_bg = NULL; this->dialogue_bg = NULL;
this->network_info = NULL;
this->small_font = NULL; this->small_font = NULL;
this->n_views = 0; this->n_views = 0;
@ -153,6 +154,7 @@ Gui::~Gui()
SDL_FreeSurface(this->infobox); SDL_FreeSurface(this->infobox);
SDL_FreeSurface(this->dialogue_bg); SDL_FreeSurface(this->dialogue_bg);
SDL_FreeSurface(this->disc_info); SDL_FreeSurface(this->disc_info);
SDL_FreeSurface(this->network_info);
SDL_FreeSurface(this->textbox); SDL_FreeSurface(this->textbox);
SDL_FreeSurface(this->selected_key); SDL_FreeSurface(this->selected_key);
SDL_FreeSurface(this->highlighted_key); SDL_FreeSurface(this->highlighted_key);
@ -181,6 +183,7 @@ bool Gui::setTheme(const char *path)
this->textbox = this->loadThemeImage(path, "textbox.png"); this->textbox = this->loadThemeImage(path, "textbox.png");
this->dialogue_bg = this->loadThemeImage(path, "dialogue_box.png"); this->dialogue_bg = this->loadThemeImage(path, "dialogue_box.png");
this->disc_info = this->loadThemeImage(path, "disc_info.png"); this->disc_info = this->loadThemeImage(path, "disc_info.png");
this->network_info = this->loadThemeImage(path, "network_info.png");
this->highlighted_key = this->loadThemeImage(path, "highlighted_key.png"); this->highlighted_key = this->loadThemeImage(path, "highlighted_key.png");
this->selected_key = this->loadThemeImage(path, "selected_key.png"); this->selected_key = this->loadThemeImage(path, "selected_key.png");
@ -196,6 +199,7 @@ bool Gui::setTheme(const char *path)
!this->selected_key || !this->selected_key ||
!this->highlighted_key || !this->highlighted_key ||
!this->status_bar_bg || !this->status_bar_bg ||
!this->network_info ||
!this->default_font || !this->default_font ||
!this->small_font) !this->small_font)
{ {
@ -207,6 +211,7 @@ bool Gui::setTheme(const char *path)
SDL_FreeSurface(this->bg_submenu_right); SDL_FreeSurface(this->bg_submenu_right);
SDL_FreeSurface(this->background); SDL_FreeSurface(this->background);
SDL_FreeSurface(this->main_menu_bg); SDL_FreeSurface(this->main_menu_bg);
SDL_FreeSurface(this->network_info);
SDL_FreeSurface(this->infobox); SDL_FreeSurface(this->infobox);
SDL_FreeSurface(this->dialogue_bg); SDL_FreeSurface(this->dialogue_bg);
SDL_FreeSurface(this->disc_info); SDL_FreeSurface(this->disc_info);

View File

@ -91,6 +91,7 @@ public:
SDL_Surface *keyboard; SDL_Surface *keyboard;
SDL_Surface *dialogue_bg; SDL_Surface *dialogue_bg;
SDL_Surface *disc_info; SDL_Surface *disc_info;
SDL_Surface *network_info;
SDL_Surface *bg_left, *bg_right, *bg_middle, SDL_Surface *bg_left, *bg_right, *bg_middle,
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle; *bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
SDL_Surface *highlighted_key; SDL_Surface *highlighted_key;

View File

@ -102,7 +102,7 @@ public:
dst = (SDL_Rect){x + w / 2 - screenshot->w / 2, y, w, h}; dst = (SDL_Rect){x + w / 2 - screenshot->w / 2, y, w, h};
SDL_BlitSurface(screenshot, NULL, where, &dst); SDL_BlitSurface(screenshot, NULL, where, &dst);
Menu::draw(where, x, y + screenshot->h + 10, w, h - screenshot->h - 10); Menu::draw(where, x + 20, y + screenshot->h + 10, w - 20, h - screenshot->h - 10);
} }
@ -111,12 +111,12 @@ public:
this->setText(NULL); this->setText(NULL);
memset(this->pi_messages, 0, sizeof(this->pi_messages)); memset(this->pi_messages, 0, sizeof(this->pi_messages));
this->pi_messages[0] = "Name:"; this->pi_messages[0] = " ";
this->pi_messages[1] = " "; this->pi_messages[1] = "Name:";
this->pi_messages[2] = "Region:"; this->pi_messages[2] = " ";
this->pi_messages[3] = " "; this->pi_messages[3] = "Region:";
this->pi_messages[4] = " "; /* Maybe add something here later */ this->pi_messages[4] = " ";
this->pi_messages[5] = " "; this->pi_messages[5] = " "; /* Maybe add something here later */
if (this->pi) if (this->pi)
{ {
@ -252,8 +252,8 @@ void NetworkUserView::draw(SDL_Surface *where)
SDL_BlitSurface(Gui::gui->main_menu_bg, NULL, where, &dst); SDL_BlitSurface(Gui::gui->main_menu_bg, NULL, where, &dst);
dst = (SDL_Rect){350,13,0,0}; dst = (SDL_Rect){350,13,0,0};
SDL_BlitSurface(Gui::gui->disc_info, NULL, where, &dst); SDL_BlitSurface(Gui::gui->network_info, NULL, where, &dst);
this->menu->draw(where, 50, 70, 280, 375); this->menu->draw(where, 50, 70, 280, 375);
this->peerInfo->draw(where, 360, 55, 262, 447); this->peerInfo->draw(where, 390, 55, 242, 447);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB