UDN
Search public documentation:

GKeySDK
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Input / Output > Logitech Gaming G-key SDK for Unreal

Logitech Gaming G-key SDK for Unreal


Overview


The Logitech Gaming G-key SDK enables to get the current state of G-keys and extra mouse buttons for supported Logitech gaming mice and keyboards.

It can easily be integrated in a UDK game by using DLLBind.

It only works when the Logitech Gaming Software is running (8.30 or later).

Find the SDK attached as a file at the bottom of this page.

Please refer to the SDK’s Doc\LogitechGamingGkeySDK.pdf for details on the SDK’s functionality.

For questions/comments, email cjuncker@logitech.com, or lbyrne@logitech.com.

Making the G-key SDK work in your UDK game


The following steps show how to make the Logitech SDK work with “UDKGame” that comes as part of the UDK download. Please adapt the steps to your game for things to work.

Steps


TestDLLGameInfo.uc
class TestDLLGameInfo extends GameInfo;

defaultproperties
{
   PlayerControllerClass=class'TestDLLPlayerController'
}

TestDLLPlayerController.uc
class TestDLLPlayerController extends PlayerController
   DLLBind(LogitechGkey);

dllimport final function bool LogiGkeyInitWithoutCallback();
dllimport final function bool LogiGkeyIsMouseButtonPressed(int buttonNumber);
dllimport final function string LogiGkeyGetMouseButtonString(int buttonNumber);
dllimport final function bool LogiGkeyIsKeyboardGkeyPressed(int gkeyNumber, int modeNumber);
dllimport final function string LogiGkeyGetKeyboardGkeyString(int gkeyNumber, int modeNumber);
dllimport final function LogiGkeyShutdown();

exec function LogiInit()
{
   local bool ret;
   ret = LogiGkeyInitWithoutCallback();

   say("LogiGkeyInitWithoutCallback return is: " $ret);
}

exec function LogiIsMouseButtonPressed(int buttonNumber)
{
   local bool ret;
   ret = LogiGkeyIsMouseButtonPressed(buttonNumber);

   say("LogiGkeyIsMouseButtonPressed return is: " $ret);
}

exec function LogiGetMouseButtonString(int buttonNumber)
{
   local string buttonString;
   buttonString = LogiGkeyGetMouseButtonString(buttonNumber);

   say("LogiGetMouseButtonString: " $buttonString);
}

exec function LogiIsKeyboardGkeyPressed(int gkeyNumber, int modeNumber)
{
   local bool ret;
   ret = LogiGkeyIsKeyboardGkeyPressed(gkeyNumber, modeNumber);

   say("LogiGkeyIsKeyboardGkeyPressed return is: " $ret);
}

exec function LogiGetKeyboardGkeyString(int gkeyNumber, int modeNumber)
{
   local string gkeyString;
   gkeyString = LogiGkeyGetKeyboardGkeyString(gkeyNumber, modeNumber);

   say("LogiGkeyGetKeyboardGkeyString: " $gkeyString);
}

exec function LogiShutdown()
{
   LogiGkeyShutdown();

   say("LogiGkeyShutdown done");
}

  • Copy Logitech SDK’s Lib\x86\ LogitechGkey.dll to UDK’s Binaries\Win32\UserCode
  • Copy Logitech SDK’s Lib\x64\ LogitechGkey.dll to UDK’s Binaries\Win64\UserCode
  • Open UDK’s UDKGame\Config\ DefaultEngineUDK.ini file for editing
    • Search for: ModEditPackages=MyMod
    • Remove the ; at the beginning of the line
  • Launch UDK’s Binaries/UnrealFrontend.exe
    • Do: Script->Full recompile

Calling Logitech SDK’s functions from within the game

Launch game the following way:

  • Binaries\Win32\UDK.exe dm-deck?game=MyMod.TestDLLGameInfo

Once the game is running, open the console (hit the ~ key), and type: LogiInit, and then hit key. You should see the "LogiGkeyInitWithoutCallback return is: TRUE” message.

Before trying other commands, especially if trying a mouse, make sure its buttons have been set up to be sent to the Logitech SDK rather than keyboard shortcuts (see Logitech SDK’s Demo\ReadMe.txt).

Then use the other commands as defined in the Unreal Script file:

  • LogiIsMouseButtonPressed
  • LogiGetMouseButtonString
  • LogiIsKeyboardGkeyPressed
  • LogiGetKeyboardGkeyString
  • LogiShutdown

For example to see if a supported keyboard’s G-key 3 in mode 2 is currently pressed, type:

  • LogiIsKeyboardGkeyPressed 3 2

Then hit , all the while holding that G-key down.

NOTE: when you run the ‘LogiInit’ command in the UDK, LGS will automatically create a new profile called UDK if there isn’t one already present. However, note that if you run a version of UDK using different architecture (32-bit vs 64-bit), it will not create another new profile automatically. One must be manually created using the LGS software. Therefore, If you wish to use LGS with both 32-bit and 64-bit UDK.exe, please ensure you have a profile for each executable.

Downloads