窗口相关函数
Declare Sub InitWindow(ByVal Width As Integer, ByVal height As Integer, ByVal title As ZString Ptr)
初始化窗口和 OpenGL 上下文
Declare Sub CloseWindow()
关闭窗口并卸载 OpenGL 上下文
Declare Function WindowShouldClose() As Boolean
检查应用程序是否应关闭(按下 ESC 键或点击窗口关闭图标)
Declare Function IsWindowReady() As Boolean
检查窗口是否已成功初始化
Declare Function IsWindowFullscreen() As Boolean
' 检查窗口当前是否为全屏模式
Declare Function IsWindowHidden() As Boolean
' 检查窗口当前是否隐藏
Declare Function IsWindowMinimized() As Boolean
' 检查窗口当前是否最小化
Declare Function IsWindowMaximized() As Boolean
' 检查窗口当前是否最大化
Declare Function IsWindowFocused() As Boolean
' 检查窗口当前是否获得焦点
Declare Function IsWindowResized() As BOOLEAN
' 检查窗口在上一帧是否被调整大小
Declare Function IsWindowState(ByVal flag As UInteger) As BOOLEAN
' 检查是否启用了某个特定的窗口标志
Declare Sub SetWindowState(ByVal FLAGS As UInteger)
' 使用标志设置窗口配置状态
Declare Sub ClearWindowState(ByVal FLAGS As UInteger)
' 清除窗口配置状态标志
Declare Sub ToggleFullscreen()
' 切换窗口状态:全屏/窗口化,调整显示器以匹配窗口分辨率
Declare Sub ToggleBorderlessWindowed()
' 切换窗口状态:无边框窗口化,调整窗口以匹配显示器分辨率
Declare Sub MaximizeWindow()
' 设置窗口状态为最大化(如果窗口可调整大小)
Declare Sub MinimizeWindow()
' 设置窗口状态为最小化(如果窗口可调整大小)
Declare Sub RestoreWindow()
' 设置窗口状态为非最小化/非最大化
Declare Sub SetWindowIcon(ByVal image As Image)
' 设置窗口图标(单张图像,RGBA 32 位)
Declare Sub SetWindowIcons(ByVal images As Image Ptr, ByVal count As Integer)
' 设置窗口图标(多张图像,RGBA 32 位)
Declare Sub SetWindowTitle(ByVal title As ZString Ptr)
' 设置窗口标题
Declare Sub SetWindowPosition(ByVal x As Integer, ByVal y As Integer)
' 设置窗口在屏幕上的位置
Declare Sub SetWindowMonitor(ByVal monitor As Integer)
' 设置当前窗口所在的显示器
Declare Sub SetWindowMinSize(ByVal width As Integer, ByVal height As Integer)
' 设置窗口的最小尺寸(适用于可调整大小的窗口)
Declare Sub SetWindowMaxSize(ByVal width As Integer, ByVal height As Integer)
' 设置窗口的最大尺寸(适用于可调整大小的窗口)
Declare Sub SetWindowSize(ByVal width As Integer, ByVal height As Integer)
' 设置窗口尺寸
Declare Sub SetWindowOpacity(ByVal opacity As Single)
' 设置窗口透明度 [0.0f..1.0f]
Declare Sub SetWindowFocused()
' 设置窗口获得焦点
Declare Function GetWindowHandle() As hWnd
' 获取原生窗口句柄
Declare Function GetScreenWidth() As Integer
' 获取当前屏幕宽度
Declare Function GetScreenHeight() As Integer
' 获取当前屏幕高度
Declare Function GetRenderWidth() As Integer
' 获取当前渲染宽度(考虑 HiDPI)
Declare Function GetRenderHeight() As Integer
' 获取当前渲染高度(考虑 HiDPI)
Declare Function GetMonitorCount() As Integer
' 获取连接的显示器数量
Declare Function GetCurrentMonitor() As Integer
' 获取窗口所在的当前显示器
Declare Function GetMonitorPosition(ByVal monitor As Integer) As Vector2
' 获取指定显示器的位置
Declare Function GetMonitorWidth(ByVal monitor As Integer) As Integer
' 获取指定显示器的宽度(显示器当前使用的视频模式)
Declare Function GetMonitorHeight(ByVal monitor As Integer) As Integer
' 获取指定显示器的高度(显示器当前使用的视频模式)
Declare Function GetMonitorPhysicalWidth(ByVal monitor As Integer) As Integer
' 获取指定显示器的物理宽度(以毫米为单位)
Declare Function GetMonitorPhysicalHeight(ByVal monitor As Integer) As Integer
' 获取指定显示器的物理高度(以毫米为单位)
Declare Function GetMonitorRefreshRate(ByVal monitor As Integer) As Integer
' 获取指定显示器的刷新率
Declare Function GetWindowPosition() As Vector2
' 获取窗口在显示器上的 XY 位置
Declare Function GetWindowScaleDPI() As Vector2
' 获取窗口的缩放 DPI 因子
Declare Function GetMonitorName(ByVal monitor As Integer) As ZString Ptr
' 获取指定显示器的可读 UTF - 8 编码名称
Declare Sub SetClipboardText(ByVal text As ZString Ptr)
' 设置剪贴板的文本内容
Declare Function GetClipboardText() As ZString Ptr
' 获取剪贴板的文本内容
Declare Function GetClipboardImage() As Image
' 获取剪贴板的图像内容
Declare Sub EnableEventWaiting()
' 启用在 EndDrawing() 时等待事件,不进行自动事件轮询
Declare Sub DisableEventWaiting()
' 禁用在 EndDrawing() 时等待事件,进行自动事件轮询
光标相关函数
Declare Sub ShowCursor()
显示光标
Declare Sub HideCursor()
隐藏光标
Declare Function IsCursorHidden() As Boolean
检查光标是否不可见
Declare Sub EnableCursor()
启用光标(解锁光标)
Declare Sub DisableCursor()
禁用光标(锁定光标)
Declare Function IsCursorOnScreen() As BOOLEAN
检查光标是否在屏幕上
绘图相关函数
Declare Sub ClearBackground(ByVal Color As Color) 设置背景颜色(帧缓冲区清除颜色)
Declare Sub BeginDrawing() 设置画布(帧缓冲区)以开始绘图
Declare Sub EndDrawing() 结束画布绘图并交换缓冲区(双缓冲)
Declare Sub BeginMode2D(ByVal camera As Camera2D) 使用自定义相机开始 2D 模式绘图
Declare Sub EndMode2D() 结束自定义相机的 2D 模式绘图
Declare Sub BeginMode3D(ByVal camera As Camera3D) 使用自定义相机开始 3D 模式绘图
Declare Sub EndMode3D() 结束 3D 模式绘图并返回默认的 2D 正交模式
Declare Sub BeginTextureMode(ByVal target As RenderTexture2D) 开始向渲染纹理绘图
Declare Sub EndTextureMode() 结束向渲染纹理绘图
Declare Sub BeginShaderMode(ByVal shader As Shader) 开始使用自定义着色器绘图
Declare Sub EndShaderMode() 结束自定义着色器绘图(使用默认着色器)
Declare Sub BeginBlendMode(ByVal mode As Integer)' 开始混合模式(alpha、加法、乘法、减法、自定义)
Declare Sub EndBlendMode()' 结束混合模式(重置为默认:alpha 混合)
Declare Sub BeginScissorMode(ByVal x As Integer, ByVal y As Integer, ByVal Width As Integer, ByVal height As Integer)' 开始剪刀模式(定义后续绘图的屏幕区域)
Declare Sub EndScissorMode() 结束剪刀模式
着色器管理函数
Declare Function LoadShader(ByVal vsFileName As ZString Ptr, ByVal fsFileName As ZString Ptr) As Shader' 从文件加载着色器并绑定默认位置
Declare Function LoadShaderFromMemory(ByVal vsCode As ZString Ptr, ByVal fsCode As ZString Ptr) As Shader' 从代码字符串加载着色器并绑定默认位置
Declare Function IsShaderValid(ByVal shader As Shader) As Boolean' 检查着色器是否有效(已加载到 GPU)
Declare Function GetShaderLocation(ByVal shader As Shader, ByVal uniformName As ZString Ptr) As Integer' 获取着色器统一变量的位置
Declare Function GetShaderLocationAttrib(ByVal shader As Shader, ByVal attribName As ZString Ptr) As Integer' 获取着色器属性的位置
Declare Sub SetShaderValue(ByVal shader As Shader, ByVal locIndex As Integer, ByVal value As Any Ptr, ByVal uniformType As Integer)' 设置着色器统一变量的值
Declare Sub SetShaderValueV(ByVal shader As Shader, ByVal locIndex As Integer, ByVal value As Any Ptr, ByVal uniformType As Integer, ByVal count As Integer)' 设置着色器统一变量的值向量
Declare Sub SetShaderValueMatrix(ByVal shader As Shader, ByVal locIndex As Integer, ByVal mat As Matrix)' 设置着色器统一变量的值(4x4 矩阵)
Declare Sub SetShaderValueTexture(ByVal shader As Shader, ByVal locIndex As Integer, ByVal texture As Texture2D)' 设置着色器统一变量的值并绑定纹理(采样器 2D)
Declare Sub UnloadShader(ByVal shader As Shader)' 从 GPU 内存(VRAM)卸载着色器
屏幕空间相关函数
Declare Function GetScreenToWorldRay(ByVal position As Vector2, ByVal camera As Camera) As Ray 从屏幕位置(如鼠标位置)获取一条射线(用于射线追踪)
Declare Function GetScreenToWorldRayEx(ByVal position As Vector2, ByVal camera As Camera, ByVal Width As Integer, ByVal height As Integer) As Ray 在视口内从屏幕位置(如鼠标位置)获取一条射线(用于射线追踪)
Declare Function GetWorldToScreen(ByVal position As Vector3, ByVal camera As Camera) As Vector2 获取 3D 世界空间位置对应的屏幕空间位置
Declare Function GetWorldToScreenEx(ByVal position As Vector3, ByVal camera As Camera, ByVal Width As Integer, ByVal height As Integer) As Vector2 获取 3D 世界空间位置对应的屏幕尺寸位置
Declare Function GetWorldToScreen2D(ByVal position As Vector2, ByVal camera As Camera2D) As Vector2 获取 2D 相机世界空间位置对应的屏幕空间位置
Declare Function GetScreenToWorld2D(ByVal position As Vector2, ByVal camera As Camera2D) As Vector2 获取 2D 相机屏幕空间位置对应的世界空间位置
Declare Function GetCameraMatrix(ByVal camera As Camera) As Matrix 获取相机的变换矩阵(视图矩阵)
Declare Function GetCameraMatrix2D(ByVal camera As Camera2D) As Matrix 获取 2D 相机的变换矩阵
时间相关函数
Declare Sub SetTargetFPS(ByVal fps As Integer) 设置目标帧率(最大值)
Declare Function GetFrameTime() As Single 获取上一帧绘制所用的时间(以秒为单位,即 delta 时间)
Declare Function GetTime() As Double 获取自 InitWindow() 调用以来经过的时间(以秒为单位)
Declare Function GetFPS() As Integer 获取当前帧率
自定义帧控制函数
' 注意:这些函数供希望完全控制帧处理的高级用户使用
' 默认情况下,EndDrawing() 完成以下工作:绘制所有内容 + 交换屏幕缓冲区 + 管理帧计时 + 轮询输入事件
' 若要避免该默认行为并手动控制帧处理过程,请在 config.h 中启用:SUPPORT_CUSTOM_FRAME_CONTROL
Declare Sub SwapScreenBuffer()' 交换后缓冲区和前缓冲区(用于屏幕绘制)
Declare Sub PollInputEvents()' 注册所有输入事件
Declare Sub WaitTime(ByVal seconds As Double)' 等待一段时间(暂停程序执行)
随机值生成函数
Declare Sub SetRandomSeed(ByVal seed As UInteger)' 设置随机数生成器的种子
Declare Function GetRandomValue(ByVal min As Integer, ByVal max As Integer) As Integer' 获取一个介于 min 和 max 之间(包含两者)的随机值
Declare Function LoadRandomSequence(ByVal count As UInteger, ByVal min As Integer, ByVal max As Integer) As Integer Ptr' 加载随机值序列,序列中无重复值
Declare Sub UnloadRandomSequence(ByVal sequence As Integer Ptr)' 卸载随机值序列
杂项函数
Declare Sub TakeScreenshot(ByVal fileName As ZString Ptr)' 对当前屏幕进行截图(文件名扩展名决定文件格式)
Declare Sub SetConfigFlags(ByVal FLAGS As UInteger)' 设置初始化配置标志(查看 FLAGS)
Declare Sub OpenUrl(ByVal url As ZString Ptr)' 使用系统默认浏览器打开 URL(若可用)
Declare Sub TraceLog(ByVal logLevel As Integer, ByVal text As ZString Ptr, ...)' 显示跟踪日志消息(如 LOG_DEBUG、LOG_INFO、LOG_WARNING、LOG_ERROR 等)
Declare Sub SetTraceLogLevel(ByVal logLevel As Integer)' 设置当前的日志级别阈值(最低级别)
Declare Function MemAlloc(ByVal SIZE As UInteger) As Any Ptr' 内部内存分配器
Declare Function MemRealloc(ByVal Ptr As Any Ptr, ByVal SIZE As UInteger) As Any Ptr' 内部内存重新分配器
Declare Sub MemFree(ByVal Ptr As Any Ptr) ' 内部内存释放函数
设置自定义回调函数
' 警告:回调函数的设置适用于高级用户
Declare Sub SetTraceLogCallback(ByVal callback As TraceLogCallback)' 设置自定义跟踪日志回调函数
Declare Sub SetLoadFileDataCallback(ByVal callback As LoadFileDataCallback)' 设置自定义文件二进制数据加载回调函数
Declare Sub SetSaveFileDataCallback(ByVal callback As SaveFileDataCallback)' 设置自定义文件二进制数据保存回调函数
Declare Sub SetLoadFileTextCallback(ByVal callback As LoadFileTextCallback)' 设置自定义文件文本数据加载回调函数
Declare Sub SetSaveFileTextCallback(ByVal callback As SaveFileTextCallback)' 设置自定义文件文本数据保存回调函数
文件管理函数
Declare Function LoadFileData(ByVal fileName As ZString Ptr, ByVal dataSize As Integer) As UByte Ptr' 将文件数据作为字节数组加载(读取)
Declare Sub UnloadFileData(ByVal Data As UByte Ptr) 卸载由 LoadFileData() 分配的文件数据
Declare Function SaveFileData(ByVal fileName As ZString Ptr, ByVal Data As Any Ptr, ByVal dataSize As Integer) As Boolean' 将字节数组中的数据保存到文件(写入),成功返回 True
Declare Function ExportDataAsCode(ByVal data As UByte Ptr, ByVal dataSize As Integer, ByVal fileName As ZString Ptr) As Boolean' 将数据导出为代码文件(.h),成功返回 True
Declare Function LoadFileText(ByVal fileName As ZString Ptr) As ZString Ptr' 从文件加载文本数据(读取),返回以 '\0' 结尾的字符串
Declare Sub UnloadFileText(ByVal text As ZString Ptr)' 卸载由 LoadFileText() 分配的文件文本数据
Declare Function SaveFileText(ByVal fileName As ZString Ptr, ByVal text As ZString Ptr) As BOOLEAN' 将文本数据保存到文件(写入),字符串必须以 '\0' 结尾,成功返回 True
文件系统函数
Declare Function FileExists(ByVal fileName As ZString Ptr) As Boolean' 检查文件是否存在
Declare Function DirectoryExists(ByVal dirPath As ZString Ptr) As Boolean' 检查目录路径是否存在
Declare Function IsFileExtension(ByVal fileName As ZString Ptr, ByVal ext As ZString Ptr) As Boolean' 检查文件扩展名(包含点:.png, .wav)
Declare Function GetFileLength(ByVal fileName As ZString Ptr) As Integer' 获取文件的字节长度(注意:GetFileSize() 与 windows.h 冲突)
Declare Function GetFileExtension(ByVal fileName As ZString Ptr) As ZString Ptr' 获取文件名中扩展名的指针(包含点:'.png')
Declare Function GetFileName(ByVal filePath As ZString Ptr) As ZString Ptr' 获取路径字符串中文件名的指针
Declare Function GetFileNameWithoutExt(ByVal filePath As ZString Ptr) As ZString Ptr' 获取不带扩展名的文件名(使用静态字符串)
Declare Function GetDirectoryPath(ByVal filePath As ZString Ptr) As ZString Ptr' 获取给定带路径文件名的完整路径(使用静态字符串)
Declare Function GetPrevDirectoryPath(ByVal dirPath As ZString Ptr) As ZString Ptr' 获取给定路径的上一级目录路径(使用静态字符串)
Declare Function GetWorkingDirectory() As ZString Ptr' 获取当前工作目录(使用静态字符串)
Declare Function GetApplicationDirectory() As ZString Ptr' 获取正在运行的应用程序的目录(使用静态字符串)
Declare Function MakeDirectory(ByVal dirPath As ZString Ptr) As Integer ' 创建目录(包括请求的完整路径),成功返回 0
Declare Function ChangeDirectory(ByVal Dir As ZString Ptr) As BOOLEAN ' 更改工作目录,成功返回 True
Declare Function IsPathFile(ByVal path As ZString Ptr) As BOOLEAN ' 检查给定路径是文件还是目录
Declare Function IsFileNameValid(ByVal fileName As ZString Ptr) As Boolean ' 检查文件名在当前平台/操作系统下是否有效
Declare Function LoadDirectoryFiles(ByVal dirPath As ZString Ptr) As FilePathList ' 加载目录中的文件路径
Declare Function LoadDirectoryFilesEx(ByVal basePath As ZString Ptr, ByVal filter As ZString Ptr, ByVal scanSubdirs As Boolean) As FilePathList' 加载目录中的文件路径,并进行扩展名过滤和递归目录扫描。在过滤字符串中使用 'DIR' 可将目录包含在结果中
Declare Sub UnloadDirectoryFiles(ByVal files As FilePathList)' 卸载文件路径
Declare Function IsFileDropped() As BOOLEAN ' 检查是否有文件被拖放到窗口中
Declare Function LoadDroppedFiles() As FilePathList ' 加载被拖放的文件路径
Declare Sub UnloadDroppedFiles(ByVal files As FilePathList)' 卸载被拖放的文件路径
Declare Function GetFileModTime(ByVal fileName As ZString Ptr) As Long' 获取文件的修改时间(最后写入时间)
压缩/编码功能
Declare Function CompressData(ByVal Data As UByte Ptr, ByVal dataSize As Integer, ByVal compDataSize As Integer) As UByte Ptr' 压缩数据(使用 DEFLATE 算法),返回的内存需使用 MemFree() 释放
Declare Function DecompressData(ByVal compData As UByte Ptr, ByVal compDataSize As Integer, ByVal dataSize As Integer) As UByte Ptr' 解压缩数据(使用 DEFLATE 算法),返回的内存需使用 MemFree() 释放
Declare Function EncodeDataBase64(ByVal Data As UByte Ptr, ByVal dataSize As Integer, ByVal outputSize As Integer) As ZString Ptr' 将数据编码为 Base64 字符串,返回的内存需使用 MemFree() 释放
Declare Function DecodeDataBase64(ByVal Data As UByte Ptr, ByVal outputSize As Integer) As UByte Ptr' 解码 Base64 字符串数据,返回的内存需使用 MemFree() 释放
Declare Function ComputeCRC32(ByVal data As UByte Ptr, ByVal dataSize As Integer) As UInteger' 计算 CRC32 哈希码
Declare Function ComputeMD5(ByVal Data As UByte Ptr, ByVal dataSize As Integer) As UInteger Ptr' 计算 MD5 哈希码,返回静态 int[4](16 字节)
Declare Function ComputeSHA1(ByVal Data As UByte Ptr, ByVal dataSize As Integer) As UInteger Ptr' 计算 SHA1 哈希码,返回静态 int[5](20 字节)
自动化事件功能
Declare Function LoadAutomationEventList(ByVal fileName As ZString Ptr) As AutomationEventList' 从文件加载自动化事件列表,若文件名为 NULL 则返回空列表,容量为 MAX_AUTOMATION_EVENTS
Declare Sub UnloadAutomationEventList(ByVal list As AutomationEventList)' 从文件卸载自动化事件列表
Declare Function ExportAutomationEventList(ByVal list As AutomationEventList, ByVal fileName As ZString Ptr) As BOOLEAN' 将自动化事件列表导出为文本文件
Declare Sub SetAutomationEventList(ByVal list As AutomationEventList Ptr)' 设置要记录到的自动化事件列表
Declare Sub SetAutomationEventBaseFrame(ByVal frame As Integer)' 设置自动化事件内部的基础帧,用于开始记录
Declare Sub StartAutomationEventRecording()' 开始记录自动化事件(必须先设置 AutomationEventList)
Declare Sub StopAutomationEventRecording()' 停止记录自动化事件
Declare Sub PlayAutomationEvent(ByVal Event As AutomationEvent)' 播放已记录的自动化事件
输入相关函数: 键盘
Declare Function IsKeyPressed(ByVal key As Integer) As Boolean' 检查某个键是否被按下一次
Declare Function IsKeyPressedRepeat(ByVal key As Integer) As BOOLEAN' 检查某个键是否再次被按下
Declare Function IsKeyDown(ByVal key As Integer) As BOOLEAN' 检查某个键是否正在被按下
Declare Function IsKeyReleased(ByVal key As Integer) As BOOLEAN' 检查某个键是否被释放一次
Declare Function IsKeyUp(ByVal key As Integer) As Boolean' 检查某个键是否未被按下
Declare Function GetKeyPressed() As Integer' 获取被按下的键(键码),多次调用以处理排队的按键,队列为空时返回 0
Declare Function GetCharPressed() As Integer' 获取被按下的字符(Unicode),多次调用以处理排队的字符,队列为空时返回 0
Declare Function GetKeyName(ByVal key As Integer) As ZString Ptr' 获取当前键盘布局下 QWERTY 键的名称(例如在 AZERTY 键盘上,对于 KEY_A 返回字符串 'q')
Declare Sub SetExitKey(ByVal key As Integer)' 设置用于退出程序的自定义键(默认是 ESC)
输入相关函数: 游戏手柄
Declare Function IsGamepadAvailable(ByVal gamepad As Integer) As BOOLEAN' 检查某个游戏手柄是否可用
Declare Function GetGamepadName(ByVal gamepad As Integer) As ZString Ptr' 获取游戏手柄的内部名称标识
Declare Function IsGamepadButtonPressed(ByVal gamepad As Integer, ByVal button As Integer) As Boolean' 检查游戏手柄的某个按钮是否被按下一次
Declare Function IsGamepadButtonDown(ByVal gamepad As Integer, ByVal button As Integer) As Boolean' 检查游戏手柄的某个按钮是否正在被按下
Declare Function IsGamepadButtonReleased(ByVal gamepad As Integer, ByVal button As Integer) As Boolean' 检查游戏手柄的某个按钮是否被释放一次
Declare Function IsGamepadButtonUp(ByVal gamepad As Integer, ByVal button As Integer) As Boolean' 检查游戏手柄的某个按钮是否未被按下
Declare Function GetGamepadButtonPressed() As Integer' 获取最后按下的游戏手柄按钮
Declare Function GetGamepadAxisCount(ByVal gamepad As Integer) As Integer' 获取某个游戏手柄的轴数量
Declare Function GetGamepadAxisMovement(ByVal gamepad As Integer, ByVal axis As Integer) As Single' 获取游戏手柄某个轴的移动值
Declare Function SetGamepadMappings(ByVal mappings As ZString Ptr) As Integer' 设置内部游戏手柄映射(SDL_GameControllerDB)
Declare Sub SetGamepadVibration(ByVal gamepad As Integer, ByVal leftMotor As Single, ByVal rightMotor As Single, ByVal duration As Single)' 设置游戏手柄两个电机的振动(持续时间以秒为单位)
输入相关函数: 鼠标
Declare Function IsMouseButtonPressed(ByVal button As Integer) As BOOLEAN' 检查鼠标按钮是否被按下一次
Declare Function IsMouseButtonDown(ByVal button As Integer) As BOOLEAN' 检查鼠标按钮是否正在被按下
Declare Function IsMouseButtonReleased(ByVal button As Integer) As Boolean' 检查鼠标按钮是否被释放一次
Declare Function IsMouseButtonUp(ByVal button As Integer) As BOOLEAN' 检查鼠标按钮是否未被按下
Declare Function GetMouseX() As Integer' 获取鼠标的 X 坐标位置
Declare Function GetMouseY() As Integer ' 获取鼠标的 Y 坐标位置
Declare Function GetMousePosition() As Vector2' 获取鼠标的 XY 坐标位置
Declare Function GetMouseDelta() As Vector2' 获取帧与帧之间鼠标的位移
Declare Sub SetMousePosition(ByVal x As Integer, ByVal y As Integer)' 设置鼠标的 XY 坐标位置
Declare Sub SetMouseOffset(ByVal offsetX As Integer, ByVal offsetY As Integer)' 设置鼠标的偏移量
Declare Sub SetMouseScale(ByVal scaleX As Single, ByVal scaleY As Single)' 设置鼠标的缩放比例
Declare Function GetMouseWheelMove() As Single' 获取鼠标滚轮在 X 或 Y 方向上的移动量(取较大值)
Declare Function GetMouseWheelMoveV() As Vector2' 获取鼠标滚轮在 X 和 Y 方向上的移动量
Declare Sub SetMouseCursor(ByVal cursor As Integer)' 设置鼠标光标样式
输入相关函数: 触摸
Declare Function GetTouchX() As Integer' 获取触摸点 0 的 X 坐标位置(相对于屏幕尺寸)
Declare Function GetTouchY() As Integer' 获取触摸点 0 的 Y 坐标位置(相对于屏幕尺寸)
Declare Function GetTouchPosition(ByVal index As Integer) As Vector2' 获取指定索引触摸点的 XY 坐标位置(相对于屏幕尺寸)
Declare Function GetTouchPointId(ByVal index As Integer) As Integer ' 获取指定索引触摸点的标识符
Declare Function GetTouchPointCount() As Integer' 获取触摸点的数量
手势和触摸处理函数 (模块: rgestures)
Declare Sub SetGesturesEnabled(ByVal FLAGS As UInteger)' 使用标志启用一组手势
Declare Function IsGestureDetected(ByVal gesture As UInteger) As Boolean' 检查是否检测到某个手势
Declare Function GetGestureDetected() As Integer' 获取最新检测到的手势
Declare Function GetGestureHoldDuration() As Single' 获取手势保持的时间(以秒为单位)
Declare Function GetGestureDragVector() As Vector2' 获取手势拖动向量
Declare Function GetGestureDragAngle() As Single' 获取手势拖动角度
Declare Function GetGesturePinchVector() As Vector2' 获取手势捏合的增量
Declare Function GetGesturePinchAngle() As Single' 获取手势捏合角度
相机系统函数 (模块: rcamera)
Declare Sub UpdateCamera(ByVal camera As Camera Ptr, ByVal mode As Integer)' 为选定模式更新相机位置
Declare Sub UpdateCameraPro(ByVal camera As Camera Ptr, ByVal movement As Vector3, ByVal rotation As Vector3, ByVal zoom As Single)' 更新相机的移动/旋转
基本形状绘制函数 (模块: shapes)
' 设置用于形状绘制的纹理和矩形
' 注意: 当使用基本形状和单个字体时可能很有用,
' 定义字体字符的白色矩形可以在一次绘制调用中绘制所有内容
Declare Sub SetShapesTexture(ByVal texture As Texture2D, ByVal source As Rectangle)' 设置用于形状绘制的纹理和矩形
Declare Function GetShapesTexture() As Texture2D' 获取用于形状绘制的纹理
Declare Function GetShapesTextureRectangle() As Rectangle' 获取用于形状绘制的纹理源矩形
Declare Sub DrawPixel(ByVal posX As Integer, ByVal posY As Integer, ByVal Color As Color)' 用几何方式绘制一个像素 [可能较慢,谨慎使用]
Declare Sub DrawPixelV(ByVal position As Vector2, ByVal Color As Color)' 用几何方式绘制一个像素(向量版本) [可能较慢,谨慎使用]
Declare Sub DrawLine(ByVal startPosX As Integer, ByVal startPosY As Integer, ByVal endPosX As Integer, ByVal endPosY As Integer, ByVal Color As Color)' 绘制一条直线
Declare Sub DrawLineV(ByVal startPos As Vector2, ByVal endPos As Vector2, ByVal color As Color)' 绘制一条直线(使用 OpenGL 直线)
Declare Sub DrawLineEx(ByVal startPos As Vector2, ByVal endPos As Vector2, ByVal thick As Single, ByVal color As Color)' 绘制一条直线(使用三角形/四边形)
Declare Sub DrawLineStrip(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal color As Color)' 绘制直线序列(使用 OpenGL 直线)
Declare Sub DrawLineBezier(ByVal startPos As Vector2, ByVal endPos As Vector2, ByVal thick As Single, ByVal color As Color)' 绘制线段的三次贝塞尔进出插值曲线
Declare Sub DrawCircle(ByVal centerX As Integer, ByVal centerY As Integer, ByVal radius As Single, ByVal Color As Color) ' 绘制一个填充颜色的圆
Declare Sub DrawCircleSector(ByVal center As Vector2, ByVal radius As Single, ByVal startAngle As Single, ByVal endAngle As Single, ByVal segments As Integer, ByVal color As Color)' 绘制圆的一部分
Declare Sub DrawCircleSectorLines(ByVal center As Vector2, ByVal radius As Single, ByVal startAngle As Single, ByVal endAngle As Single, ByVal segments As Integer, ByVal color As Color)' 绘制圆扇区的轮廓
Declare Sub DrawCircleGradient(ByVal centerX As Integer, ByVal centerY As Integer, ByVal radius As Single, ByVal inner As Color, ByVal outer As Color)' 绘制一个填充渐变颜色的圆
Declare Sub DrawCircleV(ByVal center As Vector2, ByVal radius As Single, ByVal color As Color)' 绘制一个填充颜色的圆(向量版本)
Declare Sub DrawCircleLines(ByVal centerX As Integer, ByVal centerY As Integer, ByVal radius As Single, ByVal color As Color)' 绘制圆的轮廓
Declare Sub DrawCircleLinesV(ByVal center As Vector2, ByVal radius As Single, ByVal color As Color)' 绘制圆的轮廓(向量版本)
Declare Sub DrawEllipse(ByVal centerX As Integer, ByVal centerY As Integer, ByVal radiusH As Single, ByVal radiusV As Single, ByVal color As Color)' 绘制椭圆
Declare Sub DrawEllipseLines(ByVal centerX As Integer, ByVal centerY As Integer, ByVal radiusH As Single, ByVal radiusV As Single, ByVal color As Color)' 绘制椭圆的轮廓
Declare Sub DrawRing(ByVal center As Vector2, ByVal innerRadius As Single, ByVal outerRadius As Single, ByVal startAngle As Single, ByVal endAngle As Single, ByVal segments As Integer, ByVal color As Color)' 绘制圆环
Declare Sub DrawRingLines(ByVal center As Vector2, ByVal innerRadius As Single, ByVal outerRadius As Single, ByVal startAngle As Single, ByVal endAngle As Single, ByVal segments As Integer, ByVal color As Color)' 绘制圆环的轮廓
Declare Sub DrawRectangle(ByVal posX As Integer, ByVal posY As Integer, ByVal width As Integer, ByVal height As Integer, ByVal color As Color) ' 绘制一个填充颜色的矩形
Declare Sub DrawRectangleV(ByVal position As Vector2, ByVal size As Vector2, ByVal color As Color)' 绘制一个填充颜色的矩形(向量版本)
Declare Sub DrawRectangleRec(ByVal rec As Rectangle, ByVal color As Color)' 绘制一个填充颜色的矩形
Declare Sub DrawRectanglePro(ByVal rec As Rectangle, ByVal origin As Vector2, ByVal rotation As Single, ByVal Color As Color)' 用专业参数绘制一个填充颜色的矩形
Declare Sub DrawRectangleGradientV(ByVal posX As Integer, ByVal posY As Integer, ByVal width As Integer, ByVal height As Integer, ByVal top As Color, ByVal bottom As Color)' 绘制一个垂直渐变填充的矩形
Declare Sub DrawRectangleGradientH(ByVal posX As Integer, ByVal posY As Integer, ByVal width As Integer, ByVal height As Integer, ByVal left As Color, ByVal right As Color)' 绘制一个水平渐变填充的矩形
Declare Sub DrawRectangleGradientEx(ByVal rec As Rectangle, ByVal topLeft As Color, ByVal bottomLeft As Color, ByVal topRight As Color, ByVal bottomRight As Color)' 用自定义顶点颜色绘制一个渐变填充的矩形
Declare Sub DrawRectangleLines(ByVal posX As Integer, ByVal posY As Integer, ByVal width As Integer, ByVal height As Integer, ByVal color As Color)' 绘制矩形的轮廓
Declare Sub DrawRectangleLinesEx(ByVal rec As Rectangle, ByVal lineThick As Single, ByVal color As Color)' 用扩展参数绘制矩形的轮廓
Declare Sub DrawRectangleRounded(ByVal rec As Rectangle, ByVal roundness As Single, ByVal segments As Integer, ByVal color As Color) ' 绘制带圆角的矩形
Declare Sub DrawRectangleRoundedLines(ByVal rec As Rectangle, ByVal roundness As Single, ByVal segments As Integer, ByVal Color As Color) ' 绘制带圆角的矩形轮廓
Declare Sub DrawRectangleRoundedLinesEx(ByVal rec As Rectangle, ByVal roundness As Single, ByVal segments As Integer, ByVal lineThick As Single, ByVal Color As Color)' 绘制带圆角的矩形的轮廓
Declare Sub DrawTriangle(ByVal v1 As Vector2, ByVal v2 As Vector2, ByVal v3 As Vector2, ByVal Color As Color)' 绘制一个填充颜色的三角形(顶点按逆时针顺序!)
Declare Sub DrawTriangleLines(ByVal v1 As Vector2, ByVal v2 As Vector2, ByVal v3 As Vector2, ByVal color As Color)' 绘制三角形的轮廓(顶点按逆时针顺序!)
Declare Sub DrawTriangleFan(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal color As Color)' 绘制由点定义的三角形扇(第一个顶点是中心)
Declare Sub DrawTriangleStrip(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal color As Color)' 绘制由点定义的三角形条
Declare Sub DrawPoly(ByVal center As Vector2, ByVal sides As Integer, ByVal radius As Single, ByVal rotation As Single, ByVal Color As Color)' 绘制一个正多边形(向量版本)
Declare Sub DrawPolyLines(ByVal center As Vector2, ByVal sides As Integer, ByVal radius As Single, ByVal rotation As Single, ByVal Color As Color)' 绘制 n 边形的轮廓
Declare Sub DrawPolyLinesEx(ByVal center As Vector2, ByVal sides As Integer, ByVal radius As Single, ByVal rotation As Single, ByVal lineThick As Single, ByVal Color As Color)' 用扩展参数绘制 n 边形的轮廓
样条曲线绘制函数
Declare Sub DrawSplineLinear(ByVal POINTS As Vector2 Ptr, ByVal pointCount As Integer, ByVal thick As Single, ByVal Color As Color)' 绘制样条曲线:线性,至少 2 个点
Declare Sub DrawSplineBasis(ByVal POINTS As Vector2 Ptr, ByVal pointCount As Integer, ByVal thick As Single, ByVal Color As Color) ' 绘制样条曲线:B - 样条,至少 4 个点
Declare Sub DrawSplineCatmullRom(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal thick As Single, ByVal color As Color) ' 绘制样条曲线:Catmull - Rom,至少 4 个点
Declare Sub DrawSplineBezierQuadratic(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal thick As Single, ByVal color As Color)' 绘制样条曲线:二次贝塞尔,至少 3 个点(1 个控制点):[p1, c2, p3, c4...]
Declare Sub DrawSplineBezierCubic(ByVal points As Vector2 Ptr, ByVal pointCount As Integer, ByVal thick As Single, ByVal color As Color)' 绘制样条曲线:三次贝塞尔,至少 4 个点(2 个控制点):[p1, c2, c3, p4, c5, c6...]
Declare Sub DrawSplineSegmentLinear(ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal thick As Single, ByVal color As Color)' 绘制样条线段:线性,2 个点
Declare Sub DrawSplineSegmentBasis(ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal p3 As Vector2, ByVal p4 As Vector2, ByVal thick As Single, ByVal color As Color) ' 绘制样条线段:B - 样条,4 个点
Declare Sub DrawSplineSegmentCatmullRom(ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal p3 As Vector2, ByVal p4 As Vector2, ByVal thick As Single, ByVal color As Color)' 绘制样条线段:Catmull - Rom,4 个点
Declare Sub DrawSplineSegmentBezierQuadratic(ByVal p1 As Vector2, ByVal c2 As Vector2, ByVal p3 As Vector2, ByVal thick As Single, ByVal color As Color) ' 绘制样条线段:二次贝塞尔,2 个点,1 个控制点
Declare Sub DrawSplineSegmentBezierCubic(ByVal p1 As Vector2, ByVal c2 As Vector2, ByVal c3 As Vector2, ByVal p4 As Vector2, ByVal thick As Single, ByVal Color As Color)' 绘制样条线段:三次贝塞尔,2 个点,2 个控制点
样条线段点评估函数,针对给定的 t [0.0f .. 1.0f]
Declare Function GetSplinePointLinear(ByVal startPos As Vector2, ByVal endPos As Vector2, ByVal t As Single) As Vector2' 获取(评估)样条线上的点:线性
Declare Function GetSplinePointBasis(ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal p3 As Vector2, ByVal p4 As Vector2, ByVal t As Single) As Vector2' 获取(评估)样条线上的点:B - 样条
Declare Function GetSplinePointCatmullRom(ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal p3 As Vector2, ByVal p4 As Vector2, ByVal t As Single) As Vector2' 获取(评估)样条线上的点:Catmull - Rom
Declare Function GetSplinePointBezierQuad(ByVal p1 As Vector2, ByVal c2 As Vector2, ByVal p3 As Vector2, ByVal t As Single) As Vector2' 获取(评估)样条线上的点:二次贝塞尔
Declare Function GetSplinePointBezierCubic(ByVal p1 As Vector2, ByVal c2 As Vector2, ByVal c3 As Vector2, ByVal p4 As Vector2, ByVal t As Single) As Vector2' 获取(评估)样条线上的点:三次贝塞尔
基本形状碰撞检测函数
Declare Function CheckCollisionRecs(ByVal rec1 As Rectangle, ByVal rec2 As Rectangle) As BOOLEAN ' 检查两个矩形之间是否发生碰撞
Declare Function CheckCollisionCircles(ByVal center1 As Vector2, ByVal radius1 As Single, ByVal center2 As Vector2, ByVal radius2 As Single) As BOOLEAN ' 检查两个圆之间是否发生碰撞
Declare Function CheckCollisionCircleRec(ByVal center As Vector2, ByVal radius As Single, ByVal rec As Rectangle) As BOOLEAN ' 检查圆与矩形之间是否发生碰撞
Declare Function CheckCollisionCircleLine(ByVal center As Vector2, ByVal radius As Single, ByVal p1 As Vector2, ByVal p2 As Vector2) As Boolean ' 检查圆是否与由两点 [p1] 和 [p2] 构成的直线发生碰撞
Declare Function CheckCollisionPointRec(ByVal Point As Vector2, ByVal rec As Rectangle) As BOOLEAN ' 检查点是否在矩形内部
Declare Function CheckCollisionPointCircle(ByVal Point As Vector2, ByVal center As Vector2, ByVal radius As Single) As BOOLEAN ' 检查点是否在圆内部
Declare Function CheckCollisionPointTriangle(ByVal point As Vector2, ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal p3 As Vector2) As Boolean ' 检查点是否在三角形内部
Declare Function CheckCollisionPointLine(ByVal point As Vector2, ByVal p1 As Vector2, ByVal p2 As Vector2, ByVal threshold As Integer) As Boolean ' 检查点是否在由两点 [p1] 和 [p2] 构成的直线上,允许有像素级的误差范围 [threshold]
Declare Function CheckCollisionPointPoly(ByVal point As Vector2, ByVal points As Vector2 Ptr, ByVal pointCount As Integer) As Boolean ' 检查点是否在由顶点数组描述的多边形内部
Declare Function CheckCollisionLines(ByVal startPos1 As Vector2, ByVal endPos1 As Vector2, ByVal startPos2 As Vector2, ByVal endPos2 As Vector2, ByVal collisionPoint As Vector2 Ptr) As BOOLEAN ' 检查由两组两点定义的两条直线是否发生碰撞,通过引用返回碰撞点
Declare Function GetCollisionRec(ByVal rec1 As Rectangle, ByVal rec2 As Rectangle) As Rectangle ' 获取两个矩形碰撞产生的碰撞矩形
图像加载函数
' 注意: 这些函数不需要访问 GPU
Declare Function LoadImage(ByVal fileName As ZString Ptr) As Image ' 从文件将图像加载到 CPU 内存 (RAM) 中
Declare Function LoadImageRaw(ByVal fileName As ZString Ptr, ByVal width As Integer, ByVal height As Integer, ByVal format As Integer, ByVal headerSize As Integer) As Image ' 从原始文件数据加载图像
Declare Function LoadImageAnim(ByVal fileName As ZString Ptr, ByVal frames As Integer Ptr) As Image ' 从文件加载图像序列 (帧追加到 image.data)
Declare Function LoadImageAnimFromMemory(ByVal fileType As ZString Ptr, ByVal fileData As UByte Ptr, ByVal dataSize As Integer, ByVal frames As Integer Ptr) As Image ' 从内存缓冲区加载图像序列
Declare Function LoadImageFromMemory(ByVal fileType As ZString Ptr, ByVal fileData As UByte Ptr, ByVal dataSize As Integer) As Image ' 从内存缓冲区加载图像,fileType 指文件扩展名,如 '.png'
Declare Function LoadImageFromTexture(ByVal Texture As Texture2D) As Image ' 从 GPU 纹理数据加载图像
Declare Function LoadImageFromScreen() As Image ' 从屏幕缓冲区加载图像 (截图)
Declare Function IsImageValid(ByVal image As Image) As BOOLEAN ' 检查图像是否有效 (数据和参数)
Declare Sub UnloadImage(ByVal image As Image) ' 从 CPU 内存 (RAM) 中卸载图像
Declare Function ExportImage(ByVal Image As Image, ByVal fileName As ZString Ptr) As Boolean ' 将图像数据导出到文件,成功返回 True
Declare Function ExportImageToMemory(ByVal Image As Image, ByVal fileType As ZString Ptr, ByVal fileSize As Integer Ptr) As UByte Ptr ' 将图像导出到内存缓冲区
Declare Function ExportImageAsCode(ByVal image As Image, ByVal fileName As ZString Ptr) As Boolean ' 将图像作为定义字节数组的代码文件导出,成功返回 True
图像生成函数
Declare Function GenImageColor(ByVal Width As Integer, ByVal height As Integer, ByVal Color As Color) As Image ' 生成图像:纯色图像
Declare Function GenImageGradientLinear(ByVal width As Integer, ByVal height As Integer, ByVal direction As Integer, ByVal start As Color, ByVal end As Color) As Image ' 生成图像:线性渐变图像,方向以度为单位 [0..360],0 表示垂直渐变
Declare Function GenImageGradientRadial(ByVal width As Integer, ByVal height As Integer, ByVal density As Single, ByVal inner As Color, ByVal outer As Color) As Image ' 生成图像:径向渐变图像
Declare Function GenImageGradientSquare(ByVal Width As Integer, ByVal height As Integer, ByVal density As Single, ByVal inner As Color, ByVal outer As Color) As Image ' 生成图像:方形渐变图像
Declare Function GenImageChecked(ByVal width As Integer, ByVal height As Integer, ByVal checksX As Integer, ByVal checksY As Integer, ByVal col1 As Color, ByVal col2 As Color) As Image ' 生成图像:棋盘格图像
Declare Function GenImageWhiteNoise(ByVal width As Integer, ByVal height As Integer, ByVal factor As Single) As Image ' 生成图像:白噪声图像
Declare Function GenImagePerlinNoise(ByVal width As Integer, ByVal height As Integer, ByVal offsetX As Integer, ByVal offsetY As Integer, ByVal scale As Single) As Image ' 生成图像:Perlin 噪声图像
Declare Function GenImageCellular(ByVal width As Integer, ByVal height As Integer, ByVal tileSize As Integer) As Image ' 生成图像:细胞算法图像,tileSize 越大,细胞越大
Declare Function GenImageText(ByVal Width As Integer, ByVal height As Integer, ByVal text As ZString Ptr) As Image ' 生成图像:根据文本数据生成灰度图像
图像操作函数
Declare Function ImageCopy(ByVal image As Image) As Image ' 创建图像副本(用于变换操作很有用)
Declare Function ImageFromImage(ByVal image As Image, ByVal rec As Rectangle) As Image ' 从另一个图像的部分区域创建新图像
Declare Function ImageFromChannel(ByVal image As Image, ByVal selectedChannel As Integer) As Image ' 从另一个图像的选定通道创建新图像(灰度图)
Declare Function ImageText(ByVal text As ZString Ptr, ByVal fontSize As Integer, ByVal Color As Color) As Image ' 根据文本创建图像(使用默认字体)
Declare Function ImageTextEx(ByVal font As Font, ByVal text As ZString Ptr, ByVal fontSize As Single, ByVal spacing As Single, ByVal tint As Color) As Image ' 根据文本创建图像(使用自定义精灵字体)
Declare Sub ImageFormat(ByVal image As Image Ptr, ByVal newFormat As Integer) ' 将图像数据转换为所需的格式
Declare Sub ImageToPOT(ByVal image As Image Ptr, ByVal fill As Color) ' 将图像转换为 2 的幂次方尺寸(POT)
Declare Sub ImageCrop(ByVal image As Image Ptr, ByVal crop As Rectangle) ' 将图像裁剪到指定的矩形区域
Declare Sub ImageAlphaCrop(ByVal image As Image Ptr, ByVal threshold As Single) ' 根据 alpha 值裁剪图像
Declare Sub ImageAlphaClear(ByVal image As Image Ptr, ByVal Color As Color, ByVal threshold As Single) ' 将 alpha 通道清除为指定颜色
Declare Sub ImageAlphaMask(ByVal image As Image Ptr, ByVal alphaMask As Image) ' 对图像应用 alpha 遮罩
Declare Sub ImageAlphaPremultiply(ByVal image As Image Ptr) ' 预乘 alpha 通道
Declare Sub ImageBlurGaussian(ByVal image As Image Ptr, ByVal blurSize As Integer) ' 使用盒式模糊近似应用高斯模糊
Declare Sub ImageKernelConvolution(ByVal image As Image Ptr, ByVal kernel As Single Ptr, ByVal kernelSize As Integer) ' 对图像应用自定义方形卷积核
Declare Sub ImageResize(ByVal image As Image Ptr, ByVal newWidth As Integer, ByVal newHeight As Integer) ' 调整图像大小(使用双三次缩放算法)
Declare Sub ImageResizeNN(ByVal image As Image Ptr, ByVal newWidth As Integer, ByVal newHeight As Integer) ' 调整图像大小(使用最近邻缩放算法)
Declare Sub ImageResizeCanvas(ByVal image As Image Ptr, ByVal newWidth As Integer, ByVal newHeight As Integer, ByVal offsetX As Integer, ByVal offsetY As Integer, ByVal fill As Color) ' 调整画布大小并填充颜色
Declare Sub ImageMipmaps(ByVal image As Image Ptr) ' 为提供的图像计算所有 mipmap 级别
Declare Sub ImageDither(ByVal image As Image Ptr, ByVal rBpp As Integer, ByVal gBpp As Integer, ByVal bBpp As Integer, ByVal aBpp As Integer) ' 将图像数据抖动为 16 位或更低(使用 Floyd - Steinberg 抖动算法)
Declare Sub ImageFlipVertical(ByVal image As Image Ptr) ' 垂直翻转图像
Declare Sub ImageFlipHorizontal(ByVal image As Image Ptr) ' 水平翻转图像
Declare Sub ImageRotate(ByVal image As Image Ptr, ByVal degrees As Integer) ' 按输入角度(以度为单位,范围 - 359 到 359)旋转图像
Declare Sub ImageRotateCW(ByVal image As Image Ptr) ' 顺时针旋转图像 90 度
Declare Sub ImageRotateCCW(ByVal image As Image Ptr) ' 逆时针旋转图像 90 度
Declare Sub ImageColorTint(ByVal image As Image Ptr, ByVal Color As Color) ' 修改图像颜色:着色
Declare Sub ImageColorInvert(ByVal image As Image Ptr) ' 修改图像颜色:反色
Declare Sub ImageColorGrayscale(ByVal image As Image Ptr) ' 修改图像颜色:转换为灰度图
Declare Sub ImageColorContrast(ByVal image As Image Ptr, ByVal contrast As Single) ' 修改图像颜色:调整对比度(范围 - 100 到 100)
Declare Sub ImageColorBrightness(ByVal image As Image Ptr, ByVal brightness As Integer) ' 修改图像颜色:调整亮度(范围 - 255 到 255)
Declare Sub ImageColorReplace(ByVal image As Image Ptr, ByVal Color As Color, ByVal replace As Color) ' 修改图像颜色:替换颜色
Declare Function LoadImageColors(ByVal image As Image) As Color Ptr ' 从图像加载颜色数据作为颜色数组(RGBA - 32 位)
Declare Function LoadImagePalette(ByVal image As Image, ByVal maxPaletteSize As Integer, ByVal colorCount As Integer Ptr) As Color Ptr ' 从图像加载颜色调色板作为颜色数组(RGBA - 32 位)
Declare Sub UnloadImageColors(ByVal colors As Color Ptr) ' 卸载通过 LoadImageColors() 加载的颜色数据
Declare Sub UnloadImagePalette(ByVal colors As Color Ptr) ' 卸载通过 LoadImagePalette() 加载的颜色调色板
Declare Function GetImageAlphaBorder(ByVal image As Image, ByVal threshold As Single) As Rectangle ' 获取图像 alpha 边界矩形
Declare Function GetImageColor(ByVal image As Image, ByVal x As Integer, ByVal y As Integer) As Color ' 获取图像指定位置的颜色
图像绘制函数
' 注意: 图像软件渲染函数 (CPU)
Declare Sub ImageClearBackground(ByVal dst As Image Ptr, ByVal Color As Color) ' 用指定颜色清除图像背景
Declare Sub ImageDrawPixel(ByVal dst As Image Ptr, ByVal posX As Integer, ByVal posY As Integer, ByVal Color As Color) ' 在图像内绘制像素
Declare Sub ImageDrawPixelV(ByVal dst As Image Ptr, ByVal position As Vector2, ByVal Color As Color) ' 在图像内绘制像素 (向量版本)
Declare Sub ImageDrawLine(ByVal dst As Image Ptr, ByVal startPosX As Integer, ByVal startPosY As Integer, ByVal endPosX As Integer, ByVal endPosY As Integer, ByVal Color As Color) ' 在图像内绘制直线
Declare Sub ImageDrawLineV(ByVal dst As Image Ptr, ByVal start As Vector2, ByVal End As Vector2, ByVal Color As Color) ' 在图像内绘制直线 (向量版本)
Declare Sub ImageDrawLineEx(ByVal dst As Image Ptr, ByVal start As Vector2, ByVal End As Vector2, ByVal thick As Integer, ByVal Color As Color) ' 在图像内绘制指定厚度的直线
Declare Sub ImageDrawCircle(ByVal dst As Image Ptr, ByVal centerX As Integer, ByVal centerY As Integer, ByVal radius As Integer, ByVal Color As Color) ' 在图像内绘制填充的圆
Declare Sub ImageDrawCircleV(ByVal dst As Image Ptr, ByVal center As Vector2, ByVal radius As Integer, ByVal Color As Color) ' 在图像内绘制填充的圆 (向量版本)
Declare Sub ImageDrawCircleLines(ByVal dst As Image Ptr, ByVal centerX As Integer, ByVal centerY As Integer, ByVal radius As Integer, ByVal Color As Color) ' 在图像内绘制圆的轮廓
Declare Sub ImageDrawCircleLinesV(ByVal dst As Image Ptr, ByVal center As Vector2, ByVal radius As Integer, ByVal Color As Color) ' 在图像内绘制圆的轮廓 (向量版本)
Declare Sub ImageDrawRectangle(ByVal dst As Image Ptr, ByVal posX As Integer, ByVal posY As Integer, ByVal Width As Integer, ByVal height As Integer, ByVal Color As Color) ' 在图像内绘制矩形
Declare Sub ImageDrawRectangleV(ByVal dst As Image Ptr, ByVal position As Vector2, ByVal SIZE As Vector2, ByVal Color As Color) ' 在图像内绘制矩形 (向量版本)
Declare Sub ImageDrawRectangleRec(ByVal dst As Image Ptr, ByVal rec As Rectangle, ByVal Color As Color) ' 在图像内绘制矩形
Declare Sub ImageDrawRectangleLines(ByVal dst As Image Ptr, ByVal rec As Rectangle, ByVal thick As Integer, ByVal Color As Color) ' 在图像内绘制矩形的边框
Declare Sub ImageDrawTriangle(ByVal dst As Image Ptr, ByVal v1 As Vector2, ByVal v2 As Vector2, ByVal v3 As Vector2, ByVal Color As Color) ' 在图像内绘制三角形
Declare Sub ImageDrawTriangleEx(ByVal dst As Image Ptr, ByVal v1 As Vector2, ByVal v2 As Vector2, ByVal v3 As Vector2, ByVal c1 As Color, ByVal c2 As Color, ByVal c3 As Color) ' 在图像内绘制具有插值颜色的三角形
Declare Sub ImageDrawTriangleLines(ByVal dst As Image Ptr, ByVal v1 As Vector2, ByVal v2 As Vector2, ByVal v3 As Vector2, ByVal Color As Color) ' 在图像内绘制三角形的轮廓
Declare Sub ImageDrawTriangleFan(ByVal dst As Image Ptr, ByVal POINTS As Vector2 Ptr, ByVal pointCount As Integer, ByVal Color As Color) ' 在图像内绘制由点定义的三角形扇 (第一个顶点是中心)
Declare Sub ImageDrawTriangleStrip(ByVal dst As Image Ptr, ByVal POINTS As Vector2 Ptr, ByVal pointCount As Integer, ByVal Color As Color) ' 在图像内绘制由点定义的三角形条
Declare Sub ImageDraw(ByVal dst As Image Ptr, ByVal src As Image, ByVal srcRec As Rectangle, ByVal dstRec As Rectangle, ByVal tint As Color) ' 在目标图像内绘制源图像 (对源图像应用色调)
Declare Sub ImageDrawText(ByVal dst As Image Ptr, ByVal text As ZString Ptr, ByVal posX As Integer, ByVal posY As Integer, ByVal fontSize As Integer, ByVal Color As Color) ' 在图像 (目标) 内绘制文本 (使用默认字体)
Declare Sub ImageDrawTextEx(ByVal dst As Image Ptr, ByVal font As Font, ByVal text As ZString Ptr, ByVal position As Vector2, ByVal fontSize As Single, ByVal spacing As Single, ByVal tint As Color) ' 在图像 (目标) 内绘制文本 (使用自定义精灵字体)
纹理加载函数
' 注意: 这些函数需要访问 GPU
Declare Function LoadTexture(ByVal fileName As ZString Ptr) As Texture2D ' 从文件将纹理加载到 GPU 内存 (VRAM) 中
Declare Function LoadTextureFromImage(ByVal image As Image) As Texture2D ' 从图像数据加载纹理
Declare Function LoadTextureCubemap(ByVal image As Image, ByVal layout As Integer) As TextureCubemap ' 从图像加载立方体纹理,支持多种图像立方体纹理布局
Declare Function LoadRenderTexture(ByVal Width As Integer, ByVal height As Integer) As RenderTexture2D ' 加载用于渲染的纹理 (帧缓冲区)
Declare Function IsTextureValid(ByVal texture As Texture2D) As BOOLEAN ' 检查纹理是否有效 (已加载到 GPU 中)
Declare Sub UnloadTexture(ByVal texture As Texture2D) ' 从 GPU 内存 (VRAM) 中卸载纹理
Declare Function IsRenderTextureValid(ByVal target As RenderTexture2D) As BOOLEAN ' 检查渲染纹理是否有效 (已加载到 GPU 中)
Declare Sub UnloadRenderTexture(ByVal target As RenderTexture2D) ' 从 GPU 内存 (VRAM) 中卸载渲染纹理
Declare Sub UpdateTexture(ByVal texture As Texture2D, ByVal pixels As Any Ptr) ' 用新数据更新 GPU 纹理
Declare Sub UpdateTextureRec(ByVal texture As Texture2D, ByVal rec As Rectangle, ByVal pixels As Any Ptr) ' 用新数据更新 GPU 纹理的指定矩形区域
纹理配置函数
Declare Sub GenTextureMipmaps(ByVal texture As Texture2D Ptr) ' 为纹理生成 GPU mipmap
Declare Sub SetTextureFilter(ByVal texture As Texture2D, ByVal filter As Integer) ' 设置纹理缩放过滤模式
Declare Sub SetTextureWrap(ByVal texture As Texture2D, ByVal wrap As Integer) ' 设置纹理环绕模式
纹理绘制函数
Declare Sub DrawTexture(ByVal texture As Texture2D, ByVal posX As Integer, ByVal posY As Integer, ByVal tint As Color) ' 绘制一个 Texture2D
Declare Sub DrawTextureV(ByVal texture As Texture2D, ByVal position As Vector2, ByVal tint As Color) ' 以 Vector2 定义的位置绘制一个 Texture2D
Declare Sub DrawTextureEx(ByVal texture As Texture2D, ByVal position As Vector2, ByVal rotation As Single, ByVal scale As Single, ByVal tint As Color) ' 以扩展参数绘制一个 Texture2D
Declare Sub DrawTextureRec(ByVal texture As Texture2D, ByVal source As Rectangle, ByVal position As Vector2, ByVal tint As Color) ' 绘制由矩形定义的纹理的一部分
Declare Sub DrawTexturePro(ByVal texture As Texture2D, ByVal source As Rectangle, ByVal dest As Rectangle, ByVal origin As Vector2, ByVal rotation As Single, ByVal tint As Color) ' 以“专业”参数绘制由矩形定义的纹理的一部分
Declare Sub DrawTextureNPatch(ByVal texture As Texture2D, ByVal nPatchInfo As NPatchInfo, ByVal dest As Rectangle, ByVal origin As Vector2, ByVal rotation As Single, ByVal tint As Color) ' 绘制一个纹理(或其一部分),该纹理可以很好地拉伸或收缩
颜色/像素相关函数
Declare Function ColorIsEqual(ByVal col1 As Color, ByVal col2 As Color) As Boolean ' 检查两种颜色是否相等
Declare Function Fade(ByVal Color As Color, ByVal Alpha As Single) As Color ' 获取应用了透明度的颜色,透明度范围从 0.0f 到 1.0f
Declare Function ColorToInt(ByVal Color As Color) As Integer ' 获取颜色的十六进制值 (0xRRGGBBAA)
Declare Function ColorNormalize(ByVal Color As Color) As Vector4 ' 获取颜色的归一化浮点值 [0..1]
Declare Function ColorFromNormalized(ByVal normalized As Vector4) As Color ' 从归一化值 [0..1] 获取颜色
Declare Function ColorToHSV(ByVal Color As Color) As Vector3 ' 获取颜色的 HSV 值,色相 [0..360],饱和度/明度 [0..1]
Declare Function ColorFromHSV(ByVal hue As Single, ByVal saturation As Single, ByVal value As Single) As Color ' 从 HSV 值获取颜色,色相 [0..360],饱和度/明度 [0..1]
Declare Function ColorTint(ByVal Color As Color, ByVal tint As Color) As Color ' 获取与另一种颜色相乘后的颜色
Declare Function ColorBrightness(ByVal Color As Color, ByVal factor As Single) As Color ' 获取经过亮度校正的颜色,亮度因子范围从 -1.0f 到 1.0f
Declare Function ColorContrast(ByVal Color As Color, ByVal contrast As Single) As Color ' 获取经过对比度校正的颜色,对比度值在 -1.0f 和 1.0f 之间
Declare Function ColorAlpha(ByVal Color As Color, ByVal Alpha As Single) As Color ' 获取应用了透明度的颜色,透明度范围从 0.0f 到 1.0f
Declare Function ColorAlphaBlend(ByVal dst As Color, ByVal src As Color, ByVal tint As Color) As Color ' 获取源颜色以指定色调与目标颜色进行 alpha 混合后的颜色
Declare Function ColorLerp(ByVal color1 As Color, ByVal color2 As Color, ByVal factor As Single) As Color ' 获取两种颜色之间的线性插值颜色,插值因子 [0.0f..1.0f]
Declare Function GetColor(ByVal hexValue As UInteger) As Color ' 从十六进制值获取颜色结构
Declare Function GetPixelColor(ByVal srcPtr As Any Ptr, ByVal Format As Integer) As Color ' 从指定格式的源像素指针获取颜色
Declare Sub SetPixelColor(ByVal dstPtr As Any Ptr, ByVal color As Color, ByVal format As Integer) ' 将格式化的颜色设置到目标像素指针
Declare Function GetPixelDataSize(ByVal Width As Integer, ByVal height As Integer, ByVal Format As Integer) As Integer ' 获取指定格式的像素数据大小(以字节为单位)
字体加载/卸载函数
Declare Function GetFontDefault() As Font ' 获取默认字体
Declare Function LoadFont(ByVal fileName As ZString Ptr) As Font ' 从文件将字体加载到 GPU 内存 (VRAM) 中
Declare Function LoadFontEx(ByVal fileName As ZString Ptr, ByVal fontSize As Integer, ByVal codepoints As Integer Ptr, ByVal codepointCount As Integer) As Font ' 从文件以扩展参数加载字体,若 codepoints 为 NULL 且 codepointCount 为 0 则加载默认字符集,字体大小以像素高度提供
Declare Function LoadFontFromImage(ByVal image As Image, ByVal key As Color, ByVal firstChar As Integer) As Font ' 从图像加载字体 (XNA 风格)
Declare Function LoadFontFromMemory(ByVal fileType As ZString Ptr, ByVal fileData As UByte Ptr, ByVal dataSize As Integer, ByVal fontSize As Integer, ByVal codepoints As Integer Ptr, ByVal codepointCount As Integer) As Font ' 从内存缓冲区加载字体,fileType 指文件扩展名,如 '.ttf'
Declare Function IsFontValid(ByVal font As Font) As Boolean ' 检查字体是否有效 (字体数据已加载,警告: 未检查 GPU 纹理)
Declare Function LoadFontData(ByVal fileData As UByte Ptr, ByVal dataSize As Integer, ByVal fontSize As Integer, ByVal codepoints As Integer Ptr, ByVal codepointCount As Integer, ByVal Type As Integer) As GlyphInfo Ptr ' 加载字体数据以供后续使用
Declare Function GenImageFontAtlas(ByVal glyphs As GlyphInfo Ptr, ByVal glyphRecs As Rectangle Ptr Ptr, ByVal glyphCount As Integer, ByVal fontSize As Integer, ByVal padding As Integer, ByVal packMethod As Integer) As Image ' 使用字符信息生成图像字体图集
Declare Sub UnloadFontData(ByVal glyphs As GlyphInfo Ptr, ByVal glyphCount As Integer) ' 卸载字体字符信息数据 (RAM)
Declare Sub UnloadFont(ByVal font As Font) ' 从 GPU 内存 (VRAM) 中卸载字体
Declare Function ExportFontAsCode(ByVal font As Font, ByVal fileName As ZString Ptr) As Boolean ' 将字体导出为代码文件,成功返回 True
文本绘制函数
Declare Sub DrawFPS(ByVal posX As Integer, ByVal posY As Integer) ' 绘制当前帧率(FPS)
Declare Sub DrawText(ByVal text As ZString Ptr, ByVal posX As Integer, ByVal posY As Integer, ByVal fontSize As Integer, ByVal color As Color) ' 绘制文本(使用默认字体)
Declare Sub DrawTextEx(ByVal font As Font, ByVal text As ZString Ptr, ByVal position As Vector2, ByVal fontSize As Single, ByVal spacing As Single, ByVal tint As Color) ' 使用字体和额外参数绘制文本
Declare Sub DrawTextPro(ByVal font As Font, ByVal text As ZString Ptr, ByVal position As Vector2, ByVal origin As Vector2, ByVal rotation As Single, ByVal fontSize As Single, ByVal spacing As Single, ByVal tint As Color) ' 使用字体和专业参数(旋转)绘制文本
Declare Sub DrawTextCodepoint(ByVal font As Font, ByVal codepoint As Integer, ByVal position As Vector2, ByVal fontSize As Single, ByVal tint As Color) ' 绘制一个字符(代码点)
Declare Sub DrawTextCodepoints(ByVal font As Font, ByVal codepoints As Integer Ptr, ByVal codepointCount As Integer, ByVal position As Vector2, ByVal fontSize As Single, ByVal spacing As Single, ByVal tint As Color) ' 绘制多个字符(代码点)
文本字体信息函数
Declare Sub SetTextLineSpacing(ByVal spacing As Integer) ' 设置绘制带换行文本时的垂直行间距
Declare Function MeasureText(ByVal text As ZString Ptr, ByVal fontSize As Integer) As Integer ' 测量默认字体下字符串的宽度
Declare Function MeasureTextEx(ByVal font As Font, ByVal text As ZString Ptr, ByVal fontSize As Single, ByVal spacing As Single) As Vector2 ' 测量指定字体下字符串的尺寸
Declare Function GetGlyphIndex(ByVal font As Font, ByVal codepoint As Integer) As Integer ' 获取指定代码点(Unicode 字符)在字体中的字形索引位置,若未找到则回退到 '?'
Declare Function GetGlyphInfo(ByVal font As Font, ByVal codepoint As Integer) As GlyphInfo ' 获取指定代码点(Unicode 字符)的字形字体信息数据,若未找到则回退到 '?'
Declare Function GetGlyphAtlasRec(ByVal font As Font, ByVal codepoint As Integer) As Rectangle ' 获取指定代码点(Unicode 字符)在字体图集中的字形矩形,若未找到则回退到 '?'
文本代码点管理函数 (Unicode 字符)
Declare Function LoadUTF8(ByVal codepoints As Integer Ptr, ByVal length As Integer) As ZString Ptr ' 从代码点数组加载 UTF - 8 编码的文本
Declare Sub UnloadUTF8(ByVal text As ZString Ptr) ' 卸载从代码点数组编码的 UTF - 8 文本
Declare Function LoadCodepoints(ByVal text As ZString Ptr, ByVal count As Integer Ptr) As Integer Ptr ' 从 UTF - 8 文本字符串加载所有代码点,代码点数量通过参数返回
Declare Sub UnloadCodepoints(ByVal codepoints As Integer Ptr) ' 从内存中卸载代码点数据
Declare Function GetCodepointCount(ByVal text As ZString Ptr) As Integer ' 获取 UTF - 8 编码字符串中的代码点总数
Declare Function GetCodepoint(ByVal text As ZString Ptr, ByVal codepointSize As Integer Ptr) As Integer ' 获取 UTF - 8 编码字符串中的下一个代码点,失败时返回 0x3f('?')
Declare Function GetCodepointNext(ByVal text As ZString Ptr, ByVal codepointSize As Integer Ptr) As Integer ' 获取 UTF - 8 编码字符串中的下一个代码点,失败时返回 0x3f('?')
Declare Function GetCodepointPrevious(ByVal text As ZString Ptr, ByVal codepointSize As Integer Ptr) As Integer ' 获取 UTF - 8 编码字符串中的上一个代码点,失败时返回 0x3f('?')
Declare Function CodepointToUTF8(ByVal codepoint As Integer, ByVal utf8Size As Integer Ptr) As ZString Ptr ' 将一个代码点编码为 UTF - 8 字节数组(数组长度作为参数返回)
文本字符串管理函数 (非 UTF - 8 字符串,仅字节字符)
' 警告 1: 这些函数大多使用内部静态缓冲区,建议在用户端存储返回的数据以供重用
' 警告 2: 一些字符串函数会为返回的字符串内部分配内存,这些字符串必须由用户使用 MemFree() 释放
Declare Function TextCopy(ByVal dst As ZString Ptr, ByVal src As ZString Ptr) As Integer ' 将一个字符串复制到另一个字符串,返回复制的字节数
Declare Function TextIsEqual(ByVal text1 As ZString Ptr, ByVal text2 As ZString Ptr) As Boolean ' 检查两个文本字符串是否相等
Declare Function TextLength(ByVal text As ZString Ptr) As UInteger ' 获取文本长度,检查 '\0' 结尾
Declare Function TextFormat(ByVal text As ZString Ptr, ...) As ZString Ptr ' 用变量进行文本格式化 (sprintf() 风格)
Declare Function TextSubtext(ByVal text As ZString Ptr, ByVal position As Integer, ByVal length As Integer) As ZString Ptr ' 获取文本字符串的一部分
Declare Function TextReplace(ByVal text As ZString Ptr, ByVal replace As ZString Ptr, ByVal by As ZString Ptr) As ZString Ptr ' 替换文本字符串 (警告: 必须释放内存!)
Declare Function TextInsert(ByVal text As ZString Ptr, ByVal insert As ZString Ptr, ByVal position As Integer) As ZString Ptr ' 在指定位置插入文本 (警告: 必须释放内存!)
Declare Function TextJoin(ByVal textList As ZString Ptr Ptr, ByVal count As Integer, ByVal delimiter As ZString Ptr) As ZString Ptr ' 用分隔符连接文本字符串
Declare Function TextSplit(ByVal text As ZString Ptr, ByVal delimiter As ZString Ptr, ByVal count As Integer Ptr) As ZString Ptr Ptr ' 将文本拆分为多个字符串
Declare Sub TextAppend(ByVal text As ZString Ptr, ByVal Append As ZString Ptr, ByVal position As Integer Ptr) ' 在特定位置追加文本并移动光标!
Declare Function TextFindIndex(ByVal text As ZString Ptr, ByVal find As ZString Ptr) As Integer ' 在字符串中查找文本首次出现的位置
Declare Function TextToUpper(ByVal text As ZString Ptr) As ZString Ptr ' 获取提供字符串的大写版本
Declare Function TextToLower(ByVal text As ZString Ptr) As ZString Ptr ' 获取提供字符串的小写版本
Declare Function TextToPascal(ByVal text As ZString Ptr) As ZString Ptr ' 获取提供字符串的帕斯卡命名法版本
Declare Function TextToSnake(ByVal text As ZString Ptr) As ZString Ptr ' 获取提供字符串的蛇形命名法版本
Declare Function TextToCamel(ByVal text As ZString Ptr) As ZString Ptr ' 获取提供字符串的驼峰命名法版本
Declare Function TextToInteger(ByVal text As ZString Ptr) As Integer ' 从文本中获取整数值
Declare Function TextToFloat(ByVal text As ZString Ptr) As Single ' 从文本中获取浮点数值
基本几何 3D 形状绘制函数
Declare Sub DrawLine3D(ByVal startPos As Vector3, ByVal endPos As Vector3, ByVal Color As Color) ' 在 3D 世界空间中绘制一条直线
Declare Sub DrawPoint3D(ByVal position As Vector3, ByVal Color As Color) ' 在 3D 空间中绘制一个点,实际上是一条小线段
Declare Sub DrawCircle3D(ByVal center As Vector3, ByVal radius As Single, ByVal rotationAxis As Vector3, ByVal rotationAngle As Single, ByVal Color As Color) ' 在 3D 世界空间中绘制一个圆
Declare Sub DrawTriangle3D(ByVal v1 As Vector3, ByVal v2 As Vector3, ByVal v3 As Vector3, ByVal color As Color) ' 绘制一个填充颜色的三角形(顶点按逆时针顺序!)
Declare Sub DrawTriangleStrip3D(ByVal POINTS As Vector3 Ptr, ByVal pointCount As Integer, ByVal Color As Color) ' 绘制由点定义的三角形条带
Declare Sub DrawCube(ByVal position As Vector3, ByVal Width As Single, ByVal height As Single, ByVal length As Single, ByVal Color As Color) ' 绘制立方体
Declare Sub DrawCubeV(ByVal position As Vector3, ByVal SIZE As Vector3, ByVal Color As Color) ' 绘制立方体(向量版本)
Declare Sub DrawCubeWires(ByVal position As Vector3, ByVal Width As Single, ByVal height As Single, ByVal length As Single, ByVal Color As Color) ' 绘制立方体的线框
Declare Sub DrawCubeWiresV(ByVal position As Vector3, ByVal SIZE As Vector3, ByVal Color As Color) ' 绘制立方体的线框(向量版本)
Declare Sub DrawSphere(ByVal centerPos As Vector3, ByVal radius As Single, ByVal color As Color) ' 绘制球体
Declare Sub DrawSphereEx(ByVal centerPos As Vector3, ByVal radius As Single, ByVal rings As Integer, ByVal slices As Integer, ByVal color As Color) ' 用扩展参数绘制球体
Declare Sub DrawSphereWires(ByVal centerPos As Vector3, ByVal radius As Single, ByVal rings As Integer, ByVal slices As Integer, ByVal Color As Color) ' 绘制球体的线框
Declare Sub DrawCylinder(ByVal position As Vector3, ByVal radiusTop As Single, ByVal radiusBottom As Single, ByVal height As Single, ByVal slices As Integer, ByVal color As Color) ' 绘制圆柱体/圆锥体
Declare Sub DrawCylinderEx(ByVal startPos As Vector3, ByVal endPos As Vector3, ByVal startRadius As Single, ByVal endRadius As Single, ByVal sides As Integer, ByVal Color As Color) ' 绘制一个圆柱体,底面在 startPos,顶面在 endPos
Declare Sub DrawCylinderWires(ByVal position As Vector3, ByVal radiusTop As Single, ByVal radiusBottom As Single, ByVal height As Single, ByVal slices As Integer, ByVal color As Color) ' 绘制圆柱体/圆锥体的线框
Declare Sub DrawCylinderWiresEx(ByVal startPos As Vector3, ByVal endPos As Vector3, ByVal startRadius As Single, ByVal endRadius As Single, ByVal sides As Integer, ByVal color As Color) ' 绘制一个圆柱体的线框,底面在 startPos,顶面在 endPos
Declare Sub DrawCapsule(ByVal startPos As Vector3, ByVal endPos As Vector3, ByVal radius As Single, ByVal slices As Integer, ByVal rings As Integer, ByVal color As Color) ' 绘制一个胶囊体,其球冠中心分别在 startPos 和 endPos
Declare Sub DrawCapsuleWires(ByVal startPos As Vector3, ByVal endPos As Vector3, ByVal radius As Single, ByVal slices As Integer, ByVal rings As Integer, ByVal color As Color) ' 绘制胶囊体的线框,其球冠中心分别在 startPos 和 endPos
Declare Sub DrawPlane(ByVal centerPos As Vector3, ByVal SIZE As Vector2, ByVal Color As Color) ' 绘制一个 XZ 平面
Declare Sub DrawRay(ByVal ray As Ray, ByVal color As Color) ' 绘制一条射线
Declare Sub DrawGrid(ByVal slices As Integer, ByVal spacing As Single) ' 绘制网格
模型管理函数
Declare Function LoadModel(ByVal fileName As ZString Ptr) As Model ' 从文件(网格和材质)加载模型
Declare Function LoadModelFromMesh(ByVal mesh As Mesh) As Model ' 从生成的网格加载模型(使用默认材质)
Declare Function IsModelValid(ByVal model As Model) As BOOLEAN ' 检查模型是否有效(已加载到 GPU,包含 VAO/VBOs)
Declare Sub UnloadModel(ByVal model As Model) ' 从内存(RAM 和/或 VRAM)中卸载模型(包括网格)
Declare Function GetModelBoundingBox(ByVal model As Model) As BoundingBox ' 计算模型的边界框限制(考虑所有网格)
模型绘制函数
Declare Sub DrawModel(ByVal model As Model, ByVal position As Vector3, ByVal scale As Single, ByVal tint As Color) ' 绘制一个模型(若设置了纹理则带有纹理)
Declare Sub DrawModelEx(ByVal model As Model, ByVal position As Vector3, ByVal rotationAxis As Vector3, ByVal rotationAngle As Single, ByVal scale As Vector3, ByVal tint As Color) ' 用扩展参数绘制一个模型
Declare Sub DrawModelWires(ByVal model As Model, ByVal position As Vector3, ByVal scale As Single, ByVal tint As Color) ' 绘制模型的线框(若设置了纹理则带有纹理)
Declare Sub DrawModelWiresEx(ByVal model As Model, ByVal position As Vector3, ByVal rotationAxis As Vector3, ByVal rotationAngle As Single, ByVal scale As Vector3, ByVal tint As Color) ' 用扩展参数绘制模型的线框(若设置了纹理则带有纹理)
Declare Sub DrawModelPoints(ByVal model As Model, ByVal position As Vector3, ByVal scale As Single, ByVal tint As Color) ' 将模型绘制为点
Declare Sub DrawModelPointsEx(ByVal model As Model, ByVal position As Vector3, ByVal rotationAxis As Vector3, ByVal rotationAngle As Single, ByVal scale As Vector3, ByVal tint As Color) ' 用扩展参数将模型绘制为点
Declare Sub DrawBoundingBox(ByVal box As BoundingBox, ByVal color As Color) ' 绘制边界框(线框)
Declare Sub DrawBillboard(ByVal camera As Camera, ByVal texture As Texture2D, ByVal position As Vector3, ByVal scale As Single, ByVal tint As Color) ' 绘制一个公告牌纹理
Declare Sub DrawBillboardRec(ByVal camera As Camera, ByVal texture As Texture2D, ByVal source As Rectangle, ByVal position As Vector3, ByVal size As Vector2, ByVal tint As Color) ' 绘制由源矩形定义的公告牌纹理
Declare Sub DrawBillboardPro(ByVal camera As Camera, ByVal texture As Texture2D, ByVal source As Rectangle, ByVal position As Vector3, ByVal up As Vector3, ByVal SIZE As Vector2, ByVal origin As Vector2, ByVal rotation As Single, ByVal tint As Color) ' 绘制由源矩形和旋转定义的公告牌纹理
网格管理函数
Declare Sub UploadMesh(ByVal mesh As Mesh Ptr, ByVal dynamic As BOOLEAN) ' 将网格顶点数据上传到 GPU 并提供 VAO/VBO ID
Declare Sub UpdateMeshBuffer(ByVal mesh As Mesh, ByVal index As Integer, ByVal Data As Any Ptr, ByVal dataSize As Integer, ByVal offset As Integer) ' 更新 GPU 中特定缓冲区索引的网格顶点数据
Declare Sub UnloadMesh(ByVal mesh As Mesh) ' 从 CPU 和 GPU 卸载网格数据
Declare Sub DrawMesh(ByVal mesh As Mesh, ByVal material As Material, ByVal transform As Matrix) ' 使用材质和变换绘制 3D 网格
Declare Sub DrawMeshInstanced(ByVal mesh As Mesh, ByVal material As Material, ByVal transforms As Matrix Ptr, ByVal instances As Integer) ' 使用材质和不同的变换绘制多个网格实例
Declare Function GetMeshBoundingBox(ByVal mesh As Mesh) As BoundingBox ' 计算网格的边界框限制
Declare Sub GenMeshTangents(ByVal mesh As Mesh Ptr) ' 计算网格的切线
Declare Function ExportMesh(ByVal mesh As Mesh, ByVal fileName As ZString Ptr) As BOOLEAN ' 将网格数据导出到文件,成功返回 True
Declare Function ExportMeshAsCode(ByVal mesh As Mesh, ByVal fileName As ZString Ptr) As Boolean ' 将网格导出为定义多个顶点属性数组的代码文件 (.h)
网格生成函数
Declare Function GenMeshPoly(ByVal sides As Integer, ByVal radius As Single) As Mesh ' 生成多边形网格
Declare Function GenMeshPlane(ByVal Width As Single, ByVal length As Single, ByVal resX As Integer, ByVal resZ As Integer) As Mesh ' 生成平面网格(带细分)
Declare Function GenMeshCube(ByVal Width As Single, ByVal height As Single, ByVal length As Single) As Mesh ' 生成长方体网格
Declare Function GenMeshSphere(ByVal radius As Single, ByVal rings As Integer, ByVal slices As Integer) As Mesh ' 生成球体网格(标准球体)
Declare Function GenMeshHemiSphere(ByVal radius As Single, ByVal rings As Integer, ByVal slices As Integer) As Mesh ' 生成半球体网格(无底部面)
Declare Function GenMeshCylinder(ByVal radius As Single, ByVal height As Single, ByVal slices As Integer) As Mesh ' 生成圆柱体网格
Declare Function GenMeshCone(ByVal radius As Single, ByVal height As Single, ByVal slices As Integer) As Mesh ' 生成圆锥/棱锥网格
Declare Function GenMeshTorus(ByVal radius As Single, ByVal SIZE As Single, ByVal radSeg As Integer, ByVal sides As Integer) As Mesh ' 生成圆环体网格
Declare Function GenMeshKnot(ByVal radius As Single, ByVal size As Single, ByVal radSeg As Integer, ByVal sides As Integer) As Mesh ' 生成三叶结网格
Declare Function GenMeshHeightmap(ByVal heightmap As Image, ByVal SIZE As Vector3) As Mesh ' 根据图像数据生成高度图网格
Declare Function GenMeshCubicmap(ByVal cubicmap As Image, ByVal cubeSize As Vector3) As Mesh ' 根据图像数据生成基于立方体的地图网格
材质加载/卸载函数
Declare Function LoadMaterials(ByVal fileName As ZString Ptr, ByVal materialCount As Integer Ptr) As Material Ptr ' 从模型文件加载材质
Declare Function LoadMaterialDefault() As Material ' 加载默认材质(支持:漫反射、高光、法线贴图)
Declare Function IsMaterialValid(ByVal material As Material) As Boolean ' 检查材质是否有效(已分配着色器,贴图纹理已加载到 GPU)
Declare Sub UnloadMaterial(ByVal material As Material) ' 从 GPU 内存(VRAM)卸载材质
Declare Sub SetMaterialTexture(ByVal material As Material Ptr, ByVal mapType As Integer, ByVal texture As Texture2D) ' 为材质的特定贴图类型(如 MATERIAL_MAP_DIFFUSE、MATERIAL_MAP_SPECULAR 等)设置纹理
Declare Sub SetModelMeshMaterial(ByVal model As Model Ptr, ByVal meshId As Integer, ByVal materialId As Integer) ' 为网格设置材质
模型动画加载/卸载函数
Declare Function LoadModelAnimations(ByVal fileName As ZString Ptr, ByVal animCount As Integer Ptr) As ModelAnimation Ptr ' 从文件加载模型动画
Declare Sub UpdateModelAnimation(ByVal model As Model, ByVal anim As ModelAnimation, ByVal frame As Integer) ' 更新模型动画姿势(CPU 端)
Declare Sub UpdateModelAnimationBones(ByVal model As Model, ByVal anim As ModelAnimation, ByVal frame As Integer) ' 更新模型动画的网格骨骼矩阵(GPU 蒙皮)
Declare Sub UnloadModelAnimation(ByVal anim As ModelAnimation) ' 卸载动画数据
Declare Sub UnloadModelAnimations(ByVal animations As ModelAnimation Ptr, ByVal animCount As Integer) ' 卸载动画数组数据
Declare Function IsModelAnimationValid(ByVal model As Model, ByVal anim As ModelAnimation) As Boolean ' 检查模型动画骨骼是否匹配
碰撞检测函数
Declare Function CheckCollisionSpheres(ByVal center1 As Vector3, ByVal radius1 As Single, ByVal center2 As Vector3, ByVal radius2 As Single) As Boolean ' 检查两个球体之间是否发生碰撞
Declare Function CheckCollisionBoxes(ByVal box1 As BoundingBox, ByVal box2 As BoundingBox) As Boolean ' 检查两个边界框之间是否发生碰撞
Declare Function CheckCollisionBoxSphere(ByVal box As BoundingBox, ByVal center As Vector3, ByVal radius As Single) As Boolean ' 检查边界框和球体之间是否发生碰撞
Declare Function GetRayCollisionSphere(ByVal ray As Ray, ByVal center As Vector3, ByVal radius As Single) As RayCollision ' 获取射线与球体的碰撞信息
Declare Function GetRayCollisionBox(ByVal ray As Ray, ByVal box As BoundingBox) As RayCollision ' 获取射线与边界框的碰撞信息
Declare Function GetRayCollisionMesh(ByVal ray As Ray, ByVal mesh As Mesh, ByVal transform As Matrix) As RayCollision ' 获取射线与网格的碰撞信息
Declare Function GetRayCollisionTriangle(ByVal ray As Ray, ByVal p1 As Vector3, ByVal p2 As Vector3, ByVal p3 As Vector3) As RayCollision ' 获取射线与三角形的碰撞信息
Declare Function GetRayCollisionQuad(ByVal ray As Ray, ByVal p1 As Vector3, ByVal p2 As Vector3, ByVal p3 As Vector3, ByVal p4 As Vector3) As RayCollision ' 获取射线与四边形的碰撞信息
音频设备管理函数
Declare Sub InitAudioDevice() ' 初始化音频设备和上下文
Declare Sub CloseAudioDevice() ' 关闭音频设备和上下文
Declare Function IsAudioDeviceReady() As Boolean ' 检查音频设备是否已成功初始化
Declare Sub SetMasterVolume(ByVal volume As Single) ' 设置主音量(监听者)
Declare Function GetMasterVolume() As Single ' 获取主音量(监听者)
波形/声音加载/卸载函数
Declare Function LoadWave(ByVal fileName As ZString Ptr) As Wave ' 从文件加载波形数据
Declare Function LoadWaveFromMemory(ByVal fileType As ZString Ptr, ByVal fileData As UByte Ptr, ByVal dataSize As Integer) As Wave ' 从内存缓冲区加载波形,fileType 指文件扩展名,如 '.wav'
Declare Function IsWaveValid(ByVal wave As Wave) As BOOLEAN ' 检查波形数据是否有效(数据已加载且参数正确)
Declare Function LoadSound(ByVal fileName As ZString Ptr) As Sound ' 从文件加载声音
Declare Function LoadSoundFromWave(ByVal wave As Wave) As Sound ' 从波形数据加载声音
Declare Function LoadSoundAlias(ByVal source As Sound) As Sound ' 创建一个新声音,该声音与源声音共享相同的样本数据,不拥有声音数据
Declare Function IsSoundValid(ByVal sound As Sound) As Boolean ' 检查声音是否有效(数据已加载且缓冲区已初始化)
Declare Sub UpdateSound(ByVal sound As Sound, ByVal data As Any Ptr, ByVal sampleCount As Integer) ' 用新数据更新声音缓冲区
Declare Sub UnloadWave(ByVal wave As Wave) ' 卸载波形数据
Declare Sub UnloadSound(ByVal sound As Sound) ' 卸载声音
Declare Sub UnloadSoundAlias(ByVal alias As Sound) ' 卸载声音别名(不释放样本数据)
Declare Function ExportWave(ByVal wave As Wave, ByVal fileName As ZString Ptr) As Boolean ' 将波形数据导出到文件,成功返回 True
Declare Function ExportWaveAsCode(ByVal wave As Wave, ByVal fileName As ZString Ptr) As Boolean ' 将波形样本数据导出到代码文件 (.h),成功返回 True
波形/声音管理函数
Declare Sub PlaySound(ByVal sound As Sound) ' 播放一个声音
Declare Sub StopSound(ByVal sound As Sound) ' 停止播放一个声音
Declare Sub PauseSound(ByVal sound As Sound) ' 暂停一个声音
Declare Sub ResumeSound(ByVal sound As Sound) ' 恢复暂停的声音
Declare Function IsSoundPlaying(ByVal sound As Sound) As Boolean ' 检查一个声音当前是否正在播放
Declare Sub SetSoundVolume(ByVal sound As Sound, ByVal volume As Single) ' 设置一个声音的音量(1.0 为最大级别)
Declare Sub SetSoundPitch(ByVal sound As Sound, ByVal pitch As Single) ' 设置一个声音的音高(1.0 为基础级别)
Declare Sub SetSoundPan(ByVal sound As Sound, ByVal pan As Single) ' 设置一个声音的声像(0.5 为中心)
Declare Function WaveCopy(ByVal wave As Wave) As Wave ' 将一个波形复制到一个新的波形
Declare Sub WaveCrop(ByVal wave As Wave Ptr, ByVal initFrame As Integer, ByVal finalFrame As Integer) ' 将一个波形裁剪到指定的帧范围
Declare Sub WAVEFORMAT(ByVal wave As Wave Ptr, ByVal sampleRate As Integer, ByVal sampleSize As Integer, ByVal channels As Integer) ' 将波形数据转换为所需的格式
Declare Function LoadWaveSamples(ByVal wave As Wave) As Single Ptr ' 从波形中加载样本数据作为 32 位浮点数据数组
Declare Sub UnloadWaveSamples(ByVal samples As Single Ptr) ' 卸载使用 LoadWaveSamples() 加载的样本数据
音乐管理函数
Declare Function LoadMusicStream(ByVal fileName As ZString Ptr) As Music ' 从文件加载音乐流
Declare Function LoadMusicStreamFromMemory(ByVal fileType As ZString Ptr, ByVal Data As UByte Ptr, ByVal dataSize As Integer) As Music ' 从数据加载音乐流
Declare Function IsMusicValid(ByVal music As Music) As Boolean ' 检查音乐流是否有效(上下文和缓冲区已初始化)
Declare Sub UnloadMusicStream(ByVal music As Music) ' 卸载音乐流
Declare Sub PlayMusicStream(ByVal music As Music) ' 开始播放音乐
Declare Function IsMusicStreamPlaying(ByVal music As Music) As Boolean ' 检查音乐是否正在播放
Declare Sub UpdateMusicStream(ByVal music As Music) ' 更新音乐流的缓冲区
Declare Sub StopMusicStream(ByVal music As Music) ' 停止播放音乐
Declare Sub PauseMusicStream(ByVal music As Music) ' 暂停播放音乐
Declare Sub ResumeMusicStream(ByVal music As Music) ' 恢复播放暂停的音乐
Declare Sub SeekMusicStream(ByVal music As Music, ByVal position As Single) ' 将音乐定位到指定位置(以秒为单位)
Declare Sub SetMusicVolume(ByVal music As Music, ByVal volume As Single) ' 设置音乐的音量(1.0 为最大级别)
Declare Sub SetMusicPitch(ByVal music As Music, ByVal pitch As Single) ' 设置音乐的音高(1.0 为基础级别)
Declare Sub SetMusicPan(ByVal music As Music, ByVal pan As Single) ' 设置音乐的声像(0.5 为中心)
Declare Function GetMusicTimeLength(ByVal music As Music) As Single ' 获取音乐的总时长(以秒为单位)
Declare Function GetMusicTimePlayed(ByVal music As Music) As Single ' 获取当前音乐已播放的时长(以秒为单位)
音频流管理函数
Declare Function LoadAudioStream(ByVal sampleRate As UInteger, ByVal sampleSize As UInteger, ByVal channels As UInteger) As AudioStream ' 加载音频流(用于流式传输原始音频 PCM 数据)
Declare Function IsAudioStreamValid(ByVal stream As AudioStream) As Boolean ' 检查音频流是否有效(缓冲区已初始化)
Declare Sub UnloadAudioStream(ByVal stream As AudioStream) ' 卸载音频流并释放内存
Declare Sub UpdateAudioStream(ByVal stream As AudioStream, ByVal data As Any Ptr, ByVal frameCount As Integer) ' 用数据更新音频流缓冲区
Declare Function IsAudioStreamProcessed(ByVal stream As AudioStream) As Boolean ' 检查是否有音频流缓冲区需要重新填充
Declare Sub PlayAudioStream(ByVal stream As AudioStream) ' 播放音频流
Declare Sub PauseAudioStream(ByVal stream As AudioStream) ' 暂停音频流
Declare Sub ResumeAudioStream(ByVal stream As AudioStream) ' 恢复音频流
Declare Function IsAudioStreamPlaying(ByVal stream As AudioStream) As Boolean ' 检查音频流是否正在播放
Declare Sub StopAudioStream(ByVal stream As AudioStream) ' 停止音频流
Declare Sub SetAudioStreamVolume(ByVal stream As AudioStream, ByVal volume As Single) ' 设置音频流的音量(1.0 为最大级别)
Declare Sub SetAudioStreamPitch(ByVal stream As AudioStream, ByVal pitch As Single) ' 设置音频流的音高(1.0 为基础级别)
Declare Sub SetAudioStreamPan(ByVal stream As AudioStream, ByVal pan As Single) ' 设置音频流的声像(0.5 为中心)
Declare Sub SetAudioStreamBufferSizeDefault(ByVal size As Integer) ' 设置新音频流的默认缓冲区大小
Declare Sub SetAudioStreamCallback(ByVal stream As AudioStream, ByVal callback As AudioCallback) ' 设置音频线程回调以请求新数据
Declare Sub AttachAudioStreamProcessor(ByVal stream As AudioStream, ByVal processor As AudioCallback) ' 将音频流处理器附加到音频流,接收帧 x 2 个样本作为 'float'(立体声)
Declare Sub DetachAudioStreamProcessor(ByVal stream As AudioStream, ByVal processor As AudioCallback) ' 从音频流中分离音频流处理器
Declare Sub AttachAudioMixedProcessor(ByVal processor As AudioCallback) ' 将音频流处理器附加到整个音频管道,接收帧 x 2 个样本作为 'float'(立体声)
Declare Sub DetachAudioMixedProcessor(ByVal processor As AudioCallback) ' 从整个音频管道中分离音频流处理器
支持多种相机模式的基本相机系统
Declare Function GetCameraForward(ByVal Camera As Camera Ptr) As Vector3 '返回相机前向矢量(归一化)
Declare Function GetCameraUp(ByVal Camera As Camera Ptr) As Vector3 '返回相机上方向矢量(归一化)注意:向上矢量可能不垂直于向前矢量
Declare Function GetCameraRight(ByVal Camera As Camera Ptr) As Vector3 '返回相机右向量(归一化)
Declare Sub CameraMoveForward(ByVal Camera As Camera Ptr, ByVal distance As Single, ByVal moveInWorldPlane As BOOL) '向前移动相机
Declare Sub CameraMoveUp(ByVal Camera As Camera Ptr, ByVal distance As Single) '向上移动相机
Declare Sub CameraMoveRight(ByVal Camera As Camera Ptr, ByVal distance As Single, ByVal moveInWorldPlane As BOOL) '在当前右侧方向上移动相机目标
Declare Sub CameraMoveToTarget(ByVal Camera As Camera Ptr, ByVal delta As Single) '将相机位置移动到离相机目标较近/较远的位置
Declare Sub CameraYaw(ByVal Camera As Camera Ptr, ByVal angle As Single, ByVal rotateAroundTarget As BOOL) '围绕相机的上方向向量旋转相机 //偏航是“左右看”//如果rotateRoundTarget为false,则摄影机将围绕其位置旋转//注意:角度必须以弧度为单位
Declare Sub CameraPitch(ByVal Camera As Camera Ptr, ByVal angle As Single, ByVal lockView As BOOL, ByVal rotateAroundTarget As BOOL, ByVal rotateUp As BOOL) '围绕其右矢量旋转相机,俯仰为“上下观察”//-lockView可防止相机过度旋转(也称为“空翻”)//-rotateRoundTarget定义旋转是围绕目标还是围绕其位置//-rotateUp也向上旋转方向(通常仅在CAMERA_FREE中使用full)//注:角度必须以弧度为单位
Declare Sub CameraRoll(ByVal Camera As Camera Ptr, ByVal angle As Single) '围绕相机的前向矢量旋转相机//翻滚是“将你的头侧向左侧或右侧”//注意:角度必须以弧度为单位
Declare Function GetCameraViewMatrix(ByVal Camera As Camera Ptr) As Matrix '返回相机视图矩阵
Declare Function GetCameraProjectionMatrix(ByVal Camera As Camera Ptr, ByVal aspect As Single) As Matrix '返回相机投影矩阵
矩阵
Declare Sub rlMatrixMode (ByVal mode As Integer) ' 选择当前要进行变换的矩阵
Declare Sub rlPushMatrix () ' 将当前矩阵压入栈中
Declare Sub rlPopMatrix () ' 从栈中弹出最近压入的矩阵
Declare Sub rlLoadIdentity () ' 将当前矩阵重置为单位矩阵
Declare Sub rlTranslatef (ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 用一个平移矩阵乘以当前矩阵
Declare Sub rlRotatef (ByVal angle As Single, ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 用一个旋转矩阵乘以当前矩阵
Declare Sub rlScalef (ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 用一个缩放矩阵乘以当前矩阵
Declare Sub rlMultMatrixf (ByVal matf As Single Ptr) ' 用另一个矩阵乘以当前矩阵
Declare Sub rlFrustum (ByVal Left As Double, ByVal Right As Double, ByVal bottom As Double, ByVal top As Double, ByVal znear As Double, ByVal zfar As Double) ' 定义透视投影的视锥体
Declare Sub rlOrtho (ByVal Left As Double, ByVal Right As Double, ByVal bottom As Double, ByVal top As Double, ByVal znear As Double, ByVal zfar As Double) ' 定义正交投影的视锥体
Declare Sub rlViewport (ByVal x As Integer, ByVal y As Integer, ByVal Width As Integer, ByVal height As Integer) ' 设置视口区域
Declare Sub rlSetClipPlanes (ByVal nearPlane As Double, ByVal farPlane As Double) ' 设置裁剪平面的距离
Declare Function rlGetCullDistanceNear () As Double ' 获取近裁剪平面的距离
Declare Function rlGetCullDistanceFar () As Double ' 获取远裁剪平面的距离
顶点级操作
'//------------------------------------------------------------------------------------
Declare Sub rlBegin(ByVal mode As Integer) ' 初始化绘图模式(如何组织顶点)
''mode 说明:
''RL_LINES 每两个顶点会被连接成一条线段。例如,传入四个顶点 (x1, y1, z1)、(x2, y2, z2)、(x3, y3, z3) 和 (x4, y4, z4),就会绘制两条线段,分别是连接 (x1, y1, z1) 和 (x2, y2, z2) 的线段,以及连接 (x3, y3, z3) 和 (x4, y4, z4) 的线段。
''RL_TRIANGLES 每三个顶点会构成一个三角形。若传入六个顶点,就会绘制两个三角形。
''RL_QUADS 每四个顶点会被组合成一个四边形。如果提供了多于四个的顶点,将按照每四个一组依次绘制多个四边形。
Declare Sub rlEnd () ' 结束顶点提供
Declare Sub rlVertex2i (ByVal x As Integer, ByVal y As Integer) ' 定义一个顶点(位置) - 2 个整数
Declare Sub rlVertex2f (ByVal x As Single, ByVal y As Single) ' 定义一个顶点(位置) - 2 个单精度浮点数
Declare Sub rlVertex3f (ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 定义一个顶点(位置) - 3 个单精度浮点数
Declare Sub rlTexCoord2f (ByVal x As Single, ByVal y As Single) ' 定义一个顶点(纹理坐标) - 2 个单精度浮点数
Declare Sub rlNormal3f (ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 定义一个顶点(法线) - 3 个单精度浮点数
Declare Sub rlColor4ub (ByVal r As UByte, ByVal g As UByte, ByVal b As UByte, ByVal a As UByte) ' 定义一个顶点(颜色) - 4 个无符号字节
Declare Sub rlColor3f (ByVal x As Single, ByVal y As Single, ByVal z As Single) ' 定义一个顶点(颜色) - 3 个单精度浮点数
Declare Sub rlColor4f (ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal w As Single) ' 定义一个顶点(颜色) - 4 个单精度浮点数
顶点缓冲区状态
Declare Function rlEnableVertexArray (ByVal vaoId As UInteger) As BOOLEAN ' 启用顶点数组(如果支持 VAO)
Declare Sub rlDisableVertexArray () ' 禁用顶点数组(如果支持 VAO)
Declare Sub rlEnableVertexBuffer (ByVal id As UInteger) ' 启用顶点缓冲区(VBO)
Declare Sub rlDisableVertexBuffer () ' 禁用顶点缓冲区(VBO)
Declare Sub rlEnableVertexBufferElement (ByVal id As UInteger) ' 启用顶点缓冲区元素(VBO 元素)
Declare Sub rlDisableVertexBufferElement () ' 禁用顶点缓冲区元素(VBO 元素)
Declare Sub rlEnableVertexAttribute (ByVal index As UInteger) ' 启用顶点属性索引
Declare Sub rlDisableVertexAttribute (ByVal index As UInteger) ' 禁用顶点属性索引
纹理状态
Declare Sub rlActiveTextureSlot (ByVal slot As Integer) ' 选择并激活一个纹理插槽
Declare Sub rlEnableTexture (ByVal id As UInteger) ' 启用纹理
Declare Sub rlDisableTexture () ' 禁用纹理
Declare Sub rlEnableTextureCubemap (ByVal id As UInteger) ' 启用立方体纹理
Declare Sub rlDisableTextureCubemap () ' 禁用立方体纹理
Declare Sub rlTextureParameters (ByVal id As UInteger, ByVal param As Integer, ByVal value As Integer) ' 设置纹理参数(过滤、环绕模式)
Declare Sub rlCubemapParameters(ByVal id As UInteger, ByVal param As Integer, ByVal value As Integer) ' 设置立方体纹理参数(过滤、环绕模式)
着色器状态
Declare Sub rlEnableShader (ByVal id As UInteger) ' 启用着色器程序
Declare Sub rlDisableShader () ' 禁用着色器程序
帧缓冲区状态
Declare Sub rlEnableFramebuffer (ByVal id As UInteger) ' 启用渲染纹理(帧缓冲对象 FBO)
Declare Sub rlDisableFramebuffer () ' 禁用渲染纹理(FBO),返回默认帧缓冲区
Declare Function rlGetActiveFramebuffer () As UInteger ' 获取当前活动的渲染纹理(FBO),0 表示默认帧缓冲区
Declare Sub rlActiveDrawBuffers (ByVal count As Integer) ' 激活多个绘制颜色缓冲区
Declare Sub rlBlitFramebuffer (ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcWidth As Integer, ByVal srcHeight As Integer, ByVal dstX As Integer, ByVal dstY As Integer, ByVal dstWidth As Integer, ByVal dstHeight As Integer, ByVal bufferMask As Integer) ' 将活动帧缓冲区复制到主帧缓冲区
Declare Sub rlBindFramebuffer (ByVal target As UInteger, ByVal framebuffer As UInteger) ' 绑定帧缓冲区(FBO)
通用渲染状态
Declare Sub rlEnableColorBlend () ' 启用颜色混合
Declare Sub rlDisableColorBlend () ' 禁用颜色混合
Declare Sub rlEnableDepthTest () ' 启用深度测试
Declare Sub rlDisableDepthTest () ' 禁用深度测试
Declare Sub rlEnableDepthMask () ' 启用深度写入
Declare Sub rlDisableDepthMask () ' 禁用深度写入
Declare Sub rlEnableBackfaceCulling () ' 启用背面剔除
Declare Sub rlDisableBackfaceCulling () ' 禁用背面剔除
Declare Sub rlColorMask (ByVal r As Boolean, ByVal g As Boolean, ByVal b As Boolean, ByVal a As Boolean) ' 颜色掩码控制
Declare Sub rlSetCullFace (ByVal mode As Integer) ' 设置面剔除模式
Declare Sub rlEnableScissorTest () ' 启用裁剪测试
Declare Sub rlDisableScissorTest () ' 禁用裁剪测试
Declare Sub rlScissor (ByVal x As Integer, ByVal y As Integer, ByVal Width As Integer, ByVal height As Integer) ' 裁剪测试
Declare Sub rlEnablePointMode () ' 启用点模式
Declare Sub rlDisablePointMode () ' 禁用点模式
Declare Sub rlEnableWireMode () ' 启用线框模式
Declare Sub rlDisableWireMode () ' 禁用线框模式
Declare Sub rlSetLineWidth (ByVal Width As Single) ' 设置线条绘制宽度
Declare Function rlGetLineWidth () As Single ' 获取线条绘制宽度
Declare Sub rlEnableSmoothLines () ' 启用线条抗锯齿
Declare Sub rlDisableSmoothLines () ' 禁用线条抗锯齿
Declare Sub rlEnableStereoRender () ' 启用立体渲染
Declare Sub rlDisableStereoRender () ' 禁用立体渲染
Declare Function rlIsStereoRenderEnabled () As Boolean ' 检查是否启用了立体渲染
Declare Sub rlClearColor (ByVal r As Byte, ByVal g As Byte, ByVal b As Byte, ByVal a As Byte) ' 用指定颜色清除颜色缓冲区
Declare Sub rlClearScreenBuffers () ' 清除使用的屏幕缓冲区(颜色和深度)
Declare Sub rlCheckErrors () ' 检查并记录 OpenGL 错误代码
Declare Sub rlSetBlendMode (ByVal mode As Integer) ' 设置混合模式
Declare Sub rlSetBlendFactors (ByVal glSrcFactor As Integer, ByVal glDstFactor As Integer, ByVal glEquation As Integer) ' 设置混合模式因子和方程(使用 OpenGL 因子)
Declare Sub rlSetBlendFactorsSeparate (ByVal glSrcRGB As Integer, ByVal glDstRGB As Integer, ByVal glSrcAlpha As Integer, ByVal glDstAlpha As Integer, ByVal glEqRGB As Integer, ByVal glEqAlpha As Integer) ' 分别设置混合模式因子和方程(使用 OpenGL 因子)
rlgl 初始化函数
Declare Sub rlglInit (ByVal width As Integer, ByVal height As Integer) ' 初始化 rlgl(缓冲区、着色器、纹理、状态)
Declare Sub rlglClose () ' 反初始化 rlgl(缓冲区、着色器、纹理)
Declare Sub rlLoadExtensions (ByVal loader As Any Ptr) ' 加载 OpenGL 扩展(需要加载器函数)
Declare Function rlGetVersion () As Integer ' 获取当前 OpenGL 版本
Declare Sub rlSetFramebufferWidth (ByVal width As Integer) ' 设置当前帧缓冲区宽度
Declare Function rlGetFramebufferWidth () As Integer ' 获取默认帧缓冲区宽度
Declare Sub rlSetFramebufferHeight (ByVal height As Integer) ' 设置当前帧缓冲区高度
Declare Function rlGetFramebufferHeight () As Integer ' 获取默认帧缓冲区高度
Declare Function rlGetTextureIdDefault () As UInteger ' 获取默认纹理 ID
Declare Function rlGetShaderIdDefault () As UInteger ' 获取默认着色器 ID
Declare Function rlGetShaderLocsDefault () As Integer Ptr ' 获取默认着色器位置
渲染批次管理
' 注意:rlgl 提供了一个默认的渲染批次,以实现类似 OpenGL 1.1 的立即模式
' 但此渲染批次 API 是公开的,以防需要自定义批次
Declare Function rlLoadRenderBatch (ByVal numBuffers As Integer, ByVal bufferElements As Integer) As rlRenderBatch ' 加载一个渲染批次系统
Declare Sub rlUnloadRenderBatch (ByVal batch As rlRenderBatch) ' 卸载渲染批次系统
Declare Sub rlDrawRenderBatch (ByVal batch As rlRenderBatch Ptr) ' 绘制渲染批次数据(更新 -> 绘制 -> 重置)
Declare Sub rlSetRenderBatchActive (ByVal batch As rlRenderBatch Ptr) ' 设置 rlgl 的活动渲染批次(NULL 表示使用默认内部批次)
Declare Sub rlDrawRenderBatchActive () ' 更新并绘制内部渲染批次
Declare Function rlCheckRenderBatchLimit (ByVal vCount As Integer) As Boolean ' 检查给定顶点数量下的内部缓冲区溢出情况
Declare Sub rlSetTexture (ByVal id As UInteger) ' 为渲染批次设置当前纹理并检查缓冲区限制
顶点缓冲区管理
Declare Function rlLoadVertexArray () As UInteger ' 若支持,加载顶点数组(VAO)
Declare Function rlLoadVertexBuffer (ByVal buffer As Any Ptr, ByVal SIZE As Integer, ByVal dynamic As BOOLEAN) As UInteger ' 加载一个顶点缓冲区对象
Declare Function rlLoadVertexBufferElement (ByVal buffer As Any Ptr, ByVal SIZE As Integer, ByVal dynamic As Boolean) As UInteger ' 加载顶点缓冲区元素对象
Declare Sub rlUpdateVertexBuffer (ByVal bufferId As UInteger, ByVal Data As Any Ptr, ByVal dataSize As Integer, ByVal offset As Integer) ' 更新 GPU 缓冲区上的顶点缓冲区对象数据
Declare Sub rlUpdateVertexBufferElements (ByVal id As UInteger, ByVal Data As Any Ptr, ByVal dataSize As Integer, ByVal offset As Integer) ' 更新 GPU 缓冲区上的顶点缓冲区元素数据
Declare Sub rlUnloadVertexArray (ByVal vaoId As UInteger) ' 卸载顶点数组(VAO)
Declare Sub rlUnloadVertexBuffer (ByVal vboId As UInteger) ' 卸载顶点缓冲区对象
Declare Sub rlSetVertexAttribute (ByVal index As UInteger, ByVal compSize As Integer, ByVal type As Integer, ByVal normalized As Boolean, ByVal stride As Integer, ByVal offset As Integer) ' 设置顶点属性数据配置
Declare Sub rlSetVertexAttributeDivisor (ByVal index As UInteger, ByVal divisor As Integer) ' 设置顶点属性数据除数
Declare Sub rlSetVertexAttributeDefault (ByVal locIndex As Integer, ByVal value As Any Ptr, ByVal attribType As Integer, ByVal count As Integer) ' 当未提供属性时,设置顶点属性默认值
Declare Sub rlDrawVertexArray (ByVal offset As Integer, ByVal count As Integer) ' 绘制顶点数组(当前活动的 VAO)
Declare Sub rlDrawVertexArrayElements (ByVal offset As Integer, ByVal count As Integer, ByVal buffer As Any Ptr) ' 绘制顶点数组元素
Declare Sub rlDrawVertexArrayInstanced (ByVal offset As Integer, ByVal count As Integer, ByVal instances As Integer) ' 使用实例化绘制顶点数组(当前活动的 VAO)
Declare Sub rlDrawVertexArrayElementsInstanced (ByVal offset As Integer, ByVal count As Integer, ByVal buffer As Any Ptr, ByVal instances As Integer) ' 使用实例化绘制顶点数组元素
纹理管理
Declare Function rlLoadTexture (ByVal Data As Any Ptr, ByVal Width As Integer, ByVal height As Integer, ByVal Format As Integer, ByVal mipmapCount As Integer) As UInteger ' 加载纹理数据
Declare Function rlLoadTextureDepth (ByVal Width As Integer, ByVal height As Integer, ByVal useRenderBuffer As BOOLEAN) As UInteger ' 加载深度纹理/渲染缓冲区(用于附加到 FBO)
Declare Function rlLoadTextureCubemap (ByVal data As Any Ptr, ByVal size As Integer, ByVal format As Integer, ByVal mipmapCount As Integer) As UInteger ' 加载立方体纹理数据
Declare Sub rlUpdateTexture (ByVal id As UInteger, ByVal offsetX As Integer, ByVal offsetY As Integer, ByVal Width As Integer, ByVal height As Integer, ByVal Format As Integer, ByVal Data As Any Ptr) ' 在 GPU 上用新数据更新纹理
Declare Sub rlGetGlTextureFormats (ByVal Format As Integer, ByVal glInternalFormat As UInteger Ptr, ByVal glFormat As UInteger Ptr, ByVal glType As UInteger Ptr) ' 获取 OpenGL 内部格式
Declare Function rlGetPixelFormatName (ByVal Format As UInteger) As ZString Ptr ' 获取像素格式的名称字符串
Declare Sub rlUnloadTexture (ByVal id As UInteger) ' 从 GPU 内存中卸载纹理
Declare Sub rlGenTextureMipmaps (ByVal id As UInteger, ByVal width As Integer, ByVal height As Integer, ByVal format As Integer, ByVal mipmaps As Integer Ptr) ' 为选定的纹理生成 Mipmap 数据
Declare Function rlReadTexturePixels (ByVal id As UInteger, ByVal width As Integer, ByVal height As Integer, ByVal format As Integer) As Any Ptr ' 读取纹理像素数据
Declare Function rlReadScreenPixels (ByVal Width As Integer, ByVal height As Integer) As Byte Ptr ' 读取屏幕像素数据(颜色缓冲区)
帧缓冲区管理(FBO)
'Declare Function rlLoadFramebuffer () As UInteger ' 加载一个空的帧缓冲区
Declare Sub rlFramebufferAttach (ByVal fboId As UInteger, ByVal texId As UInteger, ByVal attachType As Integer, ByVal texType As Integer, ByVal mipLevel As Integer) ' 将纹理/渲染缓冲区附加到帧缓冲区
Declare Function rlFramebufferComplete (ByVal id As UInteger) As Boolean ' 验证帧缓冲区是否完整
Declare Sub rlUnloadFramebuffer (ByVal id As UInteger) ' 从 GPU 删除帧缓冲区
Declare Function rlLoadFramebuffer(ByVal Width As Long, ByVal height As Long) As ULong
着色器管理
Declare Function rlLoadShaderCode (ByVal vsCode As ZString Ptr, ByVal fsCode As ZString Ptr) As UInteger ' 从代码字符串加载着色器
Declare Function rlCompileShader (ByVal shaderCode As ZString Ptr, ByVal type As Integer) As UInteger ' 编译自定义着色器并返回着色器 ID(类型:RL_VERTEX_SHADER、RL_FRAGMENT_SHADER、RL_COMPUTE_SHADER)
Declare Function rlLoadShaderProgram (ByVal vShaderId As UInteger, ByVal fShaderId As UInteger) As UInteger ' 加载自定义着色器程序
Declare Sub rlUnloadShaderProgram (ByVal id As UInteger) ' 卸载着色器程序
Declare Function rlGetLocationUniform (ByVal shaderId As UInteger, ByVal uniformName As ZString Ptr) As Integer ' 获取着色器统一变量的位置
Declare Function rlGetLocationAttrib (ByVal shaderId As UInteger, ByVal attribName As ZString Ptr) As Integer ' 获取着色器属性的位置
Declare Sub rlSetUniform (ByVal locIndex As Integer, ByVal value As Any Ptr, ByVal uniformType As Integer, ByVal count As Integer) ' 设置着色器统一变量的值
Declare Sub rlSetUniformMatrix (ByVal locIndex As Integer, ByVal mat As Matrix) ' 设置着色器矩阵值
Declare Sub rlSetUniformMatrices (ByVal locIndex As Integer, ByVal mat As Matrix Ptr, ByVal count As Integer) ' 设置着色器多个矩阵值
Declare Sub rlSetUniformSampler (ByVal locIndex As Integer, ByVal textureId As UInteger) ' 设置着色器采样器的值
Declare Sub rlSetShader (ByVal id As UInteger, ByVal locs As Integer Ptr) ' 设置当前活动的着色器(ID 和位置)
计算着色器管理
Declare Function rlLoadComputeShaderProgram (ByVal shaderId As UInteger) As UInteger ' 加载计算着色器程序
Declare Sub rlComputeShaderDispatch(ByVal groupX As UInteger, ByVal groupY As UInteger, ByVal groupZ As UInteger) ' 调度计算着色器(相当于图形管线中的“绘制”操作)
着色器缓冲区存储对象管理(SSBO)
Declare Function rlLoadShaderBuffer (ByVal size As UInteger, ByVal data As Any Ptr, ByVal usageHint As Integer) As UInteger ' 加载着色器存储缓冲区对象(SSBO)
Declare Sub rlUnloadShaderBuffer (ByVal ssboId As UInteger) ' 卸载着色器存储缓冲区对象(SSBO)
Declare Sub rlUpdateShaderBuffer (ByVal id As UInteger, ByVal Data As Any Ptr, ByVal dataSize As UInteger, ByVal offset As UInteger) ' 更新 SSBO 缓冲区数据
Declare Sub rlBindShaderBuffer (ByVal id As UInteger, ByVal index As UInteger) ' 绑定 SSBO 缓冲区
Declare Sub rlReadShaderBuffer (ByVal id As UInteger, ByVal dest As Any Ptr, ByVal count As UInteger, ByVal offset As UInteger) ' 读取 SSBO 缓冲区数据(从 GPU 到 CPU)
Declare Sub rlCopyShaderBuffer (ByVal destId As UInteger, ByVal srcId As UInteger, ByVal destOffset As UInteger, ByVal srcOffset As UInteger, ByVal count As UInteger) ' 在缓冲区之间复制 SSBO 数据
Declare Function rlGetShaderBufferSize (ByVal id As UInteger) As UInteger ' 获取 SSBO 缓冲区大小
缓冲区管理
Declare Sub rlBindImageTexture (ByVal id As UInteger, ByVal index As UInteger, ByVal Format As Integer, ByVal readonly As Boolean) ' 绑定图像纹理
矩阵状态管理
Declare Function rlGetMatrixModelview () As Matrix ' 获取内部模型视图矩阵
Declare Function rlGetMatrixProjection () As Matrix ' 获取内部投影矩阵
Declare Function rlGetMatrixTransform () As Matrix ' 获取内部累积变换矩阵
Declare Function rlGetMatrixProjectionStereo (ByVal eye As Integer) As Matrix ' 获取用于立体渲染的内部投影矩阵(所选眼睛)
Declare Function rlGetMatrixViewOffsetStereo (ByVal eye As Integer) As Matrix ' 获取用于立体渲染的内部视图偏移矩阵(所选眼睛)
Declare Sub rlSetMatrixProjection (ByVal proj As Matrix) ' 设置自定义投影矩阵(替换内部投影矩阵)
Declare Sub rlSetMatrixModelview (ByVal View As Matrix) ' 设置自定义模型视图矩阵(替换内部模型视图矩阵)
Declare Sub rlSetMatrixProjectionStereo (ByVal Right As Matrix, ByVal Left As Matrix) ' 设置用于立体渲染的左右眼投影矩阵
Declare Sub rlSetMatrixViewOffsetStereo (ByVal Right As Matrix, ByVal Left As Matrix) ' 设置用于立体渲染的左右眼视图偏移矩阵
快速简易的立方体/四边形缓冲区加载->绘制->卸载
Declare Sub rlLoadDrawCube () ' 加载并绘制一个立方体
Declare Sub rlLoadDrawQuad() ' 加载并绘制一个四边形
评论一下?