コード例 #1
0
ファイル: Moveable.cpp プロジェクト: MajorBreakfast/cvt
	void Moveable::mouseMoveEvent( MouseMoveEvent& event )
	{
		if( _activeMode == 1 ) {
			int cx, cy, nx, ny, dx, dy;
			position( cx, cy );
			event.position( nx, ny );
			dx = nx - _lx;
			dy = ny - _ly;
			setPosition( cx + dx, cy + dy );
			_lx = nx - dx;
			_ly = ny - dy;
			update();
		} else if( _activeMode == 2 ) {
			int cw, ch, nx, ny, dx, dy;
			event.position( nx, ny );
			dx = nx - _lx;
			dy = ny - _ly;
			size( cw, ch );
			cw = Math::max( cw + dx, 32 );
			ch = Math::max( ch + dy, 32 );
			setSize( cw, ch );
			_lx = nx;
			_ly = ny;
			update();
		} else if( _activeWidget ) {
			mapGlobal( event.x, event.y );
			_activeWidget->mapLocal( event.x, event.y );
			_activeWidget->mouseMoveEvent( event );
		}
	}
コード例 #2
0
void AreaLightsExample::mouseMoveEvent(MouseMoveEvent& event) {
    if(_ui->handleMoveEvent(event.position())) {
        /* UI handles it */

    } else if((event.buttons() & MouseMoveEvent::Button::Left)) {
        const Vector2 delta = 3.0f*
            Vector2{event.position() - _previousMousePosition}/Vector2{GL::defaultFramebuffer.viewport().size()};
        _cameraRotation += delta;

        _previousMousePosition = event.position();

    } else return;

    redraw();
}
コード例 #3
0
void PrimitivesExample::mouseMoveEvent(MouseMoveEvent& event) {
    if(!(event.buttons() & MouseMoveEvent::Button::Left)) return;

    const Vector2 delta = 3.0f*
        Vector2{event.position() - _previousMousePosition}/
        Vector2{GL::defaultFramebuffer.viewport().size()};

    _transformation =
        Matrix4::rotationX(Rad{delta.y()})*
        _transformation*
        Matrix4::rotationY(Rad{delta.x()});

    _previousMousePosition = event.position();
    event.setAccepted();
    redraw();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: rynti/openLima
	virtual void onMouseMove(Mouse& source, const MouseMoveEvent& e) {
		if(fpsMode) {
			camera->rotation.y += e.getDelta().x / 10.0f;
			camera->rotation.x += e.getDelta().y / 10.0f;
			while(camera->rotation.y < 0)
				camera->rotation.y += 360;
			while(camera->rotation.y >= 360)
				camera->rotation.y -= 360;

			if(camera->rotation.x < -80)
				camera->rotation.x = -80;
			if(camera->rotation.x > 80)
				camera->rotation.x = 80;

			Real rotX = (camera->rotation.x) / 180 * OPENLIMA_REAL(3.1415926535);
			Real rotY = (camera->rotation.y + 180) / 180 * OPENLIMA_REAL(3.1415926535);

			Real cy = -sin(rotX);
			Real cz = cos(rotX);

			Vector3f dir(cz * sin(-rotY), cy, cz * cos(-rotY));

			cameraLight->direction = dir;
		}
	}
コード例 #5
0
void Menu::mouseMoveEvent(MouseMoveEvent& event) {
    Vector2 cursorPosition =
        Vector2::yScale(-1.0f)*(Vector2(event.position())/Vector2(defaultFramebuffer.viewport().size())-Vector2(0.5f))*camera->projectionSize();

    MenuItem* collisionBefore = static_cast<MenuItem*>(shapes.firstCollision(*cursor));
    cursor->resetTransformation().translate(cursorPosition);
    MenuItem* collisionAfter = static_cast<MenuItem*>(shapes.firstCollision(*cursor));

    if(collisionBefore != collisionAfter) {
        if(collisionBefore) collisionBefore->hoverChanged(false);
        if(collisionAfter) collisionAfter->hoverChanged(true);
    }

    event.setAccepted();
    redraw();
}
コード例 #6
0
ファイル: Context.hpp プロジェクト: mosra/magnum-integration
template<class MouseMoveEvent> bool Context::handleMouseMoveEvent(MouseMoveEvent& event) {
    /* Ensure we use the context we're linked to */
    ImGui::SetCurrentContext(_context);

    ImGuiIO& io = ImGui::GetIO();
    io.MousePos = ImVec2(Vector2(event.position())*_eventScaling);
    return io.WantCaptureMouse;
}
コード例 #7
0
// Dispatch a mouse move event to any registered handlers
void EventDispatcher::handleMouseMove(MouseMoveEvent& evt)
{
    HANDLE dev = evt.getDeviceHandle();

    {
        // Set the device name if it's available
        ScopedCriticalSection mMutex(&mdLock);
        if(mouseDevices.count(dev) > 0)
        {
            evt.setDeviceInfo(mouseDevices[dev]);
        }
        else
        {
            // It's an unknown device, let's see what we can find out about it.
            ScopedNonCriticalSection unlock(&mdLock);
            MouseInfo *mi = unknownMouseDevice(dev);
            if(mi)
            {
                evt.setDeviceInfo(mi);
            }
        }
    }

    {
        // Run the chain, let someone make a decision about this event
        ScopedCriticalSection mecMutex(&mecLock);
        if(mouseEventChains.count(dev) > 0 && mouseEventChains[dev]->chainSize() > 0)
        {
            // You like me! You really, really like me!
            mouseEventChains[dev]->runMouseMoveEventChain(evt);
        }
        else
        {
            // Zero is the REAL lonliest number. It's the lonliest number
            // since the number one.
        }
    }
}
コード例 #8
0
ファイル: cursor.cpp プロジェクト: Mailaender/antares
void GameCursor::mouse_move(const MouseMoveEvent& event) {
    if (event.where().h >= viewport().left) {
        wake();
    }
}
コード例 #9
0
const void Editor::mouseMoveListener(MouseMoveEvent event){
	cout << event.x() << " " << event.y() << endl;
}
コード例 #10
0
ファイル: event-tracker.cpp プロジェクト: gamefreak/antares
void EventTracker::mouse_move(const MouseMoveEvent& event) {
    _mouse = event.where();
}