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

GameInputRacingWheelState

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

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

フィールド

フィールドサイズx64x86説明
buttonsGameInputRacingWheelButtons4+0+0レーシングホイールの押下ボタンを示すフラグである。
patternShifterGearINT4+4+4パターンシフターの現在のギア位置である。
wheelFLOAT4+8+8ステアリングの回転量を-1〜1で示す。
throttleFLOAT4+12+12アクセルの踏み込み量を0〜1で示す。
brakeFLOAT4+16+16ブレーキの踏み込み量を0〜1で示す。
clutchFLOAT4+20+20クラッチの踏み込み量を0〜1で示す。
handbrakeFLOAT4+24+24ハンドブレーキの操作量を0〜1で示す。

各言語での定義

#include <windows.h>

// GameInputRacingWheelState  (x64 28 / x86 28 バイト)
typedef struct GameInputRacingWheelState {
    GameInputRacingWheelButtons buttons;
    INT patternShifterGear;
    FLOAT wheel;
    FLOAT throttle;
    FLOAT brake;
    FLOAT clutch;
    FLOAT handbrake;
} GameInputRacingWheelState;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputRacingWheelState
{
    public int buttons;
    public int patternShifterGear;
    public float wheel;
    public float throttle;
    public float brake;
    public float clutch;
    public float handbrake;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputRacingWheelState
    Public buttons As Integer
    Public patternShifterGear As Integer
    Public wheel As Single
    Public throttle As Single
    Public brake As Single
    Public clutch As Single
    Public handbrake As Single
End Structure
import ctypes
from ctypes import wintypes

class GameInputRacingWheelState(ctypes.Structure):
    _fields_ = [
        ("buttons", ctypes.c_int),
        ("patternShifterGear", ctypes.c_int),
        ("wheel", ctypes.c_float),
        ("throttle", ctypes.c_float),
        ("brake", ctypes.c_float),
        ("clutch", ctypes.c_float),
        ("handbrake", ctypes.c_float),
    ]
#[repr(C)]
pub struct GameInputRacingWheelState {
    pub buttons: i32,
    pub patternShifterGear: i32,
    pub wheel: f32,
    pub throttle: f32,
    pub brake: f32,
    pub clutch: f32,
    pub handbrake: f32,
}
import "golang.org/x/sys/windows"

type GameInputRacingWheelState struct {
	buttons int32
	patternShifterGear int32
	wheel float32
	throttle float32
	brake float32
	clutch float32
	handbrake float32
}
type
  GameInputRacingWheelState = record
    buttons: Integer;
    patternShifterGear: Integer;
    wheel: Single;
    throttle: Single;
    brake: Single;
    clutch: Single;
    handbrake: Single;
  end;
const GameInputRacingWheelState = extern struct {
    buttons: i32,
    patternShifterGear: i32,
    wheel: f32,
    throttle: f32,
    brake: f32,
    clutch: f32,
    handbrake: f32,
};
type
  GameInputRacingWheelState {.bycopy.} = object
    buttons: int32
    patternShifterGear: int32
    wheel: float32
    throttle: float32
    brake: float32
    clutch: float32
    handbrake: float32
struct GameInputRacingWheelState
{
    int buttons;
    int patternShifterGear;
    float wheel;
    float throttle;
    float brake;
    float clutch;
    float handbrake;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputRacingWheelState サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; buttons : GameInputRacingWheelButtons (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; patternShifterGear : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; wheel : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; throttle : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; brake : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; clutch : FLOAT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; handbrake : FLOAT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputRacingWheelState
    #field int buttons
    #field int patternShifterGear
    #field float wheel
    #field float throttle
    #field float brake
    #field float clutch
    #field float handbrake
#endstruct

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