Skip to content

Commit 7ece38c

Browse files
committed
draw_texture_npatch, begin_clip_rec and end_clip_rec not loaded by deafult anymore.
These functions are not yet part of the raylib 2.0.0 release, but part of a custom build and should not be loaded by default. These are only included in the x86 custom DLL installed via pip.
1 parent df9c8a8 commit 7ece38c

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

raylibpy/__init__.py

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
}
3434
_platform = sys.platform
3535

36+
ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH = False
37+
ENABLE_V2_0_0_FEATURE_CLIPRECT = False
38+
39+
if "ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH" in os.environ:
40+
ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH = True
41+
42+
if "ENABLE_V2_0_0_FEATURE_CLIPRECT" in os.environ:
43+
ENABLE_V2_0_0_FEATURE_CLIPRECT = True
3644

3745
RAYLIB_BIN_PATH = None
3846
if "RAYLIB_BIN_PATH" in os.environ:
@@ -4077,12 +4085,15 @@ def draw_texture_pro(texture: Texture2D, source_rec: Union[Rectangle, Seq], dest
40774085
"""Draw a part of a texture defined by a rectangle with 'pro' parameters"""
40784086
return _rl.DrawTexturePro(texture, _rect(source_rec), _rect(dest_rec), _vec2(origin), _float(rotation), _color(tint))
40794087

4080-
_rl.DrawTextureNPatch.argtypes = [Texture2D, NPatchInfo, Rectangle, Vector2, Float, Color]
4081-
_rl.DrawTextureNPatch.restype = None
4082-
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:
4083-
"""Draw a part of a texture defined by a rectangle with 'pro' parameters"""
4084-
return _rl.DrawNPatch(texture, npatch_info, _rect(dest_rec), _vec2(origin), _float(rotation), _color(tint))
4085-
4088+
if ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH:
4089+
_rl.DrawTextureNPatch.argtypes = [Texture2D, NPatchInfo, Rectangle, Vector2, Float, Color]
4090+
_rl.DrawTextureNPatch.restype = None
4091+
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:
4092+
"""Draw a part of a texture defined by a rectangle with 'pro' parameters"""
4093+
return _rl.DrawNPatch(texture, npatch_info, _rect(dest_rec), _vec2(origin), _float(rotation), _color(tint))
4094+
else:
4095+
def draw_texture_npatch(*args, **kwargs) -> None:
4096+
pass
40864097

40874098
# -----------------------------------------------------------------------------------
40884099
# Font Loading and Text Drawing Functions (Module: text)
@@ -4724,20 +4735,29 @@ def end_blend_mode() -> None:
47244735
"""End blending mode (reset to default: alpha blending)"""
47254736
return _rl.EndBlendMode()
47264737

4727-
_rl.BeginClipRec.argtypes = [Rectangle]
4728-
_rl.BeginClipRec.restype = None
4729-
def begin_clip_rec(rec: Rectangle) -> None:
4730-
"""Drawing functions change only pixels inside rec.
4731-
4732-
Can be nested.
4733-
"""
4734-
_rl.BeginClipRec(_rect(rec))
4738+
if ENABLE_V2_0_0_FEATURE_CLIPRECT:
4739+
_rl.BeginClipRec.argtypes = [Rectangle]
4740+
_rl.BeginClipRec.restype = None
4741+
def begin_clip_rec(rec: Rectangle) -> None:
4742+
"""Drawing functions change only pixels inside rec.
4743+
4744+
Can be nested.
4745+
"""
4746+
_rl.BeginClipRec(_rect(rec))
4747+
4748+
_rl.EndClipRec.argtypes = _NOARGS
4749+
_rl.EndClipRec.restype = None
4750+
def end_clip_rec() -> None:
4751+
"""Restore previous clip rec."""
4752+
_rl.EndClipRec()
4753+
else:
4754+
def begin_clip_rec(rec: Rectangle) -> None:
4755+
"""WARNING: THIS FUNCTION HAS NO EFFECT."""
4756+
pass
47354757

4736-
_rl.EndClipRec.argtypes = _NOARGS
4737-
_rl.EndClipRec.restype = None
4738-
def end_clip_rec() -> None:
4739-
"""Restore previous clip rec."""
4740-
_rl.EndClipRec()
4758+
def end_clip_rec() -> None:
4759+
"""WARNING: THIS FUNCTION HAS NO EFFECT."""
4760+
pass
47414761

47424762
# VR control functions
47434763
_rl.GetVrDeviceInfo.argtypes = [Int]

0 commit comments

Comments
 (0)