diff --git a/compiler/libs/raylib.yaka b/compiler/libs/raylib.yaka index 803f3ab1..5878fac3 100644 --- a/compiler/libs/raylib.yaka +++ b/compiler/libs/raylib.yaka @@ -31,6 +31,8 @@ FLAG_WINDOW_HIGHDPI: Const[int] = 8192 # Set to support HighDPI FLAG_WINDOW_MOUSE_PASSTHROUGH: Const[int] = 16384 # Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED +FLAG_BORDERLESS_WINDOWED_MODE: Const[int] = 32768 +# Set to run program in borderless windowed mode FLAG_MSAA_4X_HINT: Const[int] = 32 # Set to try enabling MSAA 4X FLAG_INTERLACED_HINT: Const[int] = 65536 @@ -475,27 +477,33 @@ PIXELFORMAT_UNCOMPRESSED_R32G32B32: Const[int] = 9 # 32*3 bpp (3 channels - float) PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: Const[int] = 10 # 32*4 bpp (4 channels - float) -PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int] = 11 +PIXELFORMAT_UNCOMPRESSED_R16: Const[int] = 11 +# 16 bpp (1 channel - half float) +PIXELFORMAT_UNCOMPRESSED_R16G16B16: Const[int] = 12 +# 16*3 bpp (3 channels - half float) +PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: Const[int] = 13 +# 16*4 bpp (4 channels - half float) +PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int] = 14 # 4 bpp (no alpha) -PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int] = 12 +PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int] = 15 # 4 bpp (1 bit alpha) -PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int] = 13 +PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int] = 16 # 8 bpp -PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int] = 14 +PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int] = 17 # 8 bpp -PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int] = 15 +PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int] = 18 # 4 bpp -PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int] = 16 +PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int] = 19 # 4 bpp -PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int] = 17 +PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int] = 20 # 8 bpp -PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int] = 18 +PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int] = 21 # 4 bpp -PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int] = 19 +PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int] = 22 # 4 bpp -PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int] = 20 +PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int] = 23 # 8 bpp -PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int] = 21 +PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int] = 24 # 2 bpp TEXTURE_FILTER_POINT: Const[int] = 0 # No filter, just pixel approximation @@ -908,11 +916,12 @@ struct ModelAnimation: frameCount: c.CInt bones: Ptr[BoneInfo] framePoses: Ptr[Ptr[Transform ]] + name: FixedArr[c.CChar,32] @nativemacro -def model_animation(bone_count: int, frame_count: int, bones: Ptr[BoneInfo], frame_poses: Ptr[Ptr[Transform]]) -> ModelAnimation: +def model_animation(bone_count: int, frame_count: int, bones: Ptr[BoneInfo], frame_poses: Ptr[Ptr[Transform]], name: FixedArr[c.CChar,32]) -> ModelAnimation: # Factory function for: ModelAnimation - ccode """(ModelAnimation){(int)nn__bone_count, (int)nn__frame_count, nn__bones, nn__frame_poses}""" + ccode """(ModelAnimation){(int)nn__bone_count, (int)nn__frame_count, nn__bones, nn__frame_poses, nn__name}""" @nativedefine("Ray") struct Ray: @@ -1050,6 +1059,23 @@ def file_path_list(capacity: u32, count: u32, paths: Ptr[Ptr[c.CChar]]) -> FileP # Factory function for: FilePathList ccode """(FilePathList){(unsigned int)nn__capacity, (unsigned int)nn__count, nn__paths}""" +@nativedefine("AutomationEvent") +class AutomationEvent: + # Automation event + pass + +@nativedefine("AutomationEventList") +struct AutomationEventList: + # Automation event list + capacity: c.CUInt + count: c.CUInt + events: Ptr[AutomationEvent] + +@nativemacro +def automation_event_list(capacity: u32, count: u32, events: Ptr[AutomationEvent]) -> AutomationEventList: + # Factory function for: AutomationEventList + ccode """(AutomationEventList){(unsigned int)nn__capacity, (unsigned int)nn__count, nn__events}""" + @nativedefine("Quaternion") struct Quaternion: # Quaternion, 4 components (Vector4 alias) @@ -1122,16 +1148,16 @@ def init_window(width: int, height: int, title: c.CStr) -> None: # Initialize window and OpenGL context ccode """InitWindow((int)nn__width, (int)nn__height, nn__title)""" -@nativemacro -def window_should_close() -> bool: - # Check if KEY_ESCAPE pressed or Close icon pressed - ccode """WindowShouldClose()""" - @nativemacro def close_window() -> None: # Close window and unload OpenGL context ccode """CloseWindow()""" +@nativemacro +def window_should_close() -> bool: + # Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) + ccode """WindowShouldClose()""" + @nativemacro def is_window_ready() -> bool: # Check if window has been initialized successfully @@ -1187,6 +1213,11 @@ def toggle_fullscreen() -> None: # Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) ccode """ToggleFullscreen()""" +@nativemacro +def toggle_borderless_windowed() -> None: + # Toggle window state: borderless windowed (only PLATFORM_DESKTOP) + ccode """ToggleBorderlessWindowed()""" + @nativemacro def maximize_window() -> None: # Set window state: maximized, if resizable (only PLATFORM_DESKTOP) @@ -1214,7 +1245,7 @@ def set_window_icons(images: Ptr[Image], count: int) -> None: @nativemacro def set_window_title(title: c.CStr) -> None: - # Set title for window (only PLATFORM_DESKTOP) + # Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB) ccode """SetWindowTitle(nn__title)""" @nativemacro @@ -1224,7 +1255,7 @@ def set_window_position(x: int, y: int) -> None: @nativemacro def set_window_monitor(monitor: int) -> None: - # Set monitor for the current window (fullscreen mode) + # Set monitor for the current window ccode """SetWindowMonitor((int)nn__monitor)""" @nativemacro @@ -1232,6 +1263,11 @@ def set_window_min_size(width: int, height: int) -> None: # Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) ccode """SetWindowMinSize((int)nn__width, (int)nn__height)""" +@nativemacro +def set_window_max_size(width: int, height: int) -> None: + # Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) + ccode """SetWindowMaxSize((int)nn__width, (int)nn__height)""" + @nativemacro def set_window_size(width: int, height: int) -> None: # Set window dimensions @@ -1242,6 +1278,11 @@ def set_window_opacity(opacity: float) -> None: # Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) ccode """SetWindowOpacity(nn__opacity)""" +@nativemacro +def set_window_focused() -> None: + # Set window focused (only PLATFORM_DESKTOP) + ccode """SetWindowFocused()""" + @nativemacro def get_window_handle() -> AnyPtr: # Get native window handle @@ -1319,7 +1360,7 @@ def get_window_scale_dpi() -> Vector2: @nativemacro def get_monitor_name(monitor: int) -> c.CStr: - # Get the human-readable, UTF-8 encoded name of the primary monitor + # Get the human-readable, UTF-8 encoded name of the specified monitor ccode """GetMonitorName((int)nn__monitor)""" @nativemacro @@ -1342,21 +1383,6 @@ def disable_event_waiting() -> None: # Disable waiting for events on EndDrawing(), automatic events polling ccode """DisableEventWaiting()""" -@nativemacro -def swap_screen_buffer() -> None: - # Swap back buffer with front buffer (screen drawing) - ccode """SwapScreenBuffer()""" - -@nativemacro -def poll_input_events() -> None: - # Register all input events - ccode """PollInputEvents()""" - -@nativemacro -def wait_time(seconds: f64) -> None: - # Wait for some time (halt program execution) - ccode """WaitTime(nn__seconds)""" - @nativemacro def show_cursor() -> None: # Shows cursor @@ -1572,11 +1598,6 @@ def set_target_fps(fps: int) -> None: # Set target FPS (maximum) ccode """SetTargetFPS((int)nn__fps)""" -@nativemacro -def get_fps() -> int: - # Get current FPS - ccode """GetFPS()""" - @nativemacro def get_frame_time() -> float: # Get time in seconds for last frame drawn (delta time) @@ -1588,15 +1609,45 @@ def get_time() -> f64: ccode """GetTime()""" @nativemacro -def get_random_value(min: int, max: int) -> int: - # Get a random value between min and max (both included) - ccode """GetRandomValue((int)nn__min, (int)nn__max)""" +def get_fps() -> int: + # Get current FPS + ccode """GetFPS()""" + +@nativemacro +def swap_screen_buffer() -> None: + # Swap back buffer with front buffer (screen drawing) + ccode """SwapScreenBuffer()""" + +@nativemacro +def poll_input_events() -> None: + # Register all input events + ccode """PollInputEvents()""" + +@nativemacro +def wait_time(seconds: f64) -> None: + # Wait for some time (halt program execution) + ccode """WaitTime(nn__seconds)""" @nativemacro def set_random_seed(seed: u32) -> None: # Set the seed for the random number generator ccode """SetRandomSeed((unsigned int)nn__seed)""" +@nativemacro +def get_random_value(min: int, max: int) -> int: + # Get a random value between min and max (both included) + ccode """GetRandomValue((int)nn__min, (int)nn__max)""" + +@nativemacro +def load_random_sequence(count: u32, min: int, max: int) -> Ptr[c.CInt]: + # Load random values sequence, no values repeated + ccode """LoadRandomSequence((unsigned int)nn__count, (int)nn__min, (int)nn__max)""" + +@nativemacro +def unload_random_sequence(sequence: Ptr[c.CInt]) -> None: + # Unload random values sequence + ccode """UnloadRandomSequence(nn__sequence)""" + @nativemacro def take_screenshot(file_name: c.CStr) -> None: # Takes a screenshot of current screen (filename extension defines format) @@ -1607,6 +1658,11 @@ def set_config_flags(flags: u32) -> None: # Setup init configuration flags (view FLAGS) ccode """SetConfigFlags((unsigned int)nn__flags)""" +@nativemacro +def open_url(url: c.CStr) -> None: + # Open URL with default system browser (if available) + ccode """OpenURL(nn__url)""" + @nativemacro def set_trace_log_level(log_level: int) -> None: # Set the current threshold (minimum) log level @@ -1627,11 +1683,6 @@ def mem_free(ptr: AnyPtr) -> None: # Internal memory free ccode """MemFree(nn__ptr)""" -@nativemacro -def open_url(url: c.CStr) -> None: - # Open URL with default system browser (if available) - ccode """OpenURL(nn__url)""" - @nativemacro def set_load_file_data_callback(callback: Function[In[c.CStr,Ptr[c.CUInt]],Out[c.CStr]]) -> None: # Set custom file binary data loader @@ -1653,9 +1704,9 @@ def set_save_file_text_callback(callback: Function[In[c.CStr,c.CStr],Out[bool]]) ccode """SetSaveFileTextCallback(nn__callback)""" @nativemacro -def load_file_data(file_name: c.CStr, bytes_read: Ptr[c.CUInt]) -> Ptr[c.CUChar]: +def load_file_data(file_name: c.CStr, data_size: Ptr[c.CInt]) -> Ptr[c.CUChar]: # Load file data as byte array (read) - ccode """LoadFileData(nn__file_name, nn__bytes_read)""" + ccode """LoadFileData(nn__file_name, nn__data_size)""" @nativemacro def unload_file_data(data: Ptr[c.CUChar]) -> None: @@ -1663,14 +1714,14 @@ def unload_file_data(data: Ptr[c.CUChar]) -> None: ccode """UnloadFileData(nn__data)""" @nativemacro -def save_file_data(file_name: c.CStr, data: AnyPtr, bytes_to_write: u32) -> bool: +def save_file_data(file_name: c.CStr, data: AnyPtr, data_size: int) -> bool: # Save data to file from byte array (write), returns true on success - ccode """SaveFileData(nn__file_name, nn__data, (unsigned int)nn__bytes_to_write)""" + ccode """SaveFileData(nn__file_name, nn__data, (int)nn__data_size)""" @nativemacro -def export_data_as_code(data: Ptr[Const[c.CUChar]], size: u32, file_name: c.CStr) -> bool: +def export_data_as_code(data: Ptr[Const[c.CUChar]], data_size: int, file_name: c.CStr) -> bool: # Export data to code (.h), returns true on success - ccode """ExportDataAsCode(nn__data, (unsigned int)nn__size, nn__file_name)""" + ccode """ExportDataAsCode(nn__data, (int)nn__data_size, nn__file_name)""" @nativemacro def load_file_text(file_name: c.CStr) -> c.CStr: @@ -1739,7 +1790,7 @@ def get_working_directory() -> c.CStr: @nativemacro def get_application_directory() -> c.CStr: - # Get the directory if the running application (uses static string) + # Get the directory of the running application (uses static string) ccode """GetApplicationDirectory()""" @nativemacro @@ -1807,11 +1858,56 @@ def decode_data_base64(data: Ptr[Const[c.CUChar]], output_size: Ptr[c.CInt]) -> # Decode Base64 string data, memory must be MemFree() ccode """DecodeDataBase64(nn__data, nn__output_size)""" +@nativemacro +def load_automation_event_list(file_name: c.CStr) -> AutomationEventList: + # Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS + ccode """LoadAutomationEventList(nn__file_name)""" + +@nativemacro +def unload_automation_event_list(list: Ptr[AutomationEventList]) -> None: + # Unload automation events list from file + ccode """UnloadAutomationEventList(nn__list)""" + +@nativemacro +def export_automation_event_list(list: AutomationEventList, file_name: c.CStr) -> bool: + # Export automation events list as text file + ccode """ExportAutomationEventList(nn__list, nn__file_name)""" + +@nativemacro +def set_automation_event_list(list: Ptr[AutomationEventList]) -> None: + # Set automation event list to record to + ccode """SetAutomationEventList(nn__list)""" + +@nativemacro +def set_automation_event_base_frame(frame: int) -> None: + # Set automation event internal base frame to start recording + ccode """SetAutomationEventBaseFrame((int)nn__frame)""" + +@nativemacro +def start_automation_event_recording() -> None: + # Start recording automation events (AutomationEventList must be set) + ccode """StartAutomationEventRecording()""" + +@nativemacro +def stop_automation_event_recording() -> None: + # Stop recording automation events + ccode """StopAutomationEventRecording()""" + +@nativemacro +def play_automation_event(event: AutomationEvent) -> None: + # Play a recorded automation event + ccode """PlayAutomationEvent(nn__event)""" + @nativemacro def is_key_pressed(key: int) -> bool: # Check if a key has been pressed once ccode """IsKeyPressed((int)nn__key)""" +@nativemacro +def is_key_pressed_repeat(key: int) -> bool: + # Check if a key has been pressed again (Only PLATFORM_DESKTOP) + ccode """IsKeyPressedRepeat((int)nn__key)""" + @nativemacro def is_key_down(key: int) -> bool: # Check if a key is being pressed @@ -1827,11 +1923,6 @@ def is_key_up(key: int) -> bool: # Check if a key is NOT being pressed ccode """IsKeyUp((int)nn__key)""" -@nativemacro -def set_exit_key(key: int) -> None: - # Set a custom key to exit program (default is ESC) - ccode """SetExitKey((int)nn__key)""" - @nativemacro def get_key_pressed() -> int: # Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty @@ -1842,6 +1933,11 @@ def get_char_pressed() -> int: # Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty ccode """GetCharPressed()""" +@nativemacro +def set_exit_key(key: int) -> None: + # Set a custom key to exit program (default is ESC) + ccode """SetExitKey((int)nn__key)""" + @nativemacro def is_gamepad_available(gamepad: int) -> bool: # Check if a gamepad is available @@ -1993,9 +2089,9 @@ def set_gestures_enabled(flags: u32) -> None: ccode """SetGesturesEnabled((unsigned int)nn__flags)""" @nativemacro -def is_gesture_detected(gesture: int) -> bool: +def is_gesture_detected(gesture: u32) -> bool: # Check if a gesture have been detected - ccode """IsGestureDetected((int)nn__gesture)""" + ccode """IsGestureDetected((unsigned int)nn__gesture)""" @nativemacro def get_gesture_detected() -> int: @@ -2059,34 +2155,24 @@ def draw_line(start_pos_x: int, start_pos_y: int, end_pos_x: int, end_pos_y: int @nativemacro def draw_line_v(start_pos: Vector2, end_pos: Vector2, p_color: Color) -> None: - # Draw a line (Vector version) + # Draw a line (using gl lines) ccode """DrawLineV(nn__start_pos, nn__end_pos, nn__p_color)""" @nativemacro def draw_line_ex(start_pos: Vector2, end_pos: Vector2, thick: float, p_color: Color) -> None: - # Draw a line defining thickness + # Draw a line (using triangles/quads) ccode """DrawLineEx(nn__start_pos, nn__end_pos, nn__thick, nn__p_color)""" -@nativemacro -def draw_line_bezier(start_pos: Vector2, end_pos: Vector2, thick: float, p_color: Color) -> None: - # Draw a line using cubic-bezier curves in-out - ccode """DrawLineBezier(nn__start_pos, nn__end_pos, nn__thick, nn__p_color)""" - -@nativemacro -def draw_line_bezier_quad(start_pos: Vector2, end_pos: Vector2, control_pos: Vector2, thick: float, p_color: Color) -> None: - # Draw line using quadratic bezier curves with a control point - ccode """DrawLineBezierQuad(nn__start_pos, nn__end_pos, nn__control_pos, nn__thick, nn__p_color)""" - -@nativemacro -def draw_line_bezier_cubic(start_pos: Vector2, end_pos: Vector2, start_control_pos: Vector2, end_control_pos: Vector2, thick: float, p_color: Color) -> None: - # Draw line using cubic bezier curves with 2 control points - ccode """DrawLineBezierCubic(nn__start_pos, nn__end_pos, nn__start_control_pos, nn__end_control_pos, nn__thick, nn__p_color)""" - @nativemacro def draw_line_strip(points: Ptr[Vector2], point_count: int, p_color: Color) -> None: - # Draw lines sequence + # Draw lines sequence (using gl lines) ccode """DrawLineStrip(nn__points, (int)nn__point_count, nn__p_color)""" +@nativemacro +def draw_line_bezier(start_pos: Vector2, end_pos: Vector2, thick: float, p_color: Color) -> None: + # Draw line segment cubic-bezier in-out interpolation + ccode """DrawLineBezier(nn__start_pos, nn__end_pos, nn__thick, nn__p_color)""" + @nativemacro def draw_circle(center_x: int, center_y: int, radius: float, p_color: Color) -> None: # Draw a color-filled circle @@ -2117,6 +2203,11 @@ def draw_circle_lines(center_x: int, center_y: int, radius: float, p_color: Colo # Draw circle outline ccode """DrawCircleLines((int)nn__center_x, (int)nn__center_y, nn__radius, nn__p_color)""" +@nativemacro +def draw_circle_lines_v(center: Vector2, radius: float, p_color: Color) -> None: + # Draw circle outline (Vector version) + ccode """DrawCircleLinesV(nn__center, nn__radius, nn__p_color)""" + @nativemacro def draw_ellipse(center_x: int, center_y: int, radius_h: float, radius_v: float, p_color: Color) -> None: # Draw ellipse @@ -2227,6 +2318,81 @@ def draw_poly_lines_ex(center: Vector2, sides: int, radius: float, rotation: flo # Draw a polygon outline of n sides with extended parameters ccode """DrawPolyLinesEx(nn__center, (int)nn__sides, nn__radius, nn__rotation, nn__line_thick, nn__p_color)""" +@nativemacro +def draw_spline_linear(points: Ptr[Vector2], point_count: int, thick: float, p_color: Color) -> None: + # Draw spline: Linear, minimum 2 points + ccode """DrawSplineLinear(nn__points, (int)nn__point_count, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_basis(points: Ptr[Vector2], point_count: int, thick: float, p_color: Color) -> None: + # Draw spline: B-Spline, minimum 4 points + ccode """DrawSplineBasis(nn__points, (int)nn__point_count, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_catmull_rom(points: Ptr[Vector2], point_count: int, thick: float, p_color: Color) -> None: + # Draw spline: Catmull-Rom, minimum 4 points + ccode """DrawSplineCatmullRom(nn__points, (int)nn__point_count, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_bezier_quadratic(points: Ptr[Vector2], point_count: int, thick: float, p_color: Color) -> None: + # Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] + ccode """DrawSplineBezierQuadratic(nn__points, (int)nn__point_count, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_bezier_cubic(points: Ptr[Vector2], point_count: int, thick: float, p_color: Color) -> None: + # Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] + ccode """DrawSplineBezierCubic(nn__points, (int)nn__point_count, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_segment_linear(p1: Vector2, p2: Vector2, thick: float, p_color: Color) -> None: + # Draw spline segment: Linear, 2 points + ccode """DrawSplineSegmentLinear(nn__p1, nn__p2, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_segment_basis(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, thick: float, p_color: Color) -> None: + # Draw spline segment: B-Spline, 4 points + ccode """DrawSplineSegmentBasis(nn__p1, nn__p2, nn__p3, nn__p4, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_segment_catmull_rom(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, thick: float, p_color: Color) -> None: + # Draw spline segment: Catmull-Rom, 4 points + ccode """DrawSplineSegmentCatmullRom(nn__p1, nn__p2, nn__p3, nn__p4, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_segment_bezier_quadratic(p1: Vector2, c2: Vector2, p3: Vector2, thick: float, p_color: Color) -> None: + # Draw spline segment: Quadratic Bezier, 2 points, 1 control point + ccode """DrawSplineSegmentBezierQuadratic(nn__p1, nn__c2, nn__p3, nn__thick, nn__p_color)""" + +@nativemacro +def draw_spline_segment_bezier_cubic(p1: Vector2, c2: Vector2, c3: Vector2, p4: Vector2, thick: float, p_color: Color) -> None: + # Draw spline segment: Cubic Bezier, 2 points, 2 control points + ccode """DrawSplineSegmentBezierCubic(nn__p1, nn__c2, nn__c3, nn__p4, nn__thick, nn__p_color)""" + +@nativemacro +def get_spline_point_linear(start_pos: Vector2, end_pos: Vector2, t: float) -> Vector2: + # Get (evaluate) spline point: Linear + ccode """GetSplinePointLinear(nn__start_pos, nn__end_pos, nn__t)""" + +@nativemacro +def get_spline_point_basis(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, t: float) -> Vector2: + # Get (evaluate) spline point: B-Spline + ccode """GetSplinePointBasis(nn__p1, nn__p2, nn__p3, nn__p4, nn__t)""" + +@nativemacro +def get_spline_point_catmull_rom(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, t: float) -> Vector2: + # Get (evaluate) spline point: Catmull-Rom + ccode """GetSplinePointCatmullRom(nn__p1, nn__p2, nn__p3, nn__p4, nn__t)""" + +@nativemacro +def get_spline_point_bezier_quad(p1: Vector2, c2: Vector2, p3: Vector2, t: float) -> Vector2: + # Get (evaluate) spline point: Quadratic Bezier + ccode """GetSplinePointBezierQuad(nn__p1, nn__c2, nn__p3, nn__t)""" + +@nativemacro +def get_spline_point_bezier_cubic(p1: Vector2, c2: Vector2, c3: Vector2, p4: Vector2, t: float) -> Vector2: + # Get (evaluate) spline point: Cubic Bezier + ccode """GetSplinePointBezierCubic(nn__p1, nn__c2, nn__c3, nn__p4, nn__t)""" + @nativemacro def check_collision_recs(rec1: Rectangle, rec2: Rectangle) -> bool: # Check collision between two rectangles @@ -2287,6 +2453,11 @@ def load_image_raw(file_name: c.CStr, width: int, height: int, format: int, head # Load image from RAW file data ccode """LoadImageRaw(nn__file_name, (int)nn__width, (int)nn__height, (int)nn__format, (int)nn__header_size)""" +@nativemacro +def load_image_svg(file_name_or_string: c.CStr, width: int, height: int) -> Image: + # Load image from SVG file data or string with specified size + ccode """LoadImageSvg(nn__file_name_or_string, (int)nn__width, (int)nn__height)""" + @nativemacro def load_image_anim(file_name: c.CStr, frames: Ptr[c.CInt]) -> Image: # Load image sequence from file (frames appended to image.data) @@ -2322,6 +2493,11 @@ def export_image(p_image: Image, file_name: c.CStr) -> bool: # Export image data to file, returns true on success ccode """ExportImage(nn__p_image, nn__file_name)""" +@nativemacro +def export_image_to_memory(p_image: Image, file_type: c.CStr, file_size: Ptr[c.CInt]) -> Ptr[c.CUChar]: + # Export image to memory buffer + ccode """ExportImageToMemory(nn__p_image, nn__file_type, nn__file_size)""" + @nativemacro def export_image_as_code(p_image: Image, file_name: c.CStr) -> bool: # Export image as code file defining an array of bytes, returns true on success @@ -2333,20 +2509,20 @@ def gen_image_color(width: int, height: int, p_color: Color) -> Image: ccode """GenImageColor((int)nn__width, (int)nn__height, nn__p_color)""" @nativemacro -def gen_image_gradient_v(width: int, height: int, top: Color, bottom: Color) -> Image: - # Generate image: vertical gradient - ccode """GenImageGradientV((int)nn__width, (int)nn__height, nn__top, nn__bottom)""" - -@nativemacro -def gen_image_gradient_h(width: int, height: int, left: Color, right: Color) -> Image: - # Generate image: horizontal gradient - ccode """GenImageGradientH((int)nn__width, (int)nn__height, nn__left, nn__right)""" +def gen_image_gradient_linear(width: int, height: int, direction: int, start: Color, end: Color) -> Image: + # Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient + ccode """GenImageGradientLinear((int)nn__width, (int)nn__height, (int)nn__direction, nn__start, nn__end)""" @nativemacro def gen_image_gradient_radial(width: int, height: int, density: float, inner: Color, outer: Color) -> Image: # Generate image: radial gradient ccode """GenImageGradientRadial((int)nn__width, (int)nn__height, nn__density, nn__inner, nn__outer)""" +@nativemacro +def gen_image_gradient_square(width: int, height: int, density: float, inner: Color, outer: Color) -> Image: + # Generate image: square gradient + ccode """GenImageGradientSquare((int)nn__width, (int)nn__height, nn__density, nn__inner, nn__outer)""" + @nativemacro def gen_image_checked(width: int, height: int, checks_x: int, checks_y: int, col1: Color, col2: Color) -> Image: # Generate image: checked @@ -2467,6 +2643,11 @@ def image_flip_horizontal(p_image: Ptr[Image]) -> None: # Flip image horizontally ccode """ImageFlipHorizontal(nn__p_image)""" +@nativemacro +def image_rotate(p_image: Ptr[Image], degrees: int) -> None: + # Rotate image by input angle in degrees (-359 to 359) + ccode """ImageRotate(nn__p_image, (int)nn__degrees)""" + @nativemacro def image_rotate_cw(p_image: Ptr[Image]) -> None: # Rotate image clockwise 90deg @@ -2798,9 +2979,9 @@ def load_font(file_name: c.CStr) -> Font: ccode """LoadFont(nn__file_name)""" @nativemacro -def load_font_ex(file_name: c.CStr, font_size: int, font_chars: Ptr[c.CInt], glyph_count: int) -> Font: - # Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set - ccode """LoadFontEx(nn__file_name, (int)nn__font_size, nn__font_chars, (int)nn__glyph_count)""" +def load_font_ex(file_name: c.CStr, font_size: int, codepoints: Ptr[c.CInt], codepoint_count: int) -> Font: + # Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont + ccode """LoadFontEx(nn__file_name, (int)nn__font_size, nn__codepoints, (int)nn__codepoint_count)""" @nativemacro def load_font_from_image(p_image: Image, key: Color, first_char: int) -> Font: @@ -2808,9 +2989,9 @@ def load_font_from_image(p_image: Image, key: Color, first_char: int) -> Font: ccode """LoadFontFromImage(nn__p_image, nn__key, (int)nn__first_char)""" @nativemacro -def load_font_from_memory(file_type: c.CStr, file_data: Ptr[Const[c.CUChar]], data_size: int, font_size: int, font_chars: Ptr[c.CInt], glyph_count: int) -> Font: +def load_font_from_memory(file_type: c.CStr, file_data: Ptr[Const[c.CUChar]], data_size: int, font_size: int, codepoints: Ptr[c.CInt], codepoint_count: int) -> Font: # Load font from memory buffer, fileType refers to extension: i.e. '.ttf' - ccode """LoadFontFromMemory(nn__file_type, nn__file_data, (int)nn__data_size, (int)nn__font_size, nn__font_chars, (int)nn__glyph_count)""" + ccode """LoadFontFromMemory(nn__file_type, nn__file_data, (int)nn__data_size, (int)nn__font_size, nn__codepoints, (int)nn__codepoint_count)""" @nativemacro def is_font_ready(p_font: Font) -> bool: @@ -2818,19 +2999,19 @@ def is_font_ready(p_font: Font) -> bool: ccode """IsFontReady(nn__p_font)""" @nativemacro -def load_font_data(file_data: Ptr[Const[c.CUChar]], data_size: int, font_size: int, font_chars: Ptr[c.CInt], glyph_count: int, type: int) -> Ptr[GlyphInfo]: +def load_font_data(file_data: Ptr[Const[c.CUChar]], data_size: int, font_size: int, codepoints: Ptr[c.CInt], codepoint_count: int, type: int) -> Ptr[GlyphInfo]: # Load font data for further use - ccode """LoadFontData(nn__file_data, (int)nn__data_size, (int)nn__font_size, nn__font_chars, (int)nn__glyph_count, (int)nn__type)""" + ccode """LoadFontData(nn__file_data, (int)nn__data_size, (int)nn__font_size, nn__codepoints, (int)nn__codepoint_count, (int)nn__type)""" @nativemacro -def gen_image_font_atlas(chars: Ptr[Const[GlyphInfo]], recs: Ptr[Ptr[Rectangle ]], glyph_count: int, font_size: int, padding: int, pack_method: int) -> Image: +def gen_image_font_atlas(glyphs: Ptr[Const[GlyphInfo]], glyph_recs: Ptr[Ptr[Rectangle ]], glyph_count: int, font_size: int, padding: int, pack_method: int) -> Image: # Generate image font atlas using chars info - ccode """GenImageFontAtlas(nn__chars, nn__recs, (int)nn__glyph_count, (int)nn__font_size, (int)nn__padding, (int)nn__pack_method)""" + ccode """GenImageFontAtlas(nn__glyphs, nn__glyph_recs, (int)nn__glyph_count, (int)nn__font_size, (int)nn__padding, (int)nn__pack_method)""" @nativemacro -def unload_font_data(chars: Ptr[GlyphInfo], glyph_count: int) -> None: +def unload_font_data(glyphs: Ptr[GlyphInfo], glyph_count: int) -> None: # Unload font chars info data (RAM) - ccode """UnloadFontData(nn__chars, (int)nn__glyph_count)""" + ccode """UnloadFontData(nn__glyphs, (int)nn__glyph_count)""" @nativemacro def unload_font(p_font: Font) -> None: @@ -2868,9 +3049,14 @@ def draw_text_codepoint(p_font: Font, codepoint: int, position: Vector2, font_si ccode """DrawTextCodepoint(nn__p_font, (int)nn__codepoint, nn__position, nn__font_size, nn__tint)""" @nativemacro -def draw_text_codepoints(p_font: Font, codepoints: Ptr[Const[c.CInt]], count: int, position: Vector2, font_size: float, spacing: float, tint: Color) -> None: +def draw_text_codepoints(p_font: Font, codepoints: Ptr[Const[c.CInt]], codepoint_count: int, position: Vector2, font_size: float, spacing: float, tint: Color) -> None: # Draw multiple character (codepoint) - ccode """DrawTextCodepoints(nn__p_font, nn__codepoints, (int)nn__count, nn__position, nn__font_size, nn__spacing, nn__tint)""" + ccode """DrawTextCodepoints(nn__p_font, nn__codepoints, (int)nn__codepoint_count, nn__position, nn__font_size, nn__spacing, nn__tint)""" + +@nativemacro +def set_text_line_spacing(spacing: int) -> None: + # Set vertical line spacing when drawing with line-breaks + ccode """SetTextLineSpacing((int)nn__spacing)""" @nativemacro def measure_text(text: c.CStr, font_size: int) -> int: @@ -3308,7 +3494,7 @@ def set_model_mesh_material(p_model: Ptr[Model], mesh_id: int, material_id: int) ccode """SetModelMeshMaterial(nn__p_model, (int)nn__mesh_id, (int)nn__material_id)""" @nativemacro -def load_model_animations(file_name: c.CStr, anim_count: Ptr[c.CUInt]) -> Ptr[ModelAnimation]: +def load_model_animations(file_name: c.CStr, anim_count: Ptr[c.CInt]) -> Ptr[ModelAnimation]: # Load model animations from file ccode """LoadModelAnimations(nn__file_name, nn__anim_count)""" @@ -3323,9 +3509,9 @@ def unload_model_animation(anim: ModelAnimation) -> None: ccode """UnloadModelAnimation(nn__anim)""" @nativemacro -def unload_model_animations(animations: Ptr[ModelAnimation], count: u32) -> None: +def unload_model_animations(animations: Ptr[ModelAnimation], anim_count: int) -> None: # Unload animation array data - ccode """UnloadModelAnimations(nn__animations, (unsigned int)nn__count)""" + ccode """UnloadModelAnimations(nn__animations, (int)nn__anim_count)""" @nativemacro def is_model_animation_valid(p_model: Model, anim: ModelAnimation) -> bool: @@ -3392,6 +3578,11 @@ def set_master_volume(volume: float) -> None: # Set master volume (listener) ccode """SetMasterVolume(nn__volume)""" +@nativemacro +def get_master_volume() -> float: + # Get master volume (listener) + ccode """GetMasterVolume()""" + @nativemacro def load_wave(file_name: c.CStr) -> Wave: # Load wave data from file @@ -3417,6 +3608,11 @@ def load_sound_from_wave(p_wave: Wave) -> Sound: # Load sound from wave data ccode """LoadSoundFromWave(nn__p_wave)""" +@nativemacro +def load_sound_alias(source: Sound) -> Sound: + # Create a new sound that shares the same sample data as the source sound, does not own the sound data + ccode """LoadSoundAlias(nn__source)""" + @nativemacro def is_sound_ready(p_sound: Sound) -> bool: # Checks if a sound is ready @@ -3437,6 +3633,11 @@ def unload_sound(p_sound: Sound) -> None: # Unload sound ccode """UnloadSound(nn__p_sound)""" +@nativemacro +def unload_sound_alias(alias: Sound) -> None: + # Unload a sound alias (does not deallocate sample data) + ccode """UnloadSoundAlias(nn__alias)""" + @nativemacro def export_wave(p_wave: Wave, file_name: c.CStr) -> bool: # Export wave data to file, returns true on success @@ -3669,7 +3870,7 @@ def set_audio_stream_callback(stream: AudioStream, callback: Function[In[AnyPtr, @nativemacro def attach_audio_stream_processor(stream: AudioStream, processor: Function[In[AnyPtr,c.CUint],Out]) -> None: - # Attach audio stream processor to stream + # Attach audio stream processor to stream, receives the samples as s ccode """AttachAudioStreamProcessor(nn__stream, nn__processor)""" @nativemacro @@ -3679,7 +3880,7 @@ def detach_audio_stream_processor(stream: AudioStream, processor: Function[In[An @nativemacro def attach_audio_mixed_processor(processor: Function[In[AnyPtr,c.CUint],Out]) -> None: - # Attach audio stream processor to the entire audio pipeline + # Attach audio stream processor to the entire audio pipeline, receives the samples as s ccode """AttachAudioMixedProcessor(nn__processor)""" @nativemacro diff --git a/compiler/libs/raylib/gl.yaka b/compiler/libs/raylib/gl.yaka index 95a7b60b..e58e014a 100644 --- a/compiler/libs/raylib/gl.yaka +++ b/compiler/libs/raylib/gl.yaka @@ -13,6 +13,8 @@ RL_OPENGL_43: Const[int] = 4 # OpenGL 4.3 (using GLSL 330) RL_OPENGL_ES_20: Const[int] = 5 # OpenGL ES 2.0 (GLSL 100) +RL_OPENGL_ES_30: Const[int] = 6 +# OpenGL ES 3.0 (GLSL 300 es) RL_LOG_ALL: Const[int] = 0 # Display all logs RL_LOG_TRACE: Const[int] = 1 @@ -49,27 +51,33 @@ RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: Const[int] = 9 # 32*3 bpp (3 channels - float) RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: Const[int] = 10 # 32*4 bpp (4 channels - float) -RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int] = 11 +RL_PIXELFORMAT_UNCOMPRESSED_R16: Const[int] = 11 +# 16 bpp (1 channel - half float) +RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: Const[int] = 12 +# 16*3 bpp (3 channels - half float) +RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: Const[int] = 13 +# 16*4 bpp (4 channels - half float) +RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int] = 14 # 4 bpp (no alpha) -RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int] = 12 +RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int] = 15 # 4 bpp (1 bit alpha) -RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int] = 13 +RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int] = 16 # 8 bpp -RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int] = 14 +RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int] = 17 # 8 bpp -RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int] = 15 +RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int] = 18 # 4 bpp -RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int] = 16 +RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int] = 19 # 4 bpp -RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int] = 17 +RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int] = 20 # 8 bpp -RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int] = 18 +RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int] = 21 # 4 bpp -RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int] = 19 +RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int] = 22 # 4 bpp -RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int] = 20 +RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int] = 23 # 8 bpp -RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int] = 21 +RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int] = 24 # 2 bpp RL_TEXTURE_FILTER_POINT: Const[int] = 0 # No filter, just pixel approximation @@ -465,6 +473,11 @@ def rl_active_draw_buffers(count: int) -> None: # Activate multiple draw color buffers ccode """rlActiveDrawBuffers((int)nn__count)""" +@nativemacro +def rl_blit_framebuffer(src_x: int, src_y: int, src_width: int, src_height: int, dst_x: int, dst_y: int, dst_width: int, dst_height: int, buffer_mask: int) -> None: + # Blit active framebuffer to main framebuffer + ccode """rlBlitFramebuffer((int)nn__src_x, (int)nn__src_y, (int)nn__src_width, (int)nn__src_height, (int)nn__dst_x, (int)nn__dst_y, (int)nn__dst_width, (int)nn__dst_height, (int)nn__buffer_mask)""" + @nativemacro def rl_enable_color_blend() -> None: # Enable color blending @@ -530,9 +543,14 @@ def rl_enable_wire_mode() -> None: # Enable wire mode ccode """rlEnableWireMode()""" +@nativemacro +def rl_enable_point_mode() -> None: + # Enable point mode + ccode """rlEnablePointMode()""" + @nativemacro def rl_disable_wire_mode() -> None: - # Disable wire mode + # Disable wire mode ( and point ) maybe rename ccode """rlDisableWireMode()""" @nativemacro diff --git a/compiler/libs/raylib/gui.yaka b/compiler/libs/raylib/gui.yaka index 5508c25c..07b03c36 100644 --- a/compiler/libs/raylib/gui.yaka +++ b/compiler/libs/raylib/gui.yaka @@ -10,6 +10,12 @@ STATE_DISABLED: Const[int] = 3 TEXT_ALIGN_LEFT: Const[int] = 0 TEXT_ALIGN_CENTER: Const[int] = 1 TEXT_ALIGN_RIGHT: Const[int] = 2 +TEXT_ALIGN_TOP: Const[int] = 0 +TEXT_ALIGN_MIDDLE: Const[int] = 1 +TEXT_ALIGN_BOTTOM: Const[int] = 2 +TEXT_WRAP_NONE: Const[int] = 0 +TEXT_WRAP_CHAR: Const[int] = 1 +TEXT_WRAP_WORD: Const[int] = 2 DEFAULT: Const[int] = 0 LABEL: Const[int] = 1 # Used also for: LABELBUTTON @@ -17,7 +23,7 @@ BUTTON: Const[int] = 2 TOGGLE: Const[int] = 3 # Used also for: TOGGLEGROUP SLIDER: Const[int] = 4 -# Used also for: SLIDERBAR +# Used also for: SLIDERBAR, TOGGLESLIDER PROGRESSBAR: Const[int] = 5 CHECKBOX: Const[int] = 6 COMBOBOX: Const[int] = 7 @@ -32,21 +38,35 @@ COLORPICKER: Const[int] = 13 SCROLLBAR: Const[int] = 14 STATUSBAR: Const[int] = 15 BORDER_COLOR_NORMAL: Const[int] = 0 +# Control border color in STATE_NORMAL BASE_COLOR_NORMAL: Const[int] = 1 +# Control base color in STATE_NORMAL TEXT_COLOR_NORMAL: Const[int] = 2 +# Control text color in STATE_NORMAL BORDER_COLOR_FOCUSED: Const[int] = 3 +# Control border color in STATE_FOCUSED BASE_COLOR_FOCUSED: Const[int] = 4 +# Control base color in STATE_FOCUSED TEXT_COLOR_FOCUSED: Const[int] = 5 +# Control text color in STATE_FOCUSED BORDER_COLOR_PRESSED: Const[int] = 6 +# Control border color in STATE_PRESSED BASE_COLOR_PRESSED: Const[int] = 7 +# Control base color in STATE_PRESSED TEXT_COLOR_PRESSED: Const[int] = 8 +# Control text color in STATE_PRESSED BORDER_COLOR_DISABLED: Const[int] = 9 +# Control border color in STATE_DISABLED BASE_COLOR_DISABLED: Const[int] = 10 +# Control base color in STATE_DISABLED TEXT_COLOR_DISABLED: Const[int] = 11 +# Control text color in STATE_DISABLED BORDER_WIDTH: Const[int] = 12 +# Control border size, 0 for no border TEXT_PADDING: Const[int] = 13 +# Control text padding, not considering border TEXT_ALIGNMENT: Const[int] = 14 -RESERVED: Const[int] = 15 +# Control text horizontal alignment inside control text bound (after border and padding) TEXT_SIZE: Const[int] = 16 # Text size (glyphs max height) TEXT_SPACING: Const[int] = 17 @@ -55,6 +75,12 @@ LINE_COLOR: Const[int] = 18 # Line control color BACKGROUND_COLOR: Const[int] = 19 # Background color +TEXT_LINE_SPACING: Const[int] = 20 +# Text spacing between lines +TEXT_ALIGNMENT_VERTICAL: Const[int] = 21 +# Text vertical alignment inside text bounds (after border and padding) +TEXT_WRAP_MODE: Const[int] = 22 +# Text wrap-mode inside text bounds GROUP_PADDING: Const[int] = 16 # ToggleGroup separation between toggles SLIDER_WIDTH: Const[int] = 16 @@ -64,12 +90,17 @@ SLIDER_PADDING: Const[int] = 17 PROGRESS_PADDING: Const[int] = 16 # ProgressBar internal padding ARROWS_SIZE: Const[int] = 16 +# ScrollBar arrows size ARROWS_VISIBLE: Const[int] = 17 +# ScrollBar arrows visible SCROLL_SLIDER_PADDING: Const[int] = 18 -# (SLIDERBAR, SLIDER_PADDING) +# ScrollBar slider internal padding SCROLL_SLIDER_SIZE: Const[int] = 19 +# ScrollBar slider size SCROLL_PADDING: Const[int] = 20 +# ScrollBar scroll padding from arrows SCROLL_SPEED: Const[int] = 21 +# ScrollBar scrolling speed CHECK_PADDING: Const[int] = 16 # CheckBox internal check padding COMBO_BUTTON_WIDTH: Const[int] = 16 @@ -80,10 +111,8 @@ ARROW_PADDING: Const[int] = 16 # DropdownBox arrow separation from border and items DROPDOWN_ITEMS_SPACING: Const[int] = 17 # DropdownBox items separation -TEXT_INNER_PADDING: Const[int] = 16 -# TextBox/TextBoxMulti/ValueBox/Spinner inner text padding -TEXT_LINES_SPACING: Const[int] = 17 -# TextBoxMulti lines separation +TEXT_READONLY: Const[int] = 16 +# TextBox in read-only mode: 0-text editable, 1-text no-editable SPIN_BUTTON_WIDTH: Const[int] = 16 # Spinner left/right buttons width SPIN_BUTTON_SPACING: Const[int] = 17 @@ -95,7 +124,7 @@ LIST_ITEMS_SPACING: Const[int] = 17 SCROLLBAR_WIDTH: Const[int] = 18 # ListView scrollbar size (usually width) SCROLLBAR_SIDE: Const[int] = 19 -# ListView scrollbar side (0-left, 1-right) +# ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) COLOR_SELECTOR_SIZE: Const[int] = 16 HUEBAR_WIDTH: Const[int] = 17 # ColorPicker right hue bar width @@ -324,7 +353,7 @@ ICON_CASE_SENSITIVE: Const[int] = 215 ICON_REG_EXP: Const[int] = 216 ICON_FOLDER: Const[int] = 217 ICON_FILE: Const[int] = 218 -ICON_219: Const[int] = 219 +ICON_SAND_TIMER: Const[int] = 219 ICON_220: Const[int] = 220 ICON_221: Const[int] = 221 ICON_222: Const[int] = 222 @@ -363,15 +392,30 @@ ICON_254: Const[int] = 254 ICON_255: Const[int] = 255 @nativedefine("GuiStyleProp") struct GuiStyleProp: - # Style property + # NOTE: Used when exporting style as code for convenience controlId: c.CUShort propertyId: c.CUShort - propertyValue: c.CUInt + propertyValue: c.CInt @nativemacro -def gui_style_prop(control_id: int, property_id: int, property_value: u32) -> GuiStyleProp: +def gui_style_prop(control_id: int, property_id: int, property_value: int) -> GuiStyleProp: # Factory function for: GuiStyleProp - ccode """(GuiStyleProp){(unsigned short)nn__control_id, (unsigned short)nn__property_id, (unsigned int)nn__property_value}""" + ccode """(GuiStyleProp){(unsigned short)nn__control_id, (unsigned short)nn__property_id, (int)nn__property_value}""" + +@nativedefine("GuiTextStyle") +struct GuiTextStyle: + # NOTE: Text style is defined by control + size: c.CUInt + charSpacing: c.CInt + lineSpacing: c.CInt + alignmentH: c.CInt + alignmentV: c.CInt + padding: c.CInt + +@nativemacro +def gui_text_style(size: u32, char_spacing: int, line_spacing: int, alignment_h: int, alignment_v: int, padding: int) -> GuiTextStyle: + # Factory function for: GuiTextStyle + ccode """(GuiTextStyle){(unsigned int)nn__size, (int)nn__char_spacing, (int)nn__line_spacing, (int)nn__alignment_h, (int)nn__alignment_v, (int)nn__padding}""" @nativemacro def gui_enable() -> None: @@ -399,9 +443,9 @@ def gui_is_locked() -> bool: ccode """GuiIsLocked()""" @nativemacro -def gui_fade(alpha: float) -> None: +def gui_set_alpha(alpha: float) -> None: # Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f - ccode """GuiFade(nn__alpha)""" + ccode """GuiSetAlpha(nn__alpha)""" @nativemacro def gui_set_state(state: int) -> None: @@ -434,22 +478,72 @@ def gui_get_style(control: int, property: int) -> int: ccode """GuiGetStyle((int)nn__control, (int)nn__property)""" @nativemacro -def gui_window_box(bounds: rl.Rectangle, title: c.CStr) -> bool: +def gui_load_style(file_name: c.CStr) -> None: + # Load style file over global style variable (.rgs) + ccode """GuiLoadStyle(nn__file_name)""" + +@nativemacro +def gui_load_style_default() -> None: + # Load style default over global style + ccode """GuiLoadStyleDefault()""" + +@nativemacro +def gui_enable_tooltip() -> None: + # Enable gui tooltips (global state) + ccode """GuiEnableTooltip()""" + +@nativemacro +def gui_disable_tooltip() -> None: + # Disable gui tooltips (global state) + ccode """GuiDisableTooltip()""" + +@nativemacro +def gui_set_tooltip(tooltip: c.CStr) -> None: + # Set tooltip string + ccode """GuiSetTooltip(nn__tooltip)""" + +@nativemacro +def gui_icon_text(icon_id: int, text: c.CStr) -> c.CStr: + # Get text with icon id prepended (if supported) + ccode """GuiIconText((int)nn__icon_id, nn__text)""" + +@nativemacro +def gui_set_icon_scale(scale: int) -> None: + # Set default icon drawing size + ccode """GuiSetIconScale((int)nn__scale)""" + +@nativemacro +def gui_get_icons() -> Ptr[c.CUInt]: + # Get raygui icons data pointer + ccode """GuiGetIcons()""" + +@nativemacro +def gui_load_icons(file_name: c.CStr, load_icons_name: bool) -> Ptr[Ptr[c.CChar]]: + # Load raygui icons file (.rgi) into internal icons data + ccode """GuiLoadIcons(nn__file_name, nn__load_icons_name)""" + +@nativemacro +def gui_draw_icon(icon_id: int, pos_x: int, pos_y: int, pixel_size: int, p_color: rl.Color) -> None: + # Draw icon using pixel size at specified position + ccode """GuiDrawIcon((int)nn__icon_id, (int)nn__pos_x, (int)nn__pos_y, (int)nn__pixel_size, nn__p_color)""" + +@nativemacro +def gui_window_box(bounds: rl.Rectangle, title: c.CStr) -> int: # Window Box control, shows a window that can be closed ccode """GuiWindowBox(nn__bounds, nn__title)""" @nativemacro -def gui_group_box(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_group_box(bounds: rl.Rectangle, text: c.CStr) -> int: # Group Box control with text name ccode """GuiGroupBox(nn__bounds, nn__text)""" @nativemacro -def gui_line(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_line(bounds: rl.Rectangle, text: c.CStr) -> int: # Line separator control, could contain text ccode """GuiLine(nn__bounds, nn__text)""" @nativemacro -def gui_panel(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_panel(bounds: rl.Rectangle, text: c.CStr) -> int: # Panel control, useful to group controls ccode """GuiPanel(nn__bounds, nn__text)""" @@ -459,109 +553,99 @@ def gui_tab_bar(bounds: rl.Rectangle, text: Ptr[Ptr[Const[c.CChar]]], count: int ccode """GuiTabBar(nn__bounds, nn__text, (int)nn__count, nn__active)""" @nativemacro -def gui_scroll_panel(bounds: rl.Rectangle, text: c.CStr, content: rl.Rectangle, scroll: Ptr[rl.Vector2]) -> rl.Rectangle: +def gui_scroll_panel(bounds: rl.Rectangle, text: c.CStr, content: rl.Rectangle, scroll: Ptr[rl.Vector2], view: Ptr[rl.Rectangle]) -> int: # Scroll Panel control - ccode """GuiScrollPanel(nn__bounds, nn__text, nn__content, nn__scroll)""" + ccode """GuiScrollPanel(nn__bounds, nn__text, nn__content, nn__scroll, nn__view)""" @nativemacro -def gui_label(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_label(bounds: rl.Rectangle, text: c.CStr) -> int: # Label control, shows text ccode """GuiLabel(nn__bounds, nn__text)""" @nativemacro -def gui_button(bounds: rl.Rectangle, text: c.CStr) -> bool: +def gui_button(bounds: rl.Rectangle, text: c.CStr) -> int: # Button control, returns true when clicked ccode """GuiButton(nn__bounds, nn__text)""" @nativemacro -def gui_label_button(bounds: rl.Rectangle, text: c.CStr) -> bool: +def gui_label_button(bounds: rl.Rectangle, text: c.CStr) -> int: # Label button control, show true when clicked ccode """GuiLabelButton(nn__bounds, nn__text)""" @nativemacro -def gui_toggle(bounds: rl.Rectangle, text: c.CStr, active: bool) -> bool: - # Toggle Button control, returns true when active - ccode """GuiToggle(nn__bounds, nn__text, nn__active)""" - -@nativemacro -def gui_toggle_group(bounds: rl.Rectangle, text: c.CStr, active: int) -> int: +def gui_toggle_group(bounds: rl.Rectangle, text: c.CStr, active: Ptr[c.CInt]) -> int: # Toggle Group control, returns active toggle index - ccode """GuiToggleGroup(nn__bounds, nn__text, (int)nn__active)""" + ccode """GuiToggleGroup(nn__bounds, nn__text, nn__active)""" @nativemacro -def gui_check_box(bounds: rl.Rectangle, text: c.CStr, checked: bool) -> bool: - # Check Box control, returns true when active - ccode """GuiCheckBox(nn__bounds, nn__text, nn__checked)""" +def gui_toggle_slider(bounds: rl.Rectangle, text: c.CStr, active: Ptr[c.CInt]) -> int: + # Toggle Slider control, returns true when clicked + ccode """GuiToggleSlider(nn__bounds, nn__text, nn__active)""" @nativemacro -def gui_combo_box(bounds: rl.Rectangle, text: c.CStr, active: int) -> int: +def gui_combo_box(bounds: rl.Rectangle, text: c.CStr, active: Ptr[c.CInt]) -> int: # Combo Box control, returns selected item index - ccode """GuiComboBox(nn__bounds, nn__text, (int)nn__active)""" + ccode """GuiComboBox(nn__bounds, nn__text, nn__active)""" @nativemacro -def gui_dropdown_box(bounds: rl.Rectangle, text: c.CStr, active: Ptr[c.CInt], edit_mode: bool) -> bool: +def gui_dropdown_box(bounds: rl.Rectangle, text: c.CStr, active: Ptr[c.CInt], edit_mode: bool) -> int: # Dropdown Box control, returns selected item ccode """GuiDropdownBox(nn__bounds, nn__text, nn__active, nn__edit_mode)""" @nativemacro -def gui_spinner(bounds: rl.Rectangle, text: c.CStr, value: Ptr[c.CInt], min_value: int, max_value: int, edit_mode: bool) -> bool: +def gui_spinner(bounds: rl.Rectangle, text: c.CStr, value: Ptr[c.CInt], min_value: int, max_value: int, edit_mode: bool) -> int: # Spinner control, returns selected value ccode """GuiSpinner(nn__bounds, nn__text, nn__value, (int)nn__min_value, (int)nn__max_value, nn__edit_mode)""" @nativemacro -def gui_value_box(bounds: rl.Rectangle, text: c.CStr, value: Ptr[c.CInt], min_value: int, max_value: int, edit_mode: bool) -> bool: +def gui_value_box(bounds: rl.Rectangle, text: c.CStr, value: Ptr[c.CInt], min_value: int, max_value: int, edit_mode: bool) -> int: # Value Box control, updates input text with numbers ccode """GuiValueBox(nn__bounds, nn__text, nn__value, (int)nn__min_value, (int)nn__max_value, nn__edit_mode)""" @nativemacro -def gui_text_box(bounds: rl.Rectangle, text: c.CStr, text_size: int, edit_mode: bool) -> bool: +def gui_text_box(bounds: rl.Rectangle, text: c.CStr, text_size: int, edit_mode: bool) -> int: # Text Box control, updates input text ccode """GuiTextBox(nn__bounds, nn__text, (int)nn__text_size, nn__edit_mode)""" @nativemacro -def gui_text_box_multi(bounds: rl.Rectangle, text: c.CStr, text_size: int, edit_mode: bool) -> bool: - # Text Box control with multiple lines - ccode """GuiTextBoxMulti(nn__bounds, nn__text, (int)nn__text_size, nn__edit_mode)""" - -@nativemacro -def gui_slider(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: float, min_value: float, max_value: float) -> float: +def gui_slider(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: Ptr[float], min_value: float, max_value: float) -> int: # Slider control, returns selected value ccode """GuiSlider(nn__bounds, nn__text_left, nn__text_right, nn__value, nn__min_value, nn__max_value)""" @nativemacro -def gui_slider_bar(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: float, min_value: float, max_value: float) -> float: +def gui_slider_bar(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: Ptr[float], min_value: float, max_value: float) -> int: # Slider Bar control, returns selected value ccode """GuiSliderBar(nn__bounds, nn__text_left, nn__text_right, nn__value, nn__min_value, nn__max_value)""" @nativemacro -def gui_progress_bar(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: float, min_value: float, max_value: float) -> float: +def gui_progress_bar(bounds: rl.Rectangle, text_left: c.CStr, text_right: c.CStr, value: Ptr[float], min_value: float, max_value: float) -> int: # Progress Bar control, shows current progress value ccode """GuiProgressBar(nn__bounds, nn__text_left, nn__text_right, nn__value, nn__min_value, nn__max_value)""" @nativemacro -def gui_status_bar(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_status_bar(bounds: rl.Rectangle, text: c.CStr) -> int: # Status Bar control, shows info text ccode """GuiStatusBar(nn__bounds, nn__text)""" @nativemacro -def gui_dummy_rec(bounds: rl.Rectangle, text: c.CStr) -> None: +def gui_dummy_rec(bounds: rl.Rectangle, text: c.CStr) -> int: # Dummy control for placeholders ccode """GuiDummyRec(nn__bounds, nn__text)""" @nativemacro -def gui_grid(bounds: rl.Rectangle, text: c.CStr, spacing: float, subdivs: int) -> rl.Vector2: +def gui_grid(bounds: rl.Rectangle, text: c.CStr, spacing: float, subdivs: int, mouse_cell: Ptr[rl.Vector2]) -> int: # Grid control, returns mouse cell position - ccode """GuiGrid(nn__bounds, nn__text, nn__spacing, (int)nn__subdivs)""" + ccode """GuiGrid(nn__bounds, nn__text, nn__spacing, (int)nn__subdivs, nn__mouse_cell)""" @nativemacro -def gui_list_view(bounds: rl.Rectangle, text: c.CStr, scroll_index: Ptr[c.CInt], active: int) -> int: +def gui_list_view(bounds: rl.Rectangle, text: c.CStr, scroll_index: Ptr[c.CInt], active: Ptr[c.CInt]) -> int: # List View control, returns selected list item index - ccode """GuiListView(nn__bounds, nn__text, nn__scroll_index, (int)nn__active)""" + ccode """GuiListView(nn__bounds, nn__text, nn__scroll_index, nn__active)""" @nativemacro -def gui_list_view_ex(bounds: rl.Rectangle, text: Ptr[Ptr[Const[c.CChar]]], count: int, focus: Ptr[c.CInt], scroll_index: Ptr[c.CInt], active: int) -> int: +def gui_list_view_ex(bounds: rl.Rectangle, text: Ptr[Ptr[Const[c.CChar]]], count: int, scroll_index: Ptr[c.CInt], active: Ptr[c.CInt], focus: Ptr[c.CInt]) -> int: # List View with extended parameters - ccode """GuiListViewEx(nn__bounds, nn__text, (int)nn__count, nn__focus, nn__scroll_index, (int)nn__active)""" + ccode """GuiListViewEx(nn__bounds, nn__text, (int)nn__count, nn__scroll_index, nn__active, nn__focus)""" @nativemacro def gui_message_box(bounds: rl.Rectangle, title: c.CStr, message: c.CStr, buttons: c.CStr) -> int: @@ -569,76 +653,32 @@ def gui_message_box(bounds: rl.Rectangle, title: c.CStr, message: c.CStr, button ccode """GuiMessageBox(nn__bounds, nn__title, nn__message, nn__buttons)""" @nativemacro -def gui_text_input_box(bounds: rl.Rectangle, title: c.CStr, message: c.CStr, buttons: c.CStr, text: c.CStr, text_max_size: int, secret_view_active: Ptr[c.CInt]) -> int: - # Text Input Box control, ask for text, supports secret - ccode """GuiTextInputBox(nn__bounds, nn__title, nn__message, nn__buttons, nn__text, (int)nn__text_max_size, nn__secret_view_active)""" - -@nativemacro -def gui_color_picker(bounds: rl.Rectangle, text: c.CStr, p_color: rl.Color) -> rl.Color: +def gui_color_picker(bounds: rl.Rectangle, text: c.CStr, p_color: Ptr[rl.Color]) -> int: # Color Picker control (multiple color controls) ccode """GuiColorPicker(nn__bounds, nn__text, nn__p_color)""" @nativemacro -def gui_color_panel(bounds: rl.Rectangle, text: c.CStr, p_color: rl.Color) -> rl.Color: +def gui_color_panel(bounds: rl.Rectangle, text: c.CStr, p_color: Ptr[rl.Color]) -> int: # Color Panel control ccode """GuiColorPanel(nn__bounds, nn__text, nn__p_color)""" @nativemacro -def gui_color_bar_alpha(bounds: rl.Rectangle, text: c.CStr, alpha: float) -> float: +def gui_color_bar_alpha(bounds: rl.Rectangle, text: c.CStr, alpha: Ptr[float]) -> int: # Color Bar Alpha control ccode """GuiColorBarAlpha(nn__bounds, nn__text, nn__alpha)""" @nativemacro -def gui_color_bar_hue(bounds: rl.Rectangle, text: c.CStr, value: float) -> float: +def gui_color_bar_hue(bounds: rl.Rectangle, text: c.CStr, value: Ptr[float]) -> int: # Color Bar Hue control ccode """GuiColorBarHue(nn__bounds, nn__text, nn__value)""" @nativemacro -def gui_load_style(file_name: c.CStr) -> None: - # Load style file over global style variable (.rgs) - ccode """GuiLoadStyle(nn__file_name)""" - -@nativemacro -def gui_load_style_default() -> None: - # Load style default over global style - ccode """GuiLoadStyleDefault()""" - -@nativemacro -def gui_enable_tooltip() -> None: - # Enable gui tooltips (global state) - ccode """GuiEnableTooltip()""" - -@nativemacro -def gui_disable_tooltip() -> None: - # Disable gui tooltips (global state) - ccode """GuiDisableTooltip()""" - -@nativemacro -def gui_set_tooltip(tooltip: c.CStr) -> None: - # Set tooltip string - ccode """GuiSetTooltip(nn__tooltip)""" +def gui_color_picker_hsv(bounds: rl.Rectangle, text: c.CStr, color_hsv: Ptr[rl.Vector3]) -> int: + # Color Picker control that avoids conversion to RGB on each call (multiple color controls) + ccode """GuiColorPickerHSV(nn__bounds, nn__text, nn__color_hsv)""" @nativemacro -def gui_icon_text(icon_id: int, text: c.CStr) -> c.CStr: - # Get text with icon id prepended (if supported) - ccode """GuiIconText((int)nn__icon_id, nn__text)""" - -@nativemacro -def gui_get_icons() -> Ptr[c.CUInt]: - # Get raygui icons data pointer - ccode """GuiGetIcons()""" - -@nativemacro -def gui_load_icons(file_name: c.CStr, load_icons_name: bool) -> Ptr[Ptr[c.CChar]]: - # Load raygui icons file (.rgi) into internal icons data - ccode """GuiLoadIcons(nn__file_name, nn__load_icons_name)""" - -@nativemacro -def gui_draw_icon(icon_id: int, pos_x: int, pos_y: int, pixel_size: int, p_color: rl.Color) -> None: - ccode """GuiDrawIcon((int)nn__icon_id, (int)nn__pos_x, (int)nn__pos_y, (int)nn__pixel_size, nn__p_color)""" - -@nativemacro -def gui_set_icon_scale(scale: int) -> None: - # Set icon drawing size - ccode """GuiSetIconScale((int)nn__scale)""" +def gui_color_panel_hsv(bounds: rl.Rectangle, text: c.CStr, color_hsv: Ptr[rl.Vector3]) -> int: + # Color Panel control that returns HSV color value, used by GuiColorPickerHSV() + ccode """GuiColorPanelHSV(nn__bounds, nn__text, nn__color_hsv)""" diff --git a/compiler/libs/raylib/math.yaka b/compiler/libs/raylib/math.yaka index bf245b87..97c83f49 100644 --- a/compiler/libs/raylib/math.yaka +++ b/compiler/libs/raylib/math.yaka @@ -230,6 +230,14 @@ def vector3_divide(v1: rl.Vector3, v2: rl.Vector3) -> rl.Vector3: def vector3_normalize(v: rl.Vector3) -> rl.Vector3: ccode """Vector3Normalize(nn__v)""" +@nativemacro +def vector3_project(v1: rl.Vector3, v2: rl.Vector3) -> rl.Vector3: + ccode """Vector3Project(nn__v1, nn__v2)""" + +@nativemacro +def vector3_reject(v1: rl.Vector3, v2: rl.Vector3) -> rl.Vector3: + ccode """Vector3Reject(nn__v1, nn__v2)""" + @nativemacro def vector3_ortho_normalize(v1: Ptr[rl.Vector3], v2: Ptr[rl.Vector3]) -> None: ccode """Vector3OrthoNormalize(nn__v1, nn__v2)""" @@ -363,12 +371,12 @@ def matrix_frustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: ccode """MatrixFrustum(nn__left, nn__right, nn__bottom, nn__top, nn__near, nn__far)""" @nativemacro -def matrix_perspective(fovy: f64, aspect: f64, near: f64, far: f64) -> rl.Matrix: - ccode """MatrixPerspective(nn__fovy, nn__aspect, nn__near, nn__far)""" +def matrix_perspective(fov_y: f64, aspect: f64, near_plane: f64, far_plane: f64) -> rl.Matrix: + ccode """MatrixPerspective(nn__fov_y, nn__aspect, nn__near_plane, nn__far_plane)""" @nativemacro -def matrix_ortho(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) -> rl.Matrix: - ccode """MatrixOrtho(nn__left, nn__right, nn__bottom, nn__top, nn__near, nn__far)""" +def matrix_ortho(left: f64, right: f64, bottom: f64, top: f64, near_plane: f64, far_plane: f64) -> rl.Matrix: + ccode """MatrixOrtho(nn__left, nn__right, nn__bottom, nn__top, nn__near_plane, nn__far_plane)""" @nativemacro def matrix_look_at(eye: rl.Vector3, target: rl.Vector3, up: rl.Vector3) -> rl.Matrix: diff --git a/compiler/runtime/raygui b/compiler/runtime/raygui index 5d1de95b..25c8c65a 160000 --- a/compiler/runtime/raygui +++ b/compiler/runtime/raygui @@ -1 +1 @@ -Subproject commit 5d1de95ba2d16c44c4e777873a0e39f75dab8ffd +Subproject commit 25c8c65a6e5f0f4d4b564a0343861898c6f2778b diff --git a/compiler/runtime/raylib b/compiler/runtime/raylib index 17c443ee..ae50bfa2 160000 --- a/compiler/runtime/raylib +++ b/compiler/runtime/raylib @@ -1 +1 @@ -Subproject commit 17c443ee6db0a111d111e766bb517657204c3574 +Subproject commit ae50bfa2cc569c0f8d5bc4315d39db64005b1b08