void GUIManager::GetVisibleEntities(RenderList* List) { for(i32 i = 0;i < m_Elements.size();i++) { RenderComponent* r = (RenderComponent*)m_Elements[i].get()->GetOwner()->GetComponentByType(CT_RENDER); if(!m_Elements[i]->GetOwner()->HasComponentType(CT_RENDER)) continue; if(!r->GetMesh()) continue; if(r->IsHidden()) continue; if(r->GetMesh()->NeedsSync()) if(r->GetVertexCount() == 0) continue; List->AddEntity(m_Elements[i].get()->GetOwner()); } }
void GUIManager::OnMouseUp(i32 Button, Vec2 cPos) { for(i32 i = (i32)m_Elements.size() - 1;i >= 0;i--) { RenderComponent* r = (RenderComponent*)m_Elements[i].get()->GetOwner()->GetComponentByType(CT_RENDER); if(r->IsHidden()) continue; Vec2 Pos = m_Elements[i].get()->GetPosition(); Vec2 Sz = m_Elements[i].get()->GetSize(); if(cPos.x > Pos.x && cPos.x < Pos.x + Sz.x && cPos.y > Pos.y && cPos.y < Pos.y + Sz.y) { m_Elements[i].get()->OnMouseUp(Button, cPos); break; } } }