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 button_axis.cxx,NONE,1.1 button


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input button_axis.cxx,NONE,1.1 button_axis.hxx,NONE,1.1
Date: 4 Jul 2002 13:11:59 -0000

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

Added Files:
        button_axis.cxx button_axis.hxx 
Log Message:
wrapper class to create an axis with two buttons


--- NEW FILE: button_axis.cxx ---
//  $Id: button_axis.cxx,v 1.1 2002/07/04 13:11:57 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.hxx"
#include "button_axis.hxx"

namespace Input
{
  ButtonAxis::ButtonAxis(float angle_, Button* button1_, Button* button2_) : 
                         angle(angle_), button1(button1_), button2(button2_) { }


  float
  ButtonAxis::get_pos ()
  {
    if (button1->is_pressed() == button2->is_pressed())
      return 0;
      
    if (button1->is_pressed())
      return -1.0f;
    else
      return 1.0f;
  }

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

/* EOF */

--- NEW FILE: button_axis.hxx ---
//  $Id: button_axis.hxx,v 1.1 2002/07/04 13:11:57 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"

class Button;

namespace Input
{
  class ButtonAxis : Axis {

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

#endif

/* EOF */




reply via email to

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