this is bug free!
This commit is contained in:
parent
2820e20d16
commit
1e4fcb48e9
@ -10,7 +10,7 @@ pub mod python_class {
|
||||
use pyo3::prelude::*;
|
||||
|
||||
use crate::math::matrix::{Matrix3, Matrix4};
|
||||
use crate::math::vector::{Vector2, Vector3, Vector4};
|
||||
use crate::math::vector::{Vector2, Vector3, Vector4, VectorTrait};
|
||||
|
||||
#[pyclass(name = "Vector2")]
|
||||
pub struct PyVector2 {
|
||||
@ -50,6 +50,7 @@ pub mod python_class {
|
||||
fn __radd__(&self, other: &PyAny) -> Self;
|
||||
fn __eq__(&self, other: &Self) -> bool;
|
||||
fn __ne__(&self, other: &Self) -> bool;
|
||||
// fn rotate
|
||||
}
|
||||
|
||||
/// 这是一个用来自动给 impl xxx for xxx 的块去掉 trait 部分的宏
|
||||
@ -69,5 +70,29 @@ pub mod python_class {
|
||||
data: self.data + other.data,
|
||||
};
|
||||
}
|
||||
|
||||
fn __sub__(&self, other: &Self) -> Self {
|
||||
return Self {
|
||||
data: self.data - other.data,
|
||||
};
|
||||
}
|
||||
|
||||
fn __mul__(&self, other: &Self) -> Self {
|
||||
return Self {
|
||||
data: self.data * other.data,
|
||||
};
|
||||
}
|
||||
|
||||
fn __truediv__(&self, other: &Self) -> Self {
|
||||
return Self {
|
||||
data: self.data / other.data,
|
||||
};
|
||||
}
|
||||
|
||||
fn __floordiv__(&self, other: &Self) -> Self {
|
||||
return Self {
|
||||
data: self.data.floordiv(&other.data),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,9 @@ impl Sprite {
|
||||
batch = batch_;
|
||||
}
|
||||
// 385
|
||||
let group = sprite_group_class.call1((texture, blend_src, blend_dest, program, group));
|
||||
let group = sprite_group_class
|
||||
.call1((texture, blend_src, blend_dest, program, group))
|
||||
.unwrap();
|
||||
|
||||
Sprite {
|
||||
subpixel,
|
||||
@ -188,17 +190,17 @@ impl Sprite {
|
||||
}
|
||||
}
|
||||
|
||||
/// python code:
|
||||
/// 390:
|
||||
/// def _create_vertex_list(self):
|
||||
/// texture = self._texture
|
||||
/// self._vertex_list = self.program.vertex_list(
|
||||
/// 1, GL_POINTS, self._batch, self._group,
|
||||
/// position=('f', (self._x, self._y, self._z)),
|
||||
/// size=('f', (texture.width, texture.height, 1, 1)),
|
||||
/// color=('Bn', self._rgba),
|
||||
/// texture_uv=('f', texture.uv),
|
||||
/// rotation=('f', (self._rotation,)))
|
||||
// python code:
|
||||
// 390:
|
||||
// def _create_vertex_list(self):
|
||||
// texture = self._texture
|
||||
// self._vertex_list = self.program.vertex_list(
|
||||
// 1, GL_POINTS, self._batch, self._group,
|
||||
// position=('f', (self._x, self._y, self._z)),
|
||||
// size=('f', (texture.width, texture.height, 1, 1)),
|
||||
// color=('Bn', self._rgba),
|
||||
// texture_uv=('f', texture.uv),
|
||||
// rotation=('f', (self._rotation,)))
|
||||
|
||||
// pub fn _create_vertex_list(&mut self) -> PyResult<()> {
|
||||
// let texture = self.texture.as_ref()?;
|
||||
|
Loading…
Reference in New Issue
Block a user