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

GameInputForceFeedbackMagnitude

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

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

フィールド

フィールドサイズx64x86説明
linearXFLOAT4+0+0X軸方向の直線力の大きさを-1〜1で指定する。
linearYFLOAT4+4+4Y軸方向の直線力の大きさを-1〜1で指定する。
linearZFLOAT4+8+8Z軸方向の直線力の大きさを-1〜1で指定する。
angularXFLOAT4+12+12X軸まわりの回転力の大きさを-1〜1で指定する。
angularYFLOAT4+16+16Y軸まわりの回転力の大きさを-1〜1で指定する。
angularZFLOAT4+20+20Z軸まわりの回転力の大きさを-1〜1で指定する。
normalFLOAT4+24+24面法線方向の力の大きさを-1〜1で指定する。

各言語での定義

#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;
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;
}
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
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),
    ]
#[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,
}
import "golang.org/x/sys/windows"

type GameInputForceFeedbackMagnitude struct {
	linearX float32
	linearY float32
	linearZ float32
	angularX float32
	angularY float32
	angularZ float32
	normal float32
}
type
  GameInputForceFeedbackMagnitude = record
    linearX: Single;
    linearY: Single;
    linearZ: Single;
    angularX: Single;
    angularY: Single;
    angularZ: Single;
    normal: Single;
  end;
const GameInputForceFeedbackMagnitude = extern struct {
    linearX: f32,
    linearY: f32,
    linearZ: f32,
    angularX: f32,
    angularY: f32,
    angularZ: f32,
    normal: f32,
};
type
  GameInputForceFeedbackMagnitude {.bycopy.} = object
    linearX: float32
    linearY: float32
    linearZ: float32
    angularX: float32
    angularY: float32
    angularZ: float32
    normal: float32
struct GameInputForceFeedbackMagnitude
{
    float linearX;
    float linearY;
    float linearZ;
    float angularX;
    float angularY;
    float angularZ;
    float normal;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputForceFeedbackMagnitude サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; linearX : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; linearY : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; linearZ : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; angularX : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; angularY : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; angularZ : FLOAT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; normal : FLOAT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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

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