|
RType
|
#include <ButtonComponent.hpp>


Public Member Functions | |
| ButtonComponent (ClientCore *core, std::shared_ptr< ClientSocket > socket) | |
| Construct a new Button Component object. More... | |
| void | action () override |
| Destroy the Button Component object. More... | |
| void | setTexture (const sf::Texture &texture) |
| Set the Texture object. More... | |
| void | setPosition (sf::Vector2f position) |
| Set the Position object. More... | |
| void | setSize (sf::Vector2f size) |
| Set the Size object. More... | |
| void | setCallback (std::function< void()> callback) |
| Set the Callback object. More... | |
| void | setRect (sf::IntRect rect) |
| Set the Rect object. More... | |
| void | display (sf::RenderWindow &window) override |
| display the button More... | |
| sf::IntRect | getRect () const |
| Get the Rect object. More... | |
| void | handleEvent (const sf::Event &event, sf::RenderWindow &window) override |
| handle event, check if the button is clicked More... | |
| void | handleClickInitServer () |
| handleClickInitServer, handle click on init server button More... | |
| void | handleClickMainScene () |
| handleClickMainScene, handle click on main scene button More... | |
| void | handleClickAccessGame () |
| handleClickMenuScene, handle click on menu scene button More... | |
| void | defaultCallback () |
| defaultCallback, default callback More... | |
Public Member Functions inherited from AComponent | |
| AComponent (ClientCore *clientCore) | |
| AComponent, constructor of AComponent. More... | |
| ~AComponent () override=default | |
| ~AComponent, destructor of AComponent More... | |
| ComponentType | getType () const override |
| getType, get the type of the component More... | |
| void | addActionTarget (std::shared_ptr< IComponent > component) override |
| addActionTarget, add a target to the action More... | |
| void | addSubComponent (std::shared_ptr< IComponent > component) override |
| addSubComponent, add a sub component More... | |
| void | setAttribute (std::string attribute) override |
| setAttribute, set the attribute More... | |
| std::string | getAttribute () override |
| getAttribute, get the attribute More... | |
Public Member Functions inherited from IComponent | |
| IComponent (ClientCore *clientCore) | |
| IComponent, constructor of IComponent. More... | |
| virtual | ~IComponent ()=default |
| ~IComponent, destructor of IComponent More... | |
Additional Inherited Members | |
Protected Attributes inherited from IComponent | |
| std::string | _attribute |
| ComponentType | _type |
| std::vector< std::shared_ptr< IComponent > > | action_target |
| std::vector< std::shared_ptr< IComponent > > | sub_components |
| ClientCore * | _clientCore |
Definition at line 18 of file ButtonComponent.hpp.
|
explicit |
Construct a new Button Component object.
ButtonComponent constructor.
| core | |
| socket |
Definition at line 18 of file ButtonComponent.cpp.
References IComponent::_attribute, IComponent::_type, AComponent::AComponent(), and BUTTON.

|
overridevirtual |
Destroy the Button Component object.
action, call the callback function
Implements IComponent.
Definition at line 39 of file ButtonComponent.cpp.
Referenced by handleEvent().

| void ButtonComponent::defaultCallback | ( | ) |
defaultCallback, default callback
Definition at line 231 of file ButtonComponent.cpp.
|
overridevirtual |
display the button
setAttribute set the attribute of the button
| window |
Implements IComponent.
Definition at line 97 of file ButtonComponent.cpp.
| sf::IntRect ButtonComponent::getRect | ( | ) | const |
Get the Rect object.
getRect get the texture of the button
Definition at line 106 of file ButtonComponent.cpp.
| void ButtonComponent::handleClickAccessGame | ( | ) |
handleClickMenuScene, handle click on menu scene button
handleClickAccessGame handle the click of the button for access the game scene
Definition at line 198 of file ButtonComponent.cpp.
References IComponent::_clientCore, packet::code, packet::data, packet::data_size, MESSAGE, and ClientCore::setCurrentScene().

| void ButtonComponent::handleClickInitServer | ( | ) |
handleClickInitServer, handle click on init server button
handleClickInitServer handle the click of the button
Definition at line 132 of file ButtonComponent.cpp.
| void ButtonComponent::handleClickMainScene | ( | ) |
handleClickMainScene, handle click on main scene button
handleClickMainScene handle the click of the button on the main scene
Definition at line 179 of file ButtonComponent.cpp.
References IComponent::_clientCore, and ClientCore::setCurrentScene().

|
overridevirtual |
handle event, check if the button is clicked
handleEvent handle the event of the button
| event | |
| window | |
| event | to handle |
| window |
Implements IComponent.
Definition at line 116 of file ButtonComponent.cpp.
References action().

| void ButtonComponent::setCallback | ( | std::function< void()> | callback | ) |
Set the Callback object.
setAttribute set the attribute of the button
| callback | |
| attribute |
Definition at line 88 of file ButtonComponent.cpp.
| void ButtonComponent::setPosition | ( | sf::Vector2f | position | ) |
Set the Position object.
setPosition set the position of the button
| position |
Definition at line 58 of file ButtonComponent.cpp.
| void ButtonComponent::setRect | ( | sf::IntRect | rect | ) |
Set the Rect object.
setRect set the rect of the button
| rect |
Definition at line 78 of file ButtonComponent.cpp.
| void ButtonComponent::setSize | ( | sf::Vector2f | size | ) |
Set the Size object.
setSize set the size of the button
| size |
Definition at line 68 of file ButtonComponent.cpp.
| void ButtonComponent::setTexture | ( | const sf::Texture & | texture | ) |
Set the Texture object.
setTexture set the texture of the button
| texture |
Definition at line 48 of file ButtonComponent.cpp.