The base class for all UI components
.
More...
#include <Component.hpp>
|
virtual void | draw (sf::RenderTarget &target, sf::RenderStates states) const |
| Draw the component to the render target. More...
|
|
virtual void | updateCoord () |
| Called when the component need update its geometry Inherit when you need to update some sprite. More...
|
|
void | triggerEvent (const sf::ui::ComponentEvent &event) |
| Triggers the event and notify all observers. More...
|
|
The base class for all UI components
.
Definition at line 29 of file Component.hpp.
sf::ui::Component::Component |
( |
| ) |
|
Creates an empty component, without texture.
sf::ui::Component::Component |
( |
sf::Texture const & |
texture | ) |
|
Creates a component with the give texture.
- Parameters
-
texture | - the texture displayed by the component |
int sf::ui::ComponentObservable::countObservers |
( |
| ) |
|
|
inherited |
- Returns
- the number of observers
virtual void sf::ui::Component::draw |
( |
sf::RenderTarget & |
target, |
|
|
sf::RenderStates |
states |
|
) |
| const |
|
protectedvirtual |
- Returns
- the begin of the observers' iterator
- Returns
- the end of the observers' iterator
const sf::Vector2f& sf::ui::Component::getPosition |
( |
| ) |
const |
- Returns
- the position of the component
virtual sf::Vector2f sf::ui::Component::getSize |
( |
| ) |
const |
|
virtual |
const sf::Texture* sf::ui::Component::getTexture |
( |
| ) |
const |
- Returns
- the texture of the component
void sf::ui::Component::move |
( |
sf::Vector2f const & |
vector | ) |
|
Move the component.
- Parameters
-
void sf::ui::Component::move |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
Move the component.
- Parameters
-
x | the x movement |
y | the y movement |
void sf::ui::ComponentObservable::removeAllObservers |
( |
| ) |
|
|
inherited |
Remove all the observers.
Remove the observer at the given index.
- Parameters
-
observer | the observer to remove |
void sf::ui::Component::setPosition |
( |
sf::Vector2f const & |
position | ) |
|
Set the component's position.
- Parameters
-
position | - the position vector |
void sf::ui::Component::setPosition |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
Set the component's position.
- Parameters
-
x | - the x coordinate |
y | - the y coordinate |
void sf::ui::Component::setTexture |
( |
const sf::Texture & |
texture | ) |
|
Set the texture of the component.
Triggers the event and notify all observers.
- Parameters
-
virtual void sf::ui::Component::updateCoord |
( |
| ) |
|
|
protectedvirtual |
virtual void sf::ui::Component::updateEvent |
( |
sf::Event const & |
event | ) |
|
|
pure virtual |
virtual void sf::ui::Component::updateFixed |
( |
sf::Time |
delta | ) |
|
|
pure virtual |
void sf::ui::Component::updateSize |
( |
| ) |
|
Update the size of the component Call it when you update your texture after it was set, to recalculate the component's size with new texture loaded.
Example:
sf::Texture texture;
sf::Label label(texture);
texture.loadFromFile("texture.png");
label.updateSize();
The documentation for this class was generated from the following file: