UDN
Search public documentation:

LogitechLCDSDK
한국어

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 LCD SDK for Unreal

Logitech Gaming LCD SDK for Unreal


Overview


The Logitech Gaming LCD SDK enables applications such as games to control the LCDs on supported Logitech gaming mice and keyboards. It can be easily integrated in a UDK game by using DLLBind. Please refer to the Logitech SDK’s Doc\LogitechGamingLCDSDK.pdf for details on the SDK’s functionality.

Making the LCD 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(LogitechLcd);

dllimport final function bool LogiLcdInit(string friendlyName, int lcdType);
dllimport final function bool LogiLcdIsConnected(int lcdType);
dllimport final function bool LogiLcdIsButtonPressed(int button);
dllimport final function bool LogiLcdUpdate();
dllimport final function bool LogiLcdShutdown();
dllimport final function bool LogiLcdMonoSetText(int lineNumber, string text);
dllimport final function int LogiLcdColorSetBackgroundUDK(byte colorBitmap[2048], int arraySize);
dllimport final function int LogiLcdColorResetBackgroundUDK();
dllimport final function int LogiLcdMonoSetBackgroundUDK(byte monoBitmap[2048], int arraySize);
dllimport final function int LogiLcdMonoResetBackgroundUDK();
dllimport final function bool LogiLcdColorSetTitle(string text, int red , int green , int blue );
dllimport final function bool LogiLcdColorSetText(int lineNumber, string text, int red, int green, int blue);

exec function LogitechLCDInit(string friendlyName, int lcdType)
{
   local bool ret;
   ret = LogiLcdInit(friendlyName, lcdType);
   say("LogitechLCDInit return is: " $ret);
}

exec function LogitechLCDIsConnected(int lcdType)
{
   local bool ret;
   ret = LogiLcdIsConnected(lcdType);
   say("LogitechLCDIsConnected return is: " $ret);
}

exec function LogitechLcdIsButtonPressed(int button)
{
   local bool ret;
   ret = true;
   ret = LogiLcdIsButtonPressed(button);
   say("LogitechLcdIsButtonPressed return is: " $ret);
}

exec function LogitechLcdUpdate()
{
   local bool ret;
   ret = LogiLcdUpdate();
   say("LogitechLcdUpdate return is: " $ret);
}

exec function LogitechLcdShutdown()
{
   LogiLcdShutdown();
   say("LogitechLcd SDK shutting down...");
}

exec function LogitechLcdMonoSetText(int lineNumber, string text)
{
   local bool ret;
   ret = LogiLcdMonoSetText(lineNumber, text);
   say("LogitechLcdMonoSetBackground return is: " $ret);
}

exec function LogitechLcdColorSetPageBackGround(int blue, int green, int red, int alpha)
{
   local int i;
   local int byteAdded;
   local byte pixelMatrix[2048];
   byteAdded = 1;

   for(i=0; i<2048; i++)
   {
      if((i%4) == 0) pixelMatrix[i] = byte(blue); // blue
      if((i%4) == 1) pixelMatrix[i] = byte(green); // green
      if((i%4) == 2) pixelMatrix[i] = byte(red); // red
      if((i%4) == 3) pixelMatrix[i] = byte(alpha); // alpha
   }

   while(byteAdded > 0)
   {
      byteAdded = LogiLcdColorSetBackgroundUDK(pixelMatrix, 2048);
   }
   if (byteAdded == 0) say("Color page Background set successfully");
   else say("Error setting color page background " $byteAdded);
   LogiLcdUpdate();
}

exec function LogitechLcdMonoSetPageBackGround(int blackOrWhite)
{
   local int byteAdded;
   local int i;
   local byte pixelMatrix[2048];
   byteAdded = 1;

   for(i=0; i<2048; i++)
   {
      pixelMatrix[i] = blackOrWhite;
   }

   while(byteAdded > 0)
   {
      byteAdded = LogiLcdMonoSetBackgroundUDK(pixelMatrix, 2048);
   }
   if (byteAdded == 0) say("Mono page Background set successfully");
   else say("Error setting mono page background " $byteAdded);
   LogiLcdUpdate();
}

exec function LogitechLcdMonoResetBitmap()
{
   local int ret;
   ret = LogiLcdMonoResetBackgroundUDK();
   say("LogitechLcdMonoResetBKG return is: " $ret);
}

exec function LogitechLcdColorResetBitmap()
{
   local int ret;
   ret = LogiLcdColorResetBackgroundUDK();
   say("LogitechLcdColorResetBKG return is: " $ret);
}

exec function LogitechLcdColorSetTitle(string text, int red , int green , int blue )
{
   local bool ret;
   ret = LogiLcdColorSetTitle(text, red, green, blue);
   say("LogitechLcdColorSetTitle return is: " $ret);
}

exec function LogitechLcdColorSetText(int lineNumber, string text, int red, int green, int blue)
{
   local bool ret;
   ret = LogiLcdColorSetText(lineNumber, text, red, green, blue);
   say("LogitechLcdColorSetText return is: " $ret);
}

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: LogitechLCDInit, and then hit key. You should see the " LogiLCDInit return is: TRUE” message. To effectively see the app running on your LCD you need to call the LogitechLcdUpdate at least once. To keep your app updated on the lcd you have to call this function every frame of your game.

Then use the other commands as defined in the Unreal Script file: * LogitechLCDIsConnected * LogitechLcdIsButtonPressed * LogitechLcdUpdate * LogitechLcdShutdown * LogitechLcdMonoSetText * LogitechLcdColorSetPageBackGround * LogitechLcdMonoSetPageBackGround * LogitechLcdMonoResetBitmap * LogitechLcdColorResetBitmap * LogitechLcdColorSetTitle * LogitechLcdColorSetText * LogitechLcdColorSetText

UDK DLLBind specific functions definitions

Due to the limitation of the UnrealScript language of the static byte array size to 2048, to send bitmaps to the LCDs, you will have to use the UDK specific functions.

In the UdkDLLBindInstructions.pdf document in the download package, it's explained how to handle this limitation in those functions that take the byte array as parameter.

Downloads