mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-23 04:52:48 +00:00
43 lines
771 B
Java
43 lines
771 B
Java
package com.limelight.nvstream.input;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
public class MouseMovePacket extends InputPacket {
|
|
|
|
private static final byte[] HEADER =
|
|
{
|
|
0x06,
|
|
0x00,
|
|
0x00,
|
|
0x00
|
|
};
|
|
|
|
public static final int PACKET_TYPE = 0x8;
|
|
public static final int PAYLOAD_LENGTH = 8;
|
|
public static final int PACKET_LENGTH = PAYLOAD_LENGTH +
|
|
InputPacket.HEADER_LENGTH;
|
|
|
|
private short deltaX;
|
|
private short deltaY;
|
|
|
|
public MouseMovePacket(short deltaX, short deltaY)
|
|
{
|
|
super(PACKET_TYPE);
|
|
|
|
this.deltaX = deltaX;
|
|
this.deltaY = deltaY;
|
|
}
|
|
|
|
@Override
|
|
public byte[] toWire() {
|
|
ByteBuffer bb = ByteBuffer.allocate(PACKET_LENGTH);
|
|
|
|
bb.put(toWireHeader());
|
|
bb.put(HEADER);
|
|
bb.putShort(deltaX);
|
|
bb.putShort(deltaY);
|
|
|
|
return bb.array();
|
|
}
|
|
}
|