summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-25 17:05:47 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-25 17:05:47 +0300
commitf99569872f391ee0090348bf58d4a2a43c549eda (patch)
treed7196f30c7106a0816a13746d9ca06bad7ab0ea3 /src
parent95d7e3775c24aad327e8aa13ec401da45be5c7f5 (diff)
downloadmv-f99569872f391ee0090348bf58d4a2a43c549eda.tar.gz
mv-f99569872f391ee0090348bf58d4a2a43c549eda.tar.bz2
mv-f99569872f391ee0090348bf58d4a2a43c549eda.tar.xz
mv-f99569872f391ee0090348bf58d4a2a43c549eda.zip
Add basic support for draw controls method without batching (safeDraw).
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.cpp18
-rw-r--r--src/gui/widgets/widget.h3
-rw-r--r--src/touchmanager.cpp5
-rw-r--r--src/touchmanager.h2
4 files changed, 25 insertions, 3 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index d54a924f1..49b6d2774 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -83,6 +83,8 @@
#include "input/inputmanager.h"
+#include "render/renderers.h"
+
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
@@ -452,9 +454,19 @@ bool Gui::handleKeyInput()
void Gui::draw()
{
BLOCK_START("Gui::draw 1")
- mGraphics->pushClipArea(getTop()->getDimension());
- getTop()->draw(mGraphics);
- touchManager.draw();
+ Widget *const top = getTop();
+ mGraphics->pushClipArea(top->getDimension());
+
+ if (isBatchDrawRenders(openGLMode))
+ {
+ top->draw(mGraphics);
+ touchManager.draw();
+ }
+ else
+ {
+ top->safeDraw(mGraphics);
+ touchManager.safeDraw();
+ }
int mouseX;
int mouseY;
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index 8191754e5..86e54510f 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -122,6 +122,9 @@ class Widget notfinal : public Widget2
*/
virtual void draw(Graphics* graphics) = 0;
+ virtual void safeDraw(Graphics* graphics)
+ { draw(graphics); }
+
/**
* Called when a widget is given a chance to draw a frame around itself.
* The frame is not considered a part of the widget, it only allows a frame
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index efa4758b1..19024fff4 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -268,6 +268,11 @@ void TouchManager::draw()
}
}
+void TouchManager::safeDraw()
+{
+ draw();
+}
+
bool TouchManager::processEvent(const MouseInput &mouseInput)
{
const int x = mouseInput.getTouchX();
diff --git a/src/touchmanager.h b/src/touchmanager.h
index 6a8e74627..87f99c8d0 100644
--- a/src/touchmanager.h
+++ b/src/touchmanager.h
@@ -125,6 +125,8 @@ class TouchManager final : public ConfigListener
void draw();
+ void safeDraw();
+
bool processEvent(const MouseInput &mouseInput);
bool isActionActive(const int index) const;