Skip to content

Commit

Permalink
Merge pull request #86 from ttencate/feature/sprite_set_draw_mode
Browse files Browse the repository at this point in the history
Implement Sprite::set_draw_mode
  • Loading branch information
boozook authored Apr 3, 2024
2 parents bc0d1da + 55f1143 commit 6439161
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 6439161

Please sign in to comment.