Sierra

Dynamically update UI based on input?

30 Sep 2024, 15:11

Hey, is there a way to dynamically update UI by detecting what the input type is (keyboard/mouse, gamepad, touch)?

Does such a thing exist that I can use as a trigger to say change the Source property of an Image?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Dynamically update UI based on input?

02 Oct 2024, 11:12

Do you mean in response to an event? So for a MouseDown you will do something, for a KeyDown a different thing, etc.
You can use EventTriggers for that, can't you?

If you are talking about something more generic, that knowing if game is being interacted with a mouse/keyboard, or only a gamepad, then that is something that only the application knows and can expose it in a global ViewModel that the UI can use to apply changes by using DataTriggers.
 
Sierra

Re: Dynamically update UI based on input?

03 Oct 2024, 08:47

Do you mean in response to an event? So for a MouseDown you will do something, for a KeyDown a different thing, etc.
You can use EventTriggers for that, can't you?

If you are talking about something more generic, that knowing if game is being interacted with a mouse/keyboard, or only a gamepad, then that is something that only the application knows and can expose it in a global ViewModel that the UI can use to apply changes by using DataTriggers.
Hey, yes, I'm talking about a general listener whether the game is being interacted with a mouse/keyboard or with a gamepad. Our use case is that we have button prompts with icons. We would like to update those icons to keyboard/mouse ones if the user is using KB/M and to gamepad ones if they are playing with a gamepad.
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: Dynamically update UI based on input?

03 Oct 2024, 11:54

The challenge is that multiple input devices (keyboard, mouse, touch, gamepad) can be used simultaneously in Noesis, making it difficult to provide a single listener that handles all possible corner cases in your game. I believe this issue should be addressed on the integration side of Noesis. Since your engine is injecting input into each view, you could make this information available in your DataContext.

Please, let me know your thoughts about this.

Who is online

Users browsing this forum: No registered users and 2 guests