[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input/scrollers Makefile.am, 1.2, 1.
From: |
Ingo Ruhnke |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input/scrollers Makefile.am, 1.2, 1.3 mouse_scroller.cxx, 1.2, 1.3 pointer_scroller.cxx, 1.4, 1.5 pointer_scroller.hxx, 1.4, 1.5 |
Date: |
Mon, 20 Oct 2003 15:33:46 +0200 |
Update of /var/lib/cvs/Games/Pingus/src/input/scrollers
In directory dark:/tmp/cvs-serv18306/input/scrollers
Modified Files:
Makefile.am mouse_scroller.cxx pointer_scroller.cxx
pointer_scroller.hxx
Log Message:
- some namespace and CL0.7 stuff
Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/scrollers/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am 26 Aug 2002 13:53:04 -0000 1.2
+++ Makefile.am 20 Oct 2003 13:33:44 -0000 1.3
@@ -17,6 +17,7 @@
noinst_LIBRARIES = libpingus_input_scrollers.a
+libpingus_input_scrollers_a_CPPFLAGS = @PINGUS_CFLAGS@
libpingus_input_scrollers_a_SOURCES = \
axis_scroller.hxx axis_scroller.cxx \
dummy_scroller.hxx \
Index: mouse_scroller.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/scrollers/mouse_scroller.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mouse_scroller.cxx 19 Apr 2003 10:23:19 -0000 1.2
+++ mouse_scroller.cxx 20 Oct 2003 13:33:44 -0000 1.3
@@ -17,49 +17,46 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include <ClanLib/Display/Input/input.h>
-#include <ClanLib/Display/Input/inputdevice.h>
-#include <ClanLib/Display/Input/inputcursor.h>
+#include <ClanLib/Display/mouse.h>
#include "mouse_scroller.hxx"
namespace Input {
+namespace Scrollers {
- namespace Scrollers {
-
- MouseScroller::MouseScroller () : old_x(0), old_y(0), x_delta(0),
y_delta(0)
- {
- }
+MouseScroller::MouseScroller () : old_x(0), old_y(0), x_delta(0), y_delta(0)
+{
+}
- const float&
- MouseScroller::get_x_delta () const
- {
- return x_delta;
- }
+const float&
+MouseScroller::get_x_delta () const
+{
+ return x_delta;
+}
- const float&
- MouseScroller::get_y_delta () const
- {
- return y_delta;
- }
+const float&
+MouseScroller::get_y_delta () const
+{
+ return y_delta;
+}
- void
- MouseScroller::get_delta (float& x, float& y) const
- {
- x = x_delta;
- y = y_delta;
- }
+void
+MouseScroller::get_delta (float& x, float& y) const
+{
+ x = x_delta;
+ y = y_delta;
+}
- void
- MouseScroller::update (float)
- {
- x_delta = CL_Input::pointers[0]->get_cursor(0)->get_x() - old_x;
- y_delta = CL_Input::pointers[0]->get_cursor(0)->get_x() - old_y;
+void
+MouseScroller::update (float)
+{
+ x_delta = CL_Mouse::get_x() - old_x;
+ y_delta = CL_Mouse::get_y() - old_y;
- old_x = CL_Input::pointers[0]->get_cursor(0)->get_x();
- old_y = CL_Input::pointers[0]->get_cursor(0)->get_y();
- }
+ old_x = CL_Mouse::get_x();
+ old_y = CL_Mouse::get_y();
+}
- }
+}
}
/* EOF */
Index: pointer_scroller.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/scrollers/pointer_scroller.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pointer_scroller.cxx 19 Jun 2003 11:00:10 -0000 1.4
+++ pointer_scroller.cxx 20 Oct 2003 13:33:44 -0000 1.5
@@ -21,73 +21,75 @@
#include "../pointer.hxx"
#include "pointer_scroller.hxx"
+namespace Pingus {
namespace Input {
+namespace Scrollers {
- namespace Scrollers {
+PointerScroller::PointerScroller (Pointer* pointer_, Button* modifier_)
+ : pointer(pointer_),
+ modifier(modifier_),
+ x_delta(0),
+ y_delta(0),
+ x_pos(-1),
+ y_pos(-1)
+{
+}
- 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;
+}
- PointerScroller::~PointerScroller ()
- {
- delete pointer;
- delete modifier;
- }
+const float&
+PointerScroller::get_x_delta () const
+{
+ return x_delta;
+}
- const float&
- PointerScroller::get_x_delta () const
- {
- return x_delta;
- }
+const float&
+PointerScroller::get_y_delta () const
+{
+ return y_delta;
+}
- const float&
- PointerScroller::get_y_delta () const
- {
- return y_delta;
- }
+void
+PointerScroller::get_delta (float& x, float& y) const
+{
+ x = x_delta;
+ y = y_delta;
+}
- void
- PointerScroller::get_delta (float& x, float& y) const
- {
- x = x_delta;
- y = y_delta;
- }
+void
+PointerScroller::update (float delta)
+{
+ pointer ->update(delta);
+ modifier->update(delta);
- void
- PointerScroller::update (float delta)
+ if (modifier->is_pressed())
{
- pointer ->update(delta);
- modifier->update(delta);
-
- if (modifier->is_pressed())
+ if (x_pos == -1)
{
- 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);
- }
+ x_pos = pointer->get_x_pos();
+ y_pos = pointer->get_y_pos();
}
else
{
- x_pos = -1;
- y_pos = -1;
+ 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;
+ }
}
+} // namespace Axes
+} // namespace Input
+} // namespace Pingus
+
/* EOF */
Index: pointer_scroller.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/input/scrollers/pointer_scroller.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pointer_scroller.hxx 19 Apr 2003 10:23:19 -0000 1.4
+++ pointer_scroller.hxx 20 Oct 2003 13:33:44 -0000 1.5
@@ -22,51 +22,53 @@
#include "../scroller.hxx"
+namespace Pingus {
namespace Input {
- class Button;
- class Pointer;
+class Button;
+class Pointer;
- namespace Scrollers {
+namespace Scrollers {
- /**
- @brief allows a Pointer to be used as a Scroller
+/**
+ @brief allows a Pointer to be used as a Scroller
- XML definition: <pointer-scroller> <pointer><button> </pointer-scroller>
+ XML definition: <pointer-scroller> <pointer><button> </pointer-scroller>
- A PointerScroller creates ScrollEvents whenever the associated Button is
pressed.
- The Pointer itself is then reset to it's original position to prevent
the visible
- pointer from moving while the Pointer is used as a Scroller.
- */
- class PointerScroller : public Scroller {
- private:
- Pointer* const pointer;
- Button* const modifier;
+ A PointerScroller creates ScrollEvents whenever the associated Button is
pressed.
+ The Pointer itself is then reset to it's original position to prevent the
visible
+ pointer from moving while the Pointer is used as a Scroller.
+*/
+class PointerScroller : public Scroller {
+private:
+ Pointer* const pointer;
+ Button* const modifier;
- float x_delta;
- float y_delta;
- float x_pos;
- float y_pos;
+ float x_delta;
+ float y_delta;
+ float x_pos;
+ float y_pos;
- public:
+public:
- PointerScroller (Pointer* pointer_, Button* modifier_);
- ~PointerScroller ();
+ PointerScroller (Pointer* pointer_, Button* modifier_);
+ ~PointerScroller ();
- const float& get_x_delta () const;
- const float& get_y_delta () const;
+ const float& get_x_delta () const;
+ const float& get_y_delta () const;
- void get_delta (float& x, float& y) const;
+ void get_delta (float& x, float& y) const;
- void update (float delta);
+ void update (float delta);
- private:
- PointerScroller (const PointerScroller&);
- PointerScroller& operator= (const PointerScroller&);
- };
+private:
+ PointerScroller (const PointerScroller&);
+ PointerScroller& operator= (const PointerScroller&);
+};
- }
-}
+} // namespace Pointer
+} // namespace Input
+} // namespace Pingus
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input/scrollers Makefile.am, 1.2, 1.3 mouse_scroller.cxx, 1.2, 1.3 pointer_scroller.cxx, 1.4, 1.5 pointer_scroller.hxx, 1.4, 1.5,
Ingo Ruhnke <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx, 1.15, 1.16 axis_factory.hxx, 1.9, 1.10 button.hxx, 1.10, 1.11 button_factory.cxx, 1.12, 1.13 controller.hxx, 1.19, 1.20 event.hxx, 1.8, 1.9
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.hxx, 1.10, 1.11 switch_door_obj.cxx, 1.10, 1.11 switch_door_obj.hxx, 1.9, 1.10
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx, 1.15, 1.16 axis_factory.hxx, 1.9, 1.10 button.hxx, 1.10, 1.11 button_factory.cxx, 1.12, 1.13 controller.hxx, 1.19, 1.20 event.hxx, 1.8, 1.9
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.hxx, 1.10, 1.11 switch_door_obj.cxx, 1.10, 1.11 switch_door_obj.hxx, 1.9, 1.10
- Index(es):