mirror of
https://github.com/raysan5/raylib.git
synced 2026-05-26 14:40:27 -04:00
Compare commits
34 Commits
970531d112
...
6.0
| Author | SHA1 | Date | |
|---|---|---|---|
| dbc56a87da | |||
| 932558ca7a | |||
| 7495a77a79 | |||
| a4680fc677 | |||
| d6445b55d6 | |||
| d87bf55607 | |||
| a32b53f4d6 | |||
| cc752037b9 | |||
| 90e9145978 | |||
| 9060ac7c95 | |||
| 4ced756474 | |||
| 88f8ca42f5 | |||
| 9a3283f698 | |||
| f0a043bb75 | |||
| dde8c8e07e | |||
| 1cbe438f93 | |||
| 7c96c24cf9 | |||
| d116c92f13 | |||
| 14fe0cbfd8 | |||
| 94f3c094e7 | |||
| be768e27f9 | |||
| 6ef36c0a17 | |||
| 49f88dc6ed | |||
| 86aa0950bd | |||
| 96e30549f5 | |||
| 1e43c1d372 | |||
| 21897f4bb9 | |||
| d8ebeb8939 | |||
| 82e980bd42 | |||
| 0decdcd497 | |||
| 4628915787 | |||
| dfbaafa337 | |||
| 019cc889fc | |||
| 034ffda887 |
@ -17,7 +17,7 @@ KEY CHANGES:
|
||||
- New File System API
|
||||
- New Text Management API
|
||||
- New tool: [rexm] raylib examples manager
|
||||
- Added +50 new examples to learn from
|
||||
- Added +70 new examples to learn from
|
||||
|
||||
Detailed changes:
|
||||
|
||||
@ -115,6 +115,7 @@ Detailed changes:
|
||||
[rcore][GLFW] REVIEWED: `GetGamepadButtonPressed()`, return GAMEPAD_BUTTON_*_TRIGGER_2 if pressed (#4742) by @whaleymar
|
||||
[rcore][GLFW] REVIEWED: Update `mappings.h` using `GenerateMappings.cmake` by @sleeptightAnsiC
|
||||
[rcore][RGFW] ADDED: New backend option: `PLATFORM_WEB_RGFW` and update RGFW (#4480) by @colleagueRiley
|
||||
[rcore][RGFW] ADDED: Support for software rendering (#5773) by @CrackedPixel
|
||||
[rcore][RGFW] REVIEWED: Added missing Right Control key by @M374LX
|
||||
[rcore][RGFW] REVIEWED: Changed `RGFW_window_eventWait` timeout to -1 by @doggymangc
|
||||
[rcore][RGFW] REVIEWED: Duplicate entries removed from `keyMappingRGFW` (#5242) by @iamahuman1395
|
||||
@ -326,6 +327,7 @@ Detailed changes:
|
||||
[rmodels] REVIEWED: `DrawSphereEx()`, normals support (#4926) by @karl-zylinski
|
||||
[rmodels] REVIEWED: `ExportMesh()`, improve OBJ vertex data precision and lower memory usage (#4496) by @mikeemm
|
||||
[rmodels] REVIEWED: `CheckCollisionSpheres()`, simplified using `Vector3DistanceSqr()` (#5695) by @Bigfoot71
|
||||
[rmodels] REVIEWED: `CheckCollisionBoxSphere()`, improved performance and consistency (#5776) by @maiconpintoabreu
|
||||
[raudio] REVIEWED: Fix a glitch at the end of a sound (#5578) by @mackron
|
||||
[raudio] REVIEWED: Improvements to device configuration (#5577) by @mackron
|
||||
[raudio] REVIEWED: Initialize sound alias properties as if it was a new sound (#5123) by @JeffM2501
|
||||
@ -410,11 +412,12 @@ Detailed changes:
|
||||
[build][CMake] REVIEWED: Set `libm` as public so it can be linked by consumer (#5193) by @brccabral
|
||||
[build][Cmake] REVIEWED: Expose PLATFORM_WEB_RGFW (#5579) by @crisserpl2
|
||||
[build][Zig] ADDED: Android target to build by @lumenkeyes
|
||||
[build][Zig] REDESIGNED: Complete refactor of build.zig to support Zig 0.16.0 (#5764) by @HaxSam
|
||||
[build][Zig] REVIEWED: Link EGL for Android by @lumenkeyes
|
||||
[build][Zig] REVIEWED: Approach to build for web with zig-build (#5157) by @haxsam
|
||||
[build][Zig] REVIEWED: Fix build accessing env vars (#5490) by @iisakki
|
||||
[build][Zig] REVIEWED: Fix emscripten building by @johnnymarler
|
||||
[build][Zig] REVIWED: Move examples/build.zig into main build.zig by @johnnymarler
|
||||
[build][Zig] REVIEWED: Move examples/build.zig into main build.zig by @johnnymarler
|
||||
[build][Zig] REVIEWED: Fix raygui inclusion in windows crosscompilation (#4489) by @kimierik
|
||||
[build][Zig] REVIEWED: Issue on emscripten run if the user has not installed emsdk by @emilhakimov415
|
||||
[build][Zig] REVIEWED: Make X11 the default display backend instead of choosing at runtime (#5168) by @Not-Nik
|
||||
@ -462,6 +465,7 @@ Detailed changes:
|
||||
[examples] ADDED: `shapes_rlgl_triangle` example (#5353) by @robinsaviary
|
||||
[examples] ADDED: `shapes_starfield` (#5255) by @themushroompirates
|
||||
[examples] ADDED: `shapes_triangle_strip` (#5240) by @Jopestpe
|
||||
[examples] ADDED: `shapes_collision_ellipses` (#5722) by @Monjaris
|
||||
[examples] ADDED: `text_inline_styling` by @raysan5
|
||||
[examples] ADDED: `text_strings_management` (#5379) by @davidbuzatto
|
||||
[examples] ADDED: `text_words_alignment` (#5254) by @themushroompirates
|
||||
|
||||
@ -6,7 +6,7 @@ if(EMSCRIPTEN)
|
||||
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
|
||||
SET(PLATFORM Web CACHE STRING "Platform to build for.")
|
||||
endif()
|
||||
enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW" "Platform to build for.")
|
||||
enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.")
|
||||
|
||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")
|
||||
|
||||
|
||||
12
HISTORY.md
12
HISTORY.md
@ -530,10 +530,10 @@ A new `raylib` release is finally ready and, again, this is the **biggest `rayli
|
||||
|
||||
Some astonishing numbers for this release:
|
||||
|
||||
- **+320** closed issues (for a TOTAL of **+2140**!)
|
||||
- **+1950** commits since previous RELEASE (for a TOTAL of **+9700**!)
|
||||
- **+330** closed issues (for a TOTAL of **+2150**!)
|
||||
- **+2000** commits since previous RELEASE (for a TOTAL of **+9760**!)
|
||||
- **+20** new functions ADDED to raylib API (for a TOTAL of **600**!)
|
||||
- **+50** new examples to learn from (for a TOTAL of **+210**!)
|
||||
- **+70** new examples to learn from (for a TOTAL of **+215**!)
|
||||
- **+210** new contributors (for a TOTAL of **+850**!)
|
||||
|
||||
Highlights for `raylib 6.0`:
|
||||
@ -591,14 +591,14 @@ COMMANDS:
|
||||
update : Validate and update examples collection, generates report
|
||||
```
|
||||
|
||||
- **`NEW` +50 new examples**: Thanks to `rexm` and the simplification on examples management, this new raylib release includes +50 new examples to leearn from, most of them contributed by community.
|
||||
- **`NEW` +70 new examples**: Thanks to `rexm` and the simplification on examples management, this new raylib release includes +70 new examples to learn from, most of them contributed by community. Multiple examples have also been renamed for consistency and all examples header and structure have been reviewed and unified.
|
||||
|
||||
Make sure to check raylib [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) for a detailed list of changes!
|
||||
|
||||
I want to **thank all the contributors (+850!**) that along the years have **greatly improved raylib** and pushed it further and better day after day. And **many thanks to raylib community and all raylib users** for supporting the library along those many years.
|
||||
|
||||
Finally, I want to thank [puffer.ai](https://puffer.ai/) and [comma.ai](https://comma.ai/) for **supporting and sponsoring the project** as platinum sponsors, along many others individuals that have been sponsoring raylib along the years. Thanks to all of you for allowing me to keep working on this library!
|
||||
Finally, I want to thank [puffer.ai](https://puffer.ai/) and [comma.ai](https://comma.ai/) for **using raylib and supporting the project** as platinum sponsors, along many others individuals that have been sponsoring raylib along the years. Thanks to all of you for allowing me to keep working on this library!
|
||||
|
||||
**After +12 years of development, `raylib 6.0` is today one of the bests libraries to enjoy games/tools/graphic programming!**
|
||||
**After +12 years of development, `raylib 6.0` is today one of the bests libraries to enjoy games/tools/graphics programming!**
|
||||
|
||||
**Enjoy graphics programming with raylib!** :)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.{
|
||||
.name = .raylib,
|
||||
.version = "5.6.0-dev",
|
||||
.minimum_zig_version = "0.15.1",
|
||||
.version = "6.0.0",
|
||||
.minimum_zig_version = "0.16.0",
|
||||
|
||||
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
|
||||
|
||||
@ -11,6 +11,11 @@
|
||||
.hash = "N-V-__8AALShqgXkvqYU6f__FrA22SMWmi2TXCJjNTO1m8XJ",
|
||||
.lazy = true,
|
||||
},
|
||||
.raygui = .{
|
||||
.url = "git+https://github.com/raysan5/raygui#3b2855842ab578a034f827c38cf8f62c042fc983",
|
||||
.hash = "N-V-__8AAHvybwBw1kyBGn0BW_s1RqIpycNjLf_XbE-fpLUF",
|
||||
.lazy = true,
|
||||
},
|
||||
.emsdk = .{
|
||||
.url = "git+https://github.com/emscripten-core/emsdk#4.0.9",
|
||||
.hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ",
|
||||
|
||||
@ -156,6 +156,7 @@ elseif ("${PLATFORM}" STREQUAL "SDL")
|
||||
add_compile_definitions(USING_SDL2_PACKAGE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
elseif ("${PLATFORM}" STREQUAL "RGFW")
|
||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_RGFW")
|
||||
|
||||
@ -181,6 +182,15 @@ elseif ("${PLATFORM}" STREQUAL "WebRGFW")
|
||||
set(PLATFORM_CPP "PLATFORM_WEB_RGFW")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
|
||||
elseif ("${PLATFORM}" STREQUAL "Memory")
|
||||
set(PLATFORM_CPP "PLATFORM_MEMORY")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
|
||||
set(OPENGL_VERSION "Software")
|
||||
|
||||
if(WIN32 OR CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64")
|
||||
set(LIBS_PRIVATE winmm)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||
|
||||
@ -105,6 +105,9 @@ elseif ("${PLATFORM}" STREQUAL "DRM")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||
|
||||
elseif ("${PLATFORM}" MATCHES "Memory")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||
|
||||
elseif ("${OPENGL_VERSION}" STREQUAL "Software")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||
|
||||
@ -510,7 +510,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
|
||||
# Libraries for Windows desktop compilation
|
||||
LDFLAGS += -L..\src
|
||||
LDLIBS = -lraylib -lgdi32 -lwinmm -lshcore
|
||||
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
LDLIBS += -lopengl32
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software
|
||||
*
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
||||
133
examples/shapes/shapes_ellipse_collision.c
Normal file
133
examples/shapes/shapes_ellipse_collision.c
Normal file
@ -0,0 +1,133 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - ellipse collision
|
||||
*
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||
*
|
||||
* Example contributed by Ziya (@Monjaris)
|
||||
*
|
||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software
|
||||
*
|
||||
* Copyright (c) 2025 Ziya (@Monjaris)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include <math.h>
|
||||
|
||||
// Check if point is inside ellipse
|
||||
static bool CheckCollisionPointEllipse(Vector2 point, Vector2 center, float rx, float ry)
|
||||
{
|
||||
float dx = (point.x - center.x)/rx;
|
||||
float dy = (point.y - center.y)/ry;
|
||||
return (dx*dx + dy*dy) <= 1.0f;
|
||||
}
|
||||
|
||||
// Check if two ellipses collide
|
||||
// Uses radial boundary distance in the direction between centers — scales correctly with radii
|
||||
static bool CheckCollisionEllipses(Vector2 c1, float rx1, float ry1, Vector2 c2, float rx2, float ry2)
|
||||
{
|
||||
float dx = c2.x - c1.x;
|
||||
float dy = c2.y - c1.y;
|
||||
float dist = sqrtf(dx*dx + dy*dy);
|
||||
|
||||
// Ellipses are on top of each other
|
||||
if (dist == 0.0f) return true;
|
||||
|
||||
float theta = atan2f(dy, dx);
|
||||
float cosT = cosf(theta);
|
||||
float sinT = sinf(theta);
|
||||
|
||||
// Radial distance from center to ellipse boundary in direction theta
|
||||
// r(theta) = (rx * ry) / sqrt((ry*cos)^2 + (rx*sin)^2)
|
||||
float r1 = (rx1*ry1)/sqrtf((ry1*cosT)*(ry1*cosT) + (rx1*sinT)*(rx1*sinT));
|
||||
float r2 = (rx2*ry2)/sqrtf((ry2*cosT)*(ry2*cosT) + (rx2*sinT)*(rx2*sinT));
|
||||
|
||||
return dist <= (r1 + r2);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - collision ellipses");
|
||||
SetTargetFPS(60);
|
||||
|
||||
Vector2 ellipseACenter = { (float)screenWidth/4, (float)screenHeight/2 };
|
||||
float ellipseARx = 120.0f;
|
||||
float ellipseARy = 70.0f;
|
||||
|
||||
Vector2 ellipseBCenter = { (float)screenWidth*3/4, (float)screenHeight/2 };
|
||||
float ellipseBRx = 90.0f;
|
||||
float ellipseBRy = 140.0f;
|
||||
|
||||
// 0 = controlling A, 1 = controlling B
|
||||
int controlled = 0;
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_A)) controlled = 0;
|
||||
if (IsKeyPressed(KEY_B)) controlled = 1;
|
||||
|
||||
if (controlled == 0) ellipseACenter = GetMousePosition();
|
||||
else ellipseBCenter = GetMousePosition();
|
||||
|
||||
bool ellipsesCollide = CheckCollisionEllipses(
|
||||
ellipseACenter, ellipseARx, ellipseARy,
|
||||
ellipseBCenter, ellipseBRx, ellipseBRy
|
||||
);
|
||||
|
||||
bool mouseInA = CheckCollisionPointEllipse(GetMousePosition(), ellipseACenter, ellipseARx, ellipseARy);
|
||||
bool mouseInB = CheckCollisionPointEllipse(GetMousePosition(), ellipseBCenter, ellipseBRx, ellipseBRy);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawEllipse((int)ellipseACenter.x, (int)ellipseACenter.y, ellipseARx, ellipseARy, ellipsesCollide ? RED : BLUE);
|
||||
|
||||
DrawEllipse((int)ellipseBCenter.x, (int)ellipseBCenter.y, ellipseBRx, ellipseBRy, ellipsesCollide ? RED : GREEN);
|
||||
|
||||
DrawEllipseLines((int)ellipseACenter.x, (int)ellipseACenter.y, ellipseARx, ellipseARy, WHITE);
|
||||
|
||||
DrawEllipseLines((int)ellipseBCenter.x, (int)ellipseBCenter.y, ellipseBRx, ellipseBRy, WHITE);
|
||||
|
||||
DrawCircleV(ellipseACenter, 4, WHITE);
|
||||
DrawCircleV(ellipseBCenter, 4, WHITE);
|
||||
|
||||
if (ellipsesCollide) DrawText("ELLIPSES COLLIDE", screenWidth/2 - 120, 40, 28, RED);
|
||||
else DrawText("NO COLLISION", screenWidth/2 - 80, 40, 28, DARKGRAY);
|
||||
|
||||
DrawText(controlled == 0 ? "Controlling: A" : "Controlling: B", 20, screenHeight - 40, 20, YELLOW);
|
||||
|
||||
if (mouseInA && controlled != 0) DrawText("Mouse inside ellipse A", 20, screenHeight - 70, 20, BLUE);
|
||||
if (mouseInB && controlled != 1) DrawText("Mouse inside ellipse B", 20, screenHeight - 70, 20, GREEN);
|
||||
|
||||
DrawText("Press [A] or [B] to switch control", 20, 20, 20, GRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
CloseWindow();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
examples/shapes/shapes_ellipse_collision.png
Normal file
BIN
examples/shapes/shapes_ellipse_collision.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Binary file not shown.
@ -191,7 +191,7 @@
|
||||
<Overload retVal="const char" descr="Get clipboard text content"></Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetClipboardImage" func="yes">
|
||||
<Overload retVal="Image" descr="Get clipboard image"></Overload>
|
||||
<Overload retVal="Image" descr="Get clipboard image content"></Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="EnableEventWaiting" func="yes">
|
||||
<Overload retVal="void" descr="Enable waiting for events on EndDrawing(), no automatic event polling"></Overload>
|
||||
@ -360,7 +360,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetShaderValueTexture" func="yes">
|
||||
<Overload retVal="void" descr="Set shader uniform value for texture (sampler2d)">
|
||||
<Overload retVal="void" descr="Set shader uniform value and bind the texture (sampler2d)">
|
||||
<Param name="Shader shader" />
|
||||
<Param name="int locIndex" />
|
||||
<Param name="Texture2D texture" />
|
||||
@ -498,8 +498,12 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<!-- NOTE: Following functions implemented in module [utils] -->
|
||||
<!-------------------------------------------------------------------- -->
|
||||
<!-- Logging system -->
|
||||
<KeyWord name="SetTraceLogLevel" func="yes">
|
||||
<Overload retVal="void" descr="Set the current threshold (minimum) log level">
|
||||
<Param name="int logLevel" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TraceLog" func="yes">
|
||||
<Overload retVal="void" descr="Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)">
|
||||
<Param name="int logLevel" />
|
||||
@ -507,11 +511,13 @@
|
||||
<Param name="..." />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetTraceLogLevel" func="yes">
|
||||
<Overload retVal="void" descr="Set the current threshold (minimum) log level">
|
||||
<Param name="int logLevel" />
|
||||
<KeyWord name="SetTraceLogCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom trace log">
|
||||
<Param name="TraceLogCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<!-- Memory management, using internal allocators -->
|
||||
<KeyWord name="MemAlloc" func="yes">
|
||||
<Overload retVal="void" descr="Internal memory allocator">
|
||||
<Param name="unsigned int size" />
|
||||
@ -524,35 +530,7 @@
|
||||
<Overload retVal="void" descr="Internal memory free"></Overload>
|
||||
</KeyWord>
|
||||
|
||||
<!-- Set custom callbacks -->
|
||||
<!-- WARNING: Callbacks setup is intended for advanced users -->
|
||||
<KeyWord name="SetTraceLogCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom trace log">
|
||||
<Param name="TraceLogCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetLoadFileDataCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file binary data loader">
|
||||
<Param name="LoadFileDataCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetSaveFileDataCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file binary data saver">
|
||||
<Param name="SaveFileDataCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetLoadFileTextCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file text data loader">
|
||||
<Param name="LoadFileTextCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetSaveFileTextCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file text data saver">
|
||||
<Param name="SaveFileTextCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<!-- Files management functions -->
|
||||
<!-- File system management functions -->
|
||||
<KeyWord name="char *LoadFileData" func="yes">
|
||||
<Overload retVal="unsigned" descr="Load file data as byte array (read)">
|
||||
<Param name="const char *fileName" />
|
||||
@ -588,12 +566,69 @@
|
||||
<KeyWord name="SaveFileText" func="yes">
|
||||
<Overload retVal="bool" descr="Save text data to file (write), string must be '\0' terminated, returns true on success">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="char *text" />
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<!-------------------------------------------------------------------- -->
|
||||
|
||||
<!-- File system functions -->
|
||||
<!-- File access custom callbacks -->
|
||||
<!-- WARNING: Callbacks setup is intended for advanced users -->
|
||||
<KeyWord name="SetLoadFileDataCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file binary data loader">
|
||||
<Param name="LoadFileDataCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetSaveFileDataCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file binary data saver">
|
||||
<Param name="SaveFileDataCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetLoadFileTextCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file text data loader">
|
||||
<Param name="LoadFileTextCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetSaveFileTextCallback" func="yes">
|
||||
<Overload retVal="void" descr="Set custom file text data saver">
|
||||
<Param name="SaveFileTextCallback callback" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<KeyWord name="FileRename" func="yes">
|
||||
<Overload retVal="int" descr="Rename file (if exists)">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="const char *fileRename" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileRemove" func="yes">
|
||||
<Overload retVal="int" descr="Remove file (if exists)">
|
||||
<Param name="const char *fileName" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileCopy" func="yes">
|
||||
<Overload retVal="int" descr="Copy file from one path to another, dstPath created if it doesn't exist">
|
||||
<Param name="const char *srcPath" />
|
||||
<Param name="const char *dstPath" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileMove" func="yes">
|
||||
<Overload retVal="int" descr="Move file from one directory to another, dstPath created if it doesn't exist">
|
||||
<Param name="const char *srcPath" />
|
||||
<Param name="const char *dstPath" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileTextReplace" func="yes">
|
||||
<Overload retVal="int" descr="Replace text in an existing file">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="const char *search" />
|
||||
<Param name="const char *replacement" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileTextFindIndex" func="yes">
|
||||
<Overload retVal="int" descr="Find text in existing file">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="const char *search" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="FileExists" func="yes">
|
||||
<Overload retVal="bool" descr="Check if file exists">
|
||||
<Param name="const char *fileName" />
|
||||
@ -605,7 +640,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="IsFileExtension" func="yes">
|
||||
<Overload retVal="bool" descr="Check file extension (including point: .png, .wav)">
|
||||
<Overload retVal="bool" descr="Check file extension (recommended include point: .png, .wav)">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="const char *ext" />
|
||||
</Overload>
|
||||
@ -615,6 +650,11 @@
|
||||
<Param name="const char *fileName" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetFileModTime" func="yes">
|
||||
<Overload retVal="long" descr="Get file modification time (last write time)">
|
||||
<Param name="const char *fileName" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetFileExtension" func="yes">
|
||||
<Overload retVal="const char" descr="Get pointer to extension for a filename string (includes dot: '.png')">
|
||||
<Param name="const char *fileName" />
|
||||
@ -653,7 +693,7 @@
|
||||
</KeyWord>
|
||||
<KeyWord name="ChangeDirectory" func="yes">
|
||||
<Overload retVal="bool" descr="Change working directory, return true on success">
|
||||
<Param name="const char *dir" />
|
||||
<Param name="const char *dirPath" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="IsPathFile" func="yes">
|
||||
@ -667,12 +707,12 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="LoadDirectoryFiles" func="yes">
|
||||
<Overload retVal="FilePathList" descr="Load directory filepaths">
|
||||
<Overload retVal="FilePathList" descr="Load directory filepaths, files and directories, no subdirs scan">
|
||||
<Param name="const char *dirPath" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="LoadDirectoryFilesEx" func="yes">
|
||||
<Overload retVal="FilePathList" descr="Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result">
|
||||
<Overload retVal="FilePathList" descr="Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*"">
|
||||
<Param name="const char *basePath" />
|
||||
<Param name="const char *filter" />
|
||||
<Param name="bool scanSubdirs" />
|
||||
@ -694,9 +734,16 @@
|
||||
<Param name="FilePathList files" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetFileModTime" func="yes">
|
||||
<Overload retVal="long" descr="Get file modification time (last write time)">
|
||||
<Param name="const char *fileName" />
|
||||
<KeyWord name="int GetDirectoryFileCount" func="yes">
|
||||
<Overload retVal="unsigned" descr="Get the file count in a directory">
|
||||
<Param name="const char *dirPath" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="int GetDirectoryFileCountEx" func="yes">
|
||||
<Overload retVal="unsigned" descr="Get the file count in a directory with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result">
|
||||
<Param name="const char *basePath" />
|
||||
<Param name="const char *filter" />
|
||||
<Param name="bool scanSubdirs" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
@ -716,15 +763,15 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="EncodeDataBase64" func="yes">
|
||||
<Overload retVal="char" descr="Encode data to Base64 string, memory must be MemFree()">
|
||||
<Overload retVal="char" descr="Encode data to Base64 string (includes NULL terminator), memory must be MemFree()">
|
||||
<Param name="const unsigned char" />
|
||||
<Param name="int dataSize" />
|
||||
<Param name="int *outputSize" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="char *DecodeDataBase64" func="yes">
|
||||
<Overload retVal="unsigned" descr="Decode Base64 string data, memory must be MemFree()">
|
||||
<Param name="const unsigned char" />
|
||||
<Overload retVal="unsigned" descr="Decode Base64 string (expected NULL terminated), memory must be MemFree()">
|
||||
<Param name="const char *text" />
|
||||
<Param name="int *outputSize" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
@ -746,7 +793,12 @@
|
||||
<Param name="int dataSize" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<KeyWord name="int *ComputeSHA256" func="yes">
|
||||
<Overload retVal="unsigned" descr="Compute SHA256 hash code, returns static int[8] (32 bytes)">
|
||||
<Param name="unsigned char *data" />
|
||||
<Param name="int dataSize" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<!-- Automation events functionality -->
|
||||
<KeyWord name="LoadAutomationEventList" func="yes">
|
||||
@ -823,6 +875,11 @@
|
||||
<KeyWord name="GetCharPressed" func="yes">
|
||||
<Overload retVal="int" descr="Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty"></Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetKeyName" func="yes">
|
||||
<Overload retVal="const char" descr="Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)">
|
||||
<Param name="int key" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetExitKey" func="yes">
|
||||
<Overload retVal="void" descr="Set a custom key to exit program (default is ESC)">
|
||||
<Param name="int key" />
|
||||
@ -868,12 +925,12 @@
|
||||
<Overload retVal="int" descr="Get the last gamepad button pressed"></Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetGamepadAxisCount" func="yes">
|
||||
<Overload retVal="int" descr="Get gamepad axis count for a gamepad">
|
||||
<Overload retVal="int" descr="Get axis count for a gamepad">
|
||||
<Param name="int gamepad" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetGamepadAxisMovement" func="yes">
|
||||
<Overload retVal="float" descr="Get axis movement value for a gamepad axis">
|
||||
<Overload retVal="float" descr="Get movement value for a gamepad axis">
|
||||
<Param name="int gamepad" />
|
||||
<Param name="int axis" />
|
||||
</Overload>
|
||||
@ -1098,6 +1155,15 @@
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawLineDashed" func="yes">
|
||||
<Overload retVal="void" descr="Draw a dashed line">
|
||||
<Param name="Vector2 startPos" />
|
||||
<Param name="Vector2 endPos" />
|
||||
<Param name="int dashSize" />
|
||||
<Param name="int spaceSize" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircle" func="yes">
|
||||
<Overload retVal="void" descr="Draw a color-filled circle">
|
||||
<Param name="int centerX" />
|
||||
@ -1106,6 +1172,21 @@
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleV" func="yes">
|
||||
<Overload retVal="void" descr="Draw a color-filled circle (Vector version)">
|
||||
<Param name="Vector2 center" />
|
||||
<Param name="float radius" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleGradient" func="yes">
|
||||
<Overload retVal="void" descr="Draw a gradient-filled circle">
|
||||
<Param name="Vector2 center" />
|
||||
<Param name="float radius" />
|
||||
<Param name="Color inner" />
|
||||
<Param name="Color outer" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleSector" func="yes">
|
||||
<Overload retVal="void" descr="Draw a piece of a circle">
|
||||
<Param name="Vector2 center" />
|
||||
@ -1126,22 +1207,6 @@
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleGradient" func="yes">
|
||||
<Overload retVal="void" descr="Draw a gradient-filled circle">
|
||||
<Param name="int centerX" />
|
||||
<Param name="int centerY" />
|
||||
<Param name="float radius" />
|
||||
<Param name="Color inner" />
|
||||
<Param name="Color outer" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleV" func="yes">
|
||||
<Overload retVal="void" descr="Draw a color-filled circle (Vector version)">
|
||||
<Param name="Vector2 center" />
|
||||
<Param name="float radius" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawCircleLines" func="yes">
|
||||
<Overload retVal="void" descr="Draw circle outline">
|
||||
<Param name="int centerX" />
|
||||
@ -1166,6 +1231,14 @@
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawEllipseV" func="yes">
|
||||
<Overload retVal="void" descr="Draw ellipse (Vector version)">
|
||||
<Param name="Vector2 center" />
|
||||
<Param name="float radiusH" />
|
||||
<Param name="float radiusV" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawEllipseLines" func="yes">
|
||||
<Overload retVal="void" descr="Draw ellipse outline">
|
||||
<Param name="int centerX" />
|
||||
@ -1175,6 +1248,14 @@
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawEllipseLinesV" func="yes">
|
||||
<Overload retVal="void" descr="Draw ellipse outline (Vector version)">
|
||||
<Param name="Vector2 center" />
|
||||
<Param name="float radiusH" />
|
||||
<Param name="float radiusV" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawRing" func="yes">
|
||||
<Overload retVal="void" descr="Draw ring">
|
||||
<Param name="Vector2 center" />
|
||||
@ -1252,8 +1333,8 @@
|
||||
<Param name="Rectangle rec" />
|
||||
<Param name="Color topLeft" />
|
||||
<Param name="Color bottomLeft" />
|
||||
<Param name="Color topRight" />
|
||||
<Param name="Color bottomRight" />
|
||||
<Param name="Color topRight" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="DrawRectangleLines" func="yes">
|
||||
@ -1637,7 +1718,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="char *ExportImageToMemory" func="yes">
|
||||
<Overload retVal="unsigned" descr="Export image to memory buffer">
|
||||
<Overload retVal="unsigned" descr="Export image to memory buffer, memory must be MemFree()">
|
||||
<Param name="Image image" />
|
||||
<Param name="const char *fileType" />
|
||||
<Param name="int *fileSize" />
|
||||
@ -2099,7 +2180,7 @@
|
||||
<KeyWord name="ImageDrawTriangleFan" func="yes">
|
||||
<Overload retVal="void" descr="Draw a triangle fan defined by points within an image (first vertex is the center)">
|
||||
<Param name="Image *dst" />
|
||||
<Param name="Vector2 *points" />
|
||||
<Param name="const Vector2 *points" />
|
||||
<Param name="int pointCount" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
@ -2107,7 +2188,7 @@
|
||||
<KeyWord name="ImageDrawTriangleStrip" func="yes">
|
||||
<Overload retVal="void" descr="Draw a triangle strip defined by points within an image">
|
||||
<Param name="Image *dst" />
|
||||
<Param name="Vector2 *points" />
|
||||
<Param name="const Vector2 *points" />
|
||||
<Param name="int pointCount" />
|
||||
<Param name="Color color" />
|
||||
</Overload>
|
||||
@ -2188,13 +2269,13 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UpdateTexture" func="yes">
|
||||
<Overload retVal="void" descr="Update GPU texture with new data">
|
||||
<Overload retVal="void" descr="Update GPU texture with new data (pixels should be able to fill texture)">
|
||||
<Param name="Texture2D texture" />
|
||||
<Param name="const void *pixels" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UpdateTextureRec" func="yes">
|
||||
<Overload retVal="void" descr="Update GPU texture rectangle with new data">
|
||||
<Overload retVal="void" descr="Update GPU texture rectangle with new data (pixels and rec should fit in texture)">
|
||||
<Param name="Texture2D texture" />
|
||||
<Param name="Rectangle rec" />
|
||||
<Param name="const void *pixels" />
|
||||
@ -2388,7 +2469,7 @@
|
||||
<Overload retVal="Font" descr="Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height">
|
||||
<Param name="const char *fileName" />
|
||||
<Param name="int fontSize" />
|
||||
<Param name="int *codepoints" />
|
||||
<Param name="const int *codepoints" />
|
||||
<Param name="int codepointCount" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
@ -2405,7 +2486,7 @@
|
||||
<Param name="const unsigned char" />
|
||||
<Param name="int dataSize" />
|
||||
<Param name="int fontSize" />
|
||||
<Param name="int *codepoints" />
|
||||
<Param name="const int *codepoints" />
|
||||
<Param name="int codepointCount" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
@ -2419,9 +2500,10 @@
|
||||
<Param name="const unsigned char" />
|
||||
<Param name="int dataSize" />
|
||||
<Param name="int fontSize" />
|
||||
<Param name="int *codepoints" />
|
||||
<Param name="const int *codepoints" />
|
||||
<Param name="int codepointCount" />
|
||||
<Param name="int type" />
|
||||
<Param name="int *glyphCount" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GenImageFontAtlas" func="yes">
|
||||
@ -2531,6 +2613,15 @@
|
||||
<Param name="float spacing" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="MeasureTextCodepoints" func="yes">
|
||||
<Overload retVal="Vector2" descr="Measure string size for an existing array of codepoints for Font">
|
||||
<Param name="Font font" />
|
||||
<Param name="const int *codepoints" />
|
||||
<Param name="int length" />
|
||||
<Param name="float fontSize" />
|
||||
<Param name="float spacing" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetGlyphIndex" func="yes">
|
||||
<Overload retVal="int" descr="Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found">
|
||||
<Param name="Font font" />
|
||||
@ -2604,7 +2695,20 @@
|
||||
</KeyWord>
|
||||
|
||||
<!-- Text strings management functions (no UTF-8 strings, only byte chars) -->
|
||||
<!-- NOTE: Some strings allocate memory internally for returned strings, just be careful! -->
|
||||
<!-- WARNING 1: Most of these functions use internal static buffers[], it's recommended to store returned data on user-side for re-use -->
|
||||
<!-- WARNING 2: Some functions allocate memory internally for the returned strings, those strings must be freed by user using MemFree() -->
|
||||
<KeyWord name="LoadTextLines" func="yes">
|
||||
<Overload retVal="char" descr="Load text as separate lines ('\n')">
|
||||
<Param name="const char *text" />
|
||||
<Param name="int *count" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UnloadTextLines" func="yes">
|
||||
<Overload retVal="void" descr="Unload text lines">
|
||||
<Param name="char **text" />
|
||||
<Param name="int lineCount" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextCopy" func="yes">
|
||||
<Overload retVal="int" descr="Copy one string to another, returns bytes copied">
|
||||
<Param name="char *dst" />
|
||||
@ -2635,80 +2739,121 @@
|
||||
<Param name="int length" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextReplace" func="yes">
|
||||
<Overload retVal="char" descr="Replace text string (WARNING: memory must be freed!)">
|
||||
<KeyWord name="TextRemoveSpaces" func="yes">
|
||||
<Overload retVal="const char" descr="Remove text spaces, concat words">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *replace" />
|
||||
<Param name="const char *by" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="GetTextBetween" func="yes">
|
||||
<Overload retVal="char" descr="Get text between two strings">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *begin" />
|
||||
<Param name="const char *end" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextReplace" func="yes">
|
||||
<Overload retVal="char" descr="Replace text string with new string">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *search" />
|
||||
<Param name="const char *replacement" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextReplaceAlloc" func="yes">
|
||||
<Overload retVal="char" descr="Replace text string with new string, memory must be MemFree()">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *search" />
|
||||
<Param name="const char *replacement" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextReplaceBetween" func="yes">
|
||||
<Overload retVal="char" descr="Replace text between two specific strings">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *begin" />
|
||||
<Param name="const char *end" />
|
||||
<Param name="const char *replacement" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextReplaceBetweenAlloc" func="yes">
|
||||
<Overload retVal="char" descr="Replace text between two specific strings, memory must be MemFree()">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *begin" />
|
||||
<Param name="const char *end" />
|
||||
<Param name="const char *replacement" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextInsert" func="yes">
|
||||
<Overload retVal="char" descr="Insert text in a position (WARNING: memory must be freed!)">
|
||||
<Overload retVal="char" descr="Insert text in a defined byte position">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *insert" />
|
||||
<Param name="int position" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextInsertAlloc" func="yes">
|
||||
<Overload retVal="char" descr="Insert text in a defined byte position, memory must be MemFree()">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *insert" />
|
||||
<Param name="int position" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextJoin" func="yes">
|
||||
<Overload retVal="const char" descr="Join text strings with delimiter">
|
||||
<Param name="const char **textList" />
|
||||
<Overload retVal="char" descr="Join text strings with delimiter">
|
||||
<Param name="char **textList" />
|
||||
<Param name="int count" />
|
||||
<Param name="const char *delimiter" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextSplit" func="yes">
|
||||
<Overload retVal="const char" descr="Split text into multiple strings">
|
||||
<Overload retVal="char" descr="Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings">
|
||||
<Param name="const char *text" />
|
||||
<Param name="char delimiter" />
|
||||
<Param name="int *count" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextAppend" func="yes">
|
||||
<Overload retVal="void" descr="Append text at specific position and move cursor!">
|
||||
<Overload retVal="void" descr="Append text at specific position and move cursor">
|
||||
<Param name="char *text" />
|
||||
<Param name="const char *append" />
|
||||
<Param name="int *position" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextFindIndex" func="yes">
|
||||
<Overload retVal="int" descr="Find first text occurrence within a string">
|
||||
<Overload retVal="int" descr="Find first text occurrence within a string, -1 if not found">
|
||||
<Param name="const char *text" />
|
||||
<Param name="const char *find" />
|
||||
<Param name="const char *search" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToUpper" func="yes">
|
||||
<Overload retVal="const char" descr="Get upper case version of provided string">
|
||||
<Overload retVal="char" descr="Get upper case version of provided string">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToLower" func="yes">
|
||||
<Overload retVal="const char" descr="Get lower case version of provided string">
|
||||
<Overload retVal="char" descr="Get lower case version of provided string">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToPascal" func="yes">
|
||||
<Overload retVal="const char" descr="Get Pascal case notation version of provided string">
|
||||
<Overload retVal="char" descr="Get Pascal case notation version of provided string">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToSnake" func="yes">
|
||||
<Overload retVal="const char" descr="Get Snake case notation version of provided string">
|
||||
<Overload retVal="char" descr="Get Snake case notation version of provided string">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToCamel" func="yes">
|
||||
<Overload retVal="const char" descr="Get Camel case notation version of provided string">
|
||||
<Overload retVal="char" descr="Get Camel case notation version of provided string">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
<KeyWord name="TextToInteger" func="yes">
|
||||
<Overload retVal="int" descr="Get integer value from text (negative values not supported)">
|
||||
<Overload retVal="int" descr="Get integer value from text">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="TextToFloat" func="yes">
|
||||
<Overload retVal="float" descr="Get float value from text (negative values not supported)">
|
||||
<Overload retVal="float" descr="Get float value from text">
|
||||
<Param name="const char *text" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
@ -2995,7 +3140,7 @@
|
||||
<Param name="Vector2 size" />
|
||||
<Param name="Vector2 origin" />
|
||||
<Param name="float rotation" />
|
||||
<Param name="<EFBFBD><EFBFBD>_)% " />
|
||||
<Param name="Color tint" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
@ -3180,22 +3325,20 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UpdateModelAnimation" func="yes">
|
||||
<Overload retVal="void" descr="Update model animation pose (CPU)">
|
||||
<Overload retVal="void" descr="Update model animation pose (vertex buffers and bone matrices)">
|
||||
<Param name="Model model" />
|
||||
<Param name="ModelAnimation anim" />
|
||||
<Param name="int frame" />
|
||||
<Param name="float frame" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UpdateModelAnimationBones" func="yes">
|
||||
<Overload retVal="void" descr="Update model animation mesh bone matrices (GPU skinning)">
|
||||
<KeyWord name="UpdateModelAnimationEx" func="yes">
|
||||
<Overload retVal="void" descr="Update model animation pose, blending two animations">
|
||||
<Param name="Model model" />
|
||||
<Param name="ModelAnimation anim" />
|
||||
<Param name="int frame" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UnloadModelAnimation" func="yes">
|
||||
<Overload retVal="void" descr="Unload animation data">
|
||||
<Param name="ModelAnimation anim" />
|
||||
<Param name="ModelAnimation animA" />
|
||||
<Param name="float frameA" />
|
||||
<Param name="ModelAnimation animB" />
|
||||
<Param name="float frameB" />
|
||||
<Param name="float blend" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UnloadModelAnimations" func="yes">
|
||||
@ -3333,7 +3476,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="UpdateSound" func="yes">
|
||||
<Overload retVal="void" descr="Update sound buffer with new data">
|
||||
<Overload retVal="void" descr="Update sound buffer with new data (default data format: 32 bit float, stereo)">
|
||||
<Param name="Sound sound" />
|
||||
<Param name="const void *data" />
|
||||
<Param name="int sampleCount" />
|
||||
@ -3406,7 +3549,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetSoundPan" func="yes">
|
||||
<Overload retVal="void" descr="Set pan for a sound (0.5 is center)">
|
||||
<Overload retVal="void" descr="Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)">
|
||||
<Param name="Sound sound" />
|
||||
<Param name="float pan" />
|
||||
</Overload>
|
||||
@ -3514,7 +3657,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetMusicPan" func="yes">
|
||||
<Overload retVal="void" descr="Set pan for a music (0.5 is center)">
|
||||
<Overload retVal="void" descr="Set pan for a music (-1.0 left, 0.0 center, 1.0 right)">
|
||||
<Param name="Music music" />
|
||||
<Param name="float pan" />
|
||||
</Overload>
|
||||
@ -3598,7 +3741,7 @@
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
<KeyWord name="SetAudioStreamPan" func="yes">
|
||||
<Overload retVal="void" descr="Set pan for audio stream (0.5 is centered)">
|
||||
<Overload retVal="void" descr="Set pan for audio stream (-1.0 to 1.0 range, 0.0 is centered)">
|
||||
<Param name="AudioStream stream" />
|
||||
<Param name="float pan" />
|
||||
</Overload>
|
||||
@ -3638,5 +3781,3 @@
|
||||
<Param name="AudioCallback processor" />
|
||||
</Overload>
|
||||
</KeyWord>
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ RLAPI Vector2 GetWindowScaleDPI(void); // Get window
|
||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
|
||||
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
|
||||
RLAPI const char *GetClipboardText(void); // Get clipboard text content
|
||||
RLAPI Image GetClipboardImage(void); // Get clipboard image
|
||||
RLAPI Image GetClipboardImage(void); // Get clipboard image content
|
||||
RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
|
||||
RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling
|
||||
|
||||
@ -91,10 +91,10 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Lo
|
||||
RLAPI bool IsShaderValid(Shader shader); // Check if a shader is valid (loaded on GPU)
|
||||
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
||||
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
|
||||
RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
|
||||
RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
|
||||
RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
|
||||
RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
|
||||
RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
|
||||
RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
|
||||
RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
|
||||
RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value and bind the texture (sampler2d)
|
||||
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
||||
|
||||
// Screen-space-related functions
|
||||
@ -109,99 +109,106 @@ RLAPI Matrix GetCameraMatrix(Camera camera); // Get c
|
||||
RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix
|
||||
|
||||
// Timing-related functions
|
||||
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||
RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
|
||||
RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow()
|
||||
RLAPI int GetFPS(void); // Get current FPS
|
||||
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||
RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
|
||||
RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow()
|
||||
RLAPI int GetFPS(void); // Get current FPS
|
||||
|
||||
// Custom frame control functions
|
||||
// NOTE: Those functions are intended for advanced users that want full control over the frame processing
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
|
||||
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
|
||||
RLAPI void PollInputEvents(void); // Register all input events
|
||||
RLAPI void WaitTime(double seconds); // Wait for some time (halt program execution)
|
||||
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
|
||||
RLAPI void PollInputEvents(void); // Register all input events
|
||||
RLAPI void WaitTime(double seconds); // Wait for some time (halt program execution)
|
||||
|
||||
// Random values generation functions
|
||||
RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator
|
||||
RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included)
|
||||
RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator
|
||||
RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included)
|
||||
RLAPI int *LoadRandomSequence(unsigned int count, int min, int max); // Load random values sequence, no values repeated
|
||||
RLAPI void UnloadRandomSequence(int *sequence); // Unload random values sequence
|
||||
RLAPI void UnloadRandomSequence(int *sequence); // Unload random values sequence
|
||||
|
||||
// Misc. functions
|
||||
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
|
||||
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
|
||||
RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
|
||||
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
|
||||
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
|
||||
RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
|
||||
|
||||
// NOTE: Following functions implemented in module [utils]
|
||||
//------------------------------------------------------------------
|
||||
RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||
RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
|
||||
RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator
|
||||
RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
|
||||
RLAPI void MemFree(void *ptr); // Internal memory free
|
||||
// Logging system
|
||||
RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
|
||||
RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
|
||||
|
||||
// Set custom callbacks
|
||||
// WARNING: Callbacks setup is intended for advanced users
|
||||
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
|
||||
RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
|
||||
RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
|
||||
RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
|
||||
RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
|
||||
// Memory management, using internal allocators
|
||||
RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator
|
||||
RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
|
||||
RLAPI void MemFree(void *ptr); // Internal memory free
|
||||
|
||||
// Files management functions
|
||||
// File system management functions
|
||||
RLAPI unsigned char *LoadFileData(const char *fileName, int *dataSize); // Load file data as byte array (read)
|
||||
RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData()
|
||||
RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData()
|
||||
RLAPI bool SaveFileData(const char *fileName, void *data, int dataSize); // Save data to file from byte array (write), returns true on success
|
||||
RLAPI bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileName); // Export data to code (.h), returns true on success
|
||||
RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
|
||||
RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
|
||||
RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
//------------------------------------------------------------------
|
||||
RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
|
||||
RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
|
||||
RLAPI bool SaveFileText(const char *fileName, const char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
|
||||
// File system functions
|
||||
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
||||
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
|
||||
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav)
|
||||
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
||||
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
|
||||
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
|
||||
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
|
||||
RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
|
||||
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
|
||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
||||
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
|
||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
|
||||
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
||||
RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
|
||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||
// File access custom callbacks
|
||||
// WARNING: Callbacks setup is intended for advanced users
|
||||
RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
|
||||
RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
|
||||
RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
|
||||
RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
|
||||
|
||||
RLAPI int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists)
|
||||
RLAPI int FileRemove(const char *fileName); // Remove file (if exists)
|
||||
RLAPI int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist
|
||||
RLAPI int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist
|
||||
RLAPI int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file
|
||||
RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file
|
||||
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
||||
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
|
||||
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
|
||||
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
|
||||
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
|
||||
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
|
||||
RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
|
||||
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
|
||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||
RLAPI bool ChangeDirectory(const char *dirPath); // Change working directory, return true on success
|
||||
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*"
|
||||
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
|
||||
RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
|
||||
RLAPI unsigned int GetDirectoryFileCount(const char *dirPath); // Get the file count in a directory
|
||||
RLAPI unsigned int GetDirectoryFileCountEx(const char *basePath, const char *filter, bool scanSubdirs); // Get the file count in a directory with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
|
||||
|
||||
// Compression/Encoding functionality
|
||||
RLAPI unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree()
|
||||
RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
|
||||
RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
|
||||
RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
|
||||
RLAPI unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code
|
||||
RLAPI unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
|
||||
RLAPI unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
|
||||
|
||||
RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string (includes NULL terminator), memory must be MemFree()
|
||||
RLAPI unsigned char *DecodeDataBase64(const char *text, int *outputSize); // Decode Base64 string (expected NULL terminated), memory must be MemFree()
|
||||
RLAPI unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code
|
||||
RLAPI unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
|
||||
RLAPI unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
|
||||
RLAPI unsigned int *ComputeSHA256(unsigned char *data, int dataSize); // Compute SHA256 hash code, returns static int[8] (32 bytes)
|
||||
|
||||
// Automation events functionality
|
||||
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
|
||||
RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
|
||||
RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
|
||||
RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
|
||||
RLAPI void StartAutomationEventRecording(void); // Start recording automation events (AutomationEventList must be set)
|
||||
RLAPI void StopAutomationEventRecording(void); // Stop recording automation events
|
||||
RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event
|
||||
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
|
||||
RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
|
||||
RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
|
||||
RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
|
||||
RLAPI void StartAutomationEventRecording(void); // Start recording automation events (AutomationEventList must be set)
|
||||
RLAPI void StopAutomationEventRecording(void); // Stop recording automation events
|
||||
RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Input Handling Functions (Module: core)
|
||||
@ -215,20 +222,20 @@ RLAPI bool IsKeyReleased(int key); // Check if a key
|
||||
RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
|
||||
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
|
||||
RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
|
||||
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)
|
||||
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)
|
||||
|
||||
// Input-related functions: gamepads
|
||||
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
|
||||
RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
|
||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
|
||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
|
||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
|
||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
|
||||
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
||||
RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
|
||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
|
||||
RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
|
||||
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
|
||||
RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
|
||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
|
||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
|
||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
|
||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
|
||||
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
||||
RLAPI int GetGamepadAxisCount(int gamepad); // Get axis count for a gamepad
|
||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get movement value for a gamepad axis
|
||||
RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
|
||||
RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
|
||||
|
||||
// Input-related functions: mouse
|
||||
@ -257,19 +264,19 @@ RLAPI int GetTouchPointCount(void); // Get number of t
|
||||
//------------------------------------------------------------------------------------
|
||||
// Gestures and Touch Handling Functions (Module: rgestures)
|
||||
//------------------------------------------------------------------------------------
|
||||
RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
||||
RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
|
||||
RLAPI int GetGestureDetected(void); // Get latest detected gesture
|
||||
RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
||||
RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
|
||||
RLAPI float GetGestureDragAngle(void); // Get gesture drag angle
|
||||
RLAPI Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
|
||||
RLAPI float GetGesturePinchAngle(void); // Get gesture pinch angle
|
||||
RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
||||
RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
|
||||
RLAPI int GetGestureDetected(void); // Get latest detected gesture
|
||||
RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
||||
RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
|
||||
RLAPI float GetGestureDragAngle(void); // Get gesture drag angle
|
||||
RLAPI Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
|
||||
RLAPI float GetGesturePinchAngle(void); // Get gesture pinch angle
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Camera System Functions (Module: rcamera)
|
||||
//------------------------------------------------------------------------------------
|
||||
RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
|
||||
RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
|
||||
RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@ -278,9 +285,9 @@ RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, f
|
||||
// Set texture and rectangle to be used on shapes drawing
|
||||
// NOTE: It can be useful when using basic shapes and one single font,
|
||||
// defining a font char white rectangle would allow drawing everything in a single draw call
|
||||
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
|
||||
RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
|
||||
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
||||
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
|
||||
RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
|
||||
RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
|
||||
|
||||
// Basic shapes drawing functions
|
||||
RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care]
|
||||
@ -290,24 +297,27 @@ RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color);
|
||||
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
||||
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
||||
RLAPI void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int spaceSize, Color color); // Draw a dashed line
|
||||
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
||||
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
||||
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
||||
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
||||
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||
RLAPI void DrawCircleGradient(Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
||||
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
||||
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
||||
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
||||
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
|
||||
RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version)
|
||||
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
|
||||
RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version)
|
||||
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
|
||||
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
|
||||
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
|
||||
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
||||
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
|
||||
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
|
||||
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
||||
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); // Draw a gradient-filled rectangle with custom vertex colors
|
||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors
|
||||
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
|
||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||
@ -322,11 +332,11 @@ RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation
|
||||
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
|
||||
|
||||
// Splines drawing functions
|
||||
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||
RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
||||
RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
||||
RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||
RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
||||
RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
||||
RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
|
||||
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
|
||||
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
|
||||
@ -369,7 +379,7 @@ RLAPI Image LoadImageFromScreen(void);
|
||||
RLAPI bool IsImageValid(Image image); // Check if an image is valid (data and parameters)
|
||||
RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM)
|
||||
RLAPI bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
|
||||
RLAPI unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer
|
||||
RLAPI unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer, memory must be MemFree()
|
||||
RLAPI bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success
|
||||
|
||||
// Image generation functions
|
||||
@ -399,7 +409,7 @@ RLAPI void ImageAlphaPremultiply(Image *image);
|
||||
RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
|
||||
RLAPI void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image
|
||||
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth, int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
|
||||
RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
|
||||
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
@ -440,8 +450,8 @@ RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color c
|
||||
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
||||
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
||||
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
||||
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||
@ -456,8 +466,8 @@ RLAPI bool IsTextureValid(Texture2D texture);
|
||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU)
|
||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
|
||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
|
||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data (pixels should be able to fill texture)
|
||||
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data (pixels and rec should fit in texture)
|
||||
|
||||
// Texture configuration functions
|
||||
RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
|
||||
@ -498,11 +508,11 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
|
||||
// Font loading/unloading functions
|
||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
|
||||
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
|
||||
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount, int type, int *glyphCount); // Load font data for further use
|
||||
RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
|
||||
RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
|
||||
RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM)
|
||||
@ -520,42 +530,51 @@ RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCou
|
||||
RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks
|
||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
||||
RLAPI Vector2 MeasureTextCodepoints(Font font, const int *codepoints, int length, float fontSize, float spacing); // Measure string size for an existing array of codepoints for Font
|
||||
RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||
RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||
RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||
|
||||
// Text codepoints management functions (unicode characters)
|
||||
RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
|
||||
RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
|
||||
RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
|
||||
RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
|
||||
RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
|
||||
RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
|
||||
RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
|
||||
RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
|
||||
RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
|
||||
RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
|
||||
RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
|
||||
RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
|
||||
RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
|
||||
|
||||
// Text strings management functions (no UTF-8 strings, only byte chars)
|
||||
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
|
||||
// WARNING 1: Most of these functions use internal static buffers[], it's recommended to store returned data on user-side for re-use
|
||||
// WARNING 2: Some functions allocate memory internally for the returned strings, those strings must be freed by user using MemFree()
|
||||
RLAPI char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n')
|
||||
RLAPI void UnloadTextLines(char **text, int lineCount); // Unload text lines
|
||||
RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
|
||||
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
|
||||
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
|
||||
RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style)
|
||||
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
|
||||
RLAPI char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
|
||||
RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
|
||||
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
||||
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
||||
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
|
||||
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
|
||||
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
|
||||
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
||||
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||
RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||
RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||
|
||||
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
||||
RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
|
||||
RLAPI const char *TextRemoveSpaces(const char *text); // Remove text spaces, concat words
|
||||
RLAPI char *GetTextBetween(const char *text, const char *begin, const char *end); // Get text between two strings
|
||||
RLAPI char *TextReplace(const char *text, const char *search, const char *replacement); // Replace text string with new string
|
||||
RLAPI char *TextReplaceAlloc(const char *text, const char *search, const char *replacement); // Replace text string with new string, memory must be MemFree()
|
||||
RLAPI char *TextReplaceBetween(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings
|
||||
RLAPI char *TextReplaceBetweenAlloc(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings, memory must be MemFree()
|
||||
RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a defined byte position
|
||||
RLAPI char *TextInsertAlloc(const char *text, const char *insert, int position); // Insert text in a defined byte position, memory must be MemFree()
|
||||
RLAPI char *TextJoin(char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
||||
RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings, using MAX_TEXTSPLIT_COUNT static strings
|
||||
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor
|
||||
RLAPI int TextFindIndex(const char *text, const char *search); // Find first text occurrence within a string, -1 if not found
|
||||
RLAPI char *TextToUpper(const char *text); // Get upper case version of provided string
|
||||
RLAPI char *TextToLower(const char *text); // Get lower case version of provided string
|
||||
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||
RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||
RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||
RLAPI int TextToInteger(const char *text); // Get integer value from text
|
||||
RLAPI float TextToFloat(const char *text); // Get float value from text
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||
@ -601,7 +620,7 @@ RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, floa
|
||||
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
||||
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
||||
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
||||
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
|
||||
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
|
||||
|
||||
@ -639,21 +658,20 @@ RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId);
|
||||
|
||||
// Model animations loading/unloading functions
|
||||
RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file
|
||||
RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose (CPU)
|
||||
RLAPI void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame); // Update model animation mesh bone matrices (GPU skinning)
|
||||
RLAPI void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
|
||||
RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, float frame); // Update model animation pose (vertex buffers and bone matrices)
|
||||
RLAPI void UpdateModelAnimationEx(Model model, ModelAnimation animA, float frameA, ModelAnimation animB, float frameB, float blend); // Update model animation pose, blending two animations
|
||||
RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
|
||||
RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
|
||||
|
||||
// Collision detection functions
|
||||
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
|
||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes
|
||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere
|
||||
RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere
|
||||
RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box
|
||||
RLAPI RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); // Get collision info between ray and mesh
|
||||
RLAPI RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
|
||||
RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); // Get collision info between ray and quad
|
||||
RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
|
||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes
|
||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere
|
||||
RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere
|
||||
RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box
|
||||
RLAPI RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); // Get collision info between ray and mesh
|
||||
RLAPI RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
|
||||
RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); // Get collision info between ray and quad
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Audio Loading and Playing Functions (Module: audio)
|
||||
@ -675,7 +693,7 @@ RLAPI Sound LoadSound(const char *fileName); // Load so
|
||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
||||
RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
|
||||
RLAPI bool IsSoundValid(Sound sound); // Checks if a sound is valid (data loaded and buffers initialized)
|
||||
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
|
||||
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data (default data format: 32 bit float, stereo)
|
||||
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||
RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data)
|
||||
@ -690,7 +708,7 @@ RLAPI void ResumeSound(Sound sound); // Resume
|
||||
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
||||
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
|
||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)
|
||||
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
||||
RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
|
||||
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
||||
@ -711,7 +729,7 @@ RLAPI void ResumeMusicStream(Music music); // Resume
|
||||
RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
|
||||
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
|
||||
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
|
||||
RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
|
||||
RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (-1.0 left, 0.0 center, 1.0 right)
|
||||
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
|
||||
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
|
||||
|
||||
@ -728,7 +746,7 @@ RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check i
|
||||
RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
|
||||
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
|
||||
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
|
||||
RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
|
||||
RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (-1.0 to 1.0 range, 0.0 is centered)
|
||||
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
||||
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
|
||||
|
||||
@ -737,4 +755,3 @@ RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processo
|
||||
|
||||
RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)
|
||||
RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ IDE | Platform(s) | Source | Example(s)
|
||||
[SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️
|
||||
[VS2019](https://www.visualstudio.com) | Windows | ✔️ | ✔️
|
||||
[VSCode](https://code.visualstudio.com/) | Windows, macOS | ❌ | ✔️
|
||||
[Zig](https://ziglang.org) | Windows, Linux, macOS, Web | ✔️ | ✔️
|
||||
scripts | Windows, Linux, macOS | ✔️ | ✔️
|
||||
|
||||
*New IDEs config files are welcome!*
|
||||
|
||||
84
projects/Zig/README.md
Normal file
84
projects/Zig/README.md
Normal file
@ -0,0 +1,84 @@
|
||||
# Starting your raylib project with Zig (0.16.0)
|
||||
|
||||
## How to compile and run it
|
||||
|
||||
To compile the project:
|
||||
|
||||
```sh
|
||||
zig build
|
||||
```
|
||||
|
||||
To run the project:
|
||||
|
||||
```sh
|
||||
zig build run
|
||||
```
|
||||
|
||||
## Compile with different optimization
|
||||
|
||||
To change from debug to release build you can do it with the `-Doptimze=` flag.
|
||||
|
||||
```
|
||||
Debug
|
||||
ReleaseSafe
|
||||
ReleaseFast
|
||||
ReleaseSmall
|
||||
```
|
||||
|
||||
## Choose a different platform
|
||||
|
||||
To compile with a different platform you can use the `-Dplatform=` flag.
|
||||
Here all the options:
|
||||
|
||||
```
|
||||
glfw
|
||||
rgfw
|
||||
sdl
|
||||
sdl2
|
||||
sdl3
|
||||
memory
|
||||
win32
|
||||
drm
|
||||
android
|
||||
```
|
||||
|
||||
In this example the platform `sdl` and `sdl2` are not supported
|
||||
|
||||
Important for the android platform you also have to compile for the right target
|
||||
|
||||
## Compile for a different target
|
||||
|
||||
To compile for a different [target](https://ziglang.org/download/0.16.0/release-notes.html#Support-Table) you can use the `-Dtarget=` flag.
|
||||
Not all targets are supported
|
||||
|
||||
## Example: Compile for web and run it
|
||||
|
||||
To compile for the web we use emscripten and you run it like that:
|
||||
|
||||
```sh
|
||||
zig build -Dtarget=wasm32-emscripten
|
||||
```
|
||||
|
||||
To run it we do:
|
||||
|
||||
```sh
|
||||
zig build run -Dtarget=wasm32-emscripten
|
||||
```
|
||||
|
||||
And to make a relase build we do:
|
||||
|
||||
```sh
|
||||
zig build -Dtarget=wasm32-emscripten -Doptimize=ReleaseFast
|
||||
```
|
||||
|
||||
If we want to use rgfw for the web build we could do:
|
||||
|
||||
```sh
|
||||
zig build -Dplatform=rgfw -Dtarget=wasm32-emscripten -Doptimize=ReleaseFast
|
||||
```
|
||||
|
||||
## Compiling the Zig code? Just add `-Dzig` and try out zig ;)
|
||||
|
||||
## More Resources
|
||||
|
||||
See [Zig Build System](https://ziglang.org/learn/build-system/)
|
||||
87
projects/Zig/build.zig
Normal file
87
projects/Zig/build.zig
Normal file
@ -0,0 +1,87 @@
|
||||
const std = @import("std");
|
||||
const rl = @import("raylib");
|
||||
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const platform = b.option(rl.PlatformBackend, "platform", "select the platform") orelse rl.PlatformBackend.glfw;
|
||||
const zig = b.option(bool, "zig", "compile zig code") orelse false;
|
||||
|
||||
const raylib_dep = b.dependency("raylib", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.platform = platform,
|
||||
});
|
||||
const raylib_artifact = raylib_dep.artifact("raylib");
|
||||
|
||||
if (platform == .sdl3) {
|
||||
if (b.lazyDependency("sdl3", .{ .optimize = optimize, .target = target })) |dep| {
|
||||
raylib_artifact.root_module.linkLibrary(dep.artifact("SDL3"));
|
||||
}
|
||||
}
|
||||
|
||||
var exe_mod: *std.Build.Module = undefined;
|
||||
|
||||
if (zig) {
|
||||
exe_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/core_basic_window.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
exe_mod.addImport("raylib", raylib_dep.module("raylib"));
|
||||
} else {
|
||||
exe_mod = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
});
|
||||
exe_mod.addCSourceFile(.{ .file = b.path("src/core_basic_window.c") });
|
||||
exe_mod.linkLibrary(raylib_artifact);
|
||||
}
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
|
||||
// web exports are completely separate
|
||||
if (target.query.os_tag == .emscripten) {
|
||||
const emsdk = rl.emsdk;
|
||||
const wasm = b.addLibrary(.{
|
||||
.name = "core_basic_window_web",
|
||||
.root_module = exe_mod,
|
||||
});
|
||||
|
||||
const install_dir: std.Build.InstallDir = .{ .custom = "web" };
|
||||
const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize });
|
||||
const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize });
|
||||
|
||||
const emcc_step = emsdk.emccStep(b, raylib_artifact, wasm, .{
|
||||
.optimize = optimize,
|
||||
.flags = emcc_flags,
|
||||
.settings = emcc_settings,
|
||||
.shell_file_path = emsdk.shell(raylib_dep),
|
||||
.install_dir = install_dir,
|
||||
});
|
||||
b.getInstallStep().dependOn(emcc_step);
|
||||
|
||||
const html_filename = try std.fmt.allocPrint(b.allocator, "{s}.html", .{wasm.name});
|
||||
const emrun_step = emsdk.emrunStep(
|
||||
b,
|
||||
b.getInstallPath(install_dir, html_filename),
|
||||
&.{},
|
||||
);
|
||||
|
||||
emrun_step.dependOn(emcc_step);
|
||||
run_step.dependOn(emrun_step);
|
||||
} else {
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "core_basic_window",
|
||||
.root_module = exe_mod,
|
||||
.use_lld = target.result.os.tag == .windows,
|
||||
});
|
||||
b.installArtifact(exe);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
}
|
||||
23
projects/Zig/build.zig.zon
Normal file
23
projects/Zig/build.zig.zon
Normal file
@ -0,0 +1,23 @@
|
||||
.{
|
||||
.name = .example,
|
||||
.version = "0.0.1",
|
||||
.minimum_zig_version = "0.16.0",
|
||||
.paths = .{""},
|
||||
|
||||
.dependencies = .{
|
||||
.raylib = .{
|
||||
.path = "../../",
|
||||
},
|
||||
.emsdk = .{
|
||||
.url = "git+https://github.com/emscripten-core/emsdk?ref=4.0.9#3bcf1dcd01f040f370e10fe673a092d9ed79ebb5",
|
||||
.hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ",
|
||||
},
|
||||
.sdl3 = .{
|
||||
.url = "git+https://codeberg.org/7Games/zig-sdl3?ref=master#6d418ef3ddae99098414a96a88bf5e5fdb41785e",
|
||||
.hash = "sdl3-0.1.9-NmT1QwiEJwByePqkmArtppCHQn8Y7kiSWcncT_Mop8ie",
|
||||
.lazy = true,
|
||||
},
|
||||
},
|
||||
|
||||
.fingerprint = 0x6eec9b9f1a9d7aca,
|
||||
}
|
||||
83
projects/Zig/src/core_basic_window.c
Normal file
83
projects/Zig/src/core_basic_window.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||
*
|
||||
* This example is prepared to compile for PLATFORM_WEB and PLATFORM_DESKTOP
|
||||
* As you will notice, code structure is slightly different to the other examples...
|
||||
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||
*
|
||||
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
void UpdateDrawFrame(void); // Update and Draw one frame
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//----------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||
#else
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
UpdateDrawFrame();
|
||||
}
|
||||
#endif
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
void UpdateDrawFrame(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
73
projects/Zig/src/core_basic_window.zig
Normal file
73
projects/Zig/src/core_basic_window.zig
Normal file
@ -0,0 +1,73 @@
|
||||
//*******************************************************************************************
|
||||
//*
|
||||
//* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||
//*
|
||||
//* This example is prepared to compile for PLATFORM_WEB and PLATFORM_DESKTOP
|
||||
//* As you will notice, code structure is slightly different to the other examples...
|
||||
//* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||
//*
|
||||
//* This example has been created using raylib 6.0 (www.raylib.com)
|
||||
//* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
//*
|
||||
//* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||
//* Rewrite in Zig by HaxSam (@haxsam)
|
||||
//*
|
||||
//*******************************************************************************************
|
||||
|
||||
const rl = @import("raylib");
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
const screenWidth: c_int = 800;
|
||||
const screenHeight: c_int = 450;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//----------------------------------------------------------------------------------
|
||||
pub fn main() void {
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
|
||||
if (builtin.os.tag == .emscripten) {
|
||||
std.os.emscripten.emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||
} else {
|
||||
rl.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!rl.WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
UpdateDrawFrame();
|
||||
}
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
rl.CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
fn UpdateDrawFrame() callconv(.c) void {
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
rl.BeginDrawing();
|
||||
|
||||
rl.ClearBackground(rl.RAYWHITE);
|
||||
|
||||
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY);
|
||||
|
||||
rl.EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@ -26,13 +26,13 @@ REM Checks if cl is available and skips to the argument loop if it is
|
||||
REM (Prevents calling vcvarsall every time you run this script)
|
||||
WHERE cl >nul 2>nul
|
||||
IF %ERRORLEVEL% == 0 goto READ_ARGS
|
||||
|
||||
REM Activate the msvc build environment if cl isn't available yet
|
||||
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" (
|
||||
set VC_INIT="C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
|
||||
for /f "tokens=*" %%i in (
|
||||
'"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath 2^>nul'
|
||||
) do set VS_PATH=%%i
|
||||
IF defined VS_PATH (
|
||||
set VC_INIT="%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
) ELSE (
|
||||
REM Initialize your vc environment here if the defaults don't work
|
||||
REM set VC_INIT="C:\your\path\here\vcvarsall.bat"
|
||||
@ -167,7 +167,7 @@ IF NOT EXIST !TEMP_DIR!\ (
|
||||
cd !TEMP_DIR!
|
||||
REM raylib source folder
|
||||
set "RAYLIB_DEFINES=/D_DEFAULT_SOURCE /DPLATFORM_DESKTOP /DGRAPHICS_API_OPENGL_33"
|
||||
set RAYLIB_C_FILES="!RAYLIB_SRC!\rcore.c" "!RAYLIB_SRC!\rshapes.c" "!RAYLIB_SRC!\rtextures.c" "!RAYLIB_SRC!\rtext.c" "!RAYLIB_SRC!\rmodels.c" "!RAYLIB_SRC!\utils.c" "!RAYLIB_SRC!\raudio.c" "!RAYLIB_SRC!\rglfw.c"
|
||||
set RAYLIB_C_FILES="!RAYLIB_SRC!\rcore.c" "!RAYLIB_SRC!\rshapes.c" "!RAYLIB_SRC!\rtextures.c" "!RAYLIB_SRC!\rtext.c" "!RAYLIB_SRC!\rmodels.c" "!RAYLIB_SRC!\raudio.c" "!RAYLIB_SRC!\rglfw.c"
|
||||
set RAYLIB_INCLUDE_FLAGS=/I"!RAYLIB_SRC!" /I"!RAYLIB_SRC!\external\glfw\include"
|
||||
|
||||
IF DEFINED REALLY_QUIET (
|
||||
|
||||
11
src/Makefile
11
src/Makefile
@ -275,11 +275,20 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_SOFTWARE # Uncomment to use software rendering
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB_RGFW)
|
||||
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
||||
|
||||
ifeq ($(GRAPHICS),GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
$(error WEB_RGFW: Software rendering not supported!)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||
# By default use OpenGL ES 2.0 on Android
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||
|
||||
11
src/config.h
11
src/config.h
@ -73,7 +73,7 @@
|
||||
#define SUPPORT_RPRAND_GENERATOR 1
|
||||
#endif
|
||||
#ifndef SUPPORT_MOUSE_GESTURES
|
||||
// Mouse gestures are directly mapped like touches and processed by gestures system
|
||||
// Mouse gestures are directly mapped like touches and processed by the gestures system
|
||||
#define SUPPORT_MOUSE_GESTURES 1
|
||||
#endif
|
||||
#ifndef SUPPORT_SSH_KEYBOARD_RPI
|
||||
@ -125,7 +125,7 @@
|
||||
#endif
|
||||
|
||||
// rcore: Configuration values
|
||||
// NOTE: Below values are alread defined inside [rcore.c] so there is no need to be
|
||||
// NOTE: Below values are already defined inside [rcore.c] so there is no need to be
|
||||
// redefined here, in case it must be done, uncomment the required line and update
|
||||
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||
//------------------------------------------------------------------------------------
|
||||
@ -159,7 +159,7 @@
|
||||
#endif
|
||||
|
||||
// rlgl: Configuration values
|
||||
// NOTE: Below values are alread defined inside [rlgl.h] so there is no need to be
|
||||
// NOTE: Below values are already defined inside [rlgl.h] so there is no need to be
|
||||
// redefined here, in case it must be done, uncomment the required line and update
|
||||
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||
//------------------------------------------------------------------------------------
|
||||
@ -252,6 +252,9 @@
|
||||
#ifndef SUPPORT_FILEFORMAT_PIC
|
||||
#define SUPPORT_FILEFORMAT_PIC 0 // Disabled by default
|
||||
#endif
|
||||
#ifndef SUPPORT_FILEFORMAT_PNM
|
||||
#define SUPPORT_FILEFORMAT_PNM 0 // Disabled by default
|
||||
#endif
|
||||
#ifndef SUPPORT_FILEFORMAT_KTX
|
||||
#define SUPPORT_FILEFORMAT_KTX 0 // Disabled by default
|
||||
#endif
|
||||
@ -349,7 +352,7 @@
|
||||
#endif
|
||||
|
||||
// raudio: Configuration values
|
||||
// NOTE: Below values are alread defined inside [rlgl.h] so there is no need to be
|
||||
// NOTE: Below values are already defined inside [rlgl.h] so there is no need to be
|
||||
// redefined here, in case it must be done, uncomment the required line and update
|
||||
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
@ -177,6 +177,13 @@ typedef struct {
|
||||
RGFW_window *window; // Native display device (physical screen connection)
|
||||
RGFW_monitor *monitor;
|
||||
mg_gamepads minigamepad;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
RGFW_surface *surface;
|
||||
u8 *surfacePixels;
|
||||
i32 surfaceWidth;
|
||||
i32 surfaceHeight;
|
||||
#endif
|
||||
} PlatformData;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -1121,7 +1128,35 @@ void DisableCursor(void)
|
||||
// Swap back buffer with front buffer (screen drawing)
|
||||
void SwapScreenBuffer(void)
|
||||
{
|
||||
RGFW_window_swapBuffers_OpenGL(platform.window);
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
{
|
||||
if (platform.surface)
|
||||
{
|
||||
// copy rlsw pixel data to the surface framebuffer
|
||||
swReadPixels(0, 0, platform.surfaceWidth, platform.surfaceHeight, SW_RGBA, SW_UNSIGNED_BYTE, platform.surfacePixels);
|
||||
|
||||
// Mac wants a different pixel order. I cant seem to get this to work any other way
|
||||
#if defined(__APPLE__)
|
||||
unsigned char temp = 0;
|
||||
unsigned char *p = NULL;
|
||||
for (int i = 0; i < (platform.surfaceWidth * platform.surfaceHeight); i += 1)
|
||||
{
|
||||
p = platform.surfacePixels + (i * 4);
|
||||
temp = p[0];
|
||||
p[0] = p[2];
|
||||
p[2] = temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
// blit surface to the window
|
||||
RGFW_window_blitSurface(platform.window, platform.surface);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
RGFW_window_swapBuffers_OpenGL(platform.window);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -1131,7 +1166,9 @@ void SwapScreenBuffer(void)
|
||||
// Get elapsed time measure in seconds since InitTimer()
|
||||
double GetTime(void)
|
||||
{
|
||||
double time = get_time_seconds() - CORE.Time.base;
|
||||
// CORE.Time.base is nanoseconds as integer
|
||||
double baseTime = (double)CORE.Time.base*1e-9;
|
||||
double time = get_time_seconds() - baseTime;
|
||||
|
||||
return time;
|
||||
}
|
||||
@ -1313,6 +1350,9 @@ void PollInputEvents(void)
|
||||
// Window events are also polled (Minimized, maximized, close...)
|
||||
case RGFW_windowResized:
|
||||
{
|
||||
// set flag that the window was resized
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
@ -1361,7 +1401,42 @@ void PollInputEvents(void)
|
||||
CORE.Window.currentFbo.width = CORE.Window.screen.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.screen.height;
|
||||
#endif
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
#if defined(__APPLE__)
|
||||
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
||||
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
||||
SetupViewport(platform.window->w * currentMonitor->pixelRatio, platform.window->h * currentMonitor->pixelRatio);
|
||||
|
||||
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio;
|
||||
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
#endif
|
||||
platform.surfaceWidth = CORE.Window.currentFbo.width;
|
||||
platform.surfaceHeight = CORE.Window.currentFbo.height;
|
||||
|
||||
// in software mode we dont have the viewport so we need to reverse the highdpi changes
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||
platform.surfaceWidth *= scaleDpi.x;
|
||||
platform.surfaceHeight *= scaleDpi.y;
|
||||
}
|
||||
|
||||
if (platform.surfacePixels != NULL)
|
||||
{
|
||||
RL_FREE(platform.surfacePixels);
|
||||
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4);
|
||||
}
|
||||
|
||||
if (platform.surface != NULL)
|
||||
{
|
||||
RGFW_surface_free(platform.surface);
|
||||
platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
|
||||
swResize(platform.surfaceWidth, platform.surfaceHeight);
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
case RGFW_windowMaximized:
|
||||
{
|
||||
@ -1639,6 +1714,12 @@ int InitPlatform(void)
|
||||
hints->major = 4;
|
||||
hints->minor = 3;
|
||||
}
|
||||
else if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
hints->major = 1;
|
||||
hints->minor = 1;
|
||||
hints->renderer = RGFW_glSoftware;
|
||||
}
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT)) hints->samples = 4;
|
||||
|
||||
@ -1654,7 +1735,6 @@ int InitPlatform(void)
|
||||
|
||||
RGFW_setGlobalHints_OpenGL(hints);
|
||||
platform.window = RGFW_createWindow((CORE.Window.title != 0)? CORE.Window.title : " ", 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, flags | RGFW_windowOpenGL);
|
||||
CORE.Time.base = get_time_seconds();
|
||||
|
||||
#ifndef PLATFORM_WEB_RGFW
|
||||
i32 screenSizeWidth;
|
||||
@ -1719,7 +1799,41 @@ int InitPlatform(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// apple always scales for retina
|
||||
#if defined(__APPLE__)
|
||||
RGFW_monitor* currentMonitor = RGFW_window_getMonitor(platform.window);
|
||||
CORE.Window.screenScale = MatrixScale(currentMonitor->pixelRatio, currentMonitor->pixelRatio, 1.0f);
|
||||
|
||||
CORE.Window.render.width = CORE.Window.screen.width * currentMonitor->pixelRatio;
|
||||
CORE.Window.render.height = CORE.Window.screen.height * currentMonitor->pixelRatio;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
#endif
|
||||
|
||||
platform.surfaceWidth = CORE.Window.currentFbo.width;
|
||||
platform.surfaceHeight = CORE.Window.currentFbo.height;
|
||||
|
||||
platform.surfacePixels = RL_MALLOC(platform.surfaceWidth * platform.surfaceHeight * 4);
|
||||
if (platform.surfacePixels == NULL)
|
||||
{
|
||||
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize software pixel buffer");
|
||||
return -1;
|
||||
}
|
||||
|
||||
platform.surface = RGFW_window_createSurface(platform.window, platform.surfacePixels, platform.surfaceWidth, platform.surfaceHeight, RGFW_formatBGRA8);
|
||||
|
||||
if (platform.surface == NULL)
|
||||
{
|
||||
RL_FREE(platform.surfacePixels);
|
||||
|
||||
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize software surface");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
@ -1748,20 +1862,63 @@ int InitPlatform(void)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if defined(RGFW_WAYLAND)
|
||||
if (RGFW_usingWayland()) TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Wayland): Initialized successfully");
|
||||
else TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (fallback)): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
if (RGFW_usingWayland()) TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Wayland, Software): Initialized successfully");
|
||||
else TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11, Software (fallback)): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RGFW_usingWayland()) TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Wayland): Initialized successfully");
|
||||
else TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (fallback)): Initialized successfully");
|
||||
}
|
||||
#elif defined(RGFW_X11)
|
||||
#if defined(__APPLE__)
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11 (MacOS)): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11, Software, (MacOS)): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11, (MacOS)): Initialized successfully");
|
||||
}
|
||||
#else
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11, Software): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - X11): Initialized successfully");
|
||||
}
|
||||
#endif
|
||||
#elif defined (RGFW_WINDOWS)
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Win32): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Win32, Software): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - Win32): Initialized successfully");
|
||||
}
|
||||
#elif defined(RGFW_WASM)
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - WASMs): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - WASMs, Software): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - WASMs): Initialized successfully");
|
||||
}
|
||||
#elif defined(RGFW_MACOS)
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - MacOS): Initialized successfully");
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - MacOS, Software): Initialized successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (RGFW - MacOS): Initialized successfully");
|
||||
}
|
||||
#endif
|
||||
|
||||
mg_gamepads_init(&platform.minigamepad);
|
||||
@ -1774,6 +1931,18 @@ void ClosePlatform(void)
|
||||
{
|
||||
mg_gamepads_free(&platform.minigamepad);
|
||||
RGFW_window_close(platform.window);
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
if (platform.surfacePixels != NULL)
|
||||
{
|
||||
RL_FREE(platform.surfacePixels);
|
||||
}
|
||||
|
||||
if (platform.surface != NULL)
|
||||
{
|
||||
RGFW_surface_free(platform.surface);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Keycode mapping
|
||||
@ -1791,34 +1960,36 @@ double get_time_seconds(void)
|
||||
|
||||
#if defined(_WIN32)
|
||||
static LARGE_INTEGER freq = { 0 };
|
||||
static int freq_init = 0;
|
||||
LARGE_INTEGER counter;
|
||||
if (!freq_init) {
|
||||
static bool freqInitialized = false;
|
||||
LARGE_INTEGER counter = { 0 };
|
||||
if (!freqInitialized)
|
||||
{
|
||||
// Lazy initialization
|
||||
QueryPerformanceFrequency(&freq);
|
||||
freq_init = 1;
|
||||
freqInitialized = true;
|
||||
}
|
||||
QueryPerformanceCounter(&counter);
|
||||
currentTime = (double)counter.QuadPart / (double)freq.QuadPart;
|
||||
currentTime = (double)counter.QuadPart/(double)freq.QuadPart;
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
currentTime = emscripten_get_now() / 1000.0;
|
||||
currentTime = emscripten_get_now()/1000.0;
|
||||
#elif defined(__APPLE__)
|
||||
static mach_timebase_info_data_t tb;
|
||||
static int tb_initialized = 0;
|
||||
|
||||
if (!tb_initialized) {
|
||||
static mach_timebase_info_data_t tb = { 0 };
|
||||
static bool tbInitialized = false;
|
||||
if (!tbInitialized)
|
||||
{
|
||||
mach_timebase_info(&tb);
|
||||
tb_initialized = 1;
|
||||
tbInitialized = true;
|
||||
}
|
||||
uint64_t ticks = mach_absolute_time();
|
||||
|
||||
currentTime = (double)ticks * (double)tb.numer / (double)tb.denom / 1e9;
|
||||
currentTime = (double)ticks*(double)tb.numer/(double)tb.denom/1e9;
|
||||
#elif defined(__linux__)
|
||||
struct timespec ts;
|
||||
struct timespec ts = { 0 };
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
currentTime = (double)ts.tv_sec + (double)ts.tv_nsec / 1e9;
|
||||
currentTime = (double)ts.tv_sec + (double)ts.tv_nsec/1e9;
|
||||
#else
|
||||
// fallback to cstd
|
||||
currentTime = (double)clock() / (double)CLOCKS_PER_SEC;
|
||||
// Fallback to cstd
|
||||
currentTime = (double)clock()/(double)CLOCKS_PER_SEC;
|
||||
#endif
|
||||
|
||||
return currentTime;
|
||||
|
||||
@ -2068,7 +2068,8 @@ int InitPlatform(void)
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
|
||||
@ -1643,7 +1643,8 @@ int InitPlatform(void)
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
|
||||
@ -1426,7 +1426,7 @@ int InitPlatform(void)
|
||||
if (eglGetPlatformDisplayEXT != NULL) platform.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_KHR, platform.gbmDevice, NULL);
|
||||
}
|
||||
|
||||
// In case extension not found or display could not be retrieved, try useing legacy version
|
||||
// In case extension not found or display could not be retrieved, try using legacy version
|
||||
if (platform.device == EGL_NO_DISPLAY) platform.device = eglGetDisplay((EGLNativeDisplayType)platform.gbmDevice);
|
||||
#endif
|
||||
if (platform.device == EGL_NO_DISPLAY)
|
||||
@ -1549,12 +1549,6 @@ int InitPlatform(void)
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1580,13 +1574,14 @@ int InitPlatform(void)
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
#endif
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully (Software Rendering)");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
#endif
|
||||
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED)) MinimizeWindow();
|
||||
|
||||
|
||||
@ -474,12 +474,6 @@ int InitPlatform(void)
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -494,7 +488,8 @@ int InitPlatform(void)
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
|
||||
@ -1423,7 +1423,8 @@ int InitPlatform(void)
|
||||
CORE.Window.currentFbo.width = fbWidth;
|
||||
CORE.Window.currentFbo.height = fbHeight;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
|
||||
@ -1245,7 +1245,8 @@ int InitPlatform(void)
|
||||
CORE.Window.currentFbo.width = fbWidth;
|
||||
CORE.Window.currentFbo.height = fbHeight;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully %s",
|
||||
FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI)? "(HighDPI)" : "");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
|
||||
21
src/raudio.c
21
src/raudio.c
@ -11,22 +11,22 @@
|
||||
* - Play/Stop/Pause/Resume loaded audio
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RAUDIO
|
||||
* #define SUPPORT_MODULE_RAUDIO 1
|
||||
* raudio module is included in the build
|
||||
*
|
||||
* #define RAUDIO_STANDALONE
|
||||
* Define to use the module as standalone library (independently of raylib)
|
||||
* Required types and functions are defined in the same module
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_WAV
|
||||
* #define SUPPORT_FILEFORMAT_OGG
|
||||
* #define SUPPORT_FILEFORMAT_MP3
|
||||
* #define SUPPORT_FILEFORMAT_QOA
|
||||
* #define SUPPORT_FILEFORMAT_FLAC
|
||||
* #define SUPPORT_FILEFORMAT_XM
|
||||
* #define SUPPORT_FILEFORMAT_MOD
|
||||
* #define SUPPORT_FILEFORMAT_WAV 1
|
||||
* #define SUPPORT_FILEFORMAT_OGG 1
|
||||
* #define SUPPORT_FILEFORMAT_MP3 1
|
||||
* #define SUPPORT_FILEFORMAT_QOA 1
|
||||
* #define SUPPORT_FILEFORMAT_FLAC 0
|
||||
* #define SUPPORT_FILEFORMAT_XM 1
|
||||
* #define SUPPORT_FILEFORMAT_MOD 1
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* supported by default, to remove support, comment unrequired #define in this module
|
||||
* supported by default, to remove support, #define as 0 in this module or your build system
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* miniaudio.h - Audio device management lib (https://github.com/mackron/miniaudio)
|
||||
@ -1702,8 +1702,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||
|
||||
// Copy data to allocated memory for default UnloadMusicStream
|
||||
unsigned char *newData = (unsigned char *)RL_MALLOC(dataSize);
|
||||
int it = dataSize/sizeof(unsigned char);
|
||||
for (int i = 0; i < it; i++) newData[i] = data[i];
|
||||
for (int i = 0; i < dataSize; i++) newData[i] = data[i];
|
||||
|
||||
// Memory loaded version for jar_mod_load_file()
|
||||
if (dataSize && (dataSize < 32*1024*1024))
|
||||
|
||||
20
src/raylib.h
20
src/raylib.h
@ -10,7 +10,7 @@
|
||||
* - Software renderer optional, for systems with no GPU: [rlsw]
|
||||
* - Custom OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||
* - Multiple Fonts formats supported (TTF, OTF, FNT, BDF, Sprite fonts)
|
||||
* - Many texture formats supportted, including compressed formats (DXT, ETC, ASTC)
|
||||
* - Many texture formats supported, including compressed formats (DXT, ETC, ASTC)
|
||||
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
|
||||
* - Flexible Materials system, supporting classic maps and PBR maps
|
||||
* - Animated 3D models supported (skeletal bones animation) (IQM, M3D, GLTF)
|
||||
@ -35,14 +35,14 @@
|
||||
* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
|
||||
* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
|
||||
* [rcore] rprand (Ramon Santamaria) for pseudo-random numbers generation
|
||||
* [rtextures] qoi (Dominic Szablewski - https://phoboslab.org) for QOI image manage
|
||||
* [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
|
||||
* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
|
||||
* [rtextures] stb_image_resize2 (Sean Barret) for image resizing algorithms
|
||||
* [rtextures] stb_perlin (Sean Barret) for Perlin Noise image generation
|
||||
* [rtextures] qoi (Dominic Szablewski - https://phoboslab.org) for QOI image management
|
||||
* [rtextures] stb_image (Sean Barrett) for images loading (BMP, TGA, PNG, JPEG, HDR...)
|
||||
* [rtextures] stb_image_write (Sean Barrett) for image writing (BMP, TGA, PNG, JPG)
|
||||
* [rtextures] stb_image_resize2 (Sean Barrett) for image resizing algorithms
|
||||
* [rtextures] stb_perlin (Sean Barrett) for Perlin Noise image generation
|
||||
* [rtextures] rltexgpu (Ramon Santamaria) for GPU-compressed texture formats
|
||||
* [rtext] stb_truetype (Sean Barret) for ttf fonts loading
|
||||
* [rtext] stb_rect_pack (Sean Barret) for rectangles packing
|
||||
* [rtext] stb_truetype (Sean Barrett) for ttf fonts loading
|
||||
* [rtext] stb_rect_pack (Sean Barrett) for rectangles packing
|
||||
* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
|
||||
* [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
|
||||
* [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
|
||||
@ -51,10 +51,10 @@
|
||||
* [raudio] dr_wav (David Reid) for WAV audio file loading
|
||||
* [raudio] dr_flac (David Reid) for FLAC audio file loading
|
||||
* [raudio] dr_mp3 (David Reid) for MP3 audio file loading
|
||||
* [raudio] stb_vorbis (Sean Barret) for OGG audio loading
|
||||
* [raudio] stb_vorbis (Sean Barrett) for OGG audio loading
|
||||
* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
|
||||
* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
|
||||
* [raudio] qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio manage
|
||||
* [raudio] qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio management
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* - Functions use always a "result" variable for return (except C++ operators)
|
||||
* - Functions are always defined inline
|
||||
* - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience)
|
||||
* - No compound literals used to make sure libray is compatible with C++
|
||||
* - No compound literals used to make sure the library is compatible with C++
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define RAYMATH_IMPLEMENTATION
|
||||
@ -183,7 +183,7 @@ typedef struct float16 {
|
||||
#if RAYMATH_USE_SIMD_INTRINSICS
|
||||
// SIMD is used on the most costly raymath function MatrixMultiply()
|
||||
// NOTE: Only SSE intrinsics support implemented
|
||||
// TODO: Consider support for other SIMD instrinsics:
|
||||
// TODO: Consider support for other SIMD intrinsics:
|
||||
// - SSEx, AVX, AVX2, FMA, NEON, RVV
|
||||
/*
|
||||
#if defined(__SSE4_2__)
|
||||
@ -1151,7 +1151,7 @@ RMAPI Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view)
|
||||
// Create quaternion from source point
|
||||
Quaternion quat = { source.x, source.y, source.z, 1.0f };
|
||||
|
||||
// Multiply quat point by unprojecte matrix
|
||||
// Multiply quat point by unprojected matrix
|
||||
Quaternion qtransformed = { // QuaternionTransform(quat, matViewProjInv)
|
||||
matViewProjInv.m0*quat.x + matViewProjInv.m4*quat.y + matViewProjInv.m8*quat.z + matViewProjInv.m12*quat.w,
|
||||
matViewProjInv.m1*quat.x + matViewProjInv.m5*quat.y + matViewProjInv.m9*quat.z + matViewProjInv.m13*quat.w,
|
||||
@ -1264,19 +1264,21 @@ RMAPI Vector3 Vector3Refract(Vector3 v, Vector3 n, float r)
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector4 math
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Get vector zero
|
||||
RMAPI Vector4 Vector4Zero(void)
|
||||
{
|
||||
Vector4 result = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get vector one
|
||||
RMAPI Vector4 Vector4One(void)
|
||||
{
|
||||
Vector4 result = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Add two vectors
|
||||
RMAPI Vector4 Vector4Add(Vector4 v1, Vector4 v2)
|
||||
{
|
||||
Vector4 result = {
|
||||
@ -1288,6 +1290,7 @@ RMAPI Vector4 Vector4Add(Vector4 v1, Vector4 v2)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Add value to vector components
|
||||
RMAPI Vector4 Vector4AddValue(Vector4 v, float add)
|
||||
{
|
||||
Vector4 result = {
|
||||
@ -1299,6 +1302,7 @@ RMAPI Vector4 Vector4AddValue(Vector4 v, float add)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Substract vectors
|
||||
RMAPI Vector4 Vector4Subtract(Vector4 v1, Vector4 v2)
|
||||
{
|
||||
Vector4 result = {
|
||||
@ -1310,6 +1314,7 @@ RMAPI Vector4 Vector4Subtract(Vector4 v1, Vector4 v2)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Substract value from vector components
|
||||
RMAPI Vector4 Vector4SubtractValue(Vector4 v, float add)
|
||||
{
|
||||
Vector4 result = {
|
||||
@ -1321,18 +1326,21 @@ RMAPI Vector4 Vector4SubtractValue(Vector4 v, float add)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Vector length
|
||||
RMAPI float Vector4Length(Vector4 v)
|
||||
{
|
||||
float result = sqrtf((v.x*v.x) + (v.y*v.y) + (v.z*v.z) + (v.w*v.w));
|
||||
return result;
|
||||
}
|
||||
|
||||
// Vector square length
|
||||
RMAPI float Vector4LengthSqr(Vector4 v)
|
||||
{
|
||||
float result = (v.x*v.x) + (v.y*v.y) + (v.z*v.z) + (v.w*v.w);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Vectors dot product
|
||||
RMAPI float Vector4DotProduct(Vector4 v1, Vector4 v2)
|
||||
{
|
||||
float result = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z + v1.w*v2.w);
|
||||
@ -1358,6 +1366,7 @@ RMAPI float Vector4DistanceSqr(Vector4 v1, Vector4 v2)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Scale vector components by value (multiply)
|
||||
RMAPI Vector4 Vector4Scale(Vector4 v, float scale)
|
||||
{
|
||||
Vector4 result = { v.x*scale, v.y*scale, v.z*scale, v.w*scale };
|
||||
@ -1753,13 +1762,14 @@ RMAPI Matrix MatrixMultiply(Matrix left, Matrix right)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Multiply matrix components by value
|
||||
RMAPI Matrix MatrixMultiplyValue(Matrix left, float value)
|
||||
{
|
||||
Matrix result = {
|
||||
left.m0 * value, left.m4 * value, left.m8 * value, left.m12 * value,
|
||||
left.m1 * value, left.m5 * value, left.m9 * value, left.m13 * value,
|
||||
left.m2 * value, left.m6 * value, left.m10 * value, left.m14 * value,
|
||||
left.m3 * value, left.m7 * value, left.m11 * value, left.m15 * value
|
||||
left.m0*value, left.m4*value, left.m8*value, left.m12*value,
|
||||
left.m1*value, left.m5*value, left.m9*value, left.m13*value,
|
||||
left.m2*value, left.m6*value, left.m10*value, left.m14*value,
|
||||
left.m3*value, left.m7*value, left.m11*value, left.m15*value
|
||||
};
|
||||
|
||||
return result;
|
||||
@ -2495,19 +2505,14 @@ RMAPI Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
|
||||
{
|
||||
Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
float axisLength = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
|
||||
float length = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
|
||||
|
||||
if (axisLength != 0.0f)
|
||||
if (length != 0.0f)
|
||||
{
|
||||
angle *= 0.5f;
|
||||
|
||||
float length = 0.0f;
|
||||
float ilength = 0.0f;
|
||||
|
||||
// Vector3Normalize(axis)
|
||||
length = axisLength;
|
||||
if (length == 0.0f) length = 1.0f;
|
||||
ilength = 1.0f/length;
|
||||
float ilength = 1.0f/length;
|
||||
axis.x *= ilength;
|
||||
axis.y *= ilength;
|
||||
axis.z *= ilength;
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
Vector3 position; // Camera position
|
||||
Vector3 target; // Camera target it looks-at
|
||||
Vector3 up; // Camera up vector (rotation over its axis)
|
||||
float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
|
||||
float fovy; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
|
||||
int projection; // Camera projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
||||
} Camera3D;
|
||||
|
||||
@ -352,7 +352,7 @@ void CameraYaw(Camera *camera, float angle, bool rotateAroundTarget)
|
||||
// Rotates the camera around its right vector, pitch is "looking up and down"
|
||||
// - lockView prevents camera overrotation (aka "somersaults")
|
||||
// - rotateAroundTarget defines if rotation is around target or around its position
|
||||
// - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE)
|
||||
// - rotateUp rotates the up direction as well (typically only useful in CAMERA_FREE)
|
||||
// NOTE: [angle] must be provided in radians
|
||||
void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp)
|
||||
{
|
||||
|
||||
50
src/rcore.c
50
src/rcore.c
@ -35,31 +35,31 @@
|
||||
* - Memory framebuffer output, using software renderer, no OS required
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_CAMERA_SYSTEM
|
||||
* #define SUPPORT_CAMERA_SYSTEM 1
|
||||
* Camera module is included (rcamera.h) and multiple predefined cameras are available:
|
||||
* free, 1st/3rd person, orbital, custom
|
||||
*
|
||||
* #define SUPPORT_GESTURES_SYSTEM
|
||||
* #define SUPPORT_GESTURES_SYSTEM 1
|
||||
* Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag
|
||||
*
|
||||
* #define SUPPORT_MOUSE_GESTURES
|
||||
* #define SUPPORT_MOUSE_GESTURES 1
|
||||
* Mouse gestures are directly mapped like touches and processed by gestures system
|
||||
*
|
||||
* #define SUPPORT_BUSY_WAIT_LOOP
|
||||
* #define SUPPORT_BUSY_WAIT_LOOP 1
|
||||
* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
|
||||
*
|
||||
* #define SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||
* #define SUPPORT_PARTIALBUSY_WAIT_LOOP 0
|
||||
* Use a partial-busy wait loop, in this case frame sleeps for most of the time and runs a busy-wait-loop at the end
|
||||
*
|
||||
* #define SUPPORT_SCREEN_CAPTURE
|
||||
* #define SUPPORT_SCREEN_CAPTURE 1
|
||||
* Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
|
||||
*
|
||||
* #define SUPPORT_COMPRESSION_API
|
||||
* #define SUPPORT_COMPRESSION_API 1
|
||||
* Support CompressData() and DecompressData() functions, those functions use zlib implementation
|
||||
* provided by stb_image and stb_image_write libraries, so, those libraries must be enabled on textures module
|
||||
* for linkage
|
||||
*
|
||||
* #define SUPPORT_AUTOMATION_EVENTS
|
||||
* #define SUPPORT_AUTOMATION_EVENTS 1
|
||||
* Support automatic events recording and playing, useful for automated testing systems or AI based game playing
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
@ -307,7 +307,7 @@ typedef struct CoreData {
|
||||
Size screen; // Screen current width and height
|
||||
Point position; // Window current position
|
||||
Size previousScreen; // Screen previous width and height (required on fullscreen/borderless-windowed toggle)
|
||||
Point previousPosition; // Window previous position (required on fullscreeen/borderless-windowed toggle)
|
||||
Point previousPosition; // Window previous position (required on fullscreen/borderless-windowed toggle)
|
||||
Size render; // Screen framebuffer width and height
|
||||
Point renderOffset; // Screen framebuffer render offset (Not required anymore?)
|
||||
Size currentFbo; // Current framebuffer render width and height (depends on active render texture)
|
||||
@ -329,7 +329,7 @@ typedef struct CoreData {
|
||||
char currentKeyState[MAX_KEYBOARD_KEYS]; // Registers current frame key state
|
||||
char previousKeyState[MAX_KEYBOARD_KEYS]; // Registers previous frame key state
|
||||
|
||||
// NOTE: Since key press logic involves comparing previous vs currrent key state,
|
||||
// NOTE: Since key press logic involves comparing previous vs current key state,
|
||||
// key repeats needs to be handled specially
|
||||
char keyRepeatInFrame[MAX_KEYBOARD_KEYS]; // Registers key repeats for current frame
|
||||
|
||||
@ -379,14 +379,14 @@ typedef struct CoreData {
|
||||
} Gamepad;
|
||||
} Input;
|
||||
struct {
|
||||
double current; // Current time measure
|
||||
double previous; // Previous time measure
|
||||
double update; // Time measure for frame update
|
||||
double draw; // Time measure for frame draw
|
||||
double frame; // Time measure for one frame
|
||||
double target; // Desired time for one frame, if 0 not applied
|
||||
unsigned long long int base; // Base time measure for hi-res timer (PLATFORM_ANDROID, PLATFORM_DRM)
|
||||
unsigned int frameCounter; // Frame counter
|
||||
double current; // Current time measure (seconds)
|
||||
double previous; // Previous time measure (seconds)
|
||||
double update; // Time measure for frame update (seconds)
|
||||
double draw; // Time measure for frame draw (seconds)
|
||||
double frame; // Time measure for one frame (seconds)
|
||||
double target; // Desired time for one frame, if 0 not applied (seconds)
|
||||
unsigned long long int base; // Base time measure for hi-res timer (ticks or nanoseconds)
|
||||
unsigned int frameCounter; // Frame counter (frames)
|
||||
|
||||
} Time;
|
||||
} CoreData;
|
||||
@ -714,7 +714,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
Rectangle rec = GetFontDefault().recs[95];
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT))
|
||||
{
|
||||
// NOTE: Try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||
// NOTE: Try to maximize rec padding to avoid pixel bleeding on MSAA filtering
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||
}
|
||||
else
|
||||
@ -2514,9 +2514,9 @@ const char *GetFileNameWithoutExt(const char *filePath)
|
||||
if (filePath != NULL)
|
||||
{
|
||||
strncpy(fileName, GetFileName(filePath), MAX_FILENAME_LENGTH - 1); // Get filename.ext without path
|
||||
int fileNameLenght = (int)strlen(fileName); // Get size in bytes
|
||||
int fileNameLength = (int)strlen(fileName); // Get size in bytes
|
||||
|
||||
for (int i = fileNameLenght; i > 0; i--) // Reverse search '.'
|
||||
for (int i = fileNameLength; i > 0; i--) // Reverse search '.'
|
||||
{
|
||||
if (fileName[i] == '.')
|
||||
{
|
||||
@ -3039,7 +3039,7 @@ unsigned char *DecompressData(const unsigned char *compData, int compDataSize, i
|
||||
char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize)
|
||||
{
|
||||
// Base64 conversion table from RFC 4648 [0..63]
|
||||
// NOTE: They represent 64 values (6 bits), to encode 3 bytes of data into 4 "sixtets" (6bit characters)
|
||||
// NOTE: They represent 64 values (6 bits), to encode 3 bytes of data into 4 "sextets" (6bit characters)
|
||||
static const char base64EncodeTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
// Compute expected size and padding
|
||||
@ -3126,7 +3126,7 @@ unsigned char *DecodeDataBase64(const char *text, int *outputSize)
|
||||
int outputCount = 0;
|
||||
for (int i = 0; i < dataSize;)
|
||||
{
|
||||
// Every 4 sixtets must generate 3 octets
|
||||
// Every 4 sextets must generate 3 octets
|
||||
if ((i + 2) >= dataSize)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "BASE64: Decoding error: Input data size is not valid");
|
||||
@ -4125,8 +4125,8 @@ Vector2 GetMouseDelta(void)
|
||||
{
|
||||
Vector2 delta = { 0 };
|
||||
|
||||
delta.x = CORE.Input.Mouse.currentPosition.x - CORE.Input.Mouse.previousPosition.x;
|
||||
delta.y = CORE.Input.Mouse.currentPosition.y - CORE.Input.Mouse.previousPosition.y;
|
||||
delta.x = (CORE.Input.Mouse.currentPosition.x - CORE.Input.Mouse.previousPosition.x)*CORE.Input.Mouse.scale.x;
|
||||
delta.y = (CORE.Input.Mouse.currentPosition.y - CORE.Input.Mouse.previousPosition.y)*CORE.Input.Mouse.scale.y;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ void UpdateGestures(void); // Update gestures detec
|
||||
|
||||
#if defined(RGESTURES_STANDALONE)
|
||||
void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
|
||||
bool IsGestureDetected(int gesture); // Check if a gesture have been detected
|
||||
bool IsGestureDetected(int gesture); // Check if a gesture has been detected
|
||||
int GetGestureDetected(void); // Get latest detected gesture
|
||||
|
||||
float GetGestureHoldDuration(void); // Get gesture hold time in seconds
|
||||
@ -297,10 +297,10 @@ void ProcessGestureEvent(GestureEvent event)
|
||||
}
|
||||
else if (event.touchAction == TOUCH_ACTION_UP)
|
||||
{
|
||||
// A swipe can happen while the current gesture is drag, but (specially for web) also hold, so set upPosition for both cases
|
||||
// A swipe can happen while the current gesture is drag, but (especially for web) also hold, so set upPosition for both cases
|
||||
if (GESTURES.current == GESTURE_DRAG || GESTURES.current == GESTURE_HOLD) GESTURES.Touch.upPosition = event.position[0];
|
||||
|
||||
// NOTE: GESTURES.Drag.intensity dependent on the resolution of the screen
|
||||
// NOTE: GESTURES.Drag.intensity is dependent on the resolution of the screen
|
||||
GESTURES.Drag.distance = rgVector2Distance(GESTURES.Touch.downPositionA, GESTURES.Touch.upPosition);
|
||||
GESTURES.Drag.intensity = GESTURES.Drag.distance/(float)((rgGetCurrentTime() - GESTURES.Swipe.startTime));
|
||||
|
||||
|
||||
16
src/rlgl.h
16
src/rlgl.h
@ -7,10 +7,10 @@
|
||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||
*
|
||||
* ADDITIONAL NOTES:
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffers are
|
||||
* initialized on rlglInit() to accumulate vertex data
|
||||
*
|
||||
* When an internal state change is required all the stored vertex data is rendered in batch,
|
||||
* When an internal state change is required all the stored vertex data is rendered in a batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch
|
||||
*
|
||||
* Some resources are also loaded for convenience, here the complete list:
|
||||
@ -29,7 +29,7 @@
|
||||
* #define GRAPHICS_API_OPENGL_ES2
|
||||
* #define GRAPHICS_API_OPENGL_ES3
|
||||
* Use selected OpenGL graphics backend, should be supported by platform
|
||||
* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
||||
* Those preprocessor defines are only used on the rlgl module, if OpenGL version is
|
||||
* required by any other module, use rlGetVersion() to check it
|
||||
*
|
||||
* #define RLGL_IMPLEMENTATION
|
||||
@ -49,7 +49,7 @@
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of texture units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
*
|
||||
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
@ -1139,21 +1139,23 @@ typedef struct rlglData {
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
static bool isGpuReady = false;
|
||||
static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR;
|
||||
static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
static rlglData RLGL = { 0 };
|
||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||
static bool isGpuReady = false;
|
||||
#endif
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(GRAPHICS_API_OPENGL_ES3)
|
||||
// VAO functions entry points
|
||||
// NOTE: VAO functionality is exposed through extensions (OES)
|
||||
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
|
||||
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
|
||||
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
|
||||
|
||||
// NOTE: Instancing functionality could also be available through extension
|
||||
// Instancing functionality entry points
|
||||
// NOTE: Instancing functionality could be available through extensions
|
||||
static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL;
|
||||
static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL;
|
||||
static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
|
||||
|
||||
@ -3,19 +3,19 @@
|
||||
* rmodels - Basic functions to draw 3d shapes and load and draw 3d models
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RMODELS
|
||||
* #define SUPPORT_MODULE_RMODELS 1
|
||||
* rmodels module is included in the build
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_OBJ
|
||||
* #define SUPPORT_FILEFORMAT_MTL
|
||||
* #define SUPPORT_FILEFORMAT_IQM
|
||||
* #define SUPPORT_FILEFORMAT_GLTF
|
||||
* #define SUPPORT_FILEFORMAT_GLTF_WRITE
|
||||
* #define SUPPORT_FILEFORMAT_VOX
|
||||
* #define SUPPORT_FILEFORMAT_M3D
|
||||
* #define SUPPORT_FILEFORMAT_OBJ 1
|
||||
* #define SUPPORT_FILEFORMAT_MTL 1
|
||||
* #define SUPPORT_FILEFORMAT_IQM 1
|
||||
* #define SUPPORT_FILEFORMAT_GLTF 1
|
||||
* #define SUPPORT_FILEFORMAT_GLTF_WRITE 0
|
||||
* #define SUPPORT_FILEFORMAT_VOX 1
|
||||
* #define SUPPORT_FILEFORMAT_M3D 1
|
||||
* Selected desired fileformats to be supported for model data loading
|
||||
*
|
||||
* #define SUPPORT_MESH_GENERATION
|
||||
* #define SUPPORT_MESH_GENERATION 1
|
||||
* Support procedural mesh generation functions, uses external par_shapes.h library
|
||||
* NOTE: Some generated meshes DO NOT include generated texture coordinates
|
||||
*
|
||||
@ -4105,7 +4105,7 @@ bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, floa
|
||||
|
||||
// Check for distances squared to avoid sqrtf()
|
||||
float radSum = radius1 + radius2;
|
||||
if (Vector3DistanceSqr(center1, center2) <= radSum*radSum) collision = true;
|
||||
if (Vector3DistanceSqr(center1, center2) <= (radSum*radSum)) collision = true;
|
||||
|
||||
return collision;
|
||||
}
|
||||
@ -4131,18 +4131,13 @@ bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius)
|
||||
{
|
||||
bool collision = false;
|
||||
|
||||
float dmin = 0;
|
||||
Vector3 closestPoint = {
|
||||
Clamp(center.x, box.min.x, box.max.x),
|
||||
Clamp(center.y, box.min.y, box.max.y),
|
||||
Clamp(center.z, box.min.z, box.max.z)
|
||||
};
|
||||
|
||||
if (center.x < box.min.x) dmin += powf(center.x - box.min.x, 2);
|
||||
else if (center.x > box.max.x) dmin += powf(center.x - box.max.x, 2);
|
||||
|
||||
if (center.y < box.min.y) dmin += powf(center.y - box.min.y, 2);
|
||||
else if (center.y > box.max.y) dmin += powf(center.y - box.max.y, 2);
|
||||
|
||||
if (center.z < box.min.z) dmin += powf(center.z - box.min.z, 2);
|
||||
else if (center.z > box.max.z) dmin += powf(center.z - box.max.z, 2);
|
||||
|
||||
if (dmin <= (radius*radius)) collision = true;
|
||||
if (Vector3DistanceSqr(center, closestPoint) <= (radius*radius)) collision = true;
|
||||
|
||||
return collision;
|
||||
}
|
||||
@ -6898,7 +6893,7 @@ static Model LoadM3D(const char *fileName)
|
||||
mi = m3d->face[i].materialid;
|
||||
|
||||
// Only allocate colors VertexBuffer if there's a color vertex in the model for this material batch
|
||||
// if all colors are fully transparent black for all verteces of this materal, then assuming no vertex colors
|
||||
// if all colors are fully transparent black for all vertices of this material, then assuming no vertex colors
|
||||
for (j = i, l = vcolor = 0; (j < (int)m3d->numface) && (mi == m3d->face[j].materialid); j++, l++)
|
||||
{
|
||||
if (!m3d->vertex[m3d->face[j].vertex[0]].color ||
|
||||
|
||||
@ -8,18 +8,18 @@
|
||||
* are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define
|
||||
*
|
||||
* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a
|
||||
* user-provided texture with SetShapesTexture(), the pourpouse of this implementation
|
||||
* user-provided texture with SetShapesTexture(), the purpose of this implementation
|
||||
* is allowing to reduce draw calls when combined with a texture-atlas
|
||||
*
|
||||
* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one
|
||||
* white character of default font [rtext], this way, raylib text and shapes can be draw with
|
||||
* white character of default font [rtext], this way, raylib text and shapes can be drawn with
|
||||
* a single draw call and it also allows users to configure it the same way with their own fonts
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RSHAPES
|
||||
* #define SUPPORT_MODULE_RSHAPES 1
|
||||
* rshapes module is included in the build
|
||||
*
|
||||
* #define SUPPORT_QUADS_DRAW_MODE
|
||||
* #define SUPPORT_QUADS_DRAW_MODE 1
|
||||
* Use QUADS instead of TRIANGLES for drawing when possible. Lines-based shapes still use LINES
|
||||
*
|
||||
*
|
||||
|
||||
18
src/rtext.c
18
src/rtext.c
@ -3,22 +3,22 @@
|
||||
* rtext - Basic functions to load fonts and draw text
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RTEXT
|
||||
* #define SUPPORT_MODULE_RTEXT 1
|
||||
* rtext module is included in the build
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_FNT
|
||||
* #define SUPPORT_FILEFORMAT_TTF
|
||||
* #define SUPPORT_FILEFORMAT_BDF
|
||||
* #define SUPPORT_FILEFORMAT_FNT 1
|
||||
* #define SUPPORT_FILEFORMAT_TTF 1
|
||||
* #define SUPPORT_FILEFORMAT_BDF 0
|
||||
* Selected desired fileformats to be supported for loading. Some of those formats are
|
||||
* supported by default, to remove support, comment unrequired #define in this module
|
||||
* supported by default, to remove support, #define as 0 in this module or your build system
|
||||
*
|
||||
* #define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
|
||||
* TextSplit() function static buffer max size
|
||||
* #define MAX_TEXT_BUFFER_LENGTH 1024
|
||||
* Text functions using static buffer max size
|
||||
*
|
||||
* #define MAX_TEXTSPLIT_COUNT
|
||||
* #define MAX_TEXTSPLIT_COUNT 128
|
||||
* TextSplit() function static substrings pointers array (pointing to static buffer)
|
||||
*
|
||||
* #define FONT_ATLAS_CORNER_REC_SIZE
|
||||
* #define FONT_ATLAS_CORNER_REC_SIZE 3
|
||||
* On font atlas image generation [GenImageFontAtlas()], add a NxN pixels white rectangle
|
||||
* at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
|
||||
* drawing text and shapes with a single draw call [SetShapesTexture()]
|
||||
|
||||
@ -3,31 +3,31 @@
|
||||
* rtextures - Basic functions to load and draw textures
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RTEXTURES
|
||||
* #define SUPPORT_MODULE_RTEXTURES 1
|
||||
* rtextures module is included in the build
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_BMP
|
||||
* #define SUPPORT_FILEFORMAT_PNG
|
||||
* #define SUPPORT_FILEFORMAT_TGA
|
||||
* #define SUPPORT_FILEFORMAT_JPG
|
||||
* #define SUPPORT_FILEFORMAT_GIF
|
||||
* #define SUPPORT_FILEFORMAT_QOI
|
||||
* #define SUPPORT_FILEFORMAT_PSD
|
||||
* #define SUPPORT_FILEFORMAT_HDR
|
||||
* #define SUPPORT_FILEFORMAT_PIC
|
||||
* #define SUPPORT_FILEFORMAT_PNM
|
||||
* #define SUPPORT_FILEFORMAT_DDS
|
||||
* #define SUPPORT_FILEFORMAT_PKM
|
||||
* #define SUPPORT_FILEFORMAT_KTX
|
||||
* #define SUPPORT_FILEFORMAT_PVR
|
||||
* #define SUPPORT_FILEFORMAT_ASTC
|
||||
* Select desired fileformats to be supported for image data loading. Some of those formats are
|
||||
* supported by default, to remove support, comment unrequired #define in this module
|
||||
* #define SUPPORT_FILEFORMAT_BMP 1
|
||||
* #define SUPPORT_FILEFORMAT_PNG 1
|
||||
* #define SUPPORT_FILEFORMAT_TGA 0
|
||||
* #define SUPPORT_FILEFORMAT_JPG 0
|
||||
* #define SUPPORT_FILEFORMAT_GIF 1
|
||||
* #define SUPPORT_FILEFORMAT_QOI 1
|
||||
* #define SUPPORT_FILEFORMAT_PSD 0
|
||||
* #define SUPPORT_FILEFORMAT_HDR 0
|
||||
* #define SUPPORT_FILEFORMAT_PIC 0
|
||||
* #define SUPPORT_FILEFORMAT_PNM 0
|
||||
* #define SUPPORT_FILEFORMAT_DDS 1
|
||||
* #define SUPPORT_FILEFORMAT_PKM 0
|
||||
* #define SUPPORT_FILEFORMAT_KTX 0
|
||||
* #define SUPPORT_FILEFORMAT_PVR 0
|
||||
* #define SUPPORT_FILEFORMAT_ASTC 0
|
||||
* Selected desired fileformats to be supported for image data loading. Some of those formats are
|
||||
* supported by default, to remove support, #define as 0 in this module or your build system
|
||||
*
|
||||
* #define SUPPORT_IMAGE_EXPORT
|
||||
* #define SUPPORT_IMAGE_EXPORT 1
|
||||
* Support image export in multiple file formats
|
||||
*
|
||||
* #define SUPPORT_IMAGE_GENERATION
|
||||
* #define SUPPORT_IMAGE_GENERATION 1
|
||||
* Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
@ -366,7 +366,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
|
||||
return image;
|
||||
}
|
||||
|
||||
// Load animated image data
|
||||
// Load animated image data from memory
|
||||
// - Image.data buffer includes all frames: [image#0][image#1][image#2][...]
|
||||
// - Number of frames is returned through 'frames' parameter
|
||||
// - All frames are returned in RGBA format
|
||||
@ -1575,7 +1575,7 @@ Image ImageFromChannel(Image image, int selectedChannel)
|
||||
// Check for RGBA formats
|
||||
if (selectedChannel > 3)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "ImageFromChannel supports channels 0 to 3 (rgba). Setting channel to alpha.");
|
||||
TRACELOG(LOG_WARNING, "ImageFromChannel supports channels 0 to 3 (RGBA). Setting channel to alpha.");
|
||||
selectedChannel = 3;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user