[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] [pingus] push by address@hidden - Removed unused src/engine
From: |
pingus |
Subject: |
[Pingus-CVS] [pingus] push by address@hidden - Removed unused src/engine/input_old/ on 2011-09-07 12:02 GMT |
Date: |
Wed, 07 Sep 2011 13:12:31 +0000 |
Revision: 8a92fca5939a
Author: Ingo Ruhnke <address@hidden>
Date: Wed Sep 7 05:01:52 2011
Log: Removed unused src/engine/input_old/
http://code.google.com/p/pingus/source/detail?r=8a92fca5939a
Deleted:
/src/engine/input_old/axes/button_axis.cpp
/src/engine/input_old/axes/button_axis.hpp
/src/engine/input_old/axes/dummy_axis.hpp
/src/engine/input_old/axes/inverted_axis.cpp
/src/engine/input_old/axes/inverted_axis.hpp
/src/engine/input_old/axes/joystick_axis.cpp
/src/engine/input_old/axes/joystick_axis.hpp
/src/engine/input_old/axes/mouse_axis.cpp
/src/engine/input_old/axes/mouse_axis.hpp
/src/engine/input_old/axes/multiple_axis.cpp
/src/engine/input_old/axes/multiple_axis.hpp
/src/engine/input_old/axis.hpp
/src/engine/input_old/axis_factory.cpp
/src/engine/input_old/axis_factory.hpp
/src/engine/input_old/button.hpp
/src/engine/input_old/button_factory.cpp
/src/engine/input_old/button_factory.hpp
/src/engine/input_old/buttons/double_button.cpp
/src/engine/input_old/buttons/double_button.hpp
/src/engine/input_old/buttons/dummy_button.hpp
/src/engine/input_old/buttons/joystick_button.cpp
/src/engine/input_old/buttons/joystick_button.hpp
/src/engine/input_old/buttons/key_button.cpp
/src/engine/input_old/buttons/key_button.hpp
/src/engine/input_old/buttons/mouse_button.cpp
/src/engine/input_old/buttons/mouse_button.hpp
/src/engine/input_old/buttons/multiple_button.cpp
/src/engine/input_old/buttons/multiple_button.hpp
/src/engine/input_old/buttons/triple_button.cpp
/src/engine/input_old/buttons/triple_button.hpp
/src/engine/input_old/controller.cpp
/src/engine/input_old/controller.hpp
/src/engine/input_old/event.hpp
/src/engine/input_old/event_fwd.hpp
/src/engine/input_old/pointer.hpp
/src/engine/input_old/pointer_factory.cpp
/src/engine/input_old/pointer_factory.hpp
/src/engine/input_old/pointers/axis_pointer.cpp
/src/engine/input_old/pointers/axis_pointer.hpp
/src/engine/input_old/pointers/dummy_pointer.hpp
/src/engine/input_old/pointers/mouse_pointer.cpp
/src/engine/input_old/pointers/mouse_pointer.hpp
/src/engine/input_old/pointers/multiple_pointer.cpp
/src/engine/input_old/pointers/multiple_pointer.hpp
/src/engine/input_old/scroller.hpp
/src/engine/input_old/scroller_factory.cpp
/src/engine/input_old/scroller_factory.hpp
/src/engine/input_old/scrollers/axis_scroller.cpp
/src/engine/input_old/scrollers/axis_scroller.hpp
/src/engine/input_old/scrollers/dummy_scroller.hpp
/src/engine/input_old/scrollers/inverted_scroller.cpp
/src/engine/input_old/scrollers/inverted_scroller.hpp
/src/engine/input_old/scrollers/joystick_scroller.cpp
/src/engine/input_old/scrollers/joystick_scroller.hpp
/src/engine/input_old/scrollers/mouse_scroller.cpp
/src/engine/input_old/scrollers/mouse_scroller.hpp
/src/engine/input_old/scrollers/multiple_scroller.cpp
/src/engine/input_old/scrollers/multiple_scroller.hpp
/src/engine/input_old/scrollers/pointer_scroller.cpp
/src/engine/input_old/scrollers/pointer_scroller.hpp
=======================================
--- /src/engine/input_old/axes/button_axis.cpp Wed Sep 7 06:11:41 2011
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.hpp"
-#include "button_axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-ButtonAxis::ButtonAxis(float angle_, Button* button1_, Button* button2_) :
- pos(0), angle(angle_), button1(button1_), button2(button2_)
-{
- if (angle < 0)
- angle = static_cast<float>((static_cast<int>(angle) % 360) + 360);
- else if (angle > 360)
- angle = static_cast<float>((static_cast<int>(angle) % 360) + 0);
-}
-
-ButtonAxis::~ButtonAxis()
-{
- delete button1;
- delete button2;
-}
-
-const float&
-ButtonAxis::get_pos() const
-{
- return pos;
-}
-
-const float&
-ButtonAxis::get_angle() const
-{
- return angle;
-}
-
-void
-ButtonAxis::update(float delta)
-{
- button1->update(delta);
- button2->update(delta);
-
- if (button1->is_pressed() == button2->is_pressed())
- {
- pos = 0;
- return;
- }
-
- if (button1->is_pressed() && pos > -1.0f)
- pos -= delta;
- else if (pos < 1.0f)
- pos += delta;
-
- if (pos < -1.0f)
- pos = -1.0f;
- else if (pos > 1.0f)
- pos = 1.0f;
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/button_axis.hpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_BUTTON_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_BUTTON_AXIS_HPP
-
-#include "../axis.hpp"
-
-namespace Input {
-
-class Button;
-
-namespace Axes {
-
-/**
- @brief maps two buttons into an axis
-
- XML definition: <button-axis angle=?> <some button 1><some button 2>
</button-axis>
-*/
-class ButtonAxis : public Axis {
-
-private:
- float pos;
- float angle;
-
- Button* const button1;
- Button* const button2;
-
-public:
-
- ButtonAxis(float angle_, Button* button1_, Button* button2_);
- ~ButtonAxis();
-
- virtual const float& get_pos() const;
- virtual const float& get_angle() const;
-
- virtual void update(float delta);
-
-private:
- ButtonAxis(const ButtonAxis&);
- ButtonAxis& operator= (const ButtonAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/dummy_axis.hpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_DUMMY_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_DUMMY_AXIS_HPP
-
-#include "../axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief Dummy Axis to be used if an axis is required but none defined
-
- XML definition: none
-*/
-class DummyAxis : public Axis {
-
-private:
- float pos;
- float angle;
-
-public:
-
- DummyAxis () : pos(0.0f), angle(0.0f) { }
-
- virtual const float& get_pos () const { return pos; }
- virtual const float& get_angle () const { return angle; }
-
- virtual void update(float) { }
-
-private:
- DummyAxis (const DummyAxis&);
- DummyAxis& operator= (const DummyAxis&);
-};
-
-} // namespace Axis
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/inverted_axis.cpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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 "inverted_axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-InvertedAxis::InvertedAxis(Axis* axis_) : axis(axis_)
-{
- angle = static_cast<float>((static_cast<int>(axis->get_angle()) + 180) %
360);
-}
-
-InvertedAxis::~InvertedAxis()
-{
- delete axis;
-}
-
-const float&
-InvertedAxis::get_pos() const
-{
- return axis->get_pos();
-}
-
-const float&
-InvertedAxis::get_angle() const
-{
- return angle;
-}
-
-void
-InvertedAxis::update(float delta)
-{
- axis->update(delta);
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/inverted_axis.hpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_INVERTED_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_INVERTED_AXIS_HPP
-
-#include "../axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief decorator class inverting the angle of an axis
-
- XML definition: <inverted-axis> <axis> </inverted-axis>
-*/
-class InvertedAxis : public Axis {
-
-private:
- Axis* const axis;
- float angle;
-
-public:
- InvertedAxis (Axis* axis_);
- ~InvertedAxis ();
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float delta);
-
-private:
- InvertedAxis (const InvertedAxis&);
- InvertedAxis& operator= (const InvertedAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/joystick_axis.cpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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 "../../pingus_error.hpp"
-#include "joystick_axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-JoystickAxis::JoystickAxis(int id_, int axis_, float angle_)
- : id(id_), axis(axis_), pos(0), angle(angle_)
-{
-#if 0
- if (id >= CL_Joystick::get_device_count())
- throw std::runtime_error("JoystickAxis: Invalid joystick id");
-
- if (axis > CL_Joystick::get_device(id).get_axis_count())
- throw std::runtime_error("JoystickAxis: Invalid joystick axis id");
-#endif
-
- if (angle < 0)
- angle = float(static_cast<int>(angle) % 360) + 360;
- else if (angle > 360)
- angle = float(static_cast<int>(angle) % 360);
-}
-
-const float&
-JoystickAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-JoystickAxis::get_angle () const
-{
- return angle;
-}
-
-void
-JoystickAxis::update (float)
-{
-#if 0
- pos = CL_Joystick::get_device(id).get_axis(axis);
-#endif
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/joystick_axis.hpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_JOYSTICK_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_JOYSTICK_AXIS_HPP
-
-#include "../axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief represents an axis of a joystick
-
- XML definition: <joystick-axis angle="?" id="joystick id" axis="axis of
the joystick"/>
-*/
-class JoystickAxis : public Axis {
-
-private:
- int id;
- int axis;
- float pos;
- float angle;
-
-public:
-
- JoystickAxis (int id_, int axis_, float angle_);
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float);
-
-private:
- JoystickAxis (const JoystickAxis&);
- JoystickAxis& operator= (const JoystickAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/mouse_axis.cpp Wed Sep 7 06:11:42 2011
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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 "mouse_axis.hpp"
-
-namespace Input {
-
-namespace Axes {
-
-MouseAxis::MouseAxis(int axis_, float angle_) : axis(axis_),
angle(angle_), pos(0), old_pos(0)
-{
- if (angle < 0)
- angle = (float)((static_cast<int>(angle) % 360) + 360);
- else if (angle > 360)
- angle = (float)(static_cast<int>(angle) % 360);
-
-#if 0
- switch (axis)
- {
- case 0: old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
- break;
- case 1: old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
- break;
- default: old_pos = 0;
- }
-#endif
-}
-
-const float&
-MouseAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-MouseAxis::get_angle () const
-{
- return angle;
-}
-
-void
-MouseAxis::update (float)
-{
-#if 0
- switch (axis)
- {
- case 0: if (old_pos != CL_Input::pointers[0]->get_cursor(0)->get_x())
- {
- pos = CL_Input::pointers[0]->get_cursor(0)->get_x() - old_pos;
- old_pos = CL_Input::pointers[0]->get_cursor(0)->get_x();
-
- if (pos < -1)
- pos = -1;
- else if (pos > 1)
- pos = 1;
- }
- break;
-
- case 1: if (old_pos != CL_Input::pointers[0]->get_cursor(0)->get_y())
- {
- pos = CL_Input::pointers[0]->get_cursor(0)->get_y() - old_pos;
- old_pos = CL_Input::pointers[0]->get_cursor(0)->get_y();
-
- if (pos < -1)
- pos = -1;
- else if (pos > 1)
- pos = 1;
- }
- break;
- default: break; // do nothing
- }
-#endif
-}
-
-}
-}
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/mouse_axis.hpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_MOUSE_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_MOUSE_AXIS_HPP
-
-#include "../axis.hpp"
-
-namespace Input {
-
-namespace Axes {
-
-/**
- @brief represents an axis of the mouse
-
- XML definition: <mouse-axis angle="?" axis="0/1"/>
-*/
-class MouseAxis : public Axis {
-
-private:
- int axis;
- float angle;
- float pos;
- float old_pos;
-
-public:
- MouseAxis (int axis_, float angle_);
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float);
-
-private:
- MouseAxis (const MouseAxis&);
- MouseAxis& operator= (const MouseAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/multiple_axis.cpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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 "multiple_axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-MultipleAxis::MultipleAxis (const std::vector<Axis*>& axes_) : axes(axes_),
- pos(0),
angle(0)
-{
-}
-
-MultipleAxis::~MultipleAxis ()
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- delete *it;
-}
-
-const float&
-MultipleAxis::get_pos () const
-{
- return pos;
-}
-
-const float&
-MultipleAxis::get_angle () const
-{
- return angle;
-}
-
-void
-MultipleAxis::update (float delta)
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- {
- (*it)->update(delta);
- const float & temp = (*it)->get_pos();
- if (temp)
- {
- pos = temp;
- angle = (*it)->get_angle();
- }
-
- }
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/axes/multiple_axis.hpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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_ENGINE_INPUT_OLD_AXES_MULTIPLE_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXES_MULTIPLE_AXIS_HPP
-
-#include <vector>
-
-#include "../axis.hpp"
-
-namespace Input {
-namespace Axes {
-
-/**
- @brief wrapper class, mapping multiple axes to one
-
- XML definition: <multiple-axis> <axis 1>...<axis n></multiple-axis>
- <br><br>
- angle and pos returned by this class will be the values returned by the
first class
- yielding a pos that is not null or of the first axis if none is found
-*/
-class MultipleAxis : public Axis {
-
-private:
- std::vector<Axis*> axes;
- float pos;
- float angle;
-
-public:
-
- MultipleAxis (const std::vector<Axis*>& axes_);
- ~MultipleAxis ();
-
- virtual const float& get_pos () const;
- virtual const float& get_angle () const;
-
- virtual void update (float delta);
-
-private:
- MultipleAxis (const MultipleAxis&);
- MultipleAxis& operator= (const MultipleAxis&);
-};
-
-} // namespace Axes
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axis.hpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_AXIS_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXIS_HPP
-
-#include "pingus.hpp"
-
-namespace Input {
-
-/// abstract base class which defines the axis interface
-class Axis {
-
-public:
- Axis () { }
- virtual ~Axis () { }
-
- /// yields the position of the axis in [-1;1]
- virtual const float& get_pos () const =0;
-
- /// yields the angle of axis in [0;360[ degree
- virtual const float& get_angle () const =0;
-
- virtual void update(float) =0;
-
-private:
- Axis (const Axis&);
- Axis& operator= (const Axis&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/axis_factory.cpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "axes/button_axis.hpp"
-#include "axes/inverted_axis.hpp"
-#include "axes/joystick_axis.hpp"
-#include "axes/multiple_axis.hpp"
-#include "axis_factory.hpp"
-#include "button.hpp"
-#include "button_factory.hpp"
-#include "debug.hpp"
-#include "pingus_error.hpp"
-
-namespace Input {
-
-using namespace Axes;
-
-Axis* AxisFactory::create(const FileReader& reader)
-{
- if (reader.get_name() == "button-axis")
- return button_axis(reader);
-
- else if (reader.get_name() == "inverted-axis")
- return inverted_axis(reader);
-
- else if (reader.get_name() == "joystick-axis")
- return joystick_axis(reader);
-
- else if (reader.get_name() == "multiple-axis")
- return multiple_axis(reader);
-
- else
- throw std::runtime_error(std::string("Unknown axis type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Axis* AxisFactory::button_axis(const FileReader& reader)
-{
- float angle;
- if (!reader.read_float("angle", angle))
- throw std::runtime_error("ButtonAxis without angle parameter");
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 3)
- throw std::runtime_error("ButtonAxis isn't <angle><button><button>");
-
- Button* button1 = ButtonFactory::create(sections[1]);
- Button* button2 = ButtonFactory::create(sections[2]);
-
- return new ButtonAxis(angle, button1, button2);
-}
-
-Axis* AxisFactory::inverted_axis (const FileReader& reader)
-{
- return new InvertedAxis(create(reader));
-}
-
-Axis* AxisFactory::joystick_axis(const FileReader& reader)
-{
- float angle;
- if (!reader.read_float("angle", angle))
- throw std::runtime_error("JoystickAxis without angle parameter");
-
- int id;
- if (!reader.read_int("id", id))
- throw std::runtime_error("JoystickAxis without id parameter");
-
- int axis;
- if (!reader.read_int("axis", axis))
- throw std::runtime_error("JoystickAxis without axis parameter");
-
- return new JoystickAxis(id, axis, angle);
-}
-
-Axis* AxisFactory::multiple_axis(const FileReader& reader)
-{
- std::vector<Axis*> axes;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- axes.push_back(create(*i));
-
- if (!axes.size())
- throw std::runtime_error("MultipleAxis without any axis");
-
- return new MultipleAxis(axes);
-}
-
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/axis_factory.hpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_AXIS_FACTORY_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_AXIS_FACTORY_HPP
-
-#include "file_reader.hpp"
-
-namespace Input {
-
-class Axis;
-
-class AxisFactory
-{
-private:
- static Axis* button_axis(const FileReader& reader);
- static Axis* inverted_axis(const FileReader& reader);
- static Axis* joystick_axis(const FileReader& reader);
- static Axis* multiple_axis(const FileReader& reader);
-
-public:
- static Axis* create(const FileReader& reader);
-
-private:
- AxisFactory();
- AxisFactory(const AxisFactory&);
- AxisFactory& operator= (const AxisFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/button.hpp Wed Sep 7 06:11:43 2011
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTON_HPP
-
-#include "controller.hpp"
-#include "pingus.hpp"
-
-namespace Input {
-
-typedef void (*button_callback_func)(void*);
-
-/// abstract base class which defines the button interface
-class Button
-{
-public:
- Button() { }
- virtual ~Button() { }
-
- /// returns true if the button is pressed, false otherwise
- virtual bool is_pressed() const = 0;
- virtual void update(float) = 0;
-
- virtual void button_down() {
- std::vector<button_callback_info>::iterator i;
- for (i = button_down_callbacks.begin(); i !=
button_down_callbacks.end(); ++i) {
- i->callback(i->userdata);
- }
- }
- virtual void button_up() {
- std::vector<button_callback_info>::iterator i;
- for (i = button_up_callbacks.begin(); i != button_up_callbacks.end();
++i) {
- i->callback(i->userdata);
- }
- }
-
- virtual void add_down_callback(button_callback_func callback, void*
userdata) {
- button_callback_info bci;
- bci.callback = callback;
- bci.userdata = userdata;
- button_down_callbacks.push_back(bci);
- }
- virtual void add_up_callback(button_callback_func callback, void*
userdata) {
- button_callback_info bci;
- bci.callback = callback;
- bci.userdata = userdata;
- button_up_callbacks.push_back(bci);
- }
-
-protected:
- struct button_callback_info {
- button_callback_func callback;
- void *userdata;
- };
- std::vector<button_callback_info> button_down_callbacks;
- std::vector<button_callback_info> button_up_callbacks;
-
-private:
- Button(const Button&);
- Button& operator= (const Button&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/button_factory.cpp Wed Sep 7 06:11:44 2011
+++ /dev/null
@@ -1,134 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "button_factory.hpp"
-#include "buttons/double_button.hpp"
-#include "buttons/joystick_button.hpp"
-#include "buttons/key_button.hpp"
-#include "buttons/mouse_button.hpp"
-#include "buttons/multiple_button.hpp"
-#include "buttons/triple_button.hpp"
-#include "file_reader.hpp"
-#include "pingus_error.hpp"
-
-namespace Input {
-
-using namespace Buttons;
-
-Button* ButtonFactory::create(const FileReader& reader)
-{
- if (reader.get_name() == "double-button")
- return double_button(reader);
-
- else if (reader.get_name() == "joystick-button")
- return joystick_button(reader);
-
- else if (reader.get_name() == "key-button")
- return key_button(reader);
-
- else if (reader.get_name() == "mouse-button")
- return mouse_button(reader);
-
- else if (reader.get_name() == "multiple-button")
- return multiple_button(reader);
-
- else if (reader.get_name() == "triple-button")
- return triple_button(reader);
-
- else
- throw std::runtime_error(std::string("Unknown button type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Button* ButtonFactory::double_button(const FileReader& reader)
-{
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 2)
- throw std::runtime_error("DoubleButton isn't <angle><button><button>");
-
- Button *button1, *button2;
-
- button1 = create(sections[0]);
- button2 = create(sections[1]);
-
- return new DoubleButton(button1, button2);
-}
-
-Button* ButtonFactory::joystick_button(const FileReader& reader)
-{
- int id;
- if (!reader.read_int("id", id))
- throw std::runtime_error("JoystickButton without id parameter");
-
- int button;
- if (!reader.read_int("button", button))
- throw std::runtime_error("JoystickButton without button parameter");
-
- return new JoystickButton(id, button);
-}
-
-Button* ButtonFactory::key_button(const FileReader& reader)
-{
- std::string key;
- if (!reader.read_string("key", key))
- throw std::runtime_error("KeyButton without key parameter");
-
- return new KeyButton(KeyButton::string_to_keyid(key));
-}
-
-Button* ButtonFactory::mouse_button (const FileReader& reader)
-{
- int button;
- if (!reader.read_int("button", button))
- throw std::runtime_error("MouseButton without button parameter");
-
- return new MouseButton(button);
-}
-
-Button* ButtonFactory::multiple_button(const FileReader& reader)
-{
- std::vector<Button*> buttons;
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- buttons.push_back(create(*i));
-
- return new MultipleButton(buttons);
-}
-
-Button* ButtonFactory::triple_button(const FileReader& reader)
-{
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 3)
- throw std::runtime_error("DoubleButton isn't <angle><button><button>");
-
- Button *button1, *button2, *button3;
-
- button1 = create(sections[0]);
- button2 = create(sections[1]);
- button3 = create(sections[2]);
-
- return new TripleButton(button1, button2, button3);
-}
-
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/button_factory.hpp Wed Sep 7 06:11:44 2011
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTON_FACTORY_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTON_FACTORY_HPP
-
-#include "file_reader.hpp"
-
-namespace Input {
-
-class Button;
-
-class ButtonFactory
-{
-private:
- static Button* double_button (const FileReader& reader);
- static Button* joystick_button (const FileReader& reader);
- static Button* key_button (const FileReader& reader);
- static Button* mouse_button (const FileReader& reader);
- static Button* multiple_button (const FileReader& reader);
- static Button* triple_button (const FileReader& reader);
-
-public:
- static Button* create (const FileReader& reader);
-
-private:
- ButtonFactory ();
- ButtonFactory (const ButtonFactory&);
- ButtonFactory& operator= (const ButtonFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/double_button.cpp Wed Sep 7 06:11:44 2011
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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 "../event_fwd.hpp"
-#include "double_button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-DoubleButton::DoubleButton (Button* button1_, Button* button2_) :
button1(button1_), button2(button2_),
-
first_pressed(false), ignore_second(false)
-{
-}
-
-DoubleButton::~DoubleButton ()
-{
- delete button1;
- delete button2;
-}
-
-void
-DoubleButton::update (float delta)
-{
- button1->update(delta);
- button2->update(delta);
-
- if (button1->is_pressed())
- {
- if (!first_pressed)
- {
- first_pressed = true;
- ignore_second = button2->is_pressed();
- }
- }
- else
- {
- first_pressed = false;
- ignore_second = true;
- }
-}
-
-bool
-DoubleButton::is_pressed () const
-{
- return ( ! ignore_second && first_pressed && button2->is_pressed());
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/double_button.hpp Wed Sep 7 06:11:44 2011
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_DOUBLE_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_DOUBLE_BUTTON_HPP
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief allows two buttons to be used in combination
-
- XML definition: <double-button><button1><button2></double-button>
-
- This class allows combinations like CTRL-X whereby it's important that
the first
- key is pressed before the second else the DoubleButton itself won't
change it's
- own state to pressed.
-*/
-class DoubleButton : public Button {
-
-private:
- Button* const button1;
- Button* const button2;
- bool first_pressed;
- bool ignore_second;
-
-public:
-
- DoubleButton (Button* button1_, Button* button2_);
- ~DoubleButton ();
-
- virtual bool is_pressed () const;
- virtual void update (float delta);
-
-private:
- DoubleButton (const DoubleButton&);
- DoubleButton& operator= (const DoubleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/dummy_button.hpp Wed Sep 7 06:11:44 2011
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_DUMMY_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_DUMMY_BUTTON_HPP
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief dummy class to be used if a button is required but not defined
-
- XML definition: none
-*/
-class DummyButton : public Button {
-public:
- DummyButton () { }
-
- virtual bool is_pressed () const { return false; }
- virtual void update (float) { }
-
-private:
- DummyButton (const DummyButton&);
- DummyButton& operator= (const DummyButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/joystick_button.cpp Wed Sep 7 06:11:44
2011
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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 "../../pingus_error.hpp"
-#include "joystick_button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-JoystickButton::JoystickButton(int id_, int button_) : id(id_),
button(button_)
-{
-#if 0
- if (id >= CL_Joystick::get_device_count())
- throw std::runtime_error("JoystickButton: Invalid joystick id: " +
CL_String::to(id));
-
- if (button > CL_Joystick::get_device(id).get_button_count())
- throw std::runtime_error("JoystickButton: Invalid joystick button
id: " + CL_String::to(button));
-#endif
-}
-
-void
-JoystickButton::update(float)
-{
-}
-
-bool
-JoystickButton::is_pressed() const
-{
- // return CL_Joystick::get_device(id).get_keycode(button);
- return false;
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/joystick_button.hpp Wed Sep 7 06:11:44
2011
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_JOYSTICK_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_JOYSTICK_BUTTON_HPP
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief represents a button of a joystick
-
- XML definition: <joystick-button id="joystick id" button="button num"/>
-*/
-class JoystickButton : public Button {
-
-private:
- int id;
- int button;
-
-public:
-
- JoystickButton (int id_, int button_);
-
- virtual bool is_pressed () const;
- virtual void update (float);
-
-private:
- JoystickButton (const JoystickButton&);
- JoystickButton& operator= (const JoystickButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/key_button.cpp Wed Sep 7 06:11:45 2011
+++ /dev/null
@@ -1,182 +0,0 @@
-// 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 "key_button.hpp"
-
-#include <iostream>
-#include <map>
-
-namespace Input {
-namespace Buttons {
-
-KeyButton::KeyButton(int button_)
- : button(button_),
- pressed(false)
-{
- Controller::add_key_callback(&KeyButton::key_handler, this);
-}
-
-void
-KeyButton::update(float)
-{
-}
-
-bool
-KeyButton::is_pressed() const
-{
- return pressed;
-}
-
-void
-KeyButton::key_handler(const SDL_Event& event, void* userdata)
-{
- KeyButton* kb = (KeyButton*)userdata;
- if (event.key.keysym.sym == kb->button)
- {
- if (event.key.state == SDL_PRESSED)
- {
- kb->pressed = true;
- kb->button_down();
- }
- else
- {
- kb->pressed = false;
- kb->button_up();
- }
- }
-}
-
-int
-KeyButton::string_to_keyid(std::string key)
-{
- static bool init = true;
- static std::map<std::string, int> string_to_id;
-
- if (init)
- {
- init = false;
-
- string_to_id["backspace"] = SDLK_BACKSPACE;
- string_to_id["tab"] = SDLK_TAB;
- string_to_id["clear"] = SDLK_CLEAR;
- string_to_id["return"] = SDLK_RETURN;
- // string_to_id["shift"] = CL_KEY_SHIFT;
- // string_to_id["control"] = CL_KEY_CONTROL;
- string_to_id["menu"] = SDLK_MENU;
- string_to_id["pause"] = SDLK_PAUSE;
- string_to_id["escape"] = SDLK_ESCAPE;
- string_to_id["space"] = SDLK_SPACE;
- string_to_id["prior"] = SDLK_PAGEUP;
- string_to_id["next"] = SDLK_PAGEDOWN;
- string_to_id["end"] = SDLK_END;
- string_to_id["home"] = SDLK_HOME;
- string_to_id["left"] = SDLK_LEFT;
- string_to_id["up"] = SDLK_UP;
- string_to_id["right"] = SDLK_RIGHT;
- string_to_id["down"] = SDLK_DOWN;
- // string_to_id["select"] = CL_KEY_SELECT;
- // string_to_id["print"] = CL_KEY_PRINT;
- // string_to_id["execute"] = CL_KEY_EXECUTE;
- string_to_id["insert"] = SDLK_INSERT;
- string_to_id["delete"] = SDLK_DELETE;
- string_to_id["help"] = SDLK_HELP;
- string_to_id["0"] = SDLK_0;
- string_to_id["1"] = SDLK_1;
- string_to_id["2"] = SDLK_2;
- string_to_id["3"] = SDLK_3;
- string_to_id["4"] = SDLK_4;
- string_to_id["5"] = SDLK_5;
- string_to_id["6"] = SDLK_6;
- string_to_id["7"] = SDLK_7;
- string_to_id["8"] = SDLK_8;
- string_to_id["9"] = SDLK_9;
- string_to_id["a"] = SDLK_a;
- string_to_id["b"] = SDLK_b;
- string_to_id["c"] = SDLK_c;
- string_to_id["d"] = SDLK_d;
- string_to_id["e"] = SDLK_e;
- string_to_id["f"] = SDLK_f;
- string_to_id["g"] = SDLK_g;
- string_to_id["h"] = SDLK_h;
- string_to_id["i"] = SDLK_i;
- string_to_id["j"] = SDLK_j;
- string_to_id["k"] = SDLK_k;
- string_to_id["l"] = SDLK_l;
- string_to_id["m"] = SDLK_m;
- string_to_id["n"] = SDLK_n;
- string_to_id["o"] = SDLK_o;
- string_to_id["p"] = SDLK_p;
- string_to_id["q"] = SDLK_q;
- string_to_id["r"] = SDLK_r;
- string_to_id["s"] = SDLK_s;
- string_to_id["t"] = SDLK_t;
- string_to_id["u"] = SDLK_u;
- string_to_id["v"] = SDLK_v;
- string_to_id["w"] = SDLK_w;
- string_to_id["x"] = SDLK_x;
- string_to_id["y"] = SDLK_y;
- string_to_id["z"] = SDLK_z;
- string_to_id["lwin"] = SDLK_LSUPER;
- string_to_id["rwin"] = SDLK_RSUPER;
- string_to_id["numpad0"] = SDLK_KP0;
- string_to_id["numpad1"] = SDLK_KP1;
- string_to_id["numpad2"] = SDLK_KP2;
- string_to_id["numpad3"] = SDLK_KP3;
- string_to_id["numpad4"] = SDLK_KP4;
- string_to_id["numpad5"] = SDLK_KP5;
- string_to_id["numpad6"] = SDLK_KP6;
- string_to_id["numpad7"] = SDLK_KP7;
- string_to_id["numpad8"] = SDLK_KP8;
- string_to_id["numpad9"] = SDLK_KP9;
- string_to_id["multiply"] = SDLK_KP_MULTIPLY;
- string_to_id["add"] = SDLK_KP_PLUS;
- // string_to_id["separator"] = CL_KEY_SEPARATOR;
- string_to_id["subtract"] = SDLK_KP_MINUS;
- string_to_id["decimal"] = SDLK_KP_PERIOD;
- string_to_id["divide"] = SDLK_KP_DIVIDE;
- string_to_id["f1"] = SDLK_F1;
- string_to_id["f2"] = SDLK_F2;
- string_to_id["f3"] = SDLK_F3;
- string_to_id["f4"] = SDLK_F4;
- string_to_id["f5"] = SDLK_F5;
- string_to_id["f6"] = SDLK_F6;
- string_to_id["f7"] = SDLK_F7;
- string_to_id["f8"] = SDLK_F8;
- string_to_id["f9"] = SDLK_F9;
- string_to_id["f10"] = SDLK_F10;
- string_to_id["f11"] = SDLK_F11;
- string_to_id["f12"] = SDLK_F12;
- string_to_id["f13"] = SDLK_F13;
- string_to_id["f14"] = SDLK_F14;
- string_to_id["f15"] = SDLK_F15;
- string_to_id["numlock"] = SDLK_NUMLOCK;
- string_to_id["scroll"] = SDLK_SCROLLOCK;
- string_to_id["lshift"] = SDLK_LSHIFT;
- string_to_id["rshift"] = SDLK_RSHIFT;
- string_to_id["lcontrol"] = SDLK_LCTRL;
- string_to_id["rcontrol"] = SDLK_RCTRL;
- string_to_id["lmenu"] = SDLK_LALT;
- string_to_id["rmenu"] = SDLK_RALT;
- }
-
- return string_to_id[key];
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/key_button.hpp Wed Sep 7 06:11:45 2011
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_KEY_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_KEY_BUTTON_HPP
-
-#include <string>
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief maps a keyboard key to a button
-
- XML definition: <key-button button="key name"/>
-*/
-class KeyButton : public Button {
-
-private:
- int button;
- bool pressed;
-
-public:
-
- KeyButton(int button_);
-
- inline int get_button() const { return button; }
-
- virtual bool is_pressed() const;
- virtual void update(float);
-
- static int string_to_keyid(std::string key);
-
-private:
- static void key_handler(const SDL_Event& event, void *userdata);
-
- KeyButton(const KeyButton&);
- KeyButton& operator= (const KeyButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/mouse_button.cpp Wed Sep 7 06:11:45 2011
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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 "../../pingus_error.hpp"
-#include "mouse_button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-MouseButton::MouseButton(int button_)
- : button(button_),
- pressed(false)
-{
- Controller::add_mouse_callback(&MouseButton::mouse_handler, this);
-}
-
-void
-MouseButton::update (float)
-{
-}
-
-void
-MouseButton::mouse_handler(const SDL_Event& event, void* userdata)
-{
- if (event.type != SDL_MOUSEBUTTONDOWN && event.type != SDL_MOUSEBUTTONUP)
- return;
-
- MouseButton* mb = (MouseButton*)userdata;
- switch (mb->button)
- {
- case 1:
- if (event.button.button == SDL_BUTTON_LEFT) {
- if (event.button.state == SDL_PRESSED) {
- mb->pressed = true;
- mb->button_down();
- } else {
- mb->pressed = false;
- mb->button_up();
- }
- }
- break;
-
- case 2:
- if (event.button.button == SDL_BUTTON_MIDDLE) {
- if (event.button.state == SDL_PRESSED) {
- mb->pressed = true;
- mb->button_down();
- } else {
- mb->pressed = false;
- mb->button_up();
- }
- }
- break;
-
- case 3:
- if (event.button.button == SDL_BUTTON_RIGHT) {
- if (event.button.state == SDL_PRESSED) {
- mb->pressed = true;
- mb->button_down();
- } else {
- mb->pressed = false;
- mb->button_up();
- }
- }
- break;
-
- default: // only three buttons support so far
- break;
- }
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/mouse_button.hpp Wed Sep 7 06:11:45 2011
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_MOUSE_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_MOUSE_BUTTON_HPP
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief represents a mouse button
-
- XML definition: <mouse-button button="button num"/>
-*/
-class MouseButton : public Button {
-
-private:
- int button;
- bool pressed;
-
-public:
- MouseButton(int button_);
-
- inline int get_button() const { return button; }
-
- virtual bool is_pressed() const { return pressed; }
- virtual void update(float);
-
-private:
- static void mouse_handler(const SDL_Event& event, void *userdata);
-
- MouseButton(const MouseButton&);
- MouseButton& operator= (const MouseButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
-
=======================================
--- /src/engine/input_old/buttons/multiple_button.cpp Wed Sep 7 06:11:45
2011
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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 <iostream>
-
-#include "multiple_button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-MultipleButton::MultipleButton (const std::vector<Button*>& buttons_) :
buttons(buttons_)
-{
- down_count = 0;
-
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- {
- (*it)->add_down_callback(&MultipleButton::on_button_down, this);
- (*it)->add_up_callback(&MultipleButton::on_button_up, this);
- }
-}
-
-MultipleButton::~MultipleButton ()
-{
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- delete *it;
-}
-
-void
-MultipleButton::update (float delta)
-{
- for (std::vector<Button*>::iterator it = buttons.begin(); it !=
buttons.end(); it++)
- (*it)->update(delta);
-}
-
-bool
-MultipleButton::is_pressed () const
-{
- for (std::vector<Button*>::const_iterator it = buttons.begin(); it !=
buttons.end(); it++)
- if ((*it)->is_pressed())
- return true;
-
- return false;
-}
-
-void
-MultipleButton::on_button_up(void* userdata)
-{
- MultipleButton* mb = (MultipleButton*)userdata;
- mb->down_count -= 1;
- if (mb->down_count < 0)
- mb->down_count = 0;
-
- if (mb->down_count == 0)
- mb->button_up();
-}
-
-void
-MultipleButton::on_button_down(void* userdata)
-{
- MultipleButton* mb = (MultipleButton*)userdata;
- if (mb->down_count == 0)
- mb->button_down();
-
- mb->down_count += 1;
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/multiple_button.hpp Wed Sep 7 06:11:45
2011
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_MULTIPLE_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_MULTIPLE_BUTTON_HPP
-
-#include <vector>
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief wrapper class mapping multiple buttons into one
-
- XML definition: <multiple-button> <button 1>...<button n>
</multiple-button>
-
- A multiple button is pressed whenever at least one of the buttons
contained is pressed.
-*/
-class MultipleButton : public Button {
-
-private:
- std::vector<Button*> buttons;
- int down_count;
-public:
- MultipleButton(const std::vector<Button*>& buttons_);
- ~MultipleButton();
-
- virtual bool is_pressed() const;
- virtual void update(float delta);
-
-private:
- static void on_button_up(void*);
- static void on_button_down(void*);
-
- MultipleButton(const MultipleButton&);
- MultipleButton& operator= (const MultipleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/triple_button.cpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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 "triple_button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-TripleButton::TripleButton (Button* button1_, Button* button2_, Button*
button3_)
- : button1(button1_),
- button2(button2_),
- button3(button3_),
- first_second_pressed(false),
- ignore_third(false)
-{
-}
-
-TripleButton::~TripleButton ()
-{
- delete button1;
- delete button2;
- delete button3;
-}
-
-void
-TripleButton::update (float delta)
-{
- button1->update(delta);
- button2->update(delta);
- button3->update(delta);
-
- if (button1->is_pressed() && button2->is_pressed())
- {
- if (!first_second_pressed)
- {
- first_second_pressed = true;
- ignore_third = button3->is_pressed();
- }
- }
- else
- {
- first_second_pressed = false;
- ignore_third = true;
- }
-}
-
-bool
-TripleButton::is_pressed() const
-{
- return ( ! ignore_third && first_second_pressed &&
button3->is_pressed());
-}
-
-} // namespace Buttons
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/buttons/triple_button.hpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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_ENGINE_INPUT_OLD_BUTTONS_TRIPLE_BUTTON_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_BUTTONS_TRIPLE_BUTTON_HPP
-
-#include "../button.hpp"
-
-namespace Input {
-namespace Buttons {
-
-/**
- @brief allows three buttons to be used in combination
-
- XML definition: <triple-button> <button1><button2><button3>
</triple-button>
-
- This class allows combinations like CTRL-ALT-R whereby it's important
that the first
- two keys are pressed before the third else the TripleButton itself
won't change it's
- own state to pressed. The order in which the first two keys are pressed
is of no
- importance, such behaviour may be created by using nested DoubleButtons.
-*/
-class TripleButton : public Button {
-
-private:
- Button* const button1;
- Button* const button2;
- Button* const button3;
- bool first_second_pressed;
- bool ignore_third;
-
-public:
- TripleButton (Button* button1_, Button* button2_, Button* button3_);
- ~TripleButton ();
-
- virtual bool is_pressed () const;
- virtual void update (float delta);
-
-private:
- TripleButton (const TripleButton&);
- TripleButton& operator= (const TripleButton&);
-};
-
-} // namespace Buttons
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/controller.cpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,378 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <SDL.h>
-
-#include "engine/screen/screen_manager.hpp"
-
-#include "debug.hpp"
-#include "pingus_error.hpp"
-
-#include "axes/dummy_axis.hpp"
-#include "button_factory.hpp"
-#include "buttons/dummy_button.hpp"
-#include "buttons/key_button.hpp"
-#include "buttons/mouse_button.hpp"
-#include "controller.hpp"
-#include "global_event.hpp"
-#include "path_manager.hpp"
-#include "pointer_factory.hpp"
-#include "pointers/dummy_pointer.hpp"
-#include "scroller_factory.hpp"
-#include "scrollers/axis_scroller.hpp"
-#include "scrollers/dummy_scroller.hpp"
-
-namespace Input {
-
-using namespace Axes;
-using namespace Buttons;
-using namespace Pointers;
-using namespace Scrollers;
-
-Controller* Controller::current_controller = 0;
-std::vector<Controller::key_callback_info> Controller::key_callbacks;
-std::vector<Controller::mouse_callback_info> Controller::mouse_callbacks;
-
-Controller::Controller(const std::string& configfile)
- : standard_pointer(0),
- scroller(0),
- std_pointer_x(0),
- std_pointer_y(0)
-{
- FileReader reader = FileReader::parse(path_manager.complete(configfile));
- if (reader.get_name() != "pingus-controller")
- {
- throw std::runtime_error("Controller: invalid config file <" +
configfile + ">");
- }
- else
- {
- const std::vector<FileReader>& sections = reader.get_sections();
- for (std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- if (i->get_name() == "standard-pointer")
- {
- standard_pointer = PointerFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "primary-button")
- {
- buttons[primary] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "secondary-button")
- {
- buttons[secondary] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "pause-button")
- {
- buttons[pause] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "fast-forward-button")
- {
- buttons[fast_forward] =
ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "single-step-button")
- {
- buttons[single_step] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "armageddon-button")
- {
- buttons[armageddon] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "escape-button")
- {
- buttons[escape] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "scroller")
- {
- scroller = ScrollerFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "action-buttons")
- {
- create_action_buttons(*i);
- }
- else if (i->get_name() == "action-up")
- {
- buttons[action_up] = ButtonFactory::create(i->get_sections()[0]);
- }
- else if (i->get_name() == "action-down")
- {
- buttons[action_down] = ButtonFactory::create(i->get_sections()[0]);
- }
- else
- {
- throw std::runtime_error(std::string("Unkown Element in Controller
Config: ")
- + i->get_name());
- }
- }
- }
-
- if (!standard_pointer)
- {
- standard_pointer = new DummyPointer;
- log_warn("Controller: No standard pointer - inserting dummy");
- }
- else
- {
- std_pointer_x = standard_pointer->get_x_pos();
- std_pointer_y = standard_pointer->get_y_pos();
- }
-
- if (!buttons.count(primary))
- {
- buttons[primary] = new DummyButton;
- log_warn("Controller: No primary button - inserting dummy");
- }
-
- if (!buttons.count(secondary))
- {
- buttons[secondary] = new DummyButton;
- log_warn("Controller: No secondary button - inserting dummy");
- }
-
- if (!buttons.count(pause))
- {
- buttons[pause] = new DummyButton;
- log_warn("Controller: No pause button - inserting dummy");
- }
-
- if (!buttons.count(fast_forward))
- {
- buttons[fast_forward] = new DummyButton;
- log_warn("Controller: No fast_forward button - inserting dummy");
- }
-
- if (!buttons.count(armageddon))
- {
- buttons[armageddon] = new DummyButton;
- log_warn("Controller: No armageddon button - inserting dummy");
- }
-
- if (!buttons.count(escape))
- {
- buttons[escape] = new DummyButton;
- log_warn("Controller: No escape button - inserting dummy");
- }
-
- if (!scroller)
- {
- scroller = new DummyScroller;
- log_warn("Controller: No scroller - inserting dummy");
- }
-
- if (!buttons.count(action_up))
- {
- buttons[action_up] = new DummyButton;
- log_warn("Controller: No action up button - inserting dummy");
- }
-
- if (!buttons.count(action_down))
- {
- buttons[action_down] = new DummyButton;
- log_warn("Controller: No action down button - inserting dummy");
- }
-
- for (std::map<ButtonName, Button*>::iterator it = buttons.begin(); it !=
buttons.end(); ++it)
- {
- static int button_names[max_button];
- button_names[it->first] = it->first;
- it->second->add_down_callback(&Controller::on_button_down,
&button_names[it->first]);
- it->second->add_up_callback(&Controller::on_button_up,
&button_names[it->first]);
- }
-
-}
-
-Controller::~Controller()
-{
- delete scroller;
- delete standard_pointer;
-
- std::map<ButtonName, Button*>::iterator it;
- for (it = buttons.begin(); it != buttons.end(); ++it)
- delete it->second;
-}
-
-void
-Controller::create_action_buttons(const FileReader& reader)
-{
- int count = 0;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- if (i->get_name() == "action-button")
- {
- buttons[static_cast<ButtonName>(action_1 + count)]
- = ButtonFactory::create(i->get_sections()[0]);
- }
- else
- {
- throw std::runtime_error(std::string("Wrong Element in Controller
Config (action-buttons): ")
- + i->get_name());
- }
- count++;
- }
-}
-
-void
-Controller::update(float delta)
-{
- // Let SDL fetch events
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- switch(event.type)
- {
- case SDL_QUIT:
- ScreenManager::instance()->pop_all_screens();
- break;
-
- case SDL_MOUSEMOTION:
- {
- std::vector<mouse_callback_info>::iterator i;
- for (i = mouse_callbacks.begin(); i != mouse_callbacks.end(); ++i)
- {
- i->callback(event, i->userdata);
- }
- break;
- }
-
- case SDL_MOUSEBUTTONDOWN:
- {
- std::vector<mouse_callback_info>::iterator i;
- for (i = mouse_callbacks.begin(); i != mouse_callbacks.end(); ++i)
- {
- i->callback(event, i->userdata);
- }
- break;
- }
-
- case SDL_MOUSEBUTTONUP:
- {
- std::vector<mouse_callback_info>::iterator i;
- for (i = mouse_callbacks.begin(); i != mouse_callbacks.end(); ++i)
- {
- i->callback(event, i->userdata);
- }
- break;
- }
-
- case SDL_KEYDOWN:
- {
- global_event.on_button_press(event.key);
-
- std::vector<key_callback_info>::iterator i;
- for (i = key_callbacks.begin(); i != key_callbacks.end(); ++i)
- {
- i->callback(event, i->userdata);
- }
-
- events.push_back(makeKeyboardEvent(event.key.keysym.unicode));
- break;
- }
-
- case SDL_KEYUP:
- {
- global_event.on_button_release(event.key);
-
- std::vector<key_callback_info>::iterator i;
- for (i = key_callbacks.begin(); i != key_callbacks.end(); ++i)
- {
- i->callback(event, i->userdata);
- }
-
- events.push_back(makeKeyboardEvent(event.key.keysym.unicode));
- break;
- }
-
- default:
- // FIXME: feed other events to the input manager
- break;
- }
- }
-
- scroller->update(delta);
- standard_pointer->update(delta);
-
- for (std::map<ButtonName, Button*>::iterator it = buttons.begin();
- it != buttons.end(); ++it)
- it->second->update(delta);
-
- // FIXME: Busy checking of button status and other events is *VERY EVIL*
- if (std_pointer_x != standard_pointer->get_x_pos()
- || std_pointer_y != standard_pointer->get_y_pos())
- {
- std_pointer_x = standard_pointer->get_x_pos();
- std_pointer_y = standard_pointer->get_y_pos();
-
- events.push_back(makePointerEvent(standard, std_pointer_x,
std_pointer_y));
- }
-
- // FIXME: Busy checking of button status and other events is *VERY EVIL*
- if (scroller->get_x_delta() || scroller->get_y_delta())
- events.push_back(makeScrollEvent(scroller->get_x_delta(),
scroller->get_y_delta()));
-}
-
-void
-Controller::clear()
-{
- events.clear();
-}
-
-void
-Controller::add_key_callback(key_callback_func callback, void *userdata)
-{
- key_callback_info cb;
- cb.callback = callback;
- cb.userdata = userdata;
- key_callbacks.push_back(cb);
-}
-
-void
-Controller::add_mouse_callback(mouse_callback_func callback, void
*userdata)
-{
- mouse_callback_info cb;
- cb.callback = callback;
- cb.userdata = userdata;
- mouse_callbacks.push_back(cb);
-}
-
-const Button*
-Controller::get_button(ButtonName name)
-{
- if (buttons.count(name))
- return buttons[name];
-
- return 0;
-}
-
-void
-Controller::on_button_down(void* userdata)
-{
- ButtonName name = *(ButtonName*)userdata;
- Controller::get_current()->events.push_back(makeButtonEvent(name,
pressed));
-}
-
-void
-Controller::on_button_up(void* userdata)
-{
- ButtonName name = *(ButtonName*)userdata;
- Controller::get_current()->events.push_back(makeButtonEvent(name,
released));
-}
-
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/controller.hpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_CONTROLLER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_CONTROLLER_HPP
-
-#include <SDL.h>
-#include <list>
-#include <map>
-#include <string>
-#include <vector>
-
-#include "event.hpp"
-#include "file_reader.hpp"
-
-namespace Input {
-
-class Axis;
-class Button;
-class Pointer;
-class Scroller;
-
-typedef void (*key_callback_func)(const SDL_Event&, void*);
-typedef void (*mouse_callback_func)(const SDL_Event&, void*);
-
-class Controller {
-
-private:
- Pointer* standard_pointer;
- Scroller* scroller;
-
- std::map<ButtonName, Button*> buttons;
-
- std::vector<Event> events;
-
- float std_pointer_x;
- float std_pointer_y;
-
-public:
- Controller(const std::string& configfile);
- ~Controller();
-
- std::vector<Event>& get_events() { return events; }
-
- const Pointer * get_pointer() const { return standard_pointer; }
- const Scroller* get_scroller() const { return scroller; }
-
- /// returns the requested Buttons::Button or 0 if it doesn't exist (e.g.
undefined action Buttons::Button)
- const Button* get_button(ButtonName name);
-
- void update(float delta);
- void clear();
-
- Controller(const Controller&);
- Controller& operator= (const Controller&);
-
- static void set_current(Controller* controller) { current_controller =
controller; }
- static Controller* get_current() { return current_controller; }
-
- static void add_key_callback(key_callback_func, void*);
- static void add_mouse_callback(mouse_callback_func, void*);
-
-private:
- static Controller* current_controller;
-
- static void on_button_down(void*);
- static void on_button_up(void*);
- void create_action_buttons(const FileReader& reader);
-
- struct key_callback_info {
- key_callback_func callback;
- void *userdata;
- };
- static std::vector<key_callback_info> key_callbacks;
-
- struct mouse_callback_info {
- mouse_callback_func callback;
- void *userdata;
- };
- static std::vector<mouse_callback_info> mouse_callbacks;
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/event.hpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,143 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_EVENT_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_EVENT_HPP
-
-#include <string>
-#include <vector>
-
-#include "pingus.hpp"
-
-namespace Input {
-
-enum EventType { ButtonEventType, PointerEventType, AxisEventType,
ScrollEventType, KeyboardEventType };
-
-enum ButtonName { primary, secondary, pause, fast_forward, single_step,
armageddon, escape, action_1, action_2,
- action_3, action_4, action_5, action_6, action_7,
action_8, action_9, action_10,
- action_up, action_down, max_button };
-
-enum State { pressed, released };
-
-struct ButtonEvent
-{
- ButtonName name;
- State state;
-};
-
-enum PointerName { standard };
-
-struct PointerEvent
-{
- PointerName name;
- float x;
- float y;
-};
-
-enum AxisName { action };
-
-struct AxisEvent
-{
- float dir;
- AxisName name;
-};
-
-struct ScrollEvent
-{
- float x_delta;
- float y_delta;
-};
-
-struct KeyboardEvent
-{
- unsigned short key;
-};
-
-struct Event
-{
- EventType type;
-
- union {
- ButtonEvent button;
- PointerEvent pointer;
- AxisEvent axis;
- ScrollEvent scroll;
- KeyboardEvent keyboard;
- };
-};
-
-typedef std::vector<Event> EventLst;
-
-inline Event makeButtonEvent(ButtonName name, State state)
-{
- Event event;
-
- event.type = ButtonEventType;
- event.button.name = name;
- event.button.state = state;
-
- return event;
-}
-
-inline Event makePointerEvent(PointerName name, float x, float y)
-{
- Event event;
-
- event.type = PointerEventType;
- event.pointer.name = name;
- event.pointer.x = x;
- event.pointer.y = y;
-
- return event;
-}
-
-inline Event makeAxisEvent(float dir, AxisName name = action)
-{
- Event event;
-
- event.type = AxisEventType;
- event.axis.dir = dir;
- event.axis.name = name;
-
- return event;
-}
-
-inline Event makeScrollEvent(float x_delta, float y_delta)
-{
- Event event;
-
- event.type = ScrollEventType;
- event.scroll.x_delta = x_delta;
- event.scroll.y_delta = y_delta;
-
- return event;
-}
-
-inline Event makeKeyboardEvent(unsigned short c)
-{
- Event event;
-
- event.type = KeyboardEventType;
- event.keyboard.key = c;
-
- return event;
-}
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/event_fwd.hpp Wed Sep 7 06:11:46 2011
+++ /dev/null
@@ -1,33 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_EVENT_FWD_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_EVENT_FWD_HPP
-
-#include <vector>
-
-// Forward Header for event.hxx, just here to reduce compile time
-// dependencies a bit.
-namespace Input {
-
-struct Event;
-typedef std::vector<Event> EventLst;
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointer.hpp Wed Sep 7 06:11:47 2011
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_POINTER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTER_HPP
-
-#include "pingus.hpp"
-
-namespace Input {
-
-/// abstract base class defining the pointer interface
-class Pointer
-{
-public:
- Pointer() { }
- virtual ~Pointer() { }
-
- /// returns the X coordinate of the pointer
- virtual const float& get_x_pos() const =0;
-
- /// returns the Y coordinate of the pointer
- virtual const float& get_y_pos() const =0;
-
- /// sets the pointer to the given position
- virtual void set_pos(float, float) =0;
-
- virtual void update(float) =0;
-
-private:
- Pointer (const Pointer&);
- Pointer& operator= (const Pointer&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointer_factory.cpp Wed Sep 7 06:11:47 2011
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "axis_factory.hpp"
-#include "pingus_error.hpp"
-#include "pointer_factory.hpp"
-#include "pointers/axis_pointer.hpp"
-#include "pointers/mouse_pointer.hpp"
-#include "pointers/multiple_pointer.hpp"
-
-namespace Input {
-
-using namespace Pointers;
-
-Pointer* PointerFactory::create (const FileReader& reader)
-{
- if (reader.get_name() == "axis-pointer")
- return axis_pointer(reader);
-
- else if (reader.get_name() == "mouse-pointer")
- return mouse_pointer();
-
- else if (reader.get_name() == "multiple-pointer")
- return multiple_pointer(reader);
-
- else
- throw std::runtime_error(std::string("Unknown pointer type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Pointer* PointerFactory::axis_pointer (const FileReader& reader)
-{
- float speed;
- if (!reader.read_float("speed", speed))
- throw std::runtime_error("AxisPointer without speed parameter");
-
- std::vector<Axis*> axes;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin() + 1;
- i != sections.end(); ++i)
- {
- axes.push_back(AxisFactory::create(*i));
- }
-
- return new AxisPointer(speed, axes);
-}
-
-Pointer* PointerFactory::mouse_pointer ()
-{
- return new MousePointer;
-}
-
-Pointer* PointerFactory::multiple_pointer (const FileReader& reader)
-{
- std::vector<Pointer*> pointers;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- pointers.push_back(create(*i));
-
- return new MultiplePointer(pointers);
-}
-
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointer_factory.hpp Wed Sep 7 06:11:47 2011
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_POINTER_FACTORY_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTER_FACTORY_HPP
-
-#include "file_reader.hpp"
-
-namespace Input {
-
-class Pointer;
-
-class PointerFactory
-{
-private:
- static Pointer* axis_pointer(const FileReader& reader);
- static Pointer* mouse_pointer();
- static Pointer* multiple_pointer(const FileReader& reader);
-
-public:
- static Pointer* create(const FileReader& reader);
-
-private:
- PointerFactory();
- PointerFactory(const PointerFactory&);
- PointerFactory& operator= (const PointerFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/axis_pointer.cpp Wed Sep 7 06:11:47 2011
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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 <assert.h>
-
-#include "../axis.hpp"
-#include "axis_pointer.hpp"
-
-namespace Input {
-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()
-{
- 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_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::update(float delta)
-{
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- {
- (*it)->update(delta);
-
- x_pos += (float)Math::cos((*it)->get_angle() * 3.14159265 / 180) *
speed * delta * (*it)->get_pos();
- y_pos += (float)Math::sin((*it)->get_angle() * 3.14159265 / 180) *
speed * delta * (*it)->get_pos();
- }
-}
-
-} // namespace Axes
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/axis_pointer.hpp Wed Sep 7 06:11:47 2011
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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_ENGINE_INPUT_OLD_POINTERS_AXIS_POINTER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTERS_AXIS_POINTER_HPP
-
-#include <vector>
-
-#include "../pointer.hpp"
-
-namespace Input {
-
-class Axis;
-
-namespace Pointers {
-
-/**
- @brief maps two or more axes into a 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 {
-
-private:
-
- const float speed;
- std::vector<Axis*> axes;
-
- float x_pos;
- float y_pos;
-
-public:
-
- AxisPointer(float speed, const std::vector<Axis*>& axes_);
- ~AxisPointer();
-
- 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 update(float delta);
-
-private:
- AxisPointer(const AxisPointer&);
- AxisPointer& operator= (const AxisPointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/dummy_pointer.hpp Wed Sep 7 06:11:47
2011
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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_ENGINE_INPUT_OLD_POINTERS_DUMMY_POINTER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTERS_DUMMY_POINTER_HPP
-
-#include "../pointer.hpp"
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief dummy class to be used if a pointer is required but none defined
-
- XML definition: none
-*/
-class DummyPointer : public Pointer {
-
-private:
- const float pos;
-
-public:
-
- DummyPointer () : pos(0) { }
-
- 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) { }
-
-private:
- DummyPointer (const DummyPointer&);
- DummyPointer& operator= (const DummyPointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/mouse_pointer.cpp Wed Sep 7 06:11:47
2011
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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 "mouse_pointer.hpp"
-
-namespace Input {
-namespace Pointers {
-
-MousePointer::MousePointer()
- : x_pos(0),
- y_pos(0)
-{
- Controller::add_mouse_callback(MousePointer::move_signal, this);
-}
-
-const float&
-MousePointer::get_x_pos() const
-{
- return x_pos;
-}
-
-const float&
-MousePointer::get_y_pos() const
-{
- return y_pos;
-}
-
-void
-MousePointer::set_pos(float new_x, float new_y)
-{
- SDL_WarpMouse(static_cast<int>(new_x), static_cast<int>(new_y));
-}
-
-void
-MousePointer::update(float)
-{
-}
-
-void
-MousePointer::move_signal(const SDL_Event& event, void* userdata)
-{
- if (event.type != SDL_MOUSEMOTION)
- return;
-
- MousePointer* mp = (MousePointer*)userdata;
- mp->x_pos = (float)event.motion.x;
- mp->y_pos = (float)event.motion.y;
-}
-
-} // namespace Pointers
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/mouse_pointer.hpp Wed Sep 7 06:11:48
2011
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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_ENGINE_INPUT_OLD_POINTERS_MOUSE_POINTER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTERS_MOUSE_POINTER_HPP
-
-#include "../controller.hpp"
-#include "../pointer.hpp"
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief maps the standard mouse into a pointer
-
- XML definition: <mouse-pointer/>
-*/
-class MousePointer : public Pointer {
-
-private:
- float x_pos;
- float y_pos;
-
-public:
- MousePointer();
-
- 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 update(float);
-
-private:
- static void move_signal(const SDL_Event&, void*);
-
- MousePointer(const MousePointer&);
- MousePointer& operator= (const MousePointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/pointers/multiple_pointer.cpp Wed Sep 7 06:11:48
2011
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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 "multiple_pointer.hpp"
-
-namespace Input {
-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 ()
-{
- 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_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::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)
- {
- 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;
- }
-
- // 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
-
-/* EOF */
-
=======================================
--- /src/engine/input_old/pointers/multiple_pointer.hpp Wed Sep 7 06:11:48
2011
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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_ENGINE_INPUT_OLD_POINTERS_MULTIPLE_POINTER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_POINTERS_MULTIPLE_POINTER_HPP
-
-#include <vector>
-
-#include "../pointer.hpp"
-
-namespace Input {
-namespace Pointers {
-
-/**
- @brief wrapper class allowing multiple pointers to be used as one
-
- 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 {
-
-private:
- std::vector<Pointer*> pointers;
-
- float old_x_pos;
- float old_y_pos;
-
- float x_pos;
- float y_pos;
-
-public:
- MultiplePointer (const std::vector<Pointer*>& pointers_);
- ~MultiplePointer ();
-
- 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 update (float delta);
-
-private:
- MultiplePointer (const MultiplePointer&);
- MultiplePointer& operator= (const MultiplePointer&);
-};
-
-} // namespace Pointers
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/scroller.hpp Wed Sep 7 06:11:48 2011
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLER_HPP
-
-#include "pingus.hpp"
-
-namespace Input {
-
-/// abstract base class defining the scroller interface
-class Scroller {
-public:
- Scroller() { }
- virtual ~Scroller() { }
-
- /// returns the scroll delta in X direction
- virtual const float& get_x_delta() const =0;
-
- /// returns the scroll delta in Y direction
- virtual const float& get_y_delta() const =0;
-
- /// writes the X/Y scroll delta into it's parameters
- virtual void get_delta(float&, float&) const =0;
-
- virtual void update(float) =0;
-
-private:
- Scroller(const Scroller&);
- Scroller& operator= (const Scroller&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/scroller_factory.cpp Wed Sep 7 06:11:48 2011
+++ /dev/null
@@ -1,154 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <stdlib.h>
-
-#include "axis.hpp"
-#include "axis_factory.hpp"
-#include "button.hpp"
-#include "button_factory.hpp"
-#include "pingus_error.hpp"
-#include "pointer.hpp"
-#include "pointer_factory.hpp"
-#include "scroller_factory.hpp"
-#include "scrollers/axis_scroller.hpp"
-#include "scrollers/inverted_scroller.hpp"
-#include "scrollers/joystick_scroller.hpp"
-#include "scrollers/mouse_scroller.hpp"
-#include "scrollers/multiple_scroller.hpp"
-#include "scrollers/pointer_scroller.hpp"
-
-namespace Input {
-
-using namespace Scrollers;
-
-Scroller*
-ScrollerFactory::create(const FileReader& reader)
-{
- if (reader.get_name() == "axis-scroller")
- return axis_scroller(reader);
-
- else if (reader.get_name() == "inverted-scroller")
- return inverted_scroller(reader);
-
- else if (reader.get_name() == "joystick-scroller")
- return joystick_scroller(reader);
-
- else if (reader.get_name() == "mouse-scroller")
- return mouse_scroller(reader);
-
- else if (reader.get_name() == "multiple-scroller")
- return multiple_scroller(reader);
-
- else if (reader.get_name() == "pointer-scroller")
- return pointer_scroller(reader);
-
- else
- throw std::runtime_error(std::string("Unknown scroller type: ") +
reader.get_name());
-
- return 0; // never reached
-}
-
-Scroller*
-ScrollerFactory::axis_scroller(const FileReader& reader)
-{
- float speed;
- if (!reader.read_float("speed", speed))
- throw std::runtime_error("AxisScroller without speed parameter");
-
- std::vector<Axis*> axes;
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin() + 1;
- i != sections.end(); ++i)
- axes.push_back(AxisFactory::create(*i));
-
- return new AxisScroller(axes, speed);
-}
-
-Scroller*
-ScrollerFactory::inverted_scroller(const FileReader& reader)
-{
- bool invert_x;
- if (!reader.read_bool("invert-x", invert_x))
- throw std::runtime_error("InvertedScroller without invert X
parameter");
-
- bool invert_y;
- if (!reader.read_bool("invert-y", invert_y))
- throw std::runtime_error("InvertedScroller without invert Y
parameter");
-
- Scroller* scroller;
- scroller = create(reader);
-
- return new InvertedScroller(scroller, invert_x, invert_y);
-}
-
-Scroller*
-ScrollerFactory::joystick_scroller(const FileReader& reader)
-{
- int id;
- if (!reader.read_int("id", id))
- throw std::runtime_error("JoystickScroller without id parameter");
-
- float speed;
- if (!reader.read_float("speed", speed))
- throw std::runtime_error("JoystickScroller without speed parameter");
-
- return new JoystickScroller(id, speed);
-}
-
-Scroller*
-ScrollerFactory::mouse_scroller (const FileReader& reader)
-{
- int id = 0;
- reader.read_int("id", id);
- return new MouseScroller(id);
-}
-
-Scroller*
-ScrollerFactory::multiple_scroller(const FileReader& reader)
-{
- std::vector<Scroller*> scrollers;
-
- const std::vector<FileReader>& sections = reader.get_sections();
- for(std::vector<FileReader>::const_iterator i = sections.begin();
- i != sections.end(); ++i)
- {
- scrollers.push_back(create(*i));
- }
-
- return new MultipleScroller(scrollers);
-}
-
-Scroller*
-ScrollerFactory::pointer_scroller(const FileReader& reader)
-{
- Pointer* pointer;
- Button* button;
-
- const std::vector<FileReader>& sections = reader.get_sections();
-
- if (sections.size() != 2)
- throw std::runtime_error("ScrollerFactory isn't <pointer><button>");
-
- pointer = PointerFactory::create(sections[0]);
- button = ButtonFactory::create(sections[1]);
-
- return new PointerScroller(pointer, button);
-}
-
-} // namespace Input
-
-/* EOF */
=======================================
--- /src/engine/input_old/scroller_factory.hpp Wed Sep 7 06:11:48 2011
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLER_FACTORY_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLER_FACTORY_HPP
-
-#include "file_reader.hpp"
-
-namespace Input {
-
-class Scroller;
-
-class ScrollerFactory
-{
-private:
- static Scroller* axis_scroller(const FileReader& reader);
- static Scroller* inverted_scroller(const FileReader& reader);
- static Scroller* joystick_scroller(const FileReader& reader);
- static Scroller* mouse_scroller(const FileReader& reader);
- static Scroller* multiple_scroller(const FileReader& reader);
- static Scroller* pointer_scroller(const FileReader& reader);
-
-public:
- static Scroller* create(const FileReader& reader);
-
-private:
- ScrollerFactory();
- ScrollerFactory(const ScrollerFactory&);
- ScrollerFactory& operator= (const ScrollerFactory&);
-};
-
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/scrollers/axis_scroller.cpp Wed Sep 7 06:11:48
2011
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 <assert.h>
-
-#include "../../debug.hpp"
-#include "../../math.hpp"
-#include "../axis.hpp"
-#include "axis_scroller.hpp"
-
-namespace Input {
-namespace Scrollers {
-
-AxisScroller::AxisScroller(const std::vector<Axis*>& axes_, float speed_)
- : axes(axes_),
- speed(speed_),
- x_delta(0),
- y_delta(0)
-{
- assert(axes.size() > 1);
- assert(axes[0]->get_angle() != axes[1]->get_angle());
-}
-
-AxisScroller::~AxisScroller()
-{
- for (unsigned int i=0; i < axes.size(); ++i)
- delete axes[i];
-}
-
-const float&
-AxisScroller::get_x_delta() const
-{
- return x_delta;
-}
-
-const float&
-AxisScroller::get_y_delta() const
-{
- return y_delta;
-}
-
-void
-AxisScroller::get_delta(float& x, float& y) const
-{
- x = x_delta;
- y = y_delta;
-}
-
-void
-AxisScroller::update(float delta)
-{
- x_delta = 0;
- y_delta = 0;
-
- for (std::vector<Axis*>::const_iterator it = axes.begin(); it !=
axes.end(); it++)
- {
- (*it)->update(delta);
-
- x_delta += (float)Math::cos((*it)->get_angle() * Math::pi / 180) *
speed * delta * (*it)->get_pos();
- y_delta += (float)Math::sin((*it)->get_angle() * Math::pi / 180) *
speed * delta * (*it)->get_pos();
- }
-
-}
-
-} // namespace Scrollers
-} // namespace Input
-
-/* EOF */
-
=======================================
--- /src/engine/input_old/scrollers/axis_scroller.hpp Wed Sep 7 06:11:49
2011
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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_ENGINE_INPUT_OLD_SCROLLERS_AXIS_SCROLLER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLERS_AXIS_SCROLLER_HPP
-
-#include <vector>
-
-#include "../scroller.hpp"
-
-namespace Input {
-
-class Axis;
-
-namespace Scrollers {
-
-/**
- @brief create a Scroller out of two or more axes
-
- XML definition: <axis-scroller speed="?"> <axis 1>...<axis N>
</axis-scroller>
-
- This class requires at least two axes whereby it's enforced that the
first
- two have different angles.
-*/
-class AxisScroller : public Scroller {
-private:
- const std::vector<Axis*> axes;
-
- const float speed;
- float x_delta;
- float y_delta;
-
-public:
- AxisScroller(const std::vector<Axis*>& axes_, float speed_);
- ~AxisScroller();
-
- const float& get_x_delta() const;
- const float& get_y_delta() const;
-
- void get_delta(float& x, float& y) const;
-
- void update(float delta);
-
-private:
- AxisScroller(const AxisScroller&);
- AxisScroller& operator= (const AxisScroller&);
-};
-
-} // namespace Scroller
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
--- /src/engine/input_old/scrollers/dummy_scroller.hpp Wed Sep 7 06:11:49
2011
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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_ENGINE_INPUT_OLD_SCROLLERS_DUMMY_SCROLLER_HPP
-#define HEADER_PINGUS_ENGINE_INPUT_OLD_SCROLLERS_DUMMY_SCROLLER_HPP
-
-#include "../scroller.hpp"
-
-namespace Input {
-namespace Scrollers {
-
-/**
- @brief dummy class to be used if an Scroller is required but none
defined
-
- XML definition: none
-*/
-class DummyScroller : public Scroller {
-private:
- const float delta;
-
-public:
-
- DummyScroller () : delta(0) { }
-
- const float& get_x_delta () const { return delta; }
- const float& get_y_delta () const { return delta; }
-
- void get_delta (float& x_delta, float& y_delta) const { x_delta =
delta; y_delta = delta; }
-
- void update (float) { }
-
-private:
- DummyScroller (const DummyScroller&);
- DummyScroller& operator= (const DummyScroller&);
-};
-
-} // namespace Scrollers
-} // namespace Input
-
-#endif
-
-/* EOF */
=======================================
***Additional files exist in this changeset.***
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] [pingus] push by address@hidden - Removed unused src/engine/input_old/ on 2011-09-07 12:02 GMT,
pingus <=