.. index:: pair: class; EE::Window::Joystick .. _doxid-class_e_e_1_1_window_1_1_joystick: class EE::Window::Joystick ========================== .. toctree:: :hidden: Overview ~~~~~~~~ Represents a physical :ref:`Joystick `, and contains all its states. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Joystick { public: // construction :target:`Joystick`(const :ref:`Uint32`& index); virtual :target:`~Joystick`(); // methods virtual void :ref:`close`(); virtual void :ref:`open`(); virtual void :ref:`update`() = 0; virtual :ref:`Uint8` :ref:`getHat`(const :ref:`Int32`& index = 0) = 0; virtual :ref:`Float` :ref:`getAxis`(const :ref:`Int32`& axis) = 0; virtual :ref:`Vector2i` :ref:`getBallMotion`(const :ref:`Int32`& ball) = 0; virtual bool :ref:`isPlugged`() const = 0; virtual void :ref:`reOpen`(); const :ref:`Int32`& :ref:`getNumHats`() const; const :ref:`Int32`& :ref:`getNumButtons`() const; const :ref:`Int32`& :ref:`getNumAxes`() const; const :ref:`Int32`& :ref:`getNumBalls`() const; const :ref:`Uint32`& :ref:`getButtonTrigger`() const; const :ref:`Uint32`& :ref:`getButtonUpTrigger`() const; bool :ref:`isButtonDown`(const :ref:`Int32`& index); bool :ref:`isButtonUp`(const :ref:`Int32`& index); }; .. _details-class_e_e_1_1_window_1_1_joystick: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Represents a physical :ref:`Joystick `, and contains all its states. Methods ------- .. index:: pair: function; close .. _doxid-class_e_e_1_1_window_1_1_joystick_1a481db8cca547f4f669c5df55d50c0495: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void close() Close the joystick .. index:: pair: function; open .. _doxid-class_e_e_1_1_window_1_1_joystick_1a34ab5e67f9f9208c171179ae3db8c700: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void open() Open the joystick .. index:: pair: function; update .. _doxid-class_e_e_1_1_window_1_1_joystick_1afaaffeced7f80b5533ba17d93e524210: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void update() = 0 Update the current joystick states ( users don't need to call this manually ) .. index:: pair: function; getHat .. _doxid-class_e_e_1_1_window_1_1_joystick_1a872cef1b6de30b0a940407e6ca226179: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Uint8` getHat(const :ref:`Int32`& index = 0) = 0 .. rubric:: Returns: The hat index state .. rubric:: See also: EE_HAT_POS to get info about the possible states You just need to compare the state against what position you need, example if ( myJoy->GetHat() == :ref:`HAT_LEFT `) { ... do whatever you need to do } .. index:: pair: function; getAxis .. _doxid-class_e_e_1_1_window_1_1_joystick_1ac6a7b4b5182d0d96976a4ee378917829: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Float` getAxis(const :ref:`Int32`& axis) = 0 .. rubric:: Returns: the axis state .. rubric:: See also: EE_JOYAXIS to know the possible axis ( usually you will use :ref:`AXIS_X ` and :ref:`AXIS_Y ` Axis values goes from :ref:`AXIS_MIN ` to :ref:`AXIS_MAX ` .. index:: pair: function; getBallMotion .. _doxid-class_e_e_1_1_window_1_1_joystick_1a23bd8bf39008356ae9d65bc829a31a2f: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Vector2i` getBallMotion(const :ref:`Int32`& ball) = 0 .. rubric:: Returns: The ball motion position .. index:: pair: function; isPlugged .. _doxid-class_e_e_1_1_window_1_1_joystick_1ae007d6463a6f77294a75a9c07ee31cc0: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool isPlugged() const = 0 .. rubric:: Returns: True if the joystick is plugged in .. index:: pair: function; reOpen .. _doxid-class_e_e_1_1_window_1_1_joystick_1a4b1243b7c7468259eecb4a24bc069495: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void reOpen() ReOpen the joysick ( this is the same of doing Close and the Open ) .. index:: pair: function; getNumHats .. _doxid-class_e_e_1_1_window_1_1_joystick_1a669203965305f8252e6b96ecb6bb4ed0: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getNumHats() const .. rubric:: Returns: The number of hats .. index:: pair: function; getNumButtons .. _doxid-class_e_e_1_1_window_1_1_joystick_1ad3c109b1832fe7cef186ddac684e93a3: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getNumButtons() const .. rubric:: Returns: The number of buttons .. index:: pair: function; getNumAxes .. _doxid-class_e_e_1_1_window_1_1_joystick_1a75b0fd353074cc115cf0b274ed7e4b1e: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getNumAxes() const .. rubric:: Returns: The number of axes .. index:: pair: function; getNumBalls .. _doxid-class_e_e_1_1_window_1_1_joystick_1a99bf5ff8f2b2159318b8e1de842f23cc: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getNumBalls() const .. rubric:: Returns: The number of balls .. index:: pair: function; getButtonTrigger .. _doxid-class_e_e_1_1_window_1_1_joystick_1a200f8aff78275a94ad6f9f1e280ecff7: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getButtonTrigger() const .. rubric:: Returns: The buttons states flags .. index:: pair: function; getButtonUpTrigger .. _doxid-class_e_e_1_1_window_1_1_joystick_1aead79ca3c7ebb04f21113e25f2de4b14: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getButtonUpTrigger() const .. rubric:: Returns: The buttons released states flags .. index:: pair: function; isButtonDown .. _doxid-class_e_e_1_1_window_1_1_joystick_1aec1e214d67ffcc7bcfb71509bce6c82a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isButtonDown(const :ref:`Int32`& index) .. rubric:: Returns: If the button index is down ( pressed ) .. index:: pair: function; isButtonUp .. _doxid-class_e_e_1_1_window_1_1_joystick_1aae6596b1e54f74f792271e20ab5f7ae8: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isButtonUp(const :ref:`Int32`& index) .. rubric:: Returns: If the button index is up ( released )