make sure CompositeEndpoints properly report readability more axis based keyboard inputs

This commit is contained in:
Brad Hefta-Gaub 2015-10-29 22:37:12 -07:00
parent 8a03383adc
commit 70f3156328
3 changed files with 18 additions and 5 deletions

View file

@ -19,7 +19,6 @@
["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"]
]
},
"when": [ "Application.InHMD", "Application.ComfortMode" ],
"to": "Actions.StepYaw",
"filters":
@ -29,10 +28,18 @@
]
},
{ "from": ["Keyboard.A", "Keyboard.Left", "Keyboard.TouchpadLeft"], "to": "Actions.YAW_LEFT" },
{ "from": ["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"], "to": "Actions.YAW_RIGHT" },
{ "from": "Keyboard.MouseMoveLeft", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_LEFT" },
{ "from": "Keyboard.MouseMoveRight", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_RIGHT" },
{ "from": { "makeAxis" : [
["Keyboard.A", "Keyboard.Left", "Keyboard.TouchpadLeft"],
["Keyboard.D", "Keyboard.Right", "Keyboard.TouchpadRight"]
]
},
"to": "Actions.Yaw"
},
{ "from": { "makeAxis" : ["Keyboard.MouseMoveLeft", "Keyboard.MouseMoveRight"] },
"when": "Keyboard.RightMouseClick",
"to": "Actions.Yaw",
},
{ "from": "Keyboard.A", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.D", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },

View file

@ -20,6 +20,10 @@ CompositeEndpoint::CompositeEndpoint(Endpoint::Pointer first, Endpoint::Pointer
}
}
bool CompositeEndpoint::readable() const {
return first->readable() && second->readable();
}
float CompositeEndpoint::value() {
float result = first->value() * -1.0f + second->value();
return result;

View file

@ -19,6 +19,8 @@ namespace controller {
virtual float value() override;
virtual void apply(float newValue, const Pointer& source) override;
virtual bool readable() const override;
};
}