diff options
author | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-06-18 12:06:24 +0000 |
---|---|---|
committer | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-06-18 12:06:24 +0000 |
commit | 275b80eca0ecc71262b4ca8aeba6e7501f711d43 (patch) | |
tree | f9d6e1d320056b90d22906a4e4dca045b388890b /src | |
parent | 80b43a59d63c3632cf9499f46f5224ec20ec6ff8 (diff) | |
download | mana-275b80eca0ecc71262b4ca8aeba6e7501f711d43.tar.gz mana-275b80eca0ecc71262b4ca8aeba6e7501f711d43.tar.bz2 mana-275b80eca0ecc71262b4ca8aeba6e7501f711d43.tar.xz mana-275b80eca0ecc71262b4ca8aeba6e7501f711d43.zip |
Removed old menu/menuitem and replaced by JAvila one
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/engine.cpp | 51 | ||||
-rw-r--r-- | src/engine.h | 2 | ||||
-rw-r--r-- | src/game.cpp | 44 |
4 files changed, 2 insertions, 99 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5f615055..2c79db79 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,10 +44,6 @@ tmw_SOURCES = graphic/spriteset.cpp \ gui/listbox.h \ gui/login.cpp \ gui/login.h \ - gui/menuitem.h \ - gui/menuitem.cpp \ - gui/menu.h \ - gui/menu.cpp \ gui/minimap.cpp \ gui/minimap.h \ gui/newskill.cpp \ diff --git a/src/engine.cpp b/src/engine.cpp index 8bede976..76edc0b5 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -63,7 +63,6 @@ EquipmentWindow *equipmentWindow; ChargeDialog *chargeDialog; TradeWindow *tradeWindow; BuddyWindow *buddyWindow; -Menu *menu; HelpWindow *helpWindow; PopupMenu *popupMenu; std::map<int, Spriteset*> monsterset; @@ -88,36 +87,6 @@ char hairtable[16][4][2] = { { { 0, 16}, {-1, 6}, {-1, 6}, { 0, 6} } // DEAD }; -/** - * Listener used for trading request - */ -class tradeItemListener : public gcn::MouseListener -{ - void mouseClick(int x, int y, int button, int count) - { - Being *target = menu->getBeing(); - - // Begin a trade - WFIFOW(0) = net_w_value(0x00e4); - WFIFOL(2) = net_l_value(target->id); - WFIFOSET(6); - std::cout << "Clicked trade" << std::endl; - menu->setVisible(!menu->isVisible()); - } -}; - -/** - * Listener used for buddy request - */ -class buddyItemListener : public gcn::MouseListener -{ - void mouseClick(int x, int y, int button, int count) - { - std::cout << "Clicked buddy" << std::endl; - //buddyWindow->setVisible(!buddyWindow->isVisible()); - menu->setVisible(!menu->isVisible()); - } -}; int get_x_offset(Being *being) { @@ -198,21 +167,6 @@ Engine::Engine(): helpWindow = new HelpWindow(); popupMenu = new PopupMenu(); - /** - * Menu items - */ - std::vector<MenuItem*> items; - - MenuItem *tradeItem = new MenuItem("Trade"); - tradeItem->addMouseListener(new tradeItemListener()); - items.push_back(tradeItem); - - MenuItem *buddyItem = new MenuItem("Buddy"); - buddyItem->addMouseListener(new buddyItemListener()); - items.push_back(buddyItem); - - menu = new Menu(items); - // Initialize window posisitons chatWindow->setPosition(0, screen->h - chatWindow->getHeight()); statusWindow->setPosition(screen->w - statusWindow->getWidth() - 5, 5); @@ -230,8 +184,7 @@ Engine::Engine(): buddyWindow->setPosition(10, minimap->getHeight() + 30); equipmentWindow->setPosition(5,140); - menu->setPosition(5,140); - + // Set initial window visibility chatWindow->setVisible(true); statusWindow->setVisible(true); @@ -249,7 +202,6 @@ Engine::Engine(): chargeDialog->setVisible(false); tradeWindow->setVisible(false); buddyWindow->setVisible(false); - menu->setVisible(false); helpWindow->setVisible(false); popupMenu->setVisible(false); @@ -298,7 +250,6 @@ Engine::~Engine() delete newSkillWindow; delete tradeWindow; delete buddyWindow; - delete menu; delete helpWindow; delete popupMenu; diff --git a/src/engine.h b/src/engine.h index 722cb287..1a4c3b70 100644 --- a/src/engine.h +++ b/src/engine.h @@ -41,7 +41,6 @@ #include "gui/setup.h" #include "gui/equipment.h" #include "gui/chargedialog.h" -#include "gui/menu.h" #include "gui/trade.h" #include "gui/help.h" #include "gui/popupmenu.h" @@ -73,7 +72,6 @@ extern EquipmentWindow *equipmentWindow; extern ChargeDialog* chargeDialog; extern TradeWindow *tradeWindow; extern BuddyWindow *buddyWindow; -extern Menu *menu; extern HelpWindow *helpWindow; extern PopupMenu *popupMenu; extern std::map<int, Spriteset*> monsterset; diff --git a/src/game.cpp b/src/game.cpp index 1023be99..2ccb49f5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -391,51 +391,9 @@ void do_input() int mx = event.button.x / 32 + camera_x; int my = event.button.y / 32 + camera_y; -//================================ By Javila ===============================// - /** - * NOTES: - * - added here just for testing purposes. I think it's better - * add to right mouse button, and put the actual right mouse - * button function as "default" actions in left mouse button. - * - the popup menu can't handle keyboard action/navigation. For - * keyboard input I think we can add slash (/) commands. - */ - if (event.button.button == 2) - { - popupMenu->showPopup(mx, my); - } -//==========================================================================// - if (event.button.button == 3) { - Being *target = findNode(mx, my); - if (target) { - if (target->isNpc()) { - // Check if no conflicting NPC window is open - if (current_npc == 0) - { - WFIFOW(0) = net_w_value(0x0090); - WFIFOL(2) = net_l_value(target->id); - WFIFOB(6) = 0; - WFIFOSET(7); - current_npc = target->id; - } - } - else if (target->isMonster()) { - if (keys[SDLK_LSHIFT]) { - if (target->action != MONSTER_DEAD) { - autoTarget = target; - } - } - attack(target); - } - else if (target->isPlayer()) { - // Show menu - menu->setVisible(!menu->isVisible()); - // Pass target to menu - menu->setBeing(target); - } - } + popupMenu->showPopup(mx, my); } } else if (event.type == SDL_QUIT) |