Files
o3de/Gems/GameStateSamples/Code/Include/GameStateSamples/GameStatePrimaryControllerDisconnected.h
T
2021-03-08 14:30:57 -08:00

82 lines
4.0 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <GameState/GameState.h>
#include <AzFramework/Input/Events/InputChannelEventListener.h>
#include <AzFramework/Input/Buses/Notifications/InputDeviceNotificationBus.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace GameStateSamples
{
////////////////////////////////////////////////////////////////////////////////////////////////
//! Game state that is active while the primary user's controller is disconnected.
class GameStatePrimaryControllerDisconnected : public GameState::IGameState
, public AzFramework::InputChannelEventListener
, public AzFramework::InputDeviceNotificationBus::Handler
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
// Allocator
AZ_CLASS_ALLOCATOR(GameStatePrimaryControllerDisconnected, AZ::SystemAllocator, 0);
////////////////////////////////////////////////////////////////////////////////////////////
// Type Info
AZ_RTTI(GameStatePrimaryControllerDisconnected, "{47FCBC7A-49CB-4FEB-842A-C730CCB19940}", IGameState);
////////////////////////////////////////////////////////////////////////////////////////////
//! Default constructor
GameStatePrimaryControllerDisconnected() = default;
////////////////////////////////////////////////////////////////////////////////////////////
//! Default destructor
~GameStatePrimaryControllerDisconnected() override = default;
protected:
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnEnter
void OnEnter() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref GameState::GameState::OnExit
void OnExit() override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputChannelEventListener::GetPriority
AZ::s32 GetPriority() const override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputChannelEventListener::OnInputChannelEventFiltered
bool OnInputChannelEventFiltered(const AzFramework::InputChannel & inputChannel) override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceNotifications::OnInputDeviceConnectedEvent
void OnInputDeviceConnectedEvent(const AzFramework::InputDevice& inputDevice) override;
////////////////////////////////////////////////////////////////////////////////////////////
//! Convenience functions to show/hide the primary controller disconnected popup.
///@{
virtual void ShowPrimaryControllerDisconnectedPopup();
virtual void HidePrimaryControllerDisconnectedPopup();
///@}
private:
////////////////////////////////////////////////////////////////////////////////////////////
// Variables
AZ::u32 m_primaryControllerDisconnectedPopupId = 0; //!< Id of the popup being displayed
};
} // namespace GameStateSamples
// Include the implementation inline so the class can be instantiated outside of the gem.
#include <GameStateSamples/GameStatePrimaryControllerDisconnected.inl>