Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mouse Selection in OpenGL by Bahrudin Hrnjica
#1
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/309...enGL-Scene
Reply
#1
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/309...enGL-Scene
Reply
CAA


Forum Jump:


Users browsing this thread: 1 Guest(s)