implemented paylist shuffling

This commit is contained in:
devZoGok
2025-06-22 10:45:30 +03:00
parent a74be10c24
commit 201f50f6cf
+9
View File
@@ -2,6 +2,9 @@
#include <SFML/Audio.hpp>
#include <algorithm>
#include <random>
namespace gameBase{
using namespace std;
@@ -75,6 +78,12 @@ namespace gameBase{
for(string path : playlist)
currentPlaylistTracks.push_back(Track(path));
if(shuffle){
random_device rd;
mt19937 g(rd());
std::shuffle(currentPlaylistTracks.begin(), currentPlaylistTracks.end(), g);
}
originalPlaylist = playlist;
currentTrackId = 0;
currentPlaylistTracks[currentTrackId].soundObj->play();