Page 1 of 1

Looking for a good approach to insert/substitute markers for controller hints

Posted: 17 Apr 2021, 05:56
by Rocko Bonaparte
I have images for just about ever keyboard key, mouse control, and various gamepad controllers. I have bindings from my controllers to actions and I'd like to show the images of these keys/buttons/joysticks when prompted. I'm trying to figure out a good approach for this.

I have two generation scenarios:
1. Controller setup. I'd like to show all the bindings using their icons. So I have a button per binding, the binding's action as a name, and then the binding icons.
2. Inserted into text. I'd also like for tutorials and such to be able to dynamically insert these icons into various text. This would also include the continue prompt for a scrolling dialog. So something like: "Press :use: to open this door" would turn into something like "Press [image of use button, like the E key on my keyboard] to open this door [bottom of prompt has binding displayed for closing prompt which would be E key or Q key]"

I was lead to believe there's some cool stuff I can do with text controls to insert stuff like this, but I don't know if Noesis can handle them. It's also been awhile since I asked about it and forgot the specific feature; I am looking it up. Regardless, I thought I'd ask here for a Noesis-friendly method for this. Do any of the demonstrations do anything like this?

Re: Looking for a good approach to insert/substitute markers for controller hints

Posted: 19 Apr 2021, 10:43
by sfernandez
You can have a binding converter (IValueConverter) that transforms a button name into an ImageSource.

You could use it on the screen that allow users select their control mapping and in text too:
  <Run Text="Press"/>
    <Image Source="{Binding Button, Converter={StaticResource ImageButtonConverter}}"/>
  <Run Text="to continue"/>