package allegro.input.events;

import allegro.math.BitAlgorithms;

import java.nio.ByteBuffer;
import java.util.ArrayList;

/**
 * Created by LeqxLeqx on 10/25/16.
 */
public class TimerEvent extends Event {

    public static int parseEvent(ArrayList<Event> events, byte[] data, int start) {

        long count;

        ByteBuffer byteBuffer = ByteBuffer.allocate(8);
        byteBuffer.put(data, start, 8);
        byteBuffer.position(0);

        count = BitAlgorithms.reverseEndianOrder(byteBuffer.getLong());

        events.add(new TimerEvent(count));

        return start + 8;
    }

    public final long count;

    public TimerEvent(long count) {
        super(Type.TIMER);
        this.count = count;
    }

}
