一个简单的python包装器,用于logitech g的led和arx sdk。
logip的Python项目详细描述
这个包是Logitech G’s LED and Arx SDKs的python包装器。
使用led sdk访问所有led背光和rgb 罗技G产品的能力。集成自定义密钥的配置文件 配置,开发游戏内效果,或标记关键点以跟踪 对各种命令进行冷却。
arx控件引入了第二屏幕功能,允许ios和 Android移动设备显示游戏内信息、重要系统统计数据 还有更多。关联的sdk使您的代码能够与 ARX控制应用程序。
LED示例
将所有设备照明设置为红色:
from logipy import logi_led import time import ctypes logi_led.logi_led_init() time.sleep(1) # Give the SDK a second to initialize logi_led.logi_led_set_lighting(100, 0, 0) logi_led.logi_led_shutdown()
或者如果您喜欢C/C++风格,您可以直接使用LED dll:
from logipy import logi_led import time import ctypes logi_led.led_dll.LogiLedInit() time.sleep(1) # Give the SDK a second to initialize logi_led.led_dll.LogiLedSetLighting(ctypes.c_int(0), ctypes.c_int(100), ctypes.c_int(0)) logi_led.led_dll.LogiLedShutdown()
加载LED效果的用户配置设置:
from logipy import logi_led import time import ctypes logi_led.led_dll.LogiLedInit() time.sleep(1) # Give the SDK a second to initialize effect_enabled = logi_led.logi_led_get_config_option_bool('effect/enabled', True) # Use a default value if not found effect_duration = logi_led.logi_led_get_config_option_number('effect/duration', 5) effect_color = logi_led.logi_led_get_config_option_color('effect/color', Color(0, 255, 0)) logi_led.logi_led_set_config_option_label('effect', 'Effect Settings') logi_led.logi_led_set_config_option_label('effect/enabled', 'Enabled') logi_led.logi_led_set_config_option_label('effect/duration', 'Duration in seconds') logi_led.logi_led_set_config_option_label('effect/color', 'Color') if effect_enabled: logi_led.logi_led_set_lighting(*effect_color.rgb_percent()) time.sleep(effect_duration) logi_led.led_dll.LogiLedShutdown()
ARX示例
显示带有默认回调的简单小程序:
from logipy import logi_arx import time index = """ <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, target-densityDpi=device-dpi, user-scalable=no" /> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <img id="splash-icon" src="http://gaming.logitech.com/images/logos/gamingLogo-lg.png" /> </body> </html> """ css = """ body { background-color: black; } img { position: absolute; top: 50%; left: 50%; width: 118px; height: 118px; margin-top: -59px; margin-left: -59px; } """ logi_arx.logi_arx_init("com.logitech.gaming.logipy", "LogiPy") time.sleep(1) logi_arx.logi_arx_add_utf8_string_as(index, "index.html", "text/html") logi_arx.logi_arx_add_utf8_string_as(css, "style.css", "text/css") logi_arx.logi_arx_set_index("index.html") logi_arx.logi_arx_shutdown()
显示带有自定义回调的简单小程序:
from logipy import logi_arx import time import ctypes index = """ <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, target-densityDpi=device-dpi, user-scalable=no" /> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <img id="splash-icon" src="http://gaming.logitech.com/images/logos/gamingLogo-lg.png" /> </body> </html> """ css = """ body { background-color: black; } img { position: absolute; top: 50%; left: 50%; width: 118px; height: 118px; margin-top: -59px; margin-left: -59px; } """ def custom_callback(event_type, event_value, event_arg, context): if event_arg and event_arg == 'splash-icon': print "\nNo wonder Logitech is called Logicool in Japan! They are so cool!" logi_arx.logi_arx_init("com.logitech.gaming.logipy", "LogiPy", custom_callback) time.sleep(1) logi_arx.logi_arx_add_utf8_string_as(index, "index.html", "text/html") logi_arx.logi_arx_add_utf8_string_as(css, "style.css", "text/css") logi_arx.logi_arx_set_index("index.html") logi_arx.logi_arx_shutdown()