xbmc
MouseInputHandling.h
1 /*
2  * Copyright (C) 2016-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "input/mouse/MouseTypes.h"
12 #include "input/mouse/interfaces/IMouseDriverHandler.h"
13 
14 namespace KODI
15 {
16 namespace JOYSTICK
17 {
18 class IButtonMap;
19 }
20 
21 namespace MOUSE
22 {
23 class IMouseInputHandler;
24 
30 {
31 public:
33 
34  ~CMouseInputHandling(void) override = default;
35 
36  // implementation of IMouseDriverHandler
37  bool OnPosition(int x, int y) override;
38  bool OnButtonPress(BUTTON_ID button) override;
39  void OnButtonRelease(BUTTON_ID button) override;
40 
41 private:
42  // Utility functions
43  static POINTER_DIRECTION GetPointerDirection(int x, int y);
44  static POINTER_DIRECTION GetOrthogonalDirectionCCW(POINTER_DIRECTION direction);
45 
46  static void GetRotation(POINTER_DIRECTION source,
47  POINTER_DIRECTION target,
48  int (&rotation)[2][2]);
49  static void GetRotation(int deg, int (&rotation)[2][2]);
50 
51  static void GetReflectionCCW(POINTER_DIRECTION source,
52  POINTER_DIRECTION target,
53  int (&reflection)[2][2]);
54  static void GetReflection(int deg, int (&reflection)[2][2]);
55 
56  // Construction parameters
57  IMouseInputHandler* const m_handler;
58  JOYSTICK::IButtonMap* const m_buttonMap;
59 
60  // Mouse parameters
61  bool m_bHasPosition = false;
62  int m_x = 0;
63  int m_y = 0;
64 };
65 } // namespace MOUSE
66 } // namespace KODI
Button map interface to translate between the driver's raw button/hat/axis elements and physical joys...
Definition: IButtonMap.h:28
Class to translate input from driver info to higher-level features.
Definition: MouseInputHandling.h:29
Controller configuration window.
Definition: AudioDecoder.h:18
Interface for handling mouse events.
Definition: IMouseInputHandler.h:23
Interface for handling mouse driver events.
Definition: IMouseDriverHandler.h:21