コード例 #1
0
ファイル: VirusViewer.cpp プロジェクト: jefrsilva/PGCPandora
void VirusViewer::handleMouseEvent(SDL_Event *event) {
  double mx;
  double my;

  switch (event->type) {
  case SDL_MOUSEMOTION:
    mx = event->motion.x;
    my = event->motion.y;
    break;
    
  case SDL_MOUSEBUTTONUP:
    break;

  case SDL_MOUSEBUTTONDOWN:
    if (event->button.button == 1) {
      Vector world = camera->convertScreenToWorld(Vector(event->motion.x,
							 event->motion.y,
							 0.0));

      debugCreateVirus(Vector(world.x, world.y, 0.0));
    } else if (event->button.button == 3) {
      Vector world = camera->convertScreenToWorld(Vector(event->motion.x,
							 event->motion.y,
							 0.0));

      debugMove(Vector(world.x, world.y, 0.0));
    } else if (event->button.button == 4) {
      camera->increaseZoom();
    } else if (event->button.button == 5) {
      camera->decreaseZoom();
    }
    break;
  }
}
コード例 #2
0
void Player::operationKey()
{
	debugMove();

	if (env.isPush(ci::app::KeyEvent::KEY_SPACE))
		debugRoll();

	if (env.isPush(ci::app::KeyEvent::KEY_b))
		debugDash();
}