diff --git a/src/config.cpp b/src/config.cpp index 66c7944..383a567 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -480,7 +480,9 @@ parseOverlayButtonDesc(const ptree &pt, TouchOverlay::Button &out) static void parseOverlayDesc(const ptree &pt, TouchOverlay &out) { - out.image = pt.get("image"); + for (auto &img : pt.get_child("images")) { + out.images[img.second.get("id")] = img.second.get("file"); + } const ptree &buttons = pt.get_child("buttons"); for (ptree::const_iterator ci = buttons.begin(); ci != buttons.end(); ++ci) diff --git a/src/config.h b/src/config.h index b737602..f207cb1 100644 --- a/src/config.h +++ b/src/config.h @@ -24,11 +24,12 @@ #include #include +#include #include struct TouchOverlay { - std::string image; + std::map images; struct Button { diff --git a/src/graphics.cpp b/src/graphics.cpp index 00ddd08..066bff6 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -503,12 +503,16 @@ struct GraphicsPrivate TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y); TEXFBO::linkFBO(frozenScene); + setOverlay(0); + FloatRect screenRect(0, 0, scRes.x, scRes.y); screenQuad.setTexPosRect(screenRect, screenRect); fpsLimiter.resetFrameAdjust(); - - const std::string &olImage = rtData->config.touchOverlay.image; + } + + void setOverlay(int id) { + const std::string &olImage = threadData->config.touchOverlay.images[id]; if (!olImage.empty()) { SDL_RWops *ops = SDL_RWFromFile(olImage.c_str(), "rb"); @@ -862,6 +866,11 @@ void Graphics::frameReset() p->fpsLimiter.resetFrameAdjust(); } +void Graphics::setOverlay(int id) +{ + p->setOverlay(id); +} + static void guardDisposed() {} DEF_ATTR_RD_SIMPLE(Graphics, FrameRate, int, p->frameRate) diff --git a/src/graphics.h b/src/graphics.h index aa30189..f609264 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -40,6 +40,7 @@ public: const char *filename = "", int vague = 40); void frameReset(); + void setOverlay(int); DECL_ATTR( FrameRate, int ) DECL_ATTR( FrameCount, int )