aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-26 05:27:45 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-26 05:43:22 +0200
commit74b18beed8651c4a7f6daa39102766676605cdc2 (patch)
tree5a4305a3b439a326f3e48dadd65a174f9a20d9d6 /include
parentd5d462f555ef9d7ce7e001aca5586c19b4d9edc8 (diff)
Change body scrolling to scroll only when the selected row hits the top/bottom
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 4987735..2f1644d 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -5,6 +5,9 @@
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
+#include <SFML/Graphics/RectangleShape.hpp>
+#include <SFML/Graphics/Sprite.hpp>
+#include "../external/RoundedRectangleShape.hpp"
#include <json/value.h>
#include <thread>
@@ -125,8 +128,11 @@ namespace QuickMedia {
sf::Vector2f thumbnail_fallback_size;
sf::Color line_seperator_color;
private:
+ void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress);
+ float get_item_height(BodyItem *item);
+ private:
struct ThumbnailData {
- bool referenced;
+ bool referenced = false;
std::shared_ptr<sf::Texture> texture;
bool loaded = false;
};
@@ -135,5 +141,12 @@ namespace QuickMedia {
std::unordered_map<std::string, ThumbnailData> item_thumbnail_textures;
bool loading_thumbnail;
int selected_item;
+ int prev_selected_item;
+ float page_scroll;
+ // TODO: Use a loading gif or something similar instead, to properly indicate the image is loading. Which could also have text that says "failed to load image" when image loading failed.
+ sf::RectangleShape image_fallback;
+ sf::RectangleShape item_background_shadow;
+ sf::RoundedRectangleShape item_background;
+ sf::Sprite image;
};
} \ No newline at end of file