Song Cover loading encore
This commit is contained in:
parent
df3dda88f3
commit
5d6dda7ecd
@ -11,6 +11,14 @@ namespace fs = std::filesystem;
|
||||
|
||||
namespace Data {
|
||||
|
||||
std::optional<fs::path> Song::full_cover_path() const {
|
||||
if (cover) {
|
||||
return folder/cover.value();
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
SongList::SongList::SongList() {
|
||||
|
||||
// Loading all song metadata
|
||||
@ -125,4 +133,4 @@ namespace Data {
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ namespace Data {
|
||||
// to allow for decimal levels (introduced in jubeat ... festo ?)
|
||||
std::unordered_map<std::string, unsigned int> chart_levels;
|
||||
|
||||
std::optional<fs::path> full_cover_path() const;
|
||||
|
||||
static bool sort_by_title(const Data::Song& a, const Data::Song& b) {
|
||||
return a.title < b.title;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "Autoloader.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
void Textures::Autoloader::load(const fs::path& t_path) {
|
||||
if (m_mapping.find(t_path) != m_mapping.end()) {
|
||||
return;
|
||||
@ -18,3 +21,7 @@ std::shared_ptr<sf::Texture> Textures::Autoloader::get(const fs::path& t_path) {
|
||||
}
|
||||
return m_mapping.at(t_path);
|
||||
}
|
||||
|
||||
bool Textures::Autoloader::has(const fs::path& t_path) {
|
||||
return m_mapping.find(t_path) != m_mapping.end();
|
||||
}
|
||||
|
@ -26,8 +26,9 @@ namespace Textures {
|
||||
public:
|
||||
Autoloader() = default;
|
||||
std::shared_ptr<sf::Texture> get(const fs::path& t_path);
|
||||
private:
|
||||
void load(const fs::path& t_path);
|
||||
mutable std::unordered_map<fs::path, std::shared_ptr<sf::Texture>> m_mapping;
|
||||
};
|
||||
bool has(const fs::path& t_path);
|
||||
private:
|
||||
std::unordered_map<fs::path, std::shared_ptr<sf::Texture>> m_mapping;
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user