hedgewars/uInputHandler.pas
changeset 7026 8d1724e1337e
parent 6994 28805595b9ec
child 7048 0a4c88935902
--- a/hedgewars/uInputHandler.pas	Sat May 05 17:19:33 2012 +0100
+++ b/hedgewars/uInputHandler.pas	Sat May 05 17:29:04 2012 +0100
@@ -39,7 +39,6 @@
 procedure SetDefaultBinds;
 
 procedure ControllerInit;
-procedure ControllerClose;
 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
 procedure ControllerHatEvent(joy, hat, value: Byte);
 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
@@ -419,14 +418,6 @@
     WriteLnToConsole('Not using any game controller');
 end;
 
-procedure ControllerClose;
-var j: Integer;
-begin
-    if ControllerEnabled > 0 then
-        for j:= 0 to pred(ControllerNumControllers) do
-            SDL_JoystickClose(Controller[j]);
-end;
-
 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
 begin
     ControllerAxes[joy][axis]:= value;
@@ -452,8 +443,12 @@
 end;
 
 procedure freeModule;
+var j: LongInt;
 begin
-
+    // close gamepad controllers
+    if ControllerEnabled > 0 then
+        for j:= 0 to pred(ControllerNumControllers) do
+            SDL_JoystickClose(Controller[j]);
 end;
 
 end.