ホーム › Graphics.Direct3D9 › D3DVIEWPORT7
D3DVIEWPORT7
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwX | DWORD | 4 | +0 | +0 | ビューポート左上のX座標(ピクセル単位)。 |
| dwY | DWORD | 4 | +4 | +4 | ビューポート左上のY座標(ピクセル単位)。 |
| dwWidth | DWORD | 4 | +8 | +8 | ビューポートの幅(ピクセル単位)。 |
| dwHeight | DWORD | 4 | +12 | +12 | ビューポートの高さ(ピクセル単位)。 |
| dvMinZ | FLOAT | 4 | +16 | +16 | 深度の最小値(通常0.0)。 |
| dvMaxZ | FLOAT | 4 | +20 | +20 | 深度の最大値(通常1.0)。 |
各言語での定義
#include <windows.h>
// D3DVIEWPORT7 (x64 24 / x86 24 バイト)
typedef struct D3DVIEWPORT7 {
DWORD dwX;
DWORD dwY;
DWORD dwWidth;
DWORD dwHeight;
FLOAT dvMinZ;
FLOAT dvMaxZ;
} D3DVIEWPORT7;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DVIEWPORT7
{
public uint dwX;
public uint dwY;
public uint dwWidth;
public uint dwHeight;
public float dvMinZ;
public float dvMaxZ;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DVIEWPORT7
Public dwX As UInteger
Public dwY As UInteger
Public dwWidth As UInteger
Public dwHeight As UInteger
Public dvMinZ As Single
Public dvMaxZ As Single
End Structureimport ctypes
from ctypes import wintypes
class D3DVIEWPORT7(ctypes.Structure):
_fields_ = [
("dwX", wintypes.DWORD),
("dwY", wintypes.DWORD),
("dwWidth", wintypes.DWORD),
("dwHeight", wintypes.DWORD),
("dvMinZ", ctypes.c_float),
("dvMaxZ", ctypes.c_float),
]#[repr(C)]
pub struct D3DVIEWPORT7 {
pub dwX: u32,
pub dwY: u32,
pub dwWidth: u32,
pub dwHeight: u32,
pub dvMinZ: f32,
pub dvMaxZ: f32,
}import "golang.org/x/sys/windows"
type D3DVIEWPORT7 struct {
dwX uint32
dwY uint32
dwWidth uint32
dwHeight uint32
dvMinZ float32
dvMaxZ float32
}type
D3DVIEWPORT7 = record
dwX: DWORD;
dwY: DWORD;
dwWidth: DWORD;
dwHeight: DWORD;
dvMinZ: Single;
dvMaxZ: Single;
end;const D3DVIEWPORT7 = extern struct {
dwX: u32,
dwY: u32,
dwWidth: u32,
dwHeight: u32,
dvMinZ: f32,
dvMaxZ: f32,
};type
D3DVIEWPORT7 {.bycopy.} = object
dwX: uint32
dwY: uint32
dwWidth: uint32
dwHeight: uint32
dvMinZ: float32
dvMaxZ: float32struct D3DVIEWPORT7
{
uint dwX;
uint dwY;
uint dwWidth;
uint dwHeight;
float dvMinZ;
float dvMaxZ;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DVIEWPORT7 サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwX : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwY : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwWidth : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwHeight : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dvMinZ : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dvMaxZ : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DVIEWPORT7
#field int dwX
#field int dwY
#field int dwWidth
#field int dwHeight
#field float dvMinZ
#field float dvMaxZ
#endstruct
stdim st, D3DVIEWPORT7 ; NSTRUCT 変数を確保
st->dwX = 100
mes "dwX=" + st->dwX