Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Input Manager

This topic is 5452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i'm writing an InputManager to handle all kind of input devices (keyboard, mouse, HMD, ...), that user choose to catch. To do this, i want some kind of interface (class Input) that every device must re-write to capture data and return to user. Two hours later i thought: "every device returns different information"...and two hours later, i realized that it was the way how DirectInput manages information (i hate myself for being so predictable). Anyway, with that kind of Input Manager I must give some interface:
class InputManager{
	map<std::string, Input*> inputMap;


class Input{
		virtual ~Input();

		virtual Input* create() = 0;
		virtual InputState* capture() = 0;

//where InputState must be the structure to fill by the device

//but i don't know what struct is it:

template<class InputDevice, class InputStruct>
class Input{
		virtual ~Input(){};

		virtual InputDevice*	create() = 0;
		virtual InputStruct*	getState() = 0;
Now i know the structure...but i can't map<> it None of these would work... the problem raises from that different types of structure for every device. If I use templates with Input interface, i can't use that map<> association (because Input<> has no especific type) and if i don't, i can't get any device information (because i can't generalize a structure). How can i solve that return structure (¿void*? )? Is there a better way to manage input info? while(true){ Thanks(); } [edited by - SS05870 on August 13, 2003 7:11:12 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!