-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16889 from hrydgard/tilt-improvements
Tilt improvements: Add visualizer, better defaults
- Loading branch information
Showing
67 changed files
with
404 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
|
||
namespace TiltEventProcessor { | ||
|
||
enum TiltTypes{ | ||
TILT_NULL = 0, | ||
TILT_ANALOG, | ||
TILT_DPAD, | ||
TILT_ACTION_BUTTON, | ||
TILT_TRIGGER_BUTTON, | ||
}; | ||
|
||
|
||
//Represents a generic Tilt event | ||
struct Tilt { | ||
Tilt() : x_(0), y_(0) {} | ||
Tilt(const float x, const float y) : x_(x), y_(y) {} | ||
|
||
float x_, y_; | ||
}; | ||
|
||
|
||
Tilt NormalizeTilt(const Tilt &tilt); | ||
|
||
// generates a tilt in the correct coordinate system based on | ||
// calibration. BaseTilt is the "base" / "zero" tilt. currentTilt is the | ||
// sensor tilt reading at this moment. | ||
// NOTE- both base and current tilt *MUST BE NORMALIZED* by calling the NormalizeTilt() function. | ||
Tilt GenTilt(const Tilt &baseTilt, const Tilt ¤tTilt, bool invertX, bool invertY, float deadzone, float xSensitivity, float ySensitivity); | ||
|
||
void TranslateTiltToInput(const Tilt &tilt); | ||
|
||
// These functions generate tilt events given the current Tilt amount, | ||
// and the deadzone radius. | ||
void GenerateAnalogStickEvent(const Tilt &tilt); | ||
void GenerateDPadEvent(const Tilt &tilt); | ||
void GenerateActionButtonEvent(const Tilt &tilt); | ||
void GenerateTriggerButtonEvent(const Tilt &tilt); | ||
|
||
void ResetTiltEvents(); | ||
|
||
// Lets you preview the amount of tilt in TiltAnalogSettingsScreen. | ||
extern float rawTiltAnalogX; | ||
extern float rawTiltAnalogY; | ||
|
||
} // namespace |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.