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 multiple_button.hxx,NONE,1.1 mu


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

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

Added Files:
        multiple_button.hxx multiple_button.cxx 
Log Message:
class mapping a group of buttons to one


--- NEW FILE: multiple_button.hxx ---
//  $Id: multiple_button.hxx,v 1.1 2002/07/08 14:48:03 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_BUTTON_HXX
#define HEADER_PINGUS_INPUT_MULTIPLE_BUTTON_HXX

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

namespace Input {

  class MultipleButton : Button {
  
    private:
      std::vector<Button*> buttons;
      
    public:
    
      MultipleButton(std::vector<Button*> buttons_);

      virtual bool is_pressed ();
      virtual void update (float delta);
  };
}

#endif

/* EOF */

--- NEW FILE: multiple_button.cxx ---
//  $Id: multiple_button.cxx,v 1.1 2002/07/08 14:48:03 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_button.hxx"

namespace Input {

  MultipleButton::MultipleButton(std::vector<Button*> buttons_) : 
buttons(buttons_) { }

  void
  MultipleButton::update(float delta)
  {
    for (std::vector<Button*>::iterator it = buttons.begin(); it != 
buttons.end(); it++)
      (*it)->update(delta);
  }
  
  bool
  MultipleButton::is_pressed()
  {
    for (std::vector<Button*>::iterator it = buttons.begin(); it != 
buttons.end(); it++)
      if ((*it)->is_pressed())
        return true;

    return false;
  }
  
}

/* EOF */




reply via email to

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