From 44e66882f6e517b06522cb1e510ed9dea7574273 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 21 Nov 2020 18:20:00 +0100 Subject: Render emoji in text, do not show notification count for cache sync, lazy load 4chan board --- include/Body.hpp | 3 ++- include/FontLoader.hpp | 19 ------------------- include/ResourceLoader.hpp | 27 +++++++++++++++++++++++++++ include/Text.hpp | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 include/FontLoader.hpp create mode 100644 include/ResourceLoader.hpp (limited to 'include') diff --git a/include/Body.hpp b/include/Body.hpp index 236a02d..43e2946 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -174,7 +174,7 @@ namespace QuickMedia { BodyItem* get_selected() const; std::shared_ptr get_selected_shared(); - // Returns null if not visible item + // Returns null if no visible items. This is the item we can see the end of BodyItem* get_last_fully_visible_item(); void clamp_selection(); @@ -205,6 +205,7 @@ namespace QuickMedia { void set_page_scroll(float scroll) { page_scroll = scroll; } float get_page_scroll() const { return page_scroll; } + // This is the item we can see the end of bool is_last_item_fully_visible() const { return last_item_fully_visible; } bool is_body_full_with_items() const { return items_cut_off; } diff --git a/include/FontLoader.hpp b/include/FontLoader.hpp deleted file mode 100644 index bff0f18..0000000 --- a/include/FontLoader.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -namespace sf { - class Font; -} - -namespace QuickMedia::FontLoader { - enum class FontType { - LATIN, - LATIN_BOLD, - CJK, - EMOJI - }; - - // Note: not thread-safe - sf::Font* get_font(FontType font_type); -} \ No newline at end of file diff --git a/include/ResourceLoader.hpp b/include/ResourceLoader.hpp new file mode 100644 index 0000000..a332ba4 --- /dev/null +++ b/include/ResourceLoader.hpp @@ -0,0 +1,27 @@ +#pragma once + +namespace sf { + class Font; + class Texture; +} + +namespace QuickMedia { + void set_resource_loader_root_path(const char *resource_root); +} + +namespace QuickMedia::FontLoader { + enum class FontType { + LATIN, + LATIN_BOLD, + CJK, + EMOJI + }; + + // Note: not thread-safe + sf::Font* get_font(FontType font_type); +} + +namespace QuickMedia::TextureLoader { + // Note: not thread-safe + sf::Texture* get_texture(const char *filepath); +} \ No newline at end of file diff --git a/include/Text.hpp b/include/Text.hpp index f102c59..135a89c 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -139,7 +139,7 @@ namespace QuickMedia sf::String str; // TODO: Remove this for non-editable text??? also replace with std::string? then we get more efficient editing of text const bool bold_font; unsigned int characterSize; - sf::VertexArray vertices[2]; + sf::VertexArray vertices[3]; float maxWidth; sf::Vector2f position; sf::Color color; -- cgit v1.2.3