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.cpp

    r2810 r2812  
    2525void KeyBinding::Bind(const char* device_name, const char* key_name)
    2626{
    27         m_device = InputDevice::Get(device_name);
    28         if (!m_device)
    29         {
    30                 Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name);
    31                 return;
    32         }
     27    m_device = InputDevice::Get(device_name);
     28    if (!m_device)
     29    {
     30        Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name);
     31        return;
     32    }
    3333
    34         m_keyindex = m_device->GetKeyIndex(key_name);
     34    m_keyindex = m_device->GetKeyIndex(key_name);
    3535
    36         if (m_keyindex < 0)
    37         {
    38                 Log::Warn("Trying to bind controller to key %s.%s which doesn't exist", device_name, key_name);
    39         }
     36    if (m_keyindex < 0)
     37    {
     38        Log::Warn("Trying to bind controller to key %s.%s which doesn't exist", device_name, key_name);
     39    }
    4040}
    4141
     
    4545void AxisBinding::Bind(const char* device_name, const char* axis_name)
    4646{
    47         m_device = InputDevice::Get(device_name);
    48         if (!m_device)
    49         {
    50                 Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name);
    51                 return;
    52         }
     47    m_device = InputDevice::Get(device_name);
     48    if (!m_device)
     49    {
     50        Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name);
     51        return;
     52    }
    5353
    54         m_axisindex = m_device->GetAxisIndex(axis_name);
     54    m_axisindex = m_device->GetAxisIndex(axis_name);
    5555
    56         if (m_axisindex < 0)
    57         {
    58                 Log::Warn("Trying to bind controller to axis %s.%s which doesn't exist", device_name, axis_name);
    59         }
     56    if (m_axisindex < 0)
     57    {
     58        Log::Warn("Trying to bind controller to axis %s.%s which doesn't exist", device_name, axis_name);
     59    }
    6060}
    6161
     
    6868Controller::Controller(int nb_keys, int nb_axis)
    6969{
    70         m_gamegroup = GAMEGROUP_BEFORE;
    71         m_nb_keys = nb_keys;
    72         m_nb_axis = nb_axis;
    73         m_keys = new KeyBinding[m_nb_keys];
    74         m_axis = new AxisBinding[m_nb_axis];
    75         m_activate_nextframe = false;
    76         m_deactivate_nextframe = false;
    77         m_active = false;
    78         controllers.Push(this);
     70    m_gamegroup = GAMEGROUP_BEFORE;
     71    m_nb_keys = nb_keys;
     72    m_nb_axis = nb_axis;
     73    m_keys = new KeyBinding[m_nb_keys];
     74    m_axis = new AxisBinding[m_nb_axis];
     75    m_activate_nextframe = false;
     76    m_deactivate_nextframe = false;
     77    m_active = false;
     78    controllers.Push(this);
    7979}
    8080
    8181Controller::~Controller()
    8282{
    83         for (int i = 0; i < controllers.Count(); ++i)
    84         {
    85                 if (controllers[i] == this)
    86                 {
    87                         controllers.Remove(i);
    88                         break;
    89                 }
    90         }
     83    for (int i = 0; i < controllers.Count(); ++i)
     84    {
     85        if (controllers[i] == this)
     86        {
     87            controllers.Remove(i);
     88            break;
     89        }
     90    }
    9191}
    9292
    9393void Controller::TickGame(float seconds)
    9494{
    95         Entity::TickGame(seconds);
     95    Entity::TickGame(seconds);
    9696
    97         for (int i = 0; i < m_nb_keys; ++i)
    98         {
    99                 m_keys[i].Update();
    100         }
     97    for (int i = 0; i < m_nb_keys; ++i)
     98    {
     99        m_keys[i].Update();
     100    }
    101101
    102         for (int i = 0; i < m_nb_axis; ++i)
    103         {
    104                 m_axis[i].Update();
    105         }
     102    for (int i = 0; i < m_nb_axis; ++i)
     103    {
     104        m_axis[i].Update();
     105    }
    106106
    107         if (m_activate_nextframe)
    108                 m_active = true;
     107    if (m_activate_nextframe)
     108        m_active = true;
    109109
    110         if (m_deactivate_nextframe)
    111                 m_active = false;
     110    if (m_deactivate_nextframe)
     111        m_active = false;
    112112
    113         m_activate_nextframe = false;
    114         m_deactivate_nextframe = false;
     113    m_activate_nextframe = false;
     114    m_deactivate_nextframe = false;
    115115}
    116116
    117117void Controller::Activate()
    118118{
    119         m_activate_nextframe = true;
    120         m_deactivate_nextframe = false;
     119    m_activate_nextframe = true;
     120    m_deactivate_nextframe = false;
    121121}
    122122
    123123void Controller::Deactivate()
    124124{
    125         m_deactivate_nextframe = true;
    126         m_activate_nextframe = false;
     125    m_deactivate_nextframe = true;
     126    m_activate_nextframe = false;
    127127}
    128128
    129129Array<Controller*> Controller::DeactivateAll()
    130130{
    131         Array<Controller*> result;
     131    Array<Controller*> result;
    132132
    133         for (int i = 0; i < controllers.Count(); ++i)
    134         {
    135                 if (controllers[i]->m_active || controllers[i]->m_activate_nextframe)
    136                 {
    137                         result.Push(controllers[i]);
    138                         controllers[i]->Deactivate();
    139                 }
    140         }
     133    for (int i = 0; i < controllers.Count(); ++i)
     134    {
     135        if (controllers[i]->m_active || controllers[i]->m_activate_nextframe)
     136        {
     137            result.Push(controllers[i]);
     138            controllers[i]->Deactivate();
     139        }
     140    }
    141141
    142         return result;
     142    return result;
    143143}
    144144
Note: See TracChangeset for help on using the changeset viewer.