aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp18
-rw-r--r--include/RoundedRectangle.hpp5
2 files changed, 17 insertions, 6 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 65645e9..91913b5 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -17,6 +17,7 @@ namespace Json {
}
namespace QuickMedia {
+ class ThumbnailData;
using BodyItemRenderCallback = std::function<void(std::shared_ptr<BodyItem> &body_item)>;
// Return true to merge
using BodyItemMergeHandler = std::function<bool(BodyItem *prev_item, BodyItem *this_item)>;
@@ -154,9 +155,10 @@ namespace QuickMedia {
void filter_search_fuzzy_item(const std::string &text, BodyItem *body_item);
void handle_item_render(const sf::Vector2f pos, const float item_width, const float item_height, int item_index);
// Returns the the body total drawn height
- float draw_list_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const int prev_num_visible_items, const Json::Value &content_progress);
+ float draw_list_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress);
void draw_card_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, sf::Vector2u window_size, float scissor_y);
void draw_item(sf::RenderWindow &window, std::shared_ptr<BodyItem> &item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress, bool include_embedded_item = true, bool merge_with_previous = false);
+ void draw_card_item(sf::RenderWindow &window, std::shared_ptr<BodyItem> &item, const sf::Vector2f &pos, const sf::Vector2f &pos_offset, const sf::Vector2f &body_size, const sf::Vector2f &window_size, float item_height, float scissor_y, int item_index, ThumbnailData *item_thumbnail);
void update_dirty_state(BodyItem *body_item, float width);
void clear_body_item_cache(BodyItem *body_item);
sf::Vector2i get_item_thumbnail_size(BodyItem *item) const;
@@ -183,11 +185,25 @@ namespace QuickMedia {
BOTTOM
};
+ struct RenderItem {
+ std::shared_ptr<BodyItem> body_item;
+ sf::Vector2f pos;
+ sf::Vector2f pos_offset;
+ sf::Vector2f size;
+ float item_height;
+ int item_index;
+ bool merge_with_previous;
+ std::shared_ptr<ThumbnailData> item_thumbnail;
+ };
+
// TODO: Prevent items from being removed when render is in progress. That would invalidate references and cause a crash
BodyItems items;
BodyTheme body_theme;
+ // Items that are rendered in the current frame
+ std::vector<RenderItem> render_items;
+
int selected_item;
int prev_selected_item;
double page_scroll = 0.0;
diff --git a/include/RoundedRectangle.hpp b/include/RoundedRectangle.hpp
index 2106634..96e57fd 100644
--- a/include/RoundedRectangle.hpp
+++ b/include/RoundedRectangle.hpp
@@ -17,8 +17,6 @@ namespace QuickMedia {
void set_color(sf::Color color);
sf::Vector2f get_position() const;
sf::Vector2f get_size() const;
- void set_band(sf::Vector2f pos, sf::Vector2f size);
- void set_band_color(sf::Color color);
void draw(sf::RenderTarget &target);
private:
float radius;
@@ -26,8 +24,5 @@ namespace QuickMedia {
sf::Vector2f size;
sf::Vertex vertices[4];
sf::Shader *rounded_rectangle_shader;
- sf::Vector2f band_pos;
- sf::Vector2f band_size;
- sf::Color band_color;
};
} \ No newline at end of file