pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/input/axes Makefile.am,NONE,1.1 axis.


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input/axes Makefile.am,NONE,1.1 axis.hxx,NONE,1.1 button_axis.cxx,NONE,1.1 button_axis.hxx,NONE,1.1 dummy_axis.hxx,NONE,1.1 inverted_axis.cxx,NONE,1.1 inverted_axis.hxx,NONE,1.1 joystick_axis.cxx,NONE,1.1 joystick_axis.hxx,NONE,1.1 mouse_axis.cxx,NONE,1.1 mouse_axis.hxx,NONE,1.1 multiple_axis.cxx,NONE,1.1 multiple_axis.hxx,NONE,1.1
Date: 24 Aug 2002 11:37:33 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/input/axes
In directory dark:/tmp/cvs-serv15327/src/input/axes

Added Files:
        Makefile.am axis.hxx button_axis.cxx button_axis.hxx 
        dummy_axis.hxx inverted_axis.cxx inverted_axis.hxx 
        joystick_axis.cxx joystick_axis.hxx mouse_axis.cxx 
        mouse_axis.hxx multiple_axis.cxx multiple_axis.hxx 
Log Message:
moved input devices in own subdirs / namespaces


--- NEW FILE: Makefile.am ---
# Pingus - A free Lemmings clone
# Copyright (C) 1999 Ingo Ruhnke <address@hidden>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

noinst_LIBRARIES = libpingus_input_axes.a

libpingus_input_axes_a_SOURCES =       \
        axis.hxx \
        button_axis.hxx button_axis.cxx \
        dummy_axis.hxx \
        inverted_axis.hxx inverted_axis.cxx \
        joystick_axis.hxx joystick_axis.cxx \
        mouse_axis.hxx mouse_axis.cxx \
        multiple_axis.hxx multiple_axis.cxx

# EOF #

--- NEW FILE: axis.hxx ---
//  $Id: axis.hxx,v 1.1 2002/08/24 11:37:30 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_AXIS_HXX
#define HEADER_PINGUS_INPUT_AXIS_HXX

#include "../../pingus.hxx"

namespace Input {

  namespace Axes {

    /// abstract base class which defines the axis interface
    class Axis {
  
      public:
        Axis () { }
        virtual ~Axis () { }
    
        /// yields the position of the axis in [-1;1]
        virtual const float& get_pos () const =0;
      
        /// yields the angle of axis in [0;360[ degree
        virtual const float& get_angle () const =0;
      
        virtual void  update(float) =0;
      
      private:
        Axis (const Axis&);
        Axis operator= (const Axis&);
    };
    
  }
}

#endif

/* EOF */

--- NEW FILE: button_axis.cxx ---
//  $Id: button_axis.cxx,v 1.1 2002/08/24 11:37:30 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "button_axis.hxx"
#include "../buttons/button.hxx"

namespace Input {

  using Buttons::Button;

  namespace Axes {

    ButtonAxis::ButtonAxis (float angle_, Button* button1_, Button* button2_) : 
                            pos(0), angle(angle_), button1(button1_), 
button2(button2_) 
    {
      if (angle < 0)
        angle = (static_cast<int>(angle) % 360) + 360;
      else if (angle > 360)
        angle = static_cast<int>(angle) % 360;
    }

    ButtonAxis::~ButtonAxis ()
    {
      delete button1;
      delete button2;
    }

    const float&
    ButtonAxis::get_pos () const
    {
      return pos;
    }

    const float&
    ButtonAxis::get_angle () const
    {
      return angle;
    }

    void
    ButtonAxis::update (float delta)
    {
      button1->update(delta);
      button2->update(delta);

      if (button1->is_pressed() == button2->is_pressed())
        {
          pos = 0;
          return;
        }
    
      if (button1->is_pressed())
        pos = -1.0f;
      else
        pos = 1.0f;
 
    }

  }
}

/* EOF */

--- NEW FILE: button_axis.hxx ---
//  $Id: button_axis.hxx,v 1.1 2002/08/24 11:37:30 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_BUTTON_AXIS_HXX
#define HEADER_PINGUS_INPUT_BUTTON_AXIS_HXX

#include "axis.hxx"

namespace Input {

  namespace Buttons {
    class Button;
  }

  namespace Axes {
  
    /**
      @brief maps two buttons into an axis
    
      XML definition: <button-axis angle=?> <some button 1><some button 2> 
</button-axis>
    */
    class ButtonAxis : public Axis {

    private:
      float   pos;
      float   angle;
    
      Buttons::Button* const button1;
      Buttons::Button* const button2;
    
    public:
  
      ButtonAxis (float angle_, Buttons::Button* button1_, Buttons::Button* 
button2_);
     ~ButtonAxis ();
  
      virtual const float& get_pos () const;
      virtual const float& get_angle () const;
    
      virtual void  update (float delta);
    
    private:
      ButtonAxis (const ButtonAxis&);
      ButtonAxis operator= (const ButtonAxis&);
    };

  }
}

#endif

/* EOF */

--- NEW FILE: dummy_axis.hxx ---
//  $Id: dummy_axis.hxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_DUMMY_AXIS_HXX
#define HEADER_PINGUS_INPUT_DUMMY_AXIS_HXX

#include "axis.hxx"

namespace Input {

  namespace Axes {

    /** 
      @brief Dummy Axis to be used if an axis is required but none defined
    
      XML definition: none
     */
    class DummyAxis : public Axis {
  
      private:
        float pos;
        float angle;

      public:
  
        DummyAxis () : pos(0.0f), angle(0.0f) { }
  
        virtual const float& get_pos ()   const { return pos; }
        virtual const float& get_angle () const { return angle; }
      
        virtual void  update(float) { }
      
      private:
        DummyAxis (const DummyAxis&);
        DummyAxis operator= (const DummyAxis&);
    };

  }
}

#endif

/* EOF */

--- NEW FILE: inverted_axis.cxx ---
//  $Id: inverted_axis.cxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "inverted_axis.hxx"

namespace Input {

  namespace Axes {

    InvertedAxis::InvertedAxis (Axis* axis_) : axis(axis_)
    {
      angle = (static_cast<int>(axis->get_angle()) + 180) % 360;
    }

    InvertedAxis::~InvertedAxis ()
    {
      delete axis;
    }

    const float&
    InvertedAxis::get_pos () const
    {
      return axis->get_pos();
    }

    const float&
    InvertedAxis::get_angle () const
    {
      return angle;
    }
  
    void
    InvertedAxis::update (float delta)
    {
      axis->update(delta);
    }
    
  }
}

/* EOF */

--- NEW FILE: inverted_axis.hxx ---
//  $Id: inverted_axis.hxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_INVERTED_AXIS_HXX
#define HEADER_PINGUS_INPUT_INVERTED_AXIS_HXX

#include "axis.hxx"

namespace Input {

  namespace Axes {

    /**
      @brief decorator class inverting the angle of an axis
  
      XML definition: <inverted-axis> <axis> </inverted-axis>
      */
    class InvertedAxis : public Axis {

    private:
      Axis* const axis;
      float       angle;
  
    public:
      InvertedAxis (Axis* axis_);
     ~InvertedAxis ();

      virtual const float& get_pos   () const;
      virtual const float& get_angle () const;
  
      virtual void  update (float delta);
  
    private:
      InvertedAxis (const InvertedAxis&);
      InvertedAxis operator= (const InvertedAxis&);
    };

  }
}

#endif

/* EOF */

--- NEW FILE: joystick_axis.cxx ---
//  $Id: joystick_axis.cxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <ClanLib/Display/Input/input.h>
#include <ClanLib/Display/Input/inputdevice.h>
#include <ClanLib/Display/Input/inputaxis.h>
#include "joystick_axis.hxx"
#include "../../pingus_error.hxx"

namespace Input {

  namespace Axes {

    JoystickAxis::JoystickAxis(int id_, int axis_, float angle_) : id(id_), 
axis(axis_), pos(0), angle(angle_)
    {
      if (static_cast<unsigned int> (id) >= CL_Input::joysticks.size())
        PingusError::raise("JoystickAxis: Invalid joystick id");
      
      if (axis > CL_Input::joysticks[id]->get_num_axes())
        PingusError::raise("JoystickAxis: Invalid joystick axis id");
  
      if (angle < 0)
        angle = (static_cast<int>(angle) % 360) + 360;
      else if (angle > 360)
        angle = static_cast<int>(angle) % 360;
    }

    const float&
    JoystickAxis::get_pos () const
    {
      return pos;
    }

    const float&
    JoystickAxis::get_angle () const
    {
      return angle;
    }
  
    void
    JoystickAxis::update (float)
    {
      pos = CL_Input::joysticks[id]->get_axis(axis)->get_pos();
    }

  }
}

/* EOF */

--- NEW FILE: joystick_axis.hxx ---
//  $Id: joystick_axis.hxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_JOYSTICK_AXIS_HXX
#define HEADER_PINGUS_INPUT_JOYSTICK_AXIS_HXX

#include "axis.hxx"

namespace Input {

  namespace Axes {

    /**
      @brief represents an axis of a joystick
    
      XML definition: <joystick-axis angle="?" id="joystick id" axis="axis of 
the joystick"/>
      */
    class JoystickAxis : public Axis {

      private:
        int     id;
        int     axis;
        float   pos;
        float   angle;
  
      public:

        JoystickAxis (int id_, int axis_, float angle_);

        virtual const float& get_pos   () const;
        virtual const float& get_angle () const;
  
        virtual void  update (float);
  
      private:
        JoystickAxis (const JoystickAxis&);
        JoystickAxis operator= (const JoystickAxis&);
    };

  }
}

#endif

/* EOF */

--- NEW FILE: mouse_axis.cxx ---
//  $Id: mouse_axis.cxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <ClanLib/Display/Input/input.h>
#include <ClanLib/Display/Input/inputdevice.h>
#include <ClanLib/Display/Input/inputcursor.h>
#include "mouse_axis.hxx"

namespace Input {

  namespace Axes {

    MouseAxis::MouseAxis(int axis_, float angle_) : axis(axis_), angle(angle_), 
pos(0), old_pos(0)
    {
      if (angle < 0)
        angle = (static_cast<int>(angle) % 360) + 360;
      else if (angle > 360)
        angle = static_cast<int>(angle) % 360;
      
      switch (axis)
        {
          case 0:  old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
                   break;
          case 1:  old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
                   break;
          default: old_pos = 0;
        }
    }

    const float&
    MouseAxis::get_pos () const
    {
      return pos;
    }

    const float&
    MouseAxis::get_angle () const
    {
      return angle;
    }
  
    void
    MouseAxis::update (float)
    {
      switch (axis)
        {
          case 0:  if (old_pos != CL_Input::pointers[0]->get_cursor(0)->get_x())
                     {
                       pos     = CL_Input::pointers[0]->get_cursor(0)->get_x() 
- old_pos;
                       old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
                    
                       if (pos < -1)
                         pos = -1;
                       else if (pos > 1)
                         pos = 1;
                     }
                   break;
                
          case 1:  if (old_pos != CL_Input::pointers[0]->get_cursor(0)->get_y())
                     {
                       pos     = CL_Input::pointers[0]->get_cursor(0)->get_y() 
- old_pos;
                       old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
                     
                       if (pos < -1)
                         pos = -1;
                       else if (pos > 1)
                         pos = 1;
                     }
                   break;
          default: break; // do nothing
        }
    }

  }
}

/* EOF */

--- NEW FILE: mouse_axis.hxx ---
//  $Id: mouse_axis.hxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_MOUSE_AXIS_HXX
#define HEADER_PINGUS_INPUT_MOUSE_AXIS_HXX

#include "axis.hxx"

namespace Input {

  namespace Axes {

    /**
      @brief represents an axis of the mouse
    
      XML definition: <mouse-axis angle="?" axis="0/1"/>
      */
    class MouseAxis : public Axis {

      private:
        int   axis;
        float angle;
        float pos;
        float old_pos;
    
      public:
        MouseAxis (int axis_, float angle_);

        virtual const float& get_pos   () const;
        virtual const float& get_angle () const;
      
        virtual void  update (float);
      
      private:
        MouseAxis (const MouseAxis&);
        MouseAxis operator= (const MouseAxis&);
    };

  }
}

#endif

/* EOF */

--- NEW FILE: multiple_axis.cxx ---
//  $Id: multiple_axis.cxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "multiple_axis.hxx"

namespace Input {

  namespace Axes {

    MultipleAxis::MultipleAxis (const std::vector<Axis*>& axes_) : axes(axes_),
                                                                   pos(0), 
angle(0)
    {
    }

    MultipleAxis::~MultipleAxis ()
    {
      for (std::vector<Axis*>::const_iterator it = axes.begin(); it != 
axes.end(); it++)
        delete *it;
    }

    const float&
    MultipleAxis::get_pos () const
    {
      return pos;
    }

    const float&
    MultipleAxis::get_angle () const
    {
      return angle;
    }
  
    void
    MultipleAxis::update (float delta)
    {
      for (std::vector<Axis*>::const_iterator it = axes.begin(); it != 
axes.end(); it++)
        {
          (*it)->update(delta);
          const float & temp = (*it)->get_pos();
          if (temp)
            {
              pos   = temp;
              angle = (*it)->get_angle();
            }
        
        }       
    }

  }
}

/* EOF */

--- NEW FILE: multiple_axis.hxx ---
//  $Id: multiple_axis.hxx,v 1.1 2002/08/24 11:37:31 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef HEADER_PINGUS_INPUT_MULTIPLE_AXIS_HXX
#define HEADER_PINGUS_INPUT_MULTIPLE_AXIS_HXX

#include <vector>
#include "axis.hxx"

namespace Input {

  namespace Axes {

    /**
      @brief wrapper class, mapping multiple axes to one
    
      XML definition: <multiple-axis> <axis 1>...<axis n></multiple-axis>
      <br><br>
      angle and pos returned by this class will be the values returned by the 
first class
      yielding a pos that is not null or of the first axis if none is found
      */
    class MultipleAxis : public Axis {

    private:
      std::vector<Axis*> axes;
      float              pos;
      float              angle;
        
    public:
  
      MultipleAxis (const std::vector<Axis*>& axes_);
     ~MultipleAxis ();
  
      virtual const float& get_pos   () const;
      virtual const float& get_angle () const;
    
      virtual void  update (float delta);
    
    private:
      MultipleAxis (const MultipleAxis&);
      MultipleAxis operator= (const MultipleAxis&);
    };

  }
}

#endif

/* EOF */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]