Win32 API 日本語リファレンス
ホームUI.InteractionContext › INTERACTION_ARGUMENTS_MANIPULATION

INTERACTION_ARGUMENTS_MANIPULATION

構造体
サイズx64: 60 バイト / x86: 60 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
deltaMANIPULATION_TRANSFORM20+0+0前回からの変化分の変換量(MANIPULATION_TRANSFORM)。
cumulativeMANIPULATION_TRANSFORM20+20+20操作開始からの累積変換量(MANIPULATION_TRANSFORM)。
velocityMANIPULATION_VELOCITY16+40+40現在の操作速度(MANIPULATION_VELOCITY)。慣性計算に用いる。
railsStateMANIPULATION_RAILS_STATE4+56+56レール(軸拘束)の状態。水平・垂直などへの移動制限を示す。

各言語での定義

#include <windows.h>

// MANIPULATION_TRANSFORM  (x64 20 / x86 20 バイト)
typedef struct MANIPULATION_TRANSFORM {
    FLOAT translationX;
    FLOAT translationY;
    FLOAT scale;
    FLOAT expansion;
    FLOAT rotation;
} MANIPULATION_TRANSFORM;

// MANIPULATION_VELOCITY  (x64 16 / x86 16 バイト)
typedef struct MANIPULATION_VELOCITY {
    FLOAT velocityX;
    FLOAT velocityY;
    FLOAT velocityExpansion;
    FLOAT velocityAngular;
} MANIPULATION_VELOCITY;

// INTERACTION_ARGUMENTS_MANIPULATION  (x64 60 / x86 60 バイト)
typedef struct INTERACTION_ARGUMENTS_MANIPULATION {
    MANIPULATION_TRANSFORM delta;
    MANIPULATION_TRANSFORM cumulative;
    MANIPULATION_VELOCITY velocity;
    MANIPULATION_RAILS_STATE railsState;
} INTERACTION_ARGUMENTS_MANIPULATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MANIPULATION_TRANSFORM
{
    public float translationX;
    public float translationY;
    public float scale;
    public float expansion;
    public float rotation;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MANIPULATION_VELOCITY
{
    public float velocityX;
    public float velocityY;
    public float velocityExpansion;
    public float velocityAngular;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INTERACTION_ARGUMENTS_MANIPULATION
{
    public MANIPULATION_TRANSFORM delta;
    public MANIPULATION_TRANSFORM cumulative;
    public MANIPULATION_VELOCITY velocity;
    public int railsState;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MANIPULATION_TRANSFORM
    Public translationX As Single
    Public translationY As Single
    Public scale As Single
    Public expansion As Single
    Public rotation As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MANIPULATION_VELOCITY
    Public velocityX As Single
    Public velocityY As Single
    Public velocityExpansion As Single
    Public velocityAngular As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INTERACTION_ARGUMENTS_MANIPULATION
    Public delta As MANIPULATION_TRANSFORM
    Public cumulative As MANIPULATION_TRANSFORM
    Public velocity As MANIPULATION_VELOCITY
    Public railsState As Integer
End Structure
import ctypes
from ctypes import wintypes

class MANIPULATION_TRANSFORM(ctypes.Structure):
    _fields_ = [
        ("translationX", ctypes.c_float),
        ("translationY", ctypes.c_float),
        ("scale", ctypes.c_float),
        ("expansion", ctypes.c_float),
        ("rotation", ctypes.c_float),
    ]

class MANIPULATION_VELOCITY(ctypes.Structure):
    _fields_ = [
        ("velocityX", ctypes.c_float),
        ("velocityY", ctypes.c_float),
        ("velocityExpansion", ctypes.c_float),
        ("velocityAngular", ctypes.c_float),
    ]

class INTERACTION_ARGUMENTS_MANIPULATION(ctypes.Structure):
    _fields_ = [
        ("delta", MANIPULATION_TRANSFORM),
        ("cumulative", MANIPULATION_TRANSFORM),
        ("velocity", MANIPULATION_VELOCITY),
        ("railsState", ctypes.c_int),
    ]
#[repr(C)]
pub struct MANIPULATION_TRANSFORM {
    pub translationX: f32,
    pub translationY: f32,
    pub scale: f32,
    pub expansion: f32,
    pub rotation: f32,
}

#[repr(C)]
pub struct MANIPULATION_VELOCITY {
    pub velocityX: f32,
    pub velocityY: f32,
    pub velocityExpansion: f32,
    pub velocityAngular: f32,
}

#[repr(C)]
pub struct INTERACTION_ARGUMENTS_MANIPULATION {
    pub delta: MANIPULATION_TRANSFORM,
    pub cumulative: MANIPULATION_TRANSFORM,
    pub velocity: MANIPULATION_VELOCITY,
    pub railsState: i32,
}
import "golang.org/x/sys/windows"

type MANIPULATION_TRANSFORM struct {
	translationX float32
	translationY float32
	scale float32
	expansion float32
	rotation float32
}

type MANIPULATION_VELOCITY struct {
	velocityX float32
	velocityY float32
	velocityExpansion float32
	velocityAngular float32
}

type INTERACTION_ARGUMENTS_MANIPULATION struct {
	delta MANIPULATION_TRANSFORM
	cumulative MANIPULATION_TRANSFORM
	velocity MANIPULATION_VELOCITY
	railsState int32
}
type
  MANIPULATION_TRANSFORM = record
    translationX: Single;
    translationY: Single;
    scale: Single;
    expansion: Single;
    rotation: Single;
  end;

  MANIPULATION_VELOCITY = record
    velocityX: Single;
    velocityY: Single;
    velocityExpansion: Single;
    velocityAngular: Single;
  end;

  INTERACTION_ARGUMENTS_MANIPULATION = record
    delta: MANIPULATION_TRANSFORM;
    cumulative: MANIPULATION_TRANSFORM;
    velocity: MANIPULATION_VELOCITY;
    railsState: Integer;
  end;
const MANIPULATION_TRANSFORM = extern struct {
    translationX: f32,
    translationY: f32,
    scale: f32,
    expansion: f32,
    rotation: f32,
};

const MANIPULATION_VELOCITY = extern struct {
    velocityX: f32,
    velocityY: f32,
    velocityExpansion: f32,
    velocityAngular: f32,
};

const INTERACTION_ARGUMENTS_MANIPULATION = extern struct {
    delta: MANIPULATION_TRANSFORM,
    cumulative: MANIPULATION_TRANSFORM,
    velocity: MANIPULATION_VELOCITY,
    railsState: i32,
};
type
  MANIPULATION_TRANSFORM {.bycopy.} = object
    translationX: float32
    translationY: float32
    scale: float32
    expansion: float32
    rotation: float32

  MANIPULATION_VELOCITY {.bycopy.} = object
    velocityX: float32
    velocityY: float32
    velocityExpansion: float32
    velocityAngular: float32

  INTERACTION_ARGUMENTS_MANIPULATION {.bycopy.} = object
    delta: MANIPULATION_TRANSFORM
    cumulative: MANIPULATION_TRANSFORM
    velocity: MANIPULATION_VELOCITY
    railsState: int32
struct MANIPULATION_TRANSFORM
{
    float translationX;
    float translationY;
    float scale;
    float expansion;
    float rotation;
}

struct MANIPULATION_VELOCITY
{
    float velocityX;
    float velocityY;
    float velocityExpansion;
    float velocityAngular;
}

struct INTERACTION_ARGUMENTS_MANIPULATION
{
    MANIPULATION_TRANSFORM delta;
    MANIPULATION_TRANSFORM cumulative;
    MANIPULATION_VELOCITY velocity;
    int railsState;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INTERACTION_ARGUMENTS_MANIPULATION サイズ: 60 バイト(x64)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; delta : MANIPULATION_TRANSFORM (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; cumulative : MANIPULATION_TRANSFORM (+20, 20byte)  varptr(st)+20 を基点に操作(20byte:入れ子/配列)
; velocity : MANIPULATION_VELOCITY (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; railsState : MANIPULATION_RAILS_STATE (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MANIPULATION_TRANSFORM
    #field float translationX
    #field float translationY
    #field float scale
    #field float expansion
    #field float rotation
#endstruct

#defstruct global MANIPULATION_VELOCITY
    #field float velocityX
    #field float velocityY
    #field float velocityExpansion
    #field float velocityAngular
#endstruct

#defstruct global INTERACTION_ARGUMENTS_MANIPULATION
    #field MANIPULATION_TRANSFORM delta
    #field MANIPULATION_TRANSFORM cumulative
    #field MANIPULATION_VELOCITY velocity
    #field int railsState
#endstruct

stdim st, INTERACTION_ARGUMENTS_MANIPULATION        ; NSTRUCT 変数を確保
st->railsState = 100
mes "railsState=" + st->railsState