void TouchscreenController::Initialize(InputSystem* input_system, vec2 window_size, const Config* config) { input_system_ = input_system; window_size_ = window_size; ClearAllLogicalInputs(); config_ = config; }
void MultiplayerController::AdvanceFrame(WorldTime delta_time) { if (character_id_ == kNoCharacter) { return; } ClearAllLogicalInputs(); // Check to make sure we're valid to be sending input. Character* character = gamestate_->characters()[character_id_].get(); auto character_state = character->State(); if (character->health() <= 0 || character_state == StateId_KO || character_state == StateId_Joining || character_state == StateId_Jumping || character_state == StateId_HitByPie || character_state == StateId_Won) { return; } // Prepare to block if (block_delay_ > 0) { block_delay_ -= delta_time; if (block_delay_ < 0) block_delay_ = 0; } else { // if we're blocking, keep blocking. if (block_hold_ > 0) { block_hold_ -= delta_time; // aiming has priority so we do it first, then we block } } if (aim_at_character_id_ != kNoCharacter) { // we have a character to aim at, make sure we are aimed there. if (character->target() != aim_at_character_id_) { fplbase::LogInfo(fplbase::kApplication, "MultiplayerController: player %d executing aim at %d", character_id_, aim_at_character_id_); character->force_target(aim_at_character_id_); return; } } if (block_hold_ > 0 && block_delay_ == 0) { SetLogicalInputs(LogicalInputs_Deflect, true); fplbase::LogInfo(fplbase::kApplication, "MultiplayerController: player %d executing block %d", character_id_, block_hold_); return; } if (throw_pie_delay_ > 0 && character_state != StateId_Throwing) { throw_pie_delay_ -= delta_time; if (throw_pie_delay_ <= 0) { fplbase::LogInfo(fplbase::kApplication, "MultiplayerController: player %d executing throw pie", character_id_); SetLogicalInputs(LogicalInputs_ThrowPie, true); throw_pie_delay_ = 0; return; } } if (grow_pie_delay_ > 0) { grow_pie_delay_ -= delta_time; if (grow_pie_delay_ <= 0) { grow_pie_delay_ = 0; SetLogicalInputs(LogicalInputs_TriggerPieGrowth, true); } } }
void TouchscreenController::AdvanceFrame(WorldTime /*delta_time*/) { ClearAllLogicalInputs(); }
void GamepadController::Initialize(InputSystem* input_system, AndroidInputDeviceId controller_id) { input_system_ = input_system; controller_id_ = controller_id; ClearAllLogicalInputs(); }