From 412c3f1b7fe003f9ada4e482ac1aa39132727d2c Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 25 Mar 2023 20:23:40 +0800 Subject: [PATCH] keep porting --- libs/pyglet_rs/src/src/sprite.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/pyglet_rs/src/src/sprite.rs b/libs/pyglet_rs/src/src/sprite.rs index 3fad8a2..0f9fc50 100644 --- a/libs/pyglet_rs/src/src/sprite.rs +++ b/libs/pyglet_rs/src/src/sprite.rs @@ -19,6 +19,7 @@ pub struct Sprite { // render pub subpixel: bool, pub batch: Py, + pub user_group: Option>, pub group_class: Py, // view pub x: f64, @@ -80,16 +81,20 @@ impl Sprite { subpixel: bool, program_: &PyAny, ) -> Self { - let animation_class = PyModule::import(py_, "pyglet.image.Animation") - .unwrap() - .getattr("Animation") - .unwrap(); let texture; let batch; let mut next_dt = 0.0; let mut animation = None; let mut program = program_; + let sprite_group_class = PyModule::import(py_, "pyglet.sprite") + .unwrap() + .getattr("SpriteGroup") + .unwrap(); // 366 + let animation_class = PyModule::import(py_, "pyglet.image.Animation") + .unwrap() + .getattr("Animation") + .unwrap(); if img.is_instance(animation_class).unwrap() { animation = Some(img.into()); texture = img @@ -153,6 +158,7 @@ impl Sprite { Sprite { subpixel, batch: batch.into(), + user_group: Some(group.into()), group_class: group.into(), x, y,