Skip to main content

WinitPlatform

Struct WinitPlatform 

Source
pub struct WinitPlatform { /* private fields */ }
Expand description

基于 winit + softbuffer 的跨平台桌面窗口平台(支持 Linux Wayland、Windows、macOS)。

实现 Platform 与 PlatformSurface 特征。

Implementations§

Source§

impl WinitPlatform

Source

pub fn new(title: impl Into<String>, width: usize, height: usize) -> Self

创建指定标题与逻辑尺寸 (width, height) 的跨平台 WinitPlatform 窗口运行器。

Source

pub fn with_dpi_scale(self, scale: usize) -> Self

设置 HiDPI 缩放倍数(1 为原始像素,2 为 2× 高清矢量光栅化)。

Source

pub fn with_backend(self, backend: DesktopRenderBackend) -> Self

配置桌面渲染后端类型(默认采用 super::DesktopRenderBackend::default_desktop,即优先 Wgpu 2D SDF GPU 后端)。

Source

pub fn set_backend(&mut self, backend: DesktopRenderBackend)

动态切换桌面渲染后端类型。

Source

pub const fn backend(&self) -> DesktopRenderBackend

返回当前激活的桌面渲染后端类型。

Source

pub const fn driver(&self) -> &SoftwareSurfaceDriver

返回内部表面驱动器只读引用(用于检查单槽原位复用与局部光栅化脏矩形)。

Source

pub fn run(self, core: VeloxEngine, scroll_list_id: Option<u32>)

启动基于 winit::event_loop::EventLoop + softbuffer 的原生跨平台窗口事件循环。

Source

pub fn run_headless(&self, core: &mut VeloxEngine, frames: usize)

无头模式运行指定帧数(用于 CI 或无显示服务器环境验证)。

Source

pub fn render_to_png(&self, core: &mut VeloxEngine, path: &str) -> Result<()>

渲染一帧并将前台 Xrgb8888 像素缓冲保存为无损 PNG 图像文件。

Trait Implementations§

Source§

impl Platform for WinitPlatform

Source§

fn duration_since_start(&self) -> Duration

返回自平台启动以来的单调递增时长(桌面端默认由 Instant 提供)。
Source§

fn step_platform( &mut self, engine: &mut VeloxEngine, dt_ms: u16, ) -> PlatformControlFlow

单步执行一次平台事件采集、状态更新与按需脏区刷屏,返回下一次循环的 PlatformControlFlow 调度策略。
Source§

fn run_event_loop(self, engine: VeloxEngine)

启动平台主事件循环,接管 VeloxEngine 直至收到 PlatformControlFlow::Exit。
Source§

impl PlatformSurface for WinitPlatform

Source§

fn surface_size(&self) -> (i16, i16)

获取当前显示表面的逻辑宽高 (width, height)。
Source§

fn flush_frame_dt( &mut self, engine: &mut VeloxEngine, dt_ms: u16, ) -> FlushReport

按给定时间步长 dt_ms(毫秒)推进一帧 VeloxEngine 并刷新所有脏区到显示设备。
Source§

fn flush_frame(&mut self, engine: &mut VeloxEngine) -> FlushReport

以默认 60FPS(16ms)步长执行一帧刷新。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> FluentBuilder for T

Source§

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self

当 condition 为 true 时执行闭包修饰自身,否则原样返回。
Source§

fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self

根据 condition 在两个修饰分支之间二选一。
Source§

fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self

当 option 为 Some(value) 时执行闭包修饰自身,否则原样返回。
Source§

fn when_none<O>( self, option: &Option<O>, then: impl FnOnce(Self) -> Self, ) -> Self

当 option 为 None 时执行闭包修饰自身,否则原样返回。
Source§

fn apply<U>(self, f: impl FnOnce(Self) -> U) -> U

通用管道映射变换(避免与 Iterator::map / Option::map 重名)。
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,