diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2005-10-09 21:34:58 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2005-10-09 21:34:58 +0000 |
commit | 31047c05a9b56c101566301d81931c66bc4b9ecd (patch) | |
tree | 8646f4383a0297732e76227bc601cd0f80ec5151 /src/gui | |
parent | 2327c5a7c3b054e52b69286da906f8e5c4432d1c (diff) | |
download | mana-client-31047c05a9b56c101566301d81931c66bc4b9ecd.tar.gz mana-client-31047c05a9b56c101566301d81931c66bc4b9ecd.tar.bz2 mana-client-31047c05a9b56c101566301d81931c66bc4b9ecd.tar.xz mana-client-31047c05a9b56c101566301d81931c66bc4b9ecd.zip |
Corrected the white browser font bug and the black hp/mp bug which were linked. Added a debug window.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 1 | ||||
-rw-r--r-- | src/gui/debugwindow.cpp | 115 | ||||
-rw-r--r-- | src/gui/debugwindow.h | 73 | ||||
-rw-r--r-- | src/gui/ministatus.cpp | 4 |
4 files changed, 191 insertions, 2 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 23da7225..9a8aed34 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -251,6 +251,7 @@ void BrowserBox::draw(gcn::Graphics* graphics) unsigned int i, j; int x = 0, y = 0; int wrappedLines = 0; + graphics->setColor(BLACK); for (i = 0; i < mTextRows.size(); i++) { int selColor = BLACK; diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp new file mode 100644 index 00000000..3823ab6a --- /dev/null +++ b/src/gui/debugwindow.cpp @@ -0,0 +1,115 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "debugwindow.h" + +#include <guichan/widgets/label.hpp> +#include "button.h" +#include <sstream> +#include "minimap.h" +#include "../game.h" +#include "../graphics.h" +#include "../engine.h" +extern Graphics *graphics; +extern Minimap *minimap; +extern int frame; + +DebugWindow::DebugWindow(): + Window("Debug") +{ + setWindowName("Debug"); + + setResizable(true); + setDefaultSize(0, 0, 400, 100); + loadWindowState(); + + FPSLabel = new gcn::Label("[0 FPS]"); + FPSLabel->setPosition(0,0); + musicFileLabel = new gcn::Label("Music File: "); + musicFileLabel->setPosition(0, 20); + mapFileLabel = new gcn::Label("Mini-Map File: "); + mapFileLabel->setPosition(0, 40); + tileMouseLabel = new gcn::Label("[Mouse: 0, 0]"); + tileMouseLabel->setPosition(100, 0); + closeButton = new Button("Close"); + closeButton->setEventId("close"); + closeButton->setPosition(5, 60); + closeButton->addActionListener(this); + + add(FPSLabel); + add(musicFileLabel); + add(mapFileLabel); + add(tileMouseLabel); + add(closeButton); +} + +DebugWindow::~DebugWindow() +{ + delete FPSLabel; + delete musicFileLabel; + delete mapFileLabel; + delete tileMouseLabel; + delete closeButton; +} + +void DebugWindow::logic() +{ + // Get the current mouse position + int mouseX, mouseY; + SDL_GetMouseState(&mouseX, &mouseY); + int mouseTileX = mouseX / 32 + camera_x; + int mouseTileY = mouseY / 32 + camera_y; + +std::stringstream updatedText; + updatedText << "[" << fps << " FPS]"; + FPSLabel->setCaption(updatedText.str()); + FPSLabel->adjustSize(); + + updatedText.str(""); + updatedText << "[Mouse: " << mouseTileX << ", " << mouseTileY << "]"; + tileMouseLabel->setCaption(updatedText.str()); + tileMouseLabel->adjustSize(); + + updatedText.str(""); + mCurrentMap = engine->getCurrentMap(); + if (mCurrentMap != NULL) + { + updatedText + << " [Music File: " << mCurrentMap->getProperty("music") << "]"; + musicFileLabel->setCaption(updatedText.str()); + musicFileLabel->adjustSize(); + updatedText.str(""); + updatedText + << " [MiniMap File: " << mCurrentMap->getProperty("minimap") << "]"; + mapFileLabel->setCaption(updatedText.str()); + mapFileLabel->adjustSize(); + } +} + +void DebugWindow::action(const std::string& eventId) +{ + if (eventId == "close") + { + setVisible(false); + } +} diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h new file mode 100644 index 00000000..f2efc31c --- /dev/null +++ b/src/gui/debugwindow.h @@ -0,0 +1,73 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_DEBUGWINDOW_H +#define _TMW_DEBUGWINDOW_H + +#include <string> + +#include <guichan/actionlistener.hpp> + +#include "window.h" +#include "map.h" +#include "../guichanfwd.h" + +/** + * The chat window. + * + * \ingroup Interface + */ +class DebugWindow : public Window, public gcn::ActionListener +{ + public: + /** + * Constructor. + */ + DebugWindow(); + + /** + * Destructor. + */ + ~DebugWindow(); + + /** + * Logic (updates components' size and infos) + */ + void logic(); + + /** + * Performs action. + */ + void action(const std::string &actionId); + + private: + gcn::Label *musicFileLabel, *mapFileLabel; + gcn::Label *tileMouseLabel, *FPSLabel; + gcn::Button *closeButton; + Map *mCurrentMap; + +}; + +extern DebugWindow *debugWindow; + +#endif diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 438470d8..9d423a7e 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -50,10 +50,10 @@ MiniStatusWindow::MiniStatusWindow(): hpLabel = new gcn::Label(""); mpLabel = new gcn::Label(""); + hpLabel->setForegroundColor(gcn::Color(255, 255, 255)); + mpLabel->setForegroundColor(gcn::Color(255, 255, 255)); hpLabel->setFont(speechFont); mpLabel->setFont(speechFont); - hpLabel->setForegroundColor(gcn::Color(255,255,255)); - mpLabel->setForegroundColor(gcn::Color(255,255,255)); add(hpBar); add(mpBar); |