Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ButtonState[] state = new ButtonState[12];
- /// <summary>
- /// Updates the status of the virtual controller.
- /// </summary>
- public void Update()
- {
- PollState();
- for (int i = 0; i < 12; i++)
- {
- state[i] = (ButtonState)(((int)state[i]) >> 1);
- if (IsButtonDown((Buttons)i))
- state[i] |= ButtonState.Pressed;
- }
- }
- }
- /// <summary>
- /// Polls the state of the physical input device.
- /// </summary>
- protected abstract void PollState();
- /// <summary>
- /// Gets the current state of the specified virtual button from the physical input device.
- /// </summary>
- /// <param name="button">Identifies the virtual button whose state should be polled.</param>
- public abstract bool IsButtonDown(Buttons button);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement