Merge remote-tracking branch 'origin/master' into fix_underscore2

# Conflicts:
#	create_stub_pyray.py
#	docs/genindex.html
#	docs/objects.inv
#	docs/pyray.html
#	docs/raylib.html
#	docs/searchindex.js
#	dynamic/raylib/defines.py
#	make_docs.sh
#	pyray/__init__.pyi
#	raylib/__init__.pyi
#	raylib/build.py
#	raylib/defines.py
#	raylib/raylib.h.modified
#	raylib/rlgl.h.modified
#	version.py
This commit is contained in:
Richard Smith 2024-11-19 12:14:37 +00:00
commit fc9d66ed14
66 changed files with 13848 additions and 8888 deletions

View file

@ -10,6 +10,7 @@ exclude raylib/*.c
exclude raylib/*.o exclude raylib/*.o
include version.py include version.py
exclude tests/* exclude tests/*
include raylib/py.typed
include pyray/py.typed

View file

@ -30,6 +30,12 @@ for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), P
for st in js["structs"]: for st in js["structs"]:
if st["name"] not in known_structs: if st["name"] not in known_structs:
known_structs[st["name"]] = st known_structs[st["name"]] = st
for e in js['enums']:
if e['name'] and e['values']:
print ("class "+e['name']+"(int):")
for value in e['values']:
print(" "+value['name']+" = "+str(value['value']))
print("")
def ctype_to_python_type(t): def ctype_to_python_type(t):
@ -43,27 +49,39 @@ def ctype_to_python_type(t):
return "int" return "int"
elif t == "uint64_t": elif t == "uint64_t":
return "int" return "int"
elif t == "short":
return "int"
elif t == "unsigned short":
return "int"
elif t == "double": elif t == "double":
return "float" return "float"
elif "char * *" in t: elif "char * *" in t:
return "list[str]" return "list[str]"
elif "char *" in t: elif "char *" in t:
return "str" return "str"
elif "char" in t: elif t == "char":
return "str" # not sure about this one return "str" # not sure about this one
elif t == "unsigned char":
return "int"
elif "*" in t: elif "*" in t:
return "Any" return "Any"
elif "[" in t:
return "list" # TODO FIXME type of items in the list
elif t.startswith("struct"): elif t.startswith("struct"):
return t.replace("struct ", "") return t.replace("struct ", "")
elif t.startswith("unsigned"): elif t.startswith("unsigned"):
return t.replace("unsigned ", "") return t.replace("unsigned ", "")
elif t.startswith("enum"):
return t.replace("enum ", "")
else: else:
return t return t
print("""from typing import Any print("""from typing import Any
import _cffi_backend # type: ignore
ffi: _cffi_backend.FFI
""") """)
# These words can be used for c arg names, but not in python # These words can be used for c arg names, but not in python
@ -89,6 +107,8 @@ for name, attr in getmembers(rl):
if param_name in reserved_words: if param_name in reserved_words:
param_name = param_name + "_" + str(i) param_name = param_name + "_" + str(i)
param_type = ctype_to_python_type(arg.cname) param_type = ctype_to_python_type(arg.cname)
if "struct" in arg.cname:
param_type += "|list|tuple"
sig += f"{param_name}: {param_type}," sig += f"{param_name}: {param_type},"
return_type = ffi.typeof(attr).result.cname return_type = ffi.typeof(attr).result.cname
@ -127,11 +147,14 @@ for struct in ffi.list_types()[0]:
print(f' """ struct """') print(f' """ struct """')
sig = "" sig = ""
for arg in ffi.typeof(struct).fields: for arg in ffi.typeof(struct).fields:
sig += ", " + arg[0] ptype = ctype_to_python_type(arg[1].type.cname)
if arg[1].type.kind == "struct":
ptype += "|list|tuple"
sig += f", {arg[0]}: {ptype}|None = None"
print(f" def __init__(self{sig}):") print(f" def __init__(self{sig}):")
for arg in ffi.typeof(struct).fields: for arg in ffi.typeof(struct).fields:
print(f" self.{arg[0]}={arg[0]}") print(f" self.{arg[0]}:{ctype_to_python_type(arg[1].type.cname)} = {arg[0]} # type: ignore")
# elif ffi.typeof(struct).kind == "enum": # elif ffi.typeof(struct).kind == "enum":
# print(f"{struct}: int") # print(f"{struct}: int")

View file

@ -42,27 +42,35 @@ def ctype_to_python_type(t):
return "int" return "int"
elif t == "uint64_t": elif t == "uint64_t":
return "int" return "int"
elif t == "short":
return "int"
elif t == "unsigned short":
return "int"
elif t == "double": elif t == "double":
return "float" return "float"
elif "char * *" in t: elif "char * *" in t:
return "list[str]" return "list[bytes]"
elif "char *" in t: elif "char *" in t:
return "str" return "bytes"
elif "char" in t: elif "char" in t:
return "str" # not sure about this one return "bytes" # not sure about this one
elif "*" in t: elif "*" in t:
return "Any" return "Any"
elif "[" in t:
return "list" # TODO FIXME type of items in the list
elif t.startswith("struct"): elif t.startswith("struct"):
return t.replace("struct ", "") return t.replace("struct ", "")
elif t.startswith("unsigned"): elif t.startswith("unsigned"):
return t.replace("unsigned ", "") return t.replace("unsigned ", "")
elif t.startswith("enum"):
return t.replace("enum ", "")
else: else:
return t return t
print("""from typing import Any print("""from typing import Any
import _cffi_backend import _cffi_backend # type: ignore
ffi: _cffi_backend.FFI ffi: _cffi_backend.FFI
rl: _cffi_backend.Lib rl: _cffi_backend.Lib
@ -96,6 +104,8 @@ for name, attr in getmembers(rl):
if param_name in reserved_words: if param_name in reserved_words:
param_name = param_name + "_" + str(i) param_name = param_name + "_" + str(i)
param_type = ctype_to_python_type(arg.cname) param_type = ctype_to_python_type(arg.cname)
if "struct" in arg.cname:
param_type += "|list|tuple"
sig += f"{param_name}: {param_type}," sig += f"{param_name}: {param_type},"
return_type = ffi.typeof(attr).result.cname return_type = ffi.typeof(attr).result.cname
@ -121,17 +131,22 @@ for struct in ffi.list_types()[0]:
# if ffi.typeof(struct).fields is None: # if ffi.typeof(struct).fields is None:
# print("weird empty struct, skipping", file=sys.stderr) # print("weird empty struct, skipping", file=sys.stderr)
# continue # continue
print(f"{struct}: struct") print(f"class {struct}:")
# sig = "" # sig = ""
# for arg in ffi.typeof(struct).fields: fields = ffi.typeof(struct).fields
# sig += ", " + arg[0] if fields is not None:
#print(ffi.typeof(struct).fields)
#print(f" {arg}: {arg}")
# print(f" def __init__(self{sig}):") # print(f" def __init__(self{sig}):")
# #
# for arg in ffi.typeof(struct).fields: for arg in ffi.typeof(struct).fields:
print(f" {arg[0]}: {ctype_to_python_type(arg[1].type.cname)}")
else:
print(" ...")
# print(f" self.{arg[0]}={arg[0]}") # print(f" self.{arg[0]}={arg[0]}")
elif ffi.typeof(struct).kind == "enum": elif ffi.typeof(struct).kind == "enum":
print(f"{struct}: int") print(f"{struct} = int")
else: else:
print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr) print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -8,4 +8,6 @@ include raylib/*.so
include version.py include version.py
exclude raylib/*.a exclude raylib/*.a
exclude raylib/*.c exclude raylib/*.c
exclude raylib/*.o exclude raylib/*.o
include raylib/py.typed
include pyray/py.typed

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@ import raylib
RAYLIB_VERSION_MAJOR: int = 5 RAYLIB_VERSION_MAJOR: int = 5
RAYLIB_VERSION_MINOR: int = 5 RAYLIB_VERSION_MINOR: int = 5
RAYLIB_VERSION_PATCH: int = 0 RAYLIB_VERSION_PATCH: int = 0
RAYLIB_VERSION: str = "5.5-dev" RAYLIB_VERSION: str = "5.5"
PI: float = 3.141592653589793 PI: float = 3.141592653589793
DEG2RAD = PI / 180.0 DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI RAD2DEG = 180.0 / PI
@ -14,10 +14,7 @@ MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS
PI: float = 3.141592653589793
EPSILON: float = 1e-06 EPSILON: float = 1e-06
DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI
RLGL_VERSION: str = "5.0" RLGL_VERSION: str = "5.0"
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192 RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
RL_DEFAULT_BATCH_BUFFERS: int = 1 RL_DEFAULT_BATCH_BUFFERS: int = 1
@ -102,9 +99,6 @@ RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS: int = 7
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8 RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8
RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO
RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
PI: float = 3.141592653589793
DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI
GL_SHADING_LANGUAGE_VERSION: int = 35724 GL_SHADING_LANGUAGE_VERSION: int = 35724
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776 GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777

View file

@ -297,7 +297,6 @@ class CubemapLayout(IntEnum):
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
CUBEMAP_LAYOUT_PANORAMA = 5
class FontType(IntEnum): class FontType(IntEnum):
FONT_DEFAULT = 0 FONT_DEFAULT = 0

0
dynamic/raylib/py.typed Normal file
View file

View file

@ -6,26 +6,6 @@ raylib [audio] example - playing
import dataclasses import dataclasses
import pyray import pyray
import raylib as rl import raylib as rl
from raylib.colors import (
RAYWHITE,
ORANGE,
RED,
GOLD,
LIME,
BLUE,
VIOLET,
BROWN,
LIGHTGRAY,
PINK,
YELLOW,
GREEN,
SKYBLUE,
PURPLE,
BEIGE,
MAROON,
GRAY,
BLACK
)
MAX_CIRCLES=64 MAX_CIRCLES=64
@ -33,12 +13,11 @@ MAX_CIRCLES=64
@dataclasses.dataclass @dataclasses.dataclass
class CircleWave: class CircleWave:
position: 'rl.Vector2' position: pyray.Vector2
radius: float radius: float
alpha: float alpha: float
speed: float speed: float
color: 'rl.Color' color: pyray.Color
screenWidth = 800 screenWidth = 800
screenHeight = 450 screenHeight = 450
@ -49,8 +28,8 @@ rl.InitWindow(screenWidth, screenHeight, b"raylib [audio] example - module playi
rl.InitAudioDevice() # Initialize audio device rl.InitAudioDevice() # Initialize audio device
colors = [ ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, colors = [pyray.ORANGE, pyray.RED, pyray.GOLD, pyray.LIME, pyray.BLUE, pyray.VIOLET, pyray.BROWN, pyray.LIGHTGRAY, pyray.PINK,
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE ] pyray.YELLOW, pyray.GREEN, pyray.SKYBLUE, pyray.PURPLE, pyray.BEIGE]
# Creates some circles for visual effect # Creates some circles for visual effect
circles = [] circles = []
@ -141,23 +120,23 @@ while not rl.WindowShouldClose(): # Detect window close button or ESC key
#---------------------------------------------------------------------------------- #----------------------------------------------------------------------------------
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(pyray.RAYWHITE)
for i in range(MAX_CIRCLES): for i in range(MAX_CIRCLES):
pyray.draw_circle_v(circles[i].position, circles[i].radius, rl.Fade(circles[i].color, circles[i].alpha)) pyray.draw_circle_v(circles[i].position, circles[i].radius, pyray.fade(circles[i].color, circles[i].alpha))
# Draw time bar # Draw time bar
pyray.draw_rectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY) pyray.draw_rectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, pyray.LIGHTGRAY)
pyray.draw_rectangle(20, screenHeight - 20 - 12, int(timePlayed), 12, MAROON) pyray.draw_rectangle(20, screenHeight - 20 - 12, int(timePlayed), 12, pyray.MAROON)
pyray.draw_rectangle_lines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY) pyray.draw_rectangle_lines(20, screenHeight - 20 - 12, screenWidth - 40, 12, pyray.GRAY)
# Draw help instructions # Draw help instructions
pyray.draw_rectangle(20, 20, 425, 145, RAYWHITE) pyray.draw_rectangle(20, 20, 425, 145, pyray.RAYWHITE)
pyray.draw_rectangle_lines(20, 20, 425, 145, GRAY) pyray.draw_rectangle_lines(20, 20, 425, 145, pyray.GRAY)
pyray.draw_text("PRESS SPACE TO RESTART MUSIC", 40, 40, 20, BLACK) pyray.draw_text("PRESS SPACE TO RESTART MUSIC", 40, 40, 20, pyray.BLACK)
pyray.draw_text("PRESS P TO PAUSE/RESUME", 40, 70, 20, BLACK) pyray.draw_text("PRESS P TO PAUSE/RESUME", 40, 70, 20, pyray.BLACK)
pyray.draw_text("PRESS UP/DOWN TO CHANGE SPEED", 40, 100, 20, BLACK) pyray.draw_text("PRESS UP/DOWN TO CHANGE SPEED", 40, 100, 20, pyray.BLACK)
pyray.draw_text(f"SPEED: {pitch}", 40, 130, 20, MAROON) pyray.draw_text(f"SPEED: {pitch}", 40, 130, 20, pyray.MAROON)
pyray.end_drawing() pyray.end_drawing()
#---------------------------------------------------------------------------------- #----------------------------------------------------------------------------------

View file

@ -57,18 +57,18 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
# Update # Update
# Player movement # Player movement
if pyray.is_key_down(pyray.KEY_RIGHT): if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
player.x += 2 player.x += 2
elif pyray.is_key_down(pyray.KEY_LEFT): elif pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
player.x -= 2 player.x -= 2
# Camera target follows player # Camera target follows player
camera.target = pyray.Vector2(player.x + 20, player.y + 20) camera.target = pyray.Vector2(player.x + 20, player.y + 20)
# Camera rotation controls # Camera rotation controls
if pyray.is_key_down(pyray.KEY_A): if pyray.is_key_down(pyray.KeyboardKey.KEY_A):
camera.rotation -= 1 camera.rotation -= 1
elif pyray.is_key_down(pyray.KEY_S): elif pyray.is_key_down(pyray.KeyboardKey.KEY_S):
camera.rotation += 1 camera.rotation += 1
# Limit camera rotation to 80 degrees (-40 to 40) # Limit camera rotation to 80 degrees (-40 to 40)
@ -86,7 +86,7 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
camera.zoom = 0.1 camera.zoom = 0.1
# Camera reset (zoom and rotation) # Camera reset (zoom and rotation)
if pyray.is_key_pressed(pyray.KEY_R): if pyray.is_key_pressed(pyray.KeyboardKey.KEY_R):
camera.zoom = 1.0 camera.zoom = 1.0
camera.rotation = 0.0 camera.rotation = 0.0

View file

@ -13,15 +13,14 @@ pyray.set_target_fps(60)
camera = pyray.Camera2D() camera = pyray.Camera2D()
camera = pyray.Camera2D()
camera.zoom = 1.0 camera.zoom = 1.0
pyray.set_target_fps(60); pyray.set_target_fps(60)
# main game loop # main game loop
while not pyray.window_should_close(): while not pyray.window_should_close():
# update # update
if pyray.is_mouse_button_down(pyray.MOUSE_BUTTON_RIGHT): if pyray.is_mouse_button_down(pyray.MouseButton.MOUSE_BUTTON_RIGHT):
delta = pyray.get_mouse_delta() delta = pyray.get_mouse_delta()
delta = pyray.vector2_scale(delta, -1.0 / camera.zoom) delta = pyray.vector2_scale(delta, -1.0 / camera.zoom)
camera.target = pyray.vector2_add(camera.target, delta) camera.target = pyray.vector2_add(camera.target, delta)
@ -58,7 +57,7 @@ while not pyray.window_should_close():
pyray.end_mode_2d() pyray.end_mode_2d()
pyray.draw_text("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, pyray.WHITE); pyray.draw_text("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, pyray.WHITE)
pyray.end_drawing() pyray.end_drawing()

View file

@ -62,11 +62,11 @@ class EnvItem:
def update_player(player, env_items, delta): def update_player(player, env_items, delta):
if pyray.is_key_down(pyray.KEY_LEFT): if pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
player.position.x -= PLAYER_HOR_SPD * delta player.position.x -= PLAYER_HOR_SPD * delta
if pyray.is_key_down(pyray.KEY_RIGHT): if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
player.position.x += PLAYER_HOR_SPD * delta player.position.x += PLAYER_HOR_SPD * delta
if pyray.is_key_down(pyray.KEY_SPACE) and player.can_jump: if pyray.is_key_down(pyray.KeyboardKey.KEY_SPACE) and player.can_jump:
player.speed = -PLAYER_JUMP_SPD player.speed = -PLAYER_JUMP_SPD
player.can_jump = False player.can_jump = False
@ -264,11 +264,11 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
elif camera.zoom < 0.25: elif camera.zoom < 0.25:
camera.zoom = 0.25 camera.zoom = 0.25
if pyray.is_key_pressed(pyray.KEY_R): if pyray.is_key_pressed(pyray.KeyboardKey.KEY_R):
camera.zoom = 1.0 camera.zoom = 1.0
player.position = pyray.Vector2(400, 280) player.position = pyray.Vector2(400, 280)
if pyray.is_key_pressed(pyray.KEY_C): if pyray.is_key_pressed(pyray.KeyboardKey.KEY_C):
camera_option = (camera_option + 1) % camera_updaters_length camera_option = (camera_option + 1) % camera_updaters_length
# Call update camera function by its pointer # Call update camera function by its pointer

View file

@ -10,7 +10,7 @@ MAX_COLUMNS = 20
SCREEN_WIDTH = 800 SCREEN_WIDTH = 800
SCREEN_HEIGHT = 450 SCREEN_HEIGHT = 450
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, b"raylib [core] example - 3d camera first person") pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - 3d camera first person")
# Define the camera to look into our 3d world (position, target, up vector) # Define the camera to look into our 3d world (position, target, up vector)
camera = pyray.Camera3D() camera = pyray.Camera3D()
@ -18,24 +18,24 @@ camera.position = pyray.Vector3(4.0, 2.0, 4.0)
camera.target = pyray.Vector3(0.0, 1.8, 0.0) camera.target = pyray.Vector3(0.0, 1.8, 0.0)
camera.up = pyray.Vector3(0.0, 1.0, 0.0) camera.up = pyray.Vector3(0.0, 1.0, 0.0)
camera.fovy = 60.0 camera.fovy = 60.0
camera.projection = pyray.CAMERA_PERSPECTIVE camera.projection = pyray.CameraProjection.CAMERA_PERSPECTIVE
# Generates some random columns # Generates some random columns
heights = [None] * MAX_COLUMNS heights = []
positions = [None] * MAX_COLUMNS positions = []
colors = [None] * MAX_COLUMNS colors = []
for i in range(MAX_COLUMNS): for i in range(MAX_COLUMNS):
heights[i] = pyray.get_random_value(1, 12) * 1.0 heights.append(pyray.get_random_value(1, 12) * 1.0)
positions[i] = pyray.Vector3(pyray.get_random_value(-15, 15) * 1.0, heights[i]/2.0 * 1.0, pyray.get_random_value(-15, 15) * 1.0) positions.append(pyray.Vector3(pyray.get_random_value(-15, 15) * 1.0, heights[i]/2.0 * 1.0, pyray.get_random_value(-15, 15) * 1.0))
colors[i] = pyray.Color(pyray.get_random_value(20, 255), pyray.get_random_value(10, 55), 30, 255) colors.append(pyray.Color(pyray.get_random_value(20, 255), pyray.get_random_value(10, 55), 30, 255))
pyray.set_target_fps(60) pyray.set_target_fps(60)
while not pyray.window_should_close(): while not pyray.window_should_close():
pyray.update_camera(camera, pyray.CAMERA_FIRST_PERSON) pyray.update_camera(camera, pyray.CameraMode.CAMERA_FIRST_PERSON)
pyray.begin_drawing() pyray.begin_drawing()

View file

@ -25,7 +25,7 @@ while not window_should_close(): # Detect window close button or ESC key
# Update # Update
update_camera(camera, CameraMode.CAMERA_FREE) update_camera(camera, CameraMode.CAMERA_FREE)
if is_key_pressed(KEY_Z): if is_key_pressed(KeyboardKey.KEY_Z):
camera.target = Vector3(0.0, 0.0, 0.0) camera.target = Vector3(0.0, 0.0, 0.0)
# Draw # Draw

View file

@ -40,7 +40,7 @@ while not pyray.window_should_close():
pyray.end_mode_3d() pyray.end_mode_3d()
pyray.draw_text("Welcome to the third dimension!", 10, 40, 20, pyray.DARKGRAY); pyray.draw_text("Welcome to the third dimension!", 10, 40, 20, pyray.DARKGRAY)
pyray.draw_fps(10, 10) pyray.draw_fps(10, 10)

View file

@ -27,13 +27,13 @@ def main():
if frame_count > 120: if frame_count > 120:
current_screen = GameScreen.TITLE current_screen = GameScreen.TITLE
elif current_screen == GameScreen.TITLE: elif current_screen == GameScreen.TITLE:
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP): if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
current_screen = GameScreen.GAMEPLAY current_screen = GameScreen.GAMEPLAY
elif current_screen == GameScreen.GAMEPLAY: elif current_screen == GameScreen.GAMEPLAY:
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP): if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
current_screen = GameScreen.ENDING current_screen = GameScreen.ENDING
elif current_screen == GameScreen.ENDING: elif current_screen == GameScreen.ENDING:
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP): if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
current_screen = GameScreen.TITLE current_screen = GameScreen.TITLE
begin_drawing() begin_drawing()

View file

@ -11,12 +11,6 @@
""" """
import pyray import pyray
from raylib.colors import (
RAYWHITE,
DARKGRAY,
LIGHTGRAY,
GRAY
)
screenWidth = 800 screenWidth = 800
screenHeight = 450 screenHeight = 450
@ -36,21 +30,21 @@ while not pyray.window_should_close():
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(pyray.RAYWHITE)
if droppedFiles.count == 0: if droppedFiles.count == 0:
pyray.draw_text("Drop your files to this window!", 100, 40, 20, DARKGRAY) pyray.draw_text("Drop your files to this window!", 100, 40, 20, pyray.DARKGRAY)
else: else:
pyray.draw_text("Dropped files:", 100, 40, 20, DARKGRAY) pyray.draw_text("Dropped files:", 100, 40, 20, pyray.DARKGRAY)
for i in range(0, droppedFiles.count): for i in range(0, droppedFiles.count):
if i % 2 == 0: if i % 2 == 0:
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.5)) pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(pyray.LIGHTGRAY, 0.5))
else: else:
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.3)) pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(pyray.LIGHTGRAY, 0.3))
pyray.draw_text(droppedFiles.paths[i], 120, 100 + 40*i, 10, GRAY) pyray.draw_text(droppedFiles.paths[i], 120, 100 + 40*i, 10, pyray.GRAY)
pyray.draw_text("Drop new files...", 100, 110 + 40*droppedFiles.count, 20, DARKGRAY) pyray.draw_text("Drop new files...", 100, 110 + 40*droppedFiles.count, 20, pyray.DARKGRAY)
pyray.end_drawing() pyray.end_drawing()
# De-Initialization # De-Initialization

View file

@ -4,13 +4,6 @@ raylib [core] example - Input Gestures Detection
""" """
import pyray import pyray
from raylib.colors import (
RAYWHITE,
LIGHTGRAY,
DARKGRAY,
MAROON,
GRAY,
)
@ -26,20 +19,20 @@ touch_area = pyray.Rectangle(220, 10, SCREEN_WIDTH - 230, SCREEN_HEIGHT - 20)
gesture_strings = [] gesture_strings = []
current_gesture = pyray.GESTURE_NONE current_gesture = pyray.Gesture.GESTURE_NONE
last_gesture = pyray.GESTURE_NONE last_gesture = pyray.Gesture.GESTURE_NONE
GESTURE_LABELS = { GESTURE_LABELS = {
pyray.GESTURE_TAP: 'GESTURE TAP', pyray.Gesture.GESTURE_TAP: 'GESTURE TAP',
pyray.GESTURE_DOUBLETAP: 'GESTURE DOUBLETAP', pyray.Gesture.GESTURE_DOUBLETAP: 'GESTURE DOUBLETAP',
pyray.GESTURE_HOLD: 'GESTURE HOLD', pyray.Gesture.GESTURE_HOLD: 'GESTURE HOLD',
pyray.GESTURE_DRAG: 'GESTURE DRAG', pyray.Gesture.GESTURE_DRAG: 'GESTURE DRAG',
pyray.GESTURE_SWIPE_RIGHT: 'GESTURE SWIPE RIGHT', pyray.Gesture.GESTURE_SWIPE_RIGHT: 'GESTURE SWIPE RIGHT',
pyray.GESTURE_SWIPE_LEFT: 'GESTURE SWIPE LEFT', pyray.Gesture.GESTURE_SWIPE_LEFT: 'GESTURE SWIPE LEFT',
pyray.GESTURE_SWIPE_UP: 'GESTURE SWIPE UP', pyray.Gesture.GESTURE_SWIPE_UP: 'GESTURE SWIPE UP',
pyray.GESTURE_SWIPE_DOWN: 'GESTURE SWIPE DOWN', pyray.Gesture.GESTURE_SWIPE_DOWN: 'GESTURE SWIPE DOWN',
pyray.GESTURE_PINCH_IN: 'GESTURE PINCH IN', pyray.Gesture.GESTURE_PINCH_IN: 'GESTURE PINCH IN',
pyray.GESTURE_PINCH_OUT: 'GESTURE PINCH OUT', pyray.Gesture.GESTURE_PINCH_OUT: 'GESTURE PINCH OUT',
} }
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
@ -54,7 +47,7 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
if ( if (
pyray.check_collision_point_rec(touch_position, touch_area) pyray.check_collision_point_rec(touch_position, touch_area)
and current_gesture != pyray.GESTURE_NONE and current_gesture != pyray.Gesture.GESTURE_NONE
): ):
if current_gesture != last_gesture: if current_gesture != last_gesture:
gesture_strings.append(GESTURE_LABELS[current_gesture]) gesture_strings.append(GESTURE_LABELS[current_gesture])
@ -66,34 +59,34 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
# Draw # Draw
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(pyray.RAYWHITE)
pyray.draw_rectangle_rec(touch_area, GRAY) pyray.draw_rectangle_rec(touch_area, pyray.GRAY)
pyray.draw_rectangle(225, 15, SCREEN_WIDTH - 240, SCREEN_HEIGHT - 30, pyray.draw_rectangle(225, 15, SCREEN_WIDTH - 240, SCREEN_HEIGHT - 30,
RAYWHITE) pyray.RAYWHITE)
pyray.draw_text( pyray.draw_text(
'GESTURES TEST AREA', 'GESTURES TEST AREA',
SCREEN_WIDTH - 270, SCREEN_HEIGHT - 40, 20, pyray.fade(GRAY, 0.5) SCREEN_WIDTH - 270, SCREEN_HEIGHT - 40, 20, pyray.fade(pyray.GRAY, 0.5)
) )
for i, val in enumerate(gesture_strings): for i, val in enumerate(gesture_strings):
if i % 2 == 0: if i % 2 == 0:
pyray.draw_rectangle( pyray.draw_rectangle(
10, 30 + 20 * i, 200, 20, pyray.fade(LIGHTGRAY, 0.5)) 10, 30 + 20 * i, 200, 20, pyray.fade(pyray.LIGHTGRAY, 0.5))
else: else:
pyray.draw_rectangle( pyray.draw_rectangle(
10, 30 + 20 * i, 200, 20, pyray.fade(LIGHTGRAY, 0.3)) 10, 30 + 20 * i, 200, 20, pyray.fade(pyray.LIGHTGRAY, 0.3))
if i < len(gesture_strings) - 1: if i < len(gesture_strings) - 1:
pyray.draw_text(val, 35, 36 + 20 * i, 10, DARKGRAY) pyray.draw_text(val, 35, 36 + 20 * i, 10, pyray.DARKGRAY)
else: else:
pyray.draw_text(val, 35, 36 + 20 * i, 10, MAROON) pyray.draw_text(val, 35, 36 + 20 * i, 10, pyray.MAROON)
pyray.draw_rectangle_lines(10, 29, 200, SCREEN_HEIGHT - 50, GRAY) pyray.draw_rectangle_lines(10, 29, 200, SCREEN_HEIGHT - 50, pyray.GRAY)
pyray.draw_text('DETECTED GESTURES', 50, 15, 10, GRAY) pyray.draw_text('DETECTED GESTURES', 50, 15, 10, pyray.GRAY)
if current_gesture != pyray.GESTURE_NONE: if current_gesture != pyray.Gesture.GESTURE_NONE:
pyray.draw_circle_v(touch_position, 30, MAROON) pyray.draw_circle_v(touch_position, 30, pyray.MAROON)
pyray.end_drawing() pyray.end_drawing()

View file

@ -19,13 +19,13 @@ pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
# Main game loop # Main game loop
while not pyray.window_should_close(): # Detect window close button or ESC key while not pyray.window_should_close(): # Detect window close button or ESC key
# Update # Update
if pyray.is_key_down(pyray.KEY_RIGHT): if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
ball_position.x += 2 ball_position.x += 2
if pyray.is_key_down(pyray.KEY_LEFT): if pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
ball_position.x -= 2 ball_position.x -= 2
if pyray.is_key_down(pyray.KEY_UP): if pyray.is_key_down(pyray.KeyboardKey.KEY_UP):
ball_position.y -= 2 ball_position.y -= 2
if pyray.is_key_down(pyray.KEY_DOWN): if pyray.is_key_down(pyray.KeyboardKey.KEY_DOWN):
ball_position.y += 2 ball_position.y += 2
# Draw # Draw

View file

@ -22,19 +22,19 @@ while not window_should_close(): # Detect window close button or ESC key
# Update # Update
ball_position = get_mouse_position() ball_position = get_mouse_position()
if is_mouse_button_pressed(MOUSE_BUTTON_LEFT): if is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_LEFT):
ball_color = MAROON ball_color = MAROON
elif is_mouse_button_pressed(MOUSE_BUTTON_MIDDLE): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_MIDDLE):
ball_color = LIME ball_color = LIME
elif is_mouse_button_pressed(MOUSE_BUTTON_RIGHT): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_RIGHT):
ball_color = DARKBLUE ball_color = DARKBLUE
elif is_mouse_button_pressed(MOUSE_BUTTON_SIDE): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_SIDE):
ball_color = PURPLE ball_color = PURPLE
elif is_mouse_button_pressed(MOUSE_BUTTON_EXTRA): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_EXTRA):
ball_color = YELLOW ball_color = YELLOW
elif is_mouse_button_pressed(MOUSE_BUTTON_FORWARD): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_FORWARD):
ball_color = ORANGE ball_color = ORANGE
elif is_mouse_button_pressed(MOUSE_BUTTON_BACK): elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_BACK):
ball_color = BEIGE ball_color = BEIGE
# Draw # Draw
begin_drawing() begin_drawing()

View file

@ -23,7 +23,7 @@ set_target_fps(60) # Set our game to run at 60 frames-per-second
while not window_should_close(): # Detect window close button or ESC key while not window_should_close(): # Detect window close button or ESC key
# Update # Update
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
if is_key_pressed(KEY_S): if is_key_pressed(KeyboardKey.KEY_S):
scissorMode = not scissorMode scissorMode = not scissorMode
# Centre the scissor area around the mouse position # Centre the scissor area around the mouse position

View file

@ -18,7 +18,7 @@ worldSpaceCamera.zoom = 1.0
screenSpaceCamera = Camera2D([0]) # Smoothing camera screenSpaceCamera = Camera2D([0]) # Smoothing camera
screenSpaceCamera.zoom = 1.0 screenSpaceCamera.zoom = 1.0
target = load_render_texture(virtualScreenWidth, virtualScreenHeight); # This is where we'll draw all our objects. target = load_render_texture(virtualScreenWidth, virtualScreenHeight) # This is where we'll draw all our objects.
rec01 = Rectangle(70.0, 35.0, 20.0, 20.0) rec01 = Rectangle(70.0, 35.0, 20.0, 20.0)
rec02 = Rectangle(90.0, 55.0, 30.0, 10.0) rec02 = Rectangle(90.0, 55.0, 30.0, 10.0)
@ -42,7 +42,7 @@ while not window_should_close(): # Detect window close button or ESC key
# Update # Update
rotation += 60.0 *get_frame_time(); # Rotate the rectangles, 60 degrees per second rotation += 60.0 *get_frame_time() # Rotate the rectangles, 60 degrees per second
# Make the camera move to demonstrate the effect # Make the camera move to demonstrate the effect
cameraX = (math.sin(get_time())*50.0) - 10.0 cameraX = (math.sin(get_time())*50.0) - 10.0

View file

@ -66,21 +66,21 @@ while not window_should_close(): # Detect window close button or ESC key
# Move Player1 forward and backwards (no turning) # Move Player1 forward and backwards (no turning)
if is_key_down(KEY_W): if is_key_down(KeyboardKey.KEY_W):
cameraPlayer1.position.z += offsetThisFrame cameraPlayer1.position.z += offsetThisFrame
cameraPlayer1.target.z += offsetThisFrame cameraPlayer1.target.z += offsetThisFrame
elif is_key_down(KEY_S): elif is_key_down(KeyboardKey.KEY_S):
cameraPlayer1.position.z -= offsetThisFrame cameraPlayer1.position.z -= offsetThisFrame
cameraPlayer1.target.z -= offsetThisFrame cameraPlayer1.target.z -= offsetThisFrame
# Move Player2 forward and backwards (no turning) # Move Player2 forward and backwards (no turning)
if is_key_down(KEY_UP): if is_key_down(KeyboardKey.KEY_UP):
cameraPlayer2.position.x += offsetThisFrame cameraPlayer2.position.x += offsetThisFrame
cameraPlayer2.target.x += offsetThisFrame cameraPlayer2.target.x += offsetThisFrame
elif is_key_down(KEY_DOWN): elif is_key_down(KeyboardKey.KEY_DOWN):
cameraPlayer2.position cameraPlayer2.position
cameraPlayer2.position.x -= offsetThisFrame cameraPlayer2.position.x -= offsetThisFrame
cameraPlayer2.target.x -= offsetThisFrame cameraPlayer2.target.x -= offsetThisFrame

View file

@ -17,7 +17,6 @@ device = pyray.VrDeviceInfo(
1200, # Vertical resolution in pixels 1200, # Vertical resolution in pixels
0.133793, # Horizontal size in meters 0.133793, # Horizontal size in meters
0.0669, # Vertical size in meters 0.0669, # Vertical size in meters
0.04678, # Screen center in meters
0.041, # Distance between eye and display in meters 0.041, # Distance between eye and display in meters
0.07, # Lens separation distance in meters 0.07, # Lens separation distance in meters
0.07, # IPD (distance between pupils) in meters 0.07, # IPD (distance between pupils) in meters
@ -35,15 +34,15 @@ config = pyray.load_vr_stereo_config(device)
distortion = pyray.load_shader(pyray.ffi.NULL, f"resources/distortion{GLSL_VERSION}.fs") distortion = pyray.load_shader(pyray.ffi.NULL, f"resources/distortion{GLSL_VERSION}.fs")
# Update distortion shader with lens and distortion-scale parameters # Update distortion shader with lens and distortion-scale parameters
pyray.set_shader_value(distortion, 2, pyray.ffi.new('char []', b"leftLensCenter"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2, pyray.ffi.new('char []', b"leftLensCenter"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightLensCenter"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightLensCenter"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"leftScreenCenter"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"leftScreenCenter"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightScreenCenter"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightScreenCenter"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scale"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scale"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scaleIn"), pyray.SHADER_UNIFORM_VEC2) pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scaleIn"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC2)
pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"deviceWarpParam"), pyray.SHADER_UNIFORM_VEC4) pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"deviceWarpParam"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC4)
pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"chromaAbParam"), pyray.SHADER_UNIFORM_VEC4) pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"chromaAbParam"), pyray.ShaderUniformDataType.SHADER_UNIFORM_VEC4)
# Initialize framebuffer for stereo rendering # Initialize framebuffer for stereo rendering
# NOTE: Screen size should match HMD aspect ratio # NOTE: Screen size should match HMD aspect ratio
@ -59,7 +58,7 @@ camera = pyray.Camera3D(
pyray.Vector3(0.0, 2.0, 0.0), # Camera looking at point pyray.Vector3(0.0, 2.0, 0.0), # Camera looking at point
pyray.Vector3(0.0, 1.0, 0.0), # Camera up vector pyray.Vector3(0.0, 1.0, 0.0), # Camera up vector
60.0, # Camera field-of-view Y 60.0, # Camera field-of-view Y
pyray.CAMERA_PERSPECTIVE # Camera projection type pyray.CameraProjection.CAMERA_PERSPECTIVE # Camera projection type
) )
cubePosition = pyray.Vector3(0.0, 0.0, 0.0) cubePosition = pyray.Vector3(0.0, 0.0, 0.0)
@ -71,7 +70,7 @@ pyray.set_target_fps(90) # Set our game to run at 90 frames-per-sec
# Main game loop # Main game loop
while not pyray.window_should_close(): # Detect window close button or ESC key while not pyray.window_should_close(): # Detect window close button or ESC key
# Update # Update
pyray.update_camera(camera, pyray.CAMERA_FIRST_PERSON) pyray.update_camera(camera, pyray.CameraMode.CAMERA_FIRST_PERSON)
# Draw # Draw
pyray.begin_texture_mode(target) pyray.begin_texture_mode(target)

View file

@ -6,7 +6,7 @@ import pyray
screen_width = 800 screen_width = 800
screen_height = 450 screen_height = 450
init_window(screen_width, screen_height, b"raylib [core] example - window flags") init_window(screen_width, screen_height, "raylib [core] example - window flags")
ball_position = Vector2(get_screen_width() / 2.0, get_screen_height() / 2.0) ball_position = Vector2(get_screen_width() / 2.0, get_screen_height() / 2.0)
ball_speed = Vector2(5.0, 4.0) ball_speed = Vector2(5.0, 4.0)
@ -18,71 +18,71 @@ frames_counter = 0
while not window_should_close(): # Detect window close button or ESC key while not window_should_close(): # Detect window close button or ESC key
# Update # Update
# ----------------------------------------------------- # -----------------------------------------------------
if is_key_pressed(pyray.KEY_F): if is_key_pressed(pyray.KeyboardKey.KEY_F):
toggle_fullscreen() toggle_fullscreen()
if is_key_pressed(pyray.KEY_R): if is_key_pressed(pyray.KeyboardKey.KEY_R):
if is_window_state(pyray.FLAG_WINDOW_RESIZABLE): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_RESIZABLE):
clear_window_state(pyray.FLAG_WINDOW_RESIZABLE) clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_RESIZABLE)
else: else:
set_window_state(pyray.FLAG_WINDOW_RESIZABLE) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_RESIZABLE)
if is_key_pressed(pyray.KEY_D): if is_key_pressed(pyray.KeyboardKey.KEY_D):
if is_window_state(pyray.FLAG_WINDOW_UNDECORATED): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNDECORATED):
clear_window_state(pyray.FLAG_WINDOW_UNDECORATED) clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNDECORATED)
else: else:
set_window_state(pyray.FLAG_WINDOW_UNDECORATED) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNDECORATED)
if is_key_pressed(pyray.KEY_H): if is_key_pressed(pyray.KeyboardKey.KEY_H):
if not is_window_state(pyray.FLAG_WINDOW_HIDDEN): if not is_window_state(pyray.ConfigFlags.FLAG_WINDOW_HIDDEN):
set_window_state(pyray.FLAG_WINDOW_HIDDEN) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_HIDDEN)
frames_counter = 0 frames_counter = 0
if is_window_state(pyray.FLAG_WINDOW_HIDDEN): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_HIDDEN):
frames_counter += 1 frames_counter += 1
if frames_counter >= 240: if frames_counter >= 240:
clear_window_state(pyray.FLAG_WINDOW_HIDDEN) # Show window after 3 seconds clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_HIDDEN) # Show window after 3 seconds
if is_key_pressed(pyray.KEY_N): if is_key_pressed(pyray.KeyboardKey.KEY_N):
if not is_window_state(pyray.FLAG_WINDOW_MINIMIZED): if not is_window_state(pyray.ConfigFlags.FLAG_WINDOW_MINIMIZED):
minimize_window() minimize_window()
frames_counter = 0 frames_counter = 0
if is_window_state(pyray.FLAG_WINDOW_MINIMIZED): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_MINIMIZED):
frames_counter += 1 frames_counter += 1
if frames_counter >= 240: if frames_counter >= 240:
restore_window() # Restore window after 3 seconds restore_window() # Restore window after 3 seconds
if is_key_pressed(pyray.KEY_M): if is_key_pressed(pyray.KeyboardKey.KEY_M):
if is_window_state(pyray.FLAG_WINDOW_RESIZABLE): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_RESIZABLE):
if is_window_state(pyray.FLAG_WINDOW_MAXIMIZED): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_MAXIMIZED):
restore_window() restore_window()
else: else:
maximize_window() maximize_window()
if is_key_pressed(pyray.KEY_U): if is_key_pressed(pyray.KeyboardKey.KEY_U):
if is_window_state(pyray.FLAG_WINDOW_UNFOCUSED): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNFOCUSED):
clear_window_state(pyray.FLAG_WINDOW_UNFOCUSED) clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNFOCUSED)
else: else:
set_window_state(pyray.FLAG_WINDOW_UNFOCUSED) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_UNFOCUSED)
if is_key_pressed(pyray.KEY_T): if is_key_pressed(pyray.KeyboardKey.KEY_T):
if is_window_state(pyray.FLAG_WINDOW_TOPMOST): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_TOPMOST):
clear_window_state(pyray.FLAG_WINDOW_TOPMOST) clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_TOPMOST)
else: else:
set_window_state(pyray.FLAG_WINDOW_TOPMOST) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_TOPMOST)
if is_key_pressed(pyray.KEY_A): if is_key_pressed(pyray.KeyboardKey.KEY_A):
if is_window_state(pyray.FLAG_WINDOW_ALWAYS_RUN): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_ALWAYS_RUN):
clear_window_state(pyray.FLAG_WINDOW_ALWAYS_RUN) clear_window_state(pyray.ConfigFlags.FLAG_WINDOW_ALWAYS_RUN)
else: else:
set_window_state(pyray.FLAG_WINDOW_ALWAYS_RUN) set_window_state(pyray.ConfigFlags.FLAG_WINDOW_ALWAYS_RUN)
if is_key_pressed(pyray.KEY_V): if is_key_pressed(pyray.KeyboardKey.KEY_V):
if is_window_state(pyray.FLAG_VSYNC_HINT): if is_window_state(pyray.ConfigFlags.FLAG_VSYNC_HINT):
clear_window_state(pyray.FLAG_VSYNC_HINT) clear_window_state(pyray.ConfigFlags.FLAG_VSYNC_HINT)
else: else:
set_window_state(pyray.FLAG_VSYNC_HINT) set_window_state(pyray.ConfigFlags.FLAG_VSYNC_HINT)
# Bouncing ball logic # Bouncing ball logic
ball_position.x += ball_speed.x ball_position.x += ball_speed.x
@ -96,7 +96,7 @@ while not window_should_close(): # Detect window close button or ESC key
# ----------------------------------------------------- # -----------------------------------------------------
begin_drawing() begin_drawing()
if is_window_state(pyray.FLAG_WINDOW_TRANSPARENT): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_TRANSPARENT):
clear_background(BLANK) clear_background(BLANK)
else: else:
clear_background(RAYWHITE) clear_background(RAYWHITE)
@ -113,16 +113,16 @@ while not window_should_close(): # Detect window close button or ESC key
# Draw window state info # Draw window state info
draw_text("Following flags can be set after window creation:", 10, 60, 10, GRAY) draw_text("Following flags can be set after window creation:", 10, 60, 10, GRAY)
flag_texts = [ flag_texts = [
("FLAG_FULLSCREEN_MODE", pyray.FLAG_FULLSCREEN_MODE), ("FLAG_FULLSCREEN_MODE", pyray.ConfigFlags.FLAG_FULLSCREEN_MODE),
("FLAG_WINDOW_RESIZABLE", pyray.FLAG_WINDOW_RESIZABLE), ("FLAG_WINDOW_RESIZABLE", pyray.ConfigFlags.FLAG_WINDOW_RESIZABLE),
("FLAG_WINDOW_UNDECORATED", pyray.FLAG_WINDOW_UNDECORATED), ("FLAG_WINDOW_UNDECORATED", pyray.ConfigFlags.FLAG_WINDOW_UNDECORATED),
("FLAG_WINDOW_HIDDEN", pyray.FLAG_WINDOW_HIDDEN), ("FLAG_WINDOW_HIDDEN", pyray.ConfigFlags.FLAG_WINDOW_HIDDEN),
("FLAG_WINDOW_MINIMIZED", pyray.FLAG_WINDOW_MINIMIZED), ("FLAG_WINDOW_MINIMIZED", pyray.ConfigFlags.FLAG_WINDOW_MINIMIZED),
("FLAG_WINDOW_MAXIMIZED", pyray.FLAG_WINDOW_MAXIMIZED), ("FLAG_WINDOW_MAXIMIZED", pyray.ConfigFlags.FLAG_WINDOW_MAXIMIZED),
("FLAG_WINDOW_UNFOCUSED", pyray.FLAG_WINDOW_UNFOCUSED), ("FLAG_WINDOW_UNFOCUSED", pyray.ConfigFlags.FLAG_WINDOW_UNFOCUSED),
("FLAG_WINDOW_TOPMOST", pyray.FLAG_WINDOW_TOPMOST), ("FLAG_WINDOW_TOPMOST", pyray.ConfigFlags.FLAG_WINDOW_TOPMOST),
("FLAG_WINDOW_ALWAYS_RUN", pyray.FLAG_WINDOW_ALWAYS_RUN), ("FLAG_WINDOW_ALWAYS_RUN", pyray.ConfigFlags.FLAG_WINDOW_ALWAYS_RUN),
("FLAG_VSYNC_HINT", pyray.FLAG_VSYNC_HINT), ("FLAG_VSYNC_HINT", pyray.ConfigFlags.FLAG_VSYNC_HINT),
] ]
y_offset = 80 y_offset = 80
for text, flag in flag_texts: for text, flag in flag_texts:
@ -133,15 +133,15 @@ while not window_should_close(): # Detect window close button or ESC key
y_offset += 20 y_offset += 20
draw_text("Following flags can only be set before window creation:", 10, 300, 10, GRAY) draw_text("Following flags can only be set before window creation:", 10, 300, 10, GRAY)
if is_window_state(pyray.FLAG_WINDOW_HIGHDPI): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_HIGHDPI):
draw_text("FLAG_WINDOW_HIGHDPI: on", 10, 320, 10, LIME) draw_text("FLAG_WINDOW_HIGHDPI: on", 10, 320, 10, LIME)
else: else:
draw_text("FLAG_WINDOW_HIGHDPI: off", 10, 320, 10, MAROON) draw_text("FLAG_WINDOW_HIGHDPI: off", 10, 320, 10, MAROON)
if is_window_state(pyray.FLAG_WINDOW_TRANSPARENT): if is_window_state(pyray.ConfigFlags.FLAG_WINDOW_TRANSPARENT):
draw_text("FLAG_WINDOW_TRANSPARENT: on", 10, 340, 10, LIME) draw_text("FLAG_WINDOW_TRANSPARENT: on", 10, 340, 10, LIME)
else: else:
draw_text("FLAG_WINDOW_TRANSPARENT: off", 10, 340, 10, MAROON) draw_text("FLAG_WINDOW_TRANSPARENT: off", 10, 340, 10, MAROON)
if is_window_state(pyray.FLAG_MSAA_4X_HINT): if is_window_state(pyray.ConfigFlags.FLAG_MSAA_4X_HINT):
draw_text("FLAG_MSAA_4X_HINT: on", 10, 360, 10, LIME) draw_text("FLAG_MSAA_4X_HINT: on", 10, 360, 10, LIME)
else: else:
draw_text("FLAG_MSAA_4X_HINT: off", 10, 360, 10, MAROON) draw_text("FLAG_MSAA_4X_HINT: off", 10, 360, 10, MAROON)

View file

@ -12,7 +12,7 @@ SCREEN_HEIGHT = 450
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - window should close") init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - window should close")
set_exit_key(KEY_NULL) # Disable KEY_ESCAPE to close window, X-button still works set_exit_key(KeyboardKey.KEY_NULL) # Disable KEY_ESCAPE to close window, X-button still works
exitWindowRequested = False # Flag to request window to exit exitWindowRequested = False # Flag to request window to exit
exitWindow = False # Flag to set window to exit exitWindow = False # Flag to set window to exit
@ -26,7 +26,7 @@ while not exitWindow:
# Update # Update
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
# Detect if X-button or KEY_ESCAPE have been pressed to close window # Detect if X-button or KEY_ESCAPE have been pressed to close window
if window_should_close() or is_key_pressed(KEY_ESCAPE): if window_should_close() or is_key_pressed(KeyboardKey.KEY_ESCAPE):
exitWindowRequested = True exitWindowRequested = True
if exitWindowRequested: if exitWindowRequested:
@ -34,9 +34,9 @@ while not exitWindow:
# A request for close window has been issued, we can save data before closing # A request for close window has been issued, we can save data before closing
# or just show a message asking for confirmation # or just show a message asking for confirmation
if is_key_pressed(KEY_Y): if is_key_pressed(KeyboardKey.KEY_Y):
exitWindow = True exitWindow = True
elif is_key_pressed(KEY_N): elif is_key_pressed(KeyboardKey.KEY_N):
exitWindowRequested = False exitWindowRequested = False
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------

View file

@ -1,7 +1,7 @@
# python3 -m pip install pyglm # python3 -m pip install pyglm
from math import sin, cos from math import sin, cos
import glm import glm # type: ignore
from raylib import rl, ffi from raylib import rl, ffi

View file

@ -8,7 +8,8 @@ python3 flow-field
""" """
import sys, math, time, random import sys, math, time, random
import glm # Note package is PyGLM, not glm. import glm # type: ignore
# Note package is PyGLM, not glm.
from raylib import rl, ffi from raylib import rl, ffi
from raylib.colors import * from raylib.colors import *

View file

@ -18,9 +18,9 @@ Mac:
""" """
import sys, time import sys, time
import glm import glm # type: ignore
import pytweening as tween import pytweening as tween # type: ignore
import screeninfo import screeninfo # type: ignore
from raylib import rl, ffi from raylib import rl, ffi
from raylib.colors import * from raylib.colors import *

View file

@ -1,4 +1,4 @@
import cv2 as cv import cv2 as cv # type:ignore
from pyray import * from pyray import *
opencv_image = cv.imread("resources/raylib_logo.jpg") opencv_image = cv.imread("resources/raylib_logo.jpg")
@ -10,7 +10,7 @@ screenHeight = 450
init_window(screenWidth, screenHeight, "example - image loading") init_window(screenWidth, screenHeight, "example - image loading")
pointer_to_image_data = ffi.from_buffer(opencv_image.data) pointer_to_image_data = ffi.from_buffer(opencv_image.data)
raylib_image = Image(pointer_to_image_data, 256, 256, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8) raylib_image = Image(pointer_to_image_data, 256, 256, 1, PixelFormat.PIXELFORMAT_UNCOMPRESSED_R8G8B8)
texture = load_texture_from_image(raylib_image) texture = load_texture_from_image(raylib_image)
unload_image(raylib_image) unload_image(raylib_image)

View file

@ -1,4 +1,3 @@
import pyray as ray import pyray as ray
@ -13,11 +12,11 @@ camera.position = ray.Vector3( 10.0, 10.0, 10.0 ) # Camera position
camera.target = ray.Vector3( 0.0, 0.0, 0.0 ) # Camera looking at point camera.target = ray.Vector3( 0.0, 0.0, 0.0 ) # Camera looking at point
camera.up = ray.Vector3( 0.0, 1.0, 0.0 ) # Camera up vector (rotation towards target) camera.up = ray.Vector3( 0.0, 1.0, 0.0 ) # Camera up vector (rotation towards target)
camera.fovy = 45.0 # Camera field-of-view Y camera.fovy = 45.0 # Camera field-of-view Y
camera.projection = ray.CAMERA_PERSPECTIVE # Camera mode type camera.projection = ray.CameraProjection.CAMERA_PERSPECTIVE # Camera mode type
model = ray.load_model("resources/models/iqm/guy.iqm") # Load the animated model mesh and basic data model = ray.load_model("resources/models/iqm/guy.iqm") # Load the animated model mesh and basic data
texture = ray.load_texture("resources/models/iqm/guytex.png") # Load model texture and set material texture = ray.load_texture("resources/models/iqm/guytex.png") # Load model texture and set material
ray.set_material_texture(model.materials, ray.MATERIAL_MAP_ALBEDO, texture) # Set model material map texture ray.set_material_texture(model.materials, ray.MaterialMapIndex.MATERIAL_MAP_ALBEDO, texture) # Set model material map texture
position = ( 0., 0., 0. ) # Set model position position = ( 0., 0., 0. ) # Set model position
@ -33,10 +32,10 @@ ray.set_target_fps(60) # Set our game to run at 60 frames-per-
while not ray.window_should_close(): # Detect window close button or ESC key while not ray.window_should_close(): # Detect window close button or ESC key
# Update # Update
#---------------------------------------------------------------------------------- #----------------------------------------------------------------------------------
ray.update_camera(camera, ray.CAMERA_FREE) ray.update_camera(camera, ray.CameraMode.CAMERA_FREE)
# Play animation when spacebar is held down # Play animation when spacebar is held down
if ray.is_key_down(ray.KEY_SPACE): if ray.is_key_down(ray.KeyboardKey.KEY_SPACE):
anim_frame_counter+=1 anim_frame_counter+=1
ray.update_model_animation(model, anims[0], anim_frame_counter) ray.update_model_animation(model, anims[0], anim_frame_counter)
if anim_frame_counter >= anims[0].frameCount: if anim_frame_counter >= anims[0].frameCount:

View file

@ -1,3 +1,4 @@
#type: ignore
import raylib as rl import raylib as rl
from raylib.colors import * from raylib.colors import *

View file

@ -15,7 +15,7 @@ camera.position = Vector3(30.0, 20.0, 30.0) # Camera position
camera.target = Vector3(0.0, 0.0, 0.0) # Camera looking at point camera.target = Vector3(0.0, 0.0, 0.0) # Camera looking at point
camera.up = Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target) camera.up = Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
camera.fovy = 70.0 # Camera field-of-view Y camera.fovy = 70.0 # Camera field-of-view Y
camera.projection = pyray.CAMERA_PERSPECTIVE # Camera projection type camera.projection = pyray.CameraProjection.CAMERA_PERSPECTIVE # Camera projection type
# Specify the amount of blocks in each direction # Specify the amount of blocks in each direction
numBlocks = 15 numBlocks = 15

View file

@ -118,18 +118,18 @@ class Camera:
# GLFW3: Error callback # GLFW3: Error callback
@ffi.callback("void(int, const char *)") @ffi.callback("void(int, const char *)")
def ErrorCallback(error: int, description: bytes): def ErrorCallback(error: int, description: bytes):
print("%s" % description, file=sys.stderr) print("%r" % description, file=sys.stderr)
# GLFW3: Keyboard callback # GLFW3: Keyboard callback
@ffi.callback("void(GLFWwindow *, int, int, int, int)") @ffi.callback("void(GLFWwindow *, int, int, int, int)")
def KeyCallback(window: 'GLFWwindow', key: int, scancode: int, action: int, mods: int): def KeyCallback(window, key: int, scancode: int, action: int, mods: int):
if key == GLFW_KEY_ESCAPE and action == GLFW_PRESS: if key == GLFW_KEY_ESCAPE and action == GLFW_PRESS:
rl.glfwSetWindowShouldClose(window, GLFW_TRUE) rl.glfwSetWindowShouldClose(window, GLFW_TRUE)
# Draw rectangle using rlgl OpenGL 1.1 style coding (translated to OpenGL 3.3 internally) # Draw rectangle using rlgl OpenGL 1.1 style coding (translated to OpenGL 3.3 internally)
def DrawRectangleV(position: 'raylib.Vector2', size: 'raylib.Vector2', color: Color): def DrawRectangleV(position, size, color: Color):
rl.rlBegin(RL_TRIANGLES) rl.rlBegin(RL_TRIANGLES)
rl.rlColor4ub(color.r, color.g, color.b, color.a) rl.rlColor4ub(color.r, color.g, color.b, color.a)
rl.rlVertex2f(position.x, position.y) rl.rlVertex2f(position.x, position.y)
@ -168,7 +168,7 @@ def DrawGrid(slices: int, spacing: float):
# Draw cube # Draw cube
# NOTE: Cube position is the center position # NOTE: Cube position is the center position
def DrawCube(position: 'raylib.Vector3', width: float, height: float, length: float, color: Color): def DrawCube(position, width: float, height: float, length: float, color: Color):
x: float = 0.0 x: float = 0.0
y: float = 0.0 y: float = 0.0
z: float = 0.0 z: float = 0.0
@ -242,7 +242,7 @@ def DrawCube(position: 'raylib.Vector3', width: float, height: float, length: fl
#Draw cube wires #Draw cube wires
def DrawCubeWires(position: 'raylib.Vector3', width: float, height: float, length: float, color: Color): def DrawCubeWires(position, width: float, height: float, length: float, color: Color):
x: float = 0.0 x: float = 0.0
y: float = 0.0 y: float = 0.0
z: float = 0.0 z: float = 0.0

View file

@ -2,13 +2,9 @@
raylib [physac] example - physics demo raylib [physac] example - physics demo
""" """
from pyray import Vector2
from raylib import * from raylib import *
from raylib.colors import (
BLACK,
GREEN,
WHITE
)
SCREEN_WIDTH = 800 SCREEN_WIDTH = 800
SCREEN_HEIGHT = 450 SCREEN_HEIGHT = 450
@ -18,10 +14,10 @@ InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, b'[physac] Basic demo')
InitPhysics() InitPhysics()
floor = CreatePhysicsBodyRectangle(Vector2(SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10) floor = CreatePhysicsBodyRectangle((SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10)
floor.enabled = False floor.enabled = False
circle = CreatePhysicsBodyCircle(Vector2(SCREEN_WIDTH/2, SCREEN_HEIGHT/2), 45, 10) circle = CreatePhysicsBodyCircle((SCREEN_WIDTH/2, SCREEN_HEIGHT/2), 45, 10)
circle.enabled = False circle.enabled = False
SetTargetFPS(60) SetTargetFPS(60)
@ -34,10 +30,10 @@ while not WindowShouldClose():
if IsKeyPressed(KEY_R): # Reset physics system if IsKeyPressed(KEY_R): # Reset physics system
ResetPhysics() ResetPhysics()
floor = CreatePhysicsBodyRectangle(Vector2(SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10) floor = CreatePhysicsBodyRectangle((SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10)
floor.enabled = False floor.enabled = False
circle = CreatePhysicsBodyCircle(Vector2(SCREEN_WIDTH/2, SCREEN_HEIGHT/2), 45, 10) circle = CreatePhysicsBodyCircle((SCREEN_WIDTH/2, SCREEN_HEIGHT/2), 45, 10)
circle.enabled = False circle.enabled = False
# Physics body creation inputs # Physics body creation inputs

View file

@ -4,20 +4,20 @@ import raylib as rl
class LightSystem: class LightSystem:
MAX_LIGHTS = 4 #// Max dynamic lights supported by shader MAX_LIGHTS = 4 #// Max dynamic lights supported by shader
lightsCount = 0 lightsCount = 0
lights = [] lights: list['Light'] = []
def __init__(self, ambient = [ 0.2, 0.2, 0.2, 1.0 ], *ls): def __init__(self, ambient = [ 0.2, 0.2, 0.2, 1.0 ], *ls):
self.shader = rl.LoadShader(b"resources/shaders/fogLight.vs", self.shader = rl.LoadShader(b"resources/shaders/fogLight.vs",
b"resources/shaders/fogLight.fs"); b"resources/shaders/fogLight.fs");
#// Get some shader loactions #// Get some shader loactions
self.shader.locs[rl.SHADER_LOC_MATRIX_MODEL] = rl.GetShaderLocation(self.shader, b"matModel"); self.shader.locs[rl.SHADER_LOC_MATRIX_MODEL] = rl.GetShaderLocation(self.shader, b"matModel")
self.shader.locs[rl.SHADER_LOC_VECTOR_VIEW] = rl.GetShaderLocation(self.shader, b"viewPos"); self.shader.locs[rl.SHADER_LOC_VECTOR_VIEW] = rl.GetShaderLocation(self.shader, b"viewPos")
#// ambient light level #// ambient light level
self.ambientLoc = rl.GetShaderLocation(self.shader, b"ambient"); self.ambientLoc = rl.GetShaderLocation(self.shader, b"ambient")
v = rl.ffi.new("struct Vector4 *", ambient) v = rl.ffi.new("struct Vector4 *", ambient)
rl.SetShaderValue(self.shader, self.ambientLoc, v, rl.SHADER_UNIFORM_VEC4); rl.SetShaderValue(self.shader, self.ambientLoc, v, rl.SHADER_UNIFORM_VEC4)
for light in ls: for light in ls:
self.add(light) self.add(light)

View file

@ -48,7 +48,7 @@ screenWidth = 1200
screenHeight = 720 screenHeight = 720
rl.SetConfigFlags( rl.SetConfigFlags(
rl.FLAG_MSAA_4X_HINT | rl.FLAG_WINDOW_RESIZABLE); # Enable Multi Sampling Anti Aliasing 4x (if available) rl.FLAG_MSAA_4X_HINT | rl.FLAG_WINDOW_RESIZABLE) # Enable Multi Sampling Anti Aliasing 4x (if available)
rl.InitWindow(screenWidth, screenHeight, b"raylib [shaders] example - basic lighting") rl.InitWindow(screenWidth, screenHeight, b"raylib [shaders] example - basic lighting")
camera = rl.ffi.new('struct Camera3D *', [ camera = rl.ffi.new('struct Camera3D *', [

View file

@ -9,7 +9,7 @@ def LoadRenderTextureDepthTex(width, height):
target = RenderTexture() target = RenderTexture()
target.id = rl_load_framebuffer(width, height) # Load an empty framebuffer target.id = rl_load_framebuffer() # Load an empty framebuffer
if target.id > 0: if target.id > 0:
@ -72,12 +72,7 @@ shader = load_shader("","resources/shaders/glsl330/write_depth.fs")
target = LoadRenderTextureDepthTex(screenWidth, screenHeight) target = LoadRenderTextureDepthTex(screenWidth, screenHeight)
# Define the camera to look into our 3d world # Define the camera to look into our 3d world
camera = Camera3D() camera = Camera3D((2.0, 2.0, 3.0),(0.0, 0.5, 0.0),(0.0, 1.0, 0.0),45.0, CameraProjection.CAMERA_PERSPECTIVE)
camera.position = (2.0, 2.0, 3.0) # Camera position
camera.target = (0.0, 0.5, 0.0) # Camera looking at point
camera.up = (0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
camera.fovy = 45.0 # Camera field-of-view Y
camera.projection = CameraProjection.CAMERA_PERSPECTIVE # Camera projection type
set_target_fps(60) # Set our game to run at 60 frames-per-second set_target_fps(60) # Set our game to run at 60 frames-per-second

View file

@ -1,19 +1,4 @@
import pyray import pyray
from raylib.colors import (
RAYWHITE,
DARKGRAY,
DARKBLUE,
SKYBLUE,
MAROON,
ORANGE,
RED,
VIOLET,
BEIGE,
BROWN,
BLACK,
GREEN,
GOLD
)
# Initialization # Initialization
@ -33,37 +18,37 @@ while not pyray.window_should_close():
# Draw # Draw
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(pyray.RAYWHITE)
pyray.draw_text("some basic shapes available on raylib", 20, 20, 20, DARKGRAY) pyray.draw_text("some basic shapes available on raylib", 20, 20, 20, pyray.DARKGRAY)
# Circle shapes and lines # Circle shapes and lines
pyray.draw_circle(screenWidth // 5, 120, 35, DARKBLUE) pyray.draw_circle(screenWidth // 5, 120, 35, pyray.DARKBLUE)
pyray.draw_circle_gradient(screenWidth // 5, 220, 60, GREEN, SKYBLUE) pyray.draw_circle_gradient(screenWidth // 5, 220, 60, pyray.GREEN, pyray.SKYBLUE)
pyray.draw_circle_lines(screenWidth // 5, 340, 80, DARKBLUE) pyray.draw_circle_lines(screenWidth // 5, 340, 80, pyray.DARKBLUE)
# Rectangle shapes and lines # Rectangle shapes and lines
pyray.draw_rectangle(screenWidth // 4 * 2 - 60, 100, 120, 60, RED) pyray.draw_rectangle(screenWidth // 4 * 2 - 60, 100, 120, 60, pyray.RED)
pyray.draw_rectangle_gradient_h(screenWidth // 4 * 2 - 90, 170, 180, 130, MAROON, GOLD) pyray.draw_rectangle_gradient_h(screenWidth // 4 * 2 - 90, 170, 180, 130, pyray.MAROON, pyray.GOLD)
pyray.draw_rectangle_lines(screenWidth // 4 * 2 - 40, 320, 80, 60, ORANGE) pyray.draw_rectangle_lines(screenWidth // 4 * 2 - 40, 320, 80, 60, pyray.ORANGE)
# Triangle shapes and lines # Triangle shapes and lines
pyray.draw_triangle(pyray.Vector2(screenWidth / 4.0 * 3.0, 80.0), pyray.draw_triangle(pyray.Vector2(screenWidth / 4.0 * 3.0, 80.0),
pyray.Vector2(screenWidth / 4.0 * 3.0 - 60.0, 150.0), pyray.Vector2(screenWidth / 4.0 * 3.0 - 60.0, 150.0),
pyray.Vector2(screenWidth / 4.0 * 3.0 + 60.0, 150.0), VIOLET) pyray.Vector2(screenWidth / 4.0 * 3.0 + 60.0, 150.0), pyray.VIOLET)
pyray.draw_triangle_lines(pyray.Vector2(screenWidth / 4.0 * 3.0, 160.0), pyray.draw_triangle_lines(pyray.Vector2(screenWidth / 4.0 * 3.0, 160.0),
pyray.Vector2(screenWidth / 4.0 * 3.0 - 20.0, 230.0), pyray.Vector2(screenWidth / 4.0 * 3.0 - 20.0, 230.0),
pyray.Vector2(screenWidth / 4.0 * 3.0 + 20.0, 230.0), DARKBLUE) pyray.Vector2(screenWidth / 4.0 * 3.0 + 20.0, 230.0), pyray.DARKBLUE)
# Polygon shapes and lines # Polygon shapes and lines
pyray.draw_poly(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 80, rotation, BROWN) pyray.draw_poly(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 80, rotation, pyray.BROWN)
pyray.draw_poly_lines(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 90, rotation, BROWN) pyray.draw_poly_lines(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 90, rotation, pyray.BROWN)
pyray.draw_poly_lines_ex(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 85, rotation, 6, BEIGE) pyray.draw_poly_lines_ex(pyray.Vector2(screenWidth / 4.0 * 3, 330), 6, 85, rotation, 6, pyray.BEIGE)
# NOTE: We draw all LINES based shapes together to optimize internal drawing, # NOTE: We draw all LINES based shapes together to optimize internal drawing,
# this way, all LINES are rendered in a single draw pass # this way, all LINES are rendered in a single draw pass
pyray.draw_line(18, 42, screenWidth - 18, 42, BLACK) pyray.draw_line(18, 42, screenWidth - 18, 42, pyray.BLACK)
pyray.end_drawing() pyray.end_drawing()

View file

@ -17,7 +17,7 @@ pyray.set_target_fps(60)
# Main game loop # Main game loop
while not pyray.window_should_close(): while not pyray.window_should_close():
# Update # Update
if pyray.is_key_pressed(pyray.KEY_SPACE): if pyray.is_key_pressed(pyray.KeyboardKey.KEY_SPACE):
pause = not pause pause = not pause
if not pause: if not pause:

View file

@ -12,13 +12,6 @@
#********************************************************************************************/ #********************************************************************************************/
import pyray import pyray
from raylib.colors import (
RAYWHITE,
LIGHTGRAY,
DARKGRAY,
GOLD,
MAROON,
)
SCREEN_WIDTH = 800 SCREEN_WIDTH = 800
@ -50,17 +43,17 @@ while not pyray.window_should_close(): #// Detect window close button or ESC ke
#// Draw #// Draw
#//---------------------------------------------------------------------------------- #//----------------------------------------------------------------------------------
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(pyray.RAYWHITE)
pyray.draw_line(560,0,560,pyray.get_screen_height(),pyray.fade(LIGHTGRAY,0.6)) pyray.draw_line(560,0,560,pyray.get_screen_height(),pyray.fade(pyray.LIGHTGRAY,0.6))
pyray.draw_rectangle(560,0,pyray.get_screen_width()-500,pyray.get_screen_height(),pyray.fade(LIGHTGRAY,0.3)) pyray.draw_rectangle(560,0,pyray.get_screen_width()-500,pyray.get_screen_height(),pyray.fade(pyray.LIGHTGRAY,0.3))
if drawRect: if drawRect:
pyray.draw_rectangle_rec(rec,pyray.fade(GOLD,0.6)) pyray.draw_rectangle_rec(rec,pyray.fade(pyray.GOLD,0.6))
if drawRoundedRect: if drawRoundedRect:
pyray.draw_rectangle_rounded(rec,roundness,segments,pyray.fade(MAROON,0.2)) pyray.draw_rectangle_rounded(rec,roundness,segments,pyray.fade(pyray.MAROON,0.2))
if drawRoundedLines: if drawRoundedLines:
pyray.draw_rectangle_rounded_lines(rec,roundness,segments,lineThick,pyray.fade(MAROON,0.4)) pyray.draw_rectangle_rounded_lines(rec,roundness,segments,pyray.fade(pyray.MAROON,0.4))
#// Draw GUI controls #// Draw GUI controls
#//------------------------------------------------------------------------------ #//------------------------------------------------------------------------------
@ -79,7 +72,7 @@ while not pyray.window_should_close(): #// Detect window close button or ESC ke
# drawRect = pyray.gui_check_box(pyray.Rectangle(640,380,20,20),"DrawRect",drawRect) # drawRect = pyray.gui_check_box(pyray.Rectangle(640,380,20,20),"DrawRect",drawRect)
#//------------------------------------------------------------------------------ #//------------------------------------------------------------------------------
pyray.draw_text( "MANUAL" if segments >= 4 else "AUTO" , 640, 280, 10, MAROON if segments >= 4 else DARKGRAY) pyray.draw_text( "MANUAL" if segments >= 4 else "AUTO" , 640, 280, 10, pyray.MAROON if segments >= 4 else pyray.DARKGRAY)
pyray.draw_fps(10,10) pyray.draw_fps(10,10)
pyray.end_drawing() pyray.end_drawing()
#//------------------------------------------------------------------------------ #//------------------------------------------------------------------------------

View file

@ -5,13 +5,7 @@ raylib [shapes] example - Following Eyes
""" """
from pyray import * from pyray import *
from raylib.colors import (
RAYWHITE,
BROWN,
BLACK,
LIGHTGRAY,
DARKGREEN,
)
from math import ( from math import (
atan2, atan2,
cos, cos,

View file

@ -5,11 +5,6 @@ raylib [shapes] example - Lines Bezier
""" """
from pyray import * from pyray import *
from raylib.colors import (
RAYWHITE,
GRAY,
RED
)
# ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------

View file

@ -4,11 +4,7 @@ raylib [shapes] example - Logo Raylib
""" """
from pyray import * from pyray import *
from raylib.colors import (
RAYWHITE,
BLACK,
GRAY
)
# Initialization # Initialization
screenWidth = 800 screenWidth = 800

View file

@ -38,9 +38,9 @@ bunnies = []
for i in range(0, MAX_BUNNIES): for i in range(0, MAX_BUNNIES):
bunnies.append(Bunny()) bunnies.append(Bunny())
bunniesCount = 0; # Bunnies counter bunniesCount = 0 # Bunnies counter
SetTargetFPS(60); # Set our game to run at 60 frames-per-second SetTargetFPS(60) # Set our game to run at 60 frames-per-second
#//-------------------------------------------------------------------------------------- #//--------------------------------------------------------------------------------------
#// Main game loop #// Main game loop
@ -63,8 +63,8 @@ while not WindowShouldClose(): #// Detect window close button or ESC key
# // Update bunnies # // Update bunnies
for i in range(0, bunniesCount): for i in range(0, bunniesCount):
bunnies[i].position.x += bunnies[i].speed.x; bunnies[i].position.x += bunnies[i].speed.x
bunnies[i].position.y += bunnies[i].speed.y; bunnies[i].position.y += bunnies[i].speed.y
if ((bunnies[i].position.x + texBunny.width/2) > GetScreenWidth()) or ((bunnies[i].position.x + texBunny.width/2) < 0): if ((bunnies[i].position.x + texBunny.width/2) > GetScreenWidth()) or ((bunnies[i].position.x + texBunny.width/2) < 0):
bunnies[i].speed.x *= -1 bunnies[i].speed.x *= -1
@ -104,7 +104,7 @@ while not WindowShouldClose(): #// Detect window close button or ESC key
#//-------------------------------------------------------------------------------------- #//--------------------------------------------------------------------------------------
UnloadTexture(texBunny); #Unload bunny texture UnloadTexture(texBunny) #Unload bunny texture
CloseWindow() # Close window and OpenGL context CloseWindow() # Close window and OpenGL context
#//-------------------------------------------------------------------------------------- #//--------------------------------------------------------------------------------------

View file

@ -36,9 +36,9 @@ bunnies = []
for i in range(0, MAX_BUNNIES): for i in range(0, MAX_BUNNIES):
bunnies.append(Bunny()) bunnies.append(Bunny())
bunniesCount = 0; # Bunnies counter bunniesCount = 0 # Bunnies counter
SetTargetFPS(60); # Set our game to run at 60 frames-per-second SetTargetFPS(60) # Set our game to run at 60 frames-per-second
#//-------------------------------------------------------------------------------------- #//--------------------------------------------------------------------------------------
#// Main game loop #// Main game loop

View file

@ -4,16 +4,6 @@ raylib [texture] example - Mouse Painting
""" """
from pyray import * from pyray import *
from raylib.colors import *
from raylib import (
KEY_RIGHT,
KEY_LEFT,
MOUSE_BUTTON_LEFT,
KEY_C,
GESTURE_DRAG,
MOUSE_BUTTON_RIGHT,
KEY_S
)
MAX_COLORS_COUNT = 23 # Number of colors available MAX_COLORS_COUNT = 23 # Number of colors available
@ -62,9 +52,9 @@ while not window_should_close(): # Detect window close button or ESC key
mousePos = get_mouse_position() mousePos = get_mouse_position()
# Move between colors with keys # Move between colors with keys
if is_key_pressed(KEY_RIGHT): if is_key_pressed(KeyboardKey.KEY_RIGHT):
colorSelected += 1 colorSelected += 1
elif is_key_pressed(KEY_LEFT): elif is_key_pressed(KeyboardKey.KEY_LEFT):
colorSelected -= 1 colorSelected -= 1
if colorSelected >= MAX_COLORS_COUNT: if colorSelected >= MAX_COLORS_COUNT:
@ -80,7 +70,7 @@ while not window_should_close(): # Detect window close button or ESC key
else: else:
colorMouseHover = -1 colorMouseHover = -1
if colorMouseHover >= 0 and is_mouse_button_pressed(MOUSE_BUTTON_LEFT): if colorMouseHover >= 0 and is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_LEFT):
colorSelected = colorMouseHover colorSelected = colorMouseHover
colorSelectedPrev = colorSelected colorSelectedPrev = colorSelected
@ -89,13 +79,13 @@ while not window_should_close(): # Detect window close button or ESC key
if brushSize < 2: brushSize = 2 if brushSize < 2: brushSize = 2
if brushSize > 50: brushSize = 50 if brushSize > 50: brushSize = 50
if is_key_pressed(KEY_C): if is_key_pressed(KeyboardKey.KEY_C):
# Clear render texture to clear color # Clear render texture to clear color
begin_texture_mode(target) begin_texture_mode(target)
clear_background(colors[0]) clear_background(colors[0])
end_texture_mode() end_texture_mode()
if is_mouse_button_pressed(MOUSE_BUTTON_LEFT) or get_gesture_detected() == GESTURE_DRAG: if is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_LEFT) or get_gesture_detected() == Gesture.GESTURE_DRAG:
# Paint circle into render texture # Paint circle into render texture
# NOTE: To avoid discontinuous circles, we could store # NOTE: To avoid discontinuous circles, we could store
@ -104,7 +94,7 @@ while not window_should_close(): # Detect window close button or ESC key
if mousePos.y > 50: if mousePos.y > 50:
draw_circle(int(mousePos.x), int(mousePos.y), brushSize, colors[colorSelected]) draw_circle(int(mousePos.x), int(mousePos.y), brushSize, colors[colorSelected])
end_texture_mode() end_texture_mode()
if is_mouse_button_down(MOUSE_BUTTON_RIGHT): if is_mouse_button_down(MouseButton.MOUSE_BUTTON_RIGHT):
if not mouseWasPressed: if not mouseWasPressed:
colorSelectedPrev = colorSelected colorSelectedPrev = colorSelected
@ -117,7 +107,7 @@ while not window_should_close(): # Detect window close button or ESC key
if mousePos.y > 50: draw_circle(int(mousePos.x), int(mousePos.y), brushSize, colors[0]) if mousePos.y > 50: draw_circle(int(mousePos.x), int(mousePos.y), brushSize, colors[0])
end_texture_mode() end_texture_mode()
elif is_mouse_button_released(MOUSE_BUTTON_RIGHT) and mouseWasPressed: elif is_mouse_button_released(MouseButton.MOUSE_BUTTON_RIGHT) and mouseWasPressed:
colorSelected = colorSelectedPrev colorSelected = colorSelectedPrev
mouseWasPressed = False mouseWasPressed = False
@ -130,7 +120,7 @@ while not window_should_close(): # Detect window close button or ESC key
# Image saving logic # Image saving logic
# NOTE: Saving painted texture to a default named image # NOTE: Saving painted texture to a default named image
if (btnSaveMouseHover and is_mouse_button_released(MOUSE_BUTTON_LEFT)) or is_key_pressed(KEY_S): if (btnSaveMouseHover and is_mouse_button_released(MouseButton.MOUSE_BUTTON_LEFT)) or is_key_pressed(KeyboardKey.KEY_S):
image = load_image_from_texture(target.texture) image = load_image_from_texture(target.texture)
image_flip_vertical(image) image_flip_vertical(image)
export_image(image, "my_amazing_texture_painting.png") export_image(image, "my_amazing_texture_painting.png")
@ -157,7 +147,7 @@ while not window_should_close(): # Detect window close button or ESC key
# Draw drawing circle for reference # Draw drawing circle for reference
if mousePos.y > 50: if mousePos.y > 50:
if is_mouse_button_down(MOUSE_BUTTON_RIGHT): if is_mouse_button_down(MouseButton.MOUSE_BUTTON_RIGHT):
draw_circle_lines(int(mousePos.x), int(mousePos.y), brushSize, GRAY) draw_circle_lines(int(mousePos.x), int(mousePos.y), brushSize, GRAY)
else: else:
draw_circle(get_mouse_x(), get_mouse_y(), brushSize, colors[colorSelected]) draw_circle(get_mouse_x(), get_mouse_y(), brushSize, colors[colorSelected])

View file

@ -39,6 +39,8 @@ while not window_should_close(): # Detect window close button or ESC key
clear_background(RAYWHITE) clear_background(RAYWHITE)
texture.width
draw_texture(texture, int(screenWidth/2 - texture.width/2), int(screenHeight/2 - texture.height/2), WHITE) draw_texture(texture, int(screenWidth/2 - texture.width/2), int(screenHeight/2 - texture.height/2), WHITE)
draw_text("this IS a texture loaded from an image!", 300, 370, 10, GRAY) draw_text("this IS a texture loaded from an image!", 300, 370, 10, GRAY)

View file

@ -12,12 +12,12 @@ cd ../..
echo "installing raylib headers to /usr/local/include" echo "installing raylib headers to /usr/local/include"
sudo cp ./raylib-c/src/raylib.h /usr/local/include/ sudo cp -v ./raylib-c/src/raylib.h /usr/local/include/
sudo cp ./raylib-c/src/rlgl.h /usr/local/include/ sudo cp -v ./raylib-c/src/rlgl.h /usr/local/include/
sudo cp ./raylib-c/src/raymath.h /usr/local/include/ sudo cp -v ./raylib-c/src/raymath.h /usr/local/include/
sudo cp ./raygui/src/raygui.h /usr/local/include/ sudo cp -v ./raygui/src/raygui.h /usr/local/include/
sudo cp ./physac/src/physac.h /usr/local/include/ sudo cp -v ./physac/src/physac.h /usr/local/include/
sudo cp -r ./raylib-c/src/external/glfw/include/GLFW /usr/local/include/ sudo cp -rv ./raylib-c/src/external/glfw/include/GLFW /usr/local/include/
echo "building raylib_parser" echo "building raylib_parser"
@ -45,17 +45,15 @@ python3 create_enums.py > dynamic/raylib/enums.py
echo "creating defines.py" echo "creating defines.py"
python3 create_define_consts.py > raylib/defines.py python3 create_define_consts.py | awk '!seen[$0]++' > raylib/defines.py
python3 create_define_consts.py > dynamic/raylib/defines.py python3 create_define_consts.py | awk '!seen[$0]++' > dynamic/raylib/defines.py
echo "creating pyi files" echo "creating pyi files"
python3 create_stub_pyray.py > pyray/__init__.pyi python3 create_stub_pyray.py > pyray/__init__.pyi
python3 create_enums.py >> pyray/__init__.pyi
python3 create_stub_static.py >raylib/__init__.pyi python3 create_stub_static.py >raylib/__init__.pyi
python3 create_stub_static.py >dynamic/raylib/__init__.pyi
echo "installing sphinx modules" echo "installing sphinx modules"

File diff suppressed because it is too large Load diff

0
pyray/py.typed Normal file
View file

@ -1 +1 @@
Subproject commit a2e31c4e1ba7b2ab0c4b87c70e88fa365b02f652 Subproject commit 26548c10620c4ae6937cf8b506c777a006b33c16

File diff suppressed because it is too large Load diff

View file

@ -175,11 +175,13 @@ def build_unix():
else: #platform.system() == "Linux": else: #platform.system() == "Linux":
print("BUILDING FOR LINUX") print("BUILDING FOR LINUX")
extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL', extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
'-lrt', '-lm', '-ldl', '-lX11', '-lpthread', '-latomic'] '-lrt', '-lm', '-ldl', '-lpthread', '-latomic']
if RAYLIB_PLATFORM=="SDL": if RAYLIB_PLATFORM=="SDL":
extra_link_args += ['-lSDL2'] extra_link_args += ['-lX11','-lSDL2']
elif RAYLIB_PLATFORM=="DRM": elif RAYLIB_PLATFORM=="DRM":
extra_link_args += ['-lEGL', '-lgbm'] extra_link_args += ['-lEGL', '-lgbm']
else:
extra_link_args += ['-lX11']
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"] extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
libraries = [] # Not sure why but we put them in extra_link_args instead so *shouldnt* be needed here libraries = [] # Not sure why but we put them in extra_link_args instead so *shouldnt* be needed here

View file

@ -3,7 +3,7 @@ import raylib
RAYLIB_VERSION_MAJOR: int = 5 RAYLIB_VERSION_MAJOR: int = 5
RAYLIB_VERSION_MINOR: int = 5 RAYLIB_VERSION_MINOR: int = 5
RAYLIB_VERSION_PATCH: int = 0 RAYLIB_VERSION_PATCH: int = 0
RAYLIB_VERSION: str = "5.5-dev" RAYLIB_VERSION: str = "5.5"
PI: float = 3.141592653589793 PI: float = 3.141592653589793
DEG2RAD = PI / 180.0 DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI RAD2DEG = 180.0 / PI
@ -14,10 +14,7 @@ MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS
PI: float = 3.141592653589793
EPSILON: float = 1e-06 EPSILON: float = 1e-06
DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI
RLGL_VERSION: str = "5.0" RLGL_VERSION: str = "5.0"
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192 RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
RL_DEFAULT_BATCH_BUFFERS: int = 1 RL_DEFAULT_BATCH_BUFFERS: int = 1
@ -102,9 +99,6 @@ RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS: int = 7
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8 RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8
RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO
RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
PI: float = 3.141592653589793
DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI
GL_SHADING_LANGUAGE_VERSION: int = 35724 GL_SHADING_LANGUAGE_VERSION: int = 35724
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776 GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777

View file

@ -297,7 +297,6 @@ class CubemapLayout(IntEnum):
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
CUBEMAP_LAYOUT_PANORAMA = 5
class FontType(IntEnum): class FontType(IntEnum):
FONT_DEFAULT = 0 FONT_DEFAULT = 0

0
raylib/py.typed Normal file
View file

View file

@ -1,22 +1,22 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raylib v5.5-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * raylib v5.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
* *
* FEATURES: * FEATURES:
* - NO external dependencies, all required libraries included with raylib * - NO external dependencies, all required libraries included with raylib
* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, * - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5. * MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
* - Written in plain C code (C99) in PascalCase/camelCase notation * - Written in plain C code (C99) in PascalCase/camelCase notation
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3 or ES2 - choose at compile) * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts) * - Multiple Fonts formats supported (TTF, OTF, FNT, BDF, Sprite fonts)
* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC) * - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more! * - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
* - Flexible Materials system, supporting classic maps and PBR maps * - Flexible Materials system, supporting classic maps and PBR maps
* - Animated 3D models supported (skeletal bones animation) (IQM) * - Animated 3D models supported (skeletal bones animation) (IQM, M3D, GLTF)
* - Shaders support, including Model shaders and Postprocessing shaders * - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath] * - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) * - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, QOA, XM, MOD)
* - VR stereo rendering with configurable HMD device parameters * - VR stereo rendering with configurable HMD device parameters
* - Bindings to multiple programming languages available! * - Bindings to multiple programming languages available!
* *
@ -27,29 +27,35 @@
* - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2) * - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2)
* *
* DEPENDENCIES (included): * DEPENDENCIES (included):
* [rcore] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP) * [rcore][GLFW] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input
* [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP) * [rcore][RGFW] rgfw (ColleagueRiley - github.com/ColleagueRiley/RGFW) for window/context management and input
* [rlgl] glad/glad_gles2 (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading
* [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management * [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
* *
* OPTIONAL DEPENDENCIES (included): * OPTIONAL DEPENDENCIES (included):
* [rcore] msf_gif (Miles Fogle) for GIF recording * [rcore] msf_gif (Miles Fogle) for GIF recording
* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm * [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm * [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
* [rcore] rprand (Ramon Snatamaria) for pseudo-random numbers generation
* [rtextures] qoi (Dominic Szablewski - https://phoboslab.org) for QOI image manage
* [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...) * [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG) * [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
* [rtextures] stb_image_resize (Sean Barret) for image resizing algorithms * [rtextures] stb_image_resize2 (Sean Barret) for image resizing algorithms
* [rtextures] stb_perlin (Sean Barret) for Perlin Noise image generation
* [rtext] stb_truetype (Sean Barret) for ttf fonts loading * [rtext] stb_truetype (Sean Barret) for ttf fonts loading
* [rtext] stb_rect_pack (Sean Barret) for rectangles packing * [rtext] stb_rect_pack (Sean Barret) for rectangles packing
* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation * [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
* [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL) * [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
* [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF) * [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
* [rmodels] Model3D (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d) * [rmodels] m3d (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d)
* [rmodels] vox_loader (Johann Nadalutti) for models loading (VOX)
* [raudio] dr_wav (David Reid) for WAV audio file loading * [raudio] dr_wav (David Reid) for WAV audio file loading
* [raudio] dr_flac (David Reid) for FLAC audio file loading * [raudio] dr_flac (David Reid) for FLAC audio file loading
* [raudio] dr_mp3 (David Reid) for MP3 audio file loading * [raudio] dr_mp3 (David Reid) for MP3 audio file loading
* [raudio] stb_vorbis (Sean Barret) for OGG audio loading * [raudio] stb_vorbis (Sean Barret) for OGG audio loading
* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading * [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading * [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
* [raudio] qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio manage
* *
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
@ -700,8 +706,7 @@ typedef enum {
CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces
CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE // Layout is defined by a 4x3 cross with cubemap faces
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
} CubemapLayout; } CubemapLayout;
// Font type, defines generation method // Font type, defines generation method
typedef enum { typedef enum {
@ -774,36 +779,36 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
bool IsWindowReady(void); // Check if window has been initialized successfully bool IsWindowReady(void); // Check if window has been initialized successfully
bool IsWindowFullscreen(void); // Check if window is currently fullscreen bool IsWindowFullscreen(void); // Check if window is currently fullscreen
bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP) bool IsWindowHidden(void); // Check if window is currently hidden
bool IsWindowMinimized(void); // Check if window is currently minimized (only PLATFORM_DESKTOP) bool IsWindowMinimized(void); // Check if window is currently minimized
bool IsWindowMaximized(void); // Check if window is currently maximized (only PLATFORM_DESKTOP) bool IsWindowMaximized(void); // Check if window is currently maximized
bool IsWindowFocused(void); // Check if window is currently focused (only PLATFORM_DESKTOP) bool IsWindowFocused(void); // Check if window is currently focused
bool IsWindowResized(void); // Check if window has been resized last frame bool IsWindowResized(void); // Check if window has been resized last frame
bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP) void SetWindowState(unsigned int flags); // Set window configuration state using flags
void ClearWindowState(unsigned int flags); // Clear window configuration state flags void ClearWindowState(unsigned int flags); // Clear window configuration state flags
void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP) void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed, resizes monitor to match window resolution
void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP) void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed, resizes window to match monitor resolution
void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP) void MaximizeWindow(void); // Set window state: maximized, if resizable
void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP) void MinimizeWindow(void); // Set window state: minimized, if resizable
void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP) void RestoreWindow(void); // Set window state: not minimized/maximized
void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit)
void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit)
void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB) void SetWindowTitle(const char *title); // Set title for window
void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP) void SetWindowPosition(int x, int y); // Set window position on screen
void SetWindowMonitor(int monitor); // Set monitor for the current window void SetWindowMonitor(int monitor); // Set monitor for the current window
void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetWindowSize(int width, int height); // Set window dimensions void SetWindowSize(int width, int height); // Set window dimensions
void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f]
void SetWindowFocused(void); // Set window focused (only PLATFORM_DESKTOP) void SetWindowFocused(void); // Set window focused
void *GetWindowHandle(void); // Get native window handle void *GetWindowHandle(void); // Get native window handle
int GetScreenWidth(void); // Get current screen width int GetScreenWidth(void); // Get current screen width
int GetScreenHeight(void); // Get current screen height int GetScreenHeight(void); // Get current screen height
int GetRenderWidth(void); // Get current render width (it considers HiDPI) int GetRenderWidth(void); // Get current render width (it considers HiDPI)
int GetRenderHeight(void); // Get current render height (it considers HiDPI) int GetRenderHeight(void); // Get current render height (it considers HiDPI)
int GetMonitorCount(void); // Get number of connected monitors int GetMonitorCount(void); // Get number of connected monitors
int GetCurrentMonitor(void); // Get current connected monitor int GetCurrentMonitor(void); // Get current monitor where window is placed
Vector2 GetMonitorPosition(int monitor); // Get specified monitor position Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor) int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor)
int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor) int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor)
@ -815,6 +820,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
void SetClipboardText(const char *text); // Set clipboard text content void SetClipboardText(const char *text); // Set clipboard text content
const char *GetClipboardText(void); // Get clipboard text content const char *GetClipboardText(void); // Get clipboard text content
Image GetClipboardImage(void); // Get clipboard image content
void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling
// Cursor-related functions // Cursor-related functions
@ -940,6 +946,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree() unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code
unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes) unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
// Automation events functionality // Automation events functionality
AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
@ -954,7 +961,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Input-related functions: keyboard // Input-related functions: keyboard
bool IsKeyPressed(int key); // Check if a key has been pressed once bool IsKeyPressed(int key); // Check if a key has been pressed once
bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again (Only PLATFORM_DESKTOP) bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again
bool IsKeyDown(int key); // Check if a key is being pressed bool IsKeyDown(int key); // Check if a key is being pressed
bool IsKeyReleased(int key); // Check if a key has been released once bool IsKeyReleased(int key); // Check if a key has been released once
bool IsKeyUp(int key); // Check if a key is NOT being pressed bool IsKeyUp(int key); // Check if a key is NOT being pressed
@ -972,7 +979,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor); // Set gamepad vibration for both motors void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
// Input-related functions: mouse // Input-related functions: mouse
bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
@ -1000,7 +1007,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture int GetGestureDetected(void); // Get latest detected gesture
float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds float GetGestureHoldDuration(void); // Get gesture hold time in seconds
Vector2 GetGestureDragVector(void); // Get gesture drag vector Vector2 GetGestureDragVector(void); // Get gesture drag vector
float GetGestureDragAngle(void); // Get gesture drag angle float GetGestureDragAngle(void); // Get gesture drag angle
Vector2 GetGesturePinchVector(void); // Get gesture pinch delta Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
@ -1078,13 +1085,13 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Texture Loading and Drawing Functions (Module: textures) // Texture Loading and Drawing Functions (Module: textures)
@ -1350,11 +1357,11 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
// Model animations loading/unloading functions // Model animations loading/unloading functions
ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose (CPU)
void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame); // Update model animation mesh bone matrices (GPU skinning)
void UnloadModelAnimation(ModelAnimation anim); // Unload animation data void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
void UpdateModelAnimationBoneMatrices(Model model, ModelAnimation anim, int frame); // Update model animation mesh bone matrices (Note GPU skinning does not work on Mac)
// Collision detection functions // Collision detection functions
bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes

View file

@ -1,6 +1,6 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raymath v1.5 - Math functions to work with Vector2, Vector3, Matrix and Quaternions * raymath v2.0 - Math functions to work with Vector2, Vector3, Matrix and Quaternions
* *
* CONVENTIONS: * CONVENTIONS:
* - Matrix structure is defined as row-major (memory layout) but parameters naming AND all * - Matrix structure is defined as row-major (memory layout) but parameters naming AND all
@ -12,7 +12,7 @@
* - Functions are always self-contained, no function use another raymath function inside, * - Functions are always self-contained, no function use another raymath function inside,
* required code is directly re-implemented inside * required code is directly re-implemented inside
* - Functions input parameters are always received by value (2 unavoidable exceptions) * - Functions input parameters are always received by value (2 unavoidable exceptions)
* - Functions use always a "result" variable for return * - Functions use always a "result" variable for return (except C++ operators)
* - Functions are always defined inline * - Functions are always defined inline
* - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience) * - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience)
* - No compound literals used to make sure libray is compatible with C++ * - No compound literals used to make sure libray is compatible with C++
@ -26,6 +26,8 @@
* #define RAYMATH_STATIC_INLINE * #define RAYMATH_STATIC_INLINE
* This may use up lots of memory. * This may use up lots of memory.
* *
* #define RAYMATH_DISABLE_CPP_OPERATORS
* Disables C++ operator overloads for raymath types.
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
* *

View file

@ -8,17 +8,17 @@
* *
* ADDITIONAL NOTES: * ADDITIONAL NOTES:
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are * When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
* initialized on rlglInit() to accumulate vertex data. * initialized on rlglInit() to accumulate vertex data
* *
* When an internal state change is required all the stored vertex data is renderer in batch, * When an internal state change is required all the stored vertex data is renderer in batch,
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch. * additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch
* *
* Some resources are also loaded for convenience, here the complete list: * Some resources are also loaded for convenience, here the complete list:
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data * - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 * - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) * - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
* *
* Internal buffer (and resources) must be manually unloaded calling rlglClose(). * Internal buffer (and resources) must be manually unloaded calling rlglClose()
* *
* CONFIGURATION: * CONFIGURATION:
* #define GRAPHICS_API_OPENGL_11 * #define GRAPHICS_API_OPENGL_11
@ -32,9 +32,9 @@
* required by any other module, use rlGetVersion() to check it * required by any other module, use rlGetVersion() to check it
* *
* #define RLGL_IMPLEMENTATION * #define RLGL_IMPLEMENTATION
* Generates the implementation of the library into the included file. * Generates the implementation of the library into the included file
* If not defined, the library is in header only mode and can be included in other headers * If not defined, the library is in header only mode and can be included in other headers
* or source files without problems. But only ONE file should hold the implementation. * or source files without problems. But only ONE file should hold the implementation
* *
* #define RLGL_RENDER_TEXTURES_HINT * #define RLGL_RENDER_TEXTURES_HINT
* Enable framebuffer objects (fbo) support (enabled by default) * Enable framebuffer objects (fbo) support (enabled by default)
@ -464,7 +464,7 @@ typedef enum {
// Textures management // Textures management
unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data
unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo)
unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap data unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount); // Load texture cubemap data
void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU
void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats
const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format

View file

@ -1 +1 @@
__version__ = "5.5.0.0.dev3" __version__ = "5.5.0.0"