Jump to content
  • Advertisement

Archived

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

GodsEvening

How to handle user Input ??

This topic is 6025 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

My group is making a game engine,and i have beed assigned to complete a/some class(es) to handle user input.But i haven''t any correct idea how to do it ~~ My idea is: Making a Input manager which contain a linked list to hold all input handler, and input handler is an interface to create all action in the game.
  
HANDLERNODE
{
char* Key_ID;
CINPUTHANDER handler;
HANDLERNODE* Next;
}

CINPUTMANAGER
{
LinkedList<HANDLERNODE> HandlerList;
int totalNode;
void register(char* Key_ID, CINPUTHANDER Handler); 
CINPUTHANDER getHandler(char* Key_ID);
}

CINPUTHANDER
{
virtual void execute();
};

CINPUT
{
Init();
InitKeyboard();
InitMouse();
getInput();
};

//In the game code:


CINPUT input;
CINPUTMANAGER inputManager;

KeyCode key=input.getinput();
for (int i=0; i< totalNode; i++)
{
  hr=getHandle(Key);
  if (hr != NULL)
      hr->execute();
};
  
please give me some suggestions

Share this post


Link to post
Share on other sites
Advertisement

  • 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!