From 5e7215b4675955fee8197076914599fe62f39c26 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 17 Sep 2020 16:44:52 +0200 Subject: Disable wrap around body, detect wrap around --- include/Body.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/Body.hpp b/include/Body.hpp index c487ad9..81e3a69 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -73,11 +73,12 @@ namespace QuickMedia { public: Body(Program *program, sf::Font *font, sf::Font *bold_font); - // Select previous item, ignoring invisible items - void select_previous_item(); + // Select previous item, ignoring invisible items. Returns true if the item was changed. This can be used to check if the top was hit when wrap_around is set to false + bool select_previous_item(); - // Select next item, ignoring invisible items - void select_next_item(); + // Select next item, ignoring invisible items. Returns true if the item was changed. This can be used to check if the bottom was hit when wrap_around is set to false + bool select_next_item(); + void set_selected_item(int item); void select_first_item(); void reset_selected(); @@ -99,15 +100,17 @@ namespace QuickMedia { bool no_items_visible() const; + int get_selected_item() const { return selected_item; } + sf::Font *font; sf::Font *bold_font; sf::Text progress_text; sf::Text author_text; sf::Text replies_text; - int selected_item; BodyItems items; std::thread thumbnail_load_thread; bool draw_thumbnails; + bool wrap_around; private: struct ThumbnailData { bool referenced; @@ -117,5 +120,6 @@ namespace QuickMedia { std::shared_ptr load_thumbnail_from_url(const std::string &url); std::unordered_map item_thumbnail_textures; bool loading_thumbnail; + int selected_item; }; } \ No newline at end of file -- cgit v1.2.3