1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

optimize skip video keys

This commit is contained in:
Laserlicht
2025-03-13 00:32:08 +01:00
parent f7305fd1c2
commit 46cd1f7805
3 changed files with 18 additions and 2 deletions

View File

@@ -14,6 +14,7 @@
#include "../media/IMusicPlayer.h" #include "../media/IMusicPlayer.h"
#include "../media/ISoundPlayer.h" #include "../media/ISoundPlayer.h"
#include "../GameEngine.h" #include "../GameEngine.h"
#include "../gui/Shortcut.h"
#include "../widgets/TextControls.h" #include "../widgets/TextControls.h"
#include "../widgets/VideoWidget.h" #include "../widgets/VideoWidget.h"
#include "../widgets/Images.h" #include "../widgets/Images.h"
@@ -92,7 +93,7 @@ void CPrologEpilogVideo::show(Canvas & to)
text->showAll(to); // blit text over video, if needed text->showAll(to); // blit text over video, if needed
} }
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition) void CPrologEpilogVideo::exit()
{ {
ENGINE->music().setVolume(ENGINE->music().getVolume() * 2); // restore background volume ENGINE->music().setVolume(ENGINE->music().getVolume() * 2); // restore background volume
close(); close();
@@ -102,3 +103,14 @@ void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
if(exitCb) if(exitCb)
exitCb(); exitCb();
} }
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
{
exit();
}
void CPrologEpilogVideo::keyPressed(EShortcut key)
{
if(key == EShortcut::GLOBAL_RETURN)
exit();
}

View File

@@ -30,6 +30,8 @@ class CPrologEpilogVideo : public CWindowObject
std::shared_ptr<VideoWidget> videoPlayer; std::shared_ptr<VideoWidget> videoPlayer;
std::shared_ptr<CFilledTexture> backgroundAroundMenu; std::shared_ptr<CFilledTexture> backgroundAroundMenu;
void exit();
bool voiceStopped = false; bool voiceStopped = false;
public: public:
@@ -37,5 +39,6 @@ public:
void tick(uint32_t msPassed) override; void tick(uint32_t msPassed) override;
void clickPressed(const Point & cursorPosition) override; void clickPressed(const Point & cursorPosition) override;
void keyPressed(EShortcut key) override;
void show(Canvas & to) override; void show(Canvas & to) override;
}; };

View File

@@ -1734,7 +1734,8 @@ void VideoWindow::clickPressed(const Point & cursorPosition)
void VideoWindow::keyPressed(EShortcut key) void VideoWindow::keyPressed(EShortcut key)
{ {
exit(true); if(key == EShortcut::GLOBAL_RETURN)
exit(true);
} }
void VideoWindow::notFocusedClick() void VideoWindow::notFocusedClick()