Ignore:
Timestamp:
Jul 23, 2013, 9:39:21 PM (8 years ago)
Author:
lolbot
Message:

fixed 10 files out of 2754:

  • removed 386 CR characters
  • removed 4 trailing whitespaces
  • replaced 189 tabs with spaces
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/input/controller.h

    r2810 r2812  
    2222{
    2323public:
    24         KeyBinding() : m_current(false), m_previous(false), m_device(nullptr) {}
     24    KeyBinding() : m_current(false), m_previous(false), m_device(nullptr) {}
    2525
    26         bool IsDown() const { return m_current; }
    27         bool IsUp() const { return !m_current; }
    28         bool IsPressed() const { return m_current && !m_previous; }
    29         bool IsReleased() const { return !m_current && m_previous; }
     26    bool IsDown() const { return m_current; }
     27    bool IsUp() const { return !m_current; }
     28    bool IsPressed() const { return m_current && !m_previous; }
     29    bool IsReleased() const { return !m_current && m_previous; }
    3030
    31         void Bind(const char* device_name, const char* key_name);
     31    void Bind(const char* device_name, const char* key_name);
    3232
    3333protected:
    34         void Update() { m_previous = m_current; m_current = m_device ? m_device->GetKey(m_keyindex) : false; }
     34    void Update() { m_previous = m_current; m_current = m_device ? m_device->GetKey(m_keyindex) : false; }
    3535
    36         const InputDevice* m_device;
    37         int m_keyindex;
    38         bool m_current;
    39         bool m_previous;
     36    const InputDevice* m_device;
     37    int m_keyindex;
     38    bool m_current;
     39    bool m_previous;
    4040
    41         friend class Controller;
     41    friend class Controller;
    4242};
    4343
     
    4545{
    4646public:
    47         AxisBinding() : m_current(0.0f), m_previous(0.0f), m_device(nullptr) {}
     47    AxisBinding() : m_current(0.0f), m_previous(0.0f), m_device(nullptr) {}
    4848
    49         float GetValue() const { return m_current; }
    50         float GetDelta() const { return m_current - m_previous; }
     49    float GetValue() const { return m_current; }
     50    float GetDelta() const { return m_current - m_previous; }
    5151
    52         void Bind(const char* device_name, const char* axis_name);
     52    void Bind(const char* device_name, const char* axis_name);
    5353
    5454protected:
    55         void Update() { m_previous = m_current; m_current = m_device ? m_device->GetAxis(m_axisindex) : 0.0f; }
     55    void Update() { m_previous = m_current; m_current = m_device ? m_device->GetAxis(m_axisindex) : 0.0f; }
    5656
    57         const InputDevice* m_device;
    58         int m_axisindex;
    59         float m_current;
    60         float m_previous;
     57    const InputDevice* m_device;
     58    int m_axisindex;
     59    float m_current;
     60    float m_previous;
    6161
    62         friend class Controller;
     62    friend class Controller;
    6363};
    6464
     
    6767{
    6868public:
    69         Controller(int nb_keys, int nb_axis);
    70         ~Controller();
     69    Controller(int nb_keys, int nb_axis);
     70    ~Controller();
    7171
    72         virtual void TickGame(float seconds);
     72    virtual void TickGame(float seconds);
    7373
    74         /** Activate the controller on next frame */
    75         void Activate();
    76         /** Deactivate the controller on next frame */
    77         void Deactivate();
    78         /** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */
    79         static Array<Controller*> DeactivateAll();
     74    /** Activate the controller on next frame */
     75    void Activate();
     76    /** Deactivate the controller on next frame */
     77    void Deactivate();
     78    /** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */
     79    static Array<Controller*> DeactivateAll();
    8080
    81         KeyBinding& GetKey(int index) { ASSERT(index >= 0 && index < m_nb_keys); return m_keys[index]; }
    82         AxisBinding& GetAxis(int index) { ASSERT(index >= 0 && index < m_nb_axis); return m_axis[index]; }
    83  
     81    KeyBinding& GetKey(int index) { ASSERT(index >= 0 && index < m_nb_keys); return m_keys[index]; }
     82    AxisBinding& GetAxis(int index) { ASSERT(index >= 0 && index < m_nb_axis); return m_axis[index]; }
     83
    8484protected:
    85         KeyBinding* m_keys;
    86         AxisBinding* m_axis;
    87         int m_nb_keys;
    88         int m_nb_axis;
    89        
     85    KeyBinding* m_keys;
     86    AxisBinding* m_axis;
     87    int m_nb_keys;
     88    int m_nb_axis;
     89
    9090private:
    91         static Array<Controller*> controllers;
    92         bool m_activate_nextframe;
    93         bool m_deactivate_nextframe;
    94         bool m_active;
     91    static Array<Controller*> controllers;
     92    bool m_activate_nextframe;
     93    bool m_deactivate_nextframe;
     94    bool m_active;
    9595};
    9696
Note: See TracChangeset for help on using the changeset viewer.