Hi,
I am writing a game engine for UWP. I have a code snippet taken from XNA, checking for if a certain key is pressed (see below). In my game engine I'd rather not use the dedicated event handlers (KeyDown etc), but instead simply check for pressed keys in my game loop. One reason for this is that I can then control for example how often a bullet fires if the key is continuously pressed (using a timer and mod). It would also let the keys be independent of each other, such as up and right arrow key gives diagonal movement for player A, while another player (using the same keyboard) uses keys A and W to move his/her character in another direction, and they both occasionally fire their laser guns.
The code I have found looks like this:
public void DrawHelp()
{
if (Keyboard.GetState().IsKeyDown(Keys.Tab))
{
What I'm thinking of is basically a series of if statements (the code is wrong - it's just to show what I want):
public void CheskKeysPressed()
{
if (Keyboard.GetState().KeyDown.Holds(Keys.Right) &&
(Keyboard.GetState().KeyDown.Holds(Keys.Up))
{
So, is it possible to write something like this in UWP, and if so: How?
Thanks!
Petter
What I have tried:
I've done some searching on Bing and Google for this, but there is still very little info on UWP.