Win32 API 日本語リファレンス
ホームUI.Input.GameInput › GameInputForceFeedbackParams

GameInputForceFeedbackParams

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

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

フィールド

フィールドサイズx64x86説明
kindGameInputForceFeedbackEffectKind4+0+0フォースフィードバックエフェクトの種別を示す値である。
data_data_e__Union104+8+8kindに応じたエフェクトパラメータを保持する共用体である。

共用体: _data_e__Union x64 104B / x86 104B

フィールドサイズx64x86
constantGameInputForceFeedbackConstantParams80+0+0
rampGameInputForceFeedbackRampParams104+0+0
sineWaveGameInputForceFeedbackPeriodicParams88+0+0
squareWaveGameInputForceFeedbackPeriodicParams88+0+0
triangleWaveGameInputForceFeedbackPeriodicParams88+0+0
sawtoothUpWaveGameInputForceFeedbackPeriodicParams88+0+0
sawtoothDownWaveGameInputForceFeedbackPeriodicParams88+0+0
springGameInputForceFeedbackConditionParams52+0+0
frictionGameInputForceFeedbackConditionParams52+0+0
damperGameInputForceFeedbackConditionParams52+0+0
inertiaGameInputForceFeedbackConditionParams52+0+0

各言語での定義

#include <windows.h>

// GameInputForceFeedbackParams  (x64 112 / x86 112 バイト)
typedef struct GameInputForceFeedbackParams {
    GameInputForceFeedbackEffectKind kind;
    _data_e__Union data;
} GameInputForceFeedbackParams;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackParams
{
    public int kind;
    public _data_e__Union data;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackParams
    Public kind As Integer
    Public data As _data_e__Union
End Structure
import ctypes
from ctypes import wintypes

class GameInputForceFeedbackParams(ctypes.Structure):
    _fields_ = [
        ("kind", ctypes.c_int),
        ("data", _data_e__Union),
    ]
#[repr(C)]
pub struct GameInputForceFeedbackParams {
    pub kind: i32,
    pub data: _data_e__Union,
}
import "golang.org/x/sys/windows"

type GameInputForceFeedbackParams struct {
	kind int32
	data _data_e__Union
}
type
  GameInputForceFeedbackParams = record
    kind: Integer;
    data: _data_e__Union;
  end;
const GameInputForceFeedbackParams = extern struct {
    kind: i32,
    data: _data_e__Union,
};
type
  GameInputForceFeedbackParams {.bycopy.} = object
    kind: int32
    data: _data_e__Union
struct GameInputForceFeedbackParams
{
    int kind;
    _data_e__Union data;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputForceFeedbackParams サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; kind : GameInputForceFeedbackEffectKind (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; data : _data_e__Union (+8, 104byte)  varptr(st)+8 を基点に操作(104byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputForceFeedbackParams
    #field int kind
    #field byte data 104
#endstruct

stdim st, GameInputForceFeedbackParams        ; NSTRUCT 変数を確保
st->kind = 100
mes "kind=" + st->kind
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。