[MFC / DirectX 9] CSplitterWnd - Mouse Position inside...
usually you enhance your message map of the view where you want to mouse input
BEGIN_MESSAGE_MAP( CMyview, classtype your derive CMyview from)
//{{AFX_MSG_MAP( CMyview)
ON_WM_LBUTTONDOWN( )
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
and overload afx_msg void OnLButtonDown( UINT, CPoint ); in your view class
this way you get a message whenever you left clicked into the desired view
for additional information have a look at the msdn
google: msdn mfc
as side note:
before you dive too much into MFC id rather suggest you to have a look at wxwidgets
wxwidgets
its a cross platform gui library that is very similar to mfc except with one advantage, the code looks thousand times clear which is why I use wxwidgets in all my gui app projects
BEGIN_MESSAGE_MAP( CMyview, classtype your derive CMyview from)
//{{AFX_MSG_MAP( CMyview)
ON_WM_LBUTTONDOWN( )
//}}AFX_MSG_MAP
END_MESSAGE_MAP( )
and overload afx_msg void OnLButtonDown( UINT, CPoint ); in your view class
this way you get a message whenever you left clicked into the desired view
for additional information have a look at the msdn
google: msdn mfc
as side note:
before you dive too much into MFC id rather suggest you to have a look at wxwidgets
wxwidgets
its a cross platform gui library that is very similar to mfc except with one advantage, the code looks thousand times clear which is why I use wxwidgets in all my gui app projects
;) Yeah.. i have programmed a lot in MFC... but normaly i programm in WinAPI... thats the best way :D
hmm... the Problem is that there Renderer is in an other Class... and in this Class i have no Renderer handle...
Maybe i will send the Renderer a message... with the coordinates... aso...
hmm... the Problem is that there Renderer is in an other Class... and in this Class i have no Renderer handle...
Maybe i will send the Renderer a message... with the coordinates... aso...
I am working on a level editor on my own
The way I do it is giving each window a id
the 3d camera view will use the gluProject unproject functions
the 2d views use the view ids to determine the picking ray
the final information of the ray is then passed to the scene manager that does the rest for me
i do all modifications with modifiers,
those are stored on a stack to support a undo system, pretty important in almost every editor
i simply store a copy of the unmodified object in the modifier instance and a link to the new modified object this way i can easily undo any changes
this might not be the most efficient way but it works and can be enhanced/improved later on
The way I do it is giving each window a id
the 3d camera view will use the gluProject unproject functions
the 2d views use the view ids to determine the picking ray
the final information of the ray is then passed to the scene manager that does the rest for me
i do all modifications with modifiers,
those are stored on a stack to support a undo system, pretty important in almost every editor
i simply store a copy of the unmodified object in the modifier instance and a link to the new modified object this way i can easily undo any changes
this might not be the most efficient way but it works and can be enhanced/improved later on
Hmm your Ideas sounds good... :)
.. her is the way i get the mouse positon...
i have added a new Window Message in my CMainFrame Class(Header):
than i added in the Class, which contained the Renderer, a OnMouseMove Message an call the SendMessage Function.
In the CMainFrame Source File, i added the following code:
That is a realy simple way, i belive so, to handle that problem.
Deviloper
Devil Entertainment
.. her is the way i get the mouse positon...
i have added a new Window Message in my CMainFrame Class(Header):
// Defination#define WM_VIEWMOUSEPOS WM_USER+20// protected Function for the new Messageafx_msg LRESULT OnViewMousePos(WPARAM wParam, LPARAM lParam);// protected MembervariableCPoint m_ptMousePos;
than i added in the Class, which contained the Renderer, a OnMouseMove Message an call the SendMessage Function.
In the CMainFrame Source File, i added the following code:
LRESULT CMainFrame::OnViewMousePos(WPARAM wParam, LPARAM lParam){ m_ptMousePos.x = (long)wParam; m_ptMousePos.y = (long)lParam; return 0;}void CMainFrame::OnIndicatorPos(CCmdUI *pCmdUI){ pCmdUI->Enable(); char cText[128]; sprintf(cText, "%d, %d", m_ptMousePos.x, m_ptMousePos.y); pCmdUI->SetText(cText);}
That is a realy simple way, i belive so, to handle that problem.
Deviloper
Devil Entertainment
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement