REGoth-project / REGoth

OpenSource-Reimplementation of the zEngine, used by the game "Gothic"
GNU General Public License v3.0
631 stars 62 forks source link

Input Refactoring & Mousewheel Selection in Menus #313

Closed HunterwolfAT closed 6 years ago

HunterwolfAT commented 6 years ago

Refactored input system, as HUD was not controlled by the system defined in PlatformGLFW. Now it is, fixing #255, but also allowing mouse input for HUDs, which has been implemented, addressing #306.

This is my first pull request to a project of this size. I would appreciate detailed critique, should you have any, as I see this as a valuable learning experience. Thank you for your time!

markusobi commented 6 years ago

There is a small issue with the Input while the console is open. When typing text all bindings are now fired, but some probably shouldn't. Certain input should be ignored:

The only functionality that is essential when the console is open is: Closing the Console via F10 / Esc.

That's why previously all bindings were not fired, when the Console is open. It's hard to find an elegant solution for this.

Another thing, that might cause issues in the future: The flag CameraController::m_Active and the corespondending method setActive. It doesn't work well, when this method is used more than once. Consider something like this:

enableCameraBecauseOfSomeReason(false); // sets m_Active=false
enableActionsFirstandThirdPerson(false); // sets m_Active=false
enableActionsFirstandThirdPerson(true); //sets m_Active=true
enableCameraBecauseOfSomeReason(true); // sets m_Active=true

Overlapping setActive calls cause inconsistent states. One save way is to be stateless or calling setActive only once per frame. Something like: setActive(Condition1 && Condition2)

HunterwolfAT commented 6 years ago

I am still thinking about a more elegant way to solve these things, but for now I dealt with the issue by using what I have so far. Please let me know if you find more unexpected behaviour. The only thing I find is that when using the tp command, the camera only follows the player after opening and closing a menu.

HunterwolfAT commented 6 years ago

I have solved all problems that I am aware of and think this is ready for merging. Please test and let me know what you think, any other problems or concerns.