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

DXGI_SWAP_CHAIN_FULLSCREEN_DESC

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

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

フィールド

フィールドサイズx64x86説明
RefreshRateDXGI_RATIONAL8+0+0全画面モードのリフレッシュレートを分数で表すDXGI_RATIONAL。
ScanlineOrderingDXGI_MODE_SCANLINE_ORDER4+8+8走査線の描画順序を示す列挙値。
ScalingDXGI_MODE_SCALING4+12+12スケーリング方式を示す列挙値。
WindowedBOOL4+16+16ウィンドウモードか(falseで全画面)を示すブール値。

各言語での定義

#include <windows.h>

// DXGI_RATIONAL  (x64 8 / x86 8 バイト)
typedef struct DXGI_RATIONAL {
    DWORD Numerator;
    DWORD Denominator;
} DXGI_RATIONAL;

// DXGI_SWAP_CHAIN_FULLSCREEN_DESC  (x64 20 / x86 20 バイト)
typedef struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC {
    DXGI_RATIONAL RefreshRate;
    DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
    DXGI_MODE_SCALING Scaling;
    BOOL Windowed;
} DXGI_SWAP_CHAIN_FULLSCREEN_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_RATIONAL
{
    public uint Numerator;
    public uint Denominator;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC
{
    public DXGI_RATIONAL RefreshRate;
    public int ScanlineOrdering;
    public int Scaling;
    [MarshalAs(UnmanagedType.Bool)] public bool Windowed;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_RATIONAL
    Public Numerator As UInteger
    Public Denominator As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_SWAP_CHAIN_FULLSCREEN_DESC
    Public RefreshRate As DXGI_RATIONAL
    Public ScanlineOrdering As Integer
    Public Scaling As Integer
    <MarshalAs(UnmanagedType.Bool)> Public Windowed As Boolean
End Structure
import ctypes
from ctypes import wintypes

class DXGI_RATIONAL(ctypes.Structure):
    _fields_ = [
        ("Numerator", wintypes.DWORD),
        ("Denominator", wintypes.DWORD),
    ]

class DXGI_SWAP_CHAIN_FULLSCREEN_DESC(ctypes.Structure):
    _fields_ = [
        ("RefreshRate", DXGI_RATIONAL),
        ("ScanlineOrdering", ctypes.c_int),
        ("Scaling", ctypes.c_int),
        ("Windowed", wintypes.BOOL),
    ]
#[repr(C)]
pub struct DXGI_RATIONAL {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC {
    pub RefreshRate: DXGI_RATIONAL,
    pub ScanlineOrdering: i32,
    pub Scaling: i32,
    pub Windowed: i32,
}
import "golang.org/x/sys/windows"

type DXGI_RATIONAL struct {
	Numerator uint32
	Denominator uint32
}

type DXGI_SWAP_CHAIN_FULLSCREEN_DESC struct {
	RefreshRate DXGI_RATIONAL
	ScanlineOrdering int32
	Scaling int32
	Windowed int32
}
type
  DXGI_RATIONAL = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  DXGI_SWAP_CHAIN_FULLSCREEN_DESC = record
    RefreshRate: DXGI_RATIONAL;
    ScanlineOrdering: Integer;
    Scaling: Integer;
    Windowed: BOOL;
  end;
const DXGI_RATIONAL = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const DXGI_SWAP_CHAIN_FULLSCREEN_DESC = extern struct {
    RefreshRate: DXGI_RATIONAL,
    ScanlineOrdering: i32,
    Scaling: i32,
    Windowed: i32,
};
type
  DXGI_RATIONAL {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  DXGI_SWAP_CHAIN_FULLSCREEN_DESC {.bycopy.} = object
    RefreshRate: DXGI_RATIONAL
    ScanlineOrdering: int32
    Scaling: int32
    Windowed: int32
struct DXGI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC
{
    DXGI_RATIONAL RefreshRate;
    int ScanlineOrdering;
    int Scaling;
    int Windowed;
}

HSP用 定義

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

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

#defstruct global DXGI_SWAP_CHAIN_FULLSCREEN_DESC
    #field DXGI_RATIONAL RefreshRate
    #field int ScanlineOrdering
    #field int Scaling
    #field bool Windowed
#endstruct

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