ホーム › UI.Input.GameInput › GameInputFlightStickState
GameInputFlightStickState
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| buttons | GameInputFlightStickButtons | 4 | +0 | +0 | フライトスティックの押下ボタンを示すフラグである。 |
| hatSwitch | GameInputSwitchPosition | 4 | +4 | +4 | ハットスイッチの方向位置を示す値である。 |
| roll | FLOAT | 4 | +8 | +8 | ロール軸の入力値を-1〜1で示す。 |
| pitch | FLOAT | 4 | +12 | +12 | ピッチ軸の入力値を-1〜1で示す。 |
| yaw | FLOAT | 4 | +16 | +16 | ヨー軸の入力値を-1〜1で示す。 |
| throttle | FLOAT | 4 | +20 | +20 | スロットルの入力値を0〜1で示す。 |
各言語での定義
#include <windows.h>
// GameInputFlightStickState (x64 24 / x86 24 バイト)
typedef struct GameInputFlightStickState {
GameInputFlightStickButtons buttons;
GameInputSwitchPosition hatSwitch;
FLOAT roll;
FLOAT pitch;
FLOAT yaw;
FLOAT throttle;
} GameInputFlightStickState;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputFlightStickState
{
public int buttons;
public int hatSwitch;
public float roll;
public float pitch;
public float yaw;
public float throttle;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputFlightStickState
Public buttons As Integer
Public hatSwitch As Integer
Public roll As Single
Public pitch As Single
Public yaw As Single
Public throttle As Single
End Structureimport ctypes
from ctypes import wintypes
class GameInputFlightStickState(ctypes.Structure):
_fields_ = [
("buttons", ctypes.c_int),
("hatSwitch", ctypes.c_int),
("roll", ctypes.c_float),
("pitch", ctypes.c_float),
("yaw", ctypes.c_float),
("throttle", ctypes.c_float),
]#[repr(C)]
pub struct GameInputFlightStickState {
pub buttons: i32,
pub hatSwitch: i32,
pub roll: f32,
pub pitch: f32,
pub yaw: f32,
pub throttle: f32,
}import "golang.org/x/sys/windows"
type GameInputFlightStickState struct {
buttons int32
hatSwitch int32
roll float32
pitch float32
yaw float32
throttle float32
}type
GameInputFlightStickState = record
buttons: Integer;
hatSwitch: Integer;
roll: Single;
pitch: Single;
yaw: Single;
throttle: Single;
end;const GameInputFlightStickState = extern struct {
buttons: i32,
hatSwitch: i32,
roll: f32,
pitch: f32,
yaw: f32,
throttle: f32,
};type
GameInputFlightStickState {.bycopy.} = object
buttons: int32
hatSwitch: int32
roll: float32
pitch: float32
yaw: float32
throttle: float32struct GameInputFlightStickState
{
int buttons;
int hatSwitch;
float roll;
float pitch;
float yaw;
float throttle;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputFlightStickState サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; buttons : GameInputFlightStickButtons (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hatSwitch : GameInputSwitchPosition (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; roll : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pitch : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; yaw : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; throttle : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GameInputFlightStickState
#field int buttons
#field int hatSwitch
#field float roll
#field float pitch
#field float yaw
#field float throttle
#endstruct
stdim st, GameInputFlightStickState ; NSTRUCT 変数を確保
st->buttons = 100
mes "buttons=" + st->buttons