Computer Aided Automation
Mouse Selection in OpenGL by Bahrudin Hrnjica - Printable Version

+- Computer Aided Automation (https://computeraidedautomation.com)
+-- Forum: CAA Discussions (https://computeraidedautomation.com/forum-7.html)
+--- Forum: Programming Languages (https://computeraidedautomation.com/forum-11.html)
+---- Forum: c# (https://computeraidedautomation.com/forum-14.html)
+---- Thread: Mouse Selection in OpenGL by Bahrudin Hrnjica (/thread-149.html)



Mouse Selection in OpenGL by Bahrudin Hrnjica - techberth - 20-02-2021

Mouse Selection in OpenGL by Bahrudin Hrnjica

void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_LeftButtonDown = TRUE;
m_LeftDownPos = point;
SetCapture();

CMyDoc* pDoc = (CMyDoc*)GetDocument();
ASSERT(pDoc);
CTypedPtrList<CObList,CSphere*>& sphereList =pDoc->m_SphereList;
POSITION pos = sphereList.GetHeadPosition();
while (pos != NULL)
{
CSphere* spheres = sphereList.GetNext(pos);
spheres->m_Select=FALSE;
if(spheres->GetRect().PtInRect(point))
{
m_sph=spheres;
m_sph->m_Select=TRUE;
}
}

Invalidate();
CView::OnLButtonDown(nFlags, point);
}





https://www.codeproject.com/Articles/3097/Mouse-Selection-in-OpenGL-Scene