inputTest.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //-----------------------------------------------------------------------------
  2. // Module creation functions.
  3. //-----------------------------------------------------------------------------
  4. function inputTest::create( %this )
  5. {
  6. }
  7. function inputTest::destroy( %this )
  8. {
  9. }
  10. function inputTest::initClient( %this )
  11. {
  12. exec("./scripts/customProfiles.cs");
  13. exec("./scripts/inputMonitor.cs");
  14. exec("./scripts/gui/inputMonitor.gui");
  15. exec("./scripts/joystickSettings.cs");
  16. exec("./scripts/gui/joystickSettings.gui");
  17. if (isObject(MainMenuGui))
  18. {
  19. %testBtn = new GuiButtonCtrl() {
  20. text = "Input Event Monitor";
  21. groupNum = "-1";
  22. buttonType = "PushButton";
  23. useMouseEvents = "0";
  24. position = "0 0";
  25. extent = "200 40";
  26. minExtent = "8 8";
  27. horizSizing = "right";
  28. vertSizing = "bottom";
  29. profile = "GuiBlankMenuButtonProfile";
  30. visible = "1";
  31. active = "1";
  32. command = "Canvas.pushDialog(InputMonitorDlg);";
  33. tooltipProfile = "GuiToolTipProfile";
  34. isContainer = "0";
  35. canSave = "0";
  36. canSaveDynamicFields = "0";
  37. };
  38. if (!isObject(MMTestContainer))
  39. {
  40. new GuiDynamicCtrlArrayControl(MMTestContainer) {
  41. colCount = "0";
  42. colSize = "200";
  43. rowCount = "0";
  44. rowSize = "40";
  45. rowSpacing = "2";
  46. colSpacing = "0";
  47. frozen = "0";
  48. autoCellSize = "0";
  49. fillRowFirst = "1";
  50. dynamicSize = "1";
  51. padding = "0 0 0 0";
  52. position = "0 0";
  53. extent = "200 40";
  54. minExtent = "8 2";
  55. horizSizing = "right";
  56. vertSizing = "bottom";
  57. profile = "GuiDefaultProfile";
  58. visible = "1";
  59. active = "1";
  60. tooltipProfile = "GuiToolTipProfile";
  61. hovertime = "1000";
  62. isContainer = "1";
  63. canSave = "0";
  64. canSaveDynamicFields = "0";
  65. };
  66. MainMenuGui.add(MMTestContainer);
  67. }
  68. MMTestContainer.add(%testBtn);
  69. }
  70. }
  71. function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType)
  72. {
  73. echo("onSDLDeviceConnected(" @ %sdlIndex @ ", \"" @ %deviceName @ "\", \"" @ %deviceType @ "\") - Called");
  74. // Note: This is called before the device is automatically processed to allow
  75. // overrides, so refreshing the gui needs to happen after the device has been opened
  76. if (JoystickSettingsDlg.isAwake())
  77. JoystickSettingsDlg.schedule(250, "updateDevices");
  78. if (InputMonitorDlg.isAwake())
  79. InputMonitorDlg.schedule(250, "updateDevicesLine");
  80. }
  81. function onSDLDeviceDisconnected(%sdlIndex)
  82. {
  83. echo("onSDLDeviceDisconnected(" @ %sdlIndex @ ") - Called");
  84. if (JoystickSettingsDlg.isAwake())
  85. JoystickSettingsDlg.schedule(250, "updateDevices");
  86. if (InputMonitorDlg.isAwake())
  87. InputMonitorDlg.schedule(250, "updateDevicesLine");
  88. }
  89. function listAllGCMappings()
  90. { // Lists all game controller device mappings that are currently installed
  91. %numMappings = SDLInputManager::GameControllerNumMappings();
  92. for (%i = 0; %i < %numMappings; %i++)
  93. echo(SDLInputManager::GameControllerMappingForIndex(%i));
  94. }