diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-28 13:28:57 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-28 13:28:57 +0000 |
commit | abb51426f88797f0fe292e8f85d3f0794f4d41ab (patch) | |
tree | 1d0eb4a92b09323d35088003d4044645a9314fa5 /src/gui/stats.cpp | |
parent | 89000aed97146ef5c9bed22c4c87179a18edfee2 (diff) | |
download | mana-abb51426f88797f0fe292e8f85d3f0794f4d41ab.tar.gz mana-abb51426f88797f0fe292e8f85d3f0794f4d41ab.tar.bz2 mana-abb51426f88797f0fe292e8f85d3f0794f4d41ab.tar.xz mana-abb51426f88797f0fe292e8f85d3f0794f4d41ab.zip |
Some fixes to stats window.
Diffstat (limited to 'src/gui/stats.cpp')
-rw-r--r-- | src/gui/stats.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index 9de85b79..572d204f 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -22,13 +22,16 @@ */ #include "stats.h" +#include <sstream> /** * Constructor */ StatsWindow::StatsWindow(gcn::Container *parent) : Window(parent, "Stats") -{ +{ + std::stringstream statsStr[6]; + statsStr[0] << "Strenght: " << char_info->STR; statsStr[1] << "Agility: " << char_info->AGI; statsStr[2] << "Vitality: " << char_info->VIT; @@ -37,15 +40,15 @@ StatsWindow::StatsWindow(gcn::Container *parent) statsStr[5] << "Luck: " << char_info->LUK; /* New labels */ - for(i=0; i<5;i++) + for (i = 0; i < 6; i++) statsLabel[i] = new gcn::Label(statsStr[i].str()); /* New buttons */ - for(i=0; i<5;i++) + for (i = 0; i < 6; i++) statsButton[i] = new Button("+"); /* Set position */ - for(i=0;i<5;i++) { + for (i = 0; i < 6; i++) { statsLabel[i]->setPosition(10,(i*22)+10); statsButton[i]->setPosition(170,(i*22)+10); } @@ -59,12 +62,12 @@ StatsWindow::StatsWindow(gcn::Container *parent) statsButton[5]->setEventId("LUK"); /* Assemble */ - for(i=0; i<5; i++) { + for(i = 0; i < 6; i++) { add(statsLabel[i]); add(statsButton[i]); } - setSize(200,150); + setSize(200, 150); setLocationRelativeTo(getParent()); } @@ -72,7 +75,7 @@ StatsWindow::StatsWindow(gcn::Container *parent) * Destructor */ StatsWindow::~StatsWindow() { - for(int i=0; i<5; i++) { + for(int i = 0; i < 6; i++) { delete statsLabel[i]; delete statsButton[i]; } @@ -83,7 +86,7 @@ StatsWindow::~StatsWindow() { */ StatsWindow * StatsWindow::ptr = NULL; StatsWindow * StatsWindow::create_statswindow() { - if(ptr == NULL) + if (ptr == NULL) ptr = new StatsWindow(guiTop); else ptr->setVisible(true); @@ -94,17 +97,17 @@ StatsWindow * StatsWindow::create_statswindow() { * Event handling method */ void StatsWindow::action(const std::string& eventId) { - if(eventId == "STR") { + if (eventId == "STR") { setVisible(false); } - if(eventId == "AGI") + if (eventId == "AGI") setVisible(false); - if(eventId == "VIT") + if (eventId == "VIT") setVisible(false); - if(eventId == "INT") + if (eventId == "INT") setVisible(false); - if(eventId == "DEX") + if (eventId == "DEX") setVisible(false); - if(eventId == "LUK") + if (eventId == "LUK") setVisible(false); } |