aboutsummaryrefslogtreecommitdiff
path: root/include/MessagePart.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-04-21 03:46:58 +0200
committerdec05eba <dec05eba@protonmail.com>2018-04-21 03:50:59 +0200
commit09a8ade6becca2a71f45ff0db5f4bf6d64afb212 (patch)
tree3cc733a5af1323c57f7dc4c18747ae0c7de78be6 /include/MessagePart.hpp
parentde059e317e43fa1b94d77fd981be68b86bf6de6e (diff)
Add support for static image emoji
Emoji are downloaded asynchronously using remote program (curl). Need to add support for converting [inline](url) chat message emoji and gifs.
Diffstat (limited to 'include/MessagePart.hpp')
-rw-r--r--include/MessagePart.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/MessagePart.hpp b/include/MessagePart.hpp
index e50852a..cbb0f26 100644
--- a/include/MessagePart.hpp
+++ b/include/MessagePart.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <SFML/Graphics/Text.hpp>
+#include <SFML/Graphics/Sprite.hpp>
#include <SFML/System/Vector2.hpp>
#include <string>
@@ -11,7 +12,8 @@ namespace dchat
public:
enum class Type
{
- TEXT
+ TEXT,
+ EMOJI
};
MessagePart(Type _type) : type(_type) {}
@@ -35,4 +37,17 @@ namespace dchat
sf::Text text;
};
+
+ class MessagePartEmoji : public MessagePart
+ {
+ public:
+ MessagePartEmoji(const std::string &url);
+
+ static float getHeightScaled();
+ virtual sf::Vector2f getPosition() const override;
+ virtual sf::Vector2f getSize() const override;
+
+ sf::Sprite sprite;
+ std::string url;
+ };
}