From 55f1143676378d749e47f8b1fda618a6d4582a86 Mon Sep 17 00:00:00 2001 From: Thomas ten Cate Date: Tue, 13 Feb 2024 15:35:27 +0100 Subject: [PATCH] Implement Sprite::set_draw_mode Fixes #85 --- src/sprite.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sprite.rs b/src/sprite.rs index fc0169f..07ab888 100644 --- a/src/sprite.rs +++ b/src/sprite.rs @@ -2,7 +2,7 @@ extern crate alloc; use { crate::{ - graphics::{Bitmap, Graphics, LCDBitmapFlip, LCDColor, PDRect}, + graphics::{Bitmap, Graphics, LCDBitmapDrawMode, LCDBitmapFlip, LCDColor, PDRect}, log_to_console, pd_func_caller, pd_func_caller_log, system::System, Playdate, @@ -239,6 +239,10 @@ impl SpriteInner { pd_func_caller!((*self.playdate_sprite).getTag, self.raw_sprite) } + pub fn set_draw_mode(&self, mode: LCDBitmapDrawMode) -> Result<(), Error> { + pd_func_caller!((*self.playdate_sprite).setDrawMode, self.raw_sprite, mode) + } + pub fn set_visible(&mut self, visible: bool) -> Result<(), Error> { pd_func_caller!( (*self.playdate_sprite).setVisible, @@ -437,6 +441,13 @@ impl Sprite { self.inner.try_borrow().map_err(Error::msg)?.get_tag() } + pub fn set_draw_mode(&mut self, mode: LCDBitmapDrawMode) -> Result<(), Error> { + self.inner + .try_borrow_mut() + .map_err(Error::msg)? + .set_draw_mode(mode) + } + pub fn move_to(&mut self, x: f32, y: f32) -> Result<(), Error> { self.inner .try_borrow_mut()