diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine.cpp | 42 | ||||
-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 |
11 files changed, 54 insertions, 52 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 1f255456..a79319f1 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -202,8 +202,8 @@ Engine::Engine(): popupMenu = new PopupMenu(); // Initialize window posisitons - int screenW = guiGraphics->getWidth(); - int screenH = guiGraphics->getHeight(); + int screenW = graphics->getWidth(); + int screenH = graphics->getHeight(); chatWindow->setPosition(0, screenH - chatWindow->getHeight()); statusWindow->setPosition(screenW - statusWindow->getWidth() - 5, 5); @@ -356,8 +356,8 @@ void Engine::draw() int mouseX, mouseY; SDL_GetMouseState(&mouseX, &mouseY); - int midTileX = guiGraphics->getWidth() / 32 / 2; - int midTileY = guiGraphics->getHeight() / 32 / 2; + int midTileX = graphics->getWidth() / 32 / 2; + int midTileY = graphics->getHeight() / 32 / 2; int map_x = (player_node->x - midTileX) * 32 + get_x_offset(player_node); int map_y = (player_node->y - midTileY) * 32 + get_y_offset(player_node); @@ -390,8 +390,8 @@ void Engine::draw() // Draw tiles below nodes if (mCurrentMap != NULL) { - mCurrentMap->draw(guiGraphics, map_x, map_y, 0); - mCurrentMap->draw(guiGraphics, map_x, map_y, 1); + mCurrentMap->draw(graphics, map_x, map_y, 0); + mCurrentMap->draw(graphics, map_x, map_y, 1); } // Draw items @@ -402,7 +402,7 @@ void Engine::draw() Image *image = itemset->spriteset[itemDb->getItemInfo( floorItem->id)->getImage() - 1]; - guiGraphics->drawImage(image, + graphics->drawImage(image, floorItem->x * 32 - map_x, floorItem->y * 32 - map_y); } } @@ -417,8 +417,8 @@ void Engine::draw() int y = being->y * 32 - map_y; #ifdef DEBUG - guiGraphics->setColor(gcn::Color(0, 0, 255)); - guiGraphics->drawRectangle(gcn::Rectangle(x & ~31, y & ~31, 32, 32)); + graphics->setColor(gcn::Color(0, 0, 255)); + graphics->drawRectangle(gcn::Rectangle(x & ~31, y & ~31, 32, 32)); #endif int frame; switch (being->getType()) @@ -439,7 +439,7 @@ void Engine::draw() frame += 4 * (being->getWeapon() - 1); } - guiGraphics->drawImage(playerset->spriteset[frame + 16 * dir], + graphics->drawImage(playerset->spriteset[frame + 16 * dir], being->text_x - 16, being->text_y - 32); //if (being->action == ATTACK) @@ -450,7 +450,7 @@ void Engine::draw() Image *image = weaponset->spriteset[ 16 * (being->getWeapon() - 1) + 4 * being->frame + dir]; - guiGraphics->drawImage(image, + graphics->drawImage(image, being->text_x - 64, being->text_y - 80); } @@ -458,13 +458,13 @@ void Engine::draw() int hf = being->getHairColor() - 1 + 10 * (dir + 4 * (being->getHairStyle() - 1)); - guiGraphics->drawImage(hairset->spriteset[hf], + graphics->drawImage(hairset->spriteset[hf], being->text_x - 2 + 2 * hairtable[frame][dir][0], being->text_y - 50 + 2 * hairtable[frame][dir][1]); } if (being->emotion != 0) { - guiGraphics->drawImage( + graphics->drawImage( emotionset->spriteset[being->emotion - 1], being->text_x + 3, being->text_y - 90); } @@ -478,7 +478,7 @@ void Engine::draw() // Draw a NPC case Being::NPC: - guiGraphics->drawImage(npcset->spriteset[being->job - 100], + graphics->drawImage(npcset->spriteset[being->job - 100], x - 8, y - 52); break; @@ -495,18 +495,18 @@ void Engine::draw() frame = being->frame + being->action; if (being->action == Being::MONSTER_DEAD) { - guiGraphics->drawImage( + graphics->drawImage( monsterset[being->job - 1002]->spriteset[dir + 4 * Being::MONSTER_DEAD], being->text_x + 30, being->text_y + 40); } else { - guiGraphics->drawImage( + graphics->drawImage( monsterset[being->job-1002]->spriteset[dir + 4 * frame], being->text_x + 30, being->text_y + 40); if (being->x == mouseTileX && being->y == mouseTileY) { - guiGraphics->drawImage(attackTarget, + graphics->drawImage(attackTarget, being->text_x + 30 + 16, being->text_y + 32); } } @@ -539,7 +539,7 @@ void Engine::draw() // Draw tiles below nodes if (mCurrentMap != NULL) { - mCurrentMap->draw(guiGraphics, map_x, map_y, 2); + mCurrentMap->draw(graphics, map_x, map_y, 2); } // Find a path from the player to the mouse, and draw it. This is for debug @@ -557,14 +557,14 @@ void Engine::draw() int squareX = node.x * 32 - map_x + 12; int squareY = node.y * 32 - map_y + 12; - guiGraphics->setColor(gcn::Color(255, 0, 0)); + graphics->setColor(gcn::Color(255, 0, 0)); graphics->fillRectangle(gcn::Rectangle(squareX, squareY, 8, 8)); MetaTile *tile = mCurrentMap->getMetaTile(node.x, node.y); std::stringstream cost; cost << tile->Gcost; - guiGraphics->drawText(cost.str(), squareX + 4, squareY + 12, + graphics->drawText(cost.str(), squareX + 4, squareY + 12, gcn::Graphics::CENTER); } } @@ -574,7 +574,7 @@ void Engine::draw() { Being *being = (*i); - being->drawSpeech(guiGraphics); + being->drawSpeech(graphics); } if (autoTarget) { 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; } } |