summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/RetroPlayer/RetroPlayerInput.h
blob: eb243b5ecb951deb2ece81356b8ea349c669fb71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *  Copyright (C) 2017-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "games/GameTypes.h"
#include "games/addons/GameClientCallbacks.h"
#include "peripherals/PeripheralTypes.h"

namespace PERIPHERALS
{
class CPeripherals;
}

namespace KODI
{
namespace RETRO
{
class CRPProcessInfo;

class CRetroPlayerInput : public GAME::IGameInputCallback
{
public:
  CRetroPlayerInput(PERIPHERALS::CPeripherals& peripheralManager,
                    CRPProcessInfo& processInfo,
                    GAME::GameClientPtr gameClient);
  ~CRetroPlayerInput() override;

  // Lifecycle functions
  void StartAgentManager();
  void StopAgentManager();

  // Input functions
  void SetSpeed(double speed);
  void EnableInput(bool bEnabled);

  // implementation of IGameInputCallback
  bool AcceptsInput() const override { return m_bEnabled; }
  void PollInput() override;

private:
  // Construction parameters
  PERIPHERALS::CPeripherals& m_peripheralManager;
  CRPProcessInfo& m_processInfo;

  // Input variables
  PERIPHERALS::EventPollHandlePtr m_inputPollHandle;
  bool m_bEnabled = false;

  // Game parameters
  const GAME::GameClientPtr m_gameClient;
  bool m_bAgentManagerStarted{false};
};
} // namespace RETRO
} // namespace KODI