[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx,1.1,1.2 axis_f
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx,1.1,1.2 axis_factory.hxx,1.2,1.3 |
Date: |
10 Jul 2002 11:22:31 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/input
In directory dark:/tmp/cvs-serv31350
Modified Files:
axis_factory.cxx axis_factory.hxx
Log Message:
added support for MultipleAxis
Index: axis_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_factory.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- axis_factory.cxx 9 Jul 2002 16:03:32 -0000 1.1
+++ axis_factory.cxx 10 Jul 2002 11:22:29 -0000 1.2
@@ -20,13 +20,14 @@
#include <stdlib.h>
#include "../xml_helper.hxx"
#include "../pingus_error.hxx"
+#include "axis_factory.hxx"
+#include "button.hxx"
#include "button_axis.hxx"
+#include "button_factory.hxx"
#include "inverted_axis.hxx"
#include "joystick_axis.hxx"
#include "mouse_axis.hxx"
-#include "axis_factory.hxx"
-#include "button_factory.hxx"
-#include "button.hxx"
+#include "multiple_axis.hxx"
namespace Input {
@@ -99,6 +100,30 @@
free(axis_str);
return new MouseAxis(axis, angle);
+ }
+
+ Axis* AxisFactory::multiple_axis (xmlNodePtr cur)
+ {
+ char * angle_str = reinterpret_cast<char *>(xmlGetProp(cur,
reinterpret_cast<const xmlChar*>("angle")));
+ float angle = atof(angle_str);
+ free(angle_str);
+
+ std::vector<Axis*> axes;
+ cur = cur->children;
+
+ while (cur)
+ {
+ if (xmlIsBlankNode(cur))
+ {
+ cur = cur->next;
+ continue;
+ }
+
+ axes.push_back(create(cur));
+ cur = cur->next;
+ }
+
+ return new MultipleAxis(angle, axes);
}
}
Index: axis_factory.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_factory.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- axis_factory.hxx 9 Jul 2002 17:00:10 -0000 1.2
+++ axis_factory.hxx 10 Jul 2002 11:22:29 -0000 1.3
@@ -33,6 +33,7 @@
static inline Axis* inverted_axis (xmlNodePtr cur);
static inline Axis* joystick_axis (xmlNodePtr cur);
static inline Axis* mouse_axis (xmlNodePtr cur);
+ static inline Axis* multiple_axis (xmlNodePtr cur);
public:
static Axis* create (xmlNodePtr cur);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input axis_factory.cxx,1.1,1.2 axis_factory.hxx,1.2,1.3,
torangan <=