Original Post
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:
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]
class InputManager{
map<std::string, Input*> inputMap;
//...
};
class Input{
public:
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{
public:
Input(){};
virtual ~Input(){};
virtual InputDevice* create() = 0;
virtual InputStruct* getState() = 0;
};
Now i know the structure...but i can't map<> it