Skip to content

Commit 2cc5f5d

Browse files
committed
Fewer function annotations to reflect expected enum values.
1 parent a766597 commit 2cc5f5d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

raylibpy/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import os
33
from math import modf
4-
from enum import IntEnum
4+
from enum import IntEnum, IntFlag
55
from typing import Tuple, Union, Sequence, AnyStr
66
from ctypes import (
77
c_bool,
@@ -2225,7 +2225,7 @@ class BlendMode(IntEnum):
22252225
BLEND_ADDITIVE = BlendMode.BLEND_ADDITIVE
22262226
BLEND_MULTIPLIED = BlendMode.BLEND_MULTIPLIED
22272227

2228-
class Gestures(IntEnum):
2228+
class Gestures(IntFlag):
22292229
GESTURE_NONE = 0
22302230
GESTURE_TAP = 1
22312231
GESTURE_DOUBLETAP = 2
@@ -2940,7 +2940,7 @@ def get_touch_position(index: int) -> Vector2:
29402940
# -----------------------------------------------------------------------------------
29412941
_rl.SetGesturesEnabled.argtypes = [UInt]
29422942
_rl.SetGesturesEnabled.restype = None
2943-
def set_gestures_enabled(gesture_flags: int) -> None:
2943+
def set_gestures_enabled(gesture_flags: Union[int, Gestures]) -> None:
29442944
"""Enable a set of gestures using flags"""
29452945
return _rl.SetGesturesEnabled(_int(gesture_flags))
29462946

@@ -3006,7 +3006,7 @@ def get_gesture_pinch_angle() -> float:
30063006
# -----------------------------------------------------------------------------------
30073007
_rl.SetCameraMode.argtypes = [Camera, Int]
30083008
_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:
30103010
"""Set camera mode (multiple camera modes available)"""
30113011
return _rl.SetCameraMode(camera, _int(mode))
30123012

@@ -3291,14 +3291,14 @@ def load_image_ex(pixels: ColorPtr, width: int, height: int) -> Image:
32913291

32923292
_rl.LoadImagePro.argtypes = [VoidPtr, Int, Int, Int]
32933293
_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:
32953295
"""Load image from raw data with parameters"""
32963296
return _rl.LoadImagePro(data, _int(width), _int(height), _int(img_format))
32973297

32983298

32993299
_rl.LoadImageRaw.argtypes = [CharPtr, Int, Int, Int, Int]
33003300
_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:
33023302
"""Load image from RAW file data"""
33033303
return _rl.LoadImageRaw(_str_in(file_name), _int(width), _int(height), _int(img_format), _int(header_size))
33043304

@@ -3368,7 +3368,7 @@ def get_image_data_normalized(image: Image) -> Vector4Ptr:
33683368

33693369
_rl.GetPixelDataSize.argtypes = [Int, Int, Int]
33703370
_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:
33723372
"""Get pixel data size in bytes (image or texture)"""
33733373
return _rl.GetPixelDataSize(_int(width), _int(height), _int(pxl_format))
33743374

@@ -3404,7 +3404,7 @@ def image_to_pot(image: Image, fill_color: Union[Color, Seq]) -> None:
34043404

34053405
_rl.ImageFormat.argtypes = [ImagePtr, Int]
34063406
_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:
34083408
"""Convert image data to desired format"""
34093409
return _rl.ImageFormat(image, _int(new_format))
34103410

@@ -4338,7 +4338,7 @@ def end_shader_mode() -> None:
43384338

43394339
_rl.BeginBlendMode.argtypes = [Int]
43404340
_rl.BeginBlendMode.restype = None
4341-
def begin_blend_mode(mode: int) -> None:
4341+
def begin_blend_mode(mode: Union[int, BlendMode]) -> None:
43424342
"""Begin blending mode (alpha, additive, multiplied)"""
43434343
return _rl.BeginBlendMode(_int(mode))
43444344

@@ -4353,7 +4353,7 @@ def end_blend_mode() -> None:
43534353
# VR control functions
43544354
_rl.GetVrDeviceInfo.argtypes = [Int]
43554355
_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]):
43574357
"""Get VR device information for some standard devices"""
43584358
return _rl.GetVrDeviceInfo(_int(vr_device_type))
43594359

0 commit comments

Comments
 (0)