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

GameInputForceFeedbackConditionParams

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

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

フィールド

フィールドサイズx64x86説明
magnitudeGameInputForceFeedbackMagnitude28+0+0条件エフェクトの基準となる力の大きさである。
positiveCoefficientFLOAT4+28+28正方向変位に対する力の係数である。
negativeCoefficientFLOAT4+32+32負方向変位に対する力の係数である。
maxPositiveMagnitudeFLOAT4+36+36正方向の最大力の大きさである。
maxNegativeMagnitudeFLOAT4+40+40負方向の最大力の大きさである。
deadZoneFLOAT4+44+44力を生じさせない不感帯の幅である。
biasFLOAT4+48+48条件の中心位置を示すオフセット(バイアス)である。

各言語での定義

#include <windows.h>

// GameInputForceFeedbackMagnitude  (x64 28 / x86 28 バイト)
typedef struct GameInputForceFeedbackMagnitude {
    FLOAT linearX;
    FLOAT linearY;
    FLOAT linearZ;
    FLOAT angularX;
    FLOAT angularY;
    FLOAT angularZ;
    FLOAT normal;
} GameInputForceFeedbackMagnitude;

// GameInputForceFeedbackConditionParams  (x64 52 / x86 52 バイト)
typedef struct GameInputForceFeedbackConditionParams {
    GameInputForceFeedbackMagnitude magnitude;
    FLOAT positiveCoefficient;
    FLOAT negativeCoefficient;
    FLOAT maxPositiveMagnitude;
    FLOAT maxNegativeMagnitude;
    FLOAT deadZone;
    FLOAT bias;
} GameInputForceFeedbackConditionParams;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackMagnitude
{
    public float linearX;
    public float linearY;
    public float linearZ;
    public float angularX;
    public float angularY;
    public float angularZ;
    public float normal;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackConditionParams
{
    public GameInputForceFeedbackMagnitude magnitude;
    public float positiveCoefficient;
    public float negativeCoefficient;
    public float maxPositiveMagnitude;
    public float maxNegativeMagnitude;
    public float deadZone;
    public float bias;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackMagnitude
    Public linearX As Single
    Public linearY As Single
    Public linearZ As Single
    Public angularX As Single
    Public angularY As Single
    Public angularZ As Single
    Public normal As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackConditionParams
    Public magnitude As GameInputForceFeedbackMagnitude
    Public positiveCoefficient As Single
    Public negativeCoefficient As Single
    Public maxPositiveMagnitude As Single
    Public maxNegativeMagnitude As Single
    Public deadZone As Single
    Public bias As Single
End Structure
import ctypes
from ctypes import wintypes

class GameInputForceFeedbackMagnitude(ctypes.Structure):
    _fields_ = [
        ("linearX", ctypes.c_float),
        ("linearY", ctypes.c_float),
        ("linearZ", ctypes.c_float),
        ("angularX", ctypes.c_float),
        ("angularY", ctypes.c_float),
        ("angularZ", ctypes.c_float),
        ("normal", ctypes.c_float),
    ]

class GameInputForceFeedbackConditionParams(ctypes.Structure):
    _fields_ = [
        ("magnitude", GameInputForceFeedbackMagnitude),
        ("positiveCoefficient", ctypes.c_float),
        ("negativeCoefficient", ctypes.c_float),
        ("maxPositiveMagnitude", ctypes.c_float),
        ("maxNegativeMagnitude", ctypes.c_float),
        ("deadZone", ctypes.c_float),
        ("bias", ctypes.c_float),
    ]
#[repr(C)]
pub struct GameInputForceFeedbackMagnitude {
    pub linearX: f32,
    pub linearY: f32,
    pub linearZ: f32,
    pub angularX: f32,
    pub angularY: f32,
    pub angularZ: f32,
    pub normal: f32,
}

#[repr(C)]
pub struct GameInputForceFeedbackConditionParams {
    pub magnitude: GameInputForceFeedbackMagnitude,
    pub positiveCoefficient: f32,
    pub negativeCoefficient: f32,
    pub maxPositiveMagnitude: f32,
    pub maxNegativeMagnitude: f32,
    pub deadZone: f32,
    pub bias: f32,
}
import "golang.org/x/sys/windows"

type GameInputForceFeedbackMagnitude struct {
	linearX float32
	linearY float32
	linearZ float32
	angularX float32
	angularY float32
	angularZ float32
	normal float32
}

type GameInputForceFeedbackConditionParams struct {
	magnitude GameInputForceFeedbackMagnitude
	positiveCoefficient float32
	negativeCoefficient float32
	maxPositiveMagnitude float32
	maxNegativeMagnitude float32
	deadZone float32
	bias float32
}
type
  GameInputForceFeedbackMagnitude = record
    linearX: Single;
    linearY: Single;
    linearZ: Single;
    angularX: Single;
    angularY: Single;
    angularZ: Single;
    normal: Single;
  end;

  GameInputForceFeedbackConditionParams = record
    magnitude: GameInputForceFeedbackMagnitude;
    positiveCoefficient: Single;
    negativeCoefficient: Single;
    maxPositiveMagnitude: Single;
    maxNegativeMagnitude: Single;
    deadZone: Single;
    bias: Single;
  end;
const GameInputForceFeedbackMagnitude = extern struct {
    linearX: f32,
    linearY: f32,
    linearZ: f32,
    angularX: f32,
    angularY: f32,
    angularZ: f32,
    normal: f32,
};

const GameInputForceFeedbackConditionParams = extern struct {
    magnitude: GameInputForceFeedbackMagnitude,
    positiveCoefficient: f32,
    negativeCoefficient: f32,
    maxPositiveMagnitude: f32,
    maxNegativeMagnitude: f32,
    deadZone: f32,
    bias: f32,
};
type
  GameInputForceFeedbackMagnitude {.bycopy.} = object
    linearX: float32
    linearY: float32
    linearZ: float32
    angularX: float32
    angularY: float32
    angularZ: float32
    normal: float32

  GameInputForceFeedbackConditionParams {.bycopy.} = object
    magnitude: GameInputForceFeedbackMagnitude
    positiveCoefficient: float32
    negativeCoefficient: float32
    maxPositiveMagnitude: float32
    maxNegativeMagnitude: float32
    deadZone: float32
    bias: float32
struct GameInputForceFeedbackMagnitude
{
    float linearX;
    float linearY;
    float linearZ;
    float angularX;
    float angularY;
    float angularZ;
    float normal;
}

struct GameInputForceFeedbackConditionParams
{
    GameInputForceFeedbackMagnitude magnitude;
    float positiveCoefficient;
    float negativeCoefficient;
    float maxPositiveMagnitude;
    float maxNegativeMagnitude;
    float deadZone;
    float bias;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputForceFeedbackConditionParams サイズ: 52 バイト(x64)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; magnitude : GameInputForceFeedbackMagnitude (+0, 28byte)  varptr(st)+0 を基点に操作(28byte:入れ子/配列)
; positiveCoefficient : FLOAT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; negativeCoefficient : FLOAT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; maxPositiveMagnitude : FLOAT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; maxNegativeMagnitude : FLOAT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; deadZone : FLOAT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; bias : FLOAT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GameInputForceFeedbackMagnitude
    #field float linearX
    #field float linearY
    #field float linearZ
    #field float angularX
    #field float angularY
    #field float angularZ
    #field float normal
#endstruct

#defstruct global GameInputForceFeedbackConditionParams
    #field GameInputForceFeedbackMagnitude magnitude
    #field float positiveCoefficient
    #field float negativeCoefficient
    #field float maxPositiveMagnitude
    #field float maxNegativeMagnitude
    #field float deadZone
    #field float bias
#endstruct

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