pyxen.input.touches
터치스크린 입력에 접근합니다 (모바일 및 태블릿).
touches = pyxen.input.touches
터치 지원 감지
if input.touches.present:
log("platform supports touches")
순회
for t in touches:
if t.started:
print(t.id, t.pos)
인덱싱
if len(touches) > 0:
pos = touches[0].pos
player.x = pos.x
Touch 객체
각 Touch는 다음을 노출합니다:
| 속성 | 타입 | 설명 |
|---|---|---|
id | int | 고유 터치 ID |
pos | Vector2 | 위치 |
delta | Vector2 | 이동 |
pressure | float | 압력 (지원되는 경우) |
started | bool | 첫 프레임에서 True |
ended | bool | 놓을 때 True |
모든 필드는 읽기 전용입니다.
개수
count = touches.count
또는
len(touches)
예시: 탭 감지
for t in touches:
if t.started:
spawn_explosion(t.pos)
참고
- 최대 터치 수는 엔진에 의해 정의
- 안전한 순회
- 범위 밖 인덱스는 에러 발생