neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
game_controllers.hpp
Go to the documentation of this file.
1// game_controllers.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
24#include <neolib/core/map.hpp>
26
27namespace neogfx
28{
29 uint32_t constexpr HARDWARE_BUS_USB = 0x03;
30 uint32_t constexpr HARDWARE_BUS_BLUETOOTH = 0x05;
31
33 {
34 public:
35 define_declared_event(ControllerConnected, controller_connected, i_game_controller&)
37 define_declared_event(ControllerCalibrationRequired, controller_calibration_required, i_game_controller&)
38 public:
41 public:
43 public:
44 const controller_list& controllers() const override;
45 bool have_controller_for(game_player aPlayer) const override;
47 public:
48 const button_map_type& button_map(const hid_device_uuid& aProductId) const override;
49 public:
50 abstract_t<neolib::vector<ref_ptr<i_game_controller>>>::iterator add_device(i_game_controller& aController) override;
51 abstract_t<neolib::vector<ref_ptr<i_game_controller>>>::iterator remove_device(i_game_controller& aController) override;
52 private:
53 controller_list iControllers;
54 mutable std::map<hid_device_uuid, button_map_type> iButtonMaps;
55 };
56}
define_declared_event(ControllerConnected, controller_connected, i_game_controller &) define_declared_event(ControllerDisconnected
abstract_t< neolib::vector< ref_ptr< i_game_controller > > >::iterator add_device(i_game_controller &aController) override
bool have_controller_for(game_player aPlayer) const override
const controller_list & controllers() const override
i_game_controller & controller_for(game_player aPlayer) const override
const button_map_type & button_map(const hid_device_uuid &aProductId) const override
abstract_t< neolib::vector< ref_ptr< i_game_controller > > >::iterator remove_device(i_game_controller &aController) override
uint32_t game_controller_button_ordinal
uint32_t constexpr HARDWARE_BUS_BLUETOOTH
uint32_t constexpr HARDWARE_BUS_USB
Definition plf_hive.h:79
#define define_declared_event(name, declName,...)
Definition event.hpp:195