Game Development Community

Engine Code Question

by Adam Lindsay · in Torque X 3D · 05/14/2009 (7:08 am) · 3 replies

Maybe some of the more advanced coders can help answer this. In the InputComponent.cs file of the FPS project there is the following code in the _SetupInput method:

...
// control toggle
inputMap.BindAction(gamepad, (int)XGamePadDevice.GamePadObjects.Y, ToggleControlObject);

// do keyboard
{
// wasd
inputMap.BindMove(keyboard, (int)Keys.D, MoveMapTypes.StickDigitalRight, 0);
inputMap.BindMove(keyboard, (int)Keys.A, MoveMapTypes.StickDigitalLeft, 0);
...
}

I understand the concept of scope but, my question is why are the keyboard bindings done in a separate scope that the rest of the code? I have never used this in practical use and I was curious as to what the benefit is.

Thanks in advance.

EDIT: spelling..

#1
05/14/2009 (10:54 am)
No reason or benefit whatsoever. It's a mistake by whoever wrote the original code.
#2
05/14/2009 (11:18 am)
@Peter:

Good to know...Thanks.
#3
11/26/2009 (10:47 pm)
Probably a mistake in this case, though not always a mistake, more so a style. I've seen coders use it to group related statements, especially seeing VS has auto indent!