objc2_metal_kit

Trait MTKViewDelegate

Source
pub unsafe trait MTKViewDelegate: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn mtkView_drawableSizeWillChange(
        &self,
        view: &MTKView,
        size: CGSize,
    )
       where Self: Sized + Message { ... }
    unsafe fn drawInMTKView(&self, view: &MTKView)
       where Self: Sized + Message { ... }
}
Available on crate feature MTKView only.
Expand description

Allows an object to render into the view and respond to resize events

See also Apple’s documentation

Provided Methods§

Source

unsafe fn mtkView_drawableSizeWillChange(&self, view: &MTKView, size: CGSize)
where Self: Sized + Message,

Available on crate feature objc2-app-kit and crate feature objc2-core-foundation and macOS only.

Called whenever the drawableSize of the view will change

Delegate can recompute view and projection matricies or regenerate any buffers to be compatible with the new view size or resolution

Parameter view: MTKView which called this method

Parameter size: New drawable size in pixels

Source

unsafe fn drawInMTKView(&self, view: &MTKView)
where Self: Sized + Message,

Available on crate feature objc2-app-kit and macOS only.

Called on the delegate when it is asked to render into the view

Called on the delegate when it is asked to render into the view

Trait Implementations§

Source§

impl ProtocolType for dyn MTKViewDelegate

Source§

const NAME: &'static str = "MTKViewDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MTKViewDelegate

Implementations on Foreign Types§

Source§

impl<T> MTKViewDelegate for ProtocolObject<T>
where T: ?Sized + MTKViewDelegate,

Implementors§