1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Merge pull request #3998 from IvanSavenko/refactor_sdl_media

[1.6] Reorganize SDL sound/music/video handling
This commit is contained in:
Ivan Savenko
2024-05-31 12:02:55 +03:00
committed by GitHub
65 changed files with 2372 additions and 2129 deletions

View File

@@ -19,9 +19,7 @@
#include "../CGameInfo.h"
#include "../CServerHandler.h"
#include "../Client.h"
#include "../CMusicHandler.h"
#include "../CPlayerInterface.h"
#include "../CVideoHandler.h"
#include "../gui/CGuiHandler.h"
#include "../gui/CursorHandler.h"
@@ -36,6 +34,7 @@
#include "../widgets/Slider.h"
#include "../widgets/TextControls.h"
#include "../widgets/ObjectLists.h"
#include "../widgets/VideoWidget.h"
#include "../render/Canvas.h"
#include "../render/CAnimation.h"
@@ -58,6 +57,7 @@
#include "../lib/GameSettings.h"
#include "../lib/CondSh.h"
#include "../lib/CSkillHandler.h"
#include "../lib/CSoundBase.h"
#include "../lib/filesystem/Filesystem.h"
#include "../lib/TextOperations.h"
@@ -515,11 +515,11 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj, const std::func
recruit->block(true);
}
if(LOCPLINT->castleInt)
CCS->videoh->open(LOCPLINT->castleInt->town->town->clientInfo.tavernVideo);
videoPlayer = std::make_shared<VideoWidget>(Point(70, 56), LOCPLINT->castleInt->town->town->clientInfo.tavernVideo, false);
else if(const auto * townObj = dynamic_cast<const CGTownInstance *>(TavernObj))
CCS->videoh->open(townObj->town->clientInfo.tavernVideo);
videoPlayer = std::make_shared<VideoWidget>(Point(70, 56), townObj->town->clientInfo.tavernVideo, false);
else
CCS->videoh->open(VideoPath::builtin("TAVERN.BIK"));
videoPlayer = std::make_shared<VideoWidget>(Point(70, 56), VideoPath::builtin("TAVERN.BIK"), false);
addInvite();
}
@@ -572,11 +572,6 @@ void CTavernWindow::close()
CStatusbarWindow::close();
}
CTavernWindow::~CTavernWindow()
{
CCS->videoh->close();
}
void CTavernWindow::show(Canvas & to)
{
CWindowObject::show(to);
@@ -600,8 +595,6 @@ void CTavernWindow::show(Canvas & to)
to.drawBorder(Rect::createAround(sel->pos, 2), Colors::BRIGHT_YELLOW, 2);
}
CCS->videoh->update(pos.x+70, pos.y+56, to.getInternalSurface(), true, false);
}
void CTavernWindow::HeroPortrait::clickPressed(const Point & cursorPosition)