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

D3DRECT

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

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

フィールド

フィールドサイズx64x86説明
x1INT4+0+0矩形の左端X座標。
y1INT4+4+4矩形の上端Y座標。
x2INT4+8+8矩形の右端X座標。
y2INT4+12+12矩形の下端Y座標。

各言語での定義

#include <windows.h>

// D3DRECT  (x64 16 / x86 16 バイト)
typedef struct D3DRECT {
    INT x1;
    INT y1;
    INT x2;
    INT y2;
} D3DRECT;
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;
}
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
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),
    ]
#[repr(C)]
pub struct D3DRECT {
    pub x1: i32,
    pub y1: i32,
    pub x2: i32,
    pub y2: i32,
}
import "golang.org/x/sys/windows"

type D3DRECT struct {
	x1 int32
	y1 int32
	x2 int32
	y2 int32
}
type
  D3DRECT = record
    x1: Integer;
    y1: Integer;
    x2: Integer;
    y2: Integer;
  end;
const D3DRECT = extern struct {
    x1: i32,
    y1: i32,
    x2: i32,
    y2: i32,
};
type
  D3DRECT {.bycopy.} = object
    x1: int32
    y1: int32
    x2: int32
    y2: int32
struct D3DRECT
{
    int x1;
    int y1;
    int x2;
    int y2;
}

HSP用 定義

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

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

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