2020-09-18 16:40:22 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2023-12-16 18:48:25 +00:00
|
|
|
// ES-DE
|
2022-01-17 17:43:29 +00:00
|
|
|
// Screensaver.cpp
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2020-11-10 21:18:20 +00:00
|
|
|
// Screensaver, supporting the following types:
|
2020-07-27 14:53:54 +00:00
|
|
|
// Dim, black, slideshow, video.
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
#include "Screensaver.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
|
|
|
|
#include "FileData.h"
|
|
|
|
#include "Log.h"
|
2016-12-14 08:30:54 +00:00
|
|
|
#include "SystemData.h"
|
2022-05-16 17:59:34 +00:00
|
|
|
#include "UIModeController.h"
|
2022-01-02 12:13:01 +00:00
|
|
|
#include "components/VideoFFmpegComponent.h"
|
2021-07-07 18:03:42 +00:00
|
|
|
#include "resources/Font.h"
|
|
|
|
#include "utils/FileSystemUtil.h"
|
|
|
|
#include "utils/StringUtil.h"
|
2022-01-18 19:42:50 +00:00
|
|
|
#include "views/GamelistView.h"
|
2021-07-07 18:03:42 +00:00
|
|
|
#include "views/ViewController.h"
|
2020-07-03 18:23:51 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
#include <random>
|
2018-01-29 22:50:10 +00:00
|
|
|
#include <time.h>
|
2020-07-03 18:23:51 +00:00
|
|
|
|
2020-08-23 15:04:30 +00:00
|
|
|
#if defined(_WIN64)
|
2020-07-03 18:23:51 +00:00
|
|
|
#include <cstring>
|
|
|
|
#endif
|
|
|
|
|
2023-08-20 11:21:11 +00:00
|
|
|
#define IMAGES_FADE_IN_TIME 450.0f
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
Screensaver::Screensaver()
|
2022-03-14 18:51:48 +00:00
|
|
|
: mRenderer {Renderer::getInstance()}
|
|
|
|
, mWindow {Window::getInstance()}
|
2022-01-16 17:18:28 +00:00
|
|
|
, mImageScreensaver {nullptr}
|
|
|
|
, mVideoScreensaver {nullptr}
|
|
|
|
, mCurrentGame {nullptr}
|
|
|
|
, mPreviousGame {nullptr}
|
|
|
|
, mTimer {0}
|
|
|
|
, mMediaSwapTime {0}
|
2023-08-20 11:21:11 +00:00
|
|
|
, mScreensaverActive {false}
|
2022-01-16 17:18:28 +00:00
|
|
|
, mTriggerNextGame {false}
|
|
|
|
, mHasMediaFiles {false}
|
|
|
|
, mFallbackScreensaver {false}
|
|
|
|
, mOpacity {0.0f}
|
|
|
|
, mDimValue {1.0}
|
|
|
|
, mRectangleFadeIn {50}
|
|
|
|
, mTextFadeIn {0}
|
|
|
|
, mSaturationAmount {1.0}
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2020-11-10 21:18:20 +00:00
|
|
|
mWindow->setScreensaver(this);
|
2016-12-14 08:30:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::startScreensaver(bool generateMediaList)
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2022-02-19 16:04:23 +00:00
|
|
|
ViewController::getInstance()->pauseViewVideos();
|
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
mScreensaverType = Settings::getInstance()->getString("ScreensaverType");
|
|
|
|
// In case there is an invalid entry in the es_settings.xml file.
|
|
|
|
if (mScreensaverType != "dim" && mScreensaverType != "black" &&
|
|
|
|
mScreensaverType != "slideshow" && mScreensaverType != "video") {
|
|
|
|
mScreensaverType = "dim";
|
|
|
|
}
|
|
|
|
std::string path;
|
2023-08-20 11:21:11 +00:00
|
|
|
mScreensaverActive = true;
|
2020-11-10 21:18:20 +00:00
|
|
|
mHasMediaFiles = false;
|
2021-03-18 19:07:07 +00:00
|
|
|
mFallbackScreensaver = false;
|
2020-11-11 23:46:59 +00:00
|
|
|
mOpacity = 0.0f;
|
|
|
|
|
|
|
|
// Keep a reference to the default fonts, so they don't keep getting destroyed/recreated.
|
|
|
|
if (mGameOverlayFont.empty()) {
|
|
|
|
mGameOverlayFont.push_back(Font::get(FONT_SIZE_SMALL));
|
|
|
|
mGameOverlayFont.push_back(Font::get(FONT_SIZE_MEDIUM));
|
|
|
|
mGameOverlayFont.push_back(Font::get(FONT_SIZE_LARGE));
|
|
|
|
}
|
2020-07-28 09:10:14 +00:00
|
|
|
|
|
|
|
// Set mPreviousGame which will be used to avoid showing the same game again during
|
|
|
|
// the random selection.
|
2022-09-16 17:18:43 +00:00
|
|
|
if ((mScreensaverType == "slideshow" || mScreensaverType == "video") && mCurrentGame != nullptr)
|
2020-07-28 09:10:14 +00:00
|
|
|
mPreviousGame = mCurrentGame;
|
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
if (mScreensaverType == "slideshow") {
|
2020-11-10 21:18:20 +00:00
|
|
|
if (generateMediaList) {
|
|
|
|
mImageFiles.clear();
|
2023-08-20 13:28:30 +00:00
|
|
|
mFilesInventory.clear();
|
2020-11-10 21:18:20 +00:00
|
|
|
mImageCustomFiles.clear();
|
2023-08-20 13:28:30 +00:00
|
|
|
mCustomFilesInventory.clear();
|
2020-11-10 21:18:20 +00:00
|
|
|
}
|
|
|
|
|
2020-11-12 16:13:24 +00:00
|
|
|
mMediaSwapTime = Settings::getInstance()->getInt("ScreensaverSwapImageTimeout");
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
// Load a random image.
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")) {
|
|
|
|
if (generateMediaList)
|
|
|
|
generateCustomImageList();
|
|
|
|
pickRandomCustomImage(path);
|
|
|
|
|
2023-08-20 13:28:30 +00:00
|
|
|
// We've cycled through all games, so start from the beginning again.
|
|
|
|
if (mImageCustomFiles.size() == 0 && mCustomFilesInventory.size() > 0)
|
|
|
|
mImageCustomFiles.insert(mImageCustomFiles.begin(), mCustomFilesInventory.begin(),
|
|
|
|
mCustomFilesInventory.end());
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mImageCustomFiles.size() > 0)
|
|
|
|
mHasMediaFiles = true;
|
|
|
|
// Custom images are not tied to the game list.
|
|
|
|
mCurrentGame = nullptr;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (generateMediaList)
|
|
|
|
generateImageList();
|
|
|
|
pickRandomImage(path);
|
|
|
|
}
|
|
|
|
|
2023-08-20 13:28:30 +00:00
|
|
|
// We've cycled through all games, so start from the beginning again.
|
|
|
|
if (mImageFiles.size() == 0 && mFilesInventory.size() > 0)
|
|
|
|
mImageFiles.insert(mImageFiles.begin(), mFilesInventory.begin(), mFilesInventory.end());
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mImageFiles.size() > 0)
|
|
|
|
mHasMediaFiles = true;
|
|
|
|
|
|
|
|
// Don't attempt to render the screensaver if there are no images available, but
|
2020-11-11 23:46:59 +00:00
|
|
|
// do flag it as running. This way render() will fade to a black screen, i.e. it
|
|
|
|
// will activate the 'Black' screensaver type.
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mImageFiles.size() > 0 || mImageCustomFiles.size() > 0) {
|
2020-11-11 23:46:59 +00:00
|
|
|
if (Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo"))
|
|
|
|
generateOverlayInfo();
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (!mImageScreensaver)
|
2022-09-16 17:18:43 +00:00
|
|
|
mImageScreensaver = std::make_unique<ImageComponent>(false, false);
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
mTimer = 0;
|
|
|
|
|
|
|
|
mImageScreensaver->setImage(path);
|
|
|
|
mImageScreensaver->setOrigin(0.5f, 0.5f);
|
|
|
|
mImageScreensaver->setPosition(Renderer::getScreenWidth() / 2.0f,
|
2021-07-07 18:03:42 +00:00
|
|
|
Renderer::getScreenHeight() / 2.0f);
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverStretchImages"))
|
2022-02-11 22:38:23 +00:00
|
|
|
mImageScreensaver->setResize(Renderer::getScreenWidth(),
|
|
|
|
Renderer::getScreenHeight());
|
2020-11-10 21:18:20 +00:00
|
|
|
else
|
2022-02-11 22:38:23 +00:00
|
|
|
mImageScreensaver->setMaxSize(Renderer::getScreenWidth(),
|
|
|
|
Renderer::getScreenHeight());
|
2020-11-10 21:18:20 +00:00
|
|
|
}
|
|
|
|
mTimer = 0;
|
|
|
|
return;
|
|
|
|
}
|
2022-09-16 17:18:43 +00:00
|
|
|
else if (!mVideoScreensaver && (mScreensaverType == "video")) {
|
2023-08-20 13:28:30 +00:00
|
|
|
if (generateMediaList) {
|
2020-11-10 21:18:20 +00:00
|
|
|
mVideoFiles.clear();
|
2023-08-20 13:28:30 +00:00
|
|
|
mFilesInventory.clear();
|
|
|
|
}
|
2020-11-10 21:18:20 +00:00
|
|
|
|
2020-11-12 16:13:24 +00:00
|
|
|
mMediaSwapTime = Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout");
|
2020-06-23 18:07:00 +00:00
|
|
|
|
|
|
|
// Load a random video.
|
2020-11-10 21:18:20 +00:00
|
|
|
if (generateMediaList)
|
|
|
|
generateVideoList();
|
2020-06-23 18:07:00 +00:00
|
|
|
pickRandomVideo(path);
|
|
|
|
|
2023-08-20 13:28:30 +00:00
|
|
|
// We've cycled through all games, so start from the beginning again.
|
|
|
|
if (mVideoFiles.size() == 0 && mFilesInventory.size() > 0)
|
|
|
|
mVideoFiles.insert(mVideoFiles.begin(), mFilesInventory.begin(), mFilesInventory.end());
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mVideoFiles.size() > 0)
|
|
|
|
mHasMediaFiles = true;
|
2020-06-23 18:07:00 +00:00
|
|
|
|
|
|
|
if (!path.empty() && Utils::FileSystem::exists(path)) {
|
2020-11-11 23:46:59 +00:00
|
|
|
if (Settings::getInstance()->getBool("ScreensaverVideoGameInfo"))
|
|
|
|
generateOverlayInfo();
|
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
mVideoScreensaver = std::make_unique<VideoFFmpegComponent>();
|
2020-06-23 18:07:00 +00:00
|
|
|
mVideoScreensaver->setOrigin(0.5f, 0.5f);
|
|
|
|
mVideoScreensaver->setPosition(Renderer::getScreenWidth() / 2.0f,
|
2021-07-07 18:03:42 +00:00
|
|
|
Renderer::getScreenHeight() / 2.0f);
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2020-11-05 17:18:11 +00:00
|
|
|
if (Settings::getInstance()->getBool("ScreensaverStretchVideos"))
|
2022-02-11 22:38:23 +00:00
|
|
|
mVideoScreensaver->setResize(Renderer::getScreenWidth(),
|
|
|
|
Renderer::getScreenHeight());
|
2020-06-23 18:07:00 +00:00
|
|
|
else
|
2022-02-11 22:38:23 +00:00
|
|
|
mVideoScreensaver->setMaxSize(Renderer::getScreenWidth(),
|
|
|
|
Renderer::getScreenHeight());
|
2020-06-23 18:07:00 +00:00
|
|
|
|
|
|
|
mVideoScreensaver->setVideo(path);
|
|
|
|
mVideoScreensaver->setScreensaverMode(true);
|
2022-02-19 16:04:23 +00:00
|
|
|
mVideoScreensaver->startVideoPlayer();
|
2020-06-23 18:07:00 +00:00
|
|
|
mTimer = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-11-10 21:18:20 +00:00
|
|
|
// No videos or images, just use a standard screensaver.
|
2020-06-23 18:07:00 +00:00
|
|
|
mCurrentGame = nullptr;
|
2016-12-14 08:30:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::stopScreensaver()
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2022-09-16 17:18:43 +00:00
|
|
|
mImageScreensaver.reset();
|
|
|
|
mVideoScreensaver.reset();
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2023-08-20 11:21:11 +00:00
|
|
|
mScreensaverActive = false;
|
2021-07-07 18:03:42 +00:00
|
|
|
mDimValue = 1.0f;
|
2020-11-11 23:46:59 +00:00
|
|
|
mRectangleFadeIn = 50;
|
|
|
|
mTextFadeIn = 0;
|
2021-07-07 18:03:42 +00:00
|
|
|
mSaturationAmount = 1.0f;
|
2020-11-11 23:46:59 +00:00
|
|
|
|
|
|
|
if (mGameOverlay)
|
2021-02-28 17:58:52 +00:00
|
|
|
mGameOverlay.reset();
|
2022-02-19 16:04:23 +00:00
|
|
|
|
|
|
|
ViewController::getInstance()->startViewVideos();
|
2020-11-10 21:18:20 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::nextGame()
|
2021-07-07 18:03:42 +00:00
|
|
|
{
|
2020-11-10 21:18:20 +00:00
|
|
|
stopScreensaver();
|
|
|
|
startScreensaver(false);
|
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::launchGame()
|
2020-11-10 21:18:20 +00:00
|
|
|
{
|
|
|
|
if (mCurrentGame != nullptr) {
|
2022-04-12 16:35:57 +00:00
|
|
|
// If the game is inside a folder where a folder link entry is present, then jump to
|
2022-04-11 21:28:18 +00:00
|
|
|
// that folder instead of to the actual game file. Also check the complete hierarchy in
|
2022-04-12 16:35:57 +00:00
|
|
|
// case folder link entries are set on multiple levels.
|
2022-04-11 21:28:18 +00:00
|
|
|
FileData* entry {mCurrentGame};
|
|
|
|
FileData* selectGame {mCurrentGame};
|
|
|
|
FileData* launchFolder {nullptr};
|
|
|
|
|
|
|
|
while (entry != nullptr) {
|
|
|
|
entry = entry->getParent();
|
2022-04-12 16:35:57 +00:00
|
|
|
if (entry != nullptr && entry->metadata.get("folderlink") != "")
|
2022-04-11 21:28:18 +00:00
|
|
|
launchFolder = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (launchFolder != nullptr)
|
|
|
|
selectGame = launchFolder;
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
// Launching game
|
2022-01-04 20:49:22 +00:00
|
|
|
ViewController::getInstance()->triggerGameLaunch(mCurrentGame);
|
2022-01-15 12:38:09 +00:00
|
|
|
ViewController::getInstance()->goToGamelist(mCurrentGame->getSystem());
|
2022-03-24 22:05:23 +00:00
|
|
|
GamelistView* view {
|
|
|
|
ViewController::getInstance()->getGamelistView(mCurrentGame->getSystem()).get()};
|
2022-04-11 21:28:18 +00:00
|
|
|
view->setCursor(selectGame);
|
2022-03-24 22:05:23 +00:00
|
|
|
view->stopListScrolling();
|
2022-01-04 20:49:22 +00:00
|
|
|
ViewController::getInstance()->cancelViewTransitions();
|
2022-02-19 16:04:23 +00:00
|
|
|
ViewController::getInstance()->pauseViewVideos();
|
2020-11-10 21:18:20 +00:00
|
|
|
}
|
2016-12-14 08:30:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::goToGame()
|
2020-11-12 16:13:24 +00:00
|
|
|
{
|
|
|
|
if (mCurrentGame != nullptr) {
|
2022-04-11 21:28:18 +00:00
|
|
|
FileData* entry {mCurrentGame};
|
|
|
|
FileData* launchFolder {nullptr};
|
|
|
|
|
|
|
|
while (entry != nullptr) {
|
|
|
|
entry = entry->getParent();
|
2022-04-12 16:35:57 +00:00
|
|
|
if (entry != nullptr && entry->metadata.get("folderlink") != "")
|
2022-04-11 21:28:18 +00:00
|
|
|
launchFolder = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (launchFolder != nullptr)
|
|
|
|
mCurrentGame = launchFolder;
|
|
|
|
|
2020-11-12 16:13:24 +00:00
|
|
|
// Go to the game in the gamelist view, but don't launch it.
|
2022-01-15 12:38:09 +00:00
|
|
|
ViewController::getInstance()->goToGamelist(mCurrentGame->getSystem());
|
2022-03-24 22:05:23 +00:00
|
|
|
GamelistView* view {
|
|
|
|
ViewController::getInstance()->getGamelistView(mCurrentGame->getSystem()).get()};
|
2020-11-12 16:13:24 +00:00
|
|
|
view->setCursor(mCurrentGame);
|
2022-03-24 22:05:23 +00:00
|
|
|
view->stopListScrolling();
|
2022-01-04 20:49:22 +00:00
|
|
|
ViewController::getInstance()->cancelViewTransitions();
|
2020-11-12 16:13:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::renderScreensaver()
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2022-03-11 22:17:04 +00:00
|
|
|
glm::mat4 trans {Renderer::getIdentity()};
|
2022-03-14 18:51:48 +00:00
|
|
|
mRenderer->setMatrix(trans);
|
2021-03-18 19:07:07 +00:00
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
if (mVideoScreensaver && mScreensaverType == "video") {
|
2020-11-11 23:46:59 +00:00
|
|
|
// Render a black background below the video.
|
2022-03-14 18:51:48 +00:00
|
|
|
mRenderer->drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(),
|
|
|
|
0x000000FF, 0x000000FF);
|
2023-08-20 11:21:11 +00:00
|
|
|
mVideoScreensaver->render(trans);
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2022-09-16 17:18:43 +00:00
|
|
|
else if (mImageScreensaver && mScreensaverType == "slideshow") {
|
2020-11-11 23:46:59 +00:00
|
|
|
// Render a black background below the image.
|
2022-03-14 18:51:48 +00:00
|
|
|
mRenderer->drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(),
|
|
|
|
0x000000FF, 0x000000FF);
|
2023-08-20 11:21:11 +00:00
|
|
|
// Leave a small gap without rendering during fade-in.
|
|
|
|
if (mOpacity > 0.5f) {
|
|
|
|
mImageScreensaver->setOpacity(mOpacity);
|
|
|
|
mImageScreensaver->render(trans);
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2023-08-20 13:28:30 +00:00
|
|
|
if (mScreensaverType == "slideshow") {
|
|
|
|
if (mHasMediaFiles) {
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverSlideshowScanlines"))
|
|
|
|
mRenderer->shaderPostprocessing(Renderer::Shader::SCANLINES);
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo") &&
|
|
|
|
!Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages") &&
|
|
|
|
mGameOverlay) {
|
|
|
|
mRenderer->setMatrix(mRenderer->getIdentity());
|
|
|
|
if (mGameOverlayRectangleCoords.size() == 4) {
|
|
|
|
mRenderer->drawRect(
|
|
|
|
mGameOverlayRectangleCoords[0], mGameOverlayRectangleCoords[1],
|
|
|
|
mGameOverlayRectangleCoords[2], mGameOverlayRectangleCoords[3],
|
|
|
|
0x00000000 | mRectangleFadeIn, 0x00000000 | mRectangleFadeIn);
|
2020-11-11 23:46:59 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
mRectangleFadeIn = glm::clamp(mRectangleFadeIn + 6 + mRectangleFadeIn / 20, 0, 170);
|
|
|
|
|
|
|
|
mGameOverlay.get()->setColor(0xFFFFFF00 | mTextFadeIn);
|
|
|
|
if (mTextFadeIn > 50)
|
|
|
|
mGameOverlayFont.at(0)->renderTextCache(mGameOverlay.get());
|
|
|
|
if (mTextFadeIn < 255)
|
|
|
|
mTextFadeIn = glm::clamp(mTextFadeIn + 2 + mTextFadeIn / 6, 0, 255);
|
2020-11-11 23:46:59 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
else {
|
|
|
|
mFallbackScreensaver = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mScreensaverType == "video") {
|
|
|
|
if (mHasMediaFiles) {
|
|
|
|
Renderer::postProcessingParams videoParameters;
|
|
|
|
unsigned int shaders {0};
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverVideoScanlines"))
|
|
|
|
shaders = Renderer::Shader::SCANLINES;
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverVideoBlur")) {
|
|
|
|
if (mRenderer->getScreenRotation() == 90 || mRenderer->getScreenRotation() == 270)
|
|
|
|
shaders |= Renderer::Shader::BLUR_VERTICAL;
|
|
|
|
else
|
|
|
|
shaders |= Renderer::Shader::BLUR_HORIZONTAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We run two passes to make the blur smoother.
|
|
|
|
videoParameters.blurPasses = 2;
|
|
|
|
videoParameters.blurStrength = 1.35f;
|
2022-03-13 22:52:32 +00:00
|
|
|
|
2023-08-20 13:28:30 +00:00
|
|
|
if (shaders != 0)
|
|
|
|
mRenderer->shaderPostprocessing(shaders, videoParameters);
|
|
|
|
|
|
|
|
if (Settings::getInstance()->getBool("ScreensaverVideoGameInfo") && mGameOverlay) {
|
|
|
|
mRenderer->setMatrix(mRenderer->getIdentity());
|
|
|
|
if (mGameOverlayRectangleCoords.size() == 4) {
|
|
|
|
mRenderer->drawRect(
|
|
|
|
mGameOverlayRectangleCoords[0], mGameOverlayRectangleCoords[1],
|
|
|
|
mGameOverlayRectangleCoords[2], mGameOverlayRectangleCoords[3],
|
|
|
|
0x00000000 | mRectangleFadeIn, 0x00000000 | mRectangleFadeIn);
|
2020-11-11 23:46:59 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
mRectangleFadeIn = glm::clamp(mRectangleFadeIn + 6 + mRectangleFadeIn / 20, 0, 170);
|
|
|
|
|
|
|
|
mGameOverlay.get()->setColor(0xFFFFFF00 | mTextFadeIn);
|
|
|
|
if (mTextFadeIn > 50)
|
|
|
|
mGameOverlayFont.at(0)->renderTextCache(mGameOverlay.get());
|
|
|
|
if (mTextFadeIn < 255)
|
|
|
|
mTextFadeIn = glm::clamp(mTextFadeIn + 2 + mTextFadeIn / 6, 0, 255);
|
2020-11-11 23:46:59 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
else {
|
|
|
|
mFallbackScreensaver = true;
|
2021-05-16 16:02:07 +00:00
|
|
|
}
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
if (mFallbackScreensaver || mScreensaverType == "dim") {
|
|
|
|
Renderer::postProcessingParams dimParameters;
|
|
|
|
dimParameters.dimming = mDimValue;
|
|
|
|
dimParameters.saturation = mSaturationAmount;
|
|
|
|
mRenderer->shaderPostprocessing(Renderer::Shader::CORE, dimParameters);
|
|
|
|
if (mDimValue > 0.4)
|
|
|
|
mDimValue = glm::clamp(mDimValue - 0.021f, 0.4f, 1.0f);
|
|
|
|
if (mSaturationAmount > 0.0)
|
|
|
|
mSaturationAmount = glm::clamp(mSaturationAmount - 0.035f, 0.0f, 1.0f);
|
|
|
|
}
|
|
|
|
else if (mScreensaverType == "black") {
|
|
|
|
Renderer::postProcessingParams blackParameters;
|
|
|
|
blackParameters.dimming = mDimValue;
|
|
|
|
mRenderer->shaderPostprocessing(Renderer::Shader::CORE, blackParameters);
|
|
|
|
if (mDimValue > 0.0)
|
|
|
|
mDimValue = glm::clamp(mDimValue - 0.045f, 0.0f, 1.0f);
|
|
|
|
}
|
2016-12-14 08:30:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::update(int deltaTime)
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2023-08-20 11:21:11 +00:00
|
|
|
// Update the timer that swaps the media, unless the swap time is set to 0 (only
|
|
|
|
// applicable for the video screensaver). This means that videos play to the end,
|
|
|
|
// at which point the video player will trigger a skip to the next game.
|
|
|
|
if (mMediaSwapTime != 0) {
|
|
|
|
mTimer += deltaTime;
|
|
|
|
if (mTimer > mMediaSwapTime)
|
|
|
|
nextGame();
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 11:21:11 +00:00
|
|
|
if (mTriggerNextGame) {
|
|
|
|
mTriggerNextGame = false;
|
|
|
|
nextGame();
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 11:21:11 +00:00
|
|
|
|
|
|
|
// Fade-in for the video screensaver is handled in VideoComponent.
|
|
|
|
if (mImageScreensaver && mOpacity < 1.0f) {
|
|
|
|
mOpacity += static_cast<float>(deltaTime) / IMAGES_FADE_IN_TIME;
|
|
|
|
if (mOpacity > 1.0f)
|
|
|
|
mOpacity = 1.0f;
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
if (mVideoScreensaver)
|
|
|
|
mVideoScreensaver->update(deltaTime);
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::generateImageList()
|
2017-09-09 03:45:50 +00:00
|
|
|
{
|
2023-07-01 13:57:29 +00:00
|
|
|
const bool favoritesOnly {
|
|
|
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")};
|
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
2021-11-17 16:35:34 +00:00
|
|
|
it != SystemData::sSystemVector.cend(); ++it) {
|
2020-06-23 18:07:00 +00:00
|
|
|
// We only want nodes from game systems that are not collections.
|
|
|
|
if (!(*it)->isGameSystem() || (*it)->isCollection())
|
|
|
|
continue;
|
|
|
|
|
2022-05-16 17:59:34 +00:00
|
|
|
std::vector<FileData*> allFiles {(*it)->getRootFolder()->getFilesRecursive(GAME, true)};
|
2021-11-17 16:35:34 +00:00
|
|
|
for (auto it2 = allFiles.cbegin(); it2 != allFiles.cend(); ++it2) {
|
2022-05-16 17:59:34 +00:00
|
|
|
// Only include games suitable for children if we're in Kid UI mode.
|
|
|
|
if (UIModeController::getInstance()->isUIModeKid() &&
|
|
|
|
(*it2)->metadata.get("kidgame") != "true")
|
|
|
|
continue;
|
2023-07-01 13:57:29 +00:00
|
|
|
if (favoritesOnly && (*it2)->metadata.get("favorite") != "true")
|
|
|
|
continue;
|
2022-09-16 17:18:43 +00:00
|
|
|
std::string imagePath {(*it2)->getImagePath()};
|
2020-11-10 21:18:20 +00:00
|
|
|
if (imagePath != "")
|
2021-09-19 17:46:59 +00:00
|
|
|
mImageFiles.push_back((*it2));
|
2020-07-28 09:10:14 +00:00
|
|
|
}
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
mFilesInventory.insert(mFilesInventory.begin(), mImageFiles.begin(), mImageFiles.end());
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::generateVideoList()
|
2017-09-09 03:45:50 +00:00
|
|
|
{
|
2023-07-01 13:57:29 +00:00
|
|
|
const bool favoritesOnly {Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")};
|
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
2021-11-17 16:35:34 +00:00
|
|
|
it != SystemData::sSystemVector.cend(); ++it) {
|
2020-11-10 21:18:20 +00:00
|
|
|
// We only want nodes from game systems that are not collections.
|
|
|
|
if (!(*it)->isGameSystem() || (*it)->isCollection())
|
|
|
|
continue;
|
2020-07-28 09:10:14 +00:00
|
|
|
|
2022-05-16 17:59:34 +00:00
|
|
|
std::vector<FileData*> allFiles {(*it)->getRootFolder()->getFilesRecursive(GAME, true)};
|
2021-11-17 16:35:34 +00:00
|
|
|
for (auto it2 = allFiles.cbegin(); it2 != allFiles.cend(); ++it2) {
|
2022-05-16 17:59:34 +00:00
|
|
|
// Only include games suitable for children if we're in Kid UI mode.
|
|
|
|
if (UIModeController::getInstance()->isUIModeKid() &&
|
|
|
|
(*it2)->metadata.get("kidgame") != "true")
|
|
|
|
continue;
|
2023-07-01 13:57:29 +00:00
|
|
|
if (favoritesOnly && (*it2)->metadata.get("favorite") != "true")
|
|
|
|
continue;
|
2022-09-16 17:18:43 +00:00
|
|
|
std::string videoPath {(*it2)->getVideoPath()};
|
2020-11-10 21:18:20 +00:00
|
|
|
if (videoPath != "")
|
2021-09-19 17:46:59 +00:00
|
|
|
mVideoFiles.push_back((*it2));
|
2020-07-28 09:10:14 +00:00
|
|
|
}
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
mFilesInventory.insert(mFilesInventory.begin(), mVideoFiles.begin(), mVideoFiles.end());
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::generateCustomImageList()
|
2017-09-09 03:45:50 +00:00
|
|
|
{
|
2023-12-16 20:03:41 +00:00
|
|
|
std::string imageDir {Utils::FileSystem::expandHomePath(
|
2023-12-16 20:17:05 +00:00
|
|
|
Settings::getInstance()->getString("ScreensaverSlideshowCustomDir"))};
|
2023-12-16 20:03:41 +00:00
|
|
|
|
|
|
|
if (imageDir.empty())
|
2023-12-19 16:35:58 +00:00
|
|
|
imageDir = Utils::FileSystem::getAppDataDirectory() + "/screensavers/custom_slideshow";
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2021-06-30 15:11:25 +00:00
|
|
|
// This makes it possible to set the custom image directory relative to the ES-DE binary
|
|
|
|
// directory or the ROM directory.
|
|
|
|
imageDir = Utils::String::replace(imageDir, "%ESPATH%", Utils::FileSystem::getExePath());
|
|
|
|
imageDir = Utils::String::replace(imageDir, "%ROMPATH%", FileData::getROMDirectory());
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (imageDir != "" && Utils::FileSystem::isDirectory(imageDir)) {
|
2023-12-16 20:03:41 +00:00
|
|
|
const std::vector<std::string> extList {".jpg", ".JPG", ".png", ".PNG", ".gif",
|
|
|
|
".GIF", ".webp", ".WEBP", ".svg", ".SVG"};
|
|
|
|
|
|
|
|
Utils::FileSystem::StringList dirContent {Utils::FileSystem::getDirContent(
|
|
|
|
imageDir, Settings::getInstance()->getBool("ScreensaverSlideshowRecurse"))};
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2021-11-17 16:35:34 +00:00
|
|
|
for (auto it = dirContent.begin(); it != dirContent.end(); ++it) {
|
2020-06-23 18:07:00 +00:00
|
|
|
if (Utils::FileSystem::isRegularFile(*it)) {
|
2023-12-16 20:03:41 +00:00
|
|
|
if (std::find(extList.cbegin(), extList.cend(),
|
|
|
|
Utils::FileSystem::getExtension(*it)) != extList.cend())
|
2020-11-10 21:18:20 +00:00
|
|
|
mImageCustomFiles.push_back(*it);
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2023-12-16 20:03:41 +00:00
|
|
|
LOG(LogWarning) << "Custom screensaver image directory \"" << imageDir
|
|
|
|
<< "\" does not exist";
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
mCustomFilesInventory.insert(mCustomFilesInventory.begin(), mImageCustomFiles.begin(),
|
|
|
|
mImageCustomFiles.end());
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::pickRandomImage(std::string& path)
|
2016-12-14 08:30:54 +00:00
|
|
|
{
|
2020-11-10 21:18:20 +00:00
|
|
|
mCurrentGame = nullptr;
|
2020-06-23 18:07:00 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mImageFiles.size() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mImageFiles.size() == 1) {
|
|
|
|
mPreviousGame = nullptr;
|
|
|
|
mCurrentGame = mImageFiles.front();
|
|
|
|
path = mImageFiles.front()->getImagePath();
|
2021-01-11 19:12:45 +00:00
|
|
|
mGameName = mImageFiles.front()->getName();
|
|
|
|
mSystemName = mImageFiles.front()->getSystem()->getFullName();
|
|
|
|
mCurrentGame = mImageFiles.front();
|
2023-08-20 13:28:30 +00:00
|
|
|
mImageFiles.clear();
|
2020-11-10 21:18:20 +00:00
|
|
|
return;
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
unsigned int index;
|
|
|
|
do {
|
|
|
|
// Get a random number in range.
|
|
|
|
std::random_device randDev;
|
|
|
|
// Mersenne Twister pseudorandom number generator.
|
2022-01-16 11:09:55 +00:00
|
|
|
std::mt19937 engine {randDev()};
|
2022-09-16 17:18:43 +00:00
|
|
|
std::uniform_int_distribution<int> uniform_dist {0,
|
|
|
|
static_cast<int>(mImageFiles.size()) - 1};
|
2020-11-10 21:18:20 +00:00
|
|
|
index = uniform_dist(engine);
|
2021-07-07 18:03:42 +00:00
|
|
|
} while (mPreviousGame && mImageFiles.at(index) == mPreviousGame);
|
2017-06-01 20:08:44 +00:00
|
|
|
|
2020-11-10 21:18:20 +00:00
|
|
|
path = mImageFiles.at(index)->getImagePath();
|
|
|
|
mGameName = mImageFiles.at(index)->getName();
|
|
|
|
mSystemName = mImageFiles.at(index)->getSystem()->getFullName();
|
|
|
|
mCurrentGame = mImageFiles.at(index);
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
// Don't display the same image again until we've cycled through all entries.
|
|
|
|
auto it = mImageFiles.begin() + index;
|
|
|
|
mImageFiles.erase(it);
|
2017-06-01 20:08:44 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::pickRandomVideo(std::string& path)
|
2017-06-01 20:08:44 +00:00
|
|
|
{
|
2020-11-10 21:18:20 +00:00
|
|
|
mCurrentGame = nullptr;
|
|
|
|
|
|
|
|
if (mVideoFiles.size() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mVideoFiles.size() == 1) {
|
|
|
|
mPreviousGame = nullptr;
|
|
|
|
mCurrentGame = mVideoFiles.front();
|
|
|
|
path = mVideoFiles.front()->getVideoPath();
|
2021-01-11 19:12:45 +00:00
|
|
|
mGameName = mVideoFiles.front()->getName();
|
|
|
|
mSystemName = mVideoFiles.front()->getSystem()->getFullName();
|
|
|
|
mCurrentGame = mVideoFiles.front();
|
2023-08-20 13:28:30 +00:00
|
|
|
mVideoFiles.clear();
|
2020-11-10 21:18:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int index;
|
|
|
|
do {
|
|
|
|
// Get a random number in range.
|
|
|
|
std::random_device randDev;
|
|
|
|
// Mersenne Twister pseudorandom number generator.
|
2022-01-16 11:09:55 +00:00
|
|
|
std::mt19937 engine {randDev()};
|
2022-09-16 17:18:43 +00:00
|
|
|
std::uniform_int_distribution<int> uniform_dist {0,
|
|
|
|
static_cast<int>(mVideoFiles.size()) - 1};
|
2020-11-10 21:18:20 +00:00
|
|
|
index = uniform_dist(engine);
|
2021-07-07 18:03:42 +00:00
|
|
|
} while (mPreviousGame && mVideoFiles.at(index) == mPreviousGame);
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
path = mVideoFiles.at(index)->getVideoPath();
|
|
|
|
mGameName = mVideoFiles.at(index)->getName();
|
|
|
|
mSystemName = mVideoFiles.at(index)->getSystem()->getFullName();
|
|
|
|
mCurrentGame = mVideoFiles.at(index);
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
// Don't play the same video again until we've cycled through all entries.
|
|
|
|
auto it = mVideoFiles.begin() + index;
|
|
|
|
mVideoFiles.erase(it);
|
2017-06-01 20:08:44 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::pickRandomCustomImage(std::string& path)
|
2017-06-01 20:08:44 +00:00
|
|
|
{
|
2020-11-10 21:18:20 +00:00
|
|
|
if (mImageCustomFiles.size() == 0)
|
|
|
|
return;
|
|
|
|
|
2022-04-12 18:47:25 +00:00
|
|
|
if (mImageCustomFiles.size() == 1) {
|
2020-11-10 21:18:20 +00:00
|
|
|
mPreviousCustomImage = mImageCustomFiles.front();
|
|
|
|
path = mImageCustomFiles.front();
|
2023-08-20 13:28:30 +00:00
|
|
|
mImageCustomFiles.clear();
|
2020-11-10 21:18:20 +00:00
|
|
|
return;
|
2020-06-23 18:07:00 +00:00
|
|
|
}
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
unsigned int index;
|
|
|
|
do {
|
|
|
|
// Get a random number in range.
|
|
|
|
std::random_device randDev;
|
|
|
|
// Mersenne Twister pseudorandom number generator.
|
2022-01-16 11:09:55 +00:00
|
|
|
std::mt19937 engine {randDev()};
|
2022-09-16 17:18:43 +00:00
|
|
|
std::uniform_int_distribution<int> uniform_dist {
|
|
|
|
0, static_cast<int>(mImageCustomFiles.size()) - 1};
|
2020-11-10 21:18:20 +00:00
|
|
|
index = uniform_dist(engine);
|
2021-07-07 18:03:42 +00:00
|
|
|
} while (mPreviousCustomImage != "" && mImageCustomFiles.at(index) == mPreviousCustomImage);
|
2020-11-10 21:18:20 +00:00
|
|
|
|
|
|
|
path = mImageCustomFiles.at(index);
|
|
|
|
mPreviousCustomImage = path;
|
|
|
|
mGameName = "";
|
|
|
|
mSystemName = "";
|
2023-08-20 13:28:30 +00:00
|
|
|
|
|
|
|
// Don't display the same image again until we've cycled through all entries.
|
|
|
|
auto it = mImageCustomFiles.begin() + index;
|
|
|
|
mImageCustomFiles.erase(it);
|
2017-08-02 19:56:33 +00:00
|
|
|
}
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2022-01-17 17:43:29 +00:00
|
|
|
void Screensaver::generateOverlayInfo()
|
2020-11-11 23:46:59 +00:00
|
|
|
{
|
|
|
|
if (mGameName == "" || mSystemName == "")
|
|
|
|
return;
|
|
|
|
|
2023-02-12 21:14:09 +00:00
|
|
|
float posX {mRenderer->getScreenWidth() * 0.023f};
|
|
|
|
float posY {mRenderer->getScreenHeight() * 0.02f};
|
2020-11-12 16:13:24 +00:00
|
|
|
|
2023-07-01 13:57:29 +00:00
|
|
|
const bool favoritesOnly {
|
|
|
|
(mScreensaverType == "video" &&
|
|
|
|
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")) ||
|
|
|
|
(mScreensaverType == "slideshow" &&
|
|
|
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites"))};
|
|
|
|
|
2020-11-12 16:13:24 +00:00
|
|
|
std::string favoriteChar;
|
2023-07-01 13:57:29 +00:00
|
|
|
// Don't add the favorites character if only displaying favorite games.
|
|
|
|
if (!favoritesOnly && mCurrentGame && mCurrentGame->getFavorite())
|
2022-09-16 17:18:43 +00:00
|
|
|
favoriteChar.append(" ").append(ViewController::FAVORITE_CHAR);
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
const std::string gameName {Utils::String::toUpper(mGameName) + favoriteChar};
|
|
|
|
const std::string systemName {Utils::String::toUpper(mSystemName)};
|
|
|
|
const std::string overlayText {gameName + "\n" + systemName};
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
mGameOverlay = std::unique_ptr<TextCache>(
|
|
|
|
mGameOverlayFont.at(0)->buildTextCache(overlayText, posX, posY, 0xFFFFFFFF));
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2022-09-16 17:18:43 +00:00
|
|
|
float textSizeX {0.0f};
|
|
|
|
float textSizeY {mGameOverlayFont[0].get()->sizeText(overlayText).y};
|
2020-11-11 23:46:59 +00:00
|
|
|
|
|
|
|
// There is a weird issue with sizeText() where the X size value is returned
|
|
|
|
// as too large if there are two rows in a string and the second row is longer
|
|
|
|
// than the first row. Possibly it's the newline character that is somehow
|
|
|
|
// injected in the size calculation. Regardless, this workaround is working
|
|
|
|
// fine for the time being.
|
2021-08-16 16:25:01 +00:00
|
|
|
if (mGameOverlayFont[0].get()->sizeText(gameName).x >
|
|
|
|
mGameOverlayFont[0].get()->sizeText(systemName).x)
|
|
|
|
textSizeX = mGameOverlayFont[0].get()->sizeText(gameName).x;
|
2020-11-11 23:46:59 +00:00
|
|
|
else
|
2021-08-16 16:25:01 +00:00
|
|
|
textSizeX = mGameOverlayFont[0].get()->sizeText(systemName).x;
|
2020-11-11 23:46:59 +00:00
|
|
|
|
2023-02-12 21:14:09 +00:00
|
|
|
float marginX {mRenderer->getScreenWidth() * 0.01f};
|
2020-11-11 23:46:59 +00:00
|
|
|
|
|
|
|
mGameOverlayRectangleCoords.clear();
|
|
|
|
mGameOverlayRectangleCoords.push_back(posX - marginX);
|
|
|
|
mGameOverlayRectangleCoords.push_back(posY);
|
2021-05-12 21:03:29 +00:00
|
|
|
mGameOverlayRectangleCoords.push_back(textSizeX + marginX * 2.0f);
|
2020-11-11 23:46:59 +00:00
|
|
|
mGameOverlayRectangleCoords.push_back(textSizeY);
|
|
|
|
}
|