2024-09-09 13:20:59 +08:00
|
|
|
#include <imageService.h>
|
|
|
|
#include <UtilTool.h>
|
|
|
|
#include <string>
|
|
|
|
#include <SFML/Graphics.hpp>
|
2024-09-30 13:34:05 +08:00
|
|
|
#include <memory>
|
2024-09-09 13:20:59 +08:00
|
|
|
|
|
|
|
class MediaService
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
ImageService *imageService = nullptr;
|
|
|
|
MediaType type;
|
2024-09-30 13:34:05 +08:00
|
|
|
std::shared_ptr<sf::Texture> texture;
|
|
|
|
std::shared_ptr<sf::Sprite> sprite;
|
|
|
|
std::shared_ptr<sf::RenderWindow> window;
|
2024-09-09 13:20:59 +08:00
|
|
|
int client_width = 0;
|
|
|
|
int client_height = 0;
|
|
|
|
public:
|
|
|
|
MediaService(const std::string &filename, int width, int height);
|
2024-09-30 13:34:05 +08:00
|
|
|
~MediaService() = default;
|
|
|
|
std::shared_ptr<sf::Sprite> GetSprite()
|
2024-09-09 13:20:59 +08:00
|
|
|
{
|
2024-09-30 13:34:05 +08:00
|
|
|
return sprite;
|
2024-09-09 13:20:59 +08:00
|
|
|
}
|
2024-09-30 13:34:05 +08:00
|
|
|
void SetWindow(std::shared_ptr<sf::RenderWindow> window);
|
|
|
|
void Play();
|
|
|
|
|
|
|
|
};
|