Win32 API 日本語リファレンス
ホームGraphics.Direct3D9 › D3DSTATUS

D3DSTATUS

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0更新する状態項目を示すフラグ群。
dwStatusDWORD4+4+4クリップ状態などのステータス値。
drExtentD3DRECT16+8+8描画範囲を示す矩形(D3DRECT)。

各言語での定義

#include <windows.h>

// D3DRECT  (x64 16 / x86 16 バイト)
typedef struct D3DRECT {
    INT x1;
    INT y1;
    INT x2;
    INT y2;
} D3DRECT;

// D3DSTATUS  (x64 24 / x86 24 バイト)
typedef struct D3DSTATUS {
    DWORD dwFlags;
    DWORD dwStatus;
    D3DRECT drExtent;
} D3DSTATUS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DRECT
{
    public int x1;
    public int y1;
    public int x2;
    public int y2;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DSTATUS
{
    public uint dwFlags;
    public uint dwStatus;
    public D3DRECT drExtent;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DRECT
    Public x1 As Integer
    Public y1 As Integer
    Public x2 As Integer
    Public y2 As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DSTATUS
    Public dwFlags As UInteger
    Public dwStatus As UInteger
    Public drExtent As D3DRECT
End Structure
import ctypes
from ctypes import wintypes

class D3DRECT(ctypes.Structure):
    _fields_ = [
        ("x1", ctypes.c_int),
        ("y1", ctypes.c_int),
        ("x2", ctypes.c_int),
        ("y2", ctypes.c_int),
    ]

class D3DSTATUS(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("dwStatus", wintypes.DWORD),
        ("drExtent", D3DRECT),
    ]
#[repr(C)]
pub struct D3DRECT {
    pub x1: i32,
    pub y1: i32,
    pub x2: i32,
    pub y2: i32,
}

#[repr(C)]
pub struct D3DSTATUS {
    pub dwFlags: u32,
    pub dwStatus: u32,
    pub drExtent: D3DRECT,
}
import "golang.org/x/sys/windows"

type D3DRECT struct {
	x1 int32
	y1 int32
	x2 int32
	y2 int32
}

type D3DSTATUS struct {
	dwFlags uint32
	dwStatus uint32
	drExtent D3DRECT
}
type
  D3DRECT = record
    x1: Integer;
    y1: Integer;
    x2: Integer;
    y2: Integer;
  end;

  D3DSTATUS = record
    dwFlags: DWORD;
    dwStatus: DWORD;
    drExtent: D3DRECT;
  end;
const D3DRECT = extern struct {
    x1: i32,
    y1: i32,
    x2: i32,
    y2: i32,
};

const D3DSTATUS = extern struct {
    dwFlags: u32,
    dwStatus: u32,
    drExtent: D3DRECT,
};
type
  D3DRECT {.bycopy.} = object
    x1: int32
    y1: int32
    x2: int32
    y2: int32

  D3DSTATUS {.bycopy.} = object
    dwFlags: uint32
    dwStatus: uint32
    drExtent: D3DRECT
struct D3DRECT
{
    int x1;
    int y1;
    int x2;
    int y2;
}

struct D3DSTATUS
{
    uint dwFlags;
    uint dwStatus;
    D3DRECT drExtent;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DSTATUS サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwStatus : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; drExtent : D3DRECT (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3DRECT
    #field int x1
    #field int y1
    #field int x2
    #field int y2
#endstruct

#defstruct global D3DSTATUS
    #field int dwFlags
    #field int dwStatus
    #field D3DRECT drExtent
#endstruct

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