UDN
Search public documentation:

LogitechLCDSDKKR
English Translation

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 홈 > 인풋 / 아웃풋 > 언리얼용 로지텍 게이밍 LCD SDK

언리얼용 로지텍 게이밍 LCD SDK


문서 변경내역: Christophe Juncker 작성. 홍성진 번역.

개요


로지텍 게이밍 LCD SDK 로 게임과 같은 어플리케이션에서 LCD 가 지원되는 로지텍 게이밍 마우스와 키보드의 LCD 를 조절할 수 있습니다. DLLBine 를 사용해서 UDK 게임에 쉽게 통합시킬 수 있습니다. SDK 의 함수성 관련 자세한 내용은 로지텍 SDK 의 Doc\LogitechGamingLCDSDK.pdf 문서를 참고해 주시기 바랍니다.

UDKGame 에서 LCD SDK 작동하게 만들기


UDK 에 포함된 "UDKGame" 에서 로지텍 SDK 가 작동하도록 만드는 법을 단계별로 살펴보겠습니다. 이대로 자신의 게임에 적용해 주시면 됩니다.

단계

  • UDK 다운로드 (http://www.unrealengine.com/udk/).
  • 다음 두 개의 UnrealScript 파일을 만든 다음 UDK 의 Development\Src\MyMod\Classes 폴더에 복사합니다:

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);
}

게임에서 로지텍 SDK 함수 호출하기

다음과 같이 게임을 실행합니다:
  • Binaries\Win32\UDK.exe dm-deck?game=MyMod.TestDLLGameInfo

게임 실행 중 (~ 키를 쳐) 콘솔을 열고 LogitechLCDInit 라고 입력한 다음 엔터키를 칩니다. 그러면 "LogiLCDInit return is: TRUE" 메시지가 보입니다. LCD 에서 앱이 실제 실행되는 것을 확인하려면 LogitechLcdUpdate 를 최소 한 번은 호출해 줘야 합니다. LCD 에 앱의 업데이트 상태를 유지하려면, 게임 매 프레임마다 이 함수를 호출해 줘야 합니다.

그런 다음 UnrealScript 파일에 정의된 대로 다른 명령을 사용합니다: * LogitechLCDIsConnected * LogitechLcdIsButtonPressed * LogitechLcdUpdate * LogitechLcdShutdown * LogitechLcdMonoSetText * LogitechLcdColorSetPageBackGround * LogitechLcdMonoSetPageBackGround * LogitechLcdMonoResetBitmap * LogitechLcdColorResetBitmap * LogitechLcdColorSetTitle * LogitechLcdColorSetText * LogitechLcdColorSetText

UDK DLLBind 전용 함수 정의

UnrealScript 언어 자체적으로 static byte 배열 크기 한계가 2048 이기 때문에, LCD 에 비트맵을 전송하려면 UDK 전용 함수를 사용해야 합니다.

다운로드 패키지에 있는 UdkDLLBindInstructions.pdf 문서에, byte 배열을 파라미터로 받는 그러한 함수들에서 이러한 한계를 처리하는 방법이 설명되어 있습니다.

다운로드