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