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 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) (limited to 'src/touchmanager.cpp') 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(); -- cgit v1.2.3-60-g2f50