diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-17 16:44:52 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-17 16:44:52 +0200 |
commit | 5e7215b4675955fee8197076914599fe62f39c26 (patch) | |
tree | 90b5c097a0759ae948e3ae251201cbd8e047064c /include | |
parent | d83c0123ed3e51ef1e8d6a164e87343dd5335331 (diff) |
Disable wrap around body, detect wrap around
Diffstat (limited to 'include')
-rw-r--r-- | include/Body.hpp | 14 |
1 files changed, 9 insertions, 5 deletions
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<sf::Texture> load_thumbnail_from_url(const std::string &url); std::unordered_map<std::string, ThumbnailData> item_thumbnail_textures; bool loading_thumbnail; + int selected_item; }; }
\ No newline at end of file |