@@ -2081,47 +2081,50 @@ def __str__(self) -> str:
2081
2081
return "(RENDERTEXTURE: {}w, {}h, texture: {}, depth: {})" .format (self .width , self .height , self .texture , self .depth )
2082
2082
2083
2083
2084
- class _NPatchInfo (Structure ):
2085
- _fields_ = [
2086
- ('sourceRec' , Rectangle ),
2087
- ('left' , c_int ),
2088
- ('top' , c_int ),
2089
- ('right' , c_int ),
2090
- ('bottom' , c_int ),
2091
- ('type' , c_int ),
2092
- ]
2093
-
2094
-
2095
- class NPatchInfo (_NPatchInfo ):
2096
-
2097
- def __init__ (self , source_rec : 'Rectangle' , left : int = 1 , top :int = 1 , right : int = 1 , bottom : int = 1 , npatch_type : Union [int , 'NPatchType' ]= 0 ) -> None :
2098
- if npatch_type not in NPatchType :
2099
- npatch_type = {
2084
+ if ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH :
2085
+ class _NPatchInfo (Structure ):
2086
+ _fields_ = [
2087
+ ('sourceRec' , Rectangle ),
2088
+ ('left' , c_int ),
2089
+ ('top' , c_int ),
2090
+ ('right' , c_int ),
2091
+ ('bottom' , c_int ),
2092
+ ('type' , c_int ),
2093
+ ]
2094
+
2095
+ class NPatchInfo (_NPatchInfo ):
2096
+
2097
+ def __init__ (self , source_rec : 'Rectangle' , left : int = 1 , top :int = 1 , right : int = 1 , bottom : int = 1 , npatch_type : Union [int , 'NPatchType' ]= 0 ) -> None :
2098
+ if npatch_type not in NPatchType :
2099
+ npatch_type = {
2100
+ 0 : NPT_9PATCH ,
2101
+ 1 : NPT_3PATCH_VERTICAL ,
2102
+ 2 : NPT_3PATCH_VERTICAL
2103
+ }.get (npatch_type , NPT_9PATCH )
2104
+
2105
+ super (NPatchInfo , self ).__init__ (source_rec , left , top , right , bottom , npatch_type )
2106
+
2107
+ def __str__ (self ) -> str :
2108
+ """Textual representation."""
2109
+ npt = {
2100
2110
0 : NPT_9PATCH ,
2101
2111
1 : NPT_3PATCH_VERTICAL ,
2102
2112
2 : NPT_3PATCH_VERTICAL
2103
- }.get (npatch_type , NPT_9PATCH )
2104
-
2105
- super (NPatchInfo , self ).__init__ (source_rec , left , top , right , bottom , npatch_type )
2106
-
2107
- def __str__ (self ) -> str :
2108
- """Textual representation."""
2109
- npt = {
2110
- 0 : NPT_9PATCH ,
2111
- 1 : NPT_3PATCH_VERTICAL ,
2112
- 2 : NPT_3PATCH_VERTICAL
2113
- }.get (self .type , NPT_9PATCH ).name
2114
- return "(NPATCHINFO: rec: {0.sourceRec}, ltrb: [{0.left}, {0.top}, {0.right}, {0.bottom}], type: {1})" .format (self , npt )
2115
-
2116
- def __repr__ (self ) -> str :
2117
- rc = repr (self .sourceRec )
2118
- npt = {
2119
- 0 : NPT_9PATCH ,
2120
- 1 : NPT_3PATCH_VERTICAL ,
2121
- 2 : NPT_3PATCH_VERTICAL
2122
- }.get (self .type , NPT_9PATCH ).name
2123
- return "{0.__class__.__qualname__}({1}, {0.left}, {0.top}, {0.right}, {0.bottom}, {2})" .format (self , rc , npt )
2113
+ }.get (self .type , NPT_9PATCH ).name
2114
+ return "(NPATCHINFO: rec: {0.sourceRec}, ltrb: [{0.left}, {0.top}, {0.right}, {0.bottom}], type: {1})" .format (self , npt )
2124
2115
2116
+ def __repr__ (self ) -> str :
2117
+ rc = repr (self .sourceRec )
2118
+ npt = {
2119
+ 0 : NPT_9PATCH ,
2120
+ 1 : NPT_3PATCH_VERTICAL ,
2121
+ 2 : NPT_3PATCH_VERTICAL
2122
+ }.get (self .type , NPT_9PATCH ).name
2123
+ return "{0.__class__.__qualname__}({1}, {0.left}, {0.top}, {0.right}, {0.bottom}, {2})" .format (self , rc , npt )
2124
+ else :
2125
+ class NPatchInfo :
2126
+ __slots__ = 'source_rec' , 'left' , 'top' , 'right' , 'bottom' , 'type'
2127
+ pass
2125
2128
2126
2129
class CharInfo (Structure ):
2127
2130
_fields_ = [
@@ -4089,10 +4092,11 @@ def draw_texture_pro(texture: Texture2D, source_rec: Union[Rectangle, Seq], dest
4089
4092
_rl .DrawTextureNPatch .argtypes = [Texture2D , NPatchInfo , Rectangle , Vector2 , Float , Color ]
4090
4093
_rl .DrawTextureNPatch .restype = None
4091
4094
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 """
4095
+ """Draws a textures that stretches and shrinks nicely. """
4093
4096
return _rl .DrawNPatch (texture , npatch_info , _rect (dest_rec ), _vec2 (origin ), _float (rotation ), _color (tint ))
4094
4097
else :
4095
4098
def draw_texture_npatch (* args , ** kwargs ) -> None :
4099
+ """WARNING: THIS FUNCTION HAS NO EFFECT!"""
4096
4100
pass
4097
4101
4098
4102
# -----------------------------------------------------------------------------------
0 commit comments