Rocko Bonaparte
Topic Author
Posts: 39
Joined: 13 Oct 2020, 08:32

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

17 Apr 2021, 05:56

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?
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

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

19 Apr 2021, 10:43

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:
<TextBlock>
  <Run Text="Press"/>
  <InlineUIContainer>
    <Image Source="{Binding Button, Converter={StaticResource ImageButtonConverter}}"/>
  </InlineUIContainer>
  <Run Text="to continue"/>
</TextBlock>

Who is online

Users browsing this forum: maherne and 2 guests