예제 #1
0
    private bool IsNiceSnapshot(BBInputSnapshot snapshot)
    {
        bool ret = false;

        if (BBUtil.IsStrokeInputType(snapshot.type))
        {
            if (snapshot.type == BBInputType.Move ||
                snapshot.type == BBInputType.Wheel)
            {
                if (mRecordButtons > 0)
                {
                    ret = true;
                }
            }
            else if ((mRecordButtons & snapshot.button) > 0)
            {
                ret = true;
            }
        }
        else if (BBUtil.IsKeyboardInputType(snapshot.type) && mRecordKeyboard)
        {
            ret = true;
        }
        return(ret);
    }
예제 #2
0
    private BBMacro Parse(List <BBInputSnapshot> snapshots)
    {
        BBMacro head    = null;
        BBMacro current = null;

        for (int i = 0; i < snapshots.Count; i++)
        {
            BBInputSnapshot snapshot = snapshots[i];
            BBMacro         macro    = new BBMacro();
            macro.button = snapshot.button;
            macro.code   = BBUtil.InputType2OpCode(snapshot.type);
            macro.key    = snapshot.key;
            if (BBUtil.IsStrokeInputType(snapshot.type))
            {
                var coord = mConfig.Screen2Axis(snapshot.inputPosition);
                if (snapshot.type == BBInputType.Wheel)
                {
                    macro.data = new float[] { coord[0], coord[1], snapshot.delta };
                }
                else
                {
                    macro.data = coord;
                }
            }
            if (head == null)
            {
                head    = macro;
                current = head;
            }
            else
            {
                current.next = macro;
                current      = current.next;
            }
        }
        return(head);
    }