Skip to content

Commit

Permalink
add add_presented_handler to Drawable (gfx-rs#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlannyH committed May 23, 2024
1 parent fd09dd5 commit b208377
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/drawable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

use block::Block;

use super::NSUInteger;

type DrawablePresentedHandler<'a> = Block<(&'a DrawableRef,), ()>;

/// See <https://developer.apple.com/documentation/metal/mtldrawable>
pub enum MTLDrawable {}

Expand All @@ -23,4 +27,8 @@ impl DrawableRef {
pub fn drawable_id(&self) -> NSUInteger {
unsafe { msg_send![self, drawableID] }
}

pub fn add_presented_handler(&self, block: &DrawablePresentedHandler) {
unsafe { msg_send![self, addPresentedHandler: block] }
}
}

0 comments on commit b208377

Please sign in to comment.