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 mouse_axis.hxx,NONE,1.1 mouse_a


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input mouse_axis.hxx,NONE,1.1 mouse_axis.cxx,NONE,1.1
Date: 8 Jul 2002 14:47:37 -0000

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

Added Files:
        mouse_axis.hxx mouse_axis.cxx 
Log Message:
class to make a mouse usable as an AxisPointer


--- NEW FILE: mouse_axis.hxx ---
//  $Id: mouse_axis.hxx,v 1.1 2002/07/08 14:47:35 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
{
  class MouseAxis : Axis {

  private:
    int     axis;
    float   angle;

    
  public:
    MouseAxis(int axis_, float angle_);

    virtual float get_pos ();
    virtual float get_angle ();
    virtual void  update (float);
  };
}

#endif

/* EOF */

--- NEW FILE: mouse_axis.cxx ---
//  $Id: mouse_axis.cxx,v 1.1 2002/07/08 14:47:35 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 "mouse_axis.hxx"

namespace Input
{
  MouseAxis::MouseAxis(int axis_, float angle_) : axis(axis_), angle(angle_)
  {
    if (angle < 0)
      angle = (static_cast<int>(angle) % 360) + 360;
    else if (angle > 360)
      angle = static_cast<int>(angle) % 360;
  }

  float
  MouseAxis::get_pos ()
  {
    return CL_Input::pointers[0]->get_axis(axis)->get_pos();
  }

  float
  MouseAxis::get_angle ()
  {
    return angle;
  }
  
  void
  MouseAxis::update(float)
  {
  }
}

/* EOF */




reply via email to

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