968
968
# -------------------------------------------------------------------
969
969
970
970
class Vector2 (Structure ):
971
+ """
972
+ Wrapper for raylib Vector2 struct:
973
+
974
+ typedef struct Vector2 {
975
+ float x;
976
+ float y;
977
+ } Vector2;
978
+ """
971
979
_fields_ = [
972
980
('x' , c_float ),
973
981
('y' , c_float )
@@ -978,6 +986,15 @@ class Vector2(Structure):
978
986
979
987
980
988
class Vector3 (Structure ):
989
+ """
990
+ Wrapper for raylib Vector3 struct:
991
+
992
+ typedef struct Vector3 {
993
+ float x;
994
+ float y;
995
+ float z;
996
+ } Vector3;
997
+ """
981
998
_fields_ = [
982
999
('x' , c_float ),
983
1000
('y' , c_float ),
@@ -989,6 +1006,16 @@ class Vector3(Structure):
989
1006
990
1007
991
1008
class Vector4 (Structure ):
1009
+ """
1010
+ Wrapper for raylib Vector4 struct:
1011
+
1012
+ typedef struct Vector4 {
1013
+ float x;
1014
+ float y;
1015
+ float z;
1016
+ float w;
1017
+ } Vector4;
1018
+ """
992
1019
_fields_ = [
993
1020
('x' , c_float ),
994
1021
('y' , c_float ),
@@ -1057,7 +1084,6 @@ class Image(Structure):
1057
1084
1058
1085
class Texture2D (Structure ):
1059
1086
_fields_ = [
1060
- ('data' , c_void_p ),
1061
1087
('id' , c_uint ),
1062
1088
('width' , c_int ),
1063
1089
('height' , c_int ),
@@ -1454,7 +1480,11 @@ class VrDeviceInfo(Structure):
1454
1480
_rl .InitWindow .restype = None
1455
1481
def init_window (width : int , height : int , title : bytes ) -> None :
1456
1482
"""Initialize window and OpenGL context"""
1457
- return _rl .InitWindow (width , height , title )
1483
+ return _rl .InitWindow (
1484
+ width if isinstance (width , int ) else int (width ),
1485
+ height if isinstance (width , int ) else int (width ),
1486
+ title if isinstance (title , bytes ) else title .encode ('utf-8' , 'ignore' )
1487
+ )
1458
1488
1459
1489
1460
1490
_rl .CloseWindow .argtypes = _NOARGS
@@ -1510,28 +1540,38 @@ def set_window_title(title: bytes) -> None:
1510
1540
_rl .SetWindowPosition .restype = None
1511
1541
def set_window_position (x : int , y : int ) -> None :
1512
1542
"""Set window position on screen (only PLATFORM_DESKTOP)"""
1513
- return _rl .SetWindowPosition (x , y )
1543
+ return _rl .SetWindowPosition (
1544
+ x if isinstance (x , int ) else int (x ),
1545
+ y if isinstance (y , int ) else int (y )
1546
+ )
1547
+
1548
+ def set_window_position_v (pos : Vector2 ) -> None :
1549
+ """Set window position on screen (only PLATFORM_DESKTOP)"""
1550
+ return _rl .SetWindowPosition (
1551
+ pos .x if isinstance (pos .x , int ) else int (pos .x ),
1552
+ pos .y if isinstance (pos .y , int ) else int (pos .y )
1553
+ )
1514
1554
1515
1555
1516
1556
_rl .SetWindowMonitor .argtypes = [Int ]
1517
1557
_rl .SetWindowMonitor .restype = None
1518
1558
def set_window_monitor (monitor : int ) -> None :
1519
1559
"""Set monitor for the current window (fullscreen mode)"""
1520
- return _rl .SetWindowMonitor (monitor )
1560
+ return _rl .SetWindowMonitor (int ( monitor ) )
1521
1561
1522
1562
1523
1563
_rl .SetWindowMinSize .argtypes = [Int , Int ]
1524
1564
_rl .SetWindowMinSize .restype = None
1525
1565
def set_window_min_size (width : int , height : int ) -> None :
1526
1566
"""Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)"""
1527
- return _rl .SetWindowMinSize (width , height )
1567
+ return _rl .SetWindowMinSize (int ( width ), int ( height ) )
1528
1568
1529
1569
1530
1570
_rl .SetWindowSize .argtypes = [Int , Int ]
1531
1571
_rl .SetWindowSize .restype = None
1532
1572
def set_window_size (width : int , height : int ):
1533
1573
"""Set window dimensions"""
1534
- return _rl .SetWindowSize (width , height )
1574
+ return _rl .SetWindowSize (int ( width ), int ( height ) )
1535
1575
1536
1576
1537
1577
_rl .GetScreenWidth .argtypes = _NOARGS
@@ -1829,11 +1869,14 @@ def is_file_dropped() -> bool:
1829
1869
1830
1870
_rl .GetDroppedFiles .argtypes = [IntPtr ]
1831
1871
_rl .GetDroppedFiles .restype = CharPtrPrt
1832
- def get_dropped_files () -> Tuple [int , bytes ]:
1872
+ def get_dropped_files () -> Tuple [str , ... ]:
1833
1873
"""Get dropped files names"""
1834
1874
count = Int (0 )
1835
- files : bytes = _rl .GetDroppedFiles (byref (count ))
1836
- return count .value , files
1875
+ result = _rl .GetDroppedFiles (byref (count ))
1876
+ files : list = []
1877
+ for i in range (count .value ):
1878
+ files .append (result [i ].decode ('utf-8' ))
1879
+ return tuple (files )
1837
1880
1838
1881
1839
1882
_rl .ClearDroppedFiles .argtypes = _NOARGS
@@ -2409,7 +2452,7 @@ def check_collision_point_triangle(point: Vector2, p1: Vector2, p2: Vector2, p3:
2409
2452
_rl .LoadImage .restype = Image
2410
2453
def load_image (file_name : bytes ) -> Image :
2411
2454
"""Load image from file into CPU memory (RAM)"""
2412
- return _rl .LoadImage (file_name )
2455
+ return _rl .LoadImage (file_name if isinstance ( file_name , bytes ) else file_name . encode ( 'utf-8' , 'ignore' ) )
2413
2456
2414
2457
2415
2458
_rl .LoadImageEx .argtypes = [ColorPtr , Int , Int ]
@@ -2891,7 +2934,8 @@ def draw_fps(pos_x: int, pos_y: int) -> None:
2891
2934
_rl .DrawText .restype = None
2892
2935
def draw_text (text : bytes , pos_x : int , pos_y : int , font_size : int , color : Color ) -> None :
2893
2936
"""Draw text (using default font)"""
2894
- return _rl .DrawText (text , pos_x , pos_y , font_size , color )
2937
+ return _rl .DrawText (text if isinstance (text , bytes ) else text .encode ('utf-8' , 'ignore' ),
2938
+ pos_x , pos_y , font_size , color )
2895
2939
2896
2940
2897
2941
_rl .DrawTextEx .argtypes = [Font , CharPtr , Vector2 , Float , Float , Color ]
0 commit comments