diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-14 22:25:54 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-14 22:25:54 +0000 |
commit | 8e1c3b592c9ebcec9e006bcc54eea55bfea4a864 (patch) | |
tree | 134de69274dad771a4cd9297a0a0617ed28a0543 /src/gui | |
parent | 0ce6e9e8400c326e6848688b3b865c84d96e3073 (diff) | |
download | mana-client-8e1c3b592c9ebcec9e006bcc54eea55bfea4a864.tar.gz mana-client-8e1c3b592c9ebcec9e006bcc54eea55bfea4a864.tar.bz2 mana-client-8e1c3b592c9ebcec9e006bcc54eea55bfea4a864.tar.xz mana-client-8e1c3b592c9ebcec9e006bcc54eea55bfea4a864.zip |
Removed guiGraphics global pointer and removed dependencies on gui.h in some places.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 6 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 5 | ||||
-rw-r--r-- | src/gui/chat.cpp | 6 | ||||
-rw-r--r-- | src/gui/gui.cpp | 9 | ||||
-rw-r--r-- | src/gui/gui.h | 1 | ||||
-rw-r--r-- | src/gui/login.cpp | 6 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/setup.cpp | 7 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/window.cpp | 13 |
10 files changed, 33 insertions, 31 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 8ed24bde..6c8a844b 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -46,6 +46,8 @@ #include "../net/network.h" #include "../net/protocol.h" +extern Graphics *graphics; + CharSelectDialog::CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m): ConfirmDialog(m, "Confirm", "Are you sure you want to delete this character?"), @@ -479,9 +481,9 @@ void charSelect() gui->logic(); - guiGraphics->drawImage(login_wallpaper, 0, 0); + graphics->drawImage(login_wallpaper, 0, 0); gui->draw(); - guiGraphics->updateScreen(); + graphics->updateScreen(); } delete sel; diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 2f86590e..268cb8bd 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -39,6 +39,7 @@ #include "../net/network.h" +extern Graphics *graphics; char server[30]; int showServerList = 1; @@ -153,9 +154,9 @@ void char_server() { gui->logic(); - guiGraphics->drawImage(login_wallpaper, 0, 0); + graphics->drawImage(login_wallpaper, 0, 0); gui->draw(); - guiGraphics->updateScreen(); + graphics->updateScreen(); } delete dialog; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 16a1b662..ca24ac47 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -23,9 +23,10 @@ #include "chat.h" +#include <guichan/focushandler.hpp> + #include "browserbox.h" #include "chatinput.h" -#include "gui.h" #include "scrollarea.h" #include "../playerinfo.h" @@ -143,7 +144,6 @@ void ChatWindow::chat_log(std::string line, int own) line = lineColor + tmp.nick + line; textOutput->addRow(line); - textOutput->draw(gui->getGraphics()); scrollArea->setVerticalScrollAmount(scrollArea->getVerticalMaxScroll()); } @@ -175,7 +175,7 @@ void ChatWindow::action(const std::string& eventId) } // Remove focus and hide input - gui->focusNone(); + mFocusHandler->focusNone(); } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 95cd85d7..f77ad0be 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -55,7 +55,6 @@ extern Being* autoTarget; // Guichan stuff Gui *gui; -Graphics *guiGraphics; // Graphics driver gcn::SDLInput *guiInput; // GUI input WindowContainer *guiTop; // The top container @@ -71,8 +70,6 @@ Gui::Gui(Graphics *graphics): mMouseCursor(NULL), mCustomCursor(false) { - guiGraphics = graphics; - //setGraphics(graphics); #ifdef USE_OPENGL if (useOpenGL) { // Set graphics @@ -195,7 +192,7 @@ void Gui::logic() void Gui::draw() { - guiGraphics->pushClipArea(guiTop->getDimension()); + mGraphics->pushClipArea(guiTop->getDimension()); guiTop->draw(mGraphics); int mouseX, mouseY; @@ -204,10 +201,10 @@ void Gui::draw() if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) && mCustomCursor) { - guiGraphics->drawImage(mMouseCursor, mouseX - 5, mouseY - 2); + dynamic_cast<Graphics*>(mGraphics)->drawImage(mMouseCursor, mouseX - 5, mouseY - 2); } - guiGraphics->popClipArea(); + mGraphics->popClipArea(); } void Gui::mousePress(int mx, int my, int button) diff --git a/src/gui/gui.h b/src/gui/gui.h index 1075910e..a8e602ff 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -106,7 +106,6 @@ class Gui : public gcn::Gui, public gcn::MouseListener, ConfigListener extern Gui *gui; /**< The GUI system */ extern WindowContainer *guiTop; /**< The top container */ -extern Graphics *guiGraphics; /**< Graphics driver */ extern gcn::SDLInput *guiInput; /**< GUI input */ /** diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 09e9c925..180a7f29 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -44,6 +44,8 @@ #include "../net/network.h" +extern Graphics *graphics; + LoginDialog::LoginDialog(): Window("Login") { @@ -215,9 +217,9 @@ void login() gui->logic(); - guiGraphics->drawImage(login_wallpaper, 0, 0); + graphics->drawImage(login_wallpaper, 0, 0); gui->draw(); - guiGraphics->updateScreen(); + graphics->updateScreen(); } delete dialog; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 17ca9edb..a5a6128b 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -29,9 +29,9 @@ #include <guichan/focushandler.hpp> #include "browserbox.h" -#include "gui.h" #include "inventorywindow.h" #include "item_amount.h" +#include "windowcontainer.h" #include "../being.h" #include "../floor_item.h" @@ -254,9 +254,9 @@ void PopupMenu::showPopup(int x, int y, Item *item) void PopupMenu::showPopup(int x, int y) { setContentSize(browserBox->getWidth() + 8, browserBox->getHeight() + 8); - if (guiGraphics->getWidth() < (x + getWidth() + 5)) + if (windowContainer->getWidth() < (x + getWidth() + 5)) x -= (getWidth() + 50); - if (guiGraphics->getHeight() < (y + getHeight() + 5)) + if (windowContainer->getHeight() < (y + getHeight() + 5)) y -= (getHeight() + 50); setPosition(x, y); setVisible(true); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index fa58d03b..4d00255b 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -30,7 +30,6 @@ #include "button.h" #include "checkbox.h" -#include "gui.h" #include "listbox.h" #include "ok_dialog.h" #include "scrollarea.h" @@ -44,6 +43,8 @@ #define SETUP_WIDTH 240 +extern Graphics *graphics; + ModeListModel::ModeListModel() { SDL_Rect **modes; @@ -247,10 +248,10 @@ void Setup::action(const std::string &eventId) bool fullscreen = fsCheckBox->isMarked(); if (fullscreen != (config.getValue("screen", 0) == 1)) { - if (!guiGraphics->setFullscreen(fullscreen)) + if (!graphics->setFullscreen(fullscreen)) { fullscreen = !fullscreen; - if (!guiGraphics->setFullscreen(fullscreen)) + if (!graphics->setFullscreen(fullscreen)) { std::cerr << "Failed to switch to " << (fullscreen ? "windowed" : "fullscreen") << diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 480372d3..c2220ada 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -48,6 +48,7 @@ #include "../resources/resourcemanager.h" +extern Graphics *graphics; UpdaterWindow::UpdaterWindow(): Window("Updating...") @@ -415,9 +416,9 @@ void UpdaterWindow::updateData() gui->logic(); - guiGraphics->drawImage(login_wallpaper, 0, 0); + graphics->drawImage(login_wallpaper, 0, 0); gui->draw(); - guiGraphics->updateScreen(); + graphics->updateScreen(); } if (mThread) diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 2ded3858..07b85ea5 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -25,7 +25,6 @@ #include <guichan/exception.hpp> -#include "gui.h" #include "windowcontainer.h" #include "../configuration.h" @@ -310,26 +309,26 @@ void Window::mouseMotion(int x, int y) newDim.y = 0; } - if (newDim.x + newDim.width > guiGraphics->getWidth()) + if (newDim.x + newDim.width > windowContainer->getWidth()) { if (mMouseResize) { - newDim.width = guiGraphics->getWidth() - newDim.x; + newDim.width = windowContainer->getWidth() - newDim.x; } else { - newDim.x = guiGraphics->getWidth() - newDim.width; + newDim.x = windowContainer->getWidth() - newDim.width; } } - if (newDim.y + newDim.height > guiGraphics->getHeight()) + if (newDim.y + newDim.height > windowContainer->getHeight()) { if (mMouseResize) { - newDim.height = guiGraphics->getHeight() - newDim.y; + newDim.height = windowContainer->getHeight() - newDim.y; } else { - newDim.y = guiGraphics->getHeight() - newDim.height; + newDim.y = windowContainer->getHeight() - newDim.height; } } |