RType
Public Member Functions | Public Attributes | List of all members
InputComponent Class Reference

#include <InputComponent.hpp>

Inheritance diagram for InputComponent:
Inheritance graph
[legend]
Collaboration diagram for InputComponent:
Collaboration graph
[legend]

Public Member Functions

 InputComponent (ClientCore *core, std::shared_ptr< ClientSocket > socket)
 Construct a new Input Component object. More...
 
void action () override
 action, call the callback function More...
 
void setTexture (const sf::Texture &texture)
 setTexture set the texture of the component More...
 
void setPosition (sf::Vector2f position)
 setPosition set the position of the component More...
 
void setSize (sf::Vector2f size)
 setSize set the size of the component More...
 
void setRect (sf::IntRect rect)
 setRect set the rect of the component More...
 
void setIsClicked (bool isClicked)
 setIsClicked, set the isClicked of the component More...
 
void display (sf::RenderWindow &window) override
 display display the component More...
 
sf::IntRect getRect () const
 getRect get the rect of the component More...
 
void handleEvent (const sf::Event &event, sf::RenderWindow &window) override
 handleEvent, handle the event More...
 
void handleClick ()
 handleClick, handle the click More...
 
void setText ()
 setText, set the text of the component More...
 
std::string getText ()
 getText, get the text of the component 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...
 

Public Attributes

std::string _textEntry
 

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
 

Detailed Description

Definition at line 13 of file InputComponent.hpp.

Constructor & Destructor Documentation

◆ InputComponent()

InputComponent::InputComponent ( ClientCore core,
std::shared_ptr< ClientSocket socket 
)
explicit

Construct a new Input Component object.

InputComponent constructor.

Parameters
core
socket

Definition at line 17 of file InputComponent.cpp.

References IComponent::_attribute, _textEntry, IComponent::_type, AComponent::AComponent(), and INPUT.

Here is the call graph for this function:

Member Function Documentation

◆ action()

void InputComponent::action ( )
overridevirtual

action, call the callback function

Implements IComponent.

Definition at line 45 of file InputComponent.cpp.

◆ display()

void InputComponent::display ( sf::RenderWindow &  window)
overridevirtual

display display the component

Parameters
window

Implements IComponent.

Definition at line 98 of file InputComponent.cpp.

◆ getRect()

sf::IntRect InputComponent::getRect ( ) const

getRect get the rect of the component

getRect get the texture of the component

Returns
sf::IntRect
rect of the component

Definition at line 108 of file InputComponent.cpp.

◆ getText()

std::string InputComponent::getText ( )

getText, get the text of the component

getText get the text of the component

Definition at line 124 of file InputComponent.cpp.

References _textEntry.

◆ handleClick()

void InputComponent::handleClick ( )

handleClick, handle the click

◆ handleEvent()

void InputComponent::handleEvent ( const sf::Event event,
sf::RenderWindow &  window 
)
overridevirtual

handleEvent, handle the event

handleEvent handle the event of the component

Parameters
event
window

Implements IComponent.

Definition at line 143 of file InputComponent.cpp.

References _textEntry, and setText().

Here is the call graph for this function:

◆ setIsClicked()

void InputComponent::setIsClicked ( bool  isClicked)

setIsClicked, set the isClicked of the component

SetIsClicked set the isClicked of the component.

Parameters
isClicked

Definition at line 133 of file InputComponent.cpp.

◆ setPosition()

void InputComponent::setPosition ( sf::Vector2f  position)

setPosition set the position of the component

Parameters
position

Definition at line 64 of file InputComponent.cpp.

◆ setRect()

void InputComponent::setRect ( sf::IntRect  rect)

setRect set the rect of the component

Parameters
rect

Definition at line 88 of file InputComponent.cpp.

◆ setSize()

void InputComponent::setSize ( sf::Vector2f  size)

setSize set the size of the component

Parameters
size

Definition at line 78 of file InputComponent.cpp.

◆ setText()

void InputComponent::setText ( )

setText, set the text of the component

setText set the text of the component

Definition at line 116 of file InputComponent.cpp.

Referenced by handleEvent().

Here is the caller graph for this function:

◆ setTexture()

void InputComponent::setTexture ( const sf::Texture &  texture)

setTexture set the texture of the component

Parameters
texture

Definition at line 54 of file InputComponent.cpp.

Member Data Documentation

◆ _textEntry

std::string InputComponent::_textEntry

Definition at line 104 of file InputComponent.hpp.

Referenced by getText(), handleEvent(), and InputComponent().


The documentation for this class was generated from the following files: