1
1
import sys
2
2
import os
3
3
from math import modf
4
- from enum import IntEnum
4
+ from enum import IntEnum , IntFlag
5
5
from typing import Tuple , Union , Sequence , AnyStr
6
6
from ctypes import (
7
7
c_bool ,
@@ -2225,7 +2225,7 @@ class BlendMode(IntEnum):
2225
2225
BLEND_ADDITIVE = BlendMode .BLEND_ADDITIVE
2226
2226
BLEND_MULTIPLIED = BlendMode .BLEND_MULTIPLIED
2227
2227
2228
- class Gestures (IntEnum ):
2228
+ class Gestures (IntFlag ):
2229
2229
GESTURE_NONE = 0
2230
2230
GESTURE_TAP = 1
2231
2231
GESTURE_DOUBLETAP = 2
@@ -2940,7 +2940,7 @@ def get_touch_position(index: int) -> Vector2:
2940
2940
# -----------------------------------------------------------------------------------
2941
2941
_rl .SetGesturesEnabled .argtypes = [UInt ]
2942
2942
_rl .SetGesturesEnabled .restype = None
2943
- def set_gestures_enabled (gesture_flags : int ) -> None :
2943
+ def set_gestures_enabled (gesture_flags : Union [ int , Gestures ] ) -> None :
2944
2944
"""Enable a set of gestures using flags"""
2945
2945
return _rl .SetGesturesEnabled (_int (gesture_flags ))
2946
2946
@@ -3006,7 +3006,7 @@ def get_gesture_pinch_angle() -> float:
3006
3006
# -----------------------------------------------------------------------------------
3007
3007
_rl .SetCameraMode .argtypes = [Camera , Int ]
3008
3008
_rl .SetCameraMode .restype = None
3009
- def set_camera_mode (camera : Camera , mode : int ) -> None :
3009
+ def set_camera_mode (camera : Camera , mode : Union [ int , CameraMode ] ) -> None :
3010
3010
"""Set camera mode (multiple camera modes available)"""
3011
3011
return _rl .SetCameraMode (camera , _int (mode ))
3012
3012
@@ -3291,14 +3291,14 @@ def load_image_ex(pixels: ColorPtr, width: int, height: int) -> Image:
3291
3291
3292
3292
_rl .LoadImagePro .argtypes = [VoidPtr , Int , Int , Int ]
3293
3293
_rl .LoadImagePro .restype = Image
3294
- def load_image_pro (data : Union [VoidPtr , bytes ], width : int , height : int , img_format : int ) -> Image :
3294
+ def load_image_pro (data : Union [VoidPtr , bytes ], width : int , height : int , img_format : Union [ int , PixelFormat ] ) -> Image :
3295
3295
"""Load image from raw data with parameters"""
3296
3296
return _rl .LoadImagePro (data , _int (width ), _int (height ), _int (img_format ))
3297
3297
3298
3298
3299
3299
_rl .LoadImageRaw .argtypes = [CharPtr , Int , Int , Int , Int ]
3300
3300
_rl .LoadImageRaw .restype = Image
3301
- def load_image_raw (file_name : AnyStr , width : int , height : int , img_format : int , header_size : int ) -> Image :
3301
+ def load_image_raw (file_name : AnyStr , width : int , height : int , img_format : Union [ int , PixelFormat ] , header_size : int ) -> Image :
3302
3302
"""Load image from RAW file data"""
3303
3303
return _rl .LoadImageRaw (_str_in (file_name ), _int (width ), _int (height ), _int (img_format ), _int (header_size ))
3304
3304
@@ -3368,7 +3368,7 @@ def get_image_data_normalized(image: Image) -> Vector4Ptr:
3368
3368
3369
3369
_rl .GetPixelDataSize .argtypes = [Int , Int , Int ]
3370
3370
_rl .GetPixelDataSize .restype = Int
3371
- def get_pixel_data_size (width : int , height : int , pxl_format : int ) -> int :
3371
+ def get_pixel_data_size (width : int , height : int , pxl_format : Union [ int , PixelFormat ] ) -> int :
3372
3372
"""Get pixel data size in bytes (image or texture)"""
3373
3373
return _rl .GetPixelDataSize (_int (width ), _int (height ), _int (pxl_format ))
3374
3374
@@ -3404,7 +3404,7 @@ def image_to_pot(image: Image, fill_color: Union[Color, Seq]) -> None:
3404
3404
3405
3405
_rl .ImageFormat .argtypes = [ImagePtr , Int ]
3406
3406
_rl .ImageFormat .restype = None
3407
- def image_format (image : Image , new_format : int ) -> None :
3407
+ def image_format (image : Image , new_format : Union [ int , PixelFormat ] ) -> None :
3408
3408
"""Convert image data to desired format"""
3409
3409
return _rl .ImageFormat (image , _int (new_format ))
3410
3410
@@ -4338,7 +4338,7 @@ def end_shader_mode() -> None:
4338
4338
4339
4339
_rl .BeginBlendMode .argtypes = [Int ]
4340
4340
_rl .BeginBlendMode .restype = None
4341
- def begin_blend_mode (mode : int ) -> None :
4341
+ def begin_blend_mode (mode : Union [ int , BlendMode ] ) -> None :
4342
4342
"""Begin blending mode (alpha, additive, multiplied)"""
4343
4343
return _rl .BeginBlendMode (_int (mode ))
4344
4344
@@ -4353,7 +4353,7 @@ def end_blend_mode() -> None:
4353
4353
# VR control functions
4354
4354
_rl .GetVrDeviceInfo .argtypes = [Int ]
4355
4355
_rl .GetVrDeviceInfo .restype = VrDeviceInfo
4356
- def get_vr_device_info (vr_device_type : int ):
4356
+ def get_vr_device_info (vr_device_type : Union [ int , VrDeviceType ] ):
4357
4357
"""Get VR device information for some standard devices"""
4358
4358
return _rl .GetVrDeviceInfo (_int (vr_device_type ))
4359
4359
0 commit comments