本文整理汇总了C++中vcg::Trackball::MouseDown方法的典型用法代码示例。如果您正苦于以下问题:C++ Trackball::MouseDown方法的具体用法?C++ Trackball::MouseDown怎么用?C++ Trackball::MouseDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vcg::Trackball
的用法示例。
在下文中一共展示了Trackball::MouseDown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sdlLoop
/* The main event Loop */
int sdlLoop() {
bool quit=false;
bool redraw_needed = false; // true whan a scene needs a redraw
SDL_Event event;
while( !quit ) {
SDL_WaitEvent(&event);
switch( event.type ) {
case SDL_QUIT: quit = true; break;
case SDL_VIDEORESIZE : myReshapeFunc(event.resize.w,event.resize.h); break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_ESCAPE: exit(0); break;
case SDLK_F1: drawMode= (drawMode+1)%5; printf("Current Mode %i\n",drawMode); break;
case SDLK_HOME: track.Reset(); break;
case SDLK_SPACE:
trackballMode= (trackballMode+1)%2; printf("Trackball Mode %i\n",drawMode);
SetTrackball(trackballMode);
break;
default: track.ButtonDown( SDL2VCG( event.key.keysym.sym) );
}
redraw_needed = true;
break;
case SDL_KEYUP:
track.ButtonUp( SDL2VCG( event.key.keysym.sym) ); break;
case SDL_MOUSEBUTTONDOWN:
switch(event.button.button) {
case SDL_BUTTON_WHEELUP: track.MouseWheel( 1); redraw_needed = true; break;
case SDL_BUTTON_WHEELDOWN: track.MouseWheel(-1); redraw_needed = true; break;
default: track.MouseDown(event.button.x, (height - event.button.y), SDL2VCG(event.button.button) ); break;
} break;
case SDL_MOUSEBUTTONUP:
track.MouseUp(event.button.x, (height - event.button.y), SDL2VCG(event.button.button) ); break;
break;
case SDL_MOUSEMOTION:
while(SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK));
track.MouseMove(event.button.x, (height - event.button.y));
redraw_needed = true;
break;
case SDL_TIMER:
if (onTimer()) redraw_needed = true;
if (redraw_needed) sendRedraw(); // justs sends a redraw event!
redraw_needed = false;
break;
case SDL_VIDEOEXPOSE:
// any rendering is done ONLY here.
display();
drainRedrawEvents();
break;
default: break;
}
}
SDL_Quit();
return -1;
}
示例2: sdl_idle
// The Event Loop Processor
int sdl_idle() {
bool quit=false;
SDL_Event event;
while( !quit ) {
SDL_WaitEvent(&event);
switch( event.type ) {
case SDL_QUIT: quit = true; break;
case SDL_VIDEORESIZE : myReshapeFunc(event.resize.w,event.resize.h); break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym) {
case SDLK_RCTRL:
case SDLK_LCTRL: track.ButtonDown(vcg::Trackball::KEY_CTRL); break;
case SDLK_q: exit(0); break;
case SDLK_SPACE: drawMode=((drawMode+1)%6); printf("Current Mode %i\n",drawMode); break;
} break;
case SDL_KEYUP:
switch(event.key.keysym.sym) {
case SDLK_RCTRL:
case SDLK_LCTRL: track.ButtonUp(vcg::Trackball::KEY_CTRL); break;
} break;
case SDL_MOUSEBUTTONDOWN:
switch(event.button.button) {
case SDL_BUTTON_WHEELUP: track.MouseWheel( 1); break;
case SDL_BUTTON_WHEELDOWN: track.MouseWheel(-1); break;
case SDL_BUTTON_LEFT: track.MouseDown(event.button.x, (height - event.button.y), vcg::Trackball::BUTTON_LEFT); break;
case SDL_BUTTON_RIGHT: track.MouseDown(event.button.x, (height - event.button.y), vcg::Trackball::BUTTON_RIGHT);break;
} break;
case SDL_MOUSEBUTTONUP:
switch(event.button.button) {
case SDL_BUTTON_LEFT: track.MouseUp(event.button.x, (height - event.button.y), vcg::Trackball::BUTTON_LEFT); break;
case SDL_BUTTON_RIGHT: track.MouseUp(event.button.x, (height - event.button.y), vcg::Trackball::BUTTON_RIGHT);break;
} break;
case SDL_MOUSEMOTION:
while(SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK));
track.MouseMove(event.button.x, (height - event.button.y));
break;
case SDL_VIDEOEXPOSE:
default: break;
}
display();
}
SDL_Quit();
return -1;
}
示例3: ProcessClick
void ProcessClick(int button, int state, int x, int y){
if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
track.MouseDown(x,glutGet(GLUT_WINDOW_HEIGHT)-y,vcg::Trackball::BUTTON_LEFT);
if(button == GLUT_LEFT_BUTTON && state == GLUT_UP)
track.MouseUp(x,glutGet(GLUT_WINDOW_HEIGHT)-y,vcg::Trackball::BUTTON_LEFT);
if (button == 3 && state == GLUT_DOWN) //wheel up
track.MouseWheel(0.8);
else if (button == 4 && state == GLUT_DOWN) //wheel down
track.MouseWheel(-0.8);
}
示例4: mousePressEvent
void GLWidget::mousePressEvent (QMouseEvent * e)
{
if(!TwMousePressQt(e))
{
e->accept ();
setFocus ();
track.MouseDown (e->x (), height () - e->y (), QT2VCG (e->button (), e->modifiers ()));
}
updateGL ();
}