Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5921 in orxonox.OLD


Ignore:
Timestamp:
Dec 4, 2005, 11:22:50 PM (18 years ago)
Author:
bknecht
Message:

implemented mousecontrol for spaceship

Location:
branches/spaceshipcontrol/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r5919 r5921  
    3030#include "factory.h"
    3131#include "key_mapper.h"
     32#include "event_handler.h"
    3233
    3334using namespace std;
     
    132133  registerEvent(SDLK_PAGEUP);
    133134  registerEvent(SDLK_PAGEDOWN);
     135  registerEvent(EV_MOUSE_MOTION);
    134136
    135137  this->getWeaponManager()->setSlotCount(7);
     
    261263  // this is the air friction (necessary for a smooth control)
    262264  if(velocity.len() != 0) velocity -= velocity*0.005;
     265 
     266  this->shiftDir(Quaternion(-M_PI/4*xMouse*time, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*time, Vector(0,0,1)));
    263267
    264268  this->shiftCoor (move);
     
    369373  else if( event.type == SDLK_PAGEDOWN)
    370374    this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
     375  else if( event.type == EV_MOUSE_MOTION)
     376  {
     377    this->xMouse = event.x;
     378    this->yMouse = event.y;
     379  }
    371380}
    372381
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h

    r5907 r5921  
    5555    bool                  bDescend;           //!< descend button presses.
    5656    bool                  bFire;              //!< fire button pressed.
     57   
     58    float                 xMouse;             //!< mouse moved in x-Direction
     59    float                 yMouse;             //!< mouse moved in y-Direction
    5760
    5861    Vector                velocity;           //!< the velocity of the player.
  • branches/spaceshipcontrol/src/world_entities/weapons/crosshair.cc

    r5750 r5921  
    7070  this->material = new Material;
    7171
    72   EventHandler::getInstance()->subscribe(this, ES_GAME, EV_MOUSE_MOTION);
     72  //EventHandler::getInstance()->subscribe(this, ES_GAME, EV_MOUSE_MOTION);
    7373
    7474  // center the mouse on the screen, and also hide the cursors
Note: See TracChangeset for help on using the changeset viewer.