[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/input axis_event.hxx,1.1,1.2 controll
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/input axis_event.hxx,1.1,1.2 controller.cxx,1.14,1.15 |
Date: |
16 Aug 2002 18:13:38 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/input
In directory dark:/tmp/cvs-serv30706
Modified Files:
axis_event.hxx controller.cxx
Log Message:
-fixed cause instead of effect of the parse bug
-changed AxisEvent to contain a float
Index: axis_event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_event.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- axis_event.hxx 10 Jul 2002 17:22:11 -0000 1.1
+++ axis_event.hxx 16 Aug 2002 18:13:36 -0000 1.2
@@ -24,17 +24,16 @@
namespace Input {
- enum Direction { up, down };
enum AxisName { action };
class AxisEvent : public Event {
public:
- Direction dir;
+ float dir;
AxisName name;
public:
- AxisEvent (Direction dir_, AxisName name_=action) : dir(dir_),
name(name_) { }
+ AxisEvent (float dir_, AxisName name_=action) : dir(dir_), name(name_) {
}
EventType get_type () { return AxisEventType; }
};
Index: controller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/controller.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- controller.cxx 16 Aug 2002 17:12:13 -0000 1.14
+++ controller.cxx 16 Aug 2002 18:13:36 -0000 1.15
@@ -54,11 +54,12 @@
if (!cur || strcmp(reinterpret_cast<const char*>(cur->name),
"pingus-controller") != 0)
PingusError::raise("Controller: invalid config file <" + configfile +
">");
-
- cur = XMLhelper::skip_blank(cur);
-
- cur = cur->children;
-
+ cur = XMLhelper::skip_blank(cur->children);
+
+ if (!cur || strcmp(reinterpret_cast<const char*>(cur->name),
"controller-config") != 0)
+ PingusError::raise("Controller: invalid config file <" + configfile +
">");
+ cur = XMLhelper::skip_blank(cur->children);
+
while (cur)
{
if (xmlIsBlankNode(cur)) // explicit check cause we need the continue
to check for cur again
@@ -67,14 +68,6 @@
continue;
}
- else if ( ! strcmp(reinterpret_cast<const char*>(cur->name),
"controller-config"))
- {
- // FIXME: handling two levels of the xml tree in the same
- // FIXME: while-loop isn't really nice
- cur = XMLhelper::skip_blank(cur->children);
- continue;
- }
-
else if ( ! strcmp(reinterpret_cast<const char*>(cur->name),
"standard-pointer"))
standard_pointer =
PointerFactory::create(XMLhelper::skip_blank(cur->children));
@@ -207,12 +200,10 @@
else
events.push_back(new ButtonEvent(buttons[i].first, released));
}
-
- if (action_axis->get_pos())
- if (action_axis->get_pos() > 0)
- events.push_back(new AxisEvent(up));
- else
- events.push_back(new AxisEvent(down));
+
+ const float& temp = action_axis->get_pos();
+ if (temp)
+ events.push_back(new AxisEvent(temp));
}
const Button*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/input axis_event.hxx,1.1,1.2 controller.cxx,1.14,1.15,
torangan <=