diff --git a/doc/samples/btphystest.cpp b/doc/samples/btphystest.cpp
index a8e2cfde..b2e0a009 100644
--- a/doc/samples/btphystest.cpp
+++ b/doc/samples/btphystest.cpp
@@ -72,7 +72,8 @@ void BtPhysTest::InitApp()
#endif //CAT_MODE
/* Register an input controller for the keyboard */
- m_controller = new Controller("Default", KEY_MAX, 0);
+ m_controller = new Controller("Default");
+ m_controller->SetInputCount(KEY_MAX, 0);
m_controller->GetKey(KEY_MOVE_FORWARD).Bind("Keyboard", "Up");
m_controller->GetKey(KEY_MOVE_BACK).Bind("Keyboard", "Down");
m_controller->GetKey(KEY_MOVE_LEFT).Bind("Keyboard", "Left");
diff --git a/doc/samples/meshviewer.cpp b/doc/samples/meshviewer.cpp
index 1e7cabe8..fd2b95fd 100644
--- a/doc/samples/meshviewer.cpp
+++ b/doc/samples/meshviewer.cpp
@@ -264,7 +264,8 @@ public:
#if NO_NACL_EM_INPUT
/* Register an input controller for the keyboard */
- m_controller = new Controller("Default", MAX_KEYS, MAX_AXIS);
+ m_controller = new Controller("Default");
+ m_controller->SetInputCount(MAX_KEYS, MAX_AXIS);
if (InputDevice::Get(g_name_mouse.C()))
{
diff --git a/doc/samples/meshviewer.vcxproj b/doc/samples/meshviewer.vcxproj
index f7b884f5..6e7c4ae2 100644
--- a/doc/samples/meshviewer.vcxproj
+++ b/doc/samples/meshviewer.vcxproj
@@ -53,6 +53,9 @@
true
+
+ true
+
true
diff --git a/doc/tutorial/07_input.cpp b/doc/tutorial/07_input.cpp
index 5291904f..d9c9d493 100644
--- a/doc/tutorial/07_input.cpp
+++ b/doc/tutorial/07_input.cpp
@@ -24,7 +24,8 @@ class InputTutorial : public WorldEntity
public:
InputTutorial()
{
- m_controller = new Controller("Default", KEY_MAX, AXIS_MAX);
+ m_controller = new Controller("Default");
+ m_controller->SetInputCount(KEY_MAX, AXIS_MAX);
m_keyboard = InputDevice::Get("Keyboard");
if (m_keyboard)
diff --git a/doc/tutorial/12_voronoi.cpp b/doc/tutorial/12_voronoi.cpp
index f524bda5..b718d5ea 100644
--- a/doc/tutorial/12_voronoi.cpp
+++ b/doc/tutorial/12_voronoi.cpp
@@ -62,7 +62,8 @@ public:
m_time = .0f;
m_timer = -1.0f;
mode = 0;
- m_controller = new Controller("Default", KEY_MAX, 0);
+ m_controller = new Controller("Default");
+ m_controller->SetInputCount(KEY_MAX, 0);
m_controller->GetKey(KEY_ESC).Bind("Keyboard", "Escape");
m_controller->GetKey(KEY_PUSH).Bind("Keyboard", "p");
m_controller->GetKey(KEY_POP).Bind("Keyboard", "o");
diff --git a/src/input/controller.cpp b/src/input/controller.cpp
index dc440874..90c9e710 100644
--- a/src/input/controller.cpp
+++ b/src/input/controller.cpp
@@ -226,12 +226,10 @@ float AxisBinding::RetrieveCurrentValue()
array Controller::controllers;
//-----------------------------------------------------------------------------
-Controller::Controller(String const &name, int nb_keys, int nb_axis)
+Controller::Controller(String const &name)
{
m_gamegroup = GAMEGROUP_BEFORE;
m_name = name;
- m_keys.Resize(nb_keys);
- m_axis.Resize(nb_axis);
m_activate_nextframe = true;
m_deactivate_nextframe = false;
m_active = false;
@@ -243,7 +241,7 @@ Controller::Controller(String const &name, int nb_keys, int nb_axis)
}
Controller::Controller(String const &name, InputProfile const& profile)
- : Controller(name, 0, 0)
+ : Controller(name)
{
Init(profile);
}
@@ -261,6 +259,34 @@ Controller::~Controller()
}
}
+//Init mode 1: Input profile system -------------------------------------------
+void Controller::Init(InputProfile const& profile)
+{
+ UnbindProfile();
+ BindProfile(profile);
+}
+void Controller::ClearProfile()
+{
+ UnbindProfile();
+}
+
+//Init mode 2: By hand, key/axis by key/axis ----------------------------------
+void Controller::SetInputCount(int nb_keys, int nb_axis)
+{
+ m_keys.Resize(nb_keys);
+ m_axis.Resize(nb_axis);
+}
+
+//GetKeys/Axis stuff ----------------------------------------------------------
+KeyBinding& Controller::GetKey(int index)
+{
+ return m_keys[index];
+}
+AxisBinding& Controller::GetAxis(int index)
+{
+ return m_axis[index];
+}
+
//-----------------------------------------------------------------------------
Controller* Controller::Get(String const &name)
{
diff --git a/src/input/controller.h b/src/input/controller.h
index 0685a023..e7271044 100644
--- a/src/input/controller.h
+++ b/src/input/controller.h
@@ -315,7 +315,7 @@ private:
class Controller : public Entity
{
public:
- Controller(String const &name, int nb_keys = 0, int nb_axis = 0);
+ Controller(String const &name);
Controller(String const &name, InputProfile const& setup);
virtual ~Controller();
@@ -328,20 +328,16 @@ public:
/** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */
static array DeactivateAll();
- /** Input profile system */
- void Init(InputProfile const& profile)
- {
- UnbindProfile();
- BindProfile(profile);
- }
- void ClearProfile()
- {
- UnbindProfile();
- }
+ /** Init mode 1: Input profile system */
+ void Init(InputProfile const& profile);
+ void ClearProfile();
+
+ /** Init mode 2: By hand, key/axis by key/axis */
+ void SetInputCount(int nb_keys, int nb_axis);
/** GetKeys/Axis stuff */
- KeyBinding& GetKey(int index) { return m_keys[index]; }
- AxisBinding& GetAxis(int index) { return m_axis[index]; }
+ KeyBinding& GetKey(int index);
+ AxisBinding& GetAxis(int index);
static Controller* Get(String const &name);
diff --git a/src/lol/sys/threadtypes.h b/src/lol/sys/threadtypes.h
index 34f4b885..02070c40 100644
--- a/src/lol/sys/threadtypes.h
+++ b/src/lol/sys/threadtypes.h
@@ -26,10 +26,10 @@ class DefaultThreadManager : public BaseThreadManager
{
public:
DefaultThreadManager(int thread_count)
- : DefaultThreadManager(thread_count, thread_count)
+ : BaseThreadManager(thread_count, thread_count)
{ }
DefaultThreadManager(int thread_count, int thread_min)
- : DefaultThreadManager(thread_count, thread_min)
+ : BaseThreadManager(thread_count, thread_min)
{ }
char const *GetName() { return ""; }