From 1e0e68f9cda51c881b32a54d9eece71c1428f7ac Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 22 Apr 2018 05:58:44 +0200 Subject: Add video and gif support Gif streams from url. Todo: Add play controls to video --- include/Cache.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/Cache.hpp') diff --git a/include/Cache.hpp b/include/Cache.hpp index 59d997a..0314e7e 100644 --- a/include/Cache.hpp +++ b/include/Cache.hpp @@ -14,6 +14,8 @@ namespace TinyProcessLib namespace dchat { + class Gif; + struct ImageByUrlResult { enum class Type @@ -23,9 +25,19 @@ namespace dchat FAILED_DOWNLOAD }; + ImageByUrlResult() : texture(nullptr), type(Type::DOWNLOADING), isGif(false) {} + ImageByUrlResult(sf::Texture *_texture, Type _type) : texture(_texture), type(_type), isGif(false) {} + ImageByUrlResult(Gif *_gif, Type _type) : gif(_gif), type(_type), isGif(true) {} + // @texture is null if @type is DOWNLOADING or FAILED_DOWNLOAD - sf::Texture *texture; + union + { + sf::Texture *texture; + Gif *gif; + }; + Type type; + bool isGif; }; class Cache -- cgit v1.2.3