動きの滑らかさを可視化してみました
"""joyview (Python 3.1 + Pygame 1.9.1) ジョイスティックのスティックの動作を可視化。1秒分の移動を表示します。 0 から 4 までのボタンを押すとその時点の日時を元にしたファイル名での PNG 画像として画面を SAVE します。 """
import time import pygame from pygame.locals import * WIDTH, HEIGHT = 480, 480 RADIUS = 200 COLOR0 = 0, 255, 255 # 点の色 COLOR1 = 255, 0, 255 # 点の色 LINE_COLOR = 255, 255, 0, 128 # 線の色 BG_COLOR = 0, 0, 0 # 背景色 FPS = 60 JOY_X, JOY_Y = 0, 1 def main(): pygame.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) s_rect = screen.get_rect() line_rect = Rect(0, 0, RADIUS * 2 + 1, RADIUS * 2 + 1) line_s = pygame.Surface(line_rect.size, flags=SRCALPHA) line_s.fill((0, 0, 0, 0)) j = pygame.joystick.Joystick(0) j.init() font = pygame.font.Font(None, HEIGHT // 20) joy_name = font.render(j.get_name(), True, (255, 255, 255)) pygame.draw.rect( line_s, LINE_COLOR, line_rect, 1) pygame.draw.line( line_s, LINE_COLOR, line_rect.midleft, line_rect.midright) pygame.draw.line( line_s, LINE_COLOR, line_rect.midtop, line_rect.midbottom) pygame.draw.circle( line_s, LINE_COLOR, line_rect.center, RADIUS, 1) line_rect.center = s_rect.center line_s_pos = line_rect.topleft clock = pygame.time.Clock() caption = j.get_name() clock.tick(FPS) x = y = None positions = [(0, 0)] * FPS frame_no = 0 while True: save = False for e in pygame.event.get(): if e.type == QUIT: return elif e.type == KEYDOWN and e.key is K_ESCAPE: return elif (e.type == JOYBUTTONDOWN and e.joy == 0 and 0 <= e.button <= 4): save = True old_x, old_y = x, y x, y = j.get_axis(0), j.get_axis(1) if old_x != x: print('{0:5d} X {1: f}'.format(frame_no, x)) if old_y != y: print('{0:5d} Y {1: f}'.format(frame_no, y)) positions.append((x, y)) positions = positions[-FPS:] screen.fill(BG_COLOR) screen.blit(joy_name, (5, 5)) for n, (px, py) in enumerate(positions): c = [(fc * n + bc * (FPS - n)) // FPS for fc, bc in zip( (COLOR0, COLOR1)[(frame_no + n) % 2], BG_COLOR)] pygame.draw.circle( screen, c, (int(px * RADIUS + s_rect.centerx), int(py * RADIUS + s_rect.centery)), 5) screen.blit(line_s, line_s_pos) if save: pygame.image.save( screen, '{0:s}.png'.format(time.strftime('%Y%m%dT%H%M%S'))) save = False clock.tick(FPS) pygame.display.flip() pygame.display.set_caption( '{0:5d} X: {1: f} , Y: {2: f}'.format(frame_no, x, y)) frame_no += 1 if __name__ == '__main__': try: main() finally: pygame.quit() # Public Domain. 好きに流用してください。
振動機能・連射機能アナログ 12ボタンUSBゲームパッド - JC-U912Vシリーズ
……うっわぁ。全然違う。つーかもう JC-U912V の方はデジタルパッドとほとんど変りないよ。アナログ入力のゲームで使いにくいはずだ。ELECOM のゲームパッドはみんなこんな、なのかな?
サンワ・エレコム・バッファローのパッドってどう?
FAQ - USBゲームパッドまとめWiki - アットウィキ
……納得。
コンシューマーゲーム機のメーカーオフィシャル品だと大部分のユーザーがそれを使うことになるわけで、ゲーム機そのものの評価に直結してしまうから、それなりに力を入れる必要があるわけですが、サードパーティー製のそれだと「安かろう悪かろう」でも許される。そんなあたりの理由から、なのかな。(でも値段、大差ないんだけどね)