From 68d07e98a4d8721b9e93a87ecd573fbc336b565b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 17:15:54 +0300 Subject: Add safeDraw method into touchmanager. --- src/touchmanager.cpp | 69 ++++++++++++++++++++++++++-------------------------- src/touchmanager.h | 2 ++ 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index 19024fff4..d63896a47 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -196,53 +196,57 @@ void TouchManager::clear() void TouchManager::draw() { - if (isBatchDrawRenders(openGLMode)) - { - if (mRedraw) - { - mRedraw = false; - mVertexes->clear(); - FOR_EACH (TouchItemVectorCIter, it, mObjects) - { - const TouchItem *const item = *it; - if (item && item->images && (mShow || - (item == mKeyboard && mShowKeyboard))) - { - mainGraphics->calcWindow(mVertexes, item->x, item->y, - item->width, item->height, *item->images); - const Image *const icon = item->icon; - if (icon) - { - mainGraphics->calcTileCollection(mVertexes, icon, - item->x + (item->width - icon->mBounds.w) / 2, - item->y + (item->height - icon->mBounds.h) / 2); - } - } - } - mainGraphics->finalize(mVertexes); - } - mainGraphics->drawTileCollection(mVertexes); - } - else + if (mRedraw) { + mRedraw = false; + mVertexes->clear(); FOR_EACH (TouchItemVectorCIter, it, mObjects) { const TouchItem *const item = *it; if (item && item->images && (mShow || (item == mKeyboard && mShowKeyboard))) { - mainGraphics->drawImageRect(item->x, item->y, + mainGraphics->calcWindow(mVertexes, item->x, item->y, item->width, item->height, *item->images); const Image *const icon = item->icon; if (icon) { - mainGraphics->drawImage(icon, + mainGraphics->calcTileCollection(mVertexes, icon, item->x + (item->width - icon->mBounds.w) / 2, item->y + (item->height - icon->mBounds.h) / 2); } } } + mainGraphics->finalize(mVertexes); + } + mainGraphics->drawTileCollection(mVertexes); + drawText(); +} + +void TouchManager::safeDraw() +{ + FOR_EACH (TouchItemVectorCIter, it, mObjects) + { + const TouchItem *const item = *it; + if (item && item->images && (mShow || + (item == mKeyboard && mShowKeyboard))) + { + mainGraphics->drawImageRect(item->x, item->y, + item->width, item->height, *item->images); + const Image *const icon = item->icon; + if (icon) + { + mainGraphics->drawImage(icon, + item->x + (item->width - icon->mBounds.w) / 2, + item->y + (item->height - icon->mBounds.h) / 2); + } + } } + drawText(); +} + +void TouchManager::drawText() +{ if (!gui) return; @@ -268,11 +272,6 @@ 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 87f99c8d0..63a84ba5f 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -127,6 +127,8 @@ class TouchManager final : public ConfigListener void safeDraw(); + void drawText(); + bool processEvent(const MouseInput &mouseInput); bool isActionActive(const int index) const; -- cgit v1.2.3-70-g09d2