Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller support? #5

Open
ghost opened this issue Sep 2, 2017 · 4 comments
Open

Controller support? #5

ghost opened this issue Sep 2, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 2, 2017

Would it be possible to add controller support for the mod? I saw someone else mention it in the steam comments as well, and their suggestion to use left thumbstick click to display the usage popup would be swell.

@robojumper
Copy link
Collaborator

Intercepting input is tricky.
Looks like War of the Chosen (finally) fixed Tooltips though, so it should be very easy to add a way to show tooltips on the selected item.
For those who don't have WotC, the Community Highlander mod has the same fix as WotC included, so it should be possible to catch both versions with a single update.

@ghost
Copy link
Author

ghost commented Sep 2, 2017

I always assumed that when they added xinput controller support to the game they would have updated the sdk in a way that mods could have controller support as well. I was hoping that it could be a simple hotkey bind, basically.

@ravn5
Copy link

ravn5 commented Apr 2, 2018

I'm trying to add controller support that would work like this:

  1. Add listener code for say right trigger as documented in Highlander #198
  2. When right trigger is held trigger the hover mouse event for the UsableImage or just call "ShowToolTip".

However, I'm not entirely sure if it's actually possible to trigger the Tooltip without hovering the mouse so maybe this solution is impossible... The documentation is quite lacking.

@robojumper Any tips or advice on how to proceed?

@robojumper
Copy link
Collaborator

robojumper commented Apr 2, 2018

@ravn5 UIOptionsPCScreen has an example for how to trigger tooltips "manually". When an item is selected with a controller (UIList has a callback for when the selection changes), do something like this:

ActiveTooltip = UITextTooltip(`PRESBASE.m_kTooltipMgr.GetTooltipByID(SELECTED_PANEL.OUR_SPAWNED_UIIMAGE.CachedTooltipID));
ActiveTooltip.SetFollowMouse(false);
ActiveTooltip.SetTooltipPosition(X, Y);
ActiveTooltip.SetDelay(0.0);
ActiveTooltip.ShowTooltip();
`PRESBASE.m_kTooltipMgr.ActivateTooltip(ActiveTooltip);

Single problem: GetTooltipByID is actually broken in vanilla (we fixed it in the vanilla Highlander, and Firaxis fixed it for WotC only).

You will have to do some special things to get a reference to SELECTED_PANEL.OUR_SPAWNED_UIIMAGE, I recommend spawning it with a specific InitName and retrieving the Image control with GetChildByName.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants