RType
Graphic.cpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** RType
4 ** File description:
5 ** Graphic.cpp
6 */
7 
8 #include "Graphic.hpp"
9 #include "Drawable.hpp"
10 
11 /**
12  * @brief update, update the graphic
13  * @param event
14  * @param component
15  */
16 void Graphic::update(std::shared_ptr<Event> event, std::shared_ptr<IComponentRType> component)
17 {
18  auto drawable = std::dynamic_pointer_cast<Drawable>(component);
19  if (drawable) {
20  auto packetdraw = drawable->getPacket();
21  if (drawable->getHasChanged()) {
22  _serverSocket->broadcast(packetdraw.get());
23  drawable->setHasChanged(false);
24  }
25  }
26 }