mirror of
https://github.com/modelec/GameController.git
synced 2026-01-18 16:47:32 +01:00
rumble
This commit is contained in:
@@ -39,6 +39,8 @@ void GameControllerHandler::handleMessage(const std::string &message) {
|
||||
|
||||
if (tokens[1] == "all" || tokens[1] == "gc") {
|
||||
if (tokens[2] == "stop proximity") {
|
||||
if (!this->rumble) return;
|
||||
|
||||
std::vector<std::string> args = Modelec::split(tokens[3], ",");
|
||||
double distance = stod(args[0]);
|
||||
Uint16 strength;
|
||||
@@ -60,6 +62,13 @@ void GameControllerHandler::handleMessage(const std::string &message) {
|
||||
if (tokens[2] == "ready") {
|
||||
this->sendMessage("gc;all;game mode;gc\n");
|
||||
}
|
||||
|
||||
if (tokens[2] == "start proximity") {
|
||||
this->rumble = true;
|
||||
}
|
||||
else if (tokens[2] == "stop proximity") {
|
||||
this->rumble = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,4 +28,6 @@ private:
|
||||
SDL_GameController* controller;
|
||||
|
||||
double lidarDectectionDistance = 0;
|
||||
|
||||
bool rumble = true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user