PDA

View Full Version : keypress Interaction



bez
12-16-2007, 11:52 AM
how does a keypress interaction work these days anyone got this to work

ive tryed several things and i get nothing


delegate bool OnReceivedNativeInputKey( int ControllerId, name Key, EInputEvent EventType, optional float AmountDepressed=1.f, optional bool bGamepad )
{
if( Key == 'Up')
{
if (EventType == IE_Pressed)
{
LogInternal("Key Pressed:");
return true;
}
else if (EventType == IE_Released)
{
LogInternal("Key Released:");
return true;
}
}
}

Joe Wilcox
12-16-2007, 08:05 PM
OnReceivedNativeInputKey is a delegate. You need something closer to:


function PostInitialized()
{
....
OnReceivedNativeInputKey = MyNativeInputKey;
}
function bool MyNativeInputKey( int ControllerId, name Key, EInputEvent EventType, optional float AmountDepressed=1.f, optional bool bGamepad )
{
if( Key == 'Up')
{
if (EventType == IE_Pressed)
{
LogInternal("Key Pressed:");
return true;
}
else if (EventType == IE_Released)
{
LogInternal("Key Released:");
return true;
}
}
}

Jrubzjeknf
12-17-2007, 06:53 AM
Or you can do:


function bool MyNativeInputKey(int ControllerId, name Key, EInputEvent EventType, optional float AmountDepressed=1.f, optional bool bGamepad)
{
if( Key == 'Up')
{
if (EventType == IE_Pressed)
{
LogInternal("Key Pressed:");
return true;
}
else if (EventType == IE_Released)
{
LogInternal("Key Released:");
return true;
}
}
}

defaultproperties
{
OnReceivedNativeInputKey = MyNativeInputKey
}

bez
12-17-2007, 07:24 AM
thx fellas will give it a try

bez
12-17-2007, 08:22 AM
yeah is working now thx again for the help :D

bonaldo
03-02-2008, 10:29 AM
Can anyone explain where all this code goes? Is it in the actor class or does one have to make a mutator or..?

EDIT: Never mind, I figured it out.