keep porting

This commit is contained in:
shenjack 2023-03-25 20:23:40 +08:00
parent 5a123389ae
commit 412c3f1b7f

View File

@ -19,6 +19,7 @@ pub struct Sprite {
// render // render
pub subpixel: bool, pub subpixel: bool,
pub batch: Py<PyAny>, pub batch: Py<PyAny>,
pub user_group: Option<Py<PyAny>>,
pub group_class: Py<PyAny>, pub group_class: Py<PyAny>,
// view // view
pub x: f64, pub x: f64,
@ -80,16 +81,20 @@ impl Sprite {
subpixel: bool, subpixel: bool,
program_: &PyAny, program_: &PyAny,
) -> Self { ) -> Self {
let animation_class = PyModule::import(py_, "pyglet.image.Animation")
.unwrap()
.getattr("Animation")
.unwrap();
let texture; let texture;
let batch; let batch;
let mut next_dt = 0.0; let mut next_dt = 0.0;
let mut animation = None; let mut animation = None;
let mut program = program_; let mut program = program_;
let sprite_group_class = PyModule::import(py_, "pyglet.sprite")
.unwrap()
.getattr("SpriteGroup")
.unwrap();
// 366 // 366
let animation_class = PyModule::import(py_, "pyglet.image.Animation")
.unwrap()
.getattr("Animation")
.unwrap();
if img.is_instance(animation_class).unwrap() { if img.is_instance(animation_class).unwrap() {
animation = Some(img.into()); animation = Some(img.into());
texture = img texture = img
@ -153,6 +158,7 @@ impl Sprite {
Sprite { Sprite {
subpixel, subpixel,
batch: batch.into(), batch: batch.into(),
user_group: Some(group.into()),
group_class: group.into(), group_class: group.into(),
x, x,
y, y,