aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Chatbar.hpp30
-rw-r--r--include/types.hpp22
2 files changed, 52 insertions, 0 deletions
diff --git a/include/Chatbar.hpp b/include/Chatbar.hpp
new file mode 100644
index 0000000..143ebba
--- /dev/null
+++ b/include/Chatbar.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <SFML/Graphics/Text.hpp>
+#include <SFML/Graphics/RenderWindow.hpp>
+#include <SFML/Graphics/RectangleShape.hpp>
+
+namespace dchat
+{
+ class Chatbar
+ {
+ public:
+ Chatbar();
+
+ void addChar(sf::Uint32 codePoint);
+ const sf::String& getString() const;
+ void removePreviousChar();
+ void removeNextChar();
+ void clear();
+
+ void moveCaretLeft();
+ void moveCaretRight();
+
+ void draw(sf::RenderWindow &window);
+ private:
+ sf::Text text;
+ sf::RectangleShape background;
+ int caretIndex;
+ sf::Vector2f caretOffset;
+ };
+}
diff --git a/include/types.hpp b/include/types.hpp
new file mode 100644
index 0000000..762dab1
--- /dev/null
+++ b/include/types.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <cstdint>
+
+namespace dchat
+{
+ typedef int8_t i8;
+ typedef int16_t i16;
+ typedef int32_t i32;
+ typedef int64_t i64;
+
+ typedef uint8_t u8;
+ typedef uint16_t u16;
+ typedef uint32_t u32;
+ typedef uint64_t u64;
+
+ typedef float f32;
+ typedef double f64;
+
+ typedef intptr_t ssize;
+ typedef uintptr_t usize;
+}