summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-15 20:31:52 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-15 20:31:52 +0300
commit29f929794c7519b049de0be3af635f05d7e83be6 (patch)
tree5627bfcb7f19a349f065c207476c871bc5c3aa40 /src
parent41d545176ffad2fb33158ca3415d2a0a983fffdb (diff)
downloadplus-29f929794c7519b049de0be3af635f05d7e83be6.tar.gz
plus-29f929794c7519b049de0be3af635f05d7e83be6.tar.bz2
plus-29f929794c7519b049de0be3af635f05d7e83be6.tar.xz
plus-29f929794c7519b049de0be3af635f05d7e83be6.zip
move some methods from base/graphics into render/graphics.
Remove base/graphcs.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am3
-rw-r--r--src/being/being.cpp8
-rw-r--r--src/gui/base/basiccontainer.cpp3
-rw-r--r--src/gui/base/font.hpp4
-rw-r--r--src/gui/base/graphics.cpp179
-rw-r--r--src/gui/base/graphics.hpp294
-rw-r--r--src/gui/base/gui.cpp3
-rw-r--r--src/gui/base/gui.hpp3
-rw-r--r--src/gui/base/widget.cpp3
-rw-r--r--src/gui/base/widget.hpp3
-rw-r--r--src/gui/base/widgets/button.cpp3
-rw-r--r--src/gui/base/widgets/button.hpp3
-rw-r--r--src/gui/base/widgets/checkbox.cpp3
-rw-r--r--src/gui/base/widgets/container.cpp3
-rw-r--r--src/gui/base/widgets/container.hpp3
-rw-r--r--src/gui/base/widgets/label.cpp3
-rw-r--r--src/gui/base/widgets/label.hpp3
-rw-r--r--src/gui/base/widgets/listbox.cpp3
-rw-r--r--src/gui/base/widgets/radiobutton.cpp3
-rw-r--r--src/gui/base/widgets/scrollarea.cpp3
-rw-r--r--src/gui/base/widgets/slider.cpp3
-rw-r--r--src/gui/base/widgets/textbox.cpp3
-rw-r--r--src/gui/base/widgets/textfield.cpp3
-rw-r--r--src/gui/base/widgets/window.cpp3
-rw-r--r--src/gui/sdlfont.cpp2
-rw-r--r--src/gui/sdlfont.h2
-rw-r--r--src/gui/viewport.cpp10
-rw-r--r--src/gui/viewport.h2
-rw-r--r--src/gui/widgets/avatarlistbox.cpp2
-rw-r--r--src/gui/widgets/avatarlistbox.h2
-rw-r--r--src/gui/widgets/browserbox.cpp13
-rw-r--r--src/gui/widgets/browserbox.h2
-rw-r--r--src/gui/widgets/button.cpp8
-rw-r--r--src/gui/widgets/button.h2
-rw-r--r--src/gui/widgets/checkbox.cpp4
-rw-r--r--src/gui/widgets/checkbox.h4
-rw-r--r--src/gui/widgets/colorpage.cpp2
-rw-r--r--src/gui/widgets/colorpage.h2
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/desktop.h2
-rw-r--r--src/gui/widgets/dropdown.cpp6
-rw-r--r--src/gui/widgets/dropdown.h6
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/dropshortcutcontainer.h2
-rw-r--r--src/gui/widgets/emotepage.cpp2
-rw-r--r--src/gui/widgets/emotepage.h2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.h2
-rw-r--r--src/gui/widgets/extendedlistbox.cpp5
-rw-r--r--src/gui/widgets/extendedlistbox.h2
-rw-r--r--src/gui/widgets/guitable.cpp5
-rw-r--r--src/gui/widgets/guitable.h2
-rw-r--r--src/gui/widgets/icon.cpp2
-rw-r--r--src/gui/widgets/icon.h2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.h2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h2
-rw-r--r--src/gui/widgets/label.cpp2
-rw-r--r--src/gui/widgets/label.h2
-rw-r--r--src/gui/widgets/listbox.cpp5
-rw-r--r--src/gui/widgets/listbox.h2
-rw-r--r--src/gui/widgets/passwordfield.cpp2
-rw-r--r--src/gui/widgets/passwordfield.h2
-rw-r--r--src/gui/widgets/playerbox.cpp4
-rw-r--r--src/gui/widgets/playerbox.h4
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h2
-rw-r--r--src/gui/widgets/progressbar.cpp2
-rw-r--r--src/gui/widgets/progressbar.h2
-rw-r--r--src/gui/widgets/progressindicator.cpp2
-rw-r--r--src/gui/widgets/progressindicator.h2
-rw-r--r--src/gui/widgets/radiobutton.cpp4
-rw-r--r--src/gui/widgets/radiobutton.h4
-rw-r--r--src/gui/widgets/scrollarea.cpp26
-rw-r--r--src/gui/widgets/scrollarea.h26
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/shoplistbox.h2
-rw-r--r--src/gui/widgets/shortcutcontainer.h2
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/slider.h2
-rw-r--r--src/gui/widgets/sliderlist.cpp2
-rw-r--r--src/gui/widgets/sliderlist.h2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h2
-rw-r--r--src/gui/widgets/tabbedarea.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.h2
-rw-r--r--src/gui/widgets/tabs/tab.cpp2
-rw-r--r--src/gui/widgets/tabs/tab.h2
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/textfield.cpp12
-rw-r--r--src/gui/widgets/textfield.h6
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/textpreview.h2
-rw-r--r--src/gui/widgets/window.cpp12
-rw-r--r--src/gui/widgets/window.h4
-rw-r--r--src/gui/widgets/windowcontainer.cpp2
-rw-r--r--src/gui/widgets/windowcontainer.h2
-rw-r--r--src/gui/windowmenu.cpp2
-rw-r--r--src/gui/windowmenu.h2
-rw-r--r--src/gui/windows/buydialog.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp2
-rw-r--r--src/gui/windows/chatwindow.h2
-rw-r--r--src/gui/windows/connectiondialog.cpp2
-rw-r--r--src/gui/windows/connectiondialog.h2
-rw-r--r--src/gui/windows/debugwindow.cpp2
-rw-r--r--src/gui/windows/debugwindow.h2
-rw-r--r--src/gui/windows/equipmentwindow.cpp2
-rw-r--r--src/gui/windows/equipmentwindow.h2
-rw-r--r--src/gui/windows/minimap.cpp2
-rw-r--r--src/gui/windows/minimap.h2
-rw-r--r--src/gui/windows/ministatuswindow.cpp2
-rw-r--r--src/gui/windows/ministatuswindow.h2
-rw-r--r--src/gui/windows/outfitwindow.cpp6
-rw-r--r--src/gui/windows/outfitwindow.h2
-rw-r--r--src/gui/windows/selldialog.cpp2
-rw-r--r--src/gui/windows/serverdialog.cpp2
-rw-r--r--src/gui/windows/skilldialog.cpp2
-rw-r--r--src/render/graphics.cpp124
-rw-r--r--src/render/graphics.h163
-rw-r--r--src/render/mobileopenglgraphics.cpp4
-rw-r--r--src/render/normalopenglgraphics.cpp4
-rw-r--r--src/render/nullopenglgraphics.cpp4
-rw-r--r--src/render/safeopenglgraphics.cpp4
-rw-r--r--src/render/sdl2graphics.cpp47
-rw-r--r--src/render/sdl2graphics.h43
-rw-r--r--src/render/sdl2softwaregraphics.cpp4
-rw-r--r--src/render/sdlgraphics.cpp4
-rw-r--r--src/text.cpp10
-rw-r--r--src/text.h9
132 files changed, 589 insertions, 700 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79280485c..65570ee7b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -780,7 +780,6 @@ SET(SRCS
gui/base/focushandler.hpp
gui/base/focuslistener.hpp
gui/base/font.hpp
- gui/base/graphics.hpp
gui/base/gui.hpp
gui/base/input.hpp
gui/base/inputevent.hpp
@@ -817,7 +816,6 @@ SET(SRCS
gui/base/exception.cpp
gui/base/focushandler.cpp
gui/base/font.cpp
- gui/base/graphics.cpp
gui/base/gui.cpp
gui/base/inputevent.cpp
gui/base/key.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 028041582..7fe7a5e2e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,6 @@ dyecmd_SOURCES = gui/base/actionevent.cpp \
gui/base/event.cpp \
gui/base/exception.cpp \
gui/base/font.cpp \
- gui/base/graphics.cpp \
gui/base/rectangle.cpp \
gui/base/widget.cpp \
gui/base/actionevent.hpp \
@@ -41,7 +40,6 @@ dyecmd_SOURCES = gui/base/actionevent.cpp \
gui/base/event.hpp \
gui/base/exception.hpp \
gui/base/font.hpp \
- gui/base/graphics.hpp \
gui/base/rectangle.hpp \
gui/base/widget.hpp
@@ -206,7 +204,6 @@ manaplus_SOURCES += gui/base/actionevent.hpp \
gui/base/exception.cpp \
gui/base/focushandler.cpp \
gui/base/font.cpp \
- gui/base/graphics.cpp \
gui/base/gui.cpp \
gui/base/inputevent.cpp \
gui/base/key.cpp \
diff --git a/src/being/being.cpp b/src/being/being.cpp
index dfb335f9b..8b2ece2b7 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -519,7 +519,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel,
mText = new Text(mSpeech,
getPixelX(), getPixelY() - getHeight(),
- gcn::Graphics::CENTER,
+ Graphics::CENTER,
&userPalette->getColor(UserPalette::PARTICLE),
true);
}
@@ -1856,7 +1856,7 @@ void Being::drawSpeech(const int offsetX, const int offsetY)
if (!mText && userPalette)
{
mText = new Text(mSpeech, getPixelX(), getPixelY() - getHeight(),
- gcn::Graphics::CENTER, &Theme::getThemeColor(
+ Graphics::CENTER, &Theme::getThemeColor(
Theme::BUBBLE_TEXT), true);
}
}
@@ -2019,12 +2019,12 @@ void Being::showName()
mDispName = new FlashText(displayName,
getPixelX() + mInfo->getNameOffsetX(),
getPixelY() + mInfo->getNameOffsetY(),
- gcn::Graphics::CENTER, mNameColor, font);
+ Graphics::CENTER, mNameColor, font);
}
else
{
mDispName = new FlashText(displayName, getPixelX(), getPixelY(),
- gcn::Graphics::CENTER, mNameColor, font);
+ Graphics::CENTER, mNameColor, font);
}
updateCoords();
diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp
index 45bb1e231..7a937fb42 100644
--- a/src/gui/base/basiccontainer.cpp
+++ b/src/gui/base/basiccontainer.cpp
@@ -71,9 +71,10 @@
#include "gui/base/exception.hpp"
#include "gui/base/focushandler.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/font.hpp b/src/gui/base/font.hpp
index 8e8ad18c9..075af4136 100644
--- a/src/gui/base/font.hpp
+++ b/src/gui/base/font.hpp
@@ -68,10 +68,10 @@
#include "localconsts.h"
+class Graphics;
+
namespace gcn
{
- class Graphics;
-
/**
* Interface for a font.
*
diff --git a/src/gui/base/graphics.cpp b/src/gui/base/graphics.cpp
deleted file mode 100644
index fd76a1e6f..000000000
--- a/src/gui/base/graphics.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2014 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/>.
- */
-
-/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
- *
- *
- * Per Larsson a.k.a finalman
- * Olof Naessén a.k.a jansem/yakslem
- *
- * Visit: http://guichan.sourceforge.net
- *
- * License: (BSD)
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of Guichan nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * For comments regarding functions please see the header file.
- */
-
-#include "gui/base/graphics.hpp"
-
-#include "gui/base/exception.hpp"
-#include "gui/base/font.hpp"
-#include "resources/image.h"
-
-#include "debug.h"
-
-namespace gcn
-{
-
- Graphics::Graphics() :
- mClipStack(),
- mFont(nullptr)
- {
- }
-
- bool Graphics::pushClipArea(Rectangle area)
- {
- // Ignore area with a negate width or height
- // by simple pushing an empty clip area
- // to the stack.
- if (area.width < 0 || area.height < 0)
- {
- ClipRectangle carea;
- mClipStack.push(carea);
- return true;
- }
-
- if (mClipStack.empty())
- {
- ClipRectangle carea;
- carea.x = area.x;
- carea.y = area.y;
- carea.width = area.width;
- carea.height = area.height;
- carea.xOffset = area.x;
- carea.yOffset = area.y;
- mClipStack.push(carea);
- return true;
- }
-
- const ClipRectangle &top = mClipStack.top();
- ClipRectangle carea;
- carea = area;
- carea.xOffset = top.xOffset + carea.x;
- carea.yOffset = top.yOffset + carea.y;
- carea.x += top.xOffset;
- carea.y += top.yOffset;
-
- // Clamp the pushed clip rectangle.
- if (carea.x < top.x)
- carea.x = top.x;
-
- if (carea.y < top.y)
- carea.y = top.y;
-
- if (carea.x + carea.width > top.x + top.width)
- {
- carea.width = top.x + top.width - carea.x;
-
- if (carea.width < 0)
- carea.width = 0;
- }
-
- if (carea.y + carea.height > top.y + top.height)
- {
- carea.height = top.y + top.height - carea.y;
-
- if (carea.height < 0)
- carea.height = 0;
- }
-
- const bool result = carea.isIntersecting(top);
-
- mClipStack.push(carea);
-
- return result;
- }
-
- void Graphics::popClipArea()
- {
- if (mClipStack.empty())
- throw GCN_EXCEPTION("Tried to pop clip area from empty stack.");
-
- mClipStack.pop();
- }
-
- const ClipRectangle& Graphics::getCurrentClipArea()
- {
- if (mClipStack.empty())
- throw GCN_EXCEPTION("The clip area stack is empty.");
-
- return mClipStack.top();
- }
-
- void Graphics::drawImage(const Image* image A_UNUSED,
- int dstX A_UNUSED, int dstY A_UNUSED)
- {
- }
-
-/*
- void Graphics::setFont(Font* font)
- {
- }
-
- void Graphics::drawText(const std::string& text, int x, int y,
- Alignment alignment)
- {
- }
-*/
-} // namespace gcn
diff --git a/src/gui/base/graphics.hpp b/src/gui/base/graphics.hpp
deleted file mode 100644
index d3128c8ae..000000000
--- a/src/gui/base/graphics.hpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2014 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/>.
- */
-
-/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
- *
- *
- * Per Larsson a.k.a finalman
- * Olof Naessén a.k.a jansem/yakslem
- *
- * Visit: http://guichan.sourceforge.net
- *
- * License: (BSD)
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of Guichan nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GCN_GRAPHICS_HPP
-#define GCN_GRAPHICS_HPP
-
-#include <iosfwd>
-#include <stack>
-
-#include "gui/base/cliprectangle.hpp"
-
-namespace gcn
-{
- class Color;
- class Font;
- class Image;
-
- /**
- * Abstract class for providing drawing primitve functions.
- * It contains all vital functions for drawing.
- *
- * Guichan contains implementations of Graphics for common
- * libraries like the Allegro library, the HGE library,
- * the OpenGL library, the OpenLayer library, and the SDL library.
- * To make Guichan usable with other libraries, a Graphics class
- * must be implemented.
- *
- * In Graphics you can set clip areas to limit drawing to certain
- * areas of the screen. Clip areas are put on a stack, which
- * means that you can push smaller and smaller clip areas onto the
- * stack. All coordinates will be relative to the top most clip area.
- * In most cases you won't have to worry about the clip areas,
- * unless you want to implement some really complex widget.
- * Pushing and poping of clip areas are handled automatically by
- * container widgets when their child widgets are drawn.
- *
- * IMPORTANT: Remember to pop each clip area that you pushed on the stack
- * after you are done with it.
- *
- * If you feel that Graphics is to restrictive for your needs,
- * there is no one stopping you from using your own code for drawing
- * in widgets. You could for instance use pure SDL in the drawing of
- * widgets bypassing Graphics. This might however hurt portability of
- * your application.
- *
- * If you implement a Graphics class not present in Guichan we would
- * be very happy to add it to Guichan.
- *
- * @see AllegroGraphics, HGEGraphics, OpenLayerGraphics, OpenGLGraphics,
- * SDLGraphics, Image
- * @since 0.1.0
- */
- class Graphics
- {
- public:
- /**
- * Alignments for text drawing.
- */
- enum Alignment
- {
- LEFT = 0,
- CENTER,
- RIGHT
- };
-
- /**
- * Constructor.
- */
- Graphics();
-
- A_DELETE_COPY(Graphics)
-
- /**
- * Destructor.
- */
- virtual ~Graphics()
- { }
-
- /**
- * Initializes drawing. Called by the Gui when Gui::draw() is called.
- * It is needed by some implementations of Graphics to perform
- * preparations before drawing. An example of such an implementation
- * is the OpenGLGraphics.
- *
- * NOTE: You will never need to call this function yourself, unless
- * you use a Graphics object outside of Guichan.
- *
- * @see _endDraw, Gui::draw
- */
- virtual void _beginDraw()
- { }
-
- /**
- * Deinitializes drawing. Called by the Gui when a Gui::draw() is done.
- * done. It should reset any state changes made by _beginDraw().
- *
- * NOTE: You will never need to call this function yourself, unless
- * you use a Graphics object outside of Guichan.
- *
- * @see _beginDraw, Gui::draw
- */
- virtual void _endDraw()
- { }
-
- /**
- * Pushes a clip area onto the stack. The x and y coordinates in the
- * rectangle is relative to the last pushed clip area.
- * If the new area falls outside the current clip area, it will be
- * clipped as necessary.
- *
- * If a clip area is outside of the top clip area a clip area with
- * zero width and height will be pushed.
- *
- * @param area The clip area to be pushed onto the stack.
- * @return False if the the new area lays outside the current clip
- * area.
- */
- virtual bool pushClipArea(Rectangle area);
-
- /**
- * Removes the top most clip area from the stack.
- *
- * @throws Exception if the stack is empty.
- */
- virtual void popClipArea();
-
- /**
- * Gets the current clip area. Usefull if you want to do drawing
- * bypassing Graphics.
- *
- * @return The current clip area.
- */
- virtual const ClipRectangle& getCurrentClipArea();
-
- /**
- * Draws a part of an image.
- *
- * NOTE: Width and height arguments will not scale the image but
- * specifies the size of the part to be drawn. If you want
- * to draw the whole image there is a simplified version of
- * this function.
- *
- * EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endcode
- * Will draw a rectangular piece of myImage starting at
- * coordinate (10, 10) in myImage, with width and height 40.
- * The piece will be drawn with it's top left corner at
- * coordinate (20, 20).
- *
- * @param image The image to draw.
- * @param srcX The source image x coordinate.
- * @param srcY The source image y coordinate.
- * @param dstX The destination x coordinate.
- * @param dstY The destination y coordinate.
- * @param width The width of the piece.
- * @param height The height of the piece.
- */
- virtual void drawImage(const Image* image,
- int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height) = 0;
- /**
- * Draws an image. A simplified version of the other drawImage.
- * It will draw a whole image at the coordinate you specify.
- * It is equivalent to calling:
- * @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), \
- image->getHeight()); @endcode
- */
- virtual void drawImage(const Image* image, int dstX, int dstY);
-
- /**
- * Draws a single point/pixel.
- *
- * @param x The x coordinate.
- * @param y The y coordinate.
- */
- virtual void drawPoint(int x, int y) = 0;
-
- /**
- * Ddraws a line.
- *
- * @param x1 The first x coordinate.
- * @param y1 The first y coordinate.
- * @param x2 The second x coordinate.
- * @param y2 The second y coordinate.
- */
- virtual void drawLine(int x1, int y1, int x2, int y2) = 0;
-
- /**
- * Draws a simple, non-filled, rectangle with a one pixel width.
- *
- * @param rectangle The rectangle to draw.
- */
- virtual void drawRectangle(const Rectangle& rectangle) = 0;
-
- /**
- * Draws a filled rectangle.
- *
- * @param rectangle The filled rectangle to draw.
- */
- virtual void fillRectangle(const Rectangle& rectangle) = 0;
-
- /**
- * Sets the color to use when drawing.
- *
- * @param color A color.
- * @see getColor
- */
- virtual void setColor(const Color& color) = 0;
-
- /**
- * Gets the color to use when drawing.
- *
- * @return The color used when drawing.
- * @see setColor
- */
- virtual const Color& getColor() const = 0;
-
- protected:
- /**
- * Holds the clip area stack.
- */
- std::stack<ClipRectangle> mClipStack;
-
- /**
- * Holds the current font.
- */
- Font* mFont;
- };
-} // namespace gcn
-
-#endif // end GCN_GRAPHICS_HPP
diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp
index e4827f716..73d6ff380 100644
--- a/src/gui/base/gui.cpp
+++ b/src/gui/base/gui.cpp
@@ -70,7 +70,6 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/exception.hpp"
#include "gui/base/focushandler.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/input.hpp"
#include "gui/base/keyinput.hpp"
#include "gui/base/keylistener.hpp"
@@ -78,6 +77,8 @@
#include "gui/base/mouselistener.hpp"
#include "gui/base/widget.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp
index b1daba0fc..28a231101 100644
--- a/src/gui/base/gui.hpp
+++ b/src/gui/base/gui.hpp
@@ -71,10 +71,11 @@
#include "gui/base/mouseevent.hpp"
#include "gui/base/mouseinput.hpp"
+class Graphics;
+
namespace gcn
{
class FocusHandler;
- class Graphics;
class Input;
class KeyListener;
class Widget;
diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp
index 2e8719446..eeb5849c7 100644
--- a/src/gui/base/widget.cpp
+++ b/src/gui/base/widget.cpp
@@ -74,13 +74,14 @@
#include "gui/base/event.hpp"
#include "gui/base/exception.hpp"
#include "gui/base/focushandler.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/keyinput.hpp"
#include "gui/base/keylistener.hpp"
#include "gui/base/mouseinput.hpp"
#include "gui/base/mouselistener.hpp"
#include "gui/base/widgetlistener.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp
index 847e340e1..b6a81261e 100644
--- a/src/gui/base/widget.hpp
+++ b/src/gui/base/widget.hpp
@@ -73,6 +73,8 @@
#include "localconsts.h"
+class Graphics;
+
namespace gcn
{
class ActionListener;
@@ -81,7 +83,6 @@ namespace gcn
class FocusHandler;
class FocusListener;
class Font;
- class Graphics;
class KeyInput;
class KeyListener;
class MouseInput;
diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp
index a52bf2d78..3e699670a 100644
--- a/src/gui/base/widgets/button.cpp
+++ b/src/gui/base/widgets/button.cpp
@@ -69,11 +69,12 @@
#include "gui/base/exception.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseevent.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp
index 4ae08eb16..cd41a1b02 100644
--- a/src/gui/base/widgets/button.hpp
+++ b/src/gui/base/widgets/button.hpp
@@ -67,12 +67,13 @@
#include <string>
#include "gui/base/focuslistener.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/keylistener.hpp"
#include "gui/base/mouseevent.hpp"
#include "gui/base/mouselistener.hpp"
#include "gui/base/widget.hpp"
+#include "render/graphics.h"
+
namespace gcn
{
/**
diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp
index 908b4f509..615808a85 100644
--- a/src/gui/base/widgets/checkbox.cpp
+++ b/src/gui/base/widgets/checkbox.cpp
@@ -68,10 +68,11 @@
#include "gui/base/widgets/checkbox.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/container.cpp b/src/gui/base/widgets/container.cpp
index 1e6de018b..d72f2a682 100644
--- a/src/gui/base/widgets/container.cpp
+++ b/src/gui/base/widgets/container.cpp
@@ -68,7 +68,8 @@
#include "gui/base/widgets/container.hpp"
#include "gui/base/exception.hpp"
-#include "gui/base/graphics.hpp"
+
+#include "render/graphics.h"
#include "debug.h"
diff --git a/src/gui/base/widgets/container.hpp b/src/gui/base/widgets/container.hpp
index a5cbdb31b..bffe6e884 100644
--- a/src/gui/base/widgets/container.hpp
+++ b/src/gui/base/widgets/container.hpp
@@ -67,7 +67,8 @@
#include <list>
#include "gui/base/basiccontainer.hpp"
-#include "gui/base/graphics.hpp"
+
+#include "render/graphics.h"
namespace gcn
{
diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp
index 42fcd78f4..f4576d908 100644
--- a/src/gui/base/widgets/label.cpp
+++ b/src/gui/base/widgets/label.cpp
@@ -69,7 +69,8 @@
#include "gui/base/exception.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
+
+#include "render/graphics.h"
#include "debug.h"
diff --git a/src/gui/base/widgets/label.hpp b/src/gui/base/widgets/label.hpp
index f1ef30b89..90a395f7b 100644
--- a/src/gui/base/widgets/label.hpp
+++ b/src/gui/base/widgets/label.hpp
@@ -66,9 +66,10 @@
#include <string>
-#include "gui/base/graphics.hpp"
#include "gui/base/widget.hpp"
+#include "render/graphics.h"
+
namespace gcn
{
/**
diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp
index b97bf47d4..dcf443c77 100644
--- a/src/gui/base/widgets/listbox.cpp
+++ b/src/gui/base/widgets/listbox.cpp
@@ -69,12 +69,13 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/listmodel.hpp"
#include "gui/base/mouseinput.hpp"
#include "gui/base/selectionlistener.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp
index bfd5b1ff8..1e1da2622 100644
--- a/src/gui/base/widgets/radiobutton.cpp
+++ b/src/gui/base/widgets/radiobutton.cpp
@@ -68,10 +68,11 @@
#include "gui/base/widgets/radiobutton.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp
index e3dcfc61c..308cee473 100644
--- a/src/gui/base/widgets/scrollarea.cpp
+++ b/src/gui/base/widgets/scrollarea.cpp
@@ -68,7 +68,8 @@
#include "gui/base/widgets/scrollarea.hpp"
#include "gui/base/exception.hpp"
-#include "gui/base/graphics.hpp"
+
+#include "render/graphics.h"
#include "debug.h"
diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp
index a1a106303..e9ab36e86 100644
--- a/src/gui/base/widgets/slider.cpp
+++ b/src/gui/base/widgets/slider.cpp
@@ -67,10 +67,11 @@
#include "gui/base/widgets/slider.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp
index 2e9ca0563..411fc7dd5 100644
--- a/src/gui/base/widgets/textbox.cpp
+++ b/src/gui/base/widgets/textbox.cpp
@@ -69,10 +69,11 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp
index 586e49663..3349ebccb 100644
--- a/src/gui/base/widgets/textfield.cpp
+++ b/src/gui/base/widgets/textfield.cpp
@@ -68,10 +68,11 @@
#include "gui/base/widgets/textfield.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp
index c7a108ab8..6373bcb63 100644
--- a/src/gui/base/widgets/window.cpp
+++ b/src/gui/base/widgets/window.cpp
@@ -69,9 +69,10 @@
#include "gui/base/exception.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/mouseinput.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index 8246cea94..bed4a9f31 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -444,7 +444,7 @@ void SDLFont::clear()
mCache[f].clear();
}
-void SDLFont::drawString(gcn::Graphics *const graphics,
+void SDLFont::drawString(Graphics *const graphics,
const std::string &text,
const int x, const int y)
{
diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h
index 79ee0fbfb..1cb6f5c99 100644
--- a/src/gui/sdlfont.h
+++ b/src/gui/sdlfont.h
@@ -131,7 +131,7 @@ class SDLFont final : public gcn::Font
/**
* @see Font::drawString
*/
- void drawString(gcn::Graphics *const graphics,
+ void drawString(Graphics *const graphics,
const std::string &text,
const int x, const int y) override final;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9982840de..2a91d1991 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -114,22 +114,20 @@ void Viewport::setMap(Map *const map)
mMap = map;
}
-void Viewport::draw(gcn::Graphics *gcnGraphics)
+void Viewport::draw(Graphics *graphics)
{
BLOCK_START("Viewport::draw 1")
static int lastTick = tick_time;
if (!mMap || !player_node)
{
- gcnGraphics->setColor(gcn::Color(64, 64, 64));
- gcnGraphics->fillRectangle(
+ graphics->setColor(gcn::Color(64, 64, 64));
+ graphics->fillRectangle(
gcn::Rectangle(0, 0, getWidth(), getHeight()));
BLOCK_END("Viewport::draw 1")
return;
}
- Graphics *const graphics = static_cast<Graphics* const>(gcnGraphics);
-
// Avoid freaking out when tick_time overflows
if (tick_time < lastTick)
lastTick = tick_time;
@@ -260,7 +258,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
miniStatusWindow->drawIcons(graphics);
// Draw contained widgets
- WindowContainer::draw(gcnGraphics);
+ WindowContainer::draw(graphics);
BLOCK_END("Viewport::draw 1")
}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 848a1ae8c..7e18d8395 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -83,7 +83,7 @@ class Viewport final : public WindowContainer,
/**
* Draws the viewport.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Implements player to keep following mouse.
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 4a477b802..e6f03493f 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -90,7 +90,7 @@ AvatarListBox::~AvatarListBox()
}
}
-void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
+void AvatarListBox::draw(Graphics *gcnGraphics)
{
BLOCK_START("AvatarListBox::draw")
if (!mListModel || !player_node)
diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h
index 99c1132b2..46e5c8dea 100644
--- a/src/gui/widgets/avatarlistbox.h
+++ b/src/gui/widgets/avatarlistbox.h
@@ -53,7 +53,7 @@ public:
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *gcnGraphics) override final;
+ void draw(Graphics *gcnGraphics) override final;
void mousePressed(gcn::MouseEvent &event) override final;
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index d7ce9ab12..e0fbf3d17 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -37,10 +37,11 @@
#include "utils/stringutils.h"
#include "utils/timer.h"
-#include "gui/base/graphics.hpp"
#include "gui/base/font.hpp"
#include "gui/base/cliprectangle.hpp"
+#include "render/graphics.h"
+
#include <algorithm>
#include "debug.h"
@@ -446,13 +447,15 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event)
? static_cast<int>(i - mLinks.begin()) : -1;
}
-void BrowserBox::draw(gcn::Graphics *graphics)
+void BrowserBox::draw(Graphics *graphics)
{
BLOCK_START("BrowserBox::draw")
- const gcn::ClipRectangle &cr = graphics->getCurrentClipArea();
+ const gcn::ClipRectangle *const cr = graphics->getCurrentClipArea();
+ if (!cr)
+ return;
Graphics *const graphics2 = static_cast<Graphics *const>(graphics);
- mYStart = cr.y - cr.yOffset;
- const int yEnd = mYStart + cr.height;
+ mYStart = cr->y - cr->yOffset;
+ const int yEnd = mYStart + cr->height;
if (mYStart < 0)
mYStart = 0;
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index deefd886a..85ce9b96b 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -165,7 +165,7 @@ class BrowserBox final : public gcn::Widget,
/**
* Draws the browser box.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void updateHeight();
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index faefd6f6c..8954ecf8e 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -350,7 +350,7 @@ void Button::updateAlpha()
}
}
-void Button::draw(gcn::Graphics *graphics)
+void Button::draw(Graphics *graphics)
{
BLOCK_START("Button::draw")
int mode;
@@ -437,7 +437,7 @@ void Button::draw(gcn::Graphics *graphics)
switch (mAlignment)
{
default:
- case gcn::Graphics::LEFT:
+ case Graphics::LEFT:
{
if (mImages)
{
@@ -450,7 +450,7 @@ void Button::draw(gcn::Graphics *graphics)
}
break;
}
- case gcn::Graphics::CENTER:
+ case Graphics::CENTER:
{
const int width1 = font->getWidth(mCaption);
if (mImages)
@@ -465,7 +465,7 @@ void Button::draw(gcn::Graphics *graphics)
}
break;
}
- case gcn::Graphics::RIGHT:
+ case Graphics::RIGHT:
{
const int width1 = font->getWidth(mCaption);
textX = width - width1 - padding;
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index aeec63b82..949993a48 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -102,7 +102,7 @@ class Button final : public gcn::Button,
/**
* Draws the button.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Update the alpha value to the button components.
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index fa227f5ca..e72296516 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -94,7 +94,7 @@ CheckBox::~CheckBox()
}
}
-void CheckBox::draw(gcn::Graphics *const graphics)
+void CheckBox::draw(Graphics *const graphics)
{
BLOCK_START("CheckBox::draw")
drawBox(graphics);
@@ -129,7 +129,7 @@ void CheckBox::updateAlpha()
}
}
-void CheckBox::drawBox(gcn::Graphics *const graphics)
+void CheckBox::drawBox(Graphics *const graphics)
{
if (!mSkin || !mDrawBox)
return;
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index d0864d0d5..a49c38d47 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -59,7 +59,7 @@ class CheckBox final : public gcn::CheckBox,
/**
* Draws the caption, then calls drawBox to draw the check box.
*/
- void draw(gcn::Graphics *const graphics) override final;
+ void draw(Graphics *const graphics) override final;
/**
* Update the alpha value to the checkbox components.
@@ -69,7 +69,7 @@ class CheckBox final : public gcn::CheckBox,
/**
* Draws the check box, not the caption.
*/
- void drawBox(gcn::Graphics *const graphics);
+ void drawBox(Graphics *const graphics);
/**
* Called when the mouse enteres the widget area.
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index 9730f7006..1d85874df 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -47,7 +47,7 @@ ColorPage::~ColorPage()
{
}
-void ColorPage::draw(gcn::Graphics *graphics)
+void ColorPage::draw(Graphics *graphics)
{
BLOCK_START("ColorPage::draw")
diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h
index c1c90eddf..84a3011a9 100644
--- a/src/gui/widgets/colorpage.h
+++ b/src/gui/widgets/colorpage.h
@@ -36,7 +36,7 @@ class ColorPage final : public ListBox
~ColorPage();
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void resetAction();
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 32c8a4988..4a4a73b53 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -103,7 +103,7 @@ void Desktop::widgetResized(const gcn::Event &event A_UNUSED)
setBestFittingWallpaper();
}
-void Desktop::draw(gcn::Graphics *graphics)
+void Desktop::draw(Graphics *graphics)
{
BLOCK_START("Desktop::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index 88034fbbc..6982ce525 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -61,7 +61,7 @@ class Desktop final : public Container, private gcn::WidgetListener
void widgetResized(const gcn::Event &event) override final;
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void postInit();
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 3669d3eab..354c88423 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -214,7 +214,7 @@ void DropDown::updateAlpha()
}
}
-void DropDown::draw(gcn::Graphics* graphics)
+void DropDown::draw(Graphics* graphics)
{
BLOCK_START("DropDown::draw")
int h;
@@ -286,7 +286,7 @@ void DropDown::draw(gcn::Graphics* graphics)
BLOCK_END("DropDown::draw")
}
-void DropDown::drawFrame(gcn::Graphics *graphics)
+void DropDown::drawFrame(Graphics *graphics)
{
BLOCK_START("DropDown::drawFrame")
const int bs2 = getFrameSize();
@@ -296,7 +296,7 @@ void DropDown::drawFrame(gcn::Graphics *graphics)
BLOCK_END("DropDown::drawFrame")
}
-void DropDown::drawButton(gcn::Graphics *graphics)
+void DropDown::drawButton(Graphics *graphics)
{
const int height = mDroppedDown ? mFoldedUpHeight : mDimension.height;
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index da2eb64f9..af566fb69 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -82,9 +82,9 @@ class DropDown final : public gcn::ActionListener,
*/
void updateAlpha();
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
- void drawFrame(gcn::Graphics *graphics) override final;
+ void drawFrame(Graphics *graphics) override final;
// Inherited from KeyListener
@@ -142,7 +142,7 @@ class DropDown final : public gcn::ActionListener,
*
* @param graphics a Graphics object to draw with.
*/
- void drawButton(gcn::Graphics *graphics);
+ void drawButton(Graphics *graphics);
PopupList *mPopup;
gcn::Color mShadowColor;
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 857eed024..892a74638 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -94,7 +94,7 @@ void DropShortcutContainer::setWidget2(const Widget2 *const widget)
mUnEquipedColor2 = getThemeColor(Theme::ITEM_NOT_EQUIPPED_OUTLINE);
}
-void DropShortcutContainer::draw(gcn::Graphics *graphics)
+void DropShortcutContainer::draw(Graphics *graphics)
{
if (!dropShortcut)
return;
diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h
index b5a144cba..6b7a9f151 100644
--- a/src/gui/widgets/dropshortcutcontainer.h
+++ b/src/gui/widgets/dropshortcutcontainer.h
@@ -50,7 +50,7 @@ class DropShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index f2f84ed56..869ae5d08 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -59,7 +59,7 @@ EmotePage::~EmotePage()
mVertexes = nullptr;
}
-void EmotePage::draw(gcn::Graphics *graphics)
+void EmotePage::draw(Graphics *graphics)
{
BLOCK_START("EmotePage::draw")
diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h
index 1603bab5e..9cd2867aa 100644
--- a/src/gui/widgets/emotepage.h
+++ b/src/gui/widgets/emotepage.h
@@ -41,7 +41,7 @@ class EmotePage final : public gcn::Widget,
~EmotePage();
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void mousePressed(gcn::MouseEvent &mouseEvent) override final;
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 8d83ffeae..bdb5c3163 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -99,7 +99,7 @@ void EmoteShortcutContainer::setWidget2(const Widget2 *const widget)
mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
-void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
+void EmoteShortcutContainer::draw(Graphics *graphics)
{
if (!emoteShortcut)
return;
diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h
index 2c99aaf87..62999207e 100644
--- a/src/gui/widgets/emoteshortcutcontainer.h
+++ b/src/gui/widgets/emoteshortcutcontainer.h
@@ -53,7 +53,7 @@ class EmoteShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index 6aaf85bbe..66065295c 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -23,9 +23,10 @@
#include "gui/widgets/extendedlistmodel.h"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/listmodel.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
ExtendedListBox::ExtendedListBox(const Widget2 *const widget,
@@ -47,7 +48,7 @@ ExtendedListBox::~ExtendedListBox()
{
}
-void ExtendedListBox::draw(gcn::Graphics *graphics)
+void ExtendedListBox::draw(Graphics *graphics)
{
if (!mListModel)
return;
diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h
index 30e7a32fb..9fa14fa9e 100644
--- a/src/gui/widgets/extendedlistbox.h
+++ b/src/gui/widgets/extendedlistbox.h
@@ -59,7 +59,7 @@ class ExtendedListBox final : public ListBox
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void adjustSize() override;
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 9630f5c17..6928b11d8 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -30,9 +30,10 @@
#include "utils/dtor.h"
#include "gui/base/actionlistener.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/key.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
float GuiTable::mAlpha = 1.0;
@@ -293,7 +294,7 @@ void GuiTable::installActionListeners()
}
// -- widget ops
-void GuiTable::draw(gcn::Graphics* graphics)
+void GuiTable::draw(Graphics* graphics)
{
if (!mModel || !getRowHeight())
return;
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index e91482078..2154d0889 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -113,7 +113,7 @@ public:
}
// Inherited from Widget
- void draw(gcn::Graphics* graphics) override final;
+ void draw(Graphics* graphics) override final;
gcn::Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED;
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 4fb511c85..e9b7cd525 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -67,7 +67,7 @@ void Icon::setImage(Image *const image)
}
}
-void Icon::draw(gcn::Graphics *g)
+void Icon::draw(Graphics *g)
{
BLOCK_START("Icon::draw")
if (mImage)
diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h
index 98cb83b61..a39cec517 100644
--- a/src/gui/widgets/icon.h
+++ b/src/gui/widgets/icon.h
@@ -68,7 +68,7 @@ class Icon final : public gcn::Widget,
/**
* Draws the Icon.
*/
- void draw(gcn::Graphics *g) override final;
+ void draw(Graphics *g) override final;
private:
Image *mImage;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 0361c54e7..eedbc1bd0 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -245,7 +245,7 @@ void ItemContainer::logic()
BLOCK_END("ItemContainer::logic")
}
-void ItemContainer::draw(gcn::Graphics *graphics)
+void ItemContainer::draw(Graphics *graphics)
{
if (!mInventory || !mShowMatrix)
return;
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index c7ca851d9..cfacb05c6 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -85,7 +85,7 @@ class ItemContainer final : public gcn::Widget,
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
// KeyListener
void keyPressed(gcn::KeyEvent &event) override final;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 1334afae7..78b9c0e62 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -112,7 +112,7 @@ void ItemShortcutContainer::setWidget2(const Widget2 *const widget)
mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
-void ItemShortcutContainer::draw(gcn::Graphics *graphics)
+void ItemShortcutContainer::draw(Graphics *graphics)
{
BLOCK_START("ItemShortcutContainer::draw")
const ItemShortcut *const selShortcut = itemShortcut[mNumber];
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index f9ec24589..c2dbe93a3 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -51,7 +51,7 @@ class ItemShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 767830f5d..89ba17cd6 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -76,7 +76,7 @@ void Label::init()
mPadding = 0;
}
-void Label::draw(gcn::Graphics* graphics)
+void Label::draw(Graphics* graphics)
{
BLOCK_START("Label::draw")
int textX;
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index 2fc2393fb..0b96b87e4 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -59,7 +59,7 @@ class Label final : public gcn::Label, public Widget2
/**
* Draws the label.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void adjustSize();
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 767067801..0a7956476 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -31,9 +31,10 @@
#include "gui/base/focushandler.hpp"
#include "gui/base/font.hpp"
-#include "gui/base/graphics.hpp"
#include "gui/base/listmodel.hpp"
+#include "render/graphics.h"
+
#include "debug.h"
float ListBox::mAlpha = 1.0;
@@ -98,7 +99,7 @@ void ListBox::updateAlpha()
mAlpha = alpha;
}
-void ListBox::draw(gcn::Graphics *graphics)
+void ListBox::draw(Graphics *graphics)
{
if (!mListModel)
return;
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index 784193fdf..459aea2e3 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -58,7 +58,7 @@ class ListBox : public gcn::ListBox,
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *graphics) override;
+ void draw(Graphics *graphics) override;
/**
* Update the alpha value to the graphic components.
diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp
index b2ee6ccad..1b562b7f0 100644
--- a/src/gui/widgets/passwordfield.cpp
+++ b/src/gui/widgets/passwordfield.cpp
@@ -31,7 +31,7 @@ PasswordField::PasswordField(const Widget2 *const widget,
{
}
-void PasswordField::draw(gcn::Graphics *graphics)
+void PasswordField::draw(Graphics *graphics)
{
BLOCK_START("PasswordField::draw")
// std::string uses cow, thus cheap copy
diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h
index 322d71b8b..f72350763 100644
--- a/src/gui/widgets/passwordfield.h
+++ b/src/gui/widgets/passwordfield.h
@@ -44,7 +44,7 @@ class PasswordField final : public TextField
/**
* Draws the password field.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
protected:
int mPasswordChar;
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 6fda932bf..260f80099 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -107,7 +107,7 @@ void PlayerBox::init(std::string name, std::string selectedName)
}
}
-void PlayerBox::draw(gcn::Graphics *graphics)
+void PlayerBox::draw(Graphics *graphics)
{
BLOCK_START("PlayerBox::draw")
if (mBeing)
@@ -130,7 +130,7 @@ void PlayerBox::draw(gcn::Graphics *graphics)
BLOCK_END("PlayerBox::draw")
}
-void PlayerBox::drawFrame(gcn::Graphics *graphics)
+void PlayerBox::drawFrame(Graphics *graphics)
{
BLOCK_START("PlayerBox::drawFrame")
if (mDrawBackground)
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index b78c8c3f1..9671715b0 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -71,12 +71,12 @@ class PlayerBox final : public Widget2,
/**
* Draws the scroll area.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(gcn::Graphics *graphics) override final;
+ void drawFrame(Graphics *graphics) override final;
Being *getBeing() A_WARN_UNUSED
{ return mBeing; }
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index c0de328e7..56d5d0d0c 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -94,7 +94,7 @@ void Popup::setWindowContainer(WindowContainer *const wc)
windowContainer = wc;
}
-void Popup::draw(gcn::Graphics *graphics)
+void Popup::draw(Graphics *graphics)
{
BLOCK_START("Popup::draw")
Graphics *const g = static_cast<Graphics*>(graphics);
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 7e7001891..f0fd1b932 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -75,7 +75,7 @@ class Popup : public Container, public gcn::MouseListener,
/**
* Draws the popup.
*/
- void draw(gcn::Graphics *graphics) override;
+ void draw(Graphics *graphics) override;
/**
* Sets the size of this popup.
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 61ecc9080..28c87f4ec 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -146,7 +146,7 @@ void ProgressBar::updateAlpha()
mAlpha = alpha;
}
-void ProgressBar::draw(gcn::Graphics *graphics)
+void ProgressBar::draw(Graphics *graphics)
{
BLOCK_START("ProgressBar::draw")
updateAlpha();
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index ca32fc165..022d86ab3 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -70,7 +70,7 @@ class ProgressBar final : public gcn::Widget,
/**
* Draws the progress bar.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Sets the current progress.
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index d89ff7f2a..358518132 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -65,7 +65,7 @@ void ProgressIndicator::logic()
BLOCK_END("ProgressIndicator::logic")
}
-void ProgressIndicator::draw(gcn::Graphics *graphics)
+void ProgressIndicator::draw(Graphics *graphics)
{
BLOCK_START("ProgressIndicator::draw")
if (mIndicator)
diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h
index fc9ab5b5f..8dd33bf4d 100644
--- a/src/gui/widgets/progressindicator.h
+++ b/src/gui/widgets/progressindicator.h
@@ -46,7 +46,7 @@ class ProgressIndicator final : public gcn::Widget,
void logic() override final;
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
private:
SimpleAnimation *mIndicator;
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index a81afa037..4a47a4b4e 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -110,7 +110,7 @@ void RadioButton::updateAlpha()
}
}
-void RadioButton::drawBox(gcn::Graphics* graphics)
+void RadioButton::drawBox(Graphics* graphics)
{
if (!mSkin)
return;
@@ -154,7 +154,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
}
}
-void RadioButton::draw(gcn::Graphics* graphics)
+void RadioButton::draw(Graphics* graphics)
{
BLOCK_START("RadioButton::draw")
drawBox(graphics);
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index dca2d1167..ff6f5aafd 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -56,13 +56,13 @@ class RadioButton final : public gcn::RadioButton,
/**
* Draws the radiobutton, not the caption.
*/
- void drawBox(gcn::Graphics* graphics) override final;
+ void drawBox(Graphics* graphics) override final;
/**
* Implementation of the draw methods.
* Thus, avoiding the rhomb around the radio button.
*/
- void draw(gcn::Graphics* graphics) override final;
+ void draw(Graphics* graphics) override final;
/**
* Called when the mouse enteres the widget area.
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index a260142a1..89e75f4d7 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -248,7 +248,7 @@ void ScrollArea::updateAlpha()
}
}
-void ScrollArea::draw(gcn::Graphics *graphics)
+void ScrollArea::draw(Graphics *graphics)
{
BLOCK_START("ScrollArea::draw")
if (mVBarVisible || mHBarVisible)
@@ -329,7 +329,7 @@ void ScrollArea::draw(gcn::Graphics *graphics)
BLOCK_END("ScrollArea::draw")
}
-void ScrollArea::updateCalcFlag(gcn::Graphics *const graphics)
+void ScrollArea::updateCalcFlag(Graphics *const graphics)
{
if (!mRedraw)
{
@@ -356,7 +356,7 @@ void ScrollArea::updateCalcFlag(gcn::Graphics *const graphics)
}
}
-void ScrollArea::drawFrame(gcn::Graphics *graphics)
+void ScrollArea::drawFrame(Graphics *graphics)
{
BLOCK_START("ScrollArea::drawFrame")
if (mOpaque)
@@ -392,7 +392,7 @@ void ScrollArea::setOpaque(bool opaque)
setFrameSize(mOpaque ? 2 : 0);
}
-void ScrollArea::drawButton(gcn::Graphics *const graphics,
+void ScrollArea::drawButton(Graphics *const graphics,
const BUTTON_DIR dir)
{
int state = 0;
@@ -430,7 +430,7 @@ void ScrollArea::drawButton(gcn::Graphics *const graphics,
}
}
-void ScrollArea::calcButton(gcn::Graphics *const graphics,
+void ScrollArea::calcButton(Graphics *const graphics,
const BUTTON_DIR dir)
{
int state = 0;
@@ -468,7 +468,7 @@ void ScrollArea::calcButton(gcn::Graphics *const graphics,
}
}
-void ScrollArea::drawVBar(gcn::Graphics *const graphics)
+void ScrollArea::drawVBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalBarDimension();
Graphics *const g = static_cast<Graphics*>(graphics);
@@ -491,7 +491,7 @@ void ScrollArea::drawVBar(gcn::Graphics *const graphics)
}
}
-void ScrollArea::calcVBar(gcn::Graphics *const graphics)
+void ScrollArea::calcVBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalBarDimension();
Graphics *const g = static_cast<Graphics *const>(graphics);
@@ -514,7 +514,7 @@ void ScrollArea::calcVBar(gcn::Graphics *const graphics)
}
}
-void ScrollArea::drawHBar(gcn::Graphics *const graphics)
+void ScrollArea::drawHBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getHorizontalBarDimension();
Graphics *const g = static_cast<Graphics*>(graphics);
@@ -539,7 +539,7 @@ void ScrollArea::drawHBar(gcn::Graphics *const graphics)
}
}
-void ScrollArea::calcHBar(gcn::Graphics *const graphics)
+void ScrollArea::calcHBar(Graphics *const graphics)
{
const gcn::Rectangle &dim = getHorizontalBarDimension();
Graphics *const g = static_cast<Graphics*>(graphics);
@@ -564,7 +564,7 @@ void ScrollArea::calcHBar(gcn::Graphics *const graphics)
}
}
-void ScrollArea::drawVMarker(gcn::Graphics *const graphics)
+void ScrollArea::drawVMarker(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalMarkerDimension();
@@ -580,7 +580,7 @@ void ScrollArea::drawVMarker(gcn::Graphics *const graphics)
}
}
-void ScrollArea::calcVMarker(gcn::Graphics *const graphics)
+void ScrollArea::calcVMarker(Graphics *const graphics)
{
const gcn::Rectangle &dim = getVerticalMarkerDimension();
@@ -596,7 +596,7 @@ void ScrollArea::calcVMarker(gcn::Graphics *const graphics)
}
}
-void ScrollArea::drawHMarker(gcn::Graphics *const graphics)
+void ScrollArea::drawHMarker(Graphics *const graphics)
{
const gcn::Rectangle dim = getHorizontalMarkerDimension();
@@ -612,7 +612,7 @@ void ScrollArea::drawHMarker(gcn::Graphics *const graphics)
}
}
-void ScrollArea::calcHMarker(gcn::Graphics *const graphics)
+void ScrollArea::calcHMarker(Graphics *const graphics)
{
const gcn::Rectangle dim = getHorizontalMarkerDimension();
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 58bd73107..fe60399df 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -84,12 +84,12 @@ class ScrollArea final : public gcn::ScrollArea,
/**
* Draws the scroll area.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(gcn::Graphics *graphics) override final;
+ void drawFrame(Graphics *graphics) override final;
/**
* Sets whether the widget should draw its background or not.
@@ -158,19 +158,19 @@ class ScrollArea final : public gcn::ScrollArea,
*/
void init(std::string skinName);
- void drawButton(gcn::Graphics *const graphics, const BUTTON_DIR dir);
- void calcButton(gcn::Graphics *const graphics, const BUTTON_DIR dir);
- void drawVBar(gcn::Graphics *const graphics) override final;
- void drawHBar(gcn::Graphics *const graphics) override final;
- void drawVMarker(gcn::Graphics *const graphics) override final;
- void drawHMarker(gcn::Graphics *const graphics) override final;
+ void drawButton(Graphics *const graphics, const BUTTON_DIR dir);
+ void calcButton(Graphics *const graphics, const BUTTON_DIR dir);
+ void drawVBar(Graphics *const graphics) override final;
+ void drawHBar(Graphics *const graphics) override final;
+ void drawVMarker(Graphics *const graphics) override final;
+ void drawHMarker(Graphics *const graphics) override final;
- void calcVBar(gcn::Graphics *const graphics);
- void calcHBar(gcn::Graphics *const graphics);
- void calcVMarker(gcn::Graphics *const graphics);
- void calcHMarker(gcn::Graphics *const graphics);
+ void calcVBar(Graphics *const graphics);
+ void calcHBar(Graphics *const graphics);
+ void calcVMarker(Graphics *const graphics);
+ void calcHMarker(Graphics *const graphics);
- void updateCalcFlag(gcn::Graphics *const graphics);
+ void updateCalcFlag(Graphics *const graphics);
static int instances;
static float mAlpha;
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 4a7fda039..644023c43 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -82,7 +82,7 @@ void ShopListBox::setPlayersMoney(const int money)
mPlayerMoney = money;
}
-void ShopListBox::draw(gcn::Graphics *gcnGraphics)
+void ShopListBox::draw(Graphics *gcnGraphics)
{
BLOCK_START("ShopListBox::draw")
if (!mListModel || !mShopItems)
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 095d187eb..509af8393 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -56,7 +56,7 @@ class ShopListBox final : public ListBox
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* gives information about the current player's money
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index 88e27320a..4d4ff2389 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -53,7 +53,7 @@ class ShortcutContainer : public gcn::Widget,
/**
* Draws the shortcuts
*/
- virtual void draw(gcn::Graphics *graphics) override = 0;
+ virtual void draw(Graphics *graphics) override = 0;
/**
* Invoked when a widget changes its size. This is used to determine
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 750b58528..1427bb6eb 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -118,7 +118,7 @@ void Slider::updateAlpha()
}
}
-void Slider::draw(gcn::Graphics *graphics)
+void Slider::draw(Graphics *graphics)
{
BLOCK_START("Slider::draw")
if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index d5d4a30fe..c59e0c47f 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -65,7 +65,7 @@ class Slider final : public gcn::Slider,
/**
* Draws the slider.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Called when the mouse enteres the widget area.
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index 4416a00b7..b75f65820 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -103,7 +103,7 @@ void SliderList::resize()
updateLabel();
}
-void SliderList::draw(gcn::Graphics *graphics)
+void SliderList::draw(Graphics *graphics)
{
BLOCK_START("SliderList::draw")
const int width = mDimension.width;
diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h
index 016a60290..e0f63517b 100644
--- a/src/gui/widgets/sliderlist.h
+++ b/src/gui/widgets/sliderlist.h
@@ -55,7 +55,7 @@ class SliderList final : public Container,
void resize();
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void action(const gcn::ActionEvent &event) override final;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index e59b9fbdb..7c59676b9 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -90,7 +90,7 @@ void SpellShortcutContainer::setWidget2(const Widget2 *const widget)
mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE);
}
-void SpellShortcutContainer::draw(gcn::Graphics *graphics)
+void SpellShortcutContainer::draw(Graphics *graphics)
{
if (!spellShortcut)
return;
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index 37e7b5660..3115e47fe 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -50,7 +50,7 @@ class SpellShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 8cb8fd78a..2a212ce75 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -139,7 +139,7 @@ Tab *TabbedArea::getTab(const std::string &name) const
return nullptr;
}
-void TabbedArea::draw(gcn::Graphics *graphics)
+void TabbedArea::draw(Graphics *graphics)
{
BLOCK_START("TabbedArea::draw")
if (mTabs.empty())
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 7a023903f..dede91767 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -60,7 +60,7 @@ class TabbedArea final : public Widget2,
/**
* Draw the tabbed area.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Return how many tabs have been created.
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index 4f1703d31..d0561cadf 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -153,7 +153,7 @@ void Tab::updateAlpha()
}
}
-void Tab::draw(gcn::Graphics *graphics)
+void Tab::draw(Graphics *graphics)
{
BLOCK_START("Tab::draw")
int mode = TAB_STANDARD;
diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h
index fa9846ab4..66f7521d9 100644
--- a/src/gui/widgets/tabs/tab.h
+++ b/src/gui/widgets/tabs/tab.h
@@ -68,7 +68,7 @@ class Tab : public gcn::BasicContainer,
/**
* Draw the tabbed area.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Set the normal color for the tab's text.
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 3f56ecfcf..8aaca4211 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -350,7 +350,7 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent)
keyEvent.consume();
}
-void TextBox::draw(gcn::Graphics* graphics)
+void TextBox::draw(Graphics* graphics)
{
BLOCK_START("TextBox::draw")
if (mOpaque)
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index 797707716..d8841cfeb 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -62,7 +62,7 @@ class TextBox final : public gcn::TextBox,
void keyPressed(gcn::KeyEvent& keyEvent) override final;
- void draw(gcn::Graphics* graphics) override final;
+ void draw(Graphics* graphics) override final;
void setForegroundColor(const gcn::Color &color);
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index b655de830..b1d188f22 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -137,7 +137,7 @@ void TextField::updateAlpha()
}
}
-void TextField::draw(gcn::Graphics *graphics)
+void TextField::draw(Graphics *graphics)
{
BLOCK_START("TextField::draw")
updateAlpha();
@@ -155,7 +155,7 @@ void TextField::draw(gcn::Graphics *graphics)
BLOCK_END("TextField::draw")
}
-void TextField::drawFrame(gcn::Graphics *graphics)
+void TextField::drawFrame(Graphics *graphics)
{
BLOCK_START("TextField::drawFrame")
const int bs = 2 * mFrameSize;
@@ -661,12 +661,14 @@ void TextField::handleCopy() const
sendBuffer(text);
}
-void TextField::drawCaret(gcn::Graphics* graphics, int x)
+void TextField::drawCaret(Graphics* graphics, int x)
{
- const gcn::Rectangle &clipArea = graphics->getCurrentClipArea();
+ const gcn::Rectangle *const clipArea = graphics->getCurrentClipArea();
+ if (!clipArea)
+ return;
graphics->setColor(*mCaretColor);
- graphics->drawLine(x + mPadding, clipArea.height - mPadding,
+ graphics->drawLine(x + mPadding, clipArea->height - mPadding,
x + mPadding, mPadding);
}
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index d8ab2c830..d3d1ff0eb 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -60,7 +60,7 @@ class TextField : public gcn::TextField,
/**
* Draws the text field.
*/
- virtual void draw(gcn::Graphics *graphics) override;
+ virtual void draw(Graphics *graphics) override;
/**
* Update the alpha value to the graphic components.
@@ -70,7 +70,7 @@ class TextField : public gcn::TextField,
/**
* Draws the background and border.
*/
- void drawFrame(gcn::Graphics *graphics) override final;
+ void drawFrame(Graphics *graphics) override final;
/**
* Determine whether the field should be numeric or not
@@ -142,7 +142,7 @@ class TextField : public gcn::TextField,
void caretDeleteWord();
protected:
- void drawCaret(gcn::Graphics* graphics, int x) override final;
+ void drawCaret(Graphics* graphics, int x) override final;
void fixScroll();
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 8d473dd46..5cfb2abb5 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -79,7 +79,7 @@ TextPreview::~TextPreview()
}
}
-void TextPreview::draw(gcn::Graphics* graphics)
+void TextPreview::draw(Graphics* graphics)
{
BLOCK_START("TextPreview::draw")
if (client->getGuiAlpha() != mAlpha)
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index bfb361a9b..f529e470c 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -102,7 +102,7 @@ class TextPreview final : public gcn::Widget,
*
* @param graphics graphics to draw into
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
/**
* Set opacity for this widget (whether or not to show the background
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c78582a91..26ca0a29f 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -74,7 +74,7 @@ Window::Window(const std::string &caption, const bool modal,
mVertexes(new ImageCollection),
mCaptionOffsetX(7),
mCaptionOffsetY(5),
- mCaptionAlign(gcn::Graphics::LEFT),
+ mCaptionAlign(Graphics::LEFT),
mTitlePadding(4),
mGripPadding(2),
mResizeHandles(-1),
@@ -123,12 +123,12 @@ Window::Window(const std::string &caption, const bool modal,
mCaptionOffsetY = getOption("captionoffsety");
if (!mCaptionOffsetY)
mCaptionOffsetY = 5;
- mCaptionAlign = static_cast<gcn::Graphics::Alignment>(
+ mCaptionAlign = static_cast<Graphics::Alignment>(
getOption("captionalign"));
- if (mCaptionAlign < gcn::Graphics::LEFT
- || mCaptionAlign > gcn::Graphics::RIGHT)
+ if (mCaptionAlign < Graphics::LEFT
+ || mCaptionAlign > Graphics::RIGHT)
{
- mCaptionAlign = gcn::Graphics::LEFT;
+ mCaptionAlign = Graphics::LEFT;
}
setTitleBarHeight(getOption("titlebarHeight"));
if (!mTitleBarHeight)
@@ -203,7 +203,7 @@ void Window::setWindowContainer(WindowContainer *const wc)
windowContainer = wc;
}
-void Window::draw(gcn::Graphics *graphics)
+void Window::draw(Graphics *graphics)
{
if (!mSkin)
return;
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 29fd589a5..68ce1a293 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -80,7 +80,7 @@ class Window : public gcn::Window,
/**
* Draws the window.
*/
- void draw(gcn::Graphics *graphics) override;
+ void draw(Graphics *graphics) override;
/**
* Sets the size of this window.
@@ -501,7 +501,7 @@ class Window : public gcn::Window,
ImageCollection *mVertexes;
int mCaptionOffsetX;
int mCaptionOffsetY;
- gcn::Graphics::Alignment mCaptionAlign;
+ Graphics::Alignment mCaptionAlign;
int mTitlePadding;
int mGripPadding;
int mResizeHandles;
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index d23f29bad..5adde3cae 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -79,7 +79,7 @@ void WindowContainer::moveWidgetAfter(gcn::Widget *const after,
}
#ifdef USE_PROFILER
-void WindowContainer::draw(gcn::Graphics* graphics)
+void WindowContainer::draw(Graphics* graphics)
{
BLOCK_START("WindowContainer::draw")
Container::draw(graphics);
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
index 2ee4ea37d..d940a4e91 100644
--- a/src/gui/widgets/windowcontainer.h
+++ b/src/gui/widgets/windowcontainer.h
@@ -57,7 +57,7 @@ class WindowContainer : public Container
gcn::Widget *const widget);
#ifdef USE_PROFILER
- void draw(gcn::Graphics* graphics);
+ void draw(Graphics* graphics);
#endif
private:
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index a094b5b08..127d3657d 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -419,7 +419,7 @@ void WindowMenu::saveButtons() const
config.deleteKey("windowmenu" + toString(f));
}
-void WindowMenu::drawChildren(gcn::Graphics* graphics)
+void WindowMenu::drawChildren(Graphics* graphics)
{
if (mHaveMouse || !mAutoHide || (mAutoHide == 1
&& mainGraphics && (mSmallWindow || mainGraphics->mWidth > 800)))
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index a87f655d8..bf8298b75 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -118,7 +118,7 @@ class WindowMenu final : public Container,
#endif
protected:
- void drawChildren(gcn::Graphics* graphics) override final;
+ void drawChildren(Graphics* graphics) override final;
private:
inline void addButton(const char *const text,
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index cfefa8159..ccddc76cd 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -247,7 +247,7 @@ void BuyDialog::init()
mSlider = new Slider(1.0);
mQuantityLabel = new Label(this, strprintf(
"%d / %d", mAmountItems, mMaxItems));
- mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
+ mQuantityLabel->setAlignment(Graphics::CENTER);
// TRANSLATORS: buy dialog label
mMoneyLabel = new Label(this, strprintf(
_("Price: %s / Total: %s"), "", ""));
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index a21efbe52..5bff2ee4b 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1902,7 +1902,7 @@ void ChatWindow::mouseExited(gcn::MouseEvent& mouseEvent)
Window::mouseExited(mouseEvent);
}
-void ChatWindow::draw(gcn::Graphics* graphics)
+void ChatWindow::draw(Graphics* graphics)
{
BLOCK_START("ChatWindow::draw")
if (!mAutoHide || mHaveMouse)
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 742c79876..d20f68ecc 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -280,7 +280,7 @@ class ChatWindow final : public Window,
void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) override final;
- void draw(gcn::Graphics* graphics) override final;
+ void draw(Graphics* graphics) override final;
void updateVisibility();
diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp
index 6d01dcaae..b0ffc25cd 100644
--- a/src/gui/windows/connectiondialog.cpp
+++ b/src/gui/windows/connectiondialog.cpp
@@ -66,7 +66,7 @@ void ConnectionDialog::action(const gcn::ActionEvent &)
client->setState(mCancelState);
}
-void ConnectionDialog::draw(gcn::Graphics *graphics)
+void ConnectionDialog::draw(Graphics *graphics)
{
BLOCK_START("ConnectionDialog::draw")
// Don't draw the window background, only draw the children
diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h
index dd3c84e5e..773522839 100644
--- a/src/gui/windows/connectiondialog.h
+++ b/src/gui/windows/connectiondialog.h
@@ -57,7 +57,7 @@ class ConnectionDialog final : public Window, private gcn::ActionListener
*/
void action(const gcn::ActionEvent &) override;
- void draw(gcn::Graphics *graphics) override;
+ void draw(Graphics *graphics) override;
private:
State mCancelState;
diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp
index 30d202054..4f57b9798 100644
--- a/src/gui/windows/debugwindow.cpp
+++ b/src/gui/windows/debugwindow.cpp
@@ -129,7 +129,7 @@ void DebugWindow::slowLogic()
BLOCK_END("DebugWindow::slowLogic")
}
-void DebugWindow::draw(gcn::Graphics *g)
+void DebugWindow::draw(Graphics *g)
{
BLOCK_START("DebugWindow::draw")
Window::draw(g);
diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h
index 13e73c29e..83d6676da 100644
--- a/src/gui/windows/debugwindow.h
+++ b/src/gui/windows/debugwindow.h
@@ -147,7 +147,7 @@ class DebugWindow final : public Window
*/
void slowLogic();
- void draw(gcn::Graphics *g) override final;
+ void draw(Graphics *g) override final;
void setPing(int pingTime);
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index c796c8433..e7bf02aa9 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -156,7 +156,7 @@ EquipmentWindow::~EquipmentWindow()
mVertexes = nullptr;
}
-void EquipmentWindow::draw(gcn::Graphics *graphics)
+void EquipmentWindow::draw(Graphics *graphics)
{
BLOCK_START("EquipmentWindow::draw")
// Draw window graphics
diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h
index 4b6ae8b4c..1ce8611a7 100644
--- a/src/gui/windows/equipmentwindow.h
+++ b/src/gui/windows/equipmentwindow.h
@@ -81,7 +81,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener
/**
* Draws the equipment window.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void action(const gcn::ActionEvent &event) override final;
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 02be64a13..181055053 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -233,7 +233,7 @@ void Minimap::toggle()
mShow = isWindowVisible();
}
-void Minimap::draw(gcn::Graphics *graphics)
+void Minimap::draw(Graphics *graphics)
{
BLOCK_START("Minimap::draw")
Window::draw(graphics);
diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h
index 90c08db0f..661412c57 100644
--- a/src/gui/windows/minimap.h
+++ b/src/gui/windows/minimap.h
@@ -60,7 +60,7 @@ class Minimap final : public Window, public ConfigListener
/**
* Draws the minimap.
*/
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void mouseMoved(gcn::MouseEvent &event) override final;
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index b5832c7b7..3513bb2ff 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -308,7 +308,7 @@ void MiniStatusWindow::logic()
BLOCK_END("MiniStatusWindow::logic")
}
-void MiniStatusWindow::draw(gcn::Graphics *graphics)
+void MiniStatusWindow::draw(Graphics *graphics)
{
BLOCK_START("MiniStatusWindow::draw")
drawChildren(graphics);
diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h
index 2a5903eca..7748f51d1 100644
--- a/src/gui/windows/ministatuswindow.h
+++ b/src/gui/windows/ministatuswindow.h
@@ -68,7 +68,7 @@ class MiniStatusWindow final : public Popup,
void logic() override final;
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void mouseMoved(gcn::MouseEvent &mouseEvent) override final;
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index d686056ac..677337b70 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -91,8 +91,8 @@ OutfitWindow::OutfitWindow():
setMinWidth(145);
setMinHeight(220);
- mCurrentLabel->setAlignment(gcn::Graphics::CENTER);
- mKeyLabel->setAlignment(gcn::Graphics::CENTER);
+ mCurrentLabel->setAlignment(Graphics::CENTER);
+ mKeyLabel->setAlignment(Graphics::CENTER);
mUnequipCheck->setActionEventId("unequip");
mUnequipCheck->addActionListener(this);
@@ -310,7 +310,7 @@ void OutfitWindow::copyOutfit(const int src, const int dst)
save();
}
-void OutfitWindow::draw(gcn::Graphics *graphics)
+void OutfitWindow::draw(Graphics *graphics)
{
BLOCK_START("OutfitWindow::draw")
Window::draw(graphics);
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index 6d54889e6..01e72aefc 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -52,7 +52,7 @@ class OutfitWindow final : public Window,
void action(const gcn::ActionEvent &event) override final;
- void draw(gcn::Graphics *graphics) override final;
+ void draw(Graphics *graphics) override final;
void mousePressed(gcn::MouseEvent &event) override final;
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index 15389a9c3..a4ff29f78 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -94,7 +94,7 @@ void SellDialog::init()
mQuantityLabel = new Label(this, strprintf(
"%d / %d", mAmountItems, mMaxItems));
- mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
+ mQuantityLabel->setAlignment(Graphics::CENTER);
// TRANSLATORS: sell dialog label
mMoneyLabel = new Label(this, strprintf(_("Price: %s / Total: %s"),
"", ""));
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index dec80b50a..82a264ac7 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -157,7 +157,7 @@ public:
mHighlightColor = getThemeColor(Theme::HIGHLIGHT);
}
- void draw(gcn::Graphics *graphics) override final
+ void draw(Graphics *graphics) override final
{
if (!mListModel)
return;
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index c4505b37c..674848725 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -100,7 +100,7 @@ class SkillListBox final : public ListBox
return static_cast<SkillModel*>(mListModel)->getSkillAt(selected);
}
- void draw(gcn::Graphics *gcnGraphics) override
+ void draw(Graphics *gcnGraphics) override
{
if (!mListModel)
return;
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 7e3687006..653b4d4c0 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -20,6 +20,49 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* _______ __ __ __ ______ __ __ _______ __ __
+ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
+ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
+ * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
+ * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
+ *
+ * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
+ *
+ *
+ * Per Larsson a.k.a finalman
+ * Olof Naessén a.k.a jansem/yakslem
+ *
+ * Visit: http://guichan.sourceforge.net
+ *
+ * License: (BSD)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of Guichan nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#include "render/graphics.h"
#include "main.h"
@@ -48,11 +91,11 @@
Graphics *mainGraphics = nullptr;
Graphics::Graphics() :
- gcn::Graphics(),
mWidth(0),
mHeight(0),
mActualWidth(0),
mActualHeight(0),
+ mClipStack(),
mWindow(nullptr),
#ifdef USE_SDL2
mRenderer(nullptr),
@@ -503,3 +546,82 @@ void Graphics::setWindowSize(const int width A_UNUSED,
SDL_SetWindowSize(mWindow, width, height);
#endif
}
+
+bool Graphics::pushClipArea(gcn::Rectangle area)
+{
+ // Ignore area with a negate width or height
+ // by simple pushing an empty clip area
+ // to the stack.
+ if (area.width < 0 || area.height < 0)
+ {
+ gcn::ClipRectangle carea;
+ mClipStack.push(carea);
+ return true;
+ }
+
+ if (mClipStack.empty())
+ {
+ gcn::ClipRectangle carea;
+ carea.x = area.x;
+ carea.y = area.y;
+ carea.width = area.width;
+ carea.height = area.height;
+ carea.xOffset = area.x;
+ carea.yOffset = area.y;
+ mClipStack.push(carea);
+ return true;
+ }
+
+ const gcn::ClipRectangle &top = mClipStack.top();
+ gcn::ClipRectangle carea;
+ carea = area;
+ carea.xOffset = top.xOffset + carea.x;
+ carea.yOffset = top.yOffset + carea.y;
+ carea.x += top.xOffset;
+ carea.y += top.yOffset;
+
+ // Clamp the pushed clip rectangle.
+ if (carea.x < top.x)
+ carea.x = top.x;
+
+ if (carea.y < top.y)
+ carea.y = top.y;
+
+ if (carea.x + carea.width > top.x + top.width)
+ {
+ carea.width = top.x + top.width - carea.x;
+
+ if (carea.width < 0)
+ carea.width = 0;
+ }
+
+ if (carea.y + carea.height > top.y + top.height)
+ {
+ carea.height = top.y + top.height - carea.y;
+
+ if (carea.height < 0)
+ carea.height = 0;
+ }
+
+ const bool result = carea.isIntersecting(top);
+
+ mClipStack.push(carea);
+
+ return result;
+}
+
+void Graphics::popClipArea()
+{
+ if (mClipStack.empty())
+ return;
+
+ mClipStack.pop();
+}
+
+const gcn::ClipRectangle *Graphics::getCurrentClipArea() const
+{
+ if (mClipStack.empty())
+ return nullptr;
+
+ return &mClipStack.top();
+}
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 93d46b475..53eb4af12 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -20,6 +20,49 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* _______ __ __ __ ______ __ __ _______ __ __
+ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
+ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
+ * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
+ * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
+ *
+ * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
+ *
+ *
+ * Per Larsson a.k.a finalman
+ * Olof Naessén a.k.a jansem/yakslem
+ *
+ * Visit: http://guichan.sourceforge.net
+ *
+ * License: (BSD)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of Guichan nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef RENDER_GRAPHICS_H
#define RENDER_GRAPHICS_H
@@ -29,13 +72,15 @@
#include "render/renderers.h"
+#include "gui/base/cliprectangle.hpp"
#include "gui/base/color.hpp"
-#include "gui/base/graphics.hpp"
#ifdef USE_SDL2
#include <SDL_render.h>
#endif
+#include <stack>
+
#include "localconsts.h"
class Image;
@@ -94,7 +139,7 @@ class ImageRect final
/**
* A central point of control for graphics.
*/
-class Graphics : public gcn::Graphics
+class Graphics
{
public:
A_DELETE_COPY(Graphics)
@@ -104,6 +149,16 @@ class Graphics : public gcn::Graphics
*/
virtual ~Graphics();
+ /**
+ * Alignments for text drawing.
+ */
+ enum Alignment
+ {
+ LEFT = 0,
+ CENTER,
+ RIGHT
+ };
+
void setWindow(SDL_Window *const window,
const int width, const int height)
{
@@ -145,14 +200,6 @@ class Graphics : public gcn::Graphics
*/
virtual bool resizeScreen(const int width, const int height);
- // override unused abstract function
- void drawImage(const gcn::Image* image A_UNUSED,
- int srcX A_UNUSED, int srcY A_UNUSED,
- int dstX A_UNUSED, int dstY A_UNUSED,
- int width A_UNUSED, int height A_UNUSED) override final
- {
- }
-
/**
* Draws a resclaled version of the image
*/
@@ -211,8 +258,7 @@ class Graphics : public gcn::Graphics
const int w, const int h,
const ImageRect &imgRect) = 0;
- virtual void fillRectangle(const gcn::Rectangle& rectangle)
- override = 0;
+ virtual void fillRectangle(const gcn::Rectangle& rectangle) = 0;
/**
* Updates the screen. This is done by either copying the buffer to the
@@ -246,9 +292,6 @@ class Graphics : public gcn::Graphics
const int x2, const int y2,
const int width, const int height);
- const gcn::Font *getFont() const A_WARN_UNUSED
- { return mFont; }
-
gcn::ClipRectangle &getTopClip() A_WARN_UNUSED
{ return mClipStack.top(); }
@@ -288,7 +331,7 @@ class Graphics : public gcn::Graphics
virtual void initArrays()
{ }
- void setColor(const gcn::Color &color) override
+ virtual void setColor(const gcn::Color &color)
{
mColor = color;
mColor2 = color;
@@ -305,7 +348,7 @@ class Graphics : public gcn::Graphics
mAlpha = (color.a != 255);
}
- const gcn::Color &getColor() const override
+ const gcn::Color &getColor() const
{ return mColor; }
const gcn::Color &getColor2() const
@@ -353,6 +396,87 @@ class Graphics : public gcn::Graphics
void setScale(int scale);
+ /**
+ * Pushes a clip area onto the stack. The x and y coordinates in the
+ * rectangle is relative to the last pushed clip area.
+ * If the new area falls outside the current clip area, it will be
+ * clipped as necessary.
+ *
+ * If a clip area is outside of the top clip area a clip area with
+ * zero width and height will be pushed.
+ *
+ * @param area The clip area to be pushed onto the stack.
+ * @return False if the the new area lays outside the current clip
+ * area.
+ */
+ virtual bool pushClipArea(gcn::Rectangle area);
+
+ /**
+ * Removes the top most clip area from the stack.
+ *
+ * @throws Exception if the stack is empty.
+ */
+ virtual void popClipArea();
+
+ /**
+ * Ddraws a line.
+ *
+ * @param x1 The first x coordinate.
+ * @param y1 The first y coordinate.
+ * @param x2 The second x coordinate.
+ * @param y2 The second y coordinate.
+ */
+ virtual void drawLine(int x1, int y1, int x2, int y2) = 0;
+
+ /**
+ * Draws a simple, non-filled, rectangle with a one pixel width.
+ *
+ * @param rectangle The rectangle to draw.
+ */
+ virtual void drawRectangle(const gcn::Rectangle &rectangle) = 0;
+
+ /**
+ * Gets the current clip area. Usefull if you want to do drawing
+ * bypassing Graphics.
+ *
+ * @return The current clip area.
+ */
+ virtual const gcn::ClipRectangle *getCurrentClipArea() const;
+
+ /**
+ * Draws a single point/pixel.
+ *
+ * @param x The x coordinate.
+ * @param y The y coordinate.
+ */
+ virtual void drawPoint(int x, int y) = 0;
+
+ /**
+ * Initializes drawing. Called by the Gui when Gui::draw() is called.
+ * It is needed by some implementations of Graphics to perform
+ * preparations before drawing. An example of such an implementation
+ * is the OpenGLGraphics.
+ *
+ * NOTE: You will never need to call this function yourself, unless
+ * you use a Graphics object outside of Guichan.
+ *
+ * @see _endDraw, Gui::draw
+ */
+ virtual void _beginDraw()
+ { }
+
+ /**
+ * Deinitializes drawing. Called by the Gui when a Gui::draw() is done.
+ * done. It should reset any state changes made by _beginDraw().
+ *
+ * NOTE: You will never need to call this function yourself, unless
+ * you use a Graphics object outside of Guichan.
+ *
+ * @see _beginDraw, Gui::draw
+ */
+ virtual void _endDraw()
+ { }
+
int mWidth;
int mHeight;
int mActualWidth;
@@ -382,6 +506,11 @@ class Graphics : public gcn::Graphics
bool videoInfo();
+ /**
+ * Holds the clip area stack.
+ */
+ std::stack<gcn::ClipRectangle> mClipStack;
+
SDL_Window *mWindow;
#ifdef USE_SDL2
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 82bf04dc8..252dc0766 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -963,7 +963,7 @@ bool MobileOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transY = -clipArea.yOffset;
}
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &clipArea = mClipStack.top();
transX += clipArea.xOffset;
@@ -990,7 +990,7 @@ void MobileOpenGLGraphics::popClipArea()
int transX = -clipArea1.xOffset;
int transY = -clipArea1.yOffset;
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index e8e1a2116..aea3f5d24 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -1223,7 +1223,7 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transY = -clipArea.yOffset;
}
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &clipArea = mClipStack.top();
transX += clipArea.xOffset;
@@ -1251,7 +1251,7 @@ void NormalOpenGLGraphics::popClipArea()
int transX = -clipArea1.xOffset;
int transY = -clipArea1.yOffset;
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index 3ea1e4182..d1c6ed0a6 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -947,7 +947,7 @@ bool NullOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transY = -clipArea.yOffset;
}
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &clipArea = mClipStack.top();
transX += clipArea.xOffset;
@@ -958,7 +958,7 @@ bool NullOpenGLGraphics::pushClipArea(gcn::Rectangle area)
void NullOpenGLGraphics::popClipArea()
{
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index bf9334655..c27db4f47 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -535,7 +535,7 @@ bool SafeOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transY = -clipArea.yOffset;
}
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &clipArea = mClipStack.top();
@@ -551,7 +551,7 @@ bool SafeOpenGLGraphics::pushClipArea(gcn::Rectangle area)
void SafeOpenGLGraphics::popClipArea()
{
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp
index 285b2dac2..46d8360b6 100644
--- a/src/render/sdl2graphics.cpp
+++ b/src/render/sdl2graphics.cpp
@@ -20,6 +20,49 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* _______ __ __ __ ______ __ __ _______ __ __
+ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
+ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
+ * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
+ * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
+ *
+ * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
+ *
+ *
+ * Per Larsson a.k.a finalman
+ * Olof Naessén a.k.a jansem/yakslem
+ *
+ * Visit: http://guichan.sourceforge.net
+ *
+ * License: (BSD)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of Guichan nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifdef USE_SDL2
#include "render/sdl2graphics.h"
@@ -621,7 +664,7 @@ void SDLGraphics::_endDraw()
bool SDLGraphics::pushClipArea(gcn::Rectangle area)
{
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &carea = mClipStack.top();
const SDL_Rect rect =
@@ -637,7 +680,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area)
void SDLGraphics::popClipArea()
{
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h
index c4e0d74a7..1e581dc39 100644
--- a/src/render/sdl2graphics.h
+++ b/src/render/sdl2graphics.h
@@ -20,6 +20,49 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* _______ __ __ __ ______ __ __ _______ __ __
+ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
+ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
+ * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
+ * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
+ *
+ * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
+ *
+ *
+ * Per Larsson a.k.a finalman
+ * Olof Naessén a.k.a jansem/yakslem
+ *
+ * Visit: http://guichan.sourceforge.net
+ *
+ * License: (BSD)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of Guichan nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef RENDER_SDL2GRAPHICS_H
#define RENDER_SDL2GRAPHICS_H
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index c158844ae..e78a87c7e 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -1126,7 +1126,7 @@ void SDL2SoftwareGraphics::_endDraw()
bool SDL2SoftwareGraphics::pushClipArea(gcn::Rectangle area)
{
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &carea = mClipStack.top();
const SDL_Rect rect =
@@ -1142,7 +1142,7 @@ bool SDL2SoftwareGraphics::pushClipArea(gcn::Rectangle area)
void SDL2SoftwareGraphics::popClipArea()
{
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 9e950c12f..2226be0da 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -1122,7 +1122,7 @@ void SDLGraphics::_endDraw()
bool SDLGraphics::pushClipArea(gcn::Rectangle area)
{
- const bool result = gcn::Graphics::pushClipArea(area);
+ const bool result = Graphics::pushClipArea(area);
const gcn::ClipRectangle &carea = mClipStack.top();
const SDL_Rect rect =
{
@@ -1138,7 +1138,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area)
void SDLGraphics::popClipArea()
{
- gcn::Graphics::popClipArea();
+ Graphics::popClipArea();
if (mClipStack.empty())
return;
diff --git a/src/text.cpp b/src/text.cpp
index fdd538d72..a1ffea08c 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -40,7 +40,7 @@ int Text::mInstances = 0;
ImageRect Text::mBubble;
Text::Text(const std::string &text, const int x, const int y,
- const gcn::Graphics::Alignment alignment,
+ const Graphics::Alignment alignment,
const gcn::Color *const color, const bool isSpeech,
gcn::Font *const font) :
mFont(font ? font : (gui ? gui->getFont() : nullptr)),
@@ -78,13 +78,13 @@ Text::Text(const std::string &text, const int x, const int y,
switch (alignment)
{
- case gcn::Graphics::LEFT:
+ case Graphics::LEFT:
mXOffset = 0;
break;
- case gcn::Graphics::CENTER:
+ case Graphics::CENTER:
mXOffset = mWidth / 2;
break;
- case gcn::Graphics::RIGHT:
+ case Graphics::RIGHT:
mXOffset = mWidth;
break;
default:
@@ -151,7 +151,7 @@ void Text::draw(Graphics *const graphics, const int xOff, const int yOff)
}
FlashText::FlashText(const std::string &text, const int x, const int y,
- const gcn::Graphics::Alignment alignment,
+ const Graphics::Alignment alignment,
const gcn::Color *const color, gcn::Font *const font) :
Text(text, x, y, alignment, color, false, font),
mTime(0)
diff --git a/src/text.h b/src/text.h
index ed980e588..b21ca51a7 100644
--- a/src/text.h
+++ b/src/text.h
@@ -30,6 +30,11 @@
#include "localconsts.h"
+namespace gcn
+{
+ class Font;
+}
+
class Text
{
friend class TextManager;
@@ -39,7 +44,7 @@ class Text
* Constructor creates a text object to display on the screen.
*/
Text(const std::string &text, const int x, const int y,
- const gcn::Graphics::Alignment alignment,
+ const Graphics::Alignment alignment,
const gcn::Color *const color, const bool isSpeech = false,
gcn::Font *const font = nullptr);
@@ -90,7 +95,7 @@ class FlashText final : public Text
{
public:
FlashText(const std::string &text, const int x, const int y,
- const gcn::Graphics::Alignment alignment,
+ const Graphics::Alignment alignment,
const gcn::Color *const color,
gcn::Font *const font = nullptr);