Loading...
Searching...
No Matches
Graphic.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4#ifndef MALENA_GRAPHIC_H
5#define MALENA_GRAPHIC_H
6
7#pragma once
8
13#include <stdexcept>
14#include <type_traits>
15
16namespace ml
17{
59 template<typename T>
60 class Graphic : public T, public virtual ComponentCore<>
61 {
62 public:
63 using T::T;
64
73 operator const sf::Drawable&() const;
74
76 static T isItText();
78
80
87 template<typename U>
88 explicit Graphic(const U& obj);
89
99 void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
100
110
118 void setPosition(const sf::Vector2f& position) override;
119
127 sf::Vector2f getPosition() const override;
128 };
129
130} // namespace ml
131
132#include "../../../../src/Graphics/Base/Graphic.tpp"
133#endif // SHAPE_H
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw this graphic to an SFML render target.
sf::Vector2f getPosition() const override
Return the current world-space position.
sf::FloatRect getGlobalBounds() const override
Return the axis-aligned bounding box in world space.
Graphic(const U &obj)
Construct from an existing SFML object of type U.
void setPosition(const sf::Vector2f &position) override
Set the world-space position.
Definition Component.h:22
Rect< float > FloatRect
Vector2< float > Vector2f