diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-25 17:15:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-25 17:15:54 +0300 |
commit | 68d07e98a4d8721b9e93a87ecd573fbc336b565b (patch) | |
tree | 3a9974b2138c6b92e0e9a457fa87b2664e5d1f9d /src | |
parent | 2cfbdedad7488301cb72c0ba05a450bdca7f7435 (diff) | |
download | plus-68d07e98a4d8721b9e93a87ecd573fbc336b565b.tar.gz plus-68d07e98a4d8721b9e93a87ecd573fbc336b565b.tar.bz2 plus-68d07e98a4d8721b9e93a87ecd573fbc336b565b.tar.xz plus-68d07e98a4d8721b9e93a87ecd573fbc336b565b.zip |
Add safeDraw method into touchmanager.
Diffstat (limited to 'src')
-rw-r--r-- | src/touchmanager.cpp | 69 | ||||
-rw-r--r-- | 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; |