void EventHandler::mouse_motion(SDL_MouseMotionEvent *event)
{
  int x, y;

  // Not returning in test_mode makes test_mode work with mouse input,
  // but messes up input values a little.
  //~ if (nState != STATE_RUN && !(test_mode && nState == STATE_RESUMING))
  //~ return;

  x = event->x;
  y = event->y;

  if ((Global::inputDev.zoom_control==MOUSE) && !(Global::gui && Global::gui->isVisible()))
  {
    zoom_set(y);
    return;
  }

  if (Global::TXInterface->inputMethod() == T_TX_Interface::eIM_mouse)
  {
    Global::TXInterface->setAxis(0, NORM_MOUSE_X(x));
    Global::TXInterface->setAxis(1, NORM_MOUSE_Y(y));
  }
}
Esempio n. 2
0
int			key_hook(int keycode, t_mlx *mlx)
{
    if (keycode == 18)
        mlx->motion = 1;
    if (keycode == 19)
        mlx->motion = 0;
    if (keycode == 53)
        exit(0);
    if (keycode == 20)
    {
        mlx->maxiter -= 10;
        choice(mlx);
    }
    if (keycode == 21)
    {
        mlx->maxiter += 10;
        choice(mlx);
    }
    if (keycode == 69)
        zoom_set(ZOOM, ZOOM, mlx);
    if (keycode == 78)
        zoom_out(ZOOM, ZOOM, mlx);
    return (0);
}