[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input axis_scroller.cxx,NONE,1.1 axis
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input axis_scroller.cxx,NONE,1.1 axis_scroller.hxx,NONE,1.1 pointer_scroller.cxx,NONE,1.1 pointer_scroller.hxx,NONE,1.1 scroller.hxx,NONE,1.1 |
Date: |
11 Jul 2002 12:36:17 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/input
In directory dark:/tmp/cvs-serv22265
Added Files:
axis_scroller.cxx axis_scroller.hxx pointer_scroller.cxx
pointer_scroller.hxx scroller.hxx
Log Message:
some scroller classes
--- NEW FILE: axis_scroller.cxx ---
// $Id: axis_scroller.cxx,v 1.1 2002/07/11 12:36:15 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 "axis.hxx"
#include "axis_scroller.hxx"
namespace Input {
AxisScroller::AxisScroller (Axis* axis1_, Axis* axis2_, float speed_) :
axis1(axis1_), axis2(axis2_), speed(speed_)
{
}
AxisScroller::~AxisScroller ()
{
delete axis1;
delete axis2;
}
float
AxisScroller::get_x_delta ()
{
return axis1->get_pos() * speed;
}
float
AxisScroller::get_y_delta ()
{
return axis2->get_pos() * speed;
}
void
AxisScroller::get_delta (float& x, float& y)
{
x = axis1->get_pos() * speed;
y = axis2->get_pos() * speed;
}
void
AxisScroller::update (float delta)
{
axis1->update(delta);
axis2->update(delta);
}
}
/* EOF */
--- NEW FILE: axis_scroller.hxx ---
// $Id: axis_scroller.hxx,v 1.1 2002/07/11 12:36:15 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_SCROLLER_HXX
#define HEADER_PINGUS_INPUT_AXIS_SCROLLER_HXX
#include "scroller.hxx"
namespace Input {
class Axis;
class AxisScroller : public Scroller {
private:
Axis* axis1;
Axis* axis2;
float speed;
public:
AxisScroller (Axis* axis1_, Axis* axis2_, float speed_);
~AxisScroller ();
float get_x_delta ();
float get_y_delta ();
void get_delta (float& x, float& y);
void update (float delta);
};
}
#endif
/* EOF */
--- NEW FILE: pointer_scroller.cxx ---
// $Id: pointer_scroller.cxx,v 1.1 2002/07/11 12:36:15 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 "pointer.hxx"
#include "pointer_scroller.hxx"
namespace Input {
PointerScroller::PointerScroller (Pointer* pointer_, Button* modifier_) :
pointer(pointer_), modifier(modifier_),
x_delta(0), y_delta(0), x_pos(-1), y_pos(-1)
{
}
PointerScroller::~PointerScroller ()
{
delete pointer;
delete modifier;
}
float
PointerScroller::get_x_delta ()
{
return x_delta;
}
float
PointerScroller::get_y_delta ()
{
return y_delta;
}
void
PointerScroller::get_delta (float& x, float& y)
{
x = x_delta;
y = y_delta;
}
void
PointerScroller::update (float delta)
{
pointer ->update(delta);
modifier->update(delta);
if (modifier->is_pressed())
{
if (x_pos == -1)
{
x_pos = pointer->get_x_pos();
y_pos = pointer->get_y_pos();
}
else
{
x_delta = pointer->get_x_pos() - x_pos;
y_delta = pointer->get_y_pos() - y_pos;
pointer->set_pos(x_pos, y_pos);
}
}
else
{
x_pos = -1;
y_pos = -1;
}
}
}
/* EOF */
--- NEW FILE: pointer_scroller.hxx ---
// $Id: pointer_scroller.hxx,v 1.1 2002/07/11 12:36:15 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_POINTER_SCROLLER_HXX
#define HEADER_PINGUS_INPUT_POINTER_SCROLLER_HXX
#include "scroller.hxx"
namespace Input {
class Button;
class Pointer;
class PointerScroller : public Scroller {
private:
Pointer* pointer;
Button* modifier;
float x_delta;
float y_delta;
float x_pos;
float y_pos;
public:
PointerScroller (Pointer* pointer_, Button* modifier_);
~PointerScroller ();
float get_x_delta ();
float get_y_delta ();
void get_delta (float& x, float& y);
void update (float delta);
};
}
#endif
/* EOF */
--- NEW FILE: scroller.hxx ---
// $Id: scroller.hxx,v 1.1 2002/07/11 12:36:15 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_SCROLLER_HXX
#define HEADER_PINGUS_INPUT_SCROLLER_HXX
namespace Input {
class Scroller {
public:
virtual ~Scroller () { }
virtual float get_x_delta () =0;
virtual float get_y_delta () =0;
virtual void get_delta (float&, float&) =0;
virtual void update (float) =0;
};
}
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input axis_scroller.cxx,NONE,1.1 axis_scroller.hxx,NONE,1.1 pointer_scroller.cxx,NONE,1.1 pointer_scroller.hxx,NONE,1.1 scroller.hxx,NONE,1.1,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input mouse_axis.cxx,1.1,1.2 mouse_axis.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input Makefile.am,1.13,1.14
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input mouse_axis.cxx,1.1,1.2 mouse_axis.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input Makefile.am,1.13,1.14
- Index(es):