ホーム › UI.Input.GameInput › GameInputRacingWheelState
GameInputRacingWheelState
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| buttons | GameInputRacingWheelButtons | 4 | +0 | +0 | レーシングホイールの押下ボタンを示すフラグである。 |
| patternShifterGear | INT | 4 | +4 | +4 | パターンシフターの現在のギア位置である。 |
| wheel | FLOAT | 4 | +8 | +8 | ステアリングの回転量を-1〜1で示す。 |
| throttle | FLOAT | 4 | +12 | +12 | アクセルの踏み込み量を0〜1で示す。 |
| brake | FLOAT | 4 | +16 | +16 | ブレーキの踏み込み量を0〜1で示す。 |
| clutch | FLOAT | 4 | +20 | +20 | クラッチの踏み込み量を0〜1で示す。 |
| handbrake | FLOAT | 4 | +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 Structureimport 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: float32struct 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