|
40 | 40 | RAYLIB_BIN_PATH = os.path.dirname(sys.modules['__main__'].__file__)
|
41 | 41 | elif env_path == '__file__':
|
42 | 42 | RAYLIB_BIN_PATH = os.path.abspath(os.path.dirname(__file__))
|
43 |
| - elif os.path.exists(env_path) and os.path.isfile(env_path): |
| 43 | + elif os.path.exists(env_path) and os.path.isdir(env_path): |
44 | 44 | RAYLIB_BIN_PATH = env_path
|
45 | 45 | else:
|
46 | 46 | first_path = os.path.abspath(os.path.dirname(__file__))
|
|
297 | 297 | 'WRAP_REPEAT',
|
298 | 298 | 'WRAP_CLAMP',
|
299 | 299 | 'WRAP_MIRROR',
|
300 |
| - 'TextureBlendMode', |
| 300 | + 'BlendMode', |
301 | 301 | 'BLEND_ALPHA',
|
302 | 302 | 'BLEND_ADDITIVE',
|
303 | 303 | 'BLEND_MULTIPLIED',
|
|
329 | 329 | 'HMD_OCULUS_GO',
|
330 | 330 | 'HMD_VALVE_HTC_VIVE',
|
331 | 331 | 'HMD_SONY_PSVR',
|
332 |
| - 'NPatchInfo', |
| 332 | + 'NPatchType', |
333 | 333 | 'NPT_9PATCH',
|
334 | 334 | 'NPT_3PATCH_VERTICAL',
|
335 | 335 | 'NPT_3PATCH_HORIZONTAL',
|
|
363 | 363 | 'Rectangle',
|
364 | 364 | 'RenderTexture',
|
365 | 365 | 'RenderTexture2D',
|
366 |
| - 'NPatch', |
| 366 | + 'NPatchInfo', |
367 | 367 | 'Shader',
|
368 | 368 | 'Sound',
|
369 | 369 | 'SpriteFont',
|
|
601 | 601 | 'draw_texture_ex',
|
602 | 602 | 'draw_texture_rec',
|
603 | 603 | 'draw_texture_pro',
|
604 |
| - 'draw_npatch', |
| 604 | + 'draw_texture_npatch', |
605 | 605 |
|
606 | 606 | # Module: TEXT
|
607 | 607 | 'get_font_default',
|
|
694 | 694 | 'begin_shader_mode',
|
695 | 695 | 'end_shader_mode',
|
696 | 696 | 'begin_blend_mode',
|
| 697 | + 'begin_clip_rec', |
| 698 | + 'end_clip_rec', |
697 | 699 | 'end_blend_mode',
|
698 | 700 | 'get_vr_device_info',
|
699 | 701 | 'init_vr_simulator',
|
@@ -1723,13 +1725,13 @@ def __str__(self) -> str:
|
1723 | 1725 | return "(RENDERTEXTURE: {}w, {}h, texture: {}, depth: {})".format(self.width, self.height, self.texture, self.depth)
|
1724 | 1726 |
|
1725 | 1727 |
|
1726 |
| -class NPatch(Structure): |
| 1728 | +class NPatchInfo(Structure): |
1727 | 1729 | _fields_ = [
|
1728 |
| - ('texture', Texture2D), |
1729 | 1730 | ('sourceRec', Rectangle),
|
1730 |
| - ('minSize', Vector2), |
1731 |
| - ('borderWidth', c_float * 4), |
1732 |
| - ('padding', c_int * 4), |
| 1731 | + ('left', c_int), |
| 1732 | + ('top', c_int), |
| 1733 | + ('right', c_int), |
| 1734 | + ('bottom', c_int), |
1733 | 1735 | ('type', c_int),
|
1734 | 1736 | ]
|
1735 | 1737 |
|
@@ -2271,8 +2273,8 @@ class CameraType(IntEnum):
|
2271 | 2273 | CAMERA_ORTHOGRAPHIC = 1
|
2272 | 2274 |
|
2273 | 2275 |
|
2274 |
| -CAMERA_PERSPECTIVE = CameraMode.CAMERA_PERSPECTIVE |
2275 |
| -CAMERA_ORTHOGRAPHIC = CameraMode.CAMERA_ORTHOGRAPHIC |
| 2276 | +CAMERA_PERSPECTIVE = CameraType.CAMERA_PERSPECTIVE |
| 2277 | +CAMERA_ORTHOGRAPHIC = CameraType.CAMERA_ORTHOGRAPHIC |
2276 | 2278 |
|
2277 | 2279 |
|
2278 | 2280 | class VrDeviceType(IntEnum):
|
@@ -2313,7 +2315,7 @@ def init_window(width: int, height: int, title: AnyStr) -> None:
|
2313 | 2315 | return _rl.InitWindow(_int(width), _int(height), _str_in(title))
|
2314 | 2316 |
|
2315 | 2317 |
|
2316 |
| -def init_window_v(size: Union[Vector, Seq], title: AnyStr) -> None: |
| 2318 | +def init_window_v(size: Union[Vector2, Seq], title: AnyStr) -> None: |
2317 | 2319 | """Initialize window (with a sequence type as size) and OpenGL context"""
|
2318 | 2320 | size = _vec2(size)
|
2319 | 2321 | init_window(size.x, size.y, title)
|
@@ -3702,11 +3704,11 @@ def draw_texture_pro(texture: Texture2D, source_rec: Union[Rectangle, Seq], dest
|
3702 | 3704 | """Draw a part of a texture defined by a rectangle with 'pro' parameters"""
|
3703 | 3705 | return _rl.DrawTexturePro(texture, _rect(source_rec), _rect(dest_rec), _vec2(origin), _float(rotation), _color(tint))
|
3704 | 3706 |
|
3705 |
| -_rl.DrawNPatch.argtypes = [NPatch, Rectangle, Bool, Vector2, Float, Color] |
3706 |
| -_rl.DrawNPatch.restype = None |
3707 |
| -def draw_npatch(npatch: NPatch, dest_rec: Union[Rectangle, Seq], use_padding: bool, origin: Union[Vector2, Seq], rotation: float, tint: Union[Color, Seq]) -> None: |
| 3707 | +_rl.DrawTextureNPatch.argtypes = [Texture2D, NPatchInfo, Rectangle, Vector2, Float, Color] |
| 3708 | +_rl.DrawTextureNPatch.restype = None |
| 3709 | +def draw_texture_npatch(texture: Texture2D, npatch_info: NPatchInfo, dest_rec: Union[Rectangle, Seq], origin: Union[Vector2, Seq], rotation: float, tint: Union[Color, Seq]) -> None: |
3708 | 3710 | """Draw a part of a texture defined by a rectangle with 'pro' parameters"""
|
3709 |
| - return _rl.DrawNPatch(npatch, _rect(dest_rec), use_padding, _vec2(origin), _float(rotation), _color(tint)) |
| 3711 | + return _rl.DrawNPatch(texture, npatch_info, _rect(dest_rec), _vec2(origin), _float(rotation), _color(tint)) |
3710 | 3712 |
|
3711 | 3713 |
|
3712 | 3714 | # -----------------------------------------------------------------------------------
|
@@ -4349,6 +4351,20 @@ def end_blend_mode() -> None:
|
4349 | 4351 | """End blending mode (reset to default: alpha blending)"""
|
4350 | 4352 | return _rl.EndBlendMode()
|
4351 | 4353 |
|
| 4354 | +_rl.BeginClipRec.argtypes = [Rectangle] |
| 4355 | +_rl.BeginClipRec.restype = None |
| 4356 | +def begin_clip_rec(rec: Rectangle) -> None: |
| 4357 | + """Drawing functions change only pixels inside rec. |
| 4358 | +
|
| 4359 | + Can be nested. |
| 4360 | + """ |
| 4361 | + _rl.BeginClipRec(_rect(rec)) |
| 4362 | + |
| 4363 | +_rl.EndClipRec.argtypes = _NOARGS |
| 4364 | +_rl.EndClipRec.restype = None |
| 4365 | +def end_clip_rec() -> None: |
| 4366 | + """Restore previous clip rec.""" |
| 4367 | + _rl.EndClipRec() |
4352 | 4368 |
|
4353 | 4369 | # VR control functions
|
4354 | 4370 | _rl.GetVrDeviceInfo.argtypes = [Int]
|
|
0 commit comments