126 std::list<ml::Core*> _components;
134 std::unique_ptr<sf::Shader> _ownedShader;
135 std::function<void(
sf::Shader&)> _shaderUniformSetter;
136 float _shaderTime = 0.f;
140 float _spacing = 10.f;
143 float _targetViewX = 0.f;
144 int _previewCount = 5;
154 float _arrowSize = 40.f;
157 std::optional<sf::Texture> _leftArrowTexture;
158 std::optional<sf::Texture> _rightArrowTexture;
159 std::optional<sf::Vector2f> _leftArrowManualPos;
160 std::optional<sf::Vector2f> _rightArrowManualPos;
163 void wrapComponents();
164 void updateRenderTextureSize();
165 void updateArrowPositions();
167 void loadShaderForStyle(
Style style);
void setArrowSize(float size)
Set the size of both navigation arrows.
void setShader(sf::Shader *shader, std::function< void(sf::Shader &)> uniformSetter)
Set a custom GLSL shader with a per-frame uniform setter.
void remove(ml::Core &component)
Remove a Core object from the carousel.
float getSpacing() const
Return the current item spacing in pixels.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
sf::FloatRect getGlobalBounds() const override
void showArrows(bool show)
Show or hide the navigation arrows.
CarouselManifest::ArrowPlacement ArrowPlacement
Convenience alias for CarouselManifest::ArrowPlacement.
sf::RenderStates getRenderStates() const override
void setSpacing(float spacing)
Set the pixel gap between items.
void setShaderParams(const ShaderLibrary::Params ¶ms)
Set parameters forwarded to the active ShaderLibrary style.
void setPosition(const sf::Vector2f &position) override
CarouselManifest::ArrowSide ArrowSide
Convenience alias for CarouselManifest::ArrowSide.
CarouselManifest::State State
Convenience alias for CarouselManifest::State.
void setPreviewCount(int count)
Set how many items are visible in the carousel window at once.
Style getStyle() const
Return the currently active built-in style.
ShaderLibrary::Params & getShaderParams()
Return a mutable reference to the current shader parameters.
void previous()
Scroll to the previous item (left).
void setSpeed(float speed)
Set the scroll animation speed.
CarouselManifest::Flag Flag
Convenience alias for CarouselManifest::Flag.
int getPreviewCount() const
Return the current visible item count.
sf::Vector2f getPosition() const override
void setArrowColor(sf::Color color)
Set the default fill color of the navigation arrows.
void clearArrowPosition(ArrowSide side)
Revert an arrow to its placement-preset position.
float getSpeed() const
Return the current scroll speed.
void add(ml::Core &component)
Add a Core object to the carousel.
CarouselManifest::Style Style
Convenience alias for CarouselManifest::Style.
void setArrowTexture(ArrowSide side, sf::Texture texture)
Replace the default arrow rectangle with a custom texture.
void setArrowHoverColor(sf::Color color)
Set the fill color of a navigation arrow on hover.
void next()
Scroll to the next item (right).
void setStyle(Style style)
Set a built-in shader style from ShaderLibrary.
void setArrowPosition(ArrowSide side, sf::Vector2f position)
Override the auto-computed position of one arrow.
void setArrowPlacement(ArrowPlacement placement)
Set the layout strategy for navigation arrows.
Manifest for the Carousel component.
ShaderLibrary::Style Style
Shader visual style — aliases ShaderLibrary::Style.
ArrowSide
Identifies which navigation arrow to target in setter calls.
State
Scroll animation states.
Flag
Runtime boolean flags for the carousel.
ArrowPlacement
Controls where navigation arrows are placed relative to the content.
Virtual base class for all Malena framework objects.
Base class for all Malena manifests.
A framework-integrated rectangle with optional rounded corners.
Style
Available built-in visual styles.
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
Vector2< float > Vector2f
All uniform parameters shared across the built-in shaders.