summaryrefslogtreecommitdiff
path: root/src/gui/widgets/playerbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-10-10 22:14:45 +0300
committerAndrei Karas <akaras@inbox.ru>2017-10-10 22:15:57 +0300
commitaa3f63fd497558a02feb3ddbc44f31eac091f39b (patch)
tree0e28b9b1f0501dd8be9e1a38db4ec1777fa3fbfa /src/gui/widgets/playerbox.cpp
parent7c10a6b61e9d06a4ae9cc9f942dfacb6fcfd9d3d (diff)
downloadplus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.gz
plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.bz2
plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.xz
plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.zip
Remove most unused files.
Diffstat (limited to 'src/gui/widgets/playerbox.cpp')
-rw-r--r--src/gui/widgets/playerbox.cpp190
1 files changed, 0 insertions, 190 deletions
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
deleted file mode 100644
index b6217383f..000000000
--- a/src/gui/widgets/playerbox.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/playerbox.h"
-
-#include "settings.h"
-
-#include "being/being.h"
-
-#include "gui/gui.h"
-#include "gui/skin.h"
-
-#include "render/graphics.h"
-
-#include "resources/image/image.h"
-
-#include "debug.h"
-
-PlayerBox::PlayerBox(Widget2 *const widget,
- Being *const being,
- const std::string &skin,
- const std::string &selectedSkin) :
- Widget(widget),
- MouseListener(),
- mBeing(being),
- mAlpha(1.0),
- mBackground(),
- mSelectedBackground(),
- mSkin(nullptr),
- mSelectedSkin(nullptr),
- mOffsetX(-mapTileSize / 2),
- mOffsetY(-mapTileSize),
- mDrawBackground(false),
- mSelected(false)
-{
- init(skin, selectedSkin);
-}
-
-PlayerBox::PlayerBox(Widget2 *const widget,
- const std::string &skin,
- const std::string &selectedSkin) :
- Widget(widget),
- MouseListener(),
- mBeing(nullptr),
- mAlpha(1.0),
- mBackground(),
- mSelectedBackground(),
- mSkin(nullptr),
- mSelectedSkin(nullptr),
- mOffsetX(-mapTileSize / 2),
- mOffsetY(-mapTileSize),
- mDrawBackground(false),
- mSelected(false)
-{
- init(skin, selectedSkin);
-}
-
-PlayerBox::~PlayerBox()
-{
- if (gui != nullptr)
- gui->removeDragged(this);
-
- Theme::unloadRect(mBackground);
- Theme::unloadRect(mSelectedBackground);
- mBeing = nullptr;
-}
-
-void PlayerBox::init(std::string name, std::string selectedName)
-{
- mAllowLogic = false;
- setFrameSize(2);
- addMouseListener(this);
-
- if (theme != nullptr)
- {
- if (name.empty())
- name = "playerbox.xml";
- mSkin = theme->loadSkinRect(mBackground,
- name, "playerbox_background.xml");
- if (mSkin != nullptr)
- {
- mDrawBackground = (mSkin->getOption("drawbackground") != 0);
- mOffsetX = mSkin->getOption("offsetX", -mapTileSize / 2);
- mOffsetY = mSkin->getOption("offsetY", -mapTileSize);
- mFrameSize = mSkin->getOption("frameSize", 2);
- }
- if (selectedName.empty())
- selectedName = "playerboxselected.xml";
- mSelectedSkin = theme->loadSkinRect(mSelectedBackground,
- selectedName, "playerbox_background.xml");
- }
- else
- {
- for (int f = 0; f < 9; f ++)
- mBackground.grid[f] = nullptr;
- for (int f = 0; f < 9; f ++)
- mSelectedBackground.grid[f] = nullptr;
- }
-}
-
-void PlayerBox::draw(Graphics *const graphics)
-{
- BLOCK_START("PlayerBox::draw")
- if (mBeing != nullptr)
- {
- const int bs = mFrameSize;
- const int x = mDimension.width / 2 + bs + mOffsetX;
- const int y = mDimension.height - bs + mOffsetY;
- mBeing->drawBasic(graphics, x, y);
- }
-
- if (settings.guiAlpha != mAlpha)
- {
- const float alpha = settings.guiAlpha;
- for (int a = 0; a < 9; a++)
- {
- if (mBackground.grid[a] != nullptr)
- mBackground.grid[a]->setAlpha(alpha);
- }
- }
- BLOCK_END("PlayerBox::draw")
-}
-
-void PlayerBox::safeDraw(Graphics *const graphics)
-{
- PlayerBox::draw(graphics);
-}
-
-void PlayerBox::drawFrame(Graphics *const graphics)
-{
- BLOCK_START("PlayerBox::drawFrame")
- if (mDrawBackground)
- {
- const int bs = mFrameSize * 2;
- const int w = mDimension.width + bs;
- const int h = mDimension.height + bs;
-
- if (!mSelected)
- graphics->drawImageRect(0, 0, w, h, mBackground);
- else
- graphics->drawImageRect(0, 0, w, h, mSelectedBackground);
- }
- BLOCK_END("PlayerBox::drawFrame")
-}
-
-void PlayerBox::safeDrawFrame(Graphics *const graphics)
-{
- BLOCK_START("PlayerBox::drawFrame")
- if (mDrawBackground)
- {
- const int bs = mFrameSize * 2;
- const int w = mDimension.width + bs;
- const int h = mDimension.height + bs;
-
- if (!mSelected)
- graphics->drawImageRect(0, 0, w, h, mBackground);
- else
- graphics->drawImageRect(0, 0, w, h, mSelectedBackground);
- }
- BLOCK_END("PlayerBox::drawFrame")
-}
-
-void PlayerBox::mouseReleased(MouseEvent& event)
-{
- if (event.getButton() == MouseButton::LEFT)
- {
- if (!mActionEventId.empty())
- distributeActionEvent();
- event.consume();
- }
-}