ホーム › UI.Input.GameInput › GameInputTouchState
GameInputTouchState
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| touchId | ULONGLONG | 8 | +0 | +0 | このタッチ接触点を一意に識別するIDである。 |
| sensorIndex | DWORD | 4 | +8 | +8 | 接触を検知したタッチセンサーのインデックスである。 |
| positionX | FLOAT | 4 | +12 | +12 | 接触点のX座標を0〜1の正規化値で示す。 |
| positionY | FLOAT | 4 | +16 | +16 | 接触点のY座標を0〜1の正規化値で示す。 |
| pressure | FLOAT | 4 | +20 | +20 | 接触の圧力を0〜1の正規化値で示す。 |
| proximity | FLOAT | 4 | +24 | +24 | 指などの近接度を0〜1の正規化値で示す。 |
| contactRectTop | FLOAT | 4 | +28 | +28 | 接触領域矩形の上辺を正規化値で示す。 |
| contactRectLeft | FLOAT | 4 | +32 | +32 | 接触領域矩形の左辺を正規化値で示す。 |
| contactRectRight | FLOAT | 4 | +36 | +36 | 接触領域矩形の右辺を正規化値で示す。 |
| contactRectBottom | FLOAT | 4 | +40 | +40 | 接触領域矩形の下辺を正規化値で示す。 |
各言語での定義
#include <windows.h>
// GameInputTouchState (x64 48 / x86 48 バイト)
typedef struct GameInputTouchState {
ULONGLONG touchId;
DWORD sensorIndex;
FLOAT positionX;
FLOAT positionY;
FLOAT pressure;
FLOAT proximity;
FLOAT contactRectTop;
FLOAT contactRectLeft;
FLOAT contactRectRight;
FLOAT contactRectBottom;
} GameInputTouchState;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputTouchState
{
public ulong touchId;
public uint sensorIndex;
public float positionX;
public float positionY;
public float pressure;
public float proximity;
public float contactRectTop;
public float contactRectLeft;
public float contactRectRight;
public float contactRectBottom;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputTouchState
Public touchId As ULong
Public sensorIndex As UInteger
Public positionX As Single
Public positionY As Single
Public pressure As Single
Public proximity As Single
Public contactRectTop As Single
Public contactRectLeft As Single
Public contactRectRight As Single
Public contactRectBottom As Single
End Structureimport ctypes
from ctypes import wintypes
class GameInputTouchState(ctypes.Structure):
_fields_ = [
("touchId", ctypes.c_ulonglong),
("sensorIndex", wintypes.DWORD),
("positionX", ctypes.c_float),
("positionY", ctypes.c_float),
("pressure", ctypes.c_float),
("proximity", ctypes.c_float),
("contactRectTop", ctypes.c_float),
("contactRectLeft", ctypes.c_float),
("contactRectRight", ctypes.c_float),
("contactRectBottom", ctypes.c_float),
]#[repr(C)]
pub struct GameInputTouchState {
pub touchId: u64,
pub sensorIndex: u32,
pub positionX: f32,
pub positionY: f32,
pub pressure: f32,
pub proximity: f32,
pub contactRectTop: f32,
pub contactRectLeft: f32,
pub contactRectRight: f32,
pub contactRectBottom: f32,
}import "golang.org/x/sys/windows"
type GameInputTouchState struct {
touchId uint64
sensorIndex uint32
positionX float32
positionY float32
pressure float32
proximity float32
contactRectTop float32
contactRectLeft float32
contactRectRight float32
contactRectBottom float32
}type
GameInputTouchState = record
touchId: UInt64;
sensorIndex: DWORD;
positionX: Single;
positionY: Single;
pressure: Single;
proximity: Single;
contactRectTop: Single;
contactRectLeft: Single;
contactRectRight: Single;
contactRectBottom: Single;
end;const GameInputTouchState = extern struct {
touchId: u64,
sensorIndex: u32,
positionX: f32,
positionY: f32,
pressure: f32,
proximity: f32,
contactRectTop: f32,
contactRectLeft: f32,
contactRectRight: f32,
contactRectBottom: f32,
};type
GameInputTouchState {.bycopy.} = object
touchId: uint64
sensorIndex: uint32
positionX: float32
positionY: float32
pressure: float32
proximity: float32
contactRectTop: float32
contactRectLeft: float32
contactRectRight: float32
contactRectBottom: float32struct GameInputTouchState
{
ulong touchId;
uint sensorIndex;
float positionX;
float positionY;
float pressure;
float proximity;
float contactRectTop;
float contactRectLeft;
float contactRectRight;
float contactRectBottom;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputTouchState サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; touchId : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; sensorIndex : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; positionX : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; positionY : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pressure : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; proximity : FLOAT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; contactRectTop : FLOAT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; contactRectLeft : FLOAT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; contactRectRight : FLOAT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; contactRectBottom : FLOAT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputTouchState
#field int64 touchId
#field int sensorIndex
#field float positionX
#field float positionY
#field float pressure
#field float proximity
#field float contactRectTop
#field float contactRectLeft
#field float contactRectRight
#field float contactRectBottom
#endstruct
stdim st, GameInputTouchState ; NSTRUCT 変数を確保
st->touchId = 100
mes "touchId=" + st->touchId