aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Chatbar.hpp20
-rw-r--r--include/Text.hpp6
2 files changed, 10 insertions, 16 deletions
diff --git a/include/Chatbar.hpp b/include/Chatbar.hpp
index 27b57f9..5d69448 100644
--- a/include/Chatbar.hpp
+++ b/include/Chatbar.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "StringView.hpp"
-#include <SFML/Graphics/Text.hpp>
+#include "Text.hpp"
+#include "Cache.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Window/Event.hpp>
@@ -18,20 +19,10 @@ namespace dchat
public:
Chatbar();
- void addChar(sf::Uint32 codePoint);
- void addString(const std::string &strToAdd);
- const sf::String& getString() const;
- void removePreviousChar();
- void removeNextChar();
- void clear();
-
- void moveCaretLeft();
- void moveCaretRight();
-
bool isFocused() const;
void processEvent(const sf::Event &event, Channel *channel);
- void draw(sf::RenderWindow &window);
+ void draw(sf::RenderWindow &window, Cache &cache);
static float getHeight();
@@ -41,12 +32,9 @@ namespace dchat
private:
void processChatCommand(const StringView &cmd);
private:
- sf::Text text;
+ Text text;
sf::RectangleShape background;
sf::RectangleShape inputBackground;
- int caretIndex;
- sf::Vector2f caretOffset;
- sf::Clock blinkTimer;
bool focused;
};
}
diff --git a/include/Text.hpp b/include/Text.hpp
index 0bc3ced..d2809de 100644
--- a/include/Text.hpp
+++ b/include/Text.hpp
@@ -36,11 +36,17 @@ namespace dchat
Text(const sf::String &str, const sf::Font *font, unsigned int characterSize, float maxWidth, bool plainText = true);
void setString(const sf::String &str);
+ const sf::String& getString() const;
void setPosition(float x, float y);
void setPosition(const sf::Vector2f &position);
void setMaxWidth(float maxWidth);
+
void setCharacterSize(unsigned int characterSize);
+ unsigned int getCharacterSize() const;
+
+ const sf::Font* getFont() const;
+
void setFillColor(sf::Color color);
void setLineSpacing(float lineSpacing);
void setEditable(bool editable);