mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added GuiMsgBoxOk.
This commit is contained in:
parent
9b1ba71fa3
commit
d419bb368a
|
@ -177,6 +177,7 @@ set(ES_HEADERS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxOk.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.h
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.h
|
||||||
|
@ -233,6 +234,7 @@ set(ES_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxOk.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameList.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.cpp
|
||||||
|
|
46
src/components/GuiMsgBoxOk.cpp
Normal file
46
src/components/GuiMsgBoxOk.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#include "GuiMsgBoxOk.h"
|
||||||
|
#include "../Renderer.h"
|
||||||
|
|
||||||
|
GuiMsgBoxOk::GuiMsgBoxOk(Window* window, const std::string& text, std::function<void()> callback) : GuiComponent(window),
|
||||||
|
mCallback(callback),
|
||||||
|
mText(window),
|
||||||
|
mOkText(window)
|
||||||
|
{
|
||||||
|
mText.setCentered(true);
|
||||||
|
mText.setColor(0x00BB00FF);
|
||||||
|
mText.setSize((float)Renderer::getScreenWidth(), 0);
|
||||||
|
mText.setText(text);
|
||||||
|
|
||||||
|
mOkText.setCentered(true);
|
||||||
|
mOkText.setColor(0x0044BBFF);
|
||||||
|
mOkText.setFont(Font::get(FONT_SIZE_SMALL));
|
||||||
|
mOkText.setSize((float)Renderer::getScreenWidth(), 0);
|
||||||
|
mOkText.setText("[A]");
|
||||||
|
|
||||||
|
mText.setPosition(0, (Renderer::getScreenHeight() - mText.getSize().y() - mOkText.getSize().y()) / 2);
|
||||||
|
mOkText.setPosition(0, mText.getPosition().y() + mText.getSize().y());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GuiMsgBoxOk::input(InputConfig* config, Input input)
|
||||||
|
{
|
||||||
|
if(input.value != 0 &&
|
||||||
|
(config->isMappedTo("a", input) || config->isMappedTo("b", input)))
|
||||||
|
{
|
||||||
|
if(mCallback)
|
||||||
|
mCallback();
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiMsgBoxOk::render(const Eigen::Affine3f& parentTrans)
|
||||||
|
{
|
||||||
|
float height = mText.getSize().y() + mOkText.getSize().y();
|
||||||
|
Renderer::setMatrix(parentTrans);
|
||||||
|
Renderer::drawRect(0, (int)((Renderer::getScreenHeight() - height) / 2), Renderer::getScreenWidth(), (int)height, 0x111111FF);
|
||||||
|
mText.render(parentTrans);
|
||||||
|
mOkText.render(parentTrans);
|
||||||
|
}
|
20
src/components/GuiMsgBoxOk.h
Normal file
20
src/components/GuiMsgBoxOk.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../GuiComponent.h"
|
||||||
|
#include "TextComponent.h"
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
class GuiMsgBoxOk : public GuiComponent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GuiMsgBoxOk(Window* window, const std::string& msg, std::function<void()> okCallback = nullptr);
|
||||||
|
|
||||||
|
bool input(InputConfig* config, Input input) override;
|
||||||
|
void render(const Eigen::Affine3f& parentTrans) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void()> mCallback;
|
||||||
|
|
||||||
|
TextComponent mText;
|
||||||
|
TextComponent mOkText;
|
||||||
|
};
|
|
@ -1,4 +1,5 @@
|
||||||
#include "GuiScraperStart.h"
|
#include "GuiScraperStart.h"
|
||||||
|
#include "GuiMsgBoxOk.h"
|
||||||
|
|
||||||
GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
|
GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
|
||||||
mBox(window, ":/frame.png"),
|
mBox(window, ":/frame.png"),
|
||||||
|
@ -55,6 +56,8 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
|
||||||
void GuiScraperStart::start()
|
void GuiScraperStart::start()
|
||||||
{
|
{
|
||||||
std::queue<ScraperSearchParams> searches = getSearches(mSystemsOpt.getSelectedObjects(), mFiltersOpt.getSelectedObjects()[0]);
|
std::queue<ScraperSearchParams> searches = getSearches(mSystemsOpt.getSelectedObjects(), mFiltersOpt.getSelectedObjects()[0]);
|
||||||
|
|
||||||
|
mWindow->pushGui(new GuiMsgBoxOk(mWindow, "this isn't implemented yet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::queue<ScraperSearchParams> GuiScraperStart::getSearches(std::vector<SystemData*> systems, GameFilterFunc selector)
|
std::queue<ScraperSearchParams> GuiScraperStart::getSearches(std::vector<SystemData*> systems, GameFilterFunc selector)
|
||||||
|
|
Loading…
Reference in a new issue