예제 #1
0
 virtual void mouseReleased(const MouseEventUnrecPtr e)
 {
     if(dynamic_cast<WindowEventProducer*>(e->getSource())->getKeyModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
     {
         mgr->mouseButtonRelease(e->getButton(), e->getLocation().x(), e->getLocation().y());
     }
 }
예제 #2
0
    virtual void mousePressed(const MouseEventUnrecPtr e)
    {
        if(dynamic_cast<WindowEventProducer*>(e->getSource())->getKeyModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
        {
            mgr->mouseButtonPress(e->getButton(), e->getLocation().x(), e->getLocation().y());
        }
        else
        {
            Line TheRay;
            if(e->getButton() == MouseEvent::BUTTON1)
            {

                mgr->getCamera()->calcViewRay(TheRay,e->getLocation().x(),e->getLocation().y(),*(mgr->getWindow()->getPort(0)));
                std::cout<<"Velocity "<<TheRay.getDirection()<<std::endl;
            }
            RocketParticleSystem->addParticle(TheRay.getPosition(),
                                              Vec3f(0.0,1.0f,0.0f),
                                              Color4f(1.0,0.0,0.0,1.0), 
                                              Vec3f(1.0,1.0,1.0), 
                                              10, 
                                              Vec3f(TheRay.getDirection()*50), //Velocity
                                              Vec3f(0.0f,0.0f,0.0f)
                                             );
        }
    }