Skip to content

Commit

Permalink
Added component
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Nov 10, 2024
1 parent 6e1a375 commit 6b1af49
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
19 changes: 3 additions & 16 deletions Engine/include/Handlers/ComponentsHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,9 @@ namespace Prisma

void updatePostRender(std::shared_ptr<FBO> fbo = nullptr);

void addComponent(std::shared_ptr<Component> component)
{
m_components.push_back(component);
}

void removeComponent(std::shared_ptr<Component> component)
{
// Find and remove the component from the vector
auto it = std::remove(m_components.begin(), m_components.end(), component);

// Erase the removed elements (if any)
if (it != m_components.end())
{
m_components.erase(it, m_components.end());
}
}
void addComponent(std::shared_ptr<Component> component);

void removeComponent(std::shared_ptr<Component> component);

ComponentsHandler();

Expand Down
18 changes: 18 additions & 0 deletions Engine/src/Handlers/ComponentsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ void Prisma::ComponentsHandler::updatePostRender(std::shared_ptr<FBO> fbo)
}
}

void Prisma::ComponentsHandler::addComponent(std::shared_ptr<Component> component)
{
m_components.push_back(component);
}

void Prisma::ComponentsHandler::removeComponent(std::shared_ptr<Component> component)
{
// Find and remove the component from the vector
auto it = std::find(m_components.begin(), m_components.end(), component);

// Erase the removed elements (if any)
if (it != m_components.end())
{
std::cout << "a" << std::endl;
m_components.erase(it);
}
}

Prisma::ComponentsHandler::ComponentsHandler()
{
}
2 changes: 1 addition & 1 deletion GUI/src/MeshInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void Prisma::MeshInfo::showSelected(const NodeViewer::NodeData& meshData)

NodeViewer::getInstance().showSelected(meshData, false,
isAnimate || (physicsComponent && !physicsComponent->collisionData().
softBody));
softBody) || !physicsComponent);
ImGui::Dummy(ImVec2(0.0f, 4.0f));

if (mesh)
Expand Down

0 comments on commit 6b1af49

Please sign in to comment.