diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-08-08 23:17:10 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-08-08 23:17:14 +0200 |
commit | 06f30543730c372226c398c11b3de0213d711d13 (patch) | |
tree | d6229ff224a9e7e5457c856747c2f8726e7a3868 /src/Chatbar.cpp | |
parent | 26edc563cb0ba1a9fb35507e7f32d2d43a845e68 (diff) |
Add support for discord
Diffstat (limited to 'src/Chatbar.cpp')
-rw-r--r-- | src/Chatbar.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Chatbar.cpp b/src/Chatbar.cpp index bb06308..a3e1d0f 100644 --- a/src/Chatbar.cpp +++ b/src/Chatbar.cpp @@ -217,6 +217,20 @@ namespace dchat window.draw(inputBackground); text.draw(window, cache); } + + sf::Vector2f Chatbar::getInputPosition(sf::RenderWindow &window) + { + auto windowSize = window.getSize(); + return { floor(ChannelSidePanel::getWidth() + PADDING_SIDE * Settings::getScaling()), floor(windowSize.y - getInputSize(window).y - PADDING_BOTTOM * Settings::getScaling()) }; + } + + sf::Vector2f Chatbar::getInputSize(sf::RenderWindow &window) + { + auto windowSize = window.getSize(); + const float fontSize = FONT_SIZE * Settings::getScaling(); + const float fontHeight = ResourceCache::getFont("fonts/Nunito-Regular.ttf")->getLineSpacing(fontSize); + return { floor(windowSize.x - ChannelSidePanel::getWidth() - UsersSidePanel::getWidth() - PADDING_SIDE * Settings::getScaling() * 2.0f), floor(fontHeight * 1.7f + BOX_PADDING_Y * Settings::getScaling() * 2.0f) }; + } float Chatbar::getHeight() { |