Question about Game.Components and input

Game.Components seems like it’s for holding graphical components, like a HUD or menus. What is the preferred method is for storing an Input component? Should it be part of my main object (inherited from Game)? Is there something like Game.Components for control related objects?

Thanks!

You can use Game.Components for any kind of GameComponent. It’s fine to put your input helper in there, I always do that too because it’s the quickest way to set it up :slight_smile:

You could use my little class here and wrap it in a game-component… or not…

1 Like

Thanks for your reply. I did some more reading and found this link, https://stackoverflow.com/questions/5458760/game-architecture/5459955#5459955 , which gives some good advice on general game architecture. It advocates a system of custom interfaces vs using the GameComponent or DrawableGameComponent. It does a good job explaining the shortcomings of those objects, which it seems likely I will run into. Check it out.

1 Like

I agree with him. I don’t use the GameComponent stuff a lot either. Just for quick setup of things like Input and some debugging tools (e.g. a framerate counter).

1 Like

Thanks throbax, this seems really useful. In fact, your GitHub site is full of useful things!

Nice to hear. Thx. (…20 character limit :slight_smile: )