[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input/pointers axis_pointer.cxx, 1.4,
From: |
Ingo Ruhnke |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input/pointers axis_pointer.cxx, 1.4, 1.5 axis_pointer.hxx, 1.4, 1.5 dummy_pointer.hxx, 1.4, 1.5 mouse_pointer.cxx, 1.4, 1.5 mouse_pointer.hxx, 1.5, 1.6 multiple_pointer.cxx, 1.3, 1.4 multiple_pointer.hxx, 1.4, 1.5 |
Date: |
Mon, 20 Oct 2003 21:28:57 +0200 |
Update of /var/lib/cvs/Games/Pingus/src/input/pointers
In directory dark:/tmp/cvs-serv7605/input/pointers
Modified Files:
axis_pointer.cxx axis_pointer.hxx dummy_pointer.hxx
mouse_pointer.cxx mouse_pointer.hxx multiple_pointer.cxx
multiple_pointer.hxx
Log Message:
misc stuff
Index: axis_pointer.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/axis_pointer.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- axis_pointer.cxx 19 Apr 2003 10:23:19 -0000 1.4
+++ axis_pointer.cxx 20 Oct 2003 19:28:55 -0000 1.5
@@ -22,54 +22,55 @@
#include "../axis.hxx"
#include "axis_pointer.hxx"
+namespace Pingus {
namespace Input {
+namespace Pointers {
- namespace Pointers {
-
- AxisPointer::AxisPointer (float speed_, const std::vector<Axis*>& axes_) :
speed(speed_), axes(axes_)
- {
- assert(axes.size() >= 2);
- assert(axes[0]->get_angle() != axes[1]->get_angle());
- }
+AxisPointer::AxisPointer (float speed_, const std::vector<Axis*>& axes_) :
speed(speed_), axes(axes_)
+{
+ assert(axes.size() >= 2);
+ assert(axes[0]->get_angle() != axes[1]->get_angle());
+}
- AxisPointer::~AxisPointer ()
- {
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- delete *it;
- }
+AxisPointer::~AxisPointer ()
+{
+ for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
+ delete *it;
+}
- const float&
- AxisPointer::get_x_pos () const
- {
- return x_pos;
- }
+const float&
+AxisPointer::get_x_pos () const
+{
+ return x_pos;
+}
- const float&
- AxisPointer::get_y_pos () const
- {
- return y_pos;
- }
+const float&
+AxisPointer::get_y_pos () const
+{
+ return y_pos;
+}
- void
- AxisPointer::set_pos (float new_x, float new_y)
- {
- x_pos = new_x;
- y_pos = new_y;
- }
+void
+AxisPointer::set_pos (float new_x, float new_y)
+{
+ x_pos = new_x;
+ y_pos = new_y;
+}
- void
- AxisPointer::update (float delta)
+void
+AxisPointer::update (float delta)
+{
+ for (std::vector<Axis*>::const_iterator it = axes.begin(); it != axes.end();
it++)
{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- {
- (*it)->update(delta);
+ (*it)->update(delta);
- x_pos += cos((*it)->get_angle() * 3.14159265 / 180) * speed * delta
* (*it)->get_pos();
- y_pos += sin((*it)->get_angle() * 3.14159265 / 180) * speed * delta
* (*it)->get_pos();
- }
+ x_pos += cos((*it)->get_angle() * 3.14159265 / 180) * speed * delta *
(*it)->get_pos();
+ y_pos += sin((*it)->get_angle() * 3.14159265 / 180) * speed * delta *
(*it)->get_pos();
}
-
- }
}
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
+
/* EOF */
Index: axis_pointer.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/axis_pointer.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- axis_pointer.hxx 19 Apr 2003 10:23:19 -0000 1.4
+++ axis_pointer.hxx 20 Oct 2003 19:28:55 -0000 1.5
@@ -23,51 +23,52 @@
#include <vector>
#include "../pointer.hxx"
-
+namespace Pingus {
namespace Input {
- class Axis;
+class Axis;
- namespace Pointers {
+namespace Pointers {
- /**
- @brief maps two or more axes into a pointer
+/**
+ @brief maps two or more axes into a pointer
- XML definition: <axis-pointer> <axis 1><axis 2>[... <axis N>]
</axis-pointer>
+ XML definition: <axis-pointer> <axis 1><axis 2>[... <axis N>]
</axis-pointer>
- The number of axes used to create the pointer and their respective
angles is
- unlimited as long as there are at least two axes and the first two axes
must have
- different angles.
- */
- class AxisPointer : public Pointer {
+ The number of axes used to create the pointer and their respective angles is
+ unlimited as long as there are at least two axes and the first two axes
must have
+ different angles.
+*/
+class AxisPointer : public Pointer {
- private:
+private:
- const float speed;
- std::vector<Axis*> axes;
+ const float speed;
+ std::vector<Axis*> axes;
- float x_pos;
- float y_pos;
+ float x_pos;
+ float y_pos;
- public:
+public:
- AxisPointer (float speed, const std::vector<Axis*>& axes_);
- ~AxisPointer ();
+ AxisPointer (float speed, const std::vector<Axis*>& axes_);
+ ~AxisPointer ();
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
+ virtual const float& get_x_pos () const;
+ virtual const float& get_y_pos () const;
- virtual void set_pos(float new_x, float new_y);
+ virtual void set_pos(float new_x, float new_y);
- virtual void update (float delta);
+ virtual void update (float delta);
- private:
- AxisPointer (const AxisPointer&);
- AxisPointer& operator= (const AxisPointer&);
- };
+private:
+ AxisPointer (const AxisPointer&);
+ AxisPointer& operator= (const AxisPointer&);
+};
- }
-}
+} // namespace Pointers
+} // namespace Input
+} // namespace Pingus
#endif
Index: dummy_pointer.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/dummy_pointer.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dummy_pointer.hxx 19 Apr 2003 10:23:19 -0000 1.4
+++ dummy_pointer.hxx 20 Oct 2003 19:28:55 -0000 1.5
@@ -22,37 +22,38 @@
#include "../pointer.hxx"
+namespace Pingus {
namespace Input {
+namespace Pointers {
- namespace Pointers {
-
- /**
- @brief dummy class to be used if a pointer is required but none defined
+/**
+ @brief dummy class to be used if a pointer is required but none defined
- XML definition: none
- */
- class DummyPointer : public Pointer {
+ XML definition: none
+*/
+class DummyPointer : public Pointer {
- private:
- const float pos;
+private:
+ const float pos;
- public:
+public:
- DummyPointer () : pos(0) { }
+ DummyPointer () : pos(0) { }
- virtual const float& get_x_pos () const { return pos; }
- virtual const float& get_y_pos () const { return pos; }
+ virtual const float& get_x_pos () const { return pos; }
+ virtual const float& get_y_pos () const { return pos; }
- virtual void set_pos (float, float) { }
- virtual void update (float) { }
+ virtual void set_pos (float, float) { }
+ virtual void update (float) { }
- private:
- DummyPointer (const DummyPointer&);
- DummyPointer& operator= (const DummyPointer&);
- };
+private:
+ DummyPointer (const DummyPointer&);
+ DummyPointer& operator= (const DummyPointer&);
+};
- }
-}
+} // namespace Pointers
+} // namespace Input
+} // namespace Pingus
#endif
Index: mouse_pointer.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/mouse_pointer.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mouse_pointer.cxx 19 Oct 2003 12:25:47 -0000 1.4
+++ mouse_pointer.cxx 20 Oct 2003 19:28:55 -0000 1.5
@@ -20,6 +20,7 @@
#include <ClanLib/Display/mouse.h>
#include "mouse_pointer.hxx"
+namespace Pingus {
namespace Input {
namespace Pointers {
@@ -65,7 +66,8 @@
y_pos = y;
}
-}
-}
+} // namespace Pointers
+} // namespace Input
+} // namespace Pingus
/* EOF */
Index: mouse_pointer.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/mouse_pointer.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mouse_pointer.hxx 19 Jun 2003 11:00:10 -0000 1.5
+++ mouse_pointer.hxx 20 Oct 2003 19:28:55 -0000 1.6
@@ -23,41 +23,42 @@
#include <ClanLib/Signals/slot.h>
#include "../pointer.hxx"
+namespace Pingus {
namespace Input {
+namespace Pointers {
- namespace Pointers {
-
- /**
- @brief maps the standard mouse into a pointer
+/**
+ @brief maps the standard mouse into a pointer
- XML definition: <mouse-pointer/>
- */
- class MousePointer : public Pointer {
+ XML definition: <mouse-pointer/>
+*/
+class MousePointer : public Pointer {
- private:
- float x_pos;
- float y_pos;
- CL_Slot move_slot;
+private:
+ float x_pos;
+ float y_pos;
+ CL_Slot move_slot;
- public:
- MousePointer ();
+public:
+ MousePointer ();
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
+ virtual const float& get_x_pos () const;
+ virtual const float& get_y_pos () const;
- virtual void set_pos (float new_x, float new_y);
+ virtual void set_pos (float new_x, float new_y);
- virtual void update (float);
+ virtual void update (float);
- private:
- void move_signal (int x, int y);
+private:
+ void move_signal (int x, int y);
- MousePointer (const MousePointer&);
- MousePointer& operator= (const MousePointer&);
- };
+ MousePointer (const MousePointer&);
+ MousePointer& operator= (const MousePointer&);
+};
- }
-}
+} // namespace Pointers
+} // namespace Input
+} // namespace Pingus
#endif
Index: multiple_pointer.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/multiple_pointer.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- multiple_pointer.cxx 19 Apr 2003 10:23:19 -0000 1.3
+++ multiple_pointer.cxx 20 Oct 2003 19:28:55 -0000 1.4
@@ -19,83 +19,84 @@
#include "multiple_pointer.hxx"
+namespace Pingus {
namespace Input {
+namespace Pointers {
- namespace Pointers {
-
- MultiplePointer::MultiplePointer (const std::vector<Pointer*>& pointers_)
- : pointers(pointers_),
- old_x_pos(0),
- old_y_pos(0),
- x_pos(0),
- y_pos(0)
- {
- }
+MultiplePointer::MultiplePointer (const std::vector<Pointer*>& pointers_)
+ : pointers(pointers_),
+ old_x_pos(0),
+ old_y_pos(0),
+ x_pos(0),
+ y_pos(0)
+{
+}
- MultiplePointer::~MultiplePointer ()
- {
- for (unsigned int i = 0; i < pointers.size(); ++i)
- delete pointers[i];
- }
+MultiplePointer::~MultiplePointer ()
+{
+ for (unsigned int i = 0; i < pointers.size(); ++i)
+ delete pointers[i];
+}
- const float&
- MultiplePointer::get_x_pos () const
- {
- return x_pos;
- }
+const float&
+MultiplePointer::get_x_pos () const
+{
+ return x_pos;
+}
- const float&
- MultiplePointer::get_y_pos () const
- {
- return y_pos;
- }
+const float&
+MultiplePointer::get_y_pos () const
+{
+ return y_pos;
+}
- void
- MultiplePointer::set_pos (float x_pos_, float y_pos_)
- {
- for (unsigned int i = 0; i < pointers.size(); ++i)
- pointers[i]->set_pos(x_pos_, y_pos_);
- }
+void
+MultiplePointer::set_pos (float x_pos_, float y_pos_)
+{
+ for (unsigned int i = 0; i < pointers.size(); ++i)
+ pointers[i]->set_pos(x_pos_, y_pos_);
+}
- void
- MultiplePointer::update (float delta)
- {
- unsigned int do_break = UINT_MAX;
+void
+MultiplePointer::update (float delta)
+{
+ unsigned int do_break = UINT_MAX;
- for (unsigned int i = 0; i < pointers.size(); ++i)
- pointers[i]->update(delta);
+ for (unsigned int i = 0; i < pointers.size(); ++i)
+ pointers[i]->update(delta);
- for (unsigned int i = 0; i < pointers.size(); ++i)
+ for (unsigned int i = 0; i < pointers.size(); ++i)
+ {
+ if (pointers[i]->get_x_pos() != old_x_pos)
{
- if (pointers[i]->get_x_pos() != old_x_pos)
- {
- old_x_pos = x_pos;
- x_pos = pointers[i]->get_x_pos();
- do_break = i;
- }
-
- if (pointers[i]->get_y_pos() != old_y_pos)
- {
- old_y_pos = y_pos;
- y_pos = pointers[i]->get_y_pos();
- do_break = i;
- }
-
- if (do_break != UINT_MAX)
- break;
+ old_x_pos = x_pos;
+ x_pos = pointers[i]->get_x_pos();
+ do_break = i;
}
- // no pointer changed, so there's no need to update the other pointers
- if (do_break == UINT_MAX)
- return;
+ if (pointers[i]->get_y_pos() != old_y_pos)
+ {
+ old_y_pos = y_pos;
+ y_pos = pointers[i]->get_y_pos();
+ do_break = i;
+ }
- for (unsigned int n = 0; n < pointers.size(); ++n)
- if (n != do_break)
- pointers[n]->set_pos(x_pos, y_pos);
+ if (do_break != UINT_MAX)
+ break;
}
- }
+ // no pointer changed, so there's no need to update the other pointers
+ if (do_break == UINT_MAX)
+ return;
+
+ for (unsigned int n = 0; n < pointers.size(); ++n)
+ if (n != do_break)
+ pointers[n]->set_pos(x_pos, y_pos);
}
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
+
/* EOF */
Index: multiple_pointer.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/pointers/multiple_pointer.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- multiple_pointer.hxx 19 Apr 2003 10:23:19 -0000 1.4
+++ multiple_pointer.hxx 20 Oct 2003 19:28:55 -0000 1.5
@@ -23,48 +23,49 @@
#include <vector>
#include "../pointer.hxx"
+namespace Pingus {
namespace Input {
+namespace Pointers {
- namespace Pointers {
-
- /**
- @brief wrapper class allowing multiple pointers to be used as one
+/**
+ @brief wrapper class allowing multiple pointers to be used as one
- XML definition: <multiple-pointer> <pointer 1>...<pointer N>
</multiple-pointer>
+ XML definition: <multiple-pointer> <pointer 1>...<pointer N>
</multiple-pointer>
- This class will check every contained pointer for changes and if any
changes all
- pointers are updated to the new coordinates. If more than one pointer
changes at
- the same time only the change of the first will be registered.
- */
- class MultiplePointer : public Pointer {
+ This class will check every contained pointer for changes and if any
changes all
+ pointers are updated to the new coordinates. If more than one pointer
changes at
+ the same time only the change of the first will be registered.
+*/
+class MultiplePointer : public Pointer {
- private:
- std::vector<Pointer*> pointers;
+private:
+ std::vector<Pointer*> pointers;
- float old_x_pos;
- float old_y_pos;
+ float old_x_pos;
+ float old_y_pos;
- float x_pos;
- float y_pos;
+ float x_pos;
+ float y_pos;
- public:
- MultiplePointer (const std::vector<Pointer*>& pointers_);
- ~MultiplePointer ();
+public:
+ MultiplePointer (const std::vector<Pointer*>& pointers_);
+ ~MultiplePointer ();
- virtual const float& get_x_pos () const;
- virtual const float& get_y_pos () const;
+ virtual const float& get_x_pos () const;
+ virtual const float& get_y_pos () const;
- virtual void set_pos (float x_pos, float y_pos);
+ virtual void set_pos (float x_pos, float y_pos);
- virtual void update (float delta);
+ virtual void update (float delta);
- private:
- MultiplePointer (const MultiplePointer&);
- MultiplePointer& operator= (const MultiplePointer&);
- };
+private:
+ MultiplePointer (const MultiplePointer&);
+ MultiplePointer& operator= (const MultiplePointer&);
+};
- }
-}
+} // namespace Pointers
+} // namespace Input
+} // namespace Pingus
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input/pointers axis_pointer.cxx, 1.4, 1.5 axis_pointer.hxx, 1.4, 1.5 dummy_pointer.hxx, 1.4, 1.5 mouse_pointer.cxx, 1.4, 1.5 mouse_pointer.hxx, 1.5, 1.6 multiple_pointer.cxx, 1.3, 1.4 multiple_pointer.hxx, 1.4, 1.5,
Ingo Ruhnke <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/sound sound.cxx,1.5,1.6
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input/scrollers axis_scroller.cxx, 1.5, 1.6 axis_scroller.hxx, 1.4, 1.5 dummy_scroller.hxx, 1.4, 1.5 inverted_scroller.cxx, 1.2, 1.3 inverted_scroller.hxx, 1.4, 1.5 joystick_scroller.cxx, 1.3, 1.4 joystick_scroller.hxx, 1.4, 1.5 mouse_scroller.cxx, 1.3, 1.4 mouse_scroller.hxx, 1.4, 1.5 multiple_scroller.cxx, 1.2, 1.3 multiple_scroller.hxx, 1.4, 1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/sound sound.cxx,1.5,1.6
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input/scrollers axis_scroller.cxx, 1.5, 1.6 axis_scroller.hxx, 1.4, 1.5 dummy_scroller.hxx, 1.4, 1.5 inverted_scroller.cxx, 1.2, 1.3 inverted_scroller.hxx, 1.4, 1.5 joystick_scroller.cxx, 1.3, 1.4 joystick_scroller.hxx, 1.4, 1.5 mouse_scroller.cxx, 1.3, 1.4 mouse_scroller.hxx, 1.4, 1.5 multiple_scroller.cxx, 1.2, 1.3 multiple_scroller.hxx, 1.4, 1.5
- Index(es):