ホーム › Graphics.Direct3D9 › D3DPRESENT_PARAMETERS
D3DPRESENT_PARAMETERS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| BackBufferWidth | DWORD | 4 | +0 | +0 | バックバッファの幅(ピクセル単位)。0は自動取得。 |
| BackBufferHeight | DWORD | 4 | +4 | +4 | バックバッファの高さ(ピクセル単位)。0は自動取得。 |
| BackBufferFormat | D3DFORMAT | 4 | +8 | +8 | バックバッファのピクセル形式を示すD3DFORMAT。 |
| BackBufferCount | DWORD | 4 | +12 | +12 | バックバッファの枚数。0は1とみなされる。 |
| MultiSampleType | D3DMULTISAMPLE_TYPE | 4 | +16 | +16 | マルチサンプリングの種別を示すD3DMULTISAMPLE_TYPE。 |
| MultiSampleQuality | DWORD | 4 | +20 | +20 | マルチサンプリングの品質レベル。 |
| SwapEffect | D3DSWAPEFFECT | 4 | +24 | +24 | スワップ方式を示すD3DSWAPEFFECT(Discard等)。 |
| hDeviceWindow | HWND | 8/4 | +32 | +28 | 描画先となるデバイスウィンドウのハンドル。 |
| Windowed | BOOL | 4 | +40 | +32 | ウィンドウモードならTRUE、フルスクリーンならFALSE。 |
| EnableAutoDepthStencil | BOOL | 4 | +44 | +36 | 深度ステンシルの自動管理を有効にするBOOL。 |
| AutoDepthStencilFormat | D3DFORMAT | 4 | +48 | +40 | 自動深度ステンシルの形式を示すD3DFORMAT。 |
| Flags | DWORD | 4 | +52 | +44 | プレゼンテーション動作を制御するフラグ群。 |
| FullScreen_RefreshRateInHz | DWORD | 4 | +56 | +48 | フルスクリーン時のリフレッシュレート(Hz)。ウィンドウ時は0。 |
| PresentationInterval | DWORD | 4 | +60 | +52 | Presentの同期間隔(VSync制御)を示す値。 |
各言語での定義
#include <windows.h>
// D3DPRESENT_PARAMETERS (x64 64 / x86 56 バイト)
typedef struct D3DPRESENT_PARAMETERS {
DWORD BackBufferWidth;
DWORD BackBufferHeight;
D3DFORMAT BackBufferFormat;
DWORD BackBufferCount;
D3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
D3DSWAPEFFECT SwapEffect;
HWND hDeviceWindow;
BOOL Windowed;
BOOL EnableAutoDepthStencil;
D3DFORMAT AutoDepthStencilFormat;
DWORD Flags;
DWORD FullScreen_RefreshRateInHz;
DWORD PresentationInterval;
} D3DPRESENT_PARAMETERS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DPRESENT_PARAMETERS
{
public uint BackBufferWidth;
public uint BackBufferHeight;
public uint BackBufferFormat;
public uint BackBufferCount;
public int MultiSampleType;
public uint MultiSampleQuality;
public int SwapEffect;
public IntPtr hDeviceWindow;
[MarshalAs(UnmanagedType.Bool)] public bool Windowed;
[MarshalAs(UnmanagedType.Bool)] public bool EnableAutoDepthStencil;
public uint AutoDepthStencilFormat;
public uint Flags;
public uint FullScreen_RefreshRateInHz;
public uint PresentationInterval;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DPRESENT_PARAMETERS
Public BackBufferWidth As UInteger
Public BackBufferHeight As UInteger
Public BackBufferFormat As UInteger
Public BackBufferCount As UInteger
Public MultiSampleType As Integer
Public MultiSampleQuality As UInteger
Public SwapEffect As Integer
Public hDeviceWindow As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public Windowed As Boolean
<MarshalAs(UnmanagedType.Bool)> Public EnableAutoDepthStencil As Boolean
Public AutoDepthStencilFormat As UInteger
Public Flags As UInteger
Public FullScreen_RefreshRateInHz As UInteger
Public PresentationInterval As UInteger
End Structureimport ctypes
from ctypes import wintypes
class D3DPRESENT_PARAMETERS(ctypes.Structure):
_fields_ = [
("BackBufferWidth", wintypes.DWORD),
("BackBufferHeight", wintypes.DWORD),
("BackBufferFormat", wintypes.DWORD),
("BackBufferCount", wintypes.DWORD),
("MultiSampleType", ctypes.c_int),
("MultiSampleQuality", wintypes.DWORD),
("SwapEffect", ctypes.c_int),
("hDeviceWindow", ctypes.c_void_p),
("Windowed", wintypes.BOOL),
("EnableAutoDepthStencil", wintypes.BOOL),
("AutoDepthStencilFormat", wintypes.DWORD),
("Flags", wintypes.DWORD),
("FullScreen_RefreshRateInHz", wintypes.DWORD),
("PresentationInterval", wintypes.DWORD),
]#[repr(C)]
pub struct D3DPRESENT_PARAMETERS {
pub BackBufferWidth: u32,
pub BackBufferHeight: u32,
pub BackBufferFormat: u32,
pub BackBufferCount: u32,
pub MultiSampleType: i32,
pub MultiSampleQuality: u32,
pub SwapEffect: i32,
pub hDeviceWindow: *mut core::ffi::c_void,
pub Windowed: i32,
pub EnableAutoDepthStencil: i32,
pub AutoDepthStencilFormat: u32,
pub Flags: u32,
pub FullScreen_RefreshRateInHz: u32,
pub PresentationInterval: u32,
}import "golang.org/x/sys/windows"
type D3DPRESENT_PARAMETERS struct {
BackBufferWidth uint32
BackBufferHeight uint32
BackBufferFormat uint32
BackBufferCount uint32
MultiSampleType int32
MultiSampleQuality uint32
SwapEffect int32
hDeviceWindow uintptr
Windowed int32
EnableAutoDepthStencil int32
AutoDepthStencilFormat uint32
Flags uint32
FullScreen_RefreshRateInHz uint32
PresentationInterval uint32
}type
D3DPRESENT_PARAMETERS = record
BackBufferWidth: DWORD;
BackBufferHeight: DWORD;
BackBufferFormat: DWORD;
BackBufferCount: DWORD;
MultiSampleType: Integer;
MultiSampleQuality: DWORD;
SwapEffect: Integer;
hDeviceWindow: Pointer;
Windowed: BOOL;
EnableAutoDepthStencil: BOOL;
AutoDepthStencilFormat: DWORD;
Flags: DWORD;
FullScreen_RefreshRateInHz: DWORD;
PresentationInterval: DWORD;
end;const D3DPRESENT_PARAMETERS = extern struct {
BackBufferWidth: u32,
BackBufferHeight: u32,
BackBufferFormat: u32,
BackBufferCount: u32,
MultiSampleType: i32,
MultiSampleQuality: u32,
SwapEffect: i32,
hDeviceWindow: ?*anyopaque,
Windowed: i32,
EnableAutoDepthStencil: i32,
AutoDepthStencilFormat: u32,
Flags: u32,
FullScreen_RefreshRateInHz: u32,
PresentationInterval: u32,
};type
D3DPRESENT_PARAMETERS {.bycopy.} = object
BackBufferWidth: uint32
BackBufferHeight: uint32
BackBufferFormat: uint32
BackBufferCount: uint32
MultiSampleType: int32
MultiSampleQuality: uint32
SwapEffect: int32
hDeviceWindow: pointer
Windowed: int32
EnableAutoDepthStencil: int32
AutoDepthStencilFormat: uint32
Flags: uint32
FullScreen_RefreshRateInHz: uint32
PresentationInterval: uint32struct D3DPRESENT_PARAMETERS
{
uint BackBufferWidth;
uint BackBufferHeight;
uint BackBufferFormat;
uint BackBufferCount;
int MultiSampleType;
uint MultiSampleQuality;
int SwapEffect;
void* hDeviceWindow;
int Windowed;
int EnableAutoDepthStencil;
uint AutoDepthStencilFormat;
uint Flags;
uint FullScreen_RefreshRateInHz;
uint PresentationInterval;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3DPRESENT_PARAMETERS サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; BackBufferWidth : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; BackBufferHeight : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; BackBufferFormat : D3DFORMAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; BackBufferCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MultiSampleType : D3DMULTISAMPLE_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MultiSampleQuality : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SwapEffect : D3DSWAPEFFECT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hDeviceWindow : HWND (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Windowed : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; EnableAutoDepthStencil : BOOL (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; AutoDepthStencilFormat : D3DFORMAT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; Flags : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; FullScreen_RefreshRateInHz : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; PresentationInterval : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DPRESENT_PARAMETERS サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; BackBufferWidth : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; BackBufferHeight : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; BackBufferFormat : D3DFORMAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; BackBufferCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MultiSampleType : D3DMULTISAMPLE_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MultiSampleQuality : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SwapEffect : D3DSWAPEFFECT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hDeviceWindow : HWND (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Windowed : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; EnableAutoDepthStencil : BOOL (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; AutoDepthStencilFormat : D3DFORMAT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Flags : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; FullScreen_RefreshRateInHz : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; PresentationInterval : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DPRESENT_PARAMETERS
#field int BackBufferWidth
#field int BackBufferHeight
#field int BackBufferFormat
#field int BackBufferCount
#field int MultiSampleType
#field int MultiSampleQuality
#field int SwapEffect
#field intptr hDeviceWindow
#field bool Windowed
#field bool EnableAutoDepthStencil
#field int AutoDepthStencilFormat
#field int Flags
#field int FullScreen_RefreshRateInHz
#field int PresentationInterval
#endstruct
stdim st, D3DPRESENT_PARAMETERS ; NSTRUCT 変数を確保
st->BackBufferWidth = 100
mes "BackBufferWidth=" + st->BackBufferWidth