Jump to content

Handling keyboard inpt


Feelx234

Recommended Posts

Hallo there,

 

I'd like to handle keyboard input for my mod "Nice Dropship (De) Briefing". Unfortunately I have only found this entry on keyboard inputs:

http://forums.nexusmods.com/index.php?/topic/3840700-handling-keyboard-input-from-uiscreenlistener-extension/?hl=%2Bkeyboard&do=findComment&comment=34962335

which is pretty vague when it comes to how to actually do things. (Create Dummy class derived from UIScreen & use OnUnrealCommand???)

So how are keyboard presses handled in XCom 2 and how could a mod do stuff on keyboard press?

 

Link to comment
Share on other sites

you just put stuff like this into your UIScreen class

simulated function bool OnUnrealCommand(int cmd, int arg)
{
	if( !CheckInputIsReleaseOrDirectionRepeat(cmd, arg) )
		return false;

	switch( cmd )
	{
		case class'UIUtilities_Input'.const.FXS_BUTTON_B:
		case class'UIUtilities_Input'.const.FXS_KEY_ESCAPE:
		case class'UIUtilities_Input'.const.FXS_R_MOUSE_DOWN:
			OnCancel();
			break; 
	}

	return super.OnUnrealCommand(cmd, arg);
}

This example is how you implement closing a screen (OnCancel() function) with ESC/Controller button B/Right click

Note that screens don't catch listen to all input, you can listen to ctrl/alt/esc/arrows/mouse clicks/controller buttons

Edited by bountygiver
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...