neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neogfx::game_controller Class Referenceabstract

#include <game_controller.hpp>

Inheritance diagram for neogfx::game_controller:
neogfx::hid_device< i_game_controller > neolib::reference_counted< Base, DeallocateOnRelease >

Classes

struct  button_not_found
 

Public Types

typedef boost::bimap< game_controller_button_ordinal, game_controller_buttonbutton_map_type
 
- Public Types inherited from neogfx::hid_device< i_game_controller >
typedef i_game_controller abstract_type
 

Public Member Functions

 define_declared_event (ButtonPressed, button_pressed, game_controller_button, key_modifiers_e) define_declared_event(ButtonReleased
 
key_modifiers_e define_declared_event (ButtonRepeat, button_repeat, game_controller_button, key_modifiers_e) define_declared_event(LeftTriggerMoved
 
key_modifiers_e key_modifiers_e define_declared_event (RightTriggerMoved, right_trigger_moved, double, key_modifiers_e) define_declared_event(LeftThumbMoved
 
key_modifiers_e key_modifiers_e const vec2 key_modifiers_e define_declared_event (RightThumbMoved, right_thumb_moved, const vec2 &, key_modifiers_e) define_declared_event(StickMoved
 
key_modifiers_e key_modifiers_e const vec2 key_modifiers_e const vec3 key_modifiers_e define_declared_event (StickRotated, stick_rotated, const vec3 &, key_modifiers_e) define_declared_event(SliderMoved
 
 game_controller (hid_device_subclass aSubclass, const hid_device_uuid &aProductId, const hid_device_uuid &aInstanceId, const button_map_type &aButtonMap={})
 
bool player_assigned () const override
 
game_player player () const override
 
void assign_player (game_player aPlayer) override
 
void unassign_player () override
 
bool have_port () const override
 
game_controller_port port () const override
 
void set_port (game_controller_port aPort) override
 
void clear_port () override
 
bool needs_calibrating () const override
 
bool is_button_pressed (game_controller_button_ordinal aButtonOrdinal) const override
 
bool is_button_pressed (game_controller_button aButton) const override
 
double left_trigger_position () const override
 
double right_trigger_position () const override
 
const vec2left_thumb_position () const override
 
const vec2right_thumb_position () const override
 
const vec3stick_position () const override
 
const vec3stick_rotation () const override
 
const vec2slider_position () const override
 
uint32_t button_count () const override
 
bool button_mapped (game_controller_button aButton) const override
 
game_controller_button_ordinal button_to_button_ordinal (game_controller_button aButton) const override
 
game_controller_button button_ordinal_to_button (game_controller_button_ordinal aButtonOrdinal) const override
 
- Public Member Functions inherited from neogfx::hid_device< i_game_controller >
 define_declared_event (Enabled, enabled) define_declared_event(Disabled
 
 hid_device (hid_device_type aType, hid_device_class aClass, hid_device_subclass aSubclass, const hid_device_uuid &aProductId={}, const hid_device_uuid &aInstanceId={})
 
hid_device_type device_type () const override
 
hid_device_class device_class () const override
 
hid_device_subclass device_subclass () const override
 
hid_device_uuid product_id () const override
 
hid_device_uuid instance_id () const override
 
bool is_enabled () const override
 
void enable () override
 
void disable () override
 
const i_stringproduct_name () const override
 
- Public Member Functions inherited from neolib::reference_counted< Base, DeallocateOnRelease >
 reference_counted () noexcept
 
 reference_counted (const reference_counted &aOther) noexcept
 
 ~reference_counted ()
 
reference_countedoperator= (const reference_counted &)
 
void add_ref () const noexcept override
 
void release () const override
 
int32_t use_count () const noexcept override
 
const base_type * release_and_take_ownership () const override
 
base_type * release_and_take_ownership () override
 
void pin () const noexcept override
 
void unpin () const override
 
i_ref_control_blockcontrol_block () override
 

Public Attributes

 button_released
 
 game_controller_button
 
key_modifiers_e left_trigger_moved
 
key_modifiers_e double
 
key_modifiers_e key_modifiers_e left_thumb_moved
 
key_modifiers_e key_modifiers_e const vec2 key_modifiers_e stick_moved
 
key_modifiers_e key_modifiers_e const vec2 key_modifiers_e const vec3 key_modifiers_e slider_moved
 

Static Public Attributes

static constexpr game_controller_button_ordinal MAX_BUTTONS = 64u
 

Protected Member Functions

virtual void update_state ()=0
 
button_map_typebutton_map ()
 
void set_button_state (game_controller_button_ordinal aButtonOrdinal, bool aIsPressed)
 
void set_button_state (game_controller_button aButton, bool aIsPressed)
 
void set_left_trigger_position (double aPosition)
 
void set_right_trigger_position (double aPosition)
 
void set_left_thumb_position (const vec2 &aPosition)
 
void set_right_thumb_position (const vec2 &aPosition)
 
void set_stick_position (const vec3 &aPosition)
 
void set_stick_rotation (const vec3 &aRotation)
 
void set_slider_position (const vec2 &aPosition)
 

Detailed Description

Definition at line 30 of file game_controller.hpp.

Member Typedef Documentation

◆ button_map_type

Constructor & Destructor Documentation

◆ game_controller()

neogfx::game_controller::game_controller ( hid_device_subclass  aSubclass,
const hid_device_uuid aProductId,
const hid_device_uuid aInstanceId,
const button_map_type aButtonMap = {} 
)

Member Function Documentation

◆ assign_player()

void neogfx::game_controller::assign_player ( game_player  aPlayer)
override

◆ button_count()

uint32_t neogfx::game_controller::button_count ( ) const
override

◆ button_map()

button_map_type & neogfx::game_controller::button_map ( )
protected

◆ button_mapped()

bool neogfx::game_controller::button_mapped ( game_controller_button  aButton) const
override

◆ button_ordinal_to_button()

game_controller_button neogfx::game_controller::button_ordinal_to_button ( game_controller_button_ordinal  aButtonOrdinal) const
override

◆ button_to_button_ordinal()

game_controller_button_ordinal neogfx::game_controller::button_to_button_ordinal ( game_controller_button  aButton) const
override

◆ clear_port()

void neogfx::game_controller::clear_port ( )
override

◆ define_declared_event() [1/5]

neogfx::game_controller::define_declared_event ( ButtonPressed  ,
button_pressed  ,
game_controller_button  ,
key_modifiers_e   
)

◆ define_declared_event() [2/5]

key_modifiers_e neogfx::game_controller::define_declared_event ( ButtonRepeat  ,
button_repeat  ,
game_controller_button  ,
key_modifiers_e   
)

◆ define_declared_event() [3/5]

key_modifiers_e key_modifiers_e const vec2 key_modifiers_e neogfx::game_controller::define_declared_event ( RightThumbMoved  ,
right_thumb_moved  ,
const vec2 ,
key_modifiers_e   
)

◆ define_declared_event() [4/5]

key_modifiers_e key_modifiers_e neogfx::game_controller::define_declared_event ( RightTriggerMoved  ,
right_trigger_moved  ,
double  ,
key_modifiers_e   
)

◆ define_declared_event() [5/5]

key_modifiers_e key_modifiers_e const vec2 key_modifiers_e const vec3 key_modifiers_e neogfx::game_controller::define_declared_event ( StickRotated  ,
stick_rotated  ,
const vec3 ,
key_modifiers_e   
)

◆ have_port()

bool neogfx::game_controller::have_port ( ) const
override

◆ is_button_pressed() [1/2]

bool neogfx::game_controller::is_button_pressed ( game_controller_button  aButton) const
override

◆ is_button_pressed() [2/2]

bool neogfx::game_controller::is_button_pressed ( game_controller_button_ordinal  aButtonOrdinal) const
override

◆ left_thumb_position()

const vec2 & neogfx::game_controller::left_thumb_position ( ) const
override

◆ left_trigger_position()

double neogfx::game_controller::left_trigger_position ( ) const
override

◆ needs_calibrating()

bool neogfx::game_controller::needs_calibrating ( ) const
override

◆ player()

game_player neogfx::game_controller::player ( ) const
override

◆ player_assigned()

bool neogfx::game_controller::player_assigned ( ) const
override

◆ port()

game_controller_port neogfx::game_controller::port ( ) const
override

◆ right_thumb_position()

const vec2 & neogfx::game_controller::right_thumb_position ( ) const
override

◆ right_trigger_position()

double neogfx::game_controller::right_trigger_position ( ) const
override

◆ set_button_state() [1/2]

void neogfx::game_controller::set_button_state ( game_controller_button  aButton,
bool  aIsPressed 
)
protected

◆ set_button_state() [2/2]

void neogfx::game_controller::set_button_state ( game_controller_button_ordinal  aButtonOrdinal,
bool  aIsPressed 
)
protected

◆ set_left_thumb_position()

void neogfx::game_controller::set_left_thumb_position ( const vec2 aPosition)
protected

◆ set_left_trigger_position()

void neogfx::game_controller::set_left_trigger_position ( double  aPosition)
protected

◆ set_port()

void neogfx::game_controller::set_port ( game_controller_port  aPort)
override

◆ set_right_thumb_position()

void neogfx::game_controller::set_right_thumb_position ( const vec2 aPosition)
protected

◆ set_right_trigger_position()

void neogfx::game_controller::set_right_trigger_position ( double  aPosition)
protected

◆ set_slider_position()

void neogfx::game_controller::set_slider_position ( const vec2 aPosition)
protected

◆ set_stick_position()

void neogfx::game_controller::set_stick_position ( const vec3 aPosition)
protected

◆ set_stick_rotation()

void neogfx::game_controller::set_stick_rotation ( const vec3 aRotation)
protected

◆ slider_position()

const vec2 & neogfx::game_controller::slider_position ( ) const
override

◆ stick_position()

const vec3 & neogfx::game_controller::stick_position ( ) const
override

◆ stick_rotation()

const vec3 & neogfx::game_controller::stick_rotation ( ) const
override

◆ unassign_player()

void neogfx::game_controller::unassign_player ( )
override

◆ update_state()

virtual void neogfx::game_controller::update_state ( )
protectedpure virtual

Member Data Documentation

◆ button_released

neogfx::game_controller::button_released

Definition at line 34 of file game_controller.hpp.

◆ double

key_modifiers_e neogfx::game_controller::double

Definition at line 36 of file game_controller.hpp.

◆ game_controller_button

neogfx::game_controller::game_controller_button

Definition at line 34 of file game_controller.hpp.

◆ left_thumb_moved

key_modifiers_e key_modifiers_e neogfx::game_controller::left_thumb_moved

Definition at line 38 of file game_controller.hpp.

◆ left_trigger_moved

key_modifiers_e neogfx::game_controller::left_trigger_moved

Definition at line 36 of file game_controller.hpp.

◆ MAX_BUTTONS

constexpr game_controller_button_ordinal neogfx::game_controller::MAX_BUTTONS = 64u
staticconstexpr

Definition at line 46 of file game_controller.hpp.

◆ slider_moved

key_modifiers_e key_modifiers_e const vec2 key_modifiers_e const vec3 key_modifiers_e neogfx::game_controller::slider_moved

Definition at line 42 of file game_controller.hpp.

◆ stick_moved

key_modifiers_e key_modifiers_e const vec2 key_modifiers_e neogfx::game_controller::stick_moved

Definition at line 40 of file game_controller.hpp.


The documentation for this class was generated from the following file: