refactored some functions from main.cpp
This commit is contained in:
31
src/app/TextureLoader.h
Normal file
31
src/app/TextureLoader.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class TextureLoader {
|
||||
public:
|
||||
TextureLoader(
|
||||
std::atomic<int>& loadedTasks,
|
||||
std::string& currentLoadingFile,
|
||||
std::mutex& currentLoadingMutex,
|
||||
std::vector<std::string>& assetLoadErrors,
|
||||
std::mutex& assetLoadErrorsMutex);
|
||||
|
||||
SDL_Texture* loadFromImage(SDL_Renderer* renderer, const std::string& path, int* outW = nullptr, int* outH = nullptr);
|
||||
|
||||
private:
|
||||
std::atomic<int>& loadedTasks_;
|
||||
std::string& currentLoadingFile_;
|
||||
std::mutex& currentLoadingMutex_;
|
||||
std::vector<std::string>& assetLoadErrors_;
|
||||
std::mutex& assetLoadErrorsMutex_;
|
||||
|
||||
void setCurrentLoadingFile(const std::string& filename);
|
||||
void clearCurrentLoadingFile();
|
||||
void recordAssetLoadError(const std::string& message);
|
||||
};
|
||||
Reference in New Issue
Block a user