예제 #1
0
        /// <summary>
        /// Handles all Keypresses by publishing the keys that are down to their topic
        /// </summary>
        /// <param name="keyboardState">The current state of the keyboard</param>
        private void HandleInput()
        {
            handler.GetInputs();

            //Loop through each Key in the dictionary
            foreach (Key key in KeyTopicDictionary.Keys)
            {
                //If that key was "down" (pressed)
                if (handler.isKeyDown(key))
                {
                    mLogger.Debug(string.Format("Key {0} was pressed, sending message to {1}", key.ToString(), KeyTopicDictionary[key]));
                    KeypressMessage msg = new KeypressMessage();
                    mContext.MessageRouter.SendMessage(KeyTopicDictionary[key], msg);
                }
            }
        }