From 619341b1960c1e2c017a40c217e9f6b905b7a204 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 28 Mar 2023 18:03:34 +0800 Subject: [PATCH] What a Night Mare --- libs/pyglet_rs/src/src/pymath.rs | 3 --- libs/pyglet_rs/src/src/sprite.rs | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/pyglet_rs/src/src/pymath.rs b/libs/pyglet_rs/src/src/pymath.rs index 18108e4..f9fa348 100644 --- a/libs/pyglet_rs/src/src/pymath.rs +++ b/libs/pyglet_rs/src/src/pymath.rs @@ -63,10 +63,7 @@ pub mod python_class { data: Vector2::new(x, y), }; } - } - #[pymethods] - impl PyVector2 { fn __add__(&self, other: &Self) -> Self { return Self { data: self.data + other.data, diff --git a/libs/pyglet_rs/src/src/sprite.rs b/libs/pyglet_rs/src/src/sprite.rs index 0f9fc50..65c264f 100644 --- a/libs/pyglet_rs/src/src/sprite.rs +++ b/libs/pyglet_rs/src/src/sprite.rs @@ -13,12 +13,14 @@ use pyo3::prelude::*; /// See the module documentation for usage. #[pyclass(name = "Sprite_rs", subclass)] #[pyo3(text_signature = "(img, x=0.0, y=0.0, z=0.0, \ + blend_src=770, blend_dest=771, \ batch=None, group=None, \ subpixel=False, program=None)")] pub struct Sprite { // render pub subpixel: bool, pub batch: Py, + pub group: Option>, pub user_group: Option>, pub group_class: Py, // view @@ -76,6 +78,8 @@ impl Sprite { x: f64, y: f64, z: f64, + blend_src: u32, // default 770 (GL_SRC_ALPHA) + blend_dest: u32, // default 771 (GL_ONE_MINUS_SRC_ALPHA) batch_: &PyAny, group: &PyAny, subpixel: bool, @@ -154,10 +158,13 @@ impl Sprite { } else { batch = batch_; } + // 385 + let group = sprite_group_class.call1((texture, blend_src, blend_dest, program, group)); Sprite { subpixel, batch: batch.into(), + group: Some(group.into()), user_group: Some(group.into()), group_class: group.into(), x,