[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input multiple_pointer.cxx,NONE,1.1 m
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input multiple_pointer.cxx,NONE,1.1 multiple_pointer.hxx,NONE,1.1 |
Date: |
5 Jul 2002 11:02:30 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/input
In directory dark:/tmp/cvs-serv10222
Added Files:
multiple_pointer.cxx multiple_pointer.hxx
Log Message:
wrappers class to make multipe pointers appear as one
--- NEW FILE: multiple_pointer.cxx ---
// $Id: multiple_pointer.cxx,v 1.1 2002/07/05 11:02:28 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_pointer.hxx"
namespace Input
{
MultiplePointer::MultiplePointer(std::vector<Pointer*> pointers_) :
pointers(pointers_),
x_pos_list(pointers.size()), y_pos_list(pointers.size())
{
}
float
MultiplePointer::get_x_pos ()
{
return x_pos;
}
float
MultiplePointer::get_y_pos ()
{
return y_pos;
}
void
MultiplePointer::update(float delta)
{
bool do_break = false;
for (unsigned int i = 0; i < pointers.size(); i++)
{
pointers[i]->update(delta);
if (pointers[i]->get_x_pos() != x_pos_list[i])
{
x_pos_list[i] = pointers[i]->get_x_pos();
x_pos = x_pos_list[i];
do_break = true;
}
if (pointers[i]->get_y_pos() != y_pos_list[i])
{
y_pos_list[i] = pointers[i]->get_y_pos();
y_pos = y_pos_list[i];
do_break = true;
}
if (do_break)
break;
}
// no pointer changed, so there's no need to update the pointers
if ( ! do_break)
return;
for (unsigned int i = 0; i < pointers.size(); i++)
pointers[i]->set_pos(x_pos, y_pos);
}
}
/* EOF */
--- NEW FILE: multiple_pointer.hxx ---
// $Id: multiple_pointer.hxx,v 1.1 2002/07/05 11:02:28 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_POINTER_HXX
#define HEADER_PINGUS_INPUT_MULTIPLE_POINTER_HXX
#include <vector>
#include "pointer.hxx"
namespace Input
{
class MultiplePointer : Pointer
{
private:
std::vector<Pointer*> pointers;
std::vector<float> x_pos_list;
std::vector<float> y_pos_list;
float x_pos;
float y_pos;
public:
MultiplePointer (std::vector<Pointer*> pointers_);
virtual float get_x_pos ();
virtual float get_y_pos ();
virtual void update (float delta);
};
}
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input multiple_pointer.cxx,NONE,1.1 multiple_pointer.hxx,NONE,1.1,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input Makefile.am,1.4,1.5
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input axis_pointer.cxx,1.1,1.2 axis_pointer.hxx,1.1,1.2 button_axis.cxx,1.2,1.3 joystick_axis.cxx,1.2,1.3 mouse_pointer.cxx,1.1,1.2 mouse_pointer.hxx,1.1,1.2 pointer.hxx,1.3,1.4
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input Makefile.am,1.4,1.5
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input axis_pointer.cxx,1.1,1.2 axis_pointer.hxx,1.1,1.2 button_axis.cxx,1.2,1.3 joystick_axis.cxx,1.2,1.3 mouse_pointer.cxx,1.1,1.2 mouse_pointer.hxx,1.1,1.2 pointer.hxx,1.3,1.4
- Index(es):