Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Using mouse to rotate...

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Using mouse to rotate...
#7846
Posted by: 2006-02-07 03:14:19
Hi guys,

I?ve implemented a camera Class in my app and want to rotate the camera Left-Rigth and Up-Down using mouse. So I need the mouse inicial position and the final one in the event, but I?m not sure how to do that :(

Could anyone shed some light ?

I?ve tried to do this:

void Canvas::OnMouseMove( wxMouseEvent &event )
{
     wxPoint ptInicial, ptFinal;
    
     event.GetPosition( &ptInicial.x, &ptInicial.y );
    
     if ( event.Moving() )
     {
         event.GetPosition( &ptFinal.x, &ptFinal.y );
        
         camera->rotateLeftRight( (GLfloat)ptInicial.x - (GLfloat)ptFinal.x );
         camera->rotateUpDown( (GLfloat)ptInicial.y - (GLfloat)ptFinal.y );
     }

     Refresh();
}    

Where my OnMouseMove() is a EVT_MOTION message.
The camera doesnt change the rotation at all like that.
What?s wrong?


Thanks in advance!



Message2. Re: Using mouse to rotate...
#7869
Posted by: 2006-02-11 09:07:11
Just to tell that i?ve found it. It?s the WarpPointer() method defined in wxWindow class.

:D
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥410.00 ·
 
 
¥1,015.00 ·
 
 
¥470.00 ·
 
 
¥296.00 ·
 
 
¥410.00 ·
 
 
¥387.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0