comp380team3 / PuzzlePathDimension

Class project for COMP 380 at California State University, Northridge
0 stars 0 forks source link

Input system #28

Closed Jjp137 closed 11 years ago

Jjp137 commented 11 years ago

First of all, thanks to @Twisol for the idea behind everything in this pull request. :)

The commits involved in this pull request implement a virtual controller that allows the game to be input-agonstic, which means that it should not really matter to the game what type of input device is being used. Input is fed to the virtual controller via adapters, which map an input device's controls to the virtual controller's. Included is an adapter for the keyboard and mouse combination. It's left as an exercise for someone to write one for the Xbox 360 controller :p

One can check the state of the inputs by accessing the properties. For digital buttons, there are methods called CheckForRecentPress() and CheckForRecentRelease() that are similar to how you would check the last two frames of keyboard input to see if there's any change between them. I haven't incorporated C# events into the virtual controller yet, but hopefully those two methods should be enough for now.

I still have to update GameplayScreen.cs to use the virtual controller, but for now, I just want to get this out there. Also, if you can think of ways to improve this implementation of the game's input system, feel free to do so. If you think a part of the code is unclear, let me know too. I'm never too sure of my code :p And please test this a lot!

Twisol commented 11 years ago

Thanks, Jorenz, this looks great. Merged in 68cb510.