VTB: release CVBuffer after it actually has been rendered
[xbmc.git] / xbmc / input / joysticks / IDriverHandler.h
blob45e05eb87a2d0aaa6db5022759a9b2a02cc93ebd
1 /*
2 * Copyright (C) 2014-2016 Team Kodi
3 * http://kodi.tv
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
20 #pragma once
22 #include "JoystickTypes.h"
24 namespace JOYSTICK
26 /*!
27 * \brief Interface defining methods to handle joystick events for raw driver
28 * elements (buttons, hats, axes)
30 class IDriverHandler
32 public:
33 virtual ~IDriverHandler(void) { }
35 /*!
36 * \brief Handle button motion
38 * \param buttonIndex The index of the button as reported by the driver
39 * \param bPressed true for press motion, false for release motion
41 * \return True if a press was handled, false otherwise
43 virtual bool OnButtonMotion(unsigned int buttonIndex, bool bPressed) = 0;
45 /*!
46 * \brief Handle hat motion
48 * \param hatIndex The index of the hat as reported by the driver
49 * \param state The direction the hat is now being pressed
51 * \return True if the new direction was handled, false otherwise
53 virtual bool OnHatMotion(unsigned int hatIndex, HAT_STATE state) = 0;
55 /*!
56 * \brief Handle axis motion
58 * If a joystick feature requires multiple axes (analog sticks, accelerometers),
59 * they can be buffered for later processing.
61 * \param axisIndex The index of the axis as reported by the driver
62 * \param position The position of the axis in the closed interval [-1.0, 1.0]
64 * \return True if the motion was handled, false otherwise
66 virtual bool OnAxisMotion(unsigned int axisIndex, float position) = 0;
68 /*!
69 * \brief Handle buffered axis positions for features that require multiple axes
71 * ProcessAxisMotions() is called at the end of the frame when all axis motions
72 * have been reported. This has several uses, including:
74 * - Combining multiple axes into a single analog stick or accelerometer event
75 * - Imitating an analog feature with a digital button so that events can be
76 * dispatched every frame.
78 virtual void ProcessAxisMotions(void) = 0;