Beispiel #1
0
 def built_from_axis_origin(cls,
                            x_axis=Vector2(),
                            y_axis=Vector2(),
                            origin=Vector2()):
     self._check_param_type('x_axis', x_axis, Vector2)
     self._check_param_type('y_axis', y_axis, Vector2)
     self._check_param_type('origin', origin, Vector2)
     ret = Transform2D()
     lib.godot_transform2d_new_with_axis_origin(self._gd_ptr,
                                                x_axis._gd_ptr,
                                                y_axis._gd_ptr,
                                                origin._gd_ptr)
     return ret
Beispiel #2
0
 def xform(self, v):
     if isinstance(v, Vector2):
         raw = lib.godot_transform2d_xform_vector2(self._gd_ptr, v._gd_ptr)
         return Vector2.build_from_gdobj(raw)
     elif isinstance(v, Rect2):
         raw = lib.godot_transform2d_xform_rect2(self._gd_ptr, v._gd_ptr)
         return Rect2.build_from_gdobj(raw)
     raise TypeError('Param `v` should be of type `Rect2` or `Vector2`')
Beispiel #3
0
 def get_scale(self):
     raw = lib.godot_transform2d_get_scale(self._gd_ptr)
     return Vector2.build_from_gdobj(raw)
Beispiel #4
0
 def __init__(self, rot=0.0, pos=Vector2()):
     self._check_param_float('rot', rot)
     self._check_param_type('pos', pos, Vector2)
     self._gd_ptr = godot_transform2d_alloc()
     lib.godot_transform2d_new(self._gd_ptr, rot, pos._gd_ptr)
Beispiel #5
0
 def basis_xform_inv(self, v):
     self._check_param_type('v', v, Vector2)
     raw = lib.godot_transform2d_basis_xform_inv_vector2(
         self._gd_ptr, v._gd_ptr)
     return Vector2.build_from_gdobj(raw)
Beispiel #6
0
 def size(self):
     return Vector2.build_from_gdobj(lib.godot_rect2_get_size(self._gd_ptr))
Beispiel #7
0
 def position(self):
     return Vector2.build_from_gdobj(
         lib.godot_rect2_get_position(self._gd_ptr))