summaryrefslogtreecommitdiffstats
path: root/xbmc/games/controllers/guicontrols/GUIFeatureFactory.cpp
blob: 2cce0337b21f421ded6c354c4360fb6acea43130 (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
/*
 *  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.
 */

#include "GUIFeatureFactory.h"

#include "GUICardinalFeatureButton.h"
#include "GUIScalarFeatureButton.h"
#include "GUISelectKeyButton.h"
#include "GUIThrottleButton.h"
#include "GUIWheelButton.h"

using namespace KODI;
using namespace GAME;

CGUIButtonControl* CGUIFeatureFactory::CreateButton(BUTTON_TYPE type,
                                                    const CGUIButtonControl& buttonTemplate,
                                                    IConfigurationWizard* wizard,
                                                    const CPhysicalFeature& feature,
                                                    unsigned int index)
{
  switch (type)
  {
    case BUTTON_TYPE::BUTTON:
      return new CGUIScalarFeatureButton(buttonTemplate, wizard, feature, index);

    case BUTTON_TYPE::ANALOG_STICK:
      return new CGUIAnalogStickButton(buttonTemplate, wizard, feature, index);

    case BUTTON_TYPE::WHEEL:
      return new CGUIWheelButton(buttonTemplate, wizard, feature, index);

    case BUTTON_TYPE::THROTTLE:
      return new CGUIThrottleButton(buttonTemplate, wizard, feature, index);

    case BUTTON_TYPE::SELECT_KEY:
      return new CGUISelectKeyButton(buttonTemplate, wizard, index);

    case BUTTON_TYPE::RELATIVE_POINTER:
      return new CGUIRelativePointerButton(buttonTemplate, wizard, feature, index);

    default:
      break;
  }

  return nullptr;
}