575 Commits
4.5.0 ... 5.0

Author SHA1 Message Date
Ray
ae50bfa2cc Updated Npp intellisense data for raylib 5.0 2023-11-15 11:30:50 +01:00
Ray
e84a420766 Update miniaudio to v0.11.21 2023-11-15 10:25:09 +01:00
2Bear
efc0fed9ce Fix tiny spelling mistake. (#3540) 2023-11-14 14:28:45 +01:00
Ray
5ac00a3ccb Merge branch 'master' of https://github.com/raysan5/raylib 2023-11-14 12:25:58 +01:00
ubkp
db70db5f4d Fix missing keys on PLATFORM_DESKTOP_SDL (#3539) 2023-11-14 11:49:27 +01:00
Ray
da660058eb Update HISTORY.md 2023-11-14 11:47:27 +01:00
Ray
92b7589f89 Update CHANGELOG 2023-11-14 11:47:23 +01:00
Ray
a6c33193f7 Update HISTORY.md 2023-11-13 21:40:37 +01:00
Ray
d03d6787d9 Update HISTORY.md 2023-11-13 21:21:38 +01:00
Ray
5c79c5a2ec Update rcore.c 2023-11-13 16:11:10 +01:00
ubkp
87f26c845c Fix mouse button order for SDL (#3534) 2023-11-13 00:16:31 +01:00
Ray
4f67f5f159 REVIEWED: TakeScreenshot(), potential issues 2023-11-12 12:38:10 +01:00
JupiterRider
0873af4734 Update BINDINGS.md (#3531) 2023-11-12 12:23:00 +01:00
Le Juez Victor
9099077075 [rlgl] Fixed return type of GetCompressedFormatName (#3529)
The return type of `GetCompressedFormatName` has been corrected from `char *` to `const char *`
2023-11-12 00:09:00 +01:00
Ray
1b88f2ec03 Review #3526 2023-11-11 20:53:36 +01:00
isaacgravenortechnologies
de3072f838 Added wiki links to README (#3525)
* Added wiki link

* Added second wiki link
2023-11-11 18:11:58 +01:00
ubkp
9634c84e1c Fix automation recording (#3523) 2023-11-11 16:06:23 +01:00
Ray
d32ebbe716 Testing contributors info 2023-11-11 16:05:02 +01:00
Ray
bdcca4510d Update ROADMAP.md 2023-11-10 23:25:00 +01:00
Ray
107ece438a Reviewed duplicate lines 2023-11-10 19:48:47 +01:00
Ray
e7ba72ded9 Update core_automation_events.c 2023-11-10 19:36:58 +01:00
Ray
e4ea116857 Reviewing automation events on web... 2023-11-10 19:25:28 +01:00
Ray
16b79f2c70 Format tweaks 2023-11-10 19:22:22 +01:00
Miloslav Milenkov
a92c34d83c Changed keybinds for the automation example to avoid conflict with browser shortcuts (#3519) 2023-11-10 15:04:04 +01:00
Ray
30dcbaff20 Update rlgl.h 2023-11-10 13:33:42 +01:00
Ray
737cd0be7f Updated for upcoming raylib 5.0 2023-11-10 13:27:13 +01:00
maksut
1b524bb2ec WindowShouldClose(), reset shouldClose flag when window is inited (#3518) 2023-11-09 23:36:22 +01:00
Ray
80aafdb38f REVIEWED: BeginScissorMode() #3510 2023-11-09 23:35:24 +01:00
Ray
c471d22965 Update miniaudio.h 2023-11-09 23:22:30 +01:00
Ray
21dc42d2ad Updated examples 2023-11-09 09:53:25 +01:00
Ray
c69b89cc42 Update example: shapes_splines_drawing 2023-11-09 02:01:00 +01:00
Ray
ed2ac2ae79 Update CHANGELOG 2023-11-09 00:16:58 +01:00
Ray
4c2340aea6 Update core_2d_camera_platformer.c 2023-11-08 23:35:27 +01:00
Ray
9c2308bdc3 Examples reviews 2023-11-08 23:28:31 +01:00
Ray
022b464b0b Remove BOM 2023-11-08 20:37:35 +01:00
Ray
040b945fef Reviewed some examples and warnings 2023-11-08 20:09:32 +01:00
Ray
bee6d7f065 Update Makefile.Web 2023-11-08 19:34:44 +01:00
Ray
33580991c7 Update shell.html 2023-11-08 19:34:38 +01:00
Ray
e7114a5c2a Update rcore.c 2023-11-08 19:34:29 +01:00
Ray
9d8a11f21a Update textures_textured_curve.c 2023-11-08 18:13:25 +01:00
Ray
21354119cc REVIEWED: Makefile.Web, reorganize and add examples 2023-11-08 18:10:29 +01:00
Ray
bd3ffa7db3 REDESIGNED: Spline drawing functionality
This change allows more versatile and consistent splines drawing. It also gives more control to advance users to draw splines as individual segments.
2023-11-08 17:42:35 +01:00
Ray
bbf0c3a46d REVIEWED: Added new examples to VS2022 solution 2023-11-08 17:41:08 +01:00
Ray
fe757b6267 Update rtextures.c 2023-11-08 17:40:23 +01:00
Ray
60fab9c405 Update README.md 2023-11-08 15:14:21 +01:00
ubkp
271a72f2f2 Fix absRange for PLATFORM_DRM (#3517) 2023-11-07 22:15:23 +01:00
Ray
580fbf441c Update textures_textured_curve.c 2023-11-07 20:02:55 +01:00
Ray
4b87cc455d Update shapes_splines_drawing.c 2023-11-07 19:58:45 +01:00
Ray
f01d3db739 ADDED: GetSplinePoint*() functions for spline evaluation
RENAMED: `DrawLine<spline_type>()` to `DrawSpline<spline_type>()` for more consistent and clear naming
REVIEWED: Bezier drawing parameters order, more consistent
REVIEWED: Spline-based examples -WIP-
2023-11-07 19:25:49 +01:00
Ray
c69e1c379b Merge branch 'master' of https://github.com/raysan5/raylib 2023-11-07 19:22:21 +01:00
Ray
e8a3f9f7fa ADDED: Open-graph image alt properties 2023-11-07 19:22:12 +01:00
ubkp
9a2b735645 Fix mouse/touch/gestures for PLATFORM_DRM (#3515) 2023-11-07 19:02:24 +01:00
Ray
a57ac0b18e Update m3d.h 2023-11-07 13:52:36 +01:00
Ray
30987eaf06 Update cgltf.h 2023-11-07 13:52:33 +01:00
Ray
02aa1ee873 Updated dr audio libraries 2023-11-07 13:48:48 +01:00
Ray
11de73dfd6 Update miniaudio.h 2023-11-07 13:44:55 +01:00
mooff
3b09ef58ca Add ES 3.0 to CMakeOptions (#3514) 2023-11-07 08:41:15 +01:00
Jeffery Myers
6cd37e57a6 Fix warnings in visual studio (#3512) 2023-11-06 20:31:07 +01:00
Ray
fc21a8e552 Update raygui.h 2023-11-06 20:14:40 +01:00
Ray
386bf890a0 Merge branch 'master' of https://github.com/raysan5/raylib 2023-11-06 20:06:46 +01:00
Ray
adaecba162 Update codeql.yml 2023-11-06 20:06:30 +01:00
Ray
9c816bbac1 Update codeql.yml 2023-11-06 19:59:30 +01:00
Ray
a810976aa6 REVIEWED: CodeQL workflow, cleaning and organization 2023-11-06 19:53:44 +01:00
Ray
0a9bd393dc REVIEWED: sinfl external library to avoid ASAN complaints #3349 2023-11-06 19:30:00 +01:00
Ray
8b2103fc77 REVIEWED: ScanDirectoryFiles*()- Paths building slashes sides #3507 2023-11-06 19:15:11 +01:00
b4yuan
b216e2fc98 Add CodeQL Workflow for Code Security Analysis (#3476)
* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every push and pull request to the main branch.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for third-party code, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation.

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

* Run CodeQL Analysis weekly + incorporate build script into WF

* remove: fail_on_error.py

* update: codeql.yml

---------

Signed-off-by: Brian <bayuan@purdue.edu>
2023-11-06 19:11:41 +01:00
Ray
8739c28949 REVIEWED: Scissor mode to support RenderTexture #3510 2023-11-06 19:09:12 +01:00
gulrak
56b5a5c4f0 BeginScissorMode checks for render texture to avoid using GetWindowScaleDPI (#3510) 2023-11-06 19:03:12 +01:00
Ray
304bf2cd17 ADDED: Flag to know we are rendering to texture #3510 2023-11-06 19:02:11 +01:00
Aniket Teredesai
b9f98dd8cd [build]: add uninstall cmake target (#3511) 2023-11-06 10:12:36 +01:00
Ray
a470cdce4c Merge branch 'master' of https://github.com/raysan5/raylib 2023-11-05 20:12:00 +01:00
Ray
2a67ac0027 REVIEWED: rlgl_standalone examples #3487
Example is intended for `PLATFORM_DESKTOP` only and OpenGL 3.3 Core profile.
2023-11-05 20:11:53 +01:00
Ray
8b3c18de54 Updated GLFW for 64bit 2023-11-05 20:11:14 +01:00
Ray
343e92322b Update README.md 2023-11-05 19:46:25 +01:00
JupiterRider
2252f747b7 Update Makefile (#3509) 2023-11-05 19:42:56 +01:00
Ray
925978ffde Update qoa.h 2023-11-05 19:41:22 +01:00
Ray
6ebfc6023b Update rl_gputex.h 2023-11-05 19:40:00 +01:00
Ray
57f77c3858 Update qoi.h 2023-11-05 19:39:57 +01:00
Ray
127d69e887 Update README.md 2023-11-05 19:24:45 +01:00
glowiak
17a968d2ed Jaylib is now up-to-date (#3508) 2023-11-05 15:58:48 +01:00
Ray
53451e98a7 Updated open graph for examples 2023-11-05 13:02:29 +01:00
Ray
cbf0324c34 Updating web shells open-graph info 2023-11-05 12:18:54 +01:00
freakmangd
39b539c42f Allow raylib to be built with zig 0.11.0 and zig 0.12.0dev (master) (#3506)
* allow zig 0.11.0 and 0.12.0dev to build raylib

* update comment
2023-11-04 21:05:21 +01:00
Ray
32e4be6fb9 Update rcore.c 2023-11-03 22:23:50 +01:00
Ray
2d1b211920 ADDED: LoadRandomSequence()/UnloadRandomSequence() 2023-11-03 20:21:43 +01:00
AndreaBoroni
5da0074fed Fixed Issue 3504 (#3505) 2023-11-03 19:12:42 +01:00
Ray
301d1b85ab Update raylib version to **raylib 5.0** 2023-11-02 18:18:27 +01:00
Ray
3c3e311190 Remove unneeded line on web platform 2023-11-02 18:18:05 +01:00
Ray
807516a991 Support OpenGL ES 3.0 building on Web
For some reason, the equivalent requested context (WebGL 2.0) is not provided, despite being properly requested.
2023-11-02 18:13:37 +01:00
Ray
b40f93b9e3 Comments tweaks 2023-11-02 18:12:22 +01:00
Ray
01bbd42519 Update rprand.h 2023-11-02 18:11:13 +01:00
ubkp
fe34fc7c6b Partial fix the gesture system for DRM (#3502) 2023-11-02 17:35:11 +01:00
Caleb Barger
ba75a7a23b build.zig updates for 0.11.0 release. (#3501) 2023-11-02 09:14:34 +01:00
ubkp
de1ceae4b0 [core] Fix gestures for PLATFORM_DESKTOP_SDL (#3499)
* Fix gestures for SDL

* Review the gesture handling for SDL

* Review 2
2023-11-02 09:13:41 +01:00
Ray
35d27fb11b REVIEWED: Pointers exposing not required for ES3 2023-11-02 09:04:05 +01:00
Ray
d77c918d51 Update rcore_web.c 2023-11-01 16:24:06 +01:00
Ray
c563490cf8 Update rcore_web.c 2023-11-01 15:28:31 +01:00
Ray
64d64cc181 REVIEWED: Potential code issues reported by CodeQL #3476 2023-11-01 15:28:18 +01:00
ubkp
ba21b8d274 Moves keymapUS[] and fixes GetCharPressed for DRM (#3498) 2023-11-01 12:20:33 +01:00
Jeffery Myers
38205d67da Remove unused structures from lighting fragment shaders (#3497) 2023-11-01 12:16:14 +01:00
Techuuu
d4c0d3bebe Update README.md (#3495)
* Update README.md

Fixed docs and improved.

* Update README.md

Done fixed it!

* Update README.md

Fixed!
2023-11-01 12:15:47 +01:00
Ray
df0f7ba61e Update shaders_deferred_render.c 2023-10-31 20:59:08 +01:00
Ray
aca854ccbf Update shaders_deferred_render.c 2023-10-31 20:46:10 +01:00
Ray
1407f6eb46 ADDED: rlBlitFramebuffer(), required for deferred render 2023-10-31 20:46:06 +01:00
Ray
15142a30f5 Update rmodels.c 2023-10-31 20:20:11 +01:00
Ray
43f36b9b05 REDESIGNED: LoadOBJ(), fix #3398
- Now triangulated  meshes are properly supported
 - Simplified code to consider issue situation
 - Removed mesh split per material, just define separate mesh if multiple materials are required
2023-10-31 20:15:45 +01:00
Justin
3645244f9f examples/shaders: Add an example for deferred shading (#3496)
* add example for deferred rendering/shading

* adapt convention

---------

Co-authored-by: 27justin <me@justin.cx>
2023-10-31 20:13:12 +01:00
Ray
de7beef05d Remove trailing spaces 2023-10-31 15:54:52 +01:00
Ray
f88604e6d5 Reviewed QOA seek PR 2023-10-31 15:54:38 +01:00
Ray
0a3567439d Comments tweaks 2023-10-31 15:49:42 +01:00
veins1
6842012748 Fix QOA seeking (#3494) 2023-10-31 15:48:24 +01:00
Ray
0d186a0557 REVIEWED: LoadModel(), removed cube fallback mechanism #3459 2023-10-31 11:32:07 +01:00
ubkp
ab61bad168 Fix relative mouse mode for DRM (#3492) 2023-10-31 10:16:12 +01:00
ubkp
d8acceca14 Fix example core_3d_camera_free (#3488) 2023-10-31 10:10:43 +01:00
Jett
ff04d52f12 Added rlEnablePointMode (#3490)
for rendering meshes with points.
similar to wire mode.
(NOTE) they still backface cull, so disable that if you want to show the entire mesh.
2023-10-31 08:43:32 +01:00
Ray
7677e4b928 REVIEWED: GetModelBoundingBox() #3485 2023-10-30 20:41:33 +01:00
Ray
b8fce54c0f Minor tweaks 2023-10-30 13:29:14 +01:00
Ray
abdebc244d Update rcore.c 2023-10-30 13:14:15 +01:00
Ray
9642fffbbb REVIEWED: GetRender*() issue on macOS highDPI #3367 2023-10-30 13:13:31 +01:00
ubkp
15632876f7 Fix examples Makefile for SDL (#3486) 2023-10-30 12:02:35 +01:00
Ray
ec91b44fb6 Merge branch 'master' of https://github.com/raysan5/raylib 2023-10-29 21:11:40 +01:00
Ray
fc7dcff4a7 ADDED: Pseudo-random numbers generator! 2023-10-29 21:11:30 +01:00
ubkp
049a6d475d Fix drm hang up on exit and mouse input issues (#3484) 2023-10-29 20:55:02 +01:00
Ray
09075d515a Some notes and comments 2023-10-29 20:44:32 +01:00
Ray
4625c41431 ADDED: Support for SDL building on Makefile 2023-10-29 20:44:18 +01:00
Ray
601e391b06 Remove physac library from raylib building
At this moment, physac is an external unmaintained library, better move out of raylib.
2023-10-29 20:43:52 +01:00
Ray
21243c8234 Update rcore_desktop_sdl.c 2023-10-29 20:42:29 +01:00
JaanDev
1fd61a00e4 Fix compressed DDS texture loading issues (#3483) 2023-10-29 20:21:00 +01:00
ubkp
12f3bc10c2 [core] Move rcore.h content to inside rcore.c (#3479)
* Move rcore.h content inside rcore.c

* Remove extern CoreData CORE
2023-10-29 20:20:19 +01:00
Ray
2da8cc383c Update Makefile.Web 2023-10-29 19:46:34 +01:00
Khalid Abdullah
e3363e9ad0 Typo fixed in HISTORY.md (#3481)
* [Typo fixed]  in CHANGELOG

* [Typo fixed] in HISTORY.md
2023-10-29 19:34:50 +01:00
Josh Colclough
975d4154e6 Fix the Julia set shader example (#3467)
* Simplify POI selection

* Improve mouse logic

* Add colour cycles to the shader to show finer details. Works well with high iteration numbers

* Testing things...

* Actually fix zoom. Also allow user to reset camera with 'R'

* Reset max iterations

* Tidying & comments

* Revert to original if statement

* Make mouse logic more readable

* Style conventions

* Coding conventions - f postifx on floating points

* Missed a few f postfixes
2023-10-29 16:41:02 +01:00
Ray
b4865588f8 REVIEWED: GetCurrentMonitor() #3472 2023-10-29 16:36:46 +01:00
ubkp
01c264123d Remove rcore.h include from SDL (#3475) 2023-10-29 16:23:38 +01:00
Khalid Abdullah
effa3ee249 [Typo fixed] in CHANGELOG (#3477) 2023-10-29 16:22:59 +01:00
SuperUserNameMan
b46505b13d Update tinyobj_loader_c.h (#3474)
temporary quickfix for issue #3473
2023-10-27 17:13:10 +02:00
Alexandre Almeida
2db7c727b6 GetCurrentMonitor() - use closest monitor (#3472) 2023-10-27 17:01:05 +02:00
Ray
3afd0a55b9 Update miniaudio to latest dev #3471 2023-10-27 16:55:27 +02:00
Ray
f721429f25 ADDED: SetAutomationEventBaseFrame(int frame) 2023-10-27 01:19:10 +02:00
Ray
98fcbe3fe2 Update core_automation_events.c 2023-10-27 00:50:02 +02:00
Ray
654b4e6257 Update core_automation_events.c 2023-10-27 00:45:00 +02:00
Ray
99dac5451c ADDED: Automation Events System, exposed to users
Added new API to record and play events
Added examples illustrating functionality
2023-10-26 23:59:19 +02:00
Ray
067dbe8657 ADDED: Drop files support to PLATFORM_DESKTOP_SDL 2023-10-26 23:57:07 +02:00
Ray
d0141bd105 Remove trail spaces 2023-10-26 23:56:38 +02:00
Ray
e4547eb422 Remove trail spaces 2023-10-26 23:56:03 +02:00
Ray
1cef62cf05 REVIEWED: glfwGetError() not availbale on PLATFORM_WEB fix #3470 2023-10-26 11:10:41 +02:00
Ray
77730c80d9 Updated to miniaudio v0.11.19 #3448 2023-10-26 10:34:39 +02:00
Ray
eddeafd2ed Revert "Fix IsGestureDetected parameter inconsistency in raylib.h with rgextures.h (#3464)"
This reverts commit 804f1a83eb.
2023-10-26 10:28:00 +02:00
jestarray
804f1a83eb Fix IsGestureDetected parameter inconsistency in raylib.h with rgextures.h (#3464)
closes https://github.com/raysan5/raylib/issues/3463
2023-10-26 10:24:21 +02:00
Alexandre Almeida
2f6b2897fe GetCurrentMonitor() - check window center instead of top-left corner (#3468) 2023-10-26 10:18:00 +02:00
2Bear
9a687e3153 Fix missing PLATFORM_DESKTOP_SDL checks. (#3469) 2023-10-26 10:15:25 +02:00
ubkp
cb1c2ffda1 Fix gamepad names for PLATFORM_DESKTOP/GLFW (#3462) 2023-10-25 19:13:51 +02:00
ubkp
b0c0f2e560 Fix OpenURL on SDL (#3460) 2023-10-25 12:17:54 +02:00
Ray
7e5eff8a29 Revert "Fix #3461"
This reverts commit 8fbd42d592.
2023-10-25 10:15:19 +02:00
Ray
8fbd42d592 Fix #3461 2023-10-25 10:14:17 +02:00
Ray
803b1a910e REVIEWED: Check OpenGL version required, fix #3457 2023-10-23 19:59:29 +02:00
Ray
a0f0034352 REVIEWED: InitPlatform() organization and code-gardening 2023-10-23 19:15:40 +02:00
Ray
3ff6026917 REVIEWED: Move screen capture logic to rcore.c, available for all platforms 2023-10-23 18:32:24 +02:00
Lukas
daf227a185 Fixes a memory leak as a result of creating an AudioBuffer* with the old source.frameCount. This internally allocates memory to the structs data pointer which is then later overridden by the correct sound data of the source sound. (#3458)
Additionally added a volume assignment from old to new as currently there is no way to get the volume of a sound and the AudioBuffer struct is not reachable from user code due to opaque definition.
2023-10-23 18:16:28 +02:00
Jeffery Myers
4ed776368a When the frame counter gets to 0, reset the FPS average counter. This allows the window to be closed and reopened with clean FPS stats. (#3445) 2023-10-23 10:11:50 +02:00
ubkp
8f517b7651 Fix compilation for PLATFORM_WEB examples (#3454) 2023-10-23 10:05:40 +02:00
Peter0x44
b3028e4891 Review prerequisites of rcore.c (#3453)
rcore_desktop_sdl.c was not present in the list of prerequisites this
patch changes them to use a wildcard, so any other platforms added in
future will be tracked properly
2023-10-22 19:45:49 +02:00
Peter0x44
e33e9da277 Add DrawCircleLinesV for consistency (#3452)
ImageDrawCircleLinesV already existed, so I'm not sure why this was
missing. It is trivial to implement, anyway
2023-10-22 17:13:49 +02:00
Ray
f0124df0e8 Update CHANGELOG 2023-10-22 15:34:24 +02:00
Ray
cdb394fac6 Update CHANGELOG for **raylib 5.0** -WIP- 2023-10-22 15:21:25 +02:00
Ray
0e029f719b Revert "REVIEWED: sinfl, fix #3349"
This reverts commit c4fb6c8517.
2023-10-22 15:17:35 +02:00
Ray
9127ee2ff9 Merge branch 'master' of https://github.com/raysan5/raylib 2023-10-22 15:16:08 +02:00
Ray
2b90b5600c Revert "Update sinfl.h"
This reverts commit da9bc564d2.
2023-10-22 15:15:56 +02:00
Keith Stellyes
ea325c54e8 fix examples Makefile to use Makefile.Web when building for web (#3449)
Co-authored-by: Keith Stellyes <keith@keithstellyes.com>
2023-10-22 14:58:35 +02:00
Ray
da9bc564d2 Update sinfl.h 2023-10-22 10:31:35 +02:00
Ray
c4fb6c8517 REVIEWED: sinfl, fix #3349 2023-10-22 10:27:22 +02:00
Ray
1aad6a2fc0 REVIEWED: New platform backend template comments 2023-10-22 10:09:03 +02:00
Ray
bcfa7c6718 Update rcore_desktop.c 2023-10-22 10:08:39 +02:00
ubkp
8cda4273ec [core] Complement implementations for SDL (3) (#3450)
* Fix SetWindowMinSize and SetWindowMaxSize

* Fix window resizes to update the viewport

* Fix window resizes to update the viewport 2
2023-10-22 09:45:04 +02:00
ubkp
e5993c4a4b [core] Complement implementations for SDL (2) (#3447)
* Add note and todo to GetWindowScaleDPI

* Complement ToggleFullscreen and change ToggleBorderlessWindowed

* Complement SetWindowState and ClearWindowState
2023-10-21 12:11:54 +02:00
ubkp
c66eb49199 [core] Complement implementations for SDL (#3444)
* Complement SetWindowMonitor SDL implementation

* Complement SetWindowMonitor SDL implementation 2

* Complement SetWindowMonitor SDL implementation 3

* Complement GetMonitorPosition SDL implementation

* Small tweaks to various SDL implementation

* Small tweaks to various SDL implementation 2
2023-10-20 17:38:14 +02:00
Ray
081fffd46e REVIEWED: Issue with functions definitions 2023-10-19 13:57:31 +02:00
Ray
b674e344a8 REVIEWED: Issue with symbols exposure 2023-10-19 13:46:02 +02:00
Ray
65dd0afb60 Update Makefile 2023-10-19 13:41:09 +02:00
Ray
982641228c REDESIGNED: Move platforms to separate directory #3313 2023-10-19 13:36:10 +02:00
ubkp
a64d606cb3 Fix GetMonitorPhysical* dpi (#3442) 2023-10-19 13:09:27 +02:00
Ray
f09840dcdc Merge branch 'master' of https://github.com/raysan5/raylib 2023-10-19 13:05:54 +02:00
Ray
19ff0e5fb1 REVIEWED: rlLoadTexture() #3440 2023-10-19 13:05:50 +02:00
Le Juez Victor
d7a098ebd3 [core] Add more missing implementations to SDL (#3439)
* [core] Add more missing implementations to SDL

Add functions: `SetWindowState`, `ClearWindowState`, `SetWindowIcon`

* Completing `SetWIndowState` and `ClearWindowState`

* Add VSync support for SDL

* Fix `CORE.Window.display` size issue

* Fix getting monitor size

We now get the size of the monitor where the window is located

* Add `ToggleBorderlessWindowed`

* Add `ToggleFullscreen`

* Add `GetMonitorPosition`

* Add `SetWindowMonitor`

NOTE: The function is implemented but incomplete

* Replace `TraceLog` by `TRACELOG`

* Fixed mouse delta issue in relative mode

Fixed a delta retrieval issue with `GetMouseDelta` when the mouse is in relative mode. Solution by @ubkp

* Fix `IsKeyPressed` issue

An issue caused `IsKeyPressed` to continuously return true for most keys when pressed

* Fix `SetGamepadMappings` returning
2023-10-19 00:09:00 +02:00
ubkp
d0a265cee8 [core] Add more missing implementations to SDL (#3436)
* Add more missing implementations 1

* Add more missing implementations 2

* Add more missing implementations 3

* Add more missing implementations 4

* Add more missing implementations 5

* Add more missing implementations 6
2023-10-18 08:05:35 +02:00
Ray
fc6152613f REVIEWED: raylib 5.0-dev version for a future release 2023-10-18 00:33:05 +02:00
Ray
53cd60bb29 REVIEWED: Move InitWindow()/CloseWindow() to rcore.c #3313 2023-10-18 00:03:47 +02:00
Michael Scherbakow
9534f48425 fix build.zig (#3433)
for zig master (2023-10-17)
2023-10-17 23:36:42 +02:00
Alexey Kutepov
d7d04a07a2 [raudio] Implement GetMasterVolume() (#3434)
It feels a little unfinished when you can SetMasterVolume but can't
really Get it. So to finish the symmetry here is the GetMasterVolume
implementation.
2023-10-17 23:35:38 +02:00
Le Juez Victor
80432fde62 Fix SDL keyboard issue (#3435)
* Fix SDL keyboard issue

We have added a mapping table between raylib keys and SDL scancodes.

* Change `ScancodeToKey` array type
2023-10-17 23:29:28 +02:00
ubkp
f353cd1c3a [core] Add some missing implementations to SDL (#3432)
* Add missing implementations

* Add missing implementations 2

* Add missing implementations 3

* Add missing implementations 4

* Add missing implementations 5
2023-10-17 12:01:01 +02:00
Ray
99ede0f747 Added some notes for alternative implementations #3362 2023-10-17 11:09:56 +02:00
Ray
7290ea9bfb Update models_mesh_generation.c 2023-10-17 10:59:25 +02:00
Dor Shapira
af83764f4f Implement GetCurrentMonitor in rcore_desktop_sdl (#3431)
* Implemented GetCurrentMonitor

* remove traceloog in GetCurrentMonitor
2023-10-17 09:53:53 +02:00
ubkp
fab99b8309 Remove rcore.h include from android (#3429) 2023-10-16 14:59:08 +02:00
Peter0x44
859c67792a Make sure rcore.o gets compiled in more situations (#3423)
Currently doing the following:
```
make
touch rcore_desktop.c
make
```

Will not result in rcore.o getting compiled again, despite that
rcore_desktop.c has changed

This commit resolves that
2023-10-16 14:08:55 +02:00
neyrox
c4296b166a Fix GenMeshPlane when resX != resZ (#3425)
Co-authored-by: Stanislav Yablonskiy <s.yablonskiy@pixonic.com>
2023-10-16 14:06:12 +02:00
ubkp
73363f829b [core] Fix some mouse issues on SDL (#3428)
* Fix mouse wheel getting stucked scrolling up or down

* Fix mouse movement on 3D

* Fix mouse button presses
2023-10-16 09:43:20 +02:00
Ray
84818c96f2 ADDED: NEW PLATFORM: SDL (DESKTOP) rcore_desktop_sdl #3313 2023-10-16 00:51:44 +02:00
Johnathan Corkery
a75251f0a9 Inclusion of Matte to BINDINGS.md (#3427) 2023-10-16 00:25:39 +02:00
MichaelFiber
18bedbd095 [core] Change axisCount to be an array (#3421)
* Update `PLATFORM_DRM` implementation of `GetGamepadAxisCount`

* Update

* Update `PLATFORM_DRM` implementation of `GetGamepadName`

* Add example to test gamepad info functions
Fix typo

* Update new gamepad info example

* Move axis count update out of GamepadThread - race condition

* Remove pointless if statement

* Start integrating stuff from the mikesinput lib

* Add more logging

* Add semicolon

* Add forgotten static

* More fixes

* Update axisCount to be array

* More debugging

* Add forgotten index to ready check

* Add path logging

* Missing parenthesis

* Add missing slash

* Fix axis count being reset to 0

* Fix missing paren

* Test polling joystick button events

* Major updates

* Fix missing array index

* Fix another missing array index

* Update example

* dumb logging

* Wrong constant for ev.code handling

* More dumb logging

* Remove some logging

* Add FPS to gamepad info example and try for max FPS

* tweak

* Revert example

* Add fps back

* Clean up after merge

* Switch axisCount to be an array
2023-10-14 22:51:35 +02:00
ubkp
781f717530 Remove the rcore.h include from drm, web, template (#3420) 2023-10-14 22:47:35 +02:00
Le Juez Victor
6d7112fde7 Fix some omissions (#3418)
Changes the return type of `InitGraphicsDevice()` from `bool` to `int`.
Adds a return at the end of `InitPlatform()`.
2023-10-14 22:46:46 +02:00
Ray
37e3ffcaac REVIEWED: SetMouseCursor() #3416 2023-10-14 22:45:56 +02:00
BeardedBread
b79e381092 Fix SetMouseCursor implementation for PLATFORM_WEB (#3416)
* Fix SetMouseCursor implementation for PLATFORM_WEB

- Restrict function to only set the cursor inside the canvas

* Set the CORE input mouse
2023-10-14 22:42:03 +02:00
Blue
bf639f02a8 Fix raygui.c leftover from zig build (#3417) 2023-10-14 22:38:36 +02:00
Le Juez Victor
2498170b95 Fix screen size check in InitPlatform() (#3415) 2023-10-14 15:11:56 +02:00
BeardedBread
d31b439e04 Implement SetMouseCursor for PLATFORM_WEB (#3414) 2023-10-14 15:10:33 +02:00
Ray
54950f9a3d Make sure CORE.Window.ready is set 2023-10-14 12:55:31 +02:00
Ray
b34c2ecbcb WARNING: REDESIGN: InitPlatform() to initialize all platform data #3313
`InitGraphicsDevice()` could be confusing because the function actually initialized many things: window, graphics, inputs, callbacks, timming, storage... restructured it.
2023-10-14 12:49:54 +02:00
Ray
4521a142c3 tweaks 2023-10-14 11:48:20 +02:00
Ray
005ba155c0 Minor tweaks 2023-10-14 10:56:09 +02:00
Daniil Kisel
2f08f435b9 Add Raylib.lean to BINDINGS.md (#3409) 2023-10-13 20:54:15 +02:00
Purple4pur
4981acb241 fix zig syntax errors in examples, and make it install executables correctly (#3395) 2023-10-13 19:55:52 +02:00
Daniil Kisel
5a0d9c8d43 Fix UpdateSound parameter name (#3405) 2023-10-13 19:54:43 +02:00
Le Juez Victor
36abc48cf8 Normalize gestureEvent.position coordinates (#3406)
Fixed the fact that coordinates were not normalized on Android, preventing detection of `GESTURE_DOUBLE_TAP`
2023-10-13 19:54:00 +02:00
ubkp
f3c27ec157 Fix android, drm compilation issue on InitWindow (#3407)
* Fix drm compilation issue on InitWindow

* Fix android compilation issue on InitWindow
2023-10-13 19:53:31 +02:00
Babak
0f4a8cf7cb Ported to stb_image_resize2.h (#3403) 2023-10-13 16:37:35 +02:00
Le Juez Victor
0daa5ce1e7 Fix GetMouseDelta() issue for Android (#3404) 2023-10-13 16:36:42 +02:00
Ray
2e65bc675c Moved some platforms functions to generic rcore #3313
Reviewed `InitWindow()` to clearly note platform specific code
2023-10-13 14:14:16 +02:00
Ray
876e6b3a0d REVIEWED: TextFormat(), added "..." for truncation #3366
It seems more standard than [TRUN]
2023-10-11 20:25:09 +02:00
ubkp
6ed8acde67 Fix windowMin/Max to screenMin/Max for android, drm, template (#3400) 2023-10-11 19:29:21 +02:00
Ray
61af8e7631 REVIEWED: #3399, Fix #3366 2023-10-11 12:20:03 +02:00
Murlocohol
28fb58f0ea [rtext] TextFormat() warn user if buffer overflow occured. (#3399)
* [rtext] TextFormat now alerts user to truncation.

* Update rtext.c

* Update rcore.c

* Update rtext.c
2023-10-11 12:15:40 +02:00
Ray
da9c2894fe Reorganized some functions, WaitTime() is common to all platforms 2023-10-11 12:10:38 +02:00
Ray
a2c5f01059 Reordered one function 2023-10-11 11:55:12 +02:00
Ray
0d175a69ae REVIEWED: Mouse and Touch functions generic to all platforms #3313 2023-10-11 11:36:44 +02:00
Ray
6ebfec99c5 Added gamepad functions as generic for all platforms 2023-10-11 11:14:03 +02:00
Ray
ddca525132 RENAMED: rcore_custom to rcore_template 2023-10-11 11:11:09 +02:00
MichaelFiber
daba1a2794 Split drm update input (#3397)
* Update `PLATFORM_DRM` implementation of `GetGamepadAxisCount`

* Update

* Update `PLATFORM_DRM` implementation of `GetGamepadName`

* Add example to test gamepad info functions
Fix typo

* Update new gamepad info example

* Move axis count update out of GamepadThread - race condition

* Remove pointless if statement
2023-10-11 10:30:51 +02:00
Ray
101a9b0445 Added comments and review some functions #3313 2023-10-10 11:59:41 +02:00
Ray
b94e6290a4 Added some comments and tweaks #3313 2023-10-10 10:50:09 +02:00
Ray
67a1e1ffae Update rtextures.c 2023-10-10 10:48:46 +02:00
Ray
cb57165956 REVIEWED: Fix #3387 2023-10-10 10:48:30 +02:00
Murlocohol
9702a17152 [raymath] Hotfix for Vector2Angle() and Vector2LineAngle() (#3396)
* Hotfix for Vector2LineAngle(), should probably be reviewed along with the rest of raylib angle functions to determine what coordinate system we want.

* Hotfix for Vector2LineAngle(), should probably be reviewed along with the rest of raylib angle functions to determine what coordinate system we want.

* [raymath] Hotfix for Vector2Angle and corresponding example

* [raymath] Hotfix for Vector2Angle and corresponding example

---------

Co-authored-by: Ray <raysan5@gmail.com>
2023-10-10 10:42:11 +02:00
Murlocohol
f0d949f931 Hotfix for Vector2LineAngle(), should probably be reviewed along with the rest of raylib angle functions to determine what coordinate system we want. (#3394) 2023-10-10 08:59:09 +02:00
Ray
0d8a6cfbfa Revert "Update zig build system to zig version 0.11.0 (#3393)"
This reverts commit 540ad99442.
2023-10-10 08:48:55 +02:00
Purple4pur
540ad99442 Update zig build system to zig version 0.11.0 (#3393)
* update build.zig for zig 0.11.0

* fix build.zig in examples to install executable correctly

* discard build.zig, only use src/build.zig, to avoid annoying zig-out path problem

* update zig version note
2023-10-09 13:05:19 +02:00
Ray
cfffa74f96 REVIEWED: Libs include order 2023-10-09 11:17:22 +02:00
Ray
f93d0ff9bc Update raudio.c 2023-10-09 11:17:09 +02:00
Ray
b55cf40b91 Format tweaks 2023-10-09 11:07:02 +02:00
Ray
a38afcf053 Merge branch 'master' of https://github.com/raysan5/raylib 2023-10-09 10:51:41 +02:00
Ray
f86f4159e6 Avoid references to PLATFORM_ flags #3313 2023-10-09 10:51:37 +02:00
SuperUserNameMan
dfb0326d00 Update rcore.c (#3326) 2023-10-09 09:54:43 +02:00
Ray
33c84b3c00 Update rmodels.c 2023-10-09 09:53:52 +02:00
Dennis E. Hamilton
7ab911b9a4 Ensure m3d faces in non-decreasing materialid sequence (#3385)
This modification replaces the expensive qsort protection with an
insertion sort that is near-instantaneous in the expected ordered case.
2023-10-09 09:49:58 +02:00
Masoud Naservand
d309b1eaa7 Call nsvgDeleteRasterizer() on created rasterizer (#3392)
the `NSVGrasterizer *rast` needs to be passed
to nsvgDeleteRasterizer() when we are done with it.
2023-10-09 09:47:54 +02:00
Ray
ea9de852bd ADDED: Custom platform template! #3313 2023-10-09 09:46:57 +02:00
Ray
682992e868 REVIEWED: Reorganize functions
`TakeScreenshot()` moved to `rcore.c`
2023-10-09 09:45:57 +02:00
Ray
5ed7717f0d REVIEWED: WaitTime(), added validation #3377 2023-10-09 01:21:46 +02:00
Ray
a0b30b0363 REVIEWED: SetupViewport() macOS #3313 2023-10-09 01:02:19 +02:00
Ray
df8d3a5afb REVIEWED: Some warnings #3313 2023-10-09 00:47:22 +02:00
Ray
d445fdaa19 WARNING: REDESIGN: Move platform specific data to platform submodules #3313
REVIEWED: Defines, macros, types and tweaks
2023-10-09 00:41:06 +02:00
Ray
bbbaae5562 Reviewed #3313 2023-10-08 23:38:52 +02:00
Ray
fecf56e15a WARNING: rcore module split per-platform **BIG CHANGE** (#3388)
* Submodules (#3311)

* Check in current state

* Add submodules to Makefile and clean up some imports

* Start moving InitGraphicsDeivce

* Move android_main and CloseWindow() out of rcore

* Move WindowShouldClose out of rcore

* Move IsWindowHidden out of rcore

* Move IsWindowMinimized out of rcore

* Move IsWindowMaximized, IsWindowFocused and IsWindowResized out of rcore

* Move ToggleFullscreen out of rcore

* Move MaximizeWindow, MinimizeWindow and RestoreWindow out of rcore

* Move 13 functions out of rcore:
ToggleBorderlessWindowed
SetWindowState
ClearWindowState
SetWindowIcon
SetWindowIcons
SetWindowTitle
SetWindowPosition
SetWindowMonitor
SetWindowMinSize
SetWindowMaxSize
SetWindowSize
SetWindowOpacity
SetWindowFocused

* Minor clean up, revert makefile change, include submodules directly in rcore

* Fix makefile comment

* Remove rcore.h from Makefile

* Remove debug include

* Move 18 functions from rcore to submodules
GetWindowHandle
GetMonitorCount
GetCurrentMonitor
GetMonitorPosition
GetMonitorWidth
GetMonitorHeight
GetMonitorPhysicalHeight
GetMonitorRefreshRate
GetWindowPosition
GetWindowScaleDPI
GetMonitorName
SetClipboardText
GetClipboardText
ShowCursor
HideCursor
EnableCursor
DisableCursor
GetTime

* Move TakeScreenshot, OpenURL, GetGamepadName out of rcore into submodules

* remove debugging #defines

* Move GetMonitorPhysicalWidth from rcore to submodule

* Move GetGamepadAxisCount from rcore

* Move SetGamepadMappings out of rcore

* Move GetMouseX, GetMouseY, GetMousePosition out of rcore

* Move SetMousePosition out of rcore

* Move GetMouseWheelMove out of rcore

* Move the last functions out of rcore

* Move shared function defs and some global var to rcore.h

* Clean up rcore.c and rcore.h a little more

* Remove unnecessary #define

---------

Co-authored-by: MichaelFiber <michael@cubeofb.org>

* REVIEWED: `PLATFORM_DESKTOP` Windows building

* Revert "REVIEWED: `PLATFORM_DESKTOP` Windows building"

This reverts commit 71a12171f7.

* Reviewed Windows building

* [split] Fix compilation for web (and desktop) (#3329)

* Fix compilation for web

* Remove EM_ASM_INT from core_input_gestures_web example

* Fix raymath undefined symbols for desktop and web

* Remove raylib_opengl_interop from examples Makefile

* Revert previous commit (8651c78)

* Fix TraceLog for web and desktop

* [split] `rcore`, `rcore_web` and `rcore_desktop` changes (batch 2) (#3334)

* Fix formatting

* Reapply commit 9d230d7 (#3305) that was missing

* Reapplies commits 719365f (#3309) and 8a1779b (#3312) that were missing

* Reapply commit 5c9cc3f (#3323) that was missing

* Reapply commit a2b3b1e that was missing

* Revert commit cef25c6 to fix macro redefined warning

* Move rcore.h #include to after config.h to fix macro redefinitions warnings

* [split] `rcore`, `web`, `desktop`, `android` changes (batch 3) (#3338)

* First pass to remove unneeded platform macros for web

* Second pass to remove unneeded platform macros for web

* Move GetTouchX, GetTouchY, GetTouchPosition from rcore to web, desktop, android

* Move SetMouseCursor from rcore to android, desktop, web

* [split] `rcore`, `web`, `desktop`, `android` changes (batch 4) (#3343)

* Fix ToggleBorderlessWindowed duplicated glfwSetWindowSize calls

* First pass to remove unneeded platform macros for android

* Second pass to remove unneeded platform macros for android

* Remove unneeded platform macros for desktop

* Relocate GetGamepadName and update SetGamepadMappings on android, desktop, web

* Add missing comment to web

* [split] `rcore`, `web`, `desktop`, `android` changes (batch 5) (#3345)

* Move SetExitKey from core to android, desktop, web

* Move some callbacks from core to desktop and web

* Relocate emscripten callbacks on web

* Relocate android callbacks on android

* Revert "Relocate android callbacks on android"

This reverts commit bbdbecc01e.

* Updates UnloadVrStereoConfig on rcore

* Update SetClipboardText on android

* Fix screenMin/Max default values for android

* [split] `rcore`, `drm` changes (#3347)

* Tweak makefiles for PLATFORM_DRM and move rcore_drm's dependencies to rcore.h

* Move drm functions to rcore_drm.c

* Fix a typo in rcore.c

* Add SetExitKey to rcore_drm.c

---------

Co-authored-by: MichaelFiber <michael@cubeofb.org>

* Fix compilation for android (#3360)

* Fix android include (#3364)

* Reviewed platform split #3313

 - Added file headers info
 - Added TRACELOG message for unimplemented functions
 - Reviewed code formatting and organization
 - Several code tweaks

* REVIEWED: `GetDirectoryPath()`

---------

Co-authored-by: MichaelFiber <42419558+michaelfiber@users.noreply.github.com>
Co-authored-by: MichaelFiber <michael@cubeofb.org>
Co-authored-by: ubkp <118854183+ubkp@users.noreply.github.com>
2023-10-08 18:36:07 +02:00
Ray
1327b570e3 Update raylib_parser.c 2023-10-08 18:11:55 +02:00
Ray
be8eea9eda Format tweaks 2023-10-08 18:10:05 +02:00
BLUELOVETH
97c2744a16 Update raylib_api.* (#3379) 2023-10-07 21:10:27 +02:00
Ray
52ba44c474 REVIEWED: #3363 2023-10-07 21:07:50 +02:00
DaveH355
da5407b776 Optimize m3d mesh creation (#3363)
* Optimize m3d mesh creation

* Avoid qsort() in rmodels.c

* Revert "Avoid qsort() in rmodels.c"

This reverts commit dc1bd559fd.

* Add comment
2023-10-07 21:02:05 +02:00
Luís Almeida
bc15c19518 Texture Tiling Example - luis605 (#3353)
* Texture Tiling Example - luis605

* Removed SetTraceLogLevel(LOG_WARNING);
2023-10-01 23:01:59 +02:00
Brian E
7351240218 [rcore] reveiwed GetWorldToScreenEx (#3351)
* reveiwed GetWorldToScreenEx
Used the inputted "width" instead of global CORE.window.
Used Vector3Transform instead of quaternion.

* reverted accidental unrelated change

* reverted Vector3Transform back

* fixed mistyped result

---------

Co-authored-by: Brian-E <brian@intra.fo>
2023-10-01 23:00:25 +02:00
BLUELOVETH
c3a1c8c8eb Update BINDINGS.md with raylib-pkpy-bindings (#3361) 2023-10-01 22:56:43 +02:00
Ray
73b54c862e Update raylib.h 2023-09-29 00:28:16 +02:00
Ray
411d0ee437 Update raylib_parser.c 2023-09-29 00:28:03 +02:00
Jeffery Myers
8d5a90ea3c Expose rcamera functions to the dll so they can be picked up by dll users and bindings that need the dll (#3355) 2023-09-27 23:47:18 +02:00
XXIV
9ff47fc807 fix BINDINGS.md (#3358) 2023-09-27 20:57:47 +02:00
WraithGlade
115ba2b079 Factor's Raylib bindings mention being at v4.5 (#3350)
I looked at the linked Factor binding page for Raylib and found that the file [summary.txt](https://github.com/factor/factor/blob/master/extra/raylib/summary.txt) has the following text in it:

```
Bindings for Raylib 4.5
```

The bindings have also been updated within the last week.

This implies that Factor's Raylib bindings are either already up to date with v4.5 or will be soon.

Thus, I have submitted this likely correction to Raylib's bindings table.

(PS: There are other Factor Raylib bindings on the internet that are less up-to-date, so don't confuse those with this.)
2023-09-26 18:59:40 +02:00
Ray
f2389a1e55 Remove trail spaces 2023-09-26 12:54:24 +02:00
Ray
f7c3035b8c Update raygui.h 2023-09-24 23:51:23 +02:00
Ray
c8a6093d52 Update examples creation requirements 2023-09-23 11:13:11 +02:00
Ray
557aeff253 REVIEWED: glInternalFormat is unsigned and actually, rlGetGlTextureFormats() returns 0 if fails 2023-09-22 11:59:52 +02:00
Ray
a3a5aa7c63 REVIEWED: LoadFileData() potential issues with dataSize 2023-09-22 11:58:53 +02:00
Ray
83d82b6697 Update rmodels.c 2023-09-22 11:58:24 +02:00
Ray
f27ea1f0c8 REVIEWED: IsGestureDetected() parameter type 2023-09-22 11:58:14 +02:00
Ray
7eb49d1c7b EXTERNAL: msf_gif.h, reviewed some warnings 2023-09-22 11:57:49 +02:00
Ray
477f5e5436 Update miniaudio v0.11.16 --> v0.11.18 2023-09-21 23:54:59 +02:00
Brian E
577a8de7c0 [raymath] Added macros for EPSILON on each function it's used in (#3330)
* Added macros for EPSILON
This is so the functions can be easily copied and used.

* used `#if !defined()` instead of `#ifndef`

---------

Co-authored-by: Brian-E <brian@intra.fo>
2023-09-21 23:48:48 +02:00
Ray
a2b3b1ebe4 REVIEWED: CompressData(), possible stack overflow
`struct sdefl` is almost 1MB, in some platforms it could generated a stack overflow, for example WebAssembly, where by default stack is only 65KB!
2023-09-20 21:23:43 +02:00
Ray
36e99860ee Added note about WebGL warning 2023-09-20 21:22:04 +02:00
Ray
c9020ece5d Update linux.yml 2023-09-19 18:52:40 +02:00
Ray
b335927665 Reviewed PR #3321 2023-09-18 19:43:10 +02:00
Christopher Odom
eb461512a7 Added UBSAN complaint fix to rLoadTexture #1891 (#3321) 2023-09-18 19:39:12 +02:00
Le Juez Victor
4d2906b0a5 Move mutex initialization before ma_device_start() (#3325) 2023-09-18 18:50:22 +02:00
Ray
5c9cc3f9f7 Reviewed #3323 2023-09-18 12:07:40 +02:00
Ray
b9acbbbc66 Fix #3323 2023-09-18 11:50:37 +02:00
Tobias Mock
421ae5bbd8 Update raylib-ocaml bindings to 4.5 version (#3322) 2023-09-17 22:52:34 +02:00
Ray
97c4333803 REVIEWED: UnloadRenderTexture(), additional check 2023-09-17 20:42:45 +02:00
Brian E
acf211a5fa general syntax fixes (#3319)
* Prettified a comment

* fixed broken indentation caused by another commit.
the commit renamed a bool to int and broke indentation: 233cf3970c

* Changed 0.001 and 0.00001 to EPSILON
This commit is untested.
I don't know what consequences this has.
Since the commits that added these numbers were before epsilon was added,
I have assumed that epsilon could replace them.

* Prettied up indentation in a few places

* removed spacing around *, standardizing it.

* I may have gotten overboard with indentation

* removed a few useless parenthesis

* Added fortran-raylib

* Fix examples/others/rlgl_standalone.c compilation issue (#3242)

* Update BINDINGS.md

* Ignore unused return value of GetCodepointNext in GetCodepointCount (#3241)

* Ignore unused return value of GetCodepointNext in GetCodepointCount

Removes the last warning from non-external libraries when compiling with
the default build configuration on x64 Linux.

* Remove unnecessary void cast in GetCodepointCount

* Fix #3246

* Revert "Fix #3246"

This reverts commit e4dcbd5180.

* Fix text_unicode.c example crashing (#3250)

* Fix text_unicode.c example crashing

* Adjust the text_unicode.c example crashing fix

* tweaks

* add build.zig options for individual modules (#3254)

* Add `IsKeyPressedRepeat` (desktop only) (#3245)

Since the key pressed are handle by comparing current vs previous
state (ie frame), a special way is needed to handle key repeats.

* Reviewed `IsKeyPressedRepeat()` #3248

* Update rcore.c (#3255)

* Match CMakeOptions.txt options default values (#3258)

* Fix SetClipboardText for web (#3257)

* [Image] Validate that ImageDrawRectangleRec is drawing entirely inside the image (#3264)

* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading

* sound_multi example

* Validate that image rect drawing is inside the image so we don't overflow a buffer

* remove files that should not have been added.

* remove changes that should not have been

* revert

* adsfasdfsdfsdf

* Add Vector3 Projecting and Rejection to Raymath (#3263)

* Update raymath.h

* formatting

* [Feature] IsKey... safety checks and more (#3256)

* [Feature] Add GetKeyRepeat

* Update rcore.c

* Simpler design, only one repeat per frame

* Update config.h

* Update rcore.c

* Add KEYBOARD_KEYS_MASK

* Update config.h

* reversions

* Update rcore.c

* Update rcore.c

* change docs

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update raylib.h

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Fix bug where default shaders was not linking. (#3261)

* Formating review

* Add missing cmake options (#3267)

* Fix CMake extraneous -lglfw (#3266)

Closes #3265.

The problem: LIBS_PRIVATE is a list of library names (used by pkg-config), but the shared library of the same name doesn't always exist.

* Fix example/models/models_loading_gltf.c controls (#3268)

* Fix example/models/models_loading_m3d.c controls (#3269)

* Remove e from secondes (#3270)

* Fix example/audio/audio_module_player.c help instructions and small bug (#3272)

* Fix example/audio/audio_module_player.c help instructions and small bug

* Update example/audio/audio_module_player.png screenshot

* Use type name instead of valid specifier

long long --> long long int

* REVIEWED: `GetFileLength()`, added comment #3262

* Update examples/models/models_loading_gltf.png;m3d.png screenshots (#3273)

* Remove a duplicated screenshot and add missing one (#3275)

* Add examples/shaders/shaders_lightmap.c to Makefiles (#3276)

* Fix examples/others/easings_testbed.c help instructions and small tweak (#3277)

* Fix examples/shaders/shaders_texture_outline.c help instructions (#3278)

* Fix examples/shapes/shapes_collision_area.c help instructions (#3279)

* RENAMED: LoadFont*() parameter names for consistency and coherence

* Fix uninitialized thread-locals in stbi #3282 (#3283)

* REVIEWED: Added `SetTextLineSpacing()` to multiline examples

* REVIEWED: Data size type consistency between functions #3168

* Some tweaks

* Use internal default allocators, instead of user-exposed ones

* Added rudimentary SVG support. (#2738)

* Added rudimentary SVG support. Added 2 functions ImageLoadSvg and ImageLoadSvgWithSize.

* Added an example on how to use ImageLoadSvgWithSize and adjusted Makefiles accordingly.

* Added actual correct example file.

* Reviewed the code to keep the raylib coding conventions in mind.
Moved the LoadImageSvg() code into LoadImage() guarded by SUPPORT_FILEFORMAT_SVG.
Renamed LoadImageSvgWithSize() to LoadImageSvg().
Added a LoadImageSvgFromString() function to parse the loaded SVG into an actual image. This does the bulk of the work.

* Fixed typo.

---------

Co-authored-by: Ray <raysan5@gmail.com>

* REVIEWED: `LoadImageSvg()`

* REVIEWED: `LoadImageSvg()`

* Add SUPPORT_FILEFORMAT_SVG to cmake (#3284)

* Fix examples/textures/textures_fog_of_war.c help instructions (#3285)

* Fix examples/textures/textures_image_rotate.c help instructions (#3286)

* Update rtextures.c

* Fix #3247

* Update config.h

* Fix #3293

* Disable UBSAN in zig builds. (#3292)

Zig debug builds automatically enable ubsan.
As the fix for #1891 had to be reverted, debug builds using zig will crash like so:

```
Illegal instruction at address 0x3237d2
raylib/src/rlgl.h:3690:91: 0x3237d2 in rlDrawVertexArrayElements (/home/rcorre/src/raylib-zig-template/raylib/src/rcore.c)
    glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset);
```

This disables UBSAN when using zig to build raylib.

* Update README.md (#3290)

specially -> especially

* Update cmake SUPPORT_FILEFORMAT_SVG default value (#3291)

* Mouse offset and scaling must be considered also on web!

* Update rcore.c

* Update Makefile : clean raygui.c & physac.c (#3296)

* Remove PLATFORM_RPI (#3232)

* Remove PLATFORM_RPI

* remove build artifacts

---------

Co-authored-by: MichaelFiber <michael@cubeofb.org>
Co-authored-by: Ray <raysan5@gmail.com>

* Review to avoid UBSAN complaining #1891

* added raylib-raku to bindings (#3299)

* examples: core: adds 2D camera two player split screen (#3298)

* Reviewed examples for consistency

* Update rtext.c

* Some code restructuring for input functions, consistency review

* Remove unneeded #if (#3301)

Co-authored-by: MichaelFiber <michael@cubeofb.org>

* Revert "Disable UBSAN in zig builds. (#3292)" (#3303)

This reverts commit a316f9e7fc.

Issue #1891 was fixed again, so this is no longer needed.

* rtextures: Fix ImageDraw() source clipping when drawing beyond top left (#3306)

* REVIEWED: `TextToPascal()` issue when first char is uppercase

* Implement FLAG_WINDOW_RESIZABLE for web (#3305)

Fixes #3231

* Update BINDINGS.md (#3307)

Fix Kaylib binding. Reroute to a new repository.
Binding renamed.

* Update webassembly.yml

* Add claw-raylib to BINDINGS.md (#3310)

* Add SetWindowMaxSize for desktop and web (#3309)

* Add SetWindowMaxSize for desktop and web

* Remove SizeInt and respective adjustments

* Update rtextures.c

* Reviewed parameters for consistency

* Rename windowM* to screenM* (#3312)

* Update BINDINGS.md (#3317)

Update TurboRaylib bindings

* Update rmodels.c

* Update BINDINGS.md with vaiorabbit/raylib-bindings (#3318)

* fixed spelling mistake

* put back parenthesis

* reverted major allignment changes

* reverted parser output changes

* reverted one more indentation change

---------

Co-authored-by: Brian-E <brian@intra.fo>
Co-authored-by: Ray <raysan5@gmail.com>
Co-authored-by: ubkp <118854183+ubkp@users.noreply.github.com>
Co-authored-by: ashn <60763262+ashn-dot-dev@users.noreply.github.com>
Co-authored-by: actondev (Christos) <chris.actondev@gmail.com>
Co-authored-by: vitopigno <103512727+VitusVeit@users.noreply.github.com>
Co-authored-by: Asdqwe <asdqwe@asdqwe.com>
Co-authored-by: Jeffery Myers <jeffm2501@gmail.com>
Co-authored-by: Ethan Simpson <ethansimpson@xtra.co.nz>
Co-authored-by: Nickolas McDonald <43690021+n77y@users.noreply.github.com>
Co-authored-by: Branimir Ričko <rickobranimir@gmail.com>
Co-authored-by: iacore <74560659+iacore@users.noreply.github.com>
Co-authored-by: Ethan Conneely <Econn50@outlook.com>
Co-authored-by: Johannes Barthelmes <615914+jbarthelmes@users.noreply.github.com>
Co-authored-by: bXi <bluepunk@gmail.com>
Co-authored-by: Ryan Roden-Corrent <ryan@rcorre.net>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: SuperUserNameMan <yoann@terminajones.com>
Co-authored-by: MichaelFiber <42419558+michaelfiber@users.noreply.github.com>
Co-authored-by: MichaelFiber <michael@cubeofb.org>
Co-authored-by: Dan Vu <danvu.hustle@gmail.com>
Co-authored-by: Gabriel dos Santos Sanches <gabrielssanches@gmail.com>
Co-authored-by: Rob Loach <robloach@gmail.com>
Co-authored-by: Peter0x44 <peter0x44@disroot.org>
Co-authored-by: Kenta <106167071+Its-Kenta@users.noreply.github.com>
Co-authored-by: bohonghuang <1281299809@qq.com>
Co-authored-by: turborium <45082001+turborium@users.noreply.github.com>
Co-authored-by: Wilson Silva <wilson.dsigns@gmail.com>
2023-09-17 20:16:14 +02:00
Ray
33cc18ed51 Update BINDINGS.md 2023-09-17 13:32:44 +02:00
Wilson Silva
f9c6ca468a Update BINDINGS.md with vaiorabbit/raylib-bindings (#3318) 2023-09-16 19:56:38 +02:00
Ray
06986f36b3 Update rmodels.c 2023-09-15 17:04:07 +02:00
turborium
18b22523cc Update BINDINGS.md (#3317)
Update TurboRaylib bindings
2023-09-15 12:32:50 +02:00
ubkp
8a1779b2ad Rename windowM* to screenM* (#3312) 2023-09-14 11:57:23 +02:00
Ray
97ef81914c Reviewed parameters for consistency 2023-09-13 17:05:38 +02:00
Ray
528b879955 Update rtextures.c 2023-09-13 17:05:22 +02:00
ubkp
719365f209 Add SetWindowMaxSize for desktop and web (#3309)
* Add SetWindowMaxSize for desktop and web

* Remove SizeInt and respective adjustments
2023-09-13 16:37:11 +02:00
bohonghuang
2b1849e57d Add claw-raylib to BINDINGS.md (#3310) 2023-09-13 16:35:37 +02:00
Ray
2e7a7877a5 Update webassembly.yml 2023-09-12 15:11:16 +02:00
Kenta
3ab7f70e31 Update BINDINGS.md (#3307)
Fix Kaylib binding. Reroute to a new repository.
Binding renamed.
2023-09-11 23:19:43 +02:00
Peter0x44
9d230d753b Implement FLAG_WINDOW_RESIZABLE for web (#3305)
Fixes #3231
2023-09-11 19:03:33 +02:00
Ray
e75f85ce58 REVIEWED: TextToPascal() issue when first char is uppercase 2023-09-11 19:01:24 +02:00
Rob Loach
30f8dd6e37 rtextures: Fix ImageDraw() source clipping when drawing beyond top left (#3306) 2023-09-11 19:00:30 +02:00
Ryan Roden-Corrent
b8cd10264b Revert "Disable UBSAN in zig builds. (#3292)" (#3303)
This reverts commit a316f9e7fc.

Issue #1891 was fixed again, so this is no longer needed.
2023-09-09 17:32:28 +02:00
MichaelFiber
37f60e75e7 Remove unneeded #if (#3301)
Co-authored-by: MichaelFiber <michael@cubeofb.org>
2023-09-09 09:47:07 +02:00
Ray
b68d0850b1 Some code restructuring for input functions, consistency review 2023-09-08 20:01:52 +02:00
Ray
10e4aa32f8 Update rtext.c 2023-09-08 20:01:19 +02:00
Ray
1896268775 Reviewed examples for consistency 2023-09-08 13:27:13 +02:00
Gabriel dos Santos Sanches
2d5d0c2999 examples: core: adds 2D camera two player split screen (#3298) 2023-09-08 12:22:12 +02:00
Dan Vu
ecc80bbcea added raylib-raku to bindings (#3299) 2023-09-08 11:13:00 +02:00
Ray
30a9a24db9 Review to avoid UBSAN complaining #1891 2023-09-07 18:00:10 +02:00
MichaelFiber
18e9784c6d Remove PLATFORM_RPI (#3232)
* Remove PLATFORM_RPI

* remove build artifacts

---------

Co-authored-by: MichaelFiber <michael@cubeofb.org>
Co-authored-by: Ray <raysan5@gmail.com>
2023-09-07 17:42:28 +02:00
SuperUserNameMan
8cf76ec113 Update Makefile : clean raygui.c & physac.c (#3296) 2023-09-07 17:35:02 +02:00
Ray
b0c6972e5c Update rcore.c 2023-09-06 23:33:29 +02:00
Ray
d7debba222 Mouse offset and scaling must be considered also on web! 2023-09-06 23:16:31 +02:00
Ray
d55527953a Merge branch 'master' of https://github.com/raysan5/raylib 2023-09-05 20:04:30 +02:00
Ray
9cce5a93ff Fix #3293 2023-09-05 20:04:21 +02:00
Asdqwe
76fe16259d Update cmake SUPPORT_FILEFORMAT_SVG default value (#3291) 2023-09-05 11:03:59 +02:00
Ikko Eltociear Ashimine
97a8fe1e15 Update README.md (#3290)
specially -> especially
2023-09-05 11:03:32 +02:00
Ryan Roden-Corrent
a316f9e7fc Disable UBSAN in zig builds. (#3292)
Zig debug builds automatically enable ubsan.
As the fix for #1891 had to be reverted, debug builds using zig will crash like so:

```
Illegal instruction at address 0x3237d2
raylib/src/rlgl.h:3690:91: 0x3237d2 in rlDrawVertexArrayElements (/home/rcorre/src/raylib-zig-template/raylib/src/rcore.c)
    glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset);
```

This disables UBSAN when using zig to build raylib.
2023-09-05 11:02:25 +02:00
Ray
c104a97590 Update config.h 2023-09-04 18:51:44 +02:00
Ray
bdda1efd44 Fix #3247 2023-09-04 18:43:25 +02:00
Ray
8a82e17a79 Update rtextures.c 2023-09-04 18:43:03 +02:00
Asdqwe
c147ab51c9 Fix examples/textures/textures_image_rotate.c help instructions (#3286) 2023-09-03 11:03:00 +02:00
Asdqwe
a69d401433 Fix examples/textures/textures_fog_of_war.c help instructions (#3285) 2023-09-02 22:50:59 +02:00
Asdqwe
8bd6bb622c Add SUPPORT_FILEFORMAT_SVG to cmake (#3284) 2023-09-02 22:38:10 +02:00
Ray
67a693fc5b REVIEWED: LoadImageSvg() 2023-09-02 19:20:56 +02:00
Ray
d6f3891009 REVIEWED: LoadImageSvg() 2023-09-02 13:16:44 +02:00
bXi
c03ab03627 Added rudimentary SVG support. (#2738)
* Added rudimentary SVG support. Added 2 functions ImageLoadSvg and ImageLoadSvgWithSize.

* Added an example on how to use ImageLoadSvgWithSize and adjusted Makefiles accordingly.

* Added actual correct example file.

* Reviewed the code to keep the raylib coding conventions in mind.
Moved the LoadImageSvg() code into LoadImage() guarded by SUPPORT_FILEFORMAT_SVG.
Renamed LoadImageSvgWithSize() to LoadImageSvg().
Added a LoadImageSvgFromString() function to parse the loaded SVG into an actual image. This does the bulk of the work.

* Fixed typo.

---------

Co-authored-by: Ray <raysan5@gmail.com>
2023-09-02 13:00:18 +02:00
Ray
75e5cd86d7 Use internal default allocators, instead of user-exposed ones 2023-09-02 12:58:47 +02:00
Ray
6e18d96e7a Some tweaks 2023-09-02 12:54:36 +02:00
Ray
0f447f1fb6 REVIEWED: Data size type consistency between functions #3168 2023-09-02 12:05:34 +02:00
Ray
d41e3141f1 REVIEWED: Added SetTextLineSpacing() to multiline examples 2023-09-02 11:48:19 +02:00
Johannes Barthelmes
0f39051562 Fix uninitialized thread-locals in stbi #3282 (#3283) 2023-09-02 11:41:33 +02:00
Ray
ec6d3bb688 RENAMED: LoadFont*() parameter names for consistency and coherence 2023-09-01 23:23:01 +02:00
Asdqwe
927a030bbf Fix examples/shapes/shapes_collision_area.c help instructions (#3279) 2023-08-30 22:43:19 +02:00
Asdqwe
3d0d54e070 Fix examples/shaders/shaders_texture_outline.c help instructions (#3278) 2023-08-30 22:42:01 +02:00
Asdqwe
fefe8fcda9 Fix examples/others/easings_testbed.c help instructions and small tweak (#3277) 2023-08-30 22:40:49 +02:00
Asdqwe
46bac461ce Add examples/shaders/shaders_lightmap.c to Makefiles (#3276) 2023-08-30 22:40:24 +02:00
Asdqwe
1d2b43402e Remove a duplicated screenshot and add missing one (#3275) 2023-08-30 22:39:44 +02:00
Asdqwe
752baac00c Update examples/models/models_loading_gltf.png;m3d.png screenshots (#3273) 2023-08-29 19:28:03 +02:00
Ray
8157d4283e REVIEWED: GetFileLength(), added comment #3262 2023-08-29 19:26:15 +02:00
Ray
150663f78a Use type name instead of valid specifier
long long --> long long int
2023-08-29 19:25:44 +02:00
Asdqwe
d047597244 Fix example/audio/audio_module_player.c help instructions and small bug (#3272)
* Fix example/audio/audio_module_player.c help instructions and small bug

* Update example/audio/audio_module_player.png screenshot
2023-08-29 19:04:27 +02:00
Ethan Conneely
fc0d132566 Remove e from secondes (#3270) 2023-08-28 22:49:45 +02:00
Asdqwe
de3dc94d5b Fix example/models/models_loading_m3d.c controls (#3269) 2023-08-27 21:15:02 +02:00
Asdqwe
9393500bff Fix example/models/models_loading_gltf.c controls (#3268) 2023-08-27 21:14:20 +02:00
iacore
76adf883fd Fix CMake extraneous -lglfw (#3266)
Closes #3265.

The problem: LIBS_PRIVATE is a list of library names (used by pkg-config), but the shared library of the same name doesn't always exist.
2023-08-27 15:43:39 +02:00
Asdqwe
71a8d09a63 Add missing cmake options (#3267) 2023-08-27 15:42:45 +02:00
Ray
9646497216 Formating review 2023-08-27 00:30:56 +02:00
Branimir Ričko
b27e98a428 Fix bug where default shaders was not linking. (#3261) 2023-08-26 18:55:57 +02:00
Nickolas McDonald
9c9fba6a6c [Feature] IsKey... safety checks and more (#3256)
* [Feature] Add GetKeyRepeat

* Update rcore.c

* Simpler design, only one repeat per frame

* Update config.h

* Update rcore.c

* Add KEYBOARD_KEYS_MASK

* Update config.h

* reversions

* Update rcore.c

* Update rcore.c

* change docs

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update raylib.h

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c
2023-08-26 14:48:28 +02:00
Ethan Simpson
828d273698 Add Vector3 Projecting and Rejection to Raymath (#3263)
* Update raymath.h

* formatting
2023-08-26 14:44:52 +02:00
Jeffery Myers
21f5482e0d [Image] Validate that ImageDrawRectangleRec is drawing entirely inside the image (#3264)
* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading

* sound_multi example

* Validate that image rect drawing is inside the image so we don't overflow a buffer

* remove files that should not have been added.

* remove changes that should not have been

* revert

* adsfasdfsdfsdf
2023-08-26 14:43:14 +02:00
ubkp
4fa66f2635 Fix SetClipboardText for web (#3257) 2023-08-26 14:40:30 +02:00
Asdqwe
8f228626a2 Match CMakeOptions.txt options default values (#3258) 2023-08-26 14:35:53 +02:00
vitopigno
5ed83dfa29 Update rcore.c (#3255) 2023-08-21 00:36:00 +02:00
Ray
dfd0436428 Reviewed IsKeyPressedRepeat() #3248 2023-08-21 00:34:35 +02:00
actondev (Christos)
b3f82a148a Add IsKeyPressedRepeat (desktop only) (#3245)
Since the key pressed are handle by comparing current vs previous
state (ie frame), a special way is needed to handle key repeats.
2023-08-20 23:53:20 +02:00
Ray
83628933f0 Merge branch 'master' of https://github.com/raysan5/raylib 2023-08-20 21:36:50 +02:00
Ray
8189bddefb tweaks 2023-08-20 21:36:36 +02:00
actondev (Christos)
820343e7ac add build.zig options for individual modules (#3254) 2023-08-20 21:27:39 +02:00
Ray
f95dc2d565 Merge branch 'master' of https://github.com/raysan5/raylib 2023-08-19 20:09:53 +02:00
Ray
5a33f19964 Revert "Fix #3246"
This reverts commit e4dcbd5180.
2023-08-19 20:09:43 +02:00
ubkp
016b7d0a3a Fix text_unicode.c example crashing (#3250)
* Fix text_unicode.c example crashing

* Adjust the text_unicode.c example crashing fix
2023-08-19 13:43:00 +02:00
Ray
e4dcbd5180 Fix #3246 2023-08-17 15:05:52 +02:00
ashn
a86c93ebc0 Ignore unused return value of GetCodepointNext in GetCodepointCount (#3241)
* Ignore unused return value of GetCodepointNext in GetCodepointCount

Removes the last warning from non-external libraries when compiling with
the default build configuration on x64 Linux.

* Remove unnecessary void cast in GetCodepointCount
2023-08-15 00:09:27 +02:00
Ray
e2d4463886 Update BINDINGS.md 2023-08-15 00:04:07 +02:00
ubkp
e0afb8942e Fix examples/others/rlgl_standalone.c compilation issue (#3242) 2023-08-14 21:55:13 +02:00
Ray
7a1c0d2547 Added fortran-raylib 2023-08-14 21:10:24 +02:00
Ray
bf705a63de REVIEWED: DrawLineCatmullRom() 2023-08-12 19:31:29 +02:00
Ray
d873d0f173 ISSUE: DrawLineCatmullRom(), needs review 2023-08-12 18:45:59 +02:00
Ray
9161c55d59 REVIEWED: Code formatting 2023-08-12 18:40:18 +02:00
Ray
fc88518067 ADDED: Spline drawing functions ->
- `DrawLineBSpline()`
 - `DrawLineCatmullRom()`
2023-08-12 14:00:50 +02:00
ubkp
c25b52b1b3 Fix rcamera.h issues (#3240) 2023-08-11 10:19:50 +02:00
Ray
93f59a6f59 Review tabs and trail-spaces 2023-08-10 22:47:17 +02:00
Ray
f1c31bee27 Fix #3177 #3109 2023-08-10 22:45:25 +02:00
RadsammyT
0959f6ebf6 fix typos in rmodels, rshapes, rtext modules (#3236) 2023-08-10 00:21:14 +02:00
ashn
90f1749965 Ignore unused function warnings from external headers when compiling with GCC and Clang (#3235) 2023-08-09 19:17:12 +02:00
Ray
42cfabc670 REVIEWED: Old pragma formating 2023-08-09 10:00:26 +02:00
RadsammyT
03ecf2202e Fix typos in rcore.c comments (#3234)
* Fix typos in rcore.c comments

thought i corrected "dettach"
Fix typos in rcore.c comments

* 'fordward' > forward
2023-08-08 20:10:40 +02:00
Nikolas
bef818e210 Fix build for OpenGL 2.1, where half floats are part of an extension (#3233) 2023-08-08 20:09:22 +02:00
mohad12211
db55bed72b fix: check if ctrl modifier is among the currently set modifiers (#3230) 2023-08-07 19:51:36 +02:00
Le Juez Victor
c9864d8ac1 Fixed Android app black screen issue when reopening after incomplete closing (#3227)
* Fixed black screen issue when resuming the app on Android

Partly explained here: https://github.com/raysan5/raylib/issues/3127

* Fix APP_CMD_TERM_WINDOW for Android
2023-08-06 22:04:20 +02:00
yujiri8
b82217eaaa Tweak build.zig to work with cross-compiling (#3225) 2023-08-06 09:25:37 +02:00
Nikolas
dc621ca388 Support 16-Bit HDR textures (#3220)
* Support 16-Bit HDR textures

* Fix build on emscripten

* Move helper functions
2023-08-05 23:16:26 +02:00
Ray
6094869e3e Fix material loading #3126 2023-08-04 18:14:47 +02:00
Jeffery Myers
62f5382d56 [AUDIO] Add an example of how to use LoadSoundAlias (#3223)
* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading

* sound_multi example
2023-08-04 17:14:04 +02:00
Jeffery Myers
601cadbae6 [AUDIO] Add a function to make an alias of a sound and share it's sample data (#3219)
* Add a function to clone a sound and share data with another sound.

* rename items based on feedback

* PR Feedback, use custom unload for sound alias, not variant of normal sound unloading
2023-08-04 16:40:10 +02:00
vitopigno
d3058fe589 [CORE] Support for SetWindowTitle and InitWindow for web (#3222)
* Update raylib.h

Changed SetWindowTitle's description

* Update rcore.c

SetWindowTitle now works on web

* Update rcore.c

InitWindow title now works with web platform too.
2023-08-04 12:04:19 +02:00
ubkp
5b4aaf4eb1 Adds CMake option for SUPPORT_CUSTOM_FRAME_CONTROL (#3221) 2023-08-03 10:29:45 +02:00
ubkp
464e714a2e Adds BORDERLESS_WINDOWED_MODE for PLATFORM_DESKTOP (#3216) 2023-08-02 19:16:35 +02:00
Jeffery Myers
04678bc585 int math done with floats causes warnings. (#3218) 2023-08-02 19:12:38 +02:00
Joseph Montanez
b60c691816 Update BINDINGS.md (#3217)
Updated Raylib-PHP to support Raylib 4.5
2023-08-02 09:05:02 +02:00
Matheus C. França
e7664d5684 build change (#3214)
ref.: https://github.com/ziglang/zig/pull/16446
2023-08-01 10:46:40 +02:00
ubkp
4fd40f0333 Fixes GetCurrentMonitor() detection inconsistency issue (#3215) 2023-08-01 10:42:50 +02:00
Alexander Klingenbeck
d3ea649832 Update BINDINGS.md to include rayjs (#3212) 2023-07-30 19:08:59 +02:00
ndytts
44659b7ba8 Fix android soname in src/Makefile (#3211) 2023-07-29 13:46:04 +02:00
ubkp
962030e70a Changes SetWindowMonitor() to no longer force fullscreen (#3209)
* Changes SetWindowMonitor() to no longer force fullscreen

* Readds fullscreen support
2023-07-28 20:08:41 +02:00
Nikolas
5d28bad0ad Fix LoadTextureCubemap for manual layouts (#3204) 2023-07-27 22:41:43 +02:00
ashn
ac6f889dfc Fix misleading indentation in src/Makefile (#3202) 2023-07-26 17:50:07 +02:00
bohonghuang
298f93ef50 Fix DrawBillboardPro to allow source of negative size (#3197) (#3203) 2023-07-26 17:46:57 +02:00
Ray
32b54be5cb Update FAQ.md 2023-07-24 12:32:22 +02:00
ubkp
090b857912 Fix mouse wheel not working in PLATFORM_RPI or PLATFORM_DRM (#3193) 2023-07-23 20:35:41 +02:00
ubkp
295e8c2a2f Optimize and simplify the gesture system (#3190)
* Optimize and simplify the gesture system

* Decouples GESTURE_SWIPE_* from GESTURE_DRAG
2023-07-22 20:50:04 +02:00
Jakub Václav Flasar
ad2338b994 build.zig: Support for building with PLAFORM_DRM (#3191)
- Adds an option -Dplatform_drm when using zig build
- When building for linux, checks whether -Dplatform_drm is present and configures the build accordingly.
2023-07-21 14:08:35 +02:00
smalltimewizard
1310617a92 Optimization of ImageDrawRectangleRec() (#3185)
A significant performance increase can be had by copying the first row to all other rows.
2023-07-20 13:50:56 +02:00
Alberto González Palomo
5635e4214c Add note about sample format to AttachAudioStreamProcessor() (#3188) 2023-07-20 13:41:35 +02:00
Danil
055fd752c2 Fixed GetMonitorName description (#3184) (#3189) 2023-07-20 10:56:35 +02:00
Alberto González Palomo
7124a14a60 Document buffer format for audio processors. (#3186) 2023-07-19 23:11:29 +02:00
Rokas Puzonas
d6f16b7664 Update usage of 'sinf()' and 'cosf()' to be correct (#3181)
* Update usage of 'sinf()' and 'cosf()' to be correct

* Update formatting of arithmetic operations
2023-07-19 13:46:14 +02:00
ubkp
954c60100f Fix GESTURE_DRAG and GESTURE_SWIPE_* issues (mostly) for web (#3183) 2023-07-19 11:33:10 +02:00
Ray
a9ff13a367 Update CMakeOptions.txt 2023-07-18 18:07:49 +02:00
Ray
52541b4a1f ADDED: SUPPORT_FONT_ATLAS_WHITE_REC
Support creating a 3x3 pixels white rectangle at the bottom-right corner of the generated font atlas image, useful for shapes+text drawing in a single draw call!
2023-07-18 17:57:10 +02:00
Ray
e0c80f5ddd Revert "Makefile change for cross compiling. (#3176)"
This reverts commit 70286c7cdc.
2023-07-16 20:18:38 +02:00
Ray
86f95d7150 Reviewed C compilation issues and formatting 2023-07-16 13:24:49 +02:00
Michael Anghelone
70286c7cdc Makefile change for cross compiling. (#3176)
Working from wsl and compiling for windows this change makes it much easier to compile a static library for windows on arm.
To compile a static library for windows on arm:

```
make PLATFORM=PLATFORM_DESKTOP TARGET_OS=WINDOWS CROSS_CC=/llvm/bin/aarch64-w64-mingw32-gcc CROSS_AR=/llvm/bin/aarch64-w64-mingw32-ar
```

This does not work to compile a shared library yet, only static.
2023-07-16 13:08:55 +02:00
ubkp
b980268ba7 [example] Core Input Gestures for Web (#3172)
* [example] Core Input Gestures for Web

* Fix Doubletap for web

* Changes TAP_TIMEOUT and rgGetCurrentTime to seconds
2023-07-16 13:07:29 +02:00
Roy Qu
22895ba14f fix: cmake option "OPENGL_VERSION" doesn't work (#3170) 2023-07-13 21:20:06 +02:00
Ray
bc9c063254 Update external sdefl and sinfl 2023-07-12 15:49:38 +02:00
ubkp
8096f142ec Add a new task the issue template about checking the wiki (#3169) 2023-07-12 12:02:33 +02:00
Ray
290ec11e7c Merge branch 'master' of https://github.com/raysan5/raylib 2023-07-12 10:37:17 +02:00
Ray
7f21cf1dcf Revert "UPDATED: sdefl and sinfl compression libraries"
This reverts commit e190b7eee9.
2023-07-12 10:37:10 +02:00
Anand Swaroop
e8181a5ddf Update latest h-raylib version (#3166) 2023-07-11 15:21:49 +02:00
Ray
2061bfc5e8 Reviewed parameter names to avoid issues #3159 2023-07-10 19:29:10 +02:00
Ray
bc40012ca3 Added missing structure on standalone mode #3160 2023-07-10 19:15:55 +02:00
Ray
b807c590cb Merge branch 'master' of https://github.com/raysan5/raylib 2023-07-10 19:13:53 +02:00
Ray
0b9fae3c53 Reviewed rcamera/rgestures file-macros for consistency #3161 2023-07-10 19:13:44 +02:00
ubkp
4b6cbd2340 Fix Touch pointCount for web (#3163) 2023-07-10 18:58:56 +02:00
Evan Pratten
91e4eea52d Add raylib-ffi to bindings list (#3164) 2023-07-10 18:58:10 +02:00
o3o
334e96d470 update bindbd-raylib3 to raylib 4.5 (#3157) 2023-07-06 12:32:02 +02:00
Ray
685d47938b Reverted MeasureTextEx() change #3105 2023-07-06 12:31:01 +02:00
Ray
668b37e111 REVIEWED: GenImageFontAtlas(), make atlas size less conservative 2023-07-06 12:29:28 +02:00
Ray
4f9235f6eb Merge branch 'master' of https://github.com/raysan5/raylib 2023-07-05 18:36:59 +02:00
Ray
58bd10edb2 Update rtext.c 2023-07-05 18:36:54 +02:00
ubkp
13a26a0fa2 Fix degrees of swipe gestures for web (#3155) 2023-07-05 16:43:00 +02:00
Wytek01
3c4ce9c99b Update examples_template.c to raylib 4.5 (#3156) 2023-07-05 16:39:38 +02:00
Ray
225b4fb3e2 REVIEWED: Vector2Angle() 2023-07-04 16:58:43 +02:00
ubkp
dd2d64e058 Fix pinch gestures for web (#3153) 2023-07-04 11:08:58 +02:00
ubkp
ffe4d36e0a Fix swipe gestures for web (#3151) 2023-07-03 09:29:26 +02:00
Ray
fdc28fce80 Reviewed vector2angle example 2023-07-02 20:05:15 +02:00
Ray
e8af875756 Minor format tweak, another issue introduced... 2023-07-02 18:54:50 +02:00
Gisteron
64bb2fe3ec fix vector angle example mode 0 circle segment drawing (#3150) 2023-07-02 18:51:27 +02:00
Ray
d1ab031a27 ADDED: SetWindowFocused() #3142 2023-07-02 17:48:00 +02:00
Ray
5361d498c3 WARNING: REDESIGN: Vector2Angle()<-->Vector2LineAngle() #2887 2023-07-02 17:27:38 +02:00
Ray
4fc5e82e30 REVIEWED: TextToUpper(), TextToLower(), TextToPascal() 2023-07-02 11:10:42 +02:00
Ray
3e4e4b32fd WARNING: BREAKING: ADDED: SetTextLineSpacing() 2023-07-02 10:52:20 +02:00
Ray
48e2663d03 REVIEWED: Issue #3105 2023-07-02 10:51:39 +02:00
Ray
df90da0b37 Update rcore.c 2023-07-02 10:50:40 +02:00
Ray
e190b7eee9 UPDATED: sdefl and sinfl compression libraries 2023-06-30 09:47:16 +02:00
Ray
ceafbcf9d2 REVIEWED: SetShapesTexture(), allow reseting 2023-06-28 00:37:24 +02:00
Kenta
5834e970eb Update BINDINGS.md (#3138)
Change C3 to Zlib
Update Raylib-nelua's name as Raylib.nelua to reflect repo change.
Update Raylib.nelua licence to Zlib
2023-06-27 22:03:42 +02:00
Jeffery Myers
0c126af717 casting warnings in rtextures (#3134) 2023-06-24 23:38:09 +02:00
Ray
2d518bfbcd REVIEWED: ProcessMaterialsOBJ() #3125 2023-06-24 13:32:13 +02:00
Ray
77d025ebda Merge branch 'master' of https://github.com/raysan5/raylib 2023-06-24 13:27:07 +02:00
Ray
974460b072 REVIEWED: rlLoadShaderBuffer() #3104 2023-06-24 13:26:43 +02:00
Ian Rash
fa698fb05e Update BINDINGS.md for Crystal (#3132)
Just updated
2023-06-24 13:22:23 +02:00
Le Juez Victor
5e1a81555c Review android_main() in rcore.c (#3121) 2023-06-20 11:01:57 +02:00
Dante Catalfamo
3a90acf08e Add options to zig compile (#3115)
* Add options to zig compile options

Support for compiling with raygui, raymath, and physac.
Also outputs the required headers.

Raygui should be located `../raygui` relative to the repo root
Physac should be located `../physac` relative to the repo root

This behavior matches options in the Makefile

* Move Options struct

* Remove physac, explicit raymath, always copy rlgl.h and raymath.h

* Remove unused options from build.zig

* Add srcdir as include path for raygui.h
2023-06-18 11:48:50 +02:00
Ray
830e328df0 Remove trailing spaces 2023-06-17 16:48:18 +02:00
lesleyrs
2209e5b0ca fix window flags order (#3114) 2023-06-16 18:08:10 +02:00
Ray
a0a18384cb Fix typo 2023-06-16 16:34:47 +02:00
iacore
7392c4b0c5 Better examples/core_input_gamepad (#3110)
* examples/core_input_gamepad: Add visuals for LT,RT

* examples/core_input_gamepad: arrows left/right to choose gamepad

* Style change
2023-06-14 20:46:10 +02:00
Chema Guerra
f385d0ce1c Continuation of support for ES3/WebGL2 (#3107)
* Continuation of support for ES3/WebGL2

* GetTouchPointState()

* Amends to the WebGL2 PR

---------

Co-authored-by: root <root@DESKTOP-GLOV9QV>
Co-authored-by: chemguerra <online@chemaguerra.com>
2023-06-12 08:18:31 +02:00
Charles
2e00d16f3d GLTF: fix segfault in animNormals memcpy when mesh.normals == NULL (#3103) 2023-06-10 22:15:24 +02:00
Ray
6aada7d5ec Updated examples to raygui 4.0-dev 2023-06-09 18:07:25 +02:00
Le Juez Victor
753c0b3853 Addition of support for vox files in version 200. (#3097) 2023-06-05 01:13:08 +02:00
Ray
f8b352f6d9 ADDED: ExportImageToMemory()
Only PNG supported for now
2023-06-03 19:51:16 +02:00
Ray
ba802fdd5e tweaks 2023-06-03 19:50:46 +02:00
Pixel Phobic
b1b6ae3905 Full Movement Added to Right Analog Stick (#3095)
I Added Analog Stick Support to the rcamera module, However this code only allowed for 4 Directions of Movement, This Changed adds the full range of Movement to the Right Analog Stick.
2023-06-02 10:29:45 +02:00
Peter0x44
2dec56e7b7 Add error if raylib.h is included in a C++98 program (#3093)
The color macros don't work properly in C++98, because they require
aggregate initialzation, which is a C++11 feature. So, explicitly state
how to fix this issue, instead of letting the compiler give a more vague
error message like:

main.cpp:8:23: error: expected '(' for function-style cast or type construction
      ClearBackground(BLACK);
                      ^~~~~
/opt/homebrew/Cellar/raylib/4.5.0/include/raylib.h:179:35: note: expanded from macro 'BLACK'
 #define BLACK      CLITERAL(Color){ 0, 0, 0, 255 }         // Black

NOTE: Don't use this check with MSVC because by default, it reports
199711L  regardless of any C++ version passed on command line
Only passing `/Zc:__cplusplus` will make MSVC set this correctly

see: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
2023-06-01 09:47:52 +02:00
Ray
e497603678 ADDED: Experimental support for OpenGL ES 3.0 -WIP-
Just added the required flags to request the OpenGL ES 3.0 context but it has not been tested...
2023-05-31 18:36:33 +02:00
A Billy
a18667c2e9 cross compilation for PLATFORM_DRM (#3091)
* added cross compilation options for DRM

* fixed identation
2023-05-30 21:34:08 +02:00
yujiri8
45c00ab9d4 build.zig: Fix cross-compiling from Linux (#3090) 2023-05-30 21:33:01 +02:00
Ray
924bb7226b UPDATED: sdefl and sinfl DEFLATE compression libraries 2023-05-30 21:12:03 +02:00
RayIT
15cbf313bb Enhanced cmake part for OpenBSD (#3086)
* Fixed compile on OpenBSD

* Changed to not use seperate UNIX for cmake
2023-05-28 14:49:33 +02:00
RayIT
4a371a5197 Fixed compile on OpenBSD (#3085) 2023-05-28 11:33:14 +02:00
Nikita K
aad51d4704 BINDINGS.md: Janet bindings supported version update (#3083) 2023-05-27 13:11:33 +02:00
Jason Liang
20860e2ba0 Fix a link in the FAQ (#3082) 2023-05-27 09:27:44 +02:00
Ray
5ef50ae139 REVIEWED: ImageRotate() formatting 2023-05-26 14:01:19 +02:00
LuraMoth
144ae120ab Add new file formats to FAQ (#3079)
I noticed some file formats from the new release of raylib were missing so I decided to help out and update it!
2023-05-25 09:15:53 +02:00
Dane Madsen
e465ed0850 Added ImageRotate (#3078)
* Added ImageRotate

* Quick rename of the example

* Update ImageRotate by changing doubles to floats and checking code convention

* Update API
2023-05-24 09:22:51 +02:00
Ray
bf69b38056 Added security check to file reading (memory allocations) 2023-05-22 16:08:14 +02:00
Ray
2937f2010c Review coding conventions 2023-05-22 16:06:03 +02:00
Dane Madsen
a4a6d4da8a Add GenImageGradientSquare (#3077)
* Add GenImageGradientSquare to allow square gradients

* Fix GenImageGradientSquare and add to textures_image_generation example

* Remove params from GenImageGradientSquare
2023-05-22 15:20:28 +02:00
Ray
84ae26cdc0 Update raylib.h 2023-05-21 11:35:25 +02:00
Dane Madsen
e96dc46d38 Replaced GenImageGradientH and GenImageGradientV with GenImageLinearGradient (#3074)
* Replaced GenImageGradientH and GenImageGradientV with GenImageLinearGradient

* renamed GenImageLinearGradient to GenImageGradientLinear
2023-05-21 11:33:47 +02:00
Ray
1b4634702c Minor tweak 2023-05-21 11:20:42 +02:00
Ray
3a841ac130 REVIEWED: GenImagePerlinNoise(), clamp values #3071 2023-05-21 10:28:04 +02:00
Ray
f31df7521a REVIEWED: GenImagePerlinNoise(), no change 2023-05-21 00:14:09 +02:00
Ray
51387dfbfb tweak 2023-05-18 16:14:18 +02:00
Ray
a3e78c5453 Update README.md 2023-05-18 12:00:51 +02:00
Ray
fe6973a4f6 Update README.md 2023-05-18 11:59:35 +02:00
Ray
76e39e502c Update rtextures.c 2023-05-17 23:14:14 +02:00
Ray
3a3e672804 UPDATE: miniaudio v0.11.12 --> v0.11.16 2023-05-17 11:54:32 +02:00
Ray
c3f049fd74 review formatting 2023-05-16 11:02:00 +02:00
Le Juez Victor
675efbda3b Fix Android app freeze after calling CloseWindow() (#3067)
Fixed that the Android application was not closed properly after calling `CloseWindow()` and continued to run.
2023-05-16 11:00:44 +02:00
Ray
e17cf9ecd7 REVIEWED: Formating 2023-05-15 11:30:31 +02:00
Pixel Phobic
3f8ef4e05f Updated (rcamera) To Add Analog Stick Cam Controls (#3066)
I Noticed While Writing Some code for My Game im Making that there Isn't an Easy way to control the Camera With The Analog Sticks on Controller.

I Added  a Couple Lines to the UpdateCamera Function :)
2023-05-15 11:25:44 +02:00
Crynux
3438325e7d Update rmodels.c; free fileData for LoadModelAnimationsGLTF (#3065)
fileData wasn't freed for LoadModelAnimationsGLTF causing a memory leak. Added UnloadFileData line, freeing it.
2023-05-15 11:24:37 +02:00
Gamer-Kold
6b92d71ea1 Reverted commits that deprecated the build.zig files, and added a note to all of them stating version of zig they were using (#3060)
* Revert "Fixed broken build.zig files. Now works with latest stable compiler (as of commit, latest is 0.10.1) (#3045)"

This reverts commit de748dfffe so that zig
build script works with master branch of zig.

* Added a note to build.zig files that denotes what version of zig they have been tested with.

* Standardised the note in the build.zig files
2023-05-15 11:23:36 +02:00
hamyy
26a3536958 GetCurrentMonitor() bugfix (#3058)
* GetCurrentMonitor() bugfix

* GetCurrentMonitor() bugfix
2023-05-14 21:20:43 +02:00
lesleyrs
818312683e update cmake example project (#3062)
* update cmake example project

* off is the correct one
2023-05-14 21:15:32 +02:00
Michael Scherbakow
cc17a7656c Update build.zig be be able to build with current zig master (#3064) 2023-05-14 21:14:16 +02:00
JupiterRider
5978358e58 Update BINDINGS.md (#3053) 2023-05-11 19:48:53 +02:00
Ray
452e3b494c REVIEWED: GetCollisionRec() 2023-05-10 19:25:12 +02:00
manuel5975p
af4b97a301 Update GetCollisionRec (#3052)
* Update rshapes.c

Add a much more efficient GetCollisionRec implementation

* Update GetCollisionRec

Replace macros with ternary operators
2023-05-10 19:19:59 +02:00
Ray
152262dbfc Update cgltf.h 2023-05-10 12:48:17 +02:00
Ray
fe595d60f7 Remove trailing spaces 2023-05-08 18:57:36 +02:00
Kenta
81e2c97095 Update BINDINGS.md (#3050)
Update C3 binding to use Raylib version 4.5
2023-05-08 16:00:21 +02:00
Shoozza
204c6765bd Fix vs code project (#3048)
* Modify remove trailing whitespace

* Fix invalid SetCameraMode call and missing argument to UpdateCamera for VSCode project
2023-05-07 20:22:37 +02:00
Scott Helvick
05e71f990c Version bump for CL bindings (#3049) 2023-05-07 20:21:47 +02:00
Alfred Reinold Baudisch
53b7b26c45 Added ModelAnimation.name, initially with GLTF animation names loaded (#3044) 2023-05-07 10:33:14 +02:00
Gamer-Kold
de748dfffe Fixed broken build.zig files. Now works with latest stable compiler (as of commit, latest is 0.10.1) (#3045)
Co-authored-by: Talha Qamar <qamartalha@proton.me>
2023-05-06 12:04:40 +02:00
Ray
5573f0f1c7 REVIEWED: Ligthmap example 2023-05-04 20:35:20 +02:00
Jussi Viitala
abcbd9817e Lightmap example. (#3043) 2023-05-04 20:21:35 +02:00
Ray
a48bb6e1ed ADDED: Comment to clarify raymath semantics 2023-05-02 20:51:54 +02:00
Ray
fc56940055 REVIEWED: ExportDataAsCode() 2023-05-02 20:40:45 +02:00
Ray
3a21301724 ADDED: Comment about Matrix conventions 2023-05-02 19:29:14 +02:00
Ray
7d68aa6869 REVIEWED: Modules description layout 2023-05-01 14:04:22 +02:00
Ray
a4a5a798bd Update rlgl_compute_shader.c 2023-05-01 14:03:32 +02:00
star-tek-mb
ed2caa1277 fix for latest zig master (#3037) 2023-05-01 11:02:34 +02:00
Ray
59596e4266 Update rcore.c 2023-04-29 20:39:36 +02:00
Thiago P
66f0de2807 WingBGI now leads to the correct website! (#3033)
The old link led to an unregistered site (http://www.codecutter.net/tools/winbgim/). The actual domain has changed to (https://winbgim.codecutter.org/). 
I checked the wayback machine, it's the same site, take a look: https://web.archive.org/web/20190421035959/http://www.codecutter.net/tools/winbgim/.
2023-04-29 20:34:14 +02:00
Le Juez Victor
662dfad670 Correction of values ​​used only once in GenMeshCubicmap (#3032)
* Correction of values ​​used only once in GenMeshCubicmap

The mapWidth and mapHeight values ​​were only used as a limit in the for loop when they could be used throughout the function.

* mapWidth and mapHeight removed from GenMeshCubicmap

mapWidth and mapHeight have been removed from GenMeshCubicmap in favor of using cubicmap.width and cubicmap.height
2023-04-29 17:03:19 +02:00
kolunmi
98cb7a19a1 ensure distance is greater than 0 in CameraMoveToTarget (#3031) 2023-04-27 22:17:57 +02:00
Ray
e2996f167e Update rtextures.c 2023-04-25 20:01:26 +02:00
Ray
64f2f86d32 Update rtextures.c 2023-04-25 15:15:57 +02:00
Ray
6472928cf1 REVIEWED: ImageDrawRectangleRec() #3027 2023-04-25 14:16:48 +02:00
Ray
ac2e9cd00f REVIEWED: Update CORE.Input.Touch.pointCount #3024 2023-04-23 11:48:01 +02:00
Chris
b9b045cdd8 Update BINDINGS.md (#3026) 2023-04-23 11:41:34 +02:00
Ray
838fc7e303 REVIEWED: Some old TODOs 2023-04-22 21:17:53 +02:00
Dor Shapira
05af08080e Update BINDINGS.md (#3023)
update raypyc version to 4.6-dev
2023-04-22 19:38:56 +02:00
Dan Bechard
2d04dd8b88 Fix off-by-one error in CheckCollisionPointRec (#3022)
Checking `<= x + w` causes off-by-one error where `CheckCollisionPointRec` will return true at the same time for two rectangles rendered right next to each, but which don't overlap (e.g. when making a 2D tile editor). This is clearly not what was intended.
2023-04-22 10:15:19 +02:00
Mingjie Shen
7b7c0c83ef Fix offset used before range check (#3021)
This use of offset 'i' should follow the range check.
2023-04-22 10:13:11 +02:00
Soutaisei
535680668b Update BINDINGS.md (#3017)
Update Kaylib to Raylib version 4.5
2023-04-19 21:25:25 +02:00
Ray
771957458d Avoid shader attribute not found log 2023-04-17 17:50:46 +02:00
Ray
9d38363e09 Remove trailing spaces 2023-04-17 12:18:06 +02:00
RadsammyT
e2da32e2da [raudio] Rewritten ExportWaveAsCode() file saving to be more like rtextures ExportImageAsCode() (#3013)
* Update raudio.c

Review `raudio.c`: rewritten `ExportWaveAsCode()` to be more like rtextures.c `ExportImageAsCode()'

* no tab november

accidentally inserted a tab somewhere. corrected it.
2023-04-15 10:58:00 +02:00
Benjamin Thomas
70d7f67bd8 CMake project example: fix a couple of typos (#3014) 2023-04-15 10:55:40 +02:00
Ray
709b14180a Make assets loading extension case insensitive #3008 2023-04-13 23:08:32 +02:00
Ray
9aa71f04f2 Avoid tracelog about not found uniforms #3003 2023-04-10 11:02:00 +02:00
eternalStudent
8f741d894a Minor fix in DrawLineBezier* (#3006)
When `i` starts with `0`, `t` is also `0`, which results in `previous == startPos == current`, this segment is not only redundant, but it also causes division-by-zero since `sqrtf(dx*dx + dy*dy)` is zero.
2023-04-09 22:43:06 +02:00
Jeffery Myers
e57ee9c0e8 Fix warnings in raylib for MSVC (#3004) 2023-04-09 22:42:15 +02:00
fubark
06c17ab7f1 Update BINDINGS.md (#3002) 2023-04-08 19:05:41 +02:00
Ray
d8c7b01a3c REVIEWED: GetGlyphIndex() #3000 2023-04-06 12:49:59 +02:00
chocolate42
8367abad1a [rtext] Fix GetCodepointNext() to return default value on invalid input with size=0 (#2997)
* Fix GetCodepointNext to return default value with size=0 on invalid input. Modify LoadCodepoints to work when GetCodepointNext returns a size of 0. All internal use of GetCodepointNext and GetCodepointPrev checked. This fix may break external code dealing with invalid input as the old code erroneously never returned a size of 0, external code that doesn't properly check for size=0 may endlessly loop or overflow a buffer on invalid input.

* Change default behaviour of GetCodepointNext to return a size of 1 instead of 0. This matches existing prod behaviour and guarantees size 1..4 is returned. Simplify internal code that uses GetCodepointNext that previously had to account for size=0.

* Simplified progressing through a UTF-8 string in ImageTextEx and MeasureTextEx. This change matches existing precedent in DrawTextEx

* GetCodepointNext: Add 10xxxxxx checks to multibyte encodings.

---------

Co-authored-by: anon <anon>
2023-04-06 12:34:37 +02:00
Jorge A. Gomes
17c443ee6d Update BINDINGS.md (raylib-py -> 4.5) (#2992)
Co-authored-by: Ray <raysan5@gmail.com>
2023-03-29 13:52:33 +02:00
Astie Teddy
1a110dcbd7 Update BINDINGS.md (raylib-lua -> 4.5) (#2989) 2023-03-25 23:26:38 +01:00
Ray
02bd709043 Update BINDINGS.md 2023-03-25 10:38:21 +01:00
Steven Schveighoffer
1fc8f1bdbf Update raylib-d binding version to 4.5 (#2988) 2023-03-25 10:32:46 +01:00
WIITD
57082d6600 update raylib-freebasic to 4.5 (#2986) 2023-03-23 22:26:55 +01:00
Ray
6287f68c0b Lazy loading of default font for image loading (no InitWindow) 2023-03-22 20:11:36 +01:00
Ray
0925851f89 Update rl_gputex.h 2023-03-22 20:11:03 +01:00
Ray
770e239f73 Minor tweaks to raylib events automation system 2023-03-22 19:47:42 +01:00
Ray
0d4db7ad7f Update CMakeLists.txt 2023-03-22 12:43:18 +01:00
Ray
19892a3c3a Update resource arch for 64bit #2978 2023-03-22 11:15:00 +01:00
Ray
ecb6a6af32 Review format 2023-03-22 11:08:46 +01:00
Rico P
8b8eddc8e2 slightly optimize Vector3Normalize (#2982) 2023-03-22 11:01:05 +01:00
Hanaxar
e55bdd5d8a Fix packing logic error in ``GenImageFontAtlas`` (#2979)
Basic packing algorithm currently follows this order: Copy pixel data -> Move offsetX for current glyph -> Check remaining space for current glyph...
Since X offset already moved according current glyph, remaining space should be checked for next glyph. Because of this, occasionally, current logic causes glyphs wrapping around texture.
Proposed fix accomplishes that by moving offsetX check to the beginning of the loop.
2023-03-22 11:00:13 +01:00
Hanaxar
02a8a49961 Calculate exact image size in GenImageFontAtlas (#2963)
* Calculate exact image size in GenImageFontAtlas

Calculate exact image size with a method based on total glyph width and glyph row count
Current method seemed a little bit overkill with square root, log and power functions and only approximates image size which can be wonky with some weird fonts like cursive fonts.
Proposed method calculates image size directly with a simpler method and results exact image size needed.

* Update rtext.c

* Update rtext.c

Changed do-while to while loop, and also added an extra step to calculate maximum glyph width and excluding it from image width for extra safety.
2023-03-22 10:59:28 +01:00
Jarrod Davis
7565e274b1 Update BINDINGS.md (#2983)
Adding raylib for Pascal
2023-03-22 08:55:58 +01:00
gingerBill
d61303b1b0 Update BINDINGS.md for raylib Odin 4.5 (#2981) 2023-03-21 22:46:20 +01:00
Gunko Vadim
04229c5854 Update BINDINGS.md (#2980)
update ray4laz to raylib 4.5
2023-03-21 20:03:38 +01:00
Ray
a139ba9c48 Update README.md 2023-03-21 12:04:03 +01:00
Mansour Quddus
4f43ceb0d2 add missing space in one of the cameraDescriptions (#2977) 2023-03-21 08:31:29 +01:00
Ray
9f7a49bec3 Updated version to avoid confusion with 4.5 release 2023-03-20 18:03:37 +01:00
Ikko Eltociear Ashimine
ace7aef0e6 Fix typo in rmodels.c (#2976)
Upate -> Update
2023-03-20 16:43:22 +01:00
Rob Loach
e450c75f6f BINDINGS: Update various versions to 4.5 (#2974) 2023-03-20 16:41:16 +01:00
Webfra
08670ecea1 Add const qualifier to char * path argument in qoaplay_open() (#2972)
* Add const qualifier to char * path argument
in qoa_open()

* Remove unnecessary cast
2023-03-19 20:34:22 +01:00
Michael Scherbakow
03e19c7f43 Update raylib.zig version to 4.5 (#2971) 2023-03-19 18:27:21 +01:00
Anand Swaroop
3c02f0c75b Update h-raylib version (#2970) 2023-03-19 15:38:30 +01:00
Ray
2e02474b7a Update core_loading_thread.c 2023-03-19 11:25:29 +01:00
Rob Loach
c14c7f0b69 raudio: Fix warning on discarded const qualifier (#2967)
The `qoaplay_open()` function expects a `char *`, but we are passing in a `const char *`. While this works just fine, it does issue a compiler warning when strict:

```
src/raudio.c: In function ‘LoadMusicStream’:
src/raudio.c:1290:45: warning: passing argument 1 of ‘qoaplay_open’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1290 |         qoaplay_desc *ctxQoa = qoaplay_open(fileName);
      |                                             ^~~~~~~~
In file included from src/raudio.c:233:
src/external/qoaplay.c:86:34: note: expected ‘char *’ but argument is of type ‘const char *’
   86 | qoaplay_desc *qoaplay_open(char *path)
      |                            ~~~~~~^~~~
```

This change casts the argument to a `char *` to fix the warning.
2023-03-19 11:16:52 +01:00
Niels Martignène
76b5959bb5 Fix missing symbol when rglfw.c on BSD platforms (#2968) 2023-03-19 09:43:51 +01:00
216 changed files with 56660 additions and 26802 deletions

View File

@@ -21,6 +21,7 @@ Please, before submitting a new issue verify and check:
- [ ] I tested it on latest raylib version from master branch
- [ ] I checked there is no similar issue already reported
- [ ] I checked the documentation on the [wiki](https://github.com/raysan5/raylib/wiki)
- [ ] My code has no errors or misuse of raylib
### Issue description

134
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,134 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
on:
workflow_dispatch:
# push:
# branches: [ "main", "master" ]
pull_request:
branches: '*'
schedule:
- cron: '0 0 * * 1'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-20.04' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: Setup Environment
run: |
sudo apt-get update -qq
sudo apt-get install gcc-multilib
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
queries: security-and-quality
- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cd build
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
cmake --build . --config $BUILD_TYPE
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
upload: false
id: step1
# Filter out rules with low severity or high false positve rate
# Also filter out warnings in third-party code
- name: Filter out unwanted errors and warnings
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-**:cpp/path-injection
-**:cpp/world-writable-file-creation
-**:cpp/poorly-documented-function
-**:cpp/potentially-dangerous-function
-**:cpp/use-of-goto
-**:cpp/integer-multiplication-cast-to-long
-**:cpp/comparison-with-wider-type
-**:cpp/leap-year/*
-**:cpp/ambiguously-signed-bit-field
-**:cpp/suspicious-pointer-scaling
-**:cpp/suspicious-pointer-scaling-void
-**:cpp/unsigned-comparison-zero
-**/cmake*/Modules/**
-**/src/external/glfw/**
input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"
- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}
retention-days: 5

View File

@@ -22,7 +22,7 @@ jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
max-parallel: 1

View File

@@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@master
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
uses: mymindstorm/setup-emsdk@v12
with:
version: 3.1.30
actions-cache-folder: 'emsdk-cache'

4
.gitignore vendored
View File

@@ -75,6 +75,9 @@ xcschememanagement.plist
xcuserdata/
DerivedData/
# VSCode project
.vscode
# Jetbrains project
.idea/
cmake-build-*/
@@ -85,6 +88,7 @@ CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
cmake_uninstall.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

View File

@@ -6,80 +6,90 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| name | raylib version | language | license | repo |
|:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------|
| raylib | **4.2** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib |
| raylib | **4.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib |
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo |
| Raylib-cs | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs |
| Raylib-CsLo | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo |
| cl-raylib | **4.0** | [Common Lisp](https://common-lisp.net/) | MIT | https://github.com/longlene/cl-raylib |
| claylib/wrap | **4.2** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
| chez-raylib | auto | [Chez Scheme](https://cisco.github.io/ChezScheme/) | GPLv3 | https://github.com/Yunoinsky/chez-raylib |
| raylib-cr | **4.5-dev (7e7939e)** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr |
| ray-cyber | **4.2** | [Cyber](https://cyberscript.dev) | MIT | https://github.com/fubark/ray-cyber |
| raylib-c3 | **4.5-dev** | [C3](https://c3-lang.org/) | MIT | https://github.com/Its-Kenta/Raylib-C3 |
| dart-raylib | **4.0** | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib |
| bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 |
| dray | **4.2** | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray |
| raylib-d | **4.2** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d |
| dlang_raylib | **4.0** | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib |
| Raylib-cs | **4.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs |
| Raylib-CsLo | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo |
| cl-raylib | 4.0 | [Common Lisp](https://common-lisp.net/) | MIT | https://github.com/longlene/cl-raylib |
| claylib/wrap | **4.5** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
| claw-raylib | **auto** | [Common Lisp](https://common-lisp.net/) | Apache-2.0 | https://github.com/bohonghuang/claw-raylib |
| chez-raylib | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme/) | GPLv3 | https://github.com/Yunoinsky/chez-raylib |
| raylib-cr | **4.6-dev (5e1a81)** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr |
| ray-cyber | 4.5 | [Cyber](https://cyberscript.dev) | MIT | https://github.com/fubark/ray-cyber |
| raylib-c3 | **4.5** | [C3](https://c3-lang.org/) | Zlib | https://github.com/Its-Kenta/Raylib-C3 |
| dart-raylib | 4.0 | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib |
| bindbc-raylib3 | **4.5** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 |
| dray | 4.2 | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray |
| raylib-d | **4.5** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d |
| dlang_raylib | 4.0 | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib |
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex |
| raylib-factor | **4.0** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor |
| raylib-freebasic | **4.2** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic |
| raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
| raylib-factor | **4.5** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor |
| raylib-freebasic | **4.5** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic |
| fortran-raylib | **4.5** | [Fortran](https://fortran-lang.org/) | ISC | https://github.com/interkosmos/fortran-raylib |
| raylib for Pascal | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | Modified Zlib | https://github.com/tinyBigGAMES/raylib |
| raylib-go | **5.0** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
| raylib-guile | **auto** | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
| h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
| raylib-hx | **4.2** | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
| h-raylib | **4.6-dev** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
| raylib-hx | 4.2 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
| jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |
| raylib-j | **4.0** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J |
| raylib.jl | **4.2** | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl |
| jaylib | 4.5 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib |
| jaylib | **4.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |
| raylib-j | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J |
| raylib.jl | 4.2 | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl |
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib |
| kaylib | **4.5-dev**| [Kotlin/native](https://kotlinlang.org) | Zlib | https://codeberg.org/Kenta/Kaylib |
| raylib-lua | **4.2** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua |
| raylua | **4.0** | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua |
| KaylibKit | **4.5**| [Kotlin/native](https://kotlinlang.org) | Zlib | https://codeberg.org/Kenta/KaylibKit |
| raylib-lua | **4.5** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua |
| raylua | 4.0 | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua |
| raylib-matte | 4.6-dev | [Matte](https://github.com/jcorks/matte/) | MIT | https://github.com/jcorks/raylib-matte |
| nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib |
| Raylib-Nelua | **4.5-dev** | [nelua](https://nelua.io/) | MIT | https://github.com/Its-Kenta/Raylib-Nelua |
| Raylib.nelua | **4.5** | [nelua](https://nelua.io/) | Zlib | https://github.com/Its-Kenta/Raylib-Nelua |
| NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now |
| raylib-bindings | **4.5** | [Ruby](https://www.ruby-lang.org/en/) | Zlib | https://github.com/vaiorabbit/raylib-bindings |
| raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever |
| naylib | auto | [Nim](https://nim-lang.org/) | MIT | https://github.com/planetis-m/naylib |
| node-raylib | **4.0** | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib |
| node-raylib | **4.5** | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib |
| raylib-odin | **4.5** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings |
| raylib-odin | **4.0** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
| raylib-ocaml | **4.2** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml |
| TurboRaylib | **4.2** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib |
| Ray4Laz | **4.2** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz |
| Raylib.4.0.Pascal | **4.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal |
| raylib-ocaml | **4.5** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml |
| TurboRaylib | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib |
| Ray4Laz | **4.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz |
| Raylib.4.0.Pascal | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal |
| pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib |
| raylib-python-cffi | **4.2** | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi |
| raylibpyctbg | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylibpyctbg |
| raylib-py | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylib-py |
| raylib-python-ctypes | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/sDos280/raylib-python-ctypes |
| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php |
| raylib-python-cffi | 4.2 | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi |
| raylibpyctbg | **4.5** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylibpyctbg |
| raylib-py | **4.5** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylib-py |
| raylib-python-ctypes | 4.6-dev | [Python](https://www.python.org/) | MIT | https://github.com/sDos280/raylib-python-ctypes |
| raylib-pkpy-bindings | 4.6-dev | [pocketpy](https://pocketpy.dev/) | MIT | https://github.com/blueloveTH/pkpy-bindings |
| raylib-php | **4.5** | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php |
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp |
| raylibr | **4.0** | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr |
| raylibr | 4.0 | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr |
| raylib-ffi | 4.5 | [Rust](https://www.rust-lang.org/) | GPLv3 | https://github.com/ewpratten/raylib-ffi |
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | Zlib | https://github.com/deltaphc/raylib-rs |
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | ? | https://github.com/RedCubeDev-ByteSpace/Relib |
| racket-raylib | **4.0** | [Racket](https://racket-lang.org/) | MIT/Apache-2.0 | https://github.com/eutro/racket-raylib |
| raylib-swift | **4.0** | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib |
| racket-raylib | 4.0 | [Racket](https://racket-lang.org/) | MIT/Apache-2.0 | https://github.com/eutro/racket-raylib |
| raylib-swift | 4.0 | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib |
| raylib-scopes | auto | [Scopes](http://scopes.rocks) | MIT | https://github.com/salotz/raylib-scopes |
| raylib-smallBasic | 4.1-dev | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib |
| raylib-umka | **4.2** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka |
| raylib.v | **4.2** | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v |
| raylib-vapi | **4.2** | [Vala](https://vala.dev/) | Zlib | https://github.com/lxmcf/raylib-vapi |
| raylib-wren | **4.0** | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren |
| raylib-zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
| raylib.zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
| hare-raylib | auto | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib |
| raylib-sunder | auto | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD | https://github.com/ashn-dot-dev/raylib-sunder |
| rayed-bqn | auto | [BQN](https://mlochbaum.github.io/BQN/) | MIT | https://github.com/Brian-ED/rayed-bqn |
| raylib-umka | **4.5** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka |
| raylib.v | 4.2 | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v |
| raylib-vapi | 4.2 | [Vala](https://vala.dev/) | Zlib | https://github.com/lxmcf/raylib-vapi |
| raylib-wren | 4.0 | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren |
| raylib-zig | 4.2 | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
| raylib.zig | **4.5** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
| hare-raylib | **auto** | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib |
| raylib-sunder | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD | https://github.com/ashn-dot-dev/raylib-sunder |
| rayed-bqn | **auto** | [BQN](https://mlochbaum.github.io/BQN/) | MIT | https://github.com/Brian-ED/rayed-bqn |
| rayjs | 4.6-dev | [QuickJS](https://bellard.org/quickjs/) | MIT | https://github.com/mode777/rayjs |
| raylib-raku | **auto** | [Raku](https://www.raku.org/) | Artistic License 2.0 | https://github.com/vushu/raylib-raku |
| Raylib.lean | 4.5 | [Lean4](https://lean-lang.org/) | BSD-3-Clause | https://github.com/KislyjKisel/Raylib.lean |
### Utility Wrapers
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
| name | raylib version | language | license | repo |
|:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------|
| raylib-cpp | **4.2** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp |
| claylib | **4.2** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
| raylib-cpp | **4.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp |
| claylib | **4.5** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
### Older or Unmaintained Language Bindings
These are older raylib bindings that are more than 2 versions old or have not been maintained.
@@ -132,7 +142,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kujukuju/raylib-jai |
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |

250
CHANGELOG
View File

@@ -1,7 +1,247 @@
changelog
---------
Current Release: raylib 4.5.0 (18 March 2023)
Current Release: raylib 5.0 (18 November 2023)
-------------------------------------------------------------------------
Release: raylib 5.0 - 10th Anniversary Edition (18 November 2023)
-------------------------------------------------------------------------
KEY CHANGES:
- REDESIGNED: rcore module platform-split, by @ubkp, @michaelfiber, @Bigfoot71, @raysan5
- ADDED: New platform backend supported: SDL
- ADDED: New platform backend supported: Nintendo Switch (closed source)
- ADDED: New Splines drawing and evaluation API
- ADDED: New pseudo-random numbers generator: rprand
- ADDED: Automation Events System API
- UPDATED: raygui 4.0: New version of this immediate-mode gui system for tools development with raylib
Detailed changes:
[rcore] ADDED: RAYLIB_VERSION_* values to raylib.h (#2856) by @RobLoach
[rcore] ADDED: IsKeyPressedRepeat() on PLATFORM_DESKTOP (#3245) by @actondev
[rcore] ADDED: SetWindowTitle() for PLATFORM_WEB (#3222) by @VitusVeit
[rcore] ADDED: FLAG_WINDOW_RESIZABLE for web (#3305) by @Peter0x44
[rcore] ADDED: SetWindowMaxSize() for desktop and web (#3309) by @ubkp
[rcore] ADDED: SetMouseCursor() for PLATFORM_WEB (#3414) by @BeardedBread
[rcore] ADDED: LoadRandomSequence()/UnloadRandomSequence() by @raysan5
[rcore] REMOVED: PLATFORM_RPI (#3232) by @michaelfiber
[rcore] REVIEWED: GetFileLength(), added comment (#3262) by @raysan5
[rcore] REVIEWED: Default shaders precission issue on PLATFORM_WEB (#3261) by @branc116
[rcore] REVIEWED: IsKey*() key validation checks (#3256) by @n77y
[rcore] REVIEWED: SetClipboardText() for PLATFORM_WEB (#3257) by @ubkp
[rcore] REVIEWED: Check if Ctrl modifier is among the currently set modifiers (#3230) by @mohad12211
[rcore] REVIEWED: Android app black screen when reopening by @Bigfoot71
[rcore] REVIEWED: Warnings when casting int to floats (#3218) by @JeffM2501
[rcore] REVIEWED: GetCurrentMonitor() detection inconsistency issue (#3215) by @ubkp
[rcore] REVIEWED: SetWindowMonitor() to no longer force fullscreen (#3209) by @ubkp
[rcore] REVIEWED: Fix mouse wheel not working in PLATFORM_RPI or PLATFORM_DRM (#3193) by @ubkp
[rcore] REVIEWED: GetMonitorName() description (#3184) (#3189) by @danilwhale
[rcore] REVIEWED: BeginScissorMode(), identify rendering to texture (#3510) by @gulrak
[rcore] REVIEWED: Window flags order (#3114) by @lesleyrs
[rcore] REVIEWED: Full movement for right analog stick (#3095) by @PixelPhobicGames
[rcore] REVIEWED: Fix Android app freeze after calling CloseWindow() (#3067) by @Bigfoot71
[rcore] REVIEWED: Lazy loading of default font used on image drawing (no InitWindow) by @raysan5
[rcore] REVIEWED: Minor tweaks to raylib events automation system @raysan5
[rcore] REVIEWED: GetCurrentMonitor() bugfix (#3058) by @hamyyy
[rcore] REVIEWED: Update CORE.Input.Touch.pointCount (#3024) by @raysan5
[rcore] REVIEWED: Mouse offset and scaling must be considered also on web!
[rcore] REVIEWED: CompressData(), possible stack overflow
[rcore] REVIEWED: GetWorldToScreenEx() (#3351) by @Brian-ED
[rcore] REVIEWED: Fix GetMouseDelta() issue for Android (#3404) by @Bigfoot71
[rcore] REVIEWED: GetFPS(), reset FPS averages when window is inited (#3445) by @JeffM2501
[rcore] REVIEWED: GetCurrentMonitor(), check window center position by @M374LX
[rcore] REVIEWED: GetRender*() issue on macOS highDPI (#3367) by @raysan5
[rcore] REVIEWED: ScanDirectoryFiles*(), paths building slashes sides (#3507)
[rlgl] ADDED: Experimental support for OpenGL ES 3.0 by @raysan5
[rlgl] ADDED: Support 16-Bit HDR textures (#3220) by @Not-Nik
[rlgl] ADDED: rlEnablePointMode() (#3490) by @JettMonstersGoBoom
[rlgl] ADDED: rlBlitFramebuffer(), required for deferred render
[rlgl] REVIEWED: LoadModel(), removed cube fallback mechanism (#3459)
[rlgl] REVIEWED: Improved support for ES3/WebGL2 (#3107) by @chemaguerra
[rlgl] REVIEWED: OpenGL 2.1 half floats support as part of an extension by @Not-Nik
[rlgl] REVIEWED: Avoid shader attribute not found log by @raysan5
[rlgl] REVIEWED: Avoid tracelog about not found uniforms (#3003) by @raysan5
[rlgl] REVIEWED: rLoadTexture() UBSAN complaints #1891 (#3321) by @Codom
[rlgl] REVIEWED: glInternalFormat as unsigned int
[rlgl] REVIEWED: OpenGL ES 3.0 support
[rshapes] ADDED: Spline drawing functions by @raysan5
[rshapes] ADDED: GetSplinePoint*() functions for spline evaluation by @raysan5
[rshapes] ADDED: DrawCircleLinesV() for consistency (#3452) by @Peter0x44
[rshapes] REVIEWED: DrawSplineCatmullRom() by @raysan5
[rshapes] REVIEWED: Minor fix in DrawLineBezier* (#3006) by @eternalStudent
[rshapes] REVIEWED: GetCollisionRec(), more performant (#3052) by @manuel5975p
[rshapes] REVIEWED: Fix off-by-one error in CheckCollisionPointRec() (#3022) by @dbechrd
[rtextures] ADDED: Basic SVG loading support (#2738) by @bXi
[rtextures] ADDED: Support 16-Bit HDR textures (#3220) by @Not-Nik
[rtextures] ADDED: ExportImageToMemory() by @raysan5
[rtextures] ADDED: ImageRotate() (#3078) by @danemadsen
[rtextures] ADDED: GenImageGradientSquare() (#3077) by @danemadsen
[rtextures] ADDED: GenImageLinearGradient() by @danemadsen
[rtextures] REMOVED: GenImageGradientH() and GenImageGradientV() by @danemadsen
[rtextures] REVIEWED: LoadImageSvg() by @raysan5
[rtextures] REVIEWED: Uninitialized thread-locals in stbi (#3282) (#3283) by @jbarthelmes
[rtextures] REVIEWED: ImageDrawRectangleRec(), validate drawing inside bounds by @JeffM2501
[rtextures] REVIEWED: LoadTextureCubemap() for manual layouts (#3204) by @Not-Nik
[rtextures] REVIEWED: Optimization of ImageDrawRectangleRec() (#3185) by @smalltimewizard
[rtextures] REVIEWED: ImageRotate() formatting by @raysan5
[rtextures] REVIEWED: GenImagePerlinNoise(), clamp values (#3071) by @raysan5
[rtextures] REVIEWED: Packing logic error in GenImageFontAtlas() (#2979) by @hanaxar
[rtextures] REVIEWED: Calculate exact image size in GenImageFontAtlas() (#2963) by @hanaxar
[rtextures] REVIEWED: ImageDrawRectangleRec() (#3027) by @raysan5
[rtextures] REVIEWED: ImageDraw() source clipping when drawing beyond top left (#3306) by @RobLoach
[rtextures] REVIEWED: UnloadRenderTexture(), additional checks
[rtextures] REVIEWED: Fixed compressed DDS texture loading issues (#3483) by @JaanDev
[rtext] ADDED: Font altas white rectangle and flag SUPPORT_FONT_ATLAS_WHITE_REC by @raysan5
[rtext] ADDED: SetTextLineSpacing() to define line breaks text drawing spacing by @raysan5
[rtext] RENAMED: LoadFont*() parameter names for consistency and coherence by @raysan5
[rtext] REVIEWED: GetCodepointCount(), ignore unused return value of GetCodepointNext by @ashn-dot-dev
[rtext] REVIEWED: TextFormat() warn user if buffer overflow occured (#3399) by @Murlocohol
[rtext] REVIEWED: TextFormat(), added "..." for truncation (#3366) by @raysan5
[rtext] REVIEWED: GetGlyphIndex() (#3000) by @raysan5
[rtext] REVIEWED: GetCodepointNext() to return default value by @chocolate42
[rtext] REVIEWED: TextToPascal() issue when first char is uppercase
[rmodels] ADDED: ModelAnimation.name field, initially with GLTF animation names by @alfredbaudisch
[rmodels] REDESIGNED: LoadOBJ(), avoid mesh splitting by materials, fix (#3398) by @raysan5
[rmodels] REVIEWED: Support .vox model files version 200 (#3097) by @Bigfoot71
[rmodels] REVIEWED: Materials loading (#3126) @raysan5
[rmodels] REVIEWED: DrawBillboardPro() to allow source of negative size (#3197) by @bohonghuang
[rmodels] REVIEWED: glTF loading segfault in animNormals memcpy by @charles-l
[rmodels] REVIEWED: LoadModelAnimationsGLTF(), free fileData after use (#3065) by @crynux
[rmodels] REVIEWED: GenMeshCubicmap(), correction of values (#3032) by @Bigfoot71
[rmodels] REVIEWED: DrawMesh() to avoid UBSAN complaining (#1891)
[rmodels] REVIEWED: GenMeshPlane() when resX != resZ (#3425) by @neyrox, @s-yablonskiy
[rmodels] REVIEWED: GetModelBoundingBox() (#3485)
[raudio] ADDED: LoadSoundAlias() by @JeffM2501
[raudio] ADDED: Missing structure on standalone mode (#3160) by @raysan5
[raudio] ADDED: GetMasterVolume() (#3434) by @rexim
[raudio] REVIEWED: Comments about sample format to AttachAudioStreamProcessor() (#3188) by @AlbertoGP
[raudio] REVIEWED: Documented buffer format for audio processors (#3186) by @AlbertoGP
[raudio] REVIEWED: ExportWaveAsCode() file saving by @RadsammyT
[raudio] REVIEWED: Fix warning on discarded const qualifier (#2967) by @RobLoach
[raudio] REVIEWED: Move mutex initialization before ma_device_start() (#3325) by @Bigfoot71
[raudio] REVIEWED: Fix UpdateSound() parameter name (#3405) by @KislyjKisel
[raudio] REVIEWED: Fix QOA seeking (#3494) by @veins1
[rcamera] REVIEWED: File-macros for consistency (#3161) by @raysan5
[rcamera] REVIEWED: Support analog stick camera controls (#3066) by @PixelPhobicGames
[rcamera] REVIEWED: CameraMoveToTarget(), ensure distance is greater than 0 (#3031) by @kolunmi
[rcamera] REVIEWED: Exposing rcamera functions to the dll (#3355) by @JeffM2501
[raymath] ADDED: Vector3Projection() and Vector3Rejection() (#3263) by @Dial0
[raymath] ADDED: EPSILON macro to each function requiring it (#3330) by @Brian-ED
[raymath] REVIEWED: Usage of 'sinf()' and 'cosf()' to be correct (#3181) by @RokasPuzonas
[raymath] REVIEWED: Slightly optimized Vector3Normalize() (#2982) by @RicoP
[raymath] REVIEWED: Comment to clarify raymath semantics by @raysan5
[raymath] REVIEWED: Comment about Matrix conventions by @raysan5
[raymath] REVIEWED: Vector2Angle() and Vector2LineAngle() (#3396) by @Murlocohol
[rgestures] REVIEWED: Optimize and simplify the gesture system (#3190) by @ubkp
[rgestures] REVIEWED: GESTURE_DRAG and GESTURE_SWIPE_* issues (mostly) for web (#3183) by @ubkp
[rgestures] REVIEWED: Touch pointCount for web (#3163) by @ubkp
[rgestures] REVIEWED: IsGestureDetected() parameter type
[utils] ADDED: Security checks to file reading (memory allocations) by @raysan5
[utils] REVIEWED: LoadFileData() potential issues with dataSize
[examples] ADDED: shaders_lightmap (#3043) by @nullstare
[examples] ADDED: core_2d_camera_split_screen (#3298) by @gabrielssanches
[examples] ADDED: LoadSoundAlias() usage example (#3223) by @JeffM2501
[examples] ADDED: textures_tiling (#3353) by @luis605
[examples] ADDED: shader_deferred_render (#3496) by @27justin
[examples] RENAMED: 2d_camera examples for consistency
[examples] REVIEWED: Text examples SetTextLineSpacing() to multiline examples by @raysan5
[examples] REVIEWED: examples/shapes/shapes_collision_area.c help instructions (#3279) by @asdqwe
[examples] REVIEWED: examples/shaders/shaders_texture_outline.c help instructions (#3278) by @asdqwe
[examples] REVIEWED: examples/others/easings_testbed.c help instructions and small twe… by @asdqwe
[examples] REVIEWED: example/audio/audio_module_player.c help instructions and small b… by @asdqwe
[examples] REVIEWED: example/models/models_loading_m3d.c controls (#3269) by @asdqwe
[examples] REVIEWED: example/models/models_loading_gltf.c controls (#3268) by @asdqwe
[examples] REVIEWED: text_unicode.c example crashing (#3250) by @ubkp
[examples] REVIEWED: rlgl_standalone.c compilation issue (#3242) by @ubkp
[examples] REVIEWED: core_input_gestures for Web (#3172) by @ubkp
[examples] REVIEWED: core_input_gamepad (#3110) by @iacore
[examples] REVIEWED: examples using raygui to raygui 4.0 by @raysan5
[examples] REVIEWED: Julia set shader example (#3467) by @joshcol9232
[build] ADDED: CMake option for SUPPORT_CUSTOM_FRAME_CONTROL (#3221) by @ubkp
[build] ADDED: New BORDERLESS_WINDOWED_MODE for PLATFORM_DESKTOP (#3216) by @ubkp
[build] ADDED: New examples to VS2022 solution by @raysan5
[build] REVIEWED: Updated Makefile and Makefile.Web, include new examples
[build] REVIEWED: Fix CMake extraneous -lglfw (#3266) by @iacore
[build] REVIEWED: Add missing cmake options (#3267) by @asdqwe
[build] REVIEWED: Match CMakeOptions.txt options default values (#3258) by @asdqwe
[build] REVIEWED: Add build.zig options for individual modules (#3254) by @actondev
[build] REVIEWED: build.zig to work with cross-compiling (#3225) by @yujiri8
[build] REVIEWED: Makefile build on PLATFORM_ANDROID, soname (#3211) by @ndytts
[build] REVIEWED: src/Makefile, fix misleading indentation (#3202) by @ashn-dot-dev
[build] REVIEWED: build.zig: Support for building with PLAFORM_DRM (#3191) by @jakubvf
[build] REVIEWED: Update CMakeOptions.txt by @raysan5
[build] REVIEWED: fix: cmake option "OPENGL_VERSION" doesn't work (#3170) by @royqh1979
[build] REVIEWED: Add error if raylib.h is included in a C++98 program (#3093) by @Peter0x44
[build] REVIEWED: Cross compilation for PLATFORM_DRM (#3091) by @TheLastBilly
[build] REVIEWED: build.zigm fixed cross-compiling from Linux (#3090)by @yujiri8
[build] REVIEWED: Enhanced cmake part for OpenBSD (#3086) by @rayit
[build] REVIEWED: Fixed compile on OpenBSD (#3085)by @rayit
[build] REVIEWED: CMake project example: fix a couple of typos (#3014) by @benjamin-thomas
[build] REVIEWED: Fix warnings in raylib for MSVC (#3004) by @JeffM2501
[build] REVIEWED: Update cmake example project (#3062) by @lesleyrs
[build] REVIEWED: Update build.zig be be able to build with current zig master (#3064) by @ryupold
[build] REVIEWED: VSCode project template (#3048) by @Shoozza
[build] REVIEWED: Fixed broken build.zig files. Now works with latest stable compiler (… by @Gamer-Kold
[build] REVIEWED: Fix missing symbol when rglfw.c on BSD platforms (#2968) by @Koromix
[build] REVIEWED: Update Makefile comment to indicate arm64 as a supported Linux deskto… @ashn-dot-dev
[build] REVIEWED: Update Makefile : clean raygui.c & physac.c (#3296) by @SuperUserNameMan
[build] REVIEWED: Update webassembly.yml and linux.yml
[build] REVIEWED: Update zig build system to zig version 0.11.0 (#3393) by @purple4pur
[build] REVIEWED: Fix for latest zig master (#3037) by @star-tek-mb
[build] REVIEWED: Examples Makefile to use Makefile.Web when building for web (#3449) by @keithstellyes
[build] REVIEWED: build.zig updates for 0.11.0 release. (#3501) by @cabarger
[build] REVIEWED: Support OpenGL ES 3.0 building on Web platform
[build] REVIEWED: Fix warnings in Visual Studio (#3512) by @JeffM2501
[build] REVIEWED: OpenGL ES 3.0 flags on CMakeOptions (#3514) by @awfulcooking
[bindings] ADDED: fortran-raylib
[bindings] ADDED: raylib-raku to bindings (#3299) by @vushu
[bindings] ADDED: claw-raylib to BINDINGS.md (#3310) by @bohonghuang
[bindings] ADDED: vaiorabbit/raylib-bindings (#3318) by @wilsonsilva
[bindings] ADDED: TurboRaylib (#3317) by @turborium
[bindings] ADDED: raylib-ffi to bindings list (#3164) by @ewpratten
[bindings] ADDED: raylib-pkpy-bindings (#3361) by @blueloveTH
[bindings] ADDED: Raylib.lean to BINDINGS.md (#3409) by @KislyjKisel
[bindings] UPDATED: BINDINGS.md (#3217) by @joseph-montanez
[bindings] UPDATED: BINDINGS.md to include rayjs (#3212) by @mode777
[bindings] UPDATED: latest h-raylib version (#3166) by @Anut-py
[bindings] UPDATED: bindbd-raylib3 to raylib 4.5 (#3157) by @o3o
[bindings] UPDATED: Janet bindings supported version update (#3083)by @archydragon
[bindings] UPDATED: BINDINGS.md (raylib-py -> 4.5) (#2992) by @overdev
[bindings] UPDATED: BINDINGS.md (raylib-lua -> 4.5) (#2989) by @TSnake41
[bindings] UPDATED: raylib-d binding version to 4.5 (#2988) by @schveiguy
[bindings] UPDATED: raylib-freebasic to 4.5 (#2986) by @WIITD
[bindings] UPDATED: BINDINGS.md (#2983) by @jarroddavis68
[bindings] UPDATED: BINDINGS.md for raylib Odin 4.5 (#2981) by @gingerBill
[bindings] UPDATED: BINDINGS.md (#2980) by @GuvaCode
[bindings] UPDATED: BINDINGS.md (#3002) by @fubark
[bindings] UPDATED: BINDINGS.md (#3053) by @JupiterRider
[bindings] UPDATED: BINDINGS.md (#3050) by @Its-Kenta
[bindings] UPDATED: CL bindings version (#3049) by @shelvick
[bindings] UPDATED: BINDINGS.md (#3026) by @ChrisDill
[bindings] UPDATED: BINDINGS.md (#3023) by @sDos280
[bindings] UPDATED: BINDINGS.md (#3017) by @Soutaisei
[bindings] UPDATED: Various versions to 4.5 (#2974) by @RobLoach
[bindings] UPDATED: raylib.zig version to 4.5 (#2971) by @ryupold
[bindings] UPDATED: h-raylib version (#2970) by @Anut-py
[bindings] UPDATED: Factor's raylib binding to v4.5 (#3350) by @WraithGlade
[bindings] UPDATED: raylib-ocaml bindings to 4.5 version (#3322) by @tjammer
[bindings] UPDATED: Jaylib binding (#3508) by @glowiak
[external] UPDATED: sdefl and sinfl DEFLATE compression libraries by @raysan5
[external] UPDATED: miniaudio v0.11.12 --> v0.11.19 by @raysan5
[external] UPDATED: rl_gputex.h compressed images loading library by @raysan5
[external] UPDATED: Replaced stb_image_resize.c by stb_image_resize2.h (#3403) by @BabakSamimi
[external] UPDATED: qoi and qoa libraries
[external] UPDATED: stb libraries (required ones)
[external] UPDATED: cgltf and m3d libraries
[external] REVIEWED: msf_gif.h, some warnings
[external] REVIEWED: sinfl external library to avoid ASAN complaints (#3349) by @raysan5
[misc] ADDED: New task point to issue template about checking the wiki (#3169) by @ubkp
[misc] ADDED: CodeQL for static code analysis (#3476) by @b4yuan
[misc] REVIEWED: Update FAQ.md by @raysan5
[misc] REVIEWED: Potential code issues reported by CodeQL (#3476)
[misc] REVIEWED: Fix a link in the FAQ (#3082)by @jasonliang-dev
[misc] REVIEWED: New file formats to FAQ (#3079) by @Luramoth
[misc] REVIEWED: Make assets loading extension case insensitive #3008 by @raysan5
[misc] REVIEWED: Updated web shells open-graph info by @raysan5
-------------------------------------------------------------------------
Release: raylib 4.5 (18 March 2023)
@@ -445,7 +685,7 @@ Detailed changes:
[raymath] REVIEWED: QuaternionFromAxisAngle() (#1892)
[raymath] REVIEWED: QuaternionToMatrix() returning transposed result. (#1793) by @object71
[shapes] ADDED: RenderPolyLinesEx() (#1758) by @lambertwang
[shapes] ADDED: DrawLineBezierCubic() (#2021) by @SAOMDVN
[shapes] ADDED: DrawSplineBezierCubic() (#2021) by @SAOMDVN
[textures] ADDED: GetImageColor() #2024
[textures] REMOVED: GenImagePerlinNoise()
[textures] RENAMED: GetTextureData() to LoadImageFromTexture()
@@ -583,7 +823,7 @@ Detailed changes:
[rlgl] REDESIGNED: rlLoadExtensions(), more details exposed
[raymath] REVIEWED: QuaternionFromEuler() (#1651)
[raymath] REVIEWED: MatrixRotateZYX() (#1642)
[shapes] ADDED: DrawLineBezierQuad() (#1468) by @epsilon-phase
[shapes] ADDED: DrawSplineBezierQuad() (#1468) by @epsilon-phase
[shapes] ADDED: CheckCollisionLines()
[shapes] ADDED: CheckCollisionPointLine() by @mkupiec1
[shapes] REVIEWED: CheckCollisionPointTriangle() by @mkupiec1
@@ -1665,9 +1905,9 @@ other changes:
[models] Added function DrawCubeTexture()
[models] Added function DrawQuad()
[models] Added function DrawRay()
[models] Simplified funtion DrawPlane()
[models] Simplified function DrawPlane()
[models] Removed function DrawPlaneEx()
[models] Simplified funtion DrawGizmo()
[models] Simplified function DrawGizmo()
[models] Removed function DrawGizmoEx()
[models] Added function LoadModelEx()
[models] Review of function LoadCubicMap()

View File

@@ -37,6 +37,17 @@ include(BuildOptions)
# Main sources directory (the second parameter sets the output directory name to raylib)
add_subdirectory(src raylib)
# Uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_MODULE_PATH}/Uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
if (${BUILD_EXAMPLES})
MESSAGE(STATUS "Building examples is enabled")
add_subdirectory(examples)

View File

@@ -4,7 +4,7 @@ include(EnumOption)
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
# Configuration options
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
@@ -37,15 +37,18 @@ cmake_dependent_option(SUPPORT_MODULE_RAUDIO "Include module: raudio" ON CUSTOMI
# rcore.c
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_RPRAND_GENERATOR "Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_EVENTS_AUTOMATION "Support automatic generated events, loading and recording of those events when required" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_CUSTOM_FRAME_CONTROL "Enabling this flag allows manual control of the frame processes, use at your own risk" OFF CUSTOMIZE_BUILD OFF)
# rshapes.c
cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
@@ -57,22 +60,25 @@ cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editin
cmake_dependent_option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_PNM "Support loading PNM as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_PIC "Support loading PIC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_PNM "Support loading PNM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_SVG "Support loading SVG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
# rtext.c
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FONT_ATLAS_WHITE_REC "Support white rec on font atlas bottom-right corner" ON CUSTOMIZE_BUILD ON)
# rmodels.c
cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
@@ -81,6 +87,7 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format"
cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_M3D "Support loading M3D file format" ON CUSTOMIZE_BUILD ON)
# raudio.c
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
@@ -88,6 +95,7 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" O
cmake_dependent_option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_QOA "Support loading QOA for sound" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF} CUSTOMIZE_BUILD OFF)
# utils.c

7
FAQ.md
View File

@@ -14,12 +14,13 @@
- [What does raylib provide that other engines or libraries don't?](#what-does-raylib-provide-that-other-engines-or-libraries-dont)
- [How does raylib compare to Unity/Unreal/Godot?](#how-does-raylib-compare-to-unityunrealgodot)
- [What development tools are required for raylib?](#what-development-tools-are-required-for-raylib)
- [Which are raylib external dependencies?](#which-are-raylib-external-dependencies)
- [What are raylib's external dependencies?](#what-are-raylibs-external-dependencies)
- [Can I use raylib with other technologies or libraries?](#can-i-use-raylib-with-other-technologies-or-libraries)
- [What file formats are supported by raylib?](#what-file-formats-are-supported-by-raylib)
- [Does raylib support the Vulkan API?](#does-raylib-support-the-vulkan-api)
- [What could I expect to see in raylib in the future?](#what-could-i-expect-to-see-in-raylib-in-the-future)
- [Who are the raylib developers?](#who-are-the-raylib-developers)
- [MORE QUESTIONS...](https://github.com/raysan5/raylib/wiki/Frequently-Asked-Questions)
### What is raylib?
@@ -119,8 +120,8 @@ raylib can load data from multiple standard file formats:
- Image/Textures: PNG, BMP, TGA, JPG, GIF, QOI, PSD, DDS, HDR, KTX, ASTC, PKM, PVR
- Fonts: FNT (sprite font), TTF, OTF
- Models/Meshes: OBJ, IQM, GLTF, VOX
- Audio: WAV, OGG, MP3, FLAC, XM, MOD
- Models/Meshes: OBJ, IQM, GLTF, VOX, M3D
- Audio: WAV, OGG, MP3, FLAC, XM, MOD, QOA
### Does raylib support the Vulkan API?

View File

@@ -5,7 +5,7 @@ introduction
I started developing videogames in 2006 and some years later I started teaching videogames development to young people with artistic profile, most of students had never written a single line of code.
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](http://www.codecutter.net/tools/winbgim/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](https://winbgim.codecutter.org/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
But WinBGI was not the clearer and most organized library for my taste. There were lots of things I found confusing and some function names were not clear enough for most of the students; not to mention the lack of transparencies support and no hardware acceleration.
@@ -140,7 +140,7 @@ notes on raylib 1.7
On May 2017, around 6 month after raylib 1.6, comes another raylib instalment, raylib 1.7. This time library has been improved a lot in terms of consistency and cleanness. As stated in [this patreon article](https://www.patreon.com/posts/raylib-future-7501034), this new raylib version has focused efforts in becoming more simple and easy-to-use to learn videogames programming. Some highlights of this new version are:
- More than 30 new functions added to the library, functions to control Window, utils to work with filenames and extensions, functions to draw lines with custom thick, mesh loading, functions for 3d ray collisions detailed detection, funtions for VR simulation and much more... Just check [CHANGELOG](CHANGELOG) for a detailed list of additions!
- More than 30 new functions added to the library, functions to control Window, utils to work with filenames and extensions, functions to draw lines with custom thick, mesh loading, functions for 3d ray collisions detailed detection, functions for VR simulation and much more... Just check [CHANGELOG](CHANGELOG) for a detailed list of additions!
- Support of [configuration flags](https://github.com/raysan5/raylib/issues/200) on every raylib module. Advance users can customize raylib just choosing desired features, defining some configuration flags on modules compilation. That way users can control library size and available functionality.
@@ -379,13 +379,13 @@ Some numbers to start with:
Highlights for `raylib 4.2`:
- **raylib extra libraries cleanup**: raylib has been on diet and all the _extra_ libraries included on previous releases have been removed from raylib. Now raylib only includes the original **7** raylib modules: `rcore`, `rlgl`, `rshapes`, `rtextures`, `rtext`, `rmodels` and `raudio`. But no worries, _extra_ libraries have not been deleted, they have been moved to their own repos for better maintainability and more focus on its functionality. The libraries moved out from raylib repo are: [`raygui`](https://github.com/raysan5/raygui), [`physac`](https://github.com/raysan5/physac), [`rmem`](https://github.com/raylib-extras/rmem), [`reasings`](https://github.com/raylib-extras/reasings) and [`raudio`](https://github.com/raysan5/raudio) (standalone mode). On that same line, a new **amazing GitHub group:** [`raylib-extras`](https://github.com/raylib-extras) has been created by @JeffM2501 to contain raylib extra libraries as well as other raylib add-ons provided by the community. Jeff has done an amazing work on that line, providing multiple libraries and examples for raylib, like [custom first-person and third person camera systems](https://github.com/raylib-extras/extras-c/tree/main/cameras), [Dear ImGui raylib integration](https://github.com/raylib-extras/rlImGui), [multiple specific examples](https://github.com/raylib-extras/examples-c) and even a complete [RPG Game Example](https://github.com/raylib-extras/RPGExample)! Great work Jeff! :D
- **raylib examples review**: The +120 raylib examples have been reviewed to add clearer information about when the were first created (raylib version used) and when they were updated for the last time. But the greatest improvement for users has been the **addition of an estimated difficulty level** for every example, [web has been updated accordingly](https://www.raylib.com/examples.html) to reflect those difficulty levels. Now examples are classified with **1 to 4 stars** depending on difficulty to help users with their learning process. Personally, I think this "small" addition could be a game-changer to better guide new users on the library adoption! Additionally, this new raylib release includes 7 new examples; the most interesting one: [`text_codepoints_loading`](https://www.raylib.com/examples/text/loader.html?name=text_codepoints_loading) that illustrates how to load and draw custom codepoints from a font file, very useful for Asian languages.
- **raylib examples review**: The +120 raylib examples have been reviewed to add clearer information about when the were first created (raylib version used) and when they were updated for the last time. But the greatest improvement for users has been the **addition of an estimated difficulty level** for every example, [web has been updated accordingly](https://www.raylib.com/examples.html) to reflect those difficulty levels. Now examples are classified with **1 to 4 stars** depending on difficulty to help users with their learning process. Personally, I think this "small" addition could be a game-changer to better guide new users on the library adoption! Additionally, this new raylib release includes 7 new examples; the most interesting one: [`text_codepoints_loading`](https://www.raylib.com/examples/text/loader.html?name=text_codepoints_loading) that illustrates how to load and draw custom codepoints from a font file, very useful for Asian languages.
- [**`rres 1.0`**](https://github.com/raysan5/rres): New `rres` **resources packaging file-format**, including a [`rres-raylib`](https://github.com/raysan5/rres/blob/master/src/rres-raylib.h) library implementation and [`rrespacker`](https://raylibtech.itch.io/rrespacker) tool. `rres` file format has been [under development for +8 years](https://github.com/raysan5/rres#design-history) and it was originally created to be part of raylib. It was highly inspired by _XNA XNB_ resources file format but design has changed a lot along the years. This first release of the format specs is engine-agnostic and has been designed to be portable to any engine, including lots of professional features like data processing, compression and encryption.
- [**`raygui 3.2`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** designed for tools development has been updated to a new version aligned with raylib 4.2. Multiple controls have been reviewed for library consistency, now all controls follow a similar function signature. It has been battle-tested with the development of +8 published tools in the last months. The tools can be seen and used for free in the [raylib technologies tools page](https://raylibtech.itch.io/). Worth mentioning that several of those **tools have been open sourced** for anyone to use, compile, contribute or learn how the code works.
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Multiple contributors **using the tool to automatize bindings creation** have contributed with improvements of this **tool to parse `raylib.h`** (and other raylib-style headers) to tokenize its enums, structs and functions. Processed data can be exported to custom file formats (i.e XML, JSON, LUA) for bindings generation or even docs generation if required.
- **New file system API**: Current API has been redesigned to be more comprehensive and better aligned with raylib naming conventions, two new functions are provided `LoadDirectoryFiles()`/`LoadDirectoryFilesEx()` to load a `FilePathList` for provided path, supporting extension filtering and recursive directory scan. `LoadDroppedFiles()` has been renamed to better reflect its internal functionality. Now, all raylib functions that start with `Load*()` allocate memory internally and a equivalent `Unload*()` function is defined to take care of that memory internally when not required any more!
@@ -414,21 +414,60 @@ Highlights for `raylib 4.5`:
- **`NEW` Improved ANGLE support on Desktop platforms**: Support for OpenGL ES 2.0 on Desktop platforms (Windows, Linux, macOS) has been reviewed by @wtnbgo GitHub user. Now raylib can be compiled on desktop for OpenGL ES 2.0 and linked against [`ANGLE`](https://github.com/google/angle). This _small_ addition open the door to building raylib for all **ANGLE supported backends: Direct3D 11, Vulkan and Metal**. Please note that this new feature is still experimental and requires further testing!
- **`NEW` Camera module**: A brand new implementation from scratch for `rcamera` module, contributed by @Crydsch GitHub user! **New camera system is simpler, more flexible, more granular and more extendable**. Specific camera math transformations (movement/rotation) have been moved to individual functions, exposing them to users if required. Global state has been removed from the module and standalone usage has been greatly improved; now `rcamera.h` single-file header-only library can be used externally, independently of raylib. A new `UpdateCameraPro()` function has been added to address input-dependency of `UpdateCamera()`, now advance users have **full control over camera inputs and movement/rotation speeds**!
- **`NEW` Support for M3D models and M3D/GLTF animations**: 3d models animations support has been a limited aspect of raylib for long time, some versions ago IQM animations were supported but raylib 4.5 also adds support for the brand new [M3D file format](https://bztsrc.gitlab.io/model3d/), including animations and the long expected support for **GLTF animations**! The new M3D file format is **simple, portable, feature complete, extensible and open source**. It also provides a complete set of tools to export/visualize M3D models from/to Blender! Now raylib supports up to **3 model file-formats with animations**: `IQM`, `GLTF` and `M3D`.
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rl_gputex.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
- **Reviewed `rshapes` module to minimize the rlgl dependency**: Now `rshapes` 2d shapes drawing functions **only depend on 6 low-level functions**: `rlBegin()`, `rlEnd()`, `rlVertex3f()`, `rlTexCoord2f()`, `rlNormal3f()`, `rlSetTexture()`. With only those pseudo-OpenGl 1.1 minimal functionality, everything can be drawn! This improvement converts `rshapes` module in a **self-contained, portable shapes-drawing library that can be used independently of raylib**, as far as entry points for those 6 functions are provided by the user. It even allows to be used for software rendering, with the proper backend!
- **Reviewed `rshapes` module to minimize the rlgl dependency**: Now `rshapes` 2d shapes drawing functions **only depend on 6 low-level functions**: `rlBegin()`, `rlEnd()`, `rlVertex3f()`, `rlTexCoord2f()`, `rlNormal3f()`, `rlSetTexture()`. With only those pseudo-OpenGl 1.1 minimal functionality, everything can be drawn! This improvement converts `rshapes` module in a **self-contained, portable shapes-drawing library that can be used independently of raylib**, as far as entry points for those 6 functions are provided by the user. It even allows to be used for software rendering, with the proper backend!
- **Added data structures validation functions**: Multiple functions have been added by @RobLoach GitHub user to ease the validation of raylib data structures: `IsImageReady()`, `IsTextureReady()`, `IsSoundReady()`... Now users have a simple mechanism to **make sure data has been correctly loaded**, instead of checking internal structure values by themselfs.
As usual, those are only some highlights but there is much more! New image generators, new color transformation functionality, improved blending support for color/alpha, etc... Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes! Please, note that all breaking changes have been flagged with a `WARNING` in the CHANGELOG, specially useful for binding creators!
**raylib keeps improving one more version** with a special focus on maintainability and sustainability. Always working towards making the library more **simple and easy-to-use**.
**raylib keeps improving one more version** with a special focus on maintainability and sustainability. Always working towards making the library more **simple and easy-to-use**.
Let's keep **enjoying games/tools/graphics programming!** :)
notes on raylib 5.0
-------------------
It's been **7 months** since latest raylib release and **10 years** since raylib 1.0 was officially released... what an adventure! In the last 10 years raylib has improved a lot, new functions have been added, many new features and improvements implemented, up to **500 contributors** have helped to shape the library as it is today. `raylib 5.0` is the final result of all this incredible amount of work and dedication. Here it is the summary with the key features and additions of this NEW major version of raylib.
Some numbers for this release:
- **+200** closed issues (for a TOTAL of **+1540**!)
- **+550** commits since previous RELEASE (for a TOTAL of **+6950**!)
- **+35** functions ADDED to raylib API (for a TOTAL of **552**!)
- **+60** functions REVIEWED/REDESIGNED
- **+80** new contributors (for a TOTAL of **+500**!)
Highlights for `raylib 5.0`:
- **`rcore` module platform-split**: Probably the biggest raylib redesign in the last 10 years. raylib started as a library targeting 3 desktop platforms: `Windows`, `Linux` and `macOS` (thanks to `GLFW` underlying library) but with the years support for several new platforms has been added (`Android`, `Web`, `Rapsberry Pi`, `RPI native`...); lot of the platform code was shared so the logic was all together on `rcore.c` module, separated by compilation flags. This approach was very handy but also made it very difficult to support new platforms and specially painful for contributors not familiar with the module, navigating +8000 lines of code in a single file. A big redesign was really needed but the amount of work required was humungus and quite scary for a solo-developer like me, moreover considering that everything was working and the chances to break things were really high. Fortunately, some contributors were ready for the task (@ubkp, @michaelfiber, @Bigfoot71) and thanks to their initiative and super-hard work, the `rcore` [platform split](https://github.com/raysan5/raylib/blob/master/src/platforms) has been possible! This new raylib architecture greatly improves the platforms maintenance but also greatly simplifies the addition of new platforms. A [`platforms/rcore_template.c`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_template.c) file is provided with the required structure and functions to be filled for the addition of new platforms, actually it has been simplified to mostly filling some pre-defined functions: `InitPlatform()`, `ClosePlatform`, `PollInputEvents`... Undoubtely, **this redesign opens the doors to a new era for raylib**, letting the users to plug new platforms as desired.
- **`NEW` Platform backend supported: SDL**: Thanks to the new `rcore` platform-split, the addition of new platforms/backends to raylib has been greatly simplified. As a proof of concept, [`SDL2`](https://libsdl.org/) platform backend has been added to raylib as an aternative for `GLFW` library for desktop builds: [`platforms/rcore_desktop_sdl`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_sdl.c). Lot of work has been put to provide exactly the same features as the other platforms and carefully test the new implementation. Now `SDL2` fans can use this new backend, just providing the required include libraries on compilation and linkage (not included in raylib, like `GLFW`). `SDL` backend support also **eases the process of supporting a wider range of platforms** that already support `SDL`.
- **`NEW` Platform backend supported: Nintendo Switch (closed source)**: The addition of the `SDL` backend was quite a challenge but to really verify the robustness and ease of the new platform plugin system, adding support for a console was a more demanding adventure. Surprisingly, only two days of work were required to add support for `Nintendo Switch` to raylib! Implementation result showed an outstanding level of simplicity, with a **self-contained module** (`rcore_swith.cpp`) supporting graphics and inputs. Unfortunately this module can not be open-sourced due to licensing restrictions.
- **`NEW` Splines drawing and evaluation API**: A complete set of functions has been added to [draw](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1258) and [evaluate](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1270) different types of splines: `Linear`, `Basis`, `Catmull-Rom`, `Quadratic Bezier` and `Cubic Bezier`. Splines are extremely useful for game development (describe paths, control NPC movement...) but they can also be very useful on tools development (node-conections, elements-movement, 3d modelling, animations...). This was the missing feature on the raylib [`rshapes`](https://github.com/raysan5/raylib/blob/master/src/rshapes.h) module to make it complete! Note that `rshapes` module can also be used independently of raylib just providing the **only 6 functions required for vertex definition and drawing**.
- **`NEW` Pseudo-random numbers generator: rprand**: After several years of users asking for this missing piece, a brand new pseudo-random generator module has been added to raylib. [`rprand`](https://github.com/raysan5/raylib/blob/master/src/external/rprand.h) implements the `Xoshiro128**` algorithm combined with `SplitMix64`, specially suited for **fast software pseudo-random numbers generation**. The module also implies some useful functions to generate non-repetitive random numbers sequences, functionality exposed by raylib. usage of this module can be controlled by a compilation flag, in case the default libc `rand()` function was preferred.
- **`NEW` Automation Events System API**: This new system was first added in `raylib 4.0` as an experimental feature but it was a bit clumsy and there was no API exposed to users. For the new `raylib 5.0` the system has been redesigned and [proper API](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1135) added for the users. With this new events automation system, users can **record input events for later replay**, very useful feature for testing automation, tutorials generation, assisted game playing, in-game cinematics, speedruns saving or even AI assited game playing!
- **`NEW` [`raygui 4.0`](https://github.com/raysan5/raygui)**: The **official raylib immediate-mode gui library** designed for tools development has been updated to a new version, aligned with raylib 5.0. This new version is a complete redesign of raygui to unify all controls structure and usage, now all controls have the same function signature!. `raygui` has been battle-tested with the development of +12 published tools in the last few years. The tools can be seen and used for free in the [raylib technologies tools page](https://raylibtech.itch.io/). Worth mentioning that several of those **tools have been open sourced** for anyone to use, compile, contribute or learn how the code works.
- **`NEW` raylib web examples functionality**: Beside the addition of several new examples, the web examples functionality has been improved. Examples have been organized by [complexity level](https://www.raylib.com/examples.html), marked with one star for simple examples and up to 4 stars for more complex ones. A new option has been added to web to allow to **filter examples by function-name** usage, to ease the learning process when looking for an usage example of some function. Finally, **open-graph metadata** information has been added to all examples individual webpages, improving a the visuals and information when sharing those webpages on social networks, sharing the example screenshot and details.
As always, those are only some highlights of the new `raylib 5.0` but there is many more improvements! Support for 16-bit HDR images/textures, SVG loading and scaling support, new OpenGL ES 3.0 graphic backend, new image gradient generators, sound alias loading, improved 3d models loading, multiple optimizations, new bindings, CodeQL integration and much more!
Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes!
Undoubtely, this is the **biggest raylib update in 10 years**. Many new features and improvements with a special focus on maintainabiliy and long-term sustainability. **Undoubtely, this is the raylib of the future**.
**Enjoy programming!** :)

View File

@@ -1,8 +1,8 @@
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
@@ -14,7 +14,7 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
[![GitHub Releases Downloads](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases)
[![GitHub Stars](https://img.shields.io/github/stars/raysan5/raylib?style=flat&label=stars)](https://github.com/raysan5/raylib/stargazers)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.2.0)](https://github.com/raysan5/raylib/commits/master)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.5.0)](https://github.com/raysan5/raylib/commits/master)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/raysan5?label=sponsors)](https://github.com/sponsors/raysan5)
[![Packaging Status](https://repology.org/badge/tiny-repos/raylib.svg)](https://repology.org/project/raylib/versions)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
@@ -27,7 +27,6 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
[![Windows](https://github.com/raysan5/raylib/workflows/Windows/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows)
[![Linux](https://github.com/raysan5/raylib/workflows/Linux/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
[![macOS](https://github.com/raysan5/raylib/workflows/macOS/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS)
[![Android](https://github.com/raysan5/raylib/workflows/Android/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AAndroid)
[![WebAssembly](https://github.com/raysan5/raylib/workflows/WebAssembly/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
[![CMakeBuilds](https://github.com/raysan5/raylib/workflows/CMakeBuilds/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
@@ -39,24 +38,24 @@ features
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
- Written in plain C code (C99) using PascalCase/camelCase notation
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**)
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
- Multiple **Fonts** formats supported (TTF, OTF, Image fonts, AngelCode fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps**
- **Animated 3D models** supported (skeletal bones animation) (IQM)
- Shaders support, including model and **postprocessing** shaders.
- **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF)
- Shaders support, including model shaders and **postprocessing** shaders
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
- Audio loading and playing with streaming support (WAV, QOA, OGG, MP3, FLAC, XM, MOD)
- **VR stereo rendering** support with configurable HMD device parameters
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- Bindings to [+60 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**.
- Huge examples collection with [+140 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**
basic example
--------------
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
```c
#include "raylib.h"
@@ -114,7 +113,7 @@ learning and docs
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here are the relevant links:
Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links:
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
@@ -136,9 +135,16 @@ raylib is present in several networks and raylib community is growing everyday.
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
contributors
------------
<a href="https://github.com/raysan5/raylib/graphs/contributors">
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=500&columns=20&anon=1" />
</a>
license
-------
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on raylib Wiki for details.
raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for details.

View File

@@ -11,16 +11,25 @@ Here it is a wishlist with features and ideas to improve the library. Note that
_Current version of raylib is complete and functional but there is always room for improvements._
**raylib 5.x**
- [ ] `rcore`: Support additional platforms: iOS, Xbox Series S|X
- [ ] `rcore_web`: Avoid GLFW dependency, functionality can be directly implemented using emscripten SDK
- [ ] `rlgl`: Review GLSL shaders naming conventions for consistency
- [ ] `textures`: Improve compressed textures support, loading and saving
- [ ] `rmodels`: Improve 3d objects loading, specially animations (obj, gltf)
- [ ] `raudio`: Implement miniaudio high-level provided features
- [ ] `examples`: Review all examples, add more and better code explanations
- [ ] Software renderer backend? Maybe using `Image` provided API
**raylib 4.x**
- [ ] Split core module into separate platforms?
- [ ] Basic 2d software renderer, using `Image` provided API
- [ ] Redesign gestures system, improve touch inputs management
- [ ] Redesign audio module, implement miniaudio high-level provided features
- [x] Split core module into separate platforms?
- [x] Redesign gestures system, improve touch inputs management
- [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
- [x] Better documentation and improved examples, reviewed webpage with examples complexity level
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
**raylib 4.0**
- [x] Improved consistency and coherency in raylib API
- [x] Continuous Deployment using GitHub Actions

View File

@@ -1,18 +1,7 @@
const std = @import("std");
const raylib = @import("src/build.zig");
// This has been tested to work with zig 0.11.0
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const lib = raylib.addRaylib(b, target, optimize);
lib.installHeader("src/raylib.h", "raylib.h");
lib.install();
}
raylib.build(b);
}

View File

@@ -28,6 +28,8 @@ if (${CUSTOMIZE_BUILD})
define_if("raylib" SUPPORT_EVENTS_WAITING)
define_if("raylib" SUPPORT_WINMM_HIGHRES_TIMER)
define_if("raylib" SUPPORT_COMPRESSION_API)
define_if("raylib" SUPPORT_EVENTS_AUTOMATION)
define_if("raylib" SUPPORT_CUSTOM_FRAME_CONTROL)
define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
define_if("raylib" SUPPORT_IMAGE_EXPORT)
define_if("raylib" SUPPORT_IMAGE_GENERATION)
@@ -35,6 +37,7 @@ if (${CUSTOMIZE_BUILD})
define_if("raylib" SUPPORT_FILEFORMAT_PNG)
define_if("raylib" SUPPORT_FILEFORMAT_DDS)
define_if("raylib" SUPPORT_FILEFORMAT_HDR)
define_if("raylib" SUPPORT_FILEFORMAT_PIC)
define_if("raylib" SUPPORT_FILEFORMAT_PNM)
define_if("raylib" SUPPORT_FILEFORMAT_KTX)
define_if("raylib" SUPPORT_FILEFORMAT_ASTC)
@@ -46,6 +49,7 @@ if (${CUSTOMIZE_BUILD})
define_if("raylib" SUPPORT_FILEFORMAT_PSD)
define_if("raylib" SUPPORT_FILEFORMAT_PKM)
define_if("raylib" SUPPORT_FILEFORMAT_PVR)
define_if("raylib" SUPPORT_FILEFORMAT_SVG)
define_if("raylib" SUPPORT_FILEFORMAT_FNT)
define_if("raylib" SUPPORT_FILEFORMAT_TTF)
define_if("raylib" SUPPORT_TEXT_MANIPULATION)
@@ -55,11 +59,13 @@ if (${CUSTOMIZE_BUILD})
define_if("raylib" SUPPORT_FILEFORMAT_IQM)
define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
define_if("raylib" SUPPORT_FILEFORMAT_VOX)
define_if("raylib" SUPPORT_FILEFORMAT_M3D)
define_if("raylib" SUPPORT_FILEFORMAT_WAV)
define_if("raylib" SUPPORT_FILEFORMAT_OGG)
define_if("raylib" SUPPORT_FILEFORMAT_XM)
define_if("raylib" SUPPORT_FILEFORMAT_MOD)
define_if("raylib" SUPPORT_FILEFORMAT_MP3)
define_if("raylib" SUPPORT_FILEFORMAT_QOA)
define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
define_if("raylib" SUPPORT_STANDARD_FILEIO)
define_if("raylib" SUPPORT_TRACELOG)
@@ -69,17 +75,17 @@ if (${CUSTOMIZE_BUILD})
else ()
target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
endif ()
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"")
target_compile_definitions("raylib" PUBLIC "MAX_CHAR_PRESSED_QUEUE=16")
target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64")
if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11")
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")

View File

@@ -9,8 +9,7 @@ install(
# PKG_CONFIG_LIBS_PRIVATE is used in raylib.pc.in
if (NOT BUILD_SHARED_LIBS)
include(LibraryPathToLinkerFlags)
library_path_to_linker_flags(__PKG_CONFIG_LIBS_PRIVATE "${LIBS_PRIVATE}")
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
set(PKG_CONFIG_LIBS_PRIVATE ${GLFW_PKG_LIBS})
string(REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
elseif (BUILD_SHARED_LIBS)
set(PKG_CONFIG_LIBS_EXTRA "")

View File

@@ -25,7 +25,7 @@ if (${PLATFORM} MATCHES "Desktop")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
find_package(OpenGL QUIET)
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
else ()
elseif (UNIX)
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
@@ -36,9 +36,22 @@ if (${PLATFORM} MATCHES "Desktop")
find_library(OSS_LIBRARY ossaudio)
endif ()
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
else ()
find_library(pthread NAMES pthread)
find_package(OpenGL QUIET)
if ("${OPENGL_LIBRARIES}" STREQUAL "")
set(OPENGL_LIBRARIES "GL")
endif ()
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
if (USE_AUDIO)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
find_library(OSS_LIBRARY ossaudio)
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
endif ()
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
set(LIBS_PRIVATE ${LIBS_PRIVATE} dl)
endif ()
endif ()
@@ -60,19 +73,6 @@ elseif (${PLATFORM} MATCHES "Android")
find_library(OPENGL_LIBRARY OpenGL)
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
elseif (${PLATFORM} MATCHES "Raspberry Pi")
set(PLATFORM_CPP "PLATFORM_RPI")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
add_definitions(-D_DEFAULT_SOURCE)
find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
find_library(EGL brcmEGL HINTS /opt/vc/lib)
find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
link_directories(/opt/vc/lib)
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
elseif ("${PLATFORM}" MATCHES "DRM")
set(PLATFORM_CPP "PLATFORM_DRM")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
@@ -93,7 +93,7 @@ elseif ("${PLATFORM}" MATCHES "DRM")
endif ()
if (NOT ${OPENGL_VERSION})
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
if (${OPENGL_VERSION} MATCHES "4.3")
set(GRAPHICS "GRAPHICS_API_OPENGL_43")
@@ -105,6 +105,8 @@ if (NOT ${OPENGL_VERSION})
set(GRAPHICS "GRAPHICS_API_OPENGL_11")
elseif (${OPENGL_VERSION} MATCHES "ES 2.0")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
endif ()
if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")

21
cmake/Uninstall.cmake Normal file
View File

@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()

View File

@@ -1,6 +1,25 @@
#**************************************************************************************************
#
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# raylib makefile for multiple platforms
#
# This file supports building raylib examples for the following platforms:
#
# > PLATFORM_DESKTOP (GLFW backend):
# - Windows (Win32, Win64)
# - Linux (X11/Wayland desktop mode)
# - macOS/OSX (x64, arm64)
# - FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop)
# > PLATFORM_DESKTOP_SDL (SDL backend):
# - Windows (Win32, Win64)
# - Linux (X11/Wayland desktop mode)
# - Others (not tested)
# > PLATFORM_WEB:
# - HTML5 (WebAssembly)
# > PLATFORM_DRM:
# - Raspberry Pi 0-5 (DRM/KMS)
# - Linux DRM subsystem (KMS mode)
# > PLATFORM_ANDROID:
# - Android (ARM, ARM64)
#
# Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
#
@@ -25,14 +44,17 @@
# Define required environment variables
#------------------------------------------------------------------------------------------------
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
PLATFORM ?= PLATFORM_DESKTOP
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 4.5.0
RAYLIB_VERSION ?= 5.0.0
RAYLIB_PATH ?= ..
# Define raylib source code path
RAYLIB_SRC_PATH ?= ../src
# Locations of raylib.h and libraylib.a/libraylib.so
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
RAYLIB_INCLUDE_PATH ?= /usr/local/include
@@ -47,6 +69,11 @@ BUILD_MODE ?= RELEASE
# Use external GLFW library instead of rglfw module
USE_EXTERNAL_GLFW ?= FALSE
# PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally
# WARNING: Library is not included in raylib, it MUST be configured by users
SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2-2.28.4/include
SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2-2.28.4/lib/x64
# Use Wayland display server protocol on Linux desktop (by default it uses X11 windowing system)
# NOTE: This variable is only used for PLATFORM_OS: LINUX
USE_WAYLAND_DISPLAY ?= FALSE
@@ -58,17 +85,8 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
BUILD_WEB_RESOURCES ?= TRUE
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
# Use cross-compiler for PLATFORM_RPI
ifeq ($(PLATFORM),PLATFORM_RPI)
USE_RPI_CROSS_COMPILER ?= FALSE
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
endif
endif
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
# Determine PLATFORM_OS when required
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
@@ -95,12 +113,6 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS = LINUX
endif
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux)
@@ -118,9 +130,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif
# Default path for raylib on Raspberry Pi
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_PATH ?= /home/pi/raylib
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
RAYLIB_PATH ?= /home/pi/raylib
endif
@@ -154,13 +163,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CC = clang
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# Define RPI cross-compiler
#CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned
@@ -181,7 +183,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
MAKE = mingw32-make
MAKE = emmake make
endif
# Define compiler flags: CFLAGS
@@ -231,9 +233,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS += -std=gnu99
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
CFLAGS += -std=gnu99 -DEGL_NO_X11
endif
@@ -252,15 +251,19 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH)
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
INCLUDE_PATHS += -I/usr/include/libdrm
endif
# Include GLFW required for examples/others/rlgl_standalone.c
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
all others: INCLUDE_PATHS += -I$(RAYLIB_PATH)/src/external/glfw/include
endif
# Define library paths containing required libs: LDFLAGS
#------------------------------------------------------------------------------------------------
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
@@ -281,6 +284,17 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
endif
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: The resource .rc file contains windows executable icon and properties
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
# -Wl,--subsystem,windows hides the console window
ifeq ($(BUILD_MODE), RELEASE)
LDFLAGS += -Wl,--subsystem,windows
endif
endif
LDFLAGS += -L$(SDL_LIBRARY_PATH)
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
@@ -323,9 +337,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
endif
# Define libraries required on linking: LDLIBS
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
@@ -376,12 +387,32 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDLIBS += -lglfw
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling
# NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
LDLIBS += -lvchiq_arm -lvcos
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation
LDLIBS = -lraylib -lSDL2 -lSDL2main -lopengl32 -lgdi32
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libegl1-mesa-dev
LDLIBS = -lraylib -lSDL2 -lSDL2main -lGL -lm -lpthread -ldl -lrt
# On X11 requires also below libraries
LDLIBS += -lX11
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
# On Wayland windowing system, additional libraries requires
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
endif
# Explicit link to libc
ifeq ($(RAYLIB_LIBTYPE),SHARED)
LDLIBS += -lc
endif
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
LDLIBS += -latomic
endif
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
@@ -397,92 +428,99 @@ endif
# Define source code object files required
#------------------------------------------------------------------------------------------------
CORE = \
core/core_basic_window \
core/core_2d_camera \
core/core_2d_camera_mouse_zoom \
core/core_2d_camera_platformer \
core/core_2d_camera_split_screen \
core/core_3d_camera_first_person \
core/core_3d_camera_free \
core/core_3d_camera_mode \
core/core_3d_camera_split_screen \
core/core_3d_picking \
core/core_automation_events \
core/core_basic_screen_manager \
core/core_basic_window \
core/core_custom_frame_control \
core/core_custom_logging \
core/core_drop_files \
core/core_input_gamepad \
core/core_input_gamepad_info \
core/core_input_gestures \
core/core_input_gestures_web \
core/core_input_keys \
core/core_input_mouse \
core/core_input_mouse_wheel \
core/core_input_gamepad \
core/core_input_multitouch \
core/core_input_gestures \
core/core_2d_camera \
core/core_2d_camera_platformer \
core/core_2d_camera_mouse_zoom \
core/core_3d_camera_mode \
core/core_3d_camera_free \
core/core_3d_camera_first_person \
core/core_3d_picking \
core/core_world_screen \
core/core_custom_logging \
core/core_drop_files \
core/core_loading_thread \
core/core_random_values \
core/core_scissor_test \
core/core_smooth_pixelperfect \
core/core_storage_values \
core/core_vr_simulator \
core/core_loading_thread \
core/core_window_flags \
core/core_window_letterbox \
core/core_window_should_close \
core/core_split_screen \
core/core_smooth_pixelperfect \
core/core_custom_frame_control
core/core_world_screen
SHAPES = \
shapes/shapes_basic_shapes \
shapes/shapes_bouncing_ball \
shapes/shapes_colors_palette \
shapes/shapes_logo_raylib \
shapes/shapes_logo_raylib_anim \
shapes/shapes_rectangle_scaling \
shapes/shapes_lines_bezier \
shapes/shapes_collision_area \
shapes/shapes_following_eyes \
shapes/shapes_colors_palette \
shapes/shapes_draw_circle_sector \
shapes/shapes_draw_rectangle_rounded \
shapes/shapes_draw_ring \
shapes/shapes_easings_ball_anim \
shapes/shapes_easings_box_anim \
shapes/shapes_easings_rectangle_array \
shapes/shapes_draw_ring \
shapes/shapes_draw_circle_sector \
shapes/shapes_draw_rectangle_rounded \
shapes/shapes_following_eyes \
shapes/shapes_lines_bezier \
shapes/shapes_logo_raylib \
shapes/shapes_logo_raylib_anim \
shapes/shapes_rectangle_scaling \
shapes/shapes_splines_drawing \
shapes/shapes_top_down_lights
TEXTURES = \
textures/textures_logo_raylib \
textures/textures_mouse_painting \
textures/textures_srcrec_dstrec \
textures/textures_background_scrolling \
textures/textures_blend_modes \
textures/textures_bunnymark \
textures/textures_draw_tiled \
textures/textures_fog_of_war \
textures/textures_gif_player \
textures/textures_image_drawing \
textures/textures_image_generation \
textures/textures_image_loading \
textures/textures_image_processing \
textures/textures_image_rotate \
textures/textures_image_text \
textures/textures_to_image \
textures/textures_raw_data \
textures/textures_particles_blending \
textures/textures_logo_raylib \
textures/textures_mouse_painting \
textures/textures_npatch_drawing \
textures/textures_background_scrolling \
textures/textures_particles_blending \
textures/textures_polygon \
textures/textures_raw_data \
textures/textures_sprite_anim \
textures/textures_sprite_button \
textures/textures_sprite_explosion \
textures/textures_srcrec_dstrec \
textures/textures_svg_loading \
textures/textures_textured_curve \
textures/textures_bunnymark \
textures/textures_blend_modes \
textures/textures_draw_tiled \
textures/textures_polygon \
textures/textures_gif_player \
textures/textures_fog_of_war
textures/textures_to_image
TEXT = \
text/text_raylib_fonts \
text/text_font_spritefont \
text/text_font_loading \
text/text_codepoints_loading \
text/text_draw_3d \
text/text_font_filters \
text/text_font_loading \
text/text_font_sdf \
text/text_font_spritefont \
text/text_format_text \
text/text_input_box \
text/text_writing_anim \
text/text_raylib_fonts \
text/text_rectangle_bounds \
text/text_unicode \
text/text_draw_3d \
text/text_codepoints_loading
text/text_writing_anim
MODELS = \
models/models_animation \
@@ -492,55 +530,67 @@ MODELS = \
models/models_draw_cube_texture \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_mesh_generation \
models/models_mesh_picking \
models/models_heightmap \
models/models_loading \
models/models_loading_vox \
models/models_loading_gltf \
models/models_loading_m3d \
models/models_loading_vox \
models/models_mesh_generation \
models/models_mesh_picking \
models/models_orthographic_projection \
models/models_rlgl_solar_system \
models/models_skybox \
models/models_yaw_pitch_roll \
models/models_heightmap \
models/models_waving_cubes
models/models_waving_cubes \
models/models_yaw_pitch_roll
SHADERS = \
shaders/shaders_model_shader \
shaders/shaders_shapes_textures \
shaders/shaders_custom_uniform \
shaders/shaders_postprocessing \
shaders/shaders_palette_switch \
shaders/shaders_raymarching \
shaders/shaders_texture_drawing \
shaders/shaders_texture_waves \
shaders/shaders_texture_outline \
shaders/shaders_julia_set \
shaders/shaders_eratosthenes \
shaders/shaders_basic_lighting \
shaders/shaders_custom_uniform \
shaders/shaders_deferred_render \
shaders/shaders_eratosthenes \
shaders/shaders_fog \
shaders/shaders_hot_reloading \
shaders/shaders_hybrid_render \
shaders/shaders_julia_set \
shaders/shaders_lightmap \
shaders/shaders_mesh_instancing \
shaders/shaders_model_shader \
shaders/shaders_multi_sample2d \
shaders/shaders_palette_switch \
shaders/shaders_postprocessing \
shaders/shaders_raymarching \
shaders/shaders_shapes_textures \
shaders/shaders_simple_mask \
shaders/shaders_spotlight \
shaders/shaders_hot_reloading \
shaders/shaders_mesh_instancing \
shaders/shaders_multi_sample2d \
shaders/shaders_write_depth \
shaders/shaders_hybrid_render
shaders/shaders_texture_drawing \
shaders/shaders_texture_outline \
shaders/shaders_texture_tiling \
shaders/shaders_texture_waves \
shaders/shaders_write_depth
AUDIO = \
audio/audio_mixed_processor \
audio/audio_module_playing \
audio/audio_music_stream \
audio/audio_raw_stream \
audio/audio_sound_loading \
audio/audio_stream_effects \
audio/audio_mixed_processor
audio/audio_sound_multi \
audio/audio_stream_effects
OTHERS = \
others/easings_testbed \
others/embedded_files_loading \
others/raylib_opengl_interop \
others/raymath_vector_angle \
others/rlgl_compute_shader \
others/rlgl_standalone
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
# Define processes to execute
#------------------------------------------------------------------------------------------------
# Default target entry
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO)
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(OTHERS)
core: $(CORE)
shapes: $(SHAPES)
@@ -549,12 +599,15 @@ text: $(TEXT)
models: $(MODELS)
shaders: $(SHADERS)
audio: $(AUDIO)
others: $(OTHERS)
# Generic compilation pattern
# NOTE: Examples must be ready for Android compilation!
%: %.c
ifeq ($(PLATFORM),PLATFORM_ANDROID)
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
else ifeq ($(PLATFORM),PLATFORM_WEB)
$(MAKE) -f Makefile.Web $@
else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
endif
@@ -574,10 +627,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete
rm -fv *.o
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete
rm -fv *.o

File diff suppressed because it is too large Load Diff

View File

@@ -34,26 +34,27 @@ Examples using raylib core platform functionality like window creation, inputs,
| 08 | [core_2d_camera](core/core_2d_camera.c) | <img src="core/core_2d_camera.png" alt="core_2d_camera" width="80"> | ⭐️⭐️☆☆ | 1.5 | 3.0 | [Ray](https://github.com/raysan5) |
| 09 | [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | <img src="core/core_2d_camera_mouse_zoom.png" alt="core_2d_camera_mouse_zoom" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Jeffery Myers](https://github.com/JeffM2501) |
| 10 | [core_2d_camera_platformer](core/core_2d_camera_platformer.c) | <img src="core/core_2d_camera_platformer.png" alt="core_2d_camera_platformer" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [avyy](https://github.com/avyy) |
| 11 | [core_3d_camera_mode](core/core_3d_camera_mode.c) | <img src="core/core_3d_camera_mode.png" alt="core_3d_camera_mode" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 12 | [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐️☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 13 | [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 14 | [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 15 | [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.4 | [Ray](https://github.com/raysan5) |
| 16 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
| 17 | [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐️⭐️⭐️☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 18 | [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐️⭐️☆ | 2.5 | **4.0** | [Anata](https://github.com/anatagawa) |
| 19 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| 20 | [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 21 | [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐️☆☆☆ | 1.1 | 1.1 | [Ray](https://github.com/raysan5) |
| 22 | [core_storage_values](core/core_storage_values.c) | <img src="core/core_storage_values.png" alt="core_storage_values" width="80"> | ⭐️⭐️☆☆ | 1.4 | **4.2** | [Ray](https://github.com/raysan5) |
| 23 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
| 24 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Ray](https://github.com/raysan5) |
| 25 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="80"> | ⭐️☆☆☆ | 2.5 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
| 26 | [core_basic_screen_manager](core/core_basic_screen_manager.c) | <img src="core/core_basic_screen_manager.png" alt="core_basic_screen_manager" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
| 27 | [core_custom_frame_control](core/core_custom_frame_control.c) | <img src="core/core_custom_frame_control.png" alt="core_custom_frame_control" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
| 28 | [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐️⭐️⭐️☆ | 3.7 | **4.0** | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
| 29 | [core_split_screen](core/core_split_screen.c) | <img src="core/core_split_screen.png" alt="core_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.0** | [Jeffery Myers](https://github.com/JeffM2501) |
| 30 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️⭐️☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| 11 | [core_2d_camera_split_screen](core/core_2d_camera_split_screen.c) | <img src="core/core_2d_camera_split_screen.png" alt="core_2d_camera_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | **4.5** | **4.5** | [Gabriel dos Santos Sanches](https://github.com/gabrielssanches) |
| 12 | [core_3d_camera_mode](core/core_3d_camera_mode.c) | <img src="core/core_3d_camera_mode.png" alt="core_3d_camera_mode" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 13 | [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 14 | [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 15 | [core_3d_camera:split_screen](core/core_3d_camera_split_screen.c) | <img src="core/core_3d_camera_split_screen.png" alt="core_3d_camera_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.0** | [Jeffery Myers](https://github.com/JeffM2501) |
| 16 | [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 17 | [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐️⭐️☆ | 1.3 | 1.4 | [Ray](https://github.com/raysan5) |
| 18 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
| 19 | [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐️⭐️⭐️☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 20 | [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐️⭐️☆☆ | 2.5 | **4.0** | [Anata](https://github.com/anatagawa) |
| 21 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| 22 | [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 23 | [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐️☆☆☆ | 1.1 | 1.1 | [Ray](https://github.com/raysan5) |
| 24 | [core_storage_values](core/core_storage_values.c) | <img src="core/core_storage_values.png" alt="core_storage_values" width="80"> | ⭐️⭐️☆ | 1.4 | **4.2** | [Ray](https://github.com/raysan5) |
| 25 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
| 26 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Ray](https://github.com/raysan5) |
| 27 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="80"> | ⭐️☆☆☆ | 2.5 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
| 28 | [core_basic_screen_manager](core/core_basic_screen_manager.c) | <img src="core/core_basic_screen_manager.png" alt="core_basic_screen_manager" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
| 29 | [core_custom_frame_control](core/core_custom_frame_control.c) | <img src="core/core_custom_frame_control.png" alt="core_custom_frame_control" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
| 30 | [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐️⭐️⭐️☆ | 3.7 | **4.0** | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
| 31 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
### category: shapes
@@ -175,6 +176,7 @@ Examples using raylib shaders functionality, including shaders loading, paramete
| 114 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
| 115 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 116 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
| 117 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
### category: audio
@@ -182,10 +184,10 @@ Examples using raylib audio functionality, including sound/music loading and pla
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 117 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 118 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 119 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 120 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
| 118 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 119 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 120 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 121 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
### category: others

View File

@@ -79,6 +79,7 @@ int main(void)
{
StopMusicStream(music);
PlayMusicStream(music);
pause = false;
}
// Pause/Resume music playing
@@ -134,6 +135,14 @@ int main(void)
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
// Draw help instructions
DrawRectangle(20, 20, 425, 145, WHITE);
DrawRectangleLines(20, 20, 425, 145, GRAY);
DrawText("PRESS SPACE TO RESTART MUSIC", 40, 40, 20, BLACK);
DrawText("PRESS P TO PAUSE/RESUME", 40, 70, 20, BLACK);
DrawText("PRESS UP/DOWN TO CHANGE SPEED", 40, 100, 20, BLACK);
DrawText(TextFormat("SPEED: %f", pitch), 40, 130, 20, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -148,4 +157,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -0,0 +1,87 @@
/*******************************************************************************************
*
* raylib [audio] example - Playing sound multiple times
*
* Example originally created with raylib 4.6
*
* 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) 2023 Jeffery Myers (@JeffM2501)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_SOUNDS 10
Sound soundArray[MAX_SOUNDS] = { 0 };
int currentSound;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - playing sound multiple times");
InitAudioDevice(); // Initialize audio device
// load the sound list
soundArray[0] = LoadSound("resources/sound.wav"); // Load WAV audio file into the first slot as the 'source' sound
// this sound owns the sample data
for (int i = 1; i < MAX_SOUNDS; i++)
{
soundArray[i] = LoadSoundAlias(soundArray[0]); // Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played
}
currentSound = 0; // set the sound list to the start
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE))
{
PlaySound(soundArray[currentSound]); // play the next open sound slot
currentSound++; // increment the sound slot
if (currentSound >= MAX_SOUNDS) // if the sound slot is out of bounds, go back to 0
currentSound = 0;
// Note: a better way would be to look at the list for the first sound that is not playing and use that slot
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Press SPACE to PLAY a WAV sound!", 200, 180, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
for (int i = 1; i < MAX_SOUNDS; i++)
UnloadSoundAlias(soundArray[i]); // Unload sound aliases
UnloadSound(soundArray[0]); // Unload source sound data
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,6 +1,7 @@
const std = @import("std");
const builtin = @import("builtin");
// This has been tested to work with zig 0.11.0 (67709b6, Aug 4 2023)
fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step {
if (target.getOsTag() == .emscripten) {
@panic("Emscripten building via Zig unsupported");
@@ -10,7 +11,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT
const dir = try std.fs.cwd().openIterableDir(module, .{});
var iter = dir.iterate();
while (try iter.next()) |entry| {
if (entry.kind != .File) continue;
if (entry.kind != .file) continue;
const extension_idx = std.mem.lastIndexOf(u8, entry.name, ".c") orelse continue;
const name = entry.name[0..extension_idx];
const path = try std.fs.path.join(b.allocator, &.{ module, entry.name });
@@ -23,26 +24,26 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT
.target = target,
.optimize = optimize,
});
exe.addCSourceFile(path, &[_][]const u8{});
exe.addCSourceFile(.{ .file = .{ .path = path }, .flags = &.{} });
exe.linkLibC();
exe.addObjectFile(switch (target.getOsTag()) {
.windows => "../src/raylib.lib",
.linux => "../src/libraylib.a",
.macos => "../src/libraylib.a",
.emscripten => "../src/libraylib.a",
.windows => .{ .path = "../zig-out/lib/raylib.lib" },
.linux => .{ .path = "../zig-out/lib/libraylib.a" },
.macos => .{ .path = "../zig-out/lib/libraylib.a" },
.emscripten => .{ .path = "../zig-out/lib/libraylib.a" },
else => @panic("Unsupported OS"),
});
exe.addIncludePath("../src");
exe.addIncludePath("../src/external");
exe.addIncludePath("../src/external/glfw/include");
exe.addIncludePath(.{ .path = "../src" });
exe.addIncludePath(.{ .path = "../src/external" });
exe.addIncludePath(.{ .path = "../src/external/glfw/include" });
switch (target.getOsTag()) {
.windows => {
exe.linkSystemLibrary("winmm");
exe.linkSystemLibrary("gdi32");
exe.linkSystemLibrary("opengl32");
exe.addIncludePath("external/glfw/deps/mingw");
exe.addIncludePath(.{ .path = "external/glfw/deps/mingw" });
exe.defineCMacro("PLATFORM_DESKTOP", null);
},
@@ -70,13 +71,15 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT
},
}
exe.setOutputDir(module);
const install_cmd = b.addInstallArtifact(exe, .{});
var run = exe.run();
run.step.dependOn(&b.addInstallArtifact(exe).step);
run.cwd = module;
b.step(name, name).dependOn(&run.step);
all.dependOn(&exe.step);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(&install_cmd.step);
const run_step = b.step(name, name);
run_step.dependOn(&run_cmd.step);
all.dependOn(&install_cmd.step);
}
return all;
}

View File

@@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [core] example - 2d camera
* raylib [core] example - 2D Camera system
*
* Example originally created with raylib 1.5, last time updated with raylib 3.0
*

View File

@@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [core] example - 2d camera platformer
* raylib [core] example - 2D Camera platformer
*
* Example originally created with raylib 2.5, last time updated with raylib 3.0
*
@@ -90,7 +90,7 @@ int main(void)
"Follow player center",
"Follow player center, but clamp to map edges",
"Follow player center; smoothed",
"Follow player center horizontally; updateplayer center vertically after landing",
"Follow player center horizontally; update player center vertically after landing",
"Player push camera on getting too close to screen edge"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,167 @@
/*******************************************************************************************
*
* raylib [core] example - 2d camera split screen
*
* Addapted from the core_3d_camera_split_screen example:
* https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_split_screen.c
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by Gabriel dos Santos Sanches (@gabrielssanches) and reviewed by Ramon Santamaria (@raysan5)
*
* 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) 2023 Gabriel dos Santos Sanches (@gabrielssanches)
*
********************************************************************************************/
#include "raylib.h"
#define PLAYER_SIZE 40
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 440;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera split screen");
Rectangle player1 = { 200, 200, PLAYER_SIZE, PLAYER_SIZE };
Rectangle player2 = { 250, 200, PLAYER_SIZE, PLAYER_SIZE };
Camera2D camera1 = { 0 };
camera1.target = (Vector2){ player1.x, player1.y };
camera1.offset = (Vector2){ 200.0f, 200.0f };
camera1.rotation = 0.0f;
camera1.zoom = 1.0f;
Camera2D camera2 = { 0 };
camera2.target = (Vector2){ player2.x, player2.y };
camera2.offset = (Vector2){ 200.0f, 200.0f };
camera2.rotation = 0.0f;
camera2.zoom = 1.0f;
RenderTexture screenCamera1 = LoadRenderTexture(screenWidth/2, screenHeight);
RenderTexture screenCamera2 = LoadRenderTexture(screenWidth/2, screenHeight);
// Build a flipped rectangle the size of the split view to use for drawing later
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenCamera1.texture.width, (float)-screenCamera1.texture.height };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_S)) player1.y += 3.0f;
else if (IsKeyDown(KEY_W)) player1.y -= 3.0f;
if (IsKeyDown(KEY_D)) player1.x += 3.0f;
else if (IsKeyDown(KEY_A)) player1.x -= 3.0f;
if (IsKeyDown(KEY_UP)) player2.y -= 3.0f;
else if (IsKeyDown(KEY_DOWN)) player2.y += 3.0f;
if (IsKeyDown(KEY_RIGHT)) player2.x += 3.0f;
else if (IsKeyDown(KEY_LEFT)) player2.x -= 3.0f;
camera1.target = (Vector2){ player1.x, player1.y };
camera2.target = (Vector2){ player2.x, player2.y };
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginTextureMode(screenCamera1);
ClearBackground(RAYWHITE);
BeginMode2D(camera1);
// Draw full scene with first camera
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
{
DrawLineV((Vector2){(float)PLAYER_SIZE*i, 0}, (Vector2){ (float)PLAYER_SIZE*i, (float)screenHeight}, LIGHTGRAY);
}
for (int i = 0; i < screenHeight/PLAYER_SIZE + 1; i++)
{
DrawLineV((Vector2){0, (float)PLAYER_SIZE*i}, (Vector2){ (float)screenWidth, (float)PLAYER_SIZE*i}, LIGHTGRAY);
}
for (int i = 0; i < screenWidth/PLAYER_SIZE; i++)
{
for (int j = 0; j < screenHeight/PLAYER_SIZE; j++)
{
DrawText(TextFormat("[%i,%i]", i, j), 10 + PLAYER_SIZE*i, 15 + PLAYER_SIZE*j, 10, LIGHTGRAY);
}
}
DrawRectangleRec(player1, RED);
DrawRectangleRec(player2, BLUE);
EndMode2D();
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
DrawText("PLAYER1: W/S/A/D to move", 10, 10, 10, MAROON);
EndTextureMode();
BeginTextureMode(screenCamera2);
ClearBackground(RAYWHITE);
BeginMode2D(camera2);
// Draw full scene with second camera
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
{
DrawLineV((Vector2){ (float)PLAYER_SIZE*i, 0}, (Vector2){ (float)PLAYER_SIZE*i, (float)screenHeight}, LIGHTGRAY);
}
for (int i = 0; i < screenHeight/PLAYER_SIZE + 1; i++)
{
DrawLineV((Vector2){0, (float)PLAYER_SIZE*i}, (Vector2){ (float)screenWidth, (float)PLAYER_SIZE*i}, LIGHTGRAY);
}
for (int i = 0; i < screenWidth/PLAYER_SIZE; i++)
{
for (int j = 0; j < screenHeight/PLAYER_SIZE; j++)
{
DrawText(TextFormat("[%i,%i]", i, j), 10 + PLAYER_SIZE*i, 15 + PLAYER_SIZE*j, 10, LIGHTGRAY);
}
}
DrawRectangleRec(player1, RED);
DrawRectangleRec(player2, BLUE);
EndMode2D();
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
DrawText("PLAYER2: UP/DOWN/LEFT/RIGHT to move", 10, 10, 10, DARKBLUE);
EndTextureMode();
// Draw both views render textures to the screen side by side
BeginDrawing();
ClearBackground(BLACK);
DrawTextureRec(screenCamera1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
DrawTextureRec(screenCamera2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
EndDrawing();
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadRenderTexture(screenCamera1); // Unload render texture
UnloadRenderTexture(screenCamera2); // Unload render texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -47,7 +47,7 @@ int main(void)
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_FREE);
if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
if (IsKeyPressed('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
//----------------------------------------------------------------------------------
// Draw
@@ -65,15 +65,13 @@ int main(void)
EndMode3D();
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
DrawRectangleLines( 10, 10, 320, 133, BLUE);
DrawRectangle( 10, 10, 320, 93, Fade(SKYBLUE, 0.5f));
DrawRectangleLines( 10, 10, 320, 93, BLUE);
DrawText("Free camera default controls:", 20, 20, 10, BLACK);
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
DrawText("- Z to zoom to (0, 0, 0)", 40, 80, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
@@ -85,4 +83,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [core] example - split screen
* raylib [core] example - 3d cmaera split screen
*
* Example originally created with raylib 3.7, last time updated with raylib 4.0
*
@@ -15,32 +15,6 @@
#include "raylib.h"
Camera cameraPlayer1 = { 0 };
Camera cameraPlayer2 = { 0 };
// Scene drawing
void DrawScene(void)
{
int count = 5;
float spacing = 4;
// Grid of cube trees on a plane to make a "world"
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
for (float x = -count*spacing; x <= count*spacing; x += spacing)
{
for (float z = -count*spacing; z <= count*spacing; z += spacing)
{
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
}
}
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
}
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -51,9 +25,10 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera split screen");
// Setup player 1 camera and screen
Camera cameraPlayer1 = { 0 };
cameraPlayer1.fovy = 45.0f;
cameraPlayer1.up.y = 1.0f;
cameraPlayer1.target.y = 1.0f;
@@ -63,6 +38,7 @@ int main(void)
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
// Setup player two camera and screen
Camera cameraPlayer2 = { 0 };
cameraPlayer2.fovy = 45.0f;
cameraPlayer2.up.y = 1.0f;
cameraPlayer2.target.y = 3.0f;
@@ -73,6 +49,10 @@ int main(void)
// Build a flipped rectangle the size of the split view to use for drawing later
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
// Grid data
int count = 5;
float spacing = 4;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -116,26 +96,69 @@ int main(void)
// Draw Player1 view to the render texture
BeginTextureMode(screenPlayer1);
ClearBackground(SKYBLUE);
BeginMode3D(cameraPlayer1);
DrawScene();
// Draw scene: grid of cube trees on a plane to make a "world"
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
for (float x = -count*spacing; x <= count*spacing; x += spacing)
{
for (float z = -count*spacing; z <= count*spacing; z += spacing)
{
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
}
}
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
EndMode3D();
DrawText("PLAYER1 W/S to move", 10, 10, 20, RED);
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
DrawText("PLAYER1: W/S to move", 10, 10, 20, MAROON);
EndTextureMode();
// Draw Player2 view to the render texture
BeginTextureMode(screenPlayer2);
ClearBackground(SKYBLUE);
BeginMode3D(cameraPlayer2);
DrawScene();
// Draw scene: grid of cube trees on a plane to make a "world"
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
for (float x = -count*spacing; x <= count*spacing; x += spacing)
{
for (float z = -count*spacing; z <= count*spacing; z += spacing)
{
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
}
}
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
EndMode3D();
DrawText("PLAYER2 UP/DOWN to move", 10, 10, 20, BLUE);
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
DrawText("PLAYER2: UP/DOWN to move", 10, 10, 20, DARKBLUE);
EndTextureMode();
// Draw both views render textures to the screen side by side
BeginDrawing();
ClearBackground(BLACK);
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
EndDrawing();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,334 @@
/*******************************************************************************************
*
* raylib [core] example - automation events
*
* Example originally created with raylib 5.0, last time updated with raylib 5.0
*
* Example based on 2d_camera_platformer example by arvyy (@arvyy)
*
* 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) 2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#define GRAVITY 400
#define PLAYER_JUMP_SPD 350.0f
#define PLAYER_HOR_SPD 200.0f
#define MAX_ENVIRONMENT_ELEMENTS 5
typedef struct Player {
Vector2 position;
float speed;
bool canJump;
} Player;
typedef struct EnvElement {
Rectangle rect;
int blocking;
Color color;
} EnvElement;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - automation events");
// Define player
Player player = { 0 };
player.position = (Vector2){ 400, 280 };
player.speed = 0;
player.canJump = false;
// Define environment elements (platforms)
EnvElement envElements[MAX_ENVIRONMENT_ELEMENTS] = {
{{ 0, 0, 1000, 400 }, 0, LIGHTGRAY },
{{ 0, 400, 1000, 200 }, 1, GRAY },
{{ 300, 200, 400, 10 }, 1, GRAY },
{{ 250, 300, 100, 10 }, 1, GRAY },
{{ 650, 300, 100, 10 }, 1, GRAY }
};
// Define camera
Camera2D camera = { 0 };
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
// Automation events
AutomationEventList aelist = LoadAutomationEventList(0); // Initialize list of automation events to record new events
SetAutomationEventList(&aelist);
bool eventRecording = false;
bool eventPlaying = false;
unsigned int frameCounter = 0;
unsigned int playFrameCounter = 0;
unsigned int currentPlayFrame = 0;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose())
{
// Update
//----------------------------------------------------------------------------------
float deltaTime = 0.015f;//GetFrameTime();
// Dropped files logic
//----------------------------------------------------------------------------------
if (IsFileDropped())
{
FilePathList droppedFiles = LoadDroppedFiles();
// Supports loading .rgs style files (text or binary) and .png style palette images
if (IsFileExtension(droppedFiles.paths[0], ".txt;.rae"))
{
UnloadAutomationEventList(&aelist);
aelist = LoadAutomationEventList(droppedFiles.paths[0]);
eventRecording = false;
// Reset scene state to play
eventPlaying = true;
playFrameCounter = 0;
currentPlayFrame = 0;
player.position = (Vector2){ 400, 280 };
player.speed = 0;
player.canJump = false;
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
}
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
}
//----------------------------------------------------------------------------------
// Update player
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_LEFT)) player.position.x -= PLAYER_HOR_SPD*deltaTime;
if (IsKeyDown(KEY_RIGHT)) player.position.x += PLAYER_HOR_SPD*deltaTime;
if (IsKeyDown(KEY_SPACE) && player.canJump)
{
player.speed = -PLAYER_JUMP_SPD;
player.canJump = false;
}
int hitObstacle = 0;
for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++)
{
EnvElement *element = &envElements[i];
Vector2 *p = &(player.position);
if (element->blocking &&
element->rect.x <= p->x &&
element->rect.x + element->rect.width >= p->x &&
element->rect.y >= p->y &&
element->rect.y <= p->y + player.speed*deltaTime)
{
hitObstacle = 1;
player.speed = 0.0f;
p->y = element->rect.y;
}
}
if (!hitObstacle)
{
player.position.y += player.speed*deltaTime;
player.speed += GRAVITY*deltaTime;
player.canJump = false;
}
else player.canJump = true;
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
else if (camera.zoom < 0.25f) camera.zoom = 0.25f;
if (IsKeyPressed(KEY_R))
{
// Reset game state
player.position = (Vector2){ 400, 280 };
player.speed = 0;
player.canJump = false;
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
}
//----------------------------------------------------------------------------------
// Update camera
//----------------------------------------------------------------------------------
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;
for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++)
{
EnvElement *element = &envElements[i];
minX = fminf(element->rect.x, minX);
maxX = fmaxf(element->rect.x + element->rect.width, maxX);
minY = fminf(element->rect.y, minY);
maxY = fmaxf(element->rect.y + element->rect.height, maxY);
}
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, camera);
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, camera);
if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - screenWidth/2);
if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - screenHeight/2);
if (min.x > 0) camera.offset.x = screenWidth/2 - min.x;
if (min.y > 0) camera.offset.y = screenHeight/2 - min.y;
//----------------------------------------------------------------------------------
// Toggle events recording
if (IsKeyPressed(KEY_S))
{
if (!eventPlaying)
{
if (eventRecording)
{
StopAutomationEventRecording();
eventRecording = false;
ExportAutomationEventList(aelist, "automation.rae");
TraceLog(LOG_INFO, "RECORDED FRAMES: %i", aelist.count);
}
else
{
SetAutomationEventBaseFrame(180);
StartAutomationEventRecording();
eventRecording = true;
}
}
}
else if (IsKeyPressed(KEY_A))
{
if (!eventRecording && (aelist.count > 0))
{
// Reset scene state to play
eventPlaying = true;
playFrameCounter = 0;
currentPlayFrame = 0;
player.position = (Vector2){ 400, 280 };
player.speed = 0;
player.canJump = false;
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
}
}
if (eventPlaying)
{
// NOTE: Multiple events could be executed in a single frame
while (playFrameCounter == aelist.events[currentPlayFrame].frame)
{
TraceLog(LOG_INFO, "PLAYING: PlayFrameCount: %i | currentPlayFrame: %i | Event Frame: %i, param: %i",
playFrameCounter, currentPlayFrame, aelist.events[currentPlayFrame].frame, aelist.events[currentPlayFrame].params[0]);
PlayAutomationEvent(aelist.events[currentPlayFrame]);
currentPlayFrame++;
if (currentPlayFrame == aelist.count)
{
eventPlaying = false;
currentPlayFrame = 0;
playFrameCounter = 0;
TraceLog(LOG_INFO, "FINISH PLAYING!");
break;
}
}
playFrameCounter++;
}
if (eventRecording || eventPlaying) frameCounter++;
else frameCounter = 0;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(LIGHTGRAY);
BeginMode2D(camera);
// Draw environment elements
for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++)
{
DrawRectangleRec(envElements[i].rect, envElements[i].color);
}
// Draw player rectangle
DrawRectangleRec((Rectangle){ player.position.x - 20, player.position.y - 40, 40, 40 }, RED);
EndMode2D();
// Draw game controls
DrawRectangle(10, 10, 290, 145, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(10, 10, 290, 145, Fade(BLUE, 0.8f));
DrawText("Controls:", 20, 20, 10, BLACK);
DrawText("- RIGHT | LEFT: Player movement", 30, 40, 10, DARKGRAY);
DrawText("- SPACE: Player jump", 30, 60, 10, DARKGRAY);
DrawText("- R: Reset game state", 30, 80, 10, DARKGRAY);
DrawText("- S: START/STOP RECORDING INPUT EVENTS", 30, 110, 10, BLACK);
DrawText("- A: REPLAY LAST RECORDED INPUT EVENTS", 30, 130, 10, BLACK);
// Draw automation events recording indicator
if (eventRecording)
{
DrawRectangle(10, 160, 290, 30, Fade(RED, 0.3f));
DrawRectangleLines(10, 160, 290, 30, Fade(MAROON, 0.8f));
DrawCircle(30, 175, 10, MAROON);
if (((frameCounter/15)%2) == 1) DrawText(TextFormat("RECORDING EVENTS... [%i]", aelist.count), 50, 170, 10, MAROON);
}
else if (eventPlaying)
{
DrawRectangle(10, 160, 290, 30, Fade(LIME, 0.3f));
DrawRectangleLines(10, 160, 290, 30, Fade(DARKGREEN, 0.8f));
DrawTriangle((Vector2){ 20, 155 + 10 }, (Vector2){ 20, 155 + 30 }, (Vector2){ 40, 155 + 20 }, DARKGREEN);
if (((frameCounter/15)%2) == 1) DrawText(TextFormat("PLAYING RECORDED EVENTS... [%i]", currentPlayFrame), 50, 170, 10, DARKGREEN);
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -2,7 +2,7 @@
*
* raylib [core] example - Basic window (adapted for HTML5 platform)
*
* NOTE: This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
* NOTE: This example is prepared to compile for PLATFORM_WEB, and PLATFORM_DESKTOP
* As you will notice, code structure is slightly diferent to the other examples...
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
*

View File

@@ -53,7 +53,7 @@ int main(void)
{
FilePathList droppedFiles = LoadDroppedFiles();
for (int i = 0, offset = filePathCounter; i < droppedFiles.count; i++)
for (int i = 0, offset = filePathCounter; i < (int)droppedFiles.count; i++)
{
if (filePathCounter < (MAX_FILEPATH_RECORDED - 1))
{
@@ -77,7 +77,7 @@ int main(void)
{
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
for (unsigned int i = 0; i < filePathCounter; i++)
for (int i = 0; i < filePathCounter; i++)
{
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));

View File

@@ -21,13 +21,8 @@
// NOTE: Gamepad name ID depends on drivers and OS
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
#if defined(PLATFORM_RPI)
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#else
#define XBOX360_NAME_ID "Xbox 360 Controller"
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#endif
#define XBOX360_NAME_ID "Xbox 360 Controller"
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
//------------------------------------------------------------------------------------
// Program main entry point
@@ -49,6 +44,8 @@ int main(void)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
int gamepad = 0; // which gamepad to display
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -63,102 +60,114 @@ int main(void)
ClearBackground(RAYWHITE);
if (IsGamepadAvailable(0))
{
DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK);
if (IsKeyPressed(KEY_LEFT) && gamepad > 0) gamepad--;
if (IsKeyPressed(KEY_RIGHT)) gamepad++;
if (TextIsEqual(GetGamepadName(0), XBOX360_NAME_ID) || TextIsEqual(GetGamepadName(0), XBOX360_LEGACY_NAME_ID))
if (IsGamepadAvailable(gamepad))
{
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
if (true)
{
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
// Draw buttons: xbox home
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
// Draw buttons: basic
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
// Draw buttons: d-pad
DrawRectangle(317, 202, 19, 71, BLACK);
DrawRectangle(293, 228, 69, 19, BLACK);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
// Draw buttons: left-right back
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
// Draw axis: left joystick
Color leftGamepadColor = BLACK;
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
DrawCircle(259, 152, 39, BLACK);
DrawCircle(259, 152, 34, LIGHTGRAY);
DrawCircle(259 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20),
152 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
DrawCircle(259 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X)*20),
152 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y)*20), 25, leftGamepadColor);
// Draw axis: right joystick
Color rightGamepadColor = BLACK;
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
DrawCircle(461, 237, 38, BLACK);
DrawCircle(461, 237, 33, LIGHTGRAY);
DrawCircle(461 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20),
237 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
DrawCircle(461 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X)*20),
237 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y)*20), 25, rightGamepadColor);
// Draw axis: left-right triggers
DrawRectangle(170, 30, 15, 70, GRAY);
DrawRectangle(604, 30, 15, 70, GRAY);
DrawRectangle(170, 30, 15, (int)(((1 + GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
DrawRectangle(604, 30, 15, (int)(((1 + GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
DrawRectangle(170, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
DrawRectangle(604, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
}
else if (TextIsEqual(GetGamepadName(0), PS3_NAME_ID))
else if (TextIsEqual(GetGamepadName(gamepad), PS3_NAME_ID))
{
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
// Draw buttons: ps
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
// Draw buttons: basic
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
// Draw buttons: d-pad
DrawRectangle(225, 132, 24, 84, BLACK);
DrawRectangle(195, 161, 84, 25, BLACK);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
// Draw buttons: left-right back buttons
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
// Draw axis: left joystick
DrawCircle(319, 255, 35, BLACK);
Color leftGamepadColor = BLACK;
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
DrawCircle(319, 255, 35, leftGamepadColor);
DrawCircle(319, 255, 31, LIGHTGRAY);
DrawCircle(319 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X) * 20),
255 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y) * 20), 25, BLACK);
DrawCircle(319 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X) * 20),
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y) * 20), 25, leftGamepadColor);
// Draw axis: right joystick
Color rightGamepadColor = BLACK;
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
DrawCircle(475, 255, 35, BLACK);
DrawCircle(475, 255, 31, LIGHTGRAY);
DrawCircle(475 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X) * 20),
255 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y) * 20), 25, BLACK);
DrawCircle(475 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X) * 20),
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y) * 20), 25, rightGamepadColor);
// Draw axis: left-right triggers
DrawRectangle(169, 48, 15, 70, GRAY);
DrawRectangle(611, 48, 15, 70, GRAY);
DrawRectangle(169, 48, 15, (int)(((1 - GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
DrawRectangle(611, 48, 15, (int)(((1 - GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
DrawRectangle(169, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
DrawRectangle(611, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
}
else
{
@@ -179,7 +188,7 @@ int main(void)
}
else
{
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
DrawText(TextFormat("GP%d: NOT DETECTED", gamepad), 10, 10, 10, GRAY);
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
}

View File

@@ -0,0 +1,83 @@
/*******************************************************************************************
*
* raylib [core] example - Gamepad information
*
* NOTE: This example requires a Gamepad connected to the system
* Check raylib.h for buttons configuration
*
* Example originally created with raylib 4.6, last time updated with raylib 4.6
*
* 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-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad information");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
for (int i = 0, y = 10; i < 4; i++) // MAX_GAMEPADS = 4
{
if (IsGamepadAvailable(i))
{
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 20, BLACK);
y += 30;
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 20, BLACK);
y += 30;
for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
{
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 20, BLACK);
y += 30;
}
for (int button = 0; button < 32; button++)
{
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 20, BLACK);
y += 30;
}
}
}
DrawFPS(GetScreenWidth() - 100, 100);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View File

@@ -0,0 +1,330 @@
/*******************************************************************************************
*
* raylib [core] example - Input Gestures for Web
*
* Example originally created with raylib 4.6-dev, last time updated with raylib 4.6-dev
*
* Example contributed by ubkp (@ubkp) and reviewed by Ramon Santamaria (@raysan5)
*
* 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) 2023 ubkp (@ubkp)
*
********************************************************************************************/
#include "raylib.h"
#include "math.h" // Required for the protractor angle graphic drawing
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h> // Required for the Web/HTML5
#endif
//--------------------------------------------------------------------------------------
// Global definitions and declarations
//--------------------------------------------------------------------------------------
// Common variables definitions
//--------------------------------------------------------------------------------------
int screenWidth = 800; // Update depending on web canvas
const int screenHeight = 450;
Vector2 messagePosition = { 160, 7 };
// Last gesture variables definitions
//--------------------------------------------------------------------------------------
int lastGesture = 0;
Vector2 lastGesturePosition = { 165, 130 };
// Gesture log variables definitions and functions declarations
//--------------------------------------------------------------------------------------
#define GESTURE_LOG_SIZE 20
char gestureLog[GESTURE_LOG_SIZE][12] = { "" }; // The gesture log uses an array (as an inverted circular queue) to store the performed gestures
int gestureLogIndex = GESTURE_LOG_SIZE; // The index for the inverted circular queue (moving from last to first direction, then looping around)
int previousGesture = 0;
char const *GetGestureName(int i)
{
switch (i) {
case 0: return "None"; break;
case 1: return "Tap"; break;
case 2: return "Double Tap"; break;
case 4: return "Hold"; break;
case 8: return "Drag"; break;
case 16: return "Swipe Right"; break;
case 32: return "Swipe Left"; break;
case 64: return "Swipe Up"; break;
case 128: return "Swipe Down"; break;
case 256: return "Pinch In"; break;
case 512: return "Pinch Out"; break;
default: return "Unknown"; break;
}
}
Color GetGestureColor(int i)
{
switch (i) {
case 0: return BLACK; break;
case 1: return BLUE; break;
case 2: return SKYBLUE; break;
case 4: return BLACK; break;
case 8: return LIME; break;
case 16: return RED; break;
case 32: return RED; break;
case 64: return RED; break;
case 128: return RED; break;
case 256: return VIOLET; break;
case 512: return ORANGE; break;
default: return BLACK; break;
}
}
int logMode = 1; // Log mode values: 0 shows repeated events; 1 hides repeated events; 2 shows repeated events but hide hold events; 3 hides repeated events and hide hold events
Color gestureColor = { 0, 0, 0, 255 };
Rectangle logButton1 = { 53, 7, 48, 26 };
Rectangle logButton2 = { 108, 7, 36, 26 };
Vector2 gestureLogPosition = { 10, 10 };
// Protractor variables definitions
//--------------------------------------------------------------------------------------
float angleLength = 90.0f;
float currentAngleDegrees = 0.0f;
Vector2 finalVector = { 0.0f, 0.0f };
char currentAngleStr[7] = "";
Vector2 protractorPosition = { 266.0f, 315.0f };
// Update
//--------------------------------------------------------------------------------------
void Update(void)
{
// Handle common
//--------------------------------------------------------------------------------------
int i, ii; // Iterators that will be reused by all for loops
const int currentGesture = GetGestureDetected();
const float currentDragDegrees = GetGestureDragAngle();
const float currentPitchDegrees = GetGesturePinchAngle();
const int touchCount = GetTouchPointCount();
// Handle last gesture
//--------------------------------------------------------------------------------------
if ((currentGesture != 0) && (currentGesture != 4) && (currentGesture != previousGesture)) lastGesture = currentGesture; // Filter the meaningful gestures (1, 2, 8 to 512) for the display
// Handle gesture log
//--------------------------------------------------------------------------------------
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
{
if (CheckCollisionPointRec(GetMousePosition(), logButton1))
{
switch (logMode)
{
case 3: logMode=2; break;
case 2: logMode=3; break;
case 1: logMode=0; break;
default: logMode=1; break;
}
}
else if (CheckCollisionPointRec(GetMousePosition(), logButton2))
{
switch (logMode)
{
case 3: logMode=1; break;
case 2: logMode=0; break;
case 1: logMode=3; break;
default: logMode=2; break;
}
}
}
int fillLog = 0; // Gate variable to be used to allow or not the gesture log to be filled
if (currentGesture !=0)
{
if (logMode == 3) // 3 hides repeated events and hide hold events
{
if (((currentGesture != 4) && (currentGesture != previousGesture)) || (currentGesture < 3)) fillLog = 1;
}
else if (logMode == 2) // 2 shows repeated events but hide hold events
{
if (currentGesture != 4) fillLog = 1;
}
else if (logMode == 1) // 1 hides repeated events
{
if (currentGesture != previousGesture) fillLog = 1;
}
else // 0 shows repeated events
{
fillLog = 1;
}
}
if (fillLog) // If one of the conditions from logMode was met, fill the gesture log
{
previousGesture = currentGesture;
gestureColor = GetGestureColor(currentGesture);
if (gestureLogIndex <= 0) gestureLogIndex = GESTURE_LOG_SIZE;
gestureLogIndex--;
// Copy the gesture respective name to the gesture log array
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
}
// Handle protractor
//--------------------------------------------------------------------------------------
if (currentGesture > 255) // aka Pinch In and Pinch Out
{
currentAngleDegrees = currentPitchDegrees;
}
else if (currentGesture > 15) // aka Swipe Right, Swipe Left, Swipe Up and Swipe Down
{
currentAngleDegrees = currentDragDegrees;
}
else if (currentGesture > 0) // aka Tap, Doubletap, Hold and Grab
{
currentAngleDegrees = 0.0f;
}
float currentAngleRadians = ((currentAngleDegrees +90.0f)*PI/180); // Convert the current angle to Radians
finalVector = (Vector2){ (angleLength*sinf(currentAngleRadians)) + protractorPosition.x, (angleLength*cosf(currentAngleRadians)) + protractorPosition.y }; // Calculate the final vector for display
// Handle touch and mouse pointer points
//--------------------------------------------------------------------------------------
#define MAX_TOUCH_COUNT 32
Vector2 touchPosition[MAX_TOUCH_COUNT] = { 0 };
Vector2 mousePosition = {0, 0};
if (currentGesture != GESTURE_NONE)
{
if (touchCount != 0)
{
for (i = 0; i < touchCount; i++) touchPosition[i] = GetTouchPosition(i); // Fill the touch positions
}
else mousePosition = GetMousePosition();
}
// Draw
//--------------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw common
//--------------------------------------------------------------------------------------
DrawText("*", messagePosition.x + 5, messagePosition.y + 5, 10, BLACK);
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", messagePosition.x + 15, messagePosition.y + 5, 10, BLACK);
DrawText("*", messagePosition.x + 5, messagePosition.y + 35, 10, BLACK);
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", messagePosition.x + 15, messagePosition.y + 35, 10, BLACK);
// Draw last gesture
//--------------------------------------------------------------------------------------
DrawText("Last gesture", lastGesturePosition.x + 33, lastGesturePosition.y - 47, 20, BLACK);
DrawText("Swipe Tap Pinch Touch", lastGesturePosition.x + 17, lastGesturePosition.y - 18, 10, BLACK);
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
DrawRectangle(lastGesturePosition.x, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
DrawRectangle(lastGesturePosition.x + 40, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
DrawCircle(lastGesturePosition.x + 103, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
for (i = 0; i < 4; i++) DrawCircle(lastGesturePosition.x + 180, lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
// Draw gesture log
//--------------------------------------------------------------------------------------
DrawText("Log", gestureLogPosition.x, gestureLogPosition.y, 20, BLACK);
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], gestureLogPosition.x, gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
Color logButton1Color, logButton2Color;
switch (logMode)
{
case 3: logButton1Color=MAROON; logButton2Color=MAROON; break;
case 2: logButton1Color=GRAY; logButton2Color=MAROON; break;
case 1: logButton1Color=MAROON; logButton2Color=GRAY; break;
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
}
DrawRectangleRec(logButton1, logButton1Color);
DrawText("Hide", logButton1.x + 7, logButton1.y + 3, 10, WHITE);
DrawText("Repeat", logButton1.x + 7, logButton1.y + 13, 10, WHITE);
DrawRectangleRec(logButton2, logButton2Color);
DrawText("Hide", logButton1.x + 62, logButton1.y + 3, 10, WHITE);
DrawText("Hold", logButton1.x + 62, logButton1.y + 13, 10, WHITE);
// Draw protractor
//--------------------------------------------------------------------------------------
DrawText("Angle", protractorPosition.x + 55, protractorPosition.y + 76, 10, BLACK);
const char *angleString = TextFormat("%f", currentAngleDegrees);
const int angleStringDot = TextFindIndex(angleString, ".");
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
DrawText( angleStringTrim, protractorPosition.x + 55, protractorPosition.y + 92, 20, gestureColor);
DrawCircle(protractorPosition.x, protractorPosition.y, 80.0f, WHITE);
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
DrawText("0", protractorPosition.x + 96, protractorPosition.y - 9, 20, BLACK);
DrawText("30", protractorPosition.x + 74, protractorPosition.y - 68, 20, BLACK);
DrawText("90", protractorPosition.x - 11, protractorPosition.y - 110, 20, BLACK);
DrawText("150", protractorPosition.x - 100, protractorPosition.y - 68, 20, BLACK);
DrawText("180", protractorPosition.x - 124, protractorPosition.y - 9, 20, BLACK);
DrawText("210", protractorPosition.x - 100, protractorPosition.y + 50, 20, BLACK);
DrawText("270", protractorPosition.x - 18, protractorPosition.y + 92, 20, BLACK);
DrawText("330", protractorPosition.x + 72, protractorPosition.y + 50, 20, BLACK);
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
// Draw touch and mouse pointer points
//--------------------------------------------------------------------------------------
if (currentGesture != GESTURE_NONE)
{
if ( touchCount != 0 )
{
for (i = 0; i < touchCount; i++)
{
DrawCircleV(touchPosition[i], 50.0f, Fade(gestureColor, 0.5f));
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
}
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8 : 12), gestureColor);
}
else
{
DrawCircleV(mousePosition, 35.0f, Fade(gestureColor, 0.5f));
DrawCircleV(mousePosition, 5.0f, gestureColor);
}
}
EndDrawing();
//--------------------------------------------------------------------------------------
}
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures web");
//--------------------------------------------------------------------------------------
// Main game loop
//--------------------------------------------------------------------------------------
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(Update, 0, 1);
#else
SetTargetFPS(60);
while (!WindowShouldClose()) Update(); // Detect window close button or ESC key
#endif
//--------------------------------------------------------------------------------------
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -15,6 +15,7 @@
#include "raylib.h"
// WARNING: This example does not build on Windows with MSVC compiler
#include "pthread.h" // POSIX style threads management
#include <stdatomic.h> // C11 atomic data types
@@ -40,7 +41,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - loading thread");
pthread_t threadId; // Loading data thread id
pthread_t threadId = { 0 }; // Loading data thread id
enum { STATE_WAITING, STATE_LOADING, STATE_FINISHED } state = STATE_WAITING;
int framesCounter = 0;

View File

@@ -29,7 +29,7 @@ int main(void)
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
int framesCounter = 0; // Variable used to count frames
unsigned int framesCounter = 0; // Variable used to count frames
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------

View File

@@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [core] example - smooth pixel-perfect camera
* raylib [core] example - Smooth Pixel-perfect camera
*
* Example originally created with raylib 3.7, last time updated with raylib 4.0
*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -104,7 +104,7 @@ int main(void)
bool SaveStorageValue(unsigned int position, int value)
{
bool success = false;
unsigned int dataSize = 0;
int dataSize = 0;
unsigned int newDataSize = 0;
unsigned char *fileData = LoadFileData(STORAGE_DATA_FILE, &dataSize);
unsigned char *newFileData = NULL;
@@ -172,7 +172,7 @@ bool SaveStorageValue(unsigned int position, int value)
int LoadStorageValue(unsigned int position)
{
int value = 0;
unsigned int dataSize = 0;
int dataSize = 0;
unsigned char *fileData = LoadFileData(STORAGE_DATA_FILE, &dataSize);
if (fileData != NULL)

View File

@@ -15,7 +15,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -35,13 +35,30 @@
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
10. Have fun!
The following files should be updated when adding a new example, it's planned to create some
script to automatize this process but not available yet.
- raylib/examples/<category>/<category>_example_name.c
- raylib/examples/<category>/<category>_example_name.png
- raylib/examples/<category>/resources/*.*
- raylib/examples/Makefile
- raylib/examples/Makefile.Web
- raylib/examples/README.md
- raylib/projects/VS2022/examples/<category>_example_name.vcxproj
- raylib/projects/VS2022/raylib.sln
- raylib.com/common/examples.js
- raylib.com/examples/<category>/<category>_example_name.html
- raylib.com/examples/<category>/<category>_example_name.data
- raylib.com/examples/<category>/<category>_example_name.wasm
- raylib.com/examples/<category>/<category>_example_name.js
*/
/*******************************************************************************************
*
* raylib [core] example - Basic window
*
* Example originally created with raylib 4.2, last time updated with raylib 4.2
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
*

View File

@@ -48,7 +48,7 @@ int main(void)
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
// Load animation data
unsigned int animsCount = 0;
int animsCount = 0;
ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
int animFrameCounter = 0;

View File

@@ -4,9 +4,9 @@
*
* LIMITATIONS:
* - Only supports 1 armature per file, and skips loading it if there are multiple armatures
* - Only supports linear interpolation (default method in Blender when checked
* - Only supports linear interpolation (default method in Blender when checked
* "Always Sample Animations" when exporting a GLTF file)
* - Only supports translation/rotation/scale animation channel.path,
* - Only supports translation/rotation/scale animation channel.path,
* weights not considered (i.e. morph targets)
*
* Example originally created with raylib 3.7, last time updated with raylib 4.2
@@ -42,9 +42,9 @@ int main(void)
// Load gltf model
Model model = LoadModel("resources/models/gltf/robot.glb");
// Load gltf model animations
unsigned int animsCount = 0;
int animsCount = 0;
unsigned int animIndex = 0;
unsigned int animCurrentFrame = 0;
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/robot.glb", &animsCount);
@@ -63,9 +63,9 @@ int main(void)
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
// Select current animation
if (IsKeyPressed(KEY_UP)) animIndex = (animIndex + 1)%animsCount;
else if (IsKeyPressed(KEY_DOWN)) animIndex = (animIndex + animsCount - 1)%animsCount;
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) animIndex = (animIndex + 1)%animsCount;
else if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) animIndex = (animIndex + animsCount - 1)%animsCount;
// Update model animation
ModelAnimation anim = modelAnimations[animIndex];
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
@@ -85,7 +85,8 @@ int main(void)
EndMode3D();
DrawText("Use the UP/DOWN arrow keys to switch animation", 10, 10, 20, GRAY);
DrawText("Use the LEFT/RIGHT mouse buttons to switch animation", 10, 10, 20, GRAY);
DrawText(TextFormat("Animation: %s", anim.name), 10, GetScreenHeight() - 20, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -40,7 +40,7 @@ int main(void)
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
bool drawMesh = 1;
bool drawSkeleton = 1;
@@ -50,7 +50,7 @@ int main(void)
Model model = LoadModel(modelFileName); // Load the bind-pose model mesh and basic data
// Load animations
unsigned int animsCount = 0;
int animsCount = 0;
int animFrameCounter = 0, animId = 0;
ModelAnimation *anims = LoadModelAnimations(modelFileName, &animsCount); // Load skeletal animation data
@@ -72,27 +72,27 @@ int main(void)
if (IsKeyDown(KEY_SPACE) || IsKeyPressed(KEY_N))
{
animFrameCounter++;
if (animFrameCounter >= anims[animId].frameCount) animFrameCounter = 0;
UpdateModelAnimation(model, anims[animId], animFrameCounter);
animPlaying = true;
}
// Select animation by pressing A
if (IsKeyPressed(KEY_A))
// Select animation by pressing C
if (IsKeyPressed(KEY_C))
{
animFrameCounter = 0;
animId++;
if (animId >= animsCount) animId = 0;
if (animId >= (int)animsCount) animId = 0;
UpdateModelAnimation(model, anims[animId], 0);
animPlaying = true;
}
}
// Toggle skeleton drawing
if (IsKeyPressed(KEY_S)) drawSkeleton ^= 1;
if (IsKeyPressed(KEY_B)) drawSkeleton ^= 1;
// Toggle mesh drawing
if (IsKeyPressed(KEY_M)) drawMesh ^= 1;
@@ -112,19 +112,19 @@ int main(void)
// Draw the animated skeleton
if (drawSkeleton)
{
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
// needed to workaround buggy models
// without a -1, we would always draw a cube at the origin
for (int i = 0; i < model.boneCount - 1; i++)
{
// By default the model is loaded in bind-pose by LoadModel().
// But if UpdateModelAnimation() has been called at least once
// By default the model is loaded in bind-pose by LoadModel().
// But if UpdateModelAnimation() has been called at least once
// then the model is already in animation pose, so we need the animated skeleton
if (!animPlaying || !animsCount)
{
// Display the bind-pose skeleton
DrawCube(model.bindPose[i].translation, 0.04f, 0.04f, 0.04f, RED);
if (model.bones[i].parent >= 0)
{
DrawLine3D(model.bindPose[i].translation,
@@ -135,7 +135,7 @@ int main(void)
{
// Display the frame-pose skeleton
DrawCube(anims[animId].framePoses[animFrameCounter][i].translation, 0.05f, 0.05f, 0.05f, RED);
if (anims[animId].bones[i].parent >= 0)
{
DrawLine3D(anims[animId].framePoses[animFrameCounter][i].translation,
@@ -149,9 +149,10 @@ int main(void)
EndMode3D();
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 60, 10, MAROON);
DrawText("PRESS A to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
DrawText("PRESS M to toggle MESH, S to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 80, 10, MAROON);
DrawText("PRESS N to STEP ONE ANIMATION FRAME", 10, GetScreenHeight() - 60, 10, DARKGRAY);
DrawText("PRESS C to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
DrawText("PRESS M to toggle MESH, B to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
DrawText("(c) CesiumMan model by KhronosGroup", GetScreenWidth() - 210, GetScreenHeight() - 20, 10, GRAY);
EndDrawing();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -36,7 +36,7 @@ int main(void)
Model models[NUM_MODELS] = { 0 };
models[0] = LoadModelFromMesh(GenMeshPlane(2, 2, 5, 5));
models[0] = LoadModelFromMesh(GenMeshPlane(2, 2, 4, 3));
models[1] = LoadModelFromMesh(GenMeshCube(2.0f, 1.0f, 2.0f));
models[2] = LoadModelFromMesh(GenMeshSphere(2, 32, 32));
models[3] = LoadModelFromMesh(GenMeshHemiSphere(2, 16, 16));

View File

@@ -18,7 +18,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
@@ -68,14 +68,12 @@ int main(void)
char skyboxFileName[256] = { 0 };
Texture2D panorama;
if (useHDR)
{
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
// Load HDR panorama (sphere) texture
panorama = LoadTexture(skyboxFileName);
Texture2D panorama = LoadTexture(skyboxFileName);
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
@@ -83,7 +81,7 @@ int main(void)
// despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
//UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
}
else
{
@@ -113,15 +111,18 @@ int main(void)
{
if (IsFileExtension(droppedFiles.paths[0], ".png;.jpg;.hdr;.bmp;.tga"))
{
// Unload current cubemap texture and load new one
// Unload current cubemap texture to load new one
UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
if (useHDR)
{
// Load HDR panorama (sphere) texture
Texture2D panorama = LoadTexture(droppedFiles.paths[0]);
// Generate cubemap from panorama texture
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
UnloadTexture(panorama);
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
}
else
{

View File

@@ -108,7 +108,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [easings] example - easings testbed");
Vector2 ballPosition = { 100.0f, 200.0f };
Vector2 ballPosition = { 100.0f, 100.0f };
float t = 0.0f; // Current time (in any unit measure, but same unit as duration)
float d = 300.0f; // Total time it should take to complete (duration)
@@ -180,8 +180,8 @@ int main(void)
// Movement computation
if (!paused && ((boundedT && t < d) || !boundedT))
{
ballPosition.x = Easings[easingX].func(t, 100.0f, 700.0f - 100.0f, d);
ballPosition.y = Easings[easingY].func(t, 100.0f, 400.0f - 100.0f, d);
ballPosition.x = Easings[easingX].func(t, 100.0f, 700.0f - 170.0f, d);
ballPosition.y = Easings[easingY].func(t, 100.0f, 400.0f - 170.0f, d);
t += 1.0f;
}
//----------------------------------------------------------------------------------
@@ -193,15 +193,15 @@ int main(void)
ClearBackground(RAYWHITE);
// Draw information text
DrawText(TextFormat("Easing x: %s", Easings[easingX].name), 0, FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
DrawText(TextFormat("Easing y: %s", Easings[easingY].name), 0, FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
DrawText(TextFormat("t (%c) = %.2f d = %.2f", (boundedT == true)? 'b' : 'u', t, d), 0, FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
DrawText(TextFormat("Easing x: %s", Easings[easingX].name), 20, FONT_SIZE, FONT_SIZE, LIGHTGRAY);
DrawText(TextFormat("Easing y: %s", Easings[easingY].name), 20, FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
DrawText(TextFormat("t (%c) = %.2f d = %.2f", (boundedT == true)? 'b' : 'u', t, d), 20, FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
// Draw instructions text
DrawText("Use ENTER to play or pause movement, use SPACE to restart", 0, GetScreenHeight() - FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
DrawText("Use D and W or A and S keys to change duration", 0, GetScreenHeight() - FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
DrawText("Use LEFT or RIGHT keys to choose easing for the x axis", 0, GetScreenHeight() - FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
DrawText("Use UP or DOWN keys to choose easing for the y axis", 0, GetScreenHeight() - FONT_SIZE*5, FONT_SIZE, LIGHTGRAY);
DrawText("Use ENTER to play or pause movement, use SPACE to restart", 20, GetScreenHeight() - FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
DrawText("Use Q and W or A and S keys to change duration", 20, GetScreenHeight() - FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
DrawText("Use LEFT or RIGHT keys to choose easing for the x axis", 20, GetScreenHeight() - FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
DrawText("Use UP or DOWN keys to choose easing for the y axis", 20, GetScreenHeight() - FONT_SIZE*5, FONT_SIZE, LIGHTGRAY);
// Draw ball
DrawCircleV(ballPosition, 16.0f, MAROON);
@@ -226,4 +226,4 @@ static float NoEase(float t, float b, float c, float d)
d += burn;
return b;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -62,7 +62,6 @@ extern "C" {
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
* * `GLFW_EXPOSE_NATIVE_MIR`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
@@ -75,6 +74,16 @@ extern "C" {
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*
* If you do not want the platform-specific headers to be included, define
* `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
*
* @code
* #define GLFW_EXPOSE_NATIVE_WIN32
* #define GLFW_EXPOSE_NATIVE_WGL
* #define GLFW_NATIVE_INCLUDE_NONE
* #include <GLFW/glfw3native.h>
* @endcode
*/
@@ -82,46 +91,65 @@ extern "C" {
* System headers and types
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output
// callback) but windows.h assumes no one will define APIENTRY before it does
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
#include <ApplicationServices/ApplicationServices.h>
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
typedef void* id;
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#elif defined(GLFW_EXPOSE_NATIVE_MIR)
#include <mir_toolkit/mir_client_library.h>
#endif
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
#include <GL/osmesa.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
* example to allow applications to correctly declare a GL_KHR_debug callback)
* but windows.h assumes no one will define APIENTRY before it does
*/
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#include <objc/objc.h>
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
* default it also acts as an OpenGL header
* However, glx.h will include gl.h, which will define it unconditionally
*/
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
* default it also acts as an OpenGL header
* However, osmesa.h will include gl.h, which will define it unconditionally
*/
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/osmesa.h>
#endif
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
/*************************************************************************
@@ -135,6 +163,8 @@ extern "C" {
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -150,6 +180,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -164,6 +196,16 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -180,6 +222,17 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -196,6 +249,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -210,6 +265,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -226,6 +283,9 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -242,6 +302,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -256,6 +318,8 @@ GLFWAPI Display* glfwGetX11Display(void);
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -270,6 +334,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -284,6 +350,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -350,6 +418,9 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -364,6 +435,9 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -380,6 +454,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -394,6 +470,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -408,6 +486,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -418,56 +498,17 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_MIR)
/*! @brief Returns the `MirConnection*` used by GLFW.
*
* @return The `MirConnection*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI MirConnection* glfwGetMirDisplay(void);
/*! @brief Returns the Mir output ID of the specified monitor.
*
* @return The Mir output ID of the specified monitor, or zero if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `MirWindow*` of the specified window.
*
* @return The `MirWindow*` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI MirWindow* glfwGetMirWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark Because EGL is initialized on demand, this function will return
* `EGL_NO_DISPLAY` until the first context has been created via EGL.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -482,6 +523,9 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -496,6 +540,9 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -519,6 +566,9 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -540,6 +590,9 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
@@ -554,6 +607,9 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
* @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*

Binary file not shown.

View File

@@ -42,7 +42,7 @@
#endif
#define GLSL_VERSION 330
#endif
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -0,0 +1,122 @@
/*******************************************************************************************
*
* raylib [shapes] example - Vector Angle
*
* Example originally created with raylib 1.0, last time updated with raylib 4.6
*
* 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) 2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [math] example - vector angle");
Vector2 v0 = { screenWidth/2, screenHeight/2 };
Vector2 v1 = Vector2Add(v0, (Vector2){ 100.0f, 80.0f });
Vector2 v2 = { 0 }; // Updated with mouse position
float angle = 0.0f; // Angle in degrees
int angleMode = 0; // 0-Vector2Angle(), 1-Vector2LineAngle()
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
float startangle = 0.0f;
if (angleMode == 0) startangle = -Vector2LineAngle(v0, v1)*RAD2DEG;
if (angleMode == 1) startangle = 0.0f;
v2 = GetMousePosition();
if (IsKeyPressed(KEY_SPACE)) angleMode = !angleMode;
if(angleMode == 0 && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) v1 = GetMousePosition();
if (angleMode == 0)
{
// Calculate angle between two vectors, considering a common origin (v0)
Vector2 v1Normal = Vector2Normalize(Vector2Subtract(v1, v0));
Vector2 v2Normal = Vector2Normalize(Vector2Subtract(v2, v0));
angle = Vector2Angle(v1Normal, v2Normal)*RAD2DEG;
}
else if (angleMode == 1)
{
// Calculate angle defined by a two vectors line, in reference to horizontal line
angle = Vector2LineAngle(v0, v2)*RAD2DEG;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (angleMode == 0)
{
DrawText("MODE 0: Angle between V1 and V2", 10, 10, 20, BLACK);
DrawText("Right Click to Move V2", 10, 30, 20, DARKGRAY);
DrawLineEx(v0, v1, 2.0f, BLACK);
DrawLineEx(v0, v2, 2.0f, RED);
DrawCircleSector(v0, 40.0f, startangle, startangle + angle, 32, Fade(GREEN, 0.6f));
}
else if (angleMode == 1)
{
DrawText("MODE 1: Angle formed by line V1 to V2", 10, 10, 20, BLACK);
DrawLine(0, screenHeight/2, screenWidth, screenHeight/2, LIGHTGRAY);
DrawLineEx(v0, v2, 2.0f, RED);
DrawCircleSector(v0, 40.0f, startangle, startangle - angle, 32, Fade(GREEN, 0.6f));
}
DrawText("v0", v0.x, v0.y, 10, DARKGRAY);
// If the line from v0 to v1 would overlap the text, move it's position up 10
if (angleMode == 0 && Vector2Subtract(v0, v1).y > 0.0f) DrawText("v1", v1.x, v1.y-10.0f, 10, DARKGRAY);
if (angleMode == 0 && Vector2Subtract(v0, v1).y < 0.0f) DrawText("v1", v1.x, v1.y, 10, DARKGRAY);
// If angle mode 1, use v1 to emphasize the horizontal line
if (angleMode == 1) DrawText("v1", v0.x + 40.0f, v0.y, 10, DARKGRAY);
// position adjusted by -10 so it isn't hidden by cursor
DrawText("v2", v2.x-10.0f, v2.y-10.0f, 10, DARKGRAY);
DrawText("Press SPACE to change MODE", 460, 10, 20, DARKGRAY);
DrawText(TextFormat("ANGLE: %2.2f", angle), 10, 70, 20, LIME);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -74,10 +74,10 @@ int main(void)
unsigned int ssboA = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
unsigned int ssboB = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
unsigned int ssboTransfert = rlLoadShaderBuffer(sizeof(GolUpdateSSBO), NULL, RL_DYNAMIC_COPY);
GolUpdateSSBO transfertBuffer = { 0 };
// Create a white texture of the size of the window to update
// Create a white texture of the size of the window to update
// each pixel of the window using the fragment shader: golRenderShader
Image whiteImage = GenImageColor(GOL_WIDTH, GOL_WIDTH, WHITE);
Texture whiteTex = LoadTextureFromImage(whiteImage);
@@ -105,7 +105,7 @@ int main(void)
{
// Send SSBO buffer to GPU
rlUpdateShaderBuffer(ssboTransfert, &transfertBuffer, sizeof(GolUpdateSSBO), 0);
// Process SSBO commands on GPU
rlEnableShader(golTransfertProgram);
rlBindShaderBuffer(ssboA, 1);
@@ -143,7 +143,7 @@ int main(void)
BeginShaderMode(golRenderShader);
DrawTexture(whiteTex, 0, 0, WHITE);
EndShaderMode();
DrawRectangleLines(GetMouseX() - brushSize/2, GetMouseY() - brushSize/2, brushSize, brushSize, RED);
DrawText("Use Mouse wheel to increase/decrease brush size", 10, 10, 20, WHITE);

View File

@@ -5,8 +5,8 @@
* rlgl library is an abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0)
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
*
* NOTE: This example requires OpenGL 3.3 or OpenGL ES 2.0 for shaders support,
* OpenGL 1.1 does not support shaders but it can also be used.
* WARNING: This example is intended only for PLATFORM_DESKTOP and OpenGL 3.3 Core profile.
* It could work on other platforms if redesigned for those platforms (out-of-scope)
*
* DEPENDENCIES:
* glfw3 - Windows and context initialization library
@@ -64,9 +64,6 @@
#define RAYMATH_STATIC_INLINE
#include "raymath.h" // Vector2, Vector3, Quaternion and Matrix functionality
#if defined(__EMSCRIPTEN__)
#define GLFW_INCLUDE_ES2
#endif
#include "GLFW/glfw3.h" // Windows/Context and inputs management
#include <stdio.h> // Required for: printf()
@@ -136,6 +133,8 @@ int main(void)
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_DEPTH_BITS, 16);
// WARNING: OpenGL 3.3 Core profile only
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

View File

@@ -9,3 +9,5 @@
| raysan.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| space.png | ❔ | ❔ | - |
| texel_checker.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [UV Checker Map Maker](http://uvchecker.byvalle.com/) |
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| spark_flame.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [EffectTextureMaker](https://mebiusbox.github.io/contents/EffectTextureMaker/) |

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -6,30 +6,30 @@ precision mediump float;
varying vec2 fragTexCoord;
varying vec4 fragColor;
uniform vec2 screenDims; // Dimensions of the screen
uniform vec2 c; // c.x = real, c.y = imaginary component. Equation done is z^2 + c
uniform vec2 offset; // Offset of the scale.
uniform float zoom; // Zoom of the scale.
// NOTE: Maximum number of shader for-loop iterations depend on GPU,
// for example, on RasperryPi for this examply only supports up to 60
const int MAX_ITERATIONS = 48; // Max iterations to do
const int maxIterations = 48; // Max iterations to do.
const float colorCycles = 1.0f; // Number of times the color palette repeats.
// Square a complex number
vec2 ComplexSquare(vec2 z)
{
return vec2(
z.x * z.x - z.y * z.y,
z.x * z.y * 2.0
z.x*z.x - z.y*z.y,
z.x*z.y*2.0f
);
}
// Convert Hue Saturation Value (HSV) color into RGB
vec3 Hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
vec4 K = vec4(1.0f, 2.0f/3.0f, 1.0f/3.0f, 3.0f);
vec3 p = abs(fract(c.xxx + K.xyz)*6.0f - K.www);
return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0f, 1.0f), c.y);
}
void main()
@@ -45,8 +45,8 @@ void main()
If the number is below 2, we keep iterating.
But when do we stop iterating if the number is always below 2 (it converges)?
That is what MAX_ITERATIONS is for.
Then we can divide the iterations by the MAX_ITERATIONS value to get a normalized value that we can
That is what maxIterations is for.
Then we can divide the iterations by the maxIterations value to get a normalized value that we can
then map to a color.
We use dot product (z.x * z.x + z.y * z.y) to determine the magnitude (length) squared.
@@ -55,13 +55,15 @@ void main()
// The pixel coordinates are scaled so they are on the mandelbrot scale
// NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom
vec2 z = vec2((fragTexCoord.x + offset.x/screenDims.x)*2.5/zoom, (fragTexCoord.y + offset.y/screenDims.y)*1.5/zoom);
vec2 z = vec2((fragTexCoord.x - 0.5f)*2.5f, (fragTexCoord.y - 0.5f)*1.5f)/zoom;
z.x += offset.x;
z.y += offset.y;
int iter = 0;
for (int iterations = 0; iterations < 60; iterations++)
{
z = ComplexSquare(z) + c; // Iterate function
if (dot(z, z) > 4.0) break;
if (dot(z, z) > 4.0f) break;
iter = iterations;
}
@@ -72,12 +74,12 @@ void main()
z = ComplexSquare(z) + c;
// This last part smooths the color (again see link above).
float smoothVal = float(iter) + 1.0 - (log(log(length(z)))/log(2.0));
float smoothVal = float(iter) + 1.0f - (log(log(length(z)))/log(2.0f));
// Normalize the value so it is between 0 and 1.
float norm = smoothVal/float(MAX_ITERATIONS);
float norm = smoothVal/float(maxIterations);
// If in set, color black. 0.999 allows for some float accuracy error.
if (norm > 0.999) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
else gl_FragColor = vec4(Hsv2rgb(vec3(norm, 1.0, 1.0)), 1.0);
if (norm > 0.999f) gl_FragColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
else gl_FragColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0f, 1.0f)), 1.0f);
}

View File

@@ -18,12 +18,6 @@ uniform vec4 colDiffuse;
#define LIGHT_DIRECTIONAL 0
#define LIGHT_POINT 1
struct MaterialProperty {
vec3 color;
int useSampler;
sampler2D sampler;
};
struct Light {
int enabled;
int type;

View File

@@ -42,5 +42,5 @@ void main()
tc += center;
vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;;
gl_FragColor = vec4(color.rgb, 1.0);;
gl_FragColor = vec4(color.rgb, 1.0);
}

View File

@@ -0,0 +1,21 @@
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D diffuseMap;
uniform vec4 tiling;
// NOTE: Add here your custom variables
void main()
{
vec2 texCoord = fragTexCoord*tiling;
fragColor = texture2D(diffuseMap, texCoord);
gl_FragColor = fragColor;
}

View File

@@ -10,7 +10,7 @@ varying vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
uniform float secondes;
uniform float seconds;
uniform vec2 size;
@@ -29,8 +29,8 @@ void main() {
float boxTop = 0.0;
vec2 p = fragTexCoord;
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor;
}

View File

@@ -16,12 +16,6 @@ uniform vec4 colDiffuse;
#define LIGHT_DIRECTIONAL 0
#define LIGHT_POINT 1
struct MaterialProperty {
vec3 color;
int useSampler;
sampler2D sampler;
};
struct Light {
int enabled;
int type;

View File

@@ -0,0 +1,55 @@
#version 330 core
out vec4 finalColor;
in vec2 texCoord;
in vec2 texCoord2;
uniform sampler2D gPosition;
uniform sampler2D gNormal;
uniform sampler2D gAlbedoSpec;
struct Light {
int enabled;
int type; // Unused in this demo.
vec3 position;
vec3 target; // Unused in this demo.
vec4 color;
};
const int NR_LIGHTS = 4;
uniform Light lights[NR_LIGHTS];
uniform vec3 viewPosition;
const float QUADRATIC = 0.032;
const float LINEAR = 0.09;
void main() {
vec3 fragPosition = texture(gPosition, texCoord).rgb;
vec3 normal = texture(gNormal, texCoord).rgb;
vec3 albedo = texture(gAlbedoSpec, texCoord).rgb;
float specular = texture(gAlbedoSpec, texCoord).a;
vec3 ambient = albedo * vec3(0.1f);
vec3 viewDirection = normalize(viewPosition - fragPosition);
for(int i = 0; i < NR_LIGHTS; ++i)
{
if(lights[i].enabled == 0) continue;
vec3 lightDirection = lights[i].position - fragPosition;
vec3 diffuse = max(dot(normal, lightDirection), 0.0) * albedo * lights[i].color.xyz;
vec3 halfwayDirection = normalize(lightDirection + viewDirection);
float spec = pow(max(dot(normal, halfwayDirection), 0.0), 32.0);
vec3 specular = specular * spec * lights[i].color.xyz;
// Attenuation
float distance = length(lights[i].position - fragPosition);
float attenuation = 1.0 / (1.0 + LINEAR * distance + QUADRATIC * distance * distance);
diffuse *= attenuation;
specular *= attenuation;
ambient += diffuse + specular;
}
finalColor = vec4(ambient, 1.0);
}

View File

@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec3 vertexPosition;
layout (location = 1) in vec2 vertexTexCoord;
out vec2 texCoord;
void main() {
gl_Position = vec4(vertexPosition, 1.0);
texCoord = vertexTexCoord;
}

View File

@@ -0,0 +1,22 @@
#version 330 core
layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;
in vec3 fragPosition;
in vec2 fragTexCoord;
in vec3 fragNormal;
uniform sampler2D diffuseTexture;
uniform sampler2D specularTexture;
void main() {
// store the fragment position vector in the first gbuffer texture
gPosition = fragPosition;
// also store the per-fragment normals into the gbuffer
gNormal = normalize(fragNormal);
// and the diffuse per-fragment color
gAlbedoSpec.rgb = texture(diffuseTexture, fragTexCoord).rgb;
// store specular intensity in gAlbedoSpec's alpha component
gAlbedoSpec.a = texture(specularTexture, fragTexCoord).r;
}

View File

@@ -0,0 +1,24 @@
#version 330 core
layout (location = 0) in vec3 vertexPosition;
layout (location = 1) in vec2 vertexTexCoord;
layout (location = 2) in vec3 vertexNormal;
out vec3 fragPosition;
out vec2 fragTexCoord;
out vec3 fragNormal;
uniform mat4 matModel;
uniform mat4 matView;
uniform mat4 matProjection;
void main()
{
vec4 worldPos = matModel * vec4(vertexPosition, 1.0);
fragPosition = worldPos.xyz;
fragTexCoord = vertexTexCoord;
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
fragNormal = normalMatrix * vertexNormal;
gl_Position = matProjection * matView * worldPos;
}

View File

@@ -7,28 +7,28 @@ in vec4 fragColor;
// Output fragment color
out vec4 finalColor;
uniform vec2 screenDims; // Dimensions of the screen
uniform vec2 c; // c.x = real, c.y = imaginary component. Equation done is z^2 + c
uniform vec2 offset; // Offset of the scale.
uniform float zoom; // Zoom of the scale.
const int MAX_ITERATIONS = 255; // Max iterations to do.
const int maxIterations = 255; // Max iterations to do.
const float colorCycles = 2.0f; // Number of times the color palette repeats. Can show higher detail for higher iteration numbers.
// Square a complex number
vec2 ComplexSquare(vec2 z)
{
return vec2(
z.x * z.x - z.y * z.y,
z.x * z.y * 2.0
z.x*z.x - z.y*z.y,
z.x*z.y*2.0f
);
}
// Convert Hue Saturation Value (HSV) color into RGB
vec3 Hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
vec4 K = vec4(1.0f, 2.0f/3.0f, 1.0f/3.0f, 3.0f);
vec3 p = abs(fract(c.xxx + K.xyz)*6.0f - K.www);
return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0f, 1.0f), c.y);
}
void main()
@@ -44,8 +44,8 @@ void main()
If the number is below 2, we keep iterating.
But when do we stop iterating if the number is always below 2 (it converges)?
That is what MAX_ITERATIONS is for.
Then we can divide the iterations by the MAX_ITERATIONS value to get a normalized value that we can
That is what maxIterations is for.
Then we can divide the iterations by the maxIterations value to get a normalized value that we can
then map to a color.
We use dot product (z.x * z.x + z.y * z.y) to determine the magnitude (length) squared.
@@ -54,14 +54,16 @@ void main()
// The pixel coordinates are scaled so they are on the mandelbrot scale
// NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom
vec2 z = vec2((fragTexCoord.x + offset.x/screenDims.x)*2.5/zoom, (fragTexCoord.y + offset.y/screenDims.y)*1.5/zoom);
vec2 z = vec2((fragTexCoord.x - 0.5f)*2.5f, (fragTexCoord.y - 0.5f)*1.5f)/zoom;
z.x += offset.x;
z.y += offset.y;
int iterations = 0;
for (iterations = 0; iterations < MAX_ITERATIONS; iterations++)
for (iterations = 0; iterations < maxIterations; iterations++)
{
z = ComplexSquare(z) + c; // Iterate function
if (dot(z, z) > 4.0) break;
if (dot(z, z) > 4.0f) break;
}
// Another few iterations decreases errors in the smoothing calculation.
@@ -70,12 +72,12 @@ void main()
z = ComplexSquare(z) + c;
// This last part smooths the color (again see link above).
float smoothVal = float(iterations) + 1.0 - (log(log(length(z)))/log(2.0));
float smoothVal = float(iterations) + 1.0f - (log(log(length(z)))/log(2.0f));
// Normalize the value so it is between 0 and 1.
float norm = smoothVal/float(MAX_ITERATIONS);
float norm = smoothVal/float(maxIterations);
// If in set, color black. 0.999 allows for some float accuracy error.
if (norm > 0.999) finalColor = vec4(0.0, 0.0, 0.0, 1.0);
else finalColor = vec4(Hsv2rgb(vec3(norm, 1.0, 1.0)), 1.0);
if (norm > 0.999f) finalColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
else finalColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0f, 1.0f)), 1.0f);
}

View File

@@ -19,12 +19,6 @@ out vec4 finalColor;
#define LIGHT_DIRECTIONAL 0
#define LIGHT_POINT 1
struct MaterialProperty {
vec3 color;
int useSampler;
sampler2D sampler;
};
struct Light {
int enabled;
int type;

View File

@@ -0,0 +1,23 @@
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec2 fragTexCoord2;
in vec3 fragPosition;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform sampler2D texture1;
// Output fragment color
out vec4 finalColor;
void main()
{
// Texel color fetching from texture sampler
vec4 texelColor = texture(texture0, fragTexCoord);
vec4 texelColor2 = texture(texture1, fragTexCoord2);
finalColor = texelColor * texelColor2;
}

View File

@@ -0,0 +1,29 @@
#version 330
// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec2 vertexTexCoord2;
in vec4 vertexColor;
// Input uniform values
uniform mat4 mvp;
uniform mat4 matModel;
// Output vertex attributes (to fragment shader)
out vec3 fragPosition;
out vec2 fragTexCoord;
out vec2 fragTexCoord2;
out vec4 fragColor;
void main()
{
// Send vertex attributes to fragment shader
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragTexCoord2 = vertexTexCoord2;
fragColor = vertexColor;
// Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
}

View File

@@ -0,0 +1,14 @@
#version 330 core
uniform sampler2D diffuseMap;
uniform vec2 tiling;
in vec2 fragTexCoord;
out vec4 fragColor;
void main()
{
vec2 texCoord = fragTexCoord * tiling;
fragColor = texture(diffuseMap, texCoord);
}

View File

@@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
uniform float secondes;
uniform float seconds;
uniform vec2 size;
@@ -30,8 +30,8 @@ void main() {
float boxTop = 0.0;
vec2 p = fragTexCoord;
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
finalColor = texture(texture0, p)*colDiffuse*fragColor;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -27,7 +27,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [shaders] example - Apply a postprocessing shader and connect a custom uniform variable
* raylib [shaders] example - Postprocessing with custom uniform variable
*
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
@@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -0,0 +1,336 @@
/*******************************************************************************************
*
* raylib [shaders] example - deferred rendering
*
* NOTE: This example requires raylib OpenGL 3.3 or OpenGL ES 3.0
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by Justin Andreas Lacoste (@27justin) and reviewed by Ramon Santamaria (@raysan5)
*
* 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) 2023 Justin Andreas Lacoste (@27justin)
*
********************************************************************************************/
#include "raylib.h"
#include "rlgl.h"
#include "raymath.h"
#define RLIGHTS_IMPLEMENTATION
#include "rlights.h"
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
#include <stdlib.h> // Required for: NULL
#define MAX_CUBES 30
typedef struct GBuffer {
unsigned int framebuffer;
unsigned int positionTexture;
unsigned int normalTexture;
unsigned int albedoSpecTexture;
unsigned int depthRenderbuffer;
} GBuffer;
typedef enum {
DEFERRED_POSITION,
DEFERRED_NORMAL,
DEFERRED_ALBEDO,
DEFERRED_SHADING
} DeferredMode;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
// -------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - deferred render");
Camera camera = { 0 };
camera.position = (Vector3){ 5.0f, 4.0f, 5.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 60.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load plane model from a generated mesh
Model model = LoadModelFromMesh(GenMeshPlane(10.0f, 10.0f, 3, 3));
Model cube = LoadModelFromMesh(GenMeshCube(2.0f, 2.0f, 2.0f));
// Load geometry buffer (G-buffer) shader and deferred shader
Shader gbufferShader = LoadShader("resources/shaders/glsl330/gbuffer.vs",
"resources/shaders/glsl330/gbuffer.fs");
Shader deferredShader = LoadShader("resources/shaders/glsl330/deferred_shading.vs",
"resources/shaders/glsl330/deferred_shading.fs");
deferredShader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(deferredShader, "viewPosition");
// Initialize the G-buffer
GBuffer gBuffer = { 0 };
gBuffer.framebuffer = rlLoadFramebuffer(screenWidth, screenHeight);
if (!gBuffer.framebuffer)
{
TraceLog(LOG_WARNING, "Failed to create framebuffer");
exit(1);
}
rlEnableFramebuffer(gBuffer.framebuffer);
// Since we are storing position and normal data in these textures,
// we need to use a floating point format.
gBuffer.positionTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
gBuffer.normalTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
// Albedo (diffuse color) and specular strength can be combined into one texture.
// The color in RGB, and the specular strength in the alpha channel.
gBuffer.albedoSpecTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
// Activate the draw buffers for our framebuffer
rlActiveDrawBuffers(3);
// Now we attach our textures to the framebuffer.
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.positionTexture, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0);
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.normalTexture, RL_ATTACHMENT_COLOR_CHANNEL1, RL_ATTACHMENT_TEXTURE2D, 0);
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.albedoSpecTexture, RL_ATTACHMENT_COLOR_CHANNEL2, RL_ATTACHMENT_TEXTURE2D, 0);
// Finally we attach the depth buffer.
gBuffer.depthRenderbuffer = rlLoadTextureDepth(screenWidth, screenHeight, true);
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.depthRenderbuffer, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
// Make sure our framebuffer is complete.
// NOTE: rlFramebufferComplete() automatically unbinds the framebuffer, so we don't have
// to rlDisableFramebuffer() here.
if (!rlFramebufferComplete(gBuffer.framebuffer))
{
TraceLog(LOG_WARNING, "Framebuffer is not complete");
exit(1);
}
// Now we initialize the sampler2D uniform's in the deferred shader.
// We do this by setting the uniform's value to the color channel slot we earlier
// bound our textures to.
rlEnableShader(deferredShader.id);
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gPosition"), 0);
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gNormal"), 1);
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gAlbedoSpec"), 2);
rlDisableShader();
// Assign out lighting shader to model
model.materials[0].shader = gbufferShader;
cube.materials[0].shader = gbufferShader;
// Create lights
//--------------------------------------------------------------------------------------
Light lights[MAX_LIGHTS] = { 0 };
lights[0] = CreateLight(LIGHT_POINT, (Vector3){ -2, 1, -2 }, Vector3Zero(), YELLOW, deferredShader);
lights[1] = CreateLight(LIGHT_POINT, (Vector3){ 2, 1, 2 }, Vector3Zero(), RED, deferredShader);
lights[2] = CreateLight(LIGHT_POINT, (Vector3){ -2, 1, 2 }, Vector3Zero(), GREEN, deferredShader);
lights[3] = CreateLight(LIGHT_POINT, (Vector3){ 2, 1, -2 }, Vector3Zero(), BLUE, deferredShader);
const float CUBE_SCALE = 0.25;
Vector3 cubePositions[MAX_CUBES] = { 0 };
float cubeRotations[MAX_CUBES] = { 0 };
for (int i = 0; i < MAX_CUBES; i++)
{
cubePositions[i] = (Vector3){
.x = (float)(rand()%10) - 5,
.y = (float)(rand()%5),
.z = (float)(rand()%10) - 5,
};
cubeRotations[i] = (float)(rand()%360);
}
DeferredMode mode = DEFERRED_SHADING;
rlEnableDepthTest();
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//---------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose())
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_ORBITAL);
// Update the shader with the camera view vector (points towards { 0.0f, 0.0f, 0.0f })
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
SetShaderValue(deferredShader, deferredShader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3);
// Check key inputs to enable/disable lights
if (IsKeyPressed(KEY_Y)) { lights[0].enabled = !lights[0].enabled; }
if (IsKeyPressed(KEY_R)) { lights[1].enabled = !lights[1].enabled; }
if (IsKeyPressed(KEY_G)) { lights[2].enabled = !lights[2].enabled; }
if (IsKeyPressed(KEY_B)) { lights[3].enabled = !lights[3].enabled; }
// Check key inputs to switch between G-buffer textures
if (IsKeyPressed(KEY_ONE)) mode = DEFERRED_POSITION;
if (IsKeyPressed(KEY_TWO)) mode = DEFERRED_NORMAL;
if (IsKeyPressed(KEY_THREE)) mode = DEFERRED_ALBEDO;
if (IsKeyPressed(KEY_FOUR)) mode = DEFERRED_SHADING;
// Update light values (actually, only enable/disable them)
for (int i = 0; i < MAX_LIGHTS; i++) UpdateLightValues(deferredShader, lights[i]);
//----------------------------------------------------------------------------------
// Draw
// ---------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw to the geometry buffer by first activating it
rlEnableFramebuffer(gBuffer.framebuffer);
rlClearScreenBuffers(); // Clear color and depth buffer
rlDisableColorBlend();
BeginMode3D(camera);
// NOTE: We have to use rlEnableShader here. `BeginShaderMode` or thus `rlSetShader`
// will not work, as they won't immediately load the shader program.
rlEnableShader(gbufferShader.id);
// When drawing a model here, make sure that the material's shaders
// are set to the gbuffer shader!
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
DrawModel(cube, (Vector3) { 0.0, 1.0f, 0.0 }, 1.0f, WHITE);
for (int i = 0; i < MAX_CUBES; i++)
{
Vector3 position = cubePositions[i];
DrawModelEx(cube, position, (Vector3) { 1, 1, 1 }, cubeRotations[i], (Vector3) { CUBE_SCALE, CUBE_SCALE, CUBE_SCALE }, WHITE);
}
rlDisableShader();
EndMode3D();
rlEnableColorBlend();
// Go back to the default framebuffer (0) and draw our deferred shading.
rlDisableFramebuffer();
rlClearScreenBuffers(); // Clear color & depth buffer
switch (mode)
{
case DEFERRED_SHADING:
{
BeginMode3D(camera);
rlDisableColorBlend();
rlEnableShader(deferredShader.id);
// Activate our g-buffer textures
// These will now be bound to the sampler2D uniforms `gPosition`, `gNormal`,
// and `gAlbedoSpec`
rlActiveTextureSlot(0);
rlEnableTexture(gBuffer.positionTexture);
rlActiveTextureSlot(1);
rlEnableTexture(gBuffer.normalTexture);
rlActiveTextureSlot(2);
rlEnableTexture(gBuffer.albedoSpecTexture);
// Finally, we draw a fullscreen quad to our default framebuffer
// This will now be shaded using our deferred shader
rlLoadDrawQuad();
rlDisableShader();
rlEnableColorBlend();
EndMode3D();
// As a last step, we now copy over the depth buffer from our g-buffer to the default framebuffer.
rlEnableFramebuffer(gBuffer.framebuffer); //glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer.framebuffer);
rlEnableFramebuffer(0); //glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
rlBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0x00000100); // GL_DEPTH_BUFFER_BIT
rlDisableFramebuffer();
// Since our shader is now done and disabled, we can draw our lights in default
// forward rendering
BeginMode3D(camera);
rlEnableShader(rlGetShaderIdDefault());
for(int i = 0; i < MAX_LIGHTS; i++)
{
if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lights[i].color);
else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lights[i].color, 0.3f));
}
rlDisableShader();
EndMode3D();
DrawText("FINAL RESULT", 10, screenHeight - 30, 20, DARKGREEN);
} break;
case DEFERRED_POSITION:
{
DrawTextureRec((Texture2D){
.id = gBuffer.positionTexture,
.width = screenWidth,
.height = screenHeight,
}, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE);
DrawText("POSITION TEXTURE", 10, screenHeight - 30, 20, DARKGREEN);
} break;
case DEFERRED_NORMAL:
{
DrawTextureRec((Texture2D){
.id = gBuffer.normalTexture,
.width = screenWidth,
.height = screenHeight,
}, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE);
DrawText("NORMAL TEXTURE", 10, screenHeight - 30, 20, DARKGREEN);
} break;
case DEFERRED_ALBEDO:
{
DrawTextureRec((Texture2D){
.id = gBuffer.albedoSpecTexture,
.width = screenWidth,
.height = screenHeight,
}, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE);
DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, DARKGREEN);
} break;
}
DrawText("Toggle lights keys: [Y][R][G][B]", 10, 40, 20, DARKGRAY);
DrawText("Switch G-buffer textures: [1][2][3][4]", 10, 70, 20, DARKGRAY);
DrawFPS(10, 10);
EndDrawing();
// -----------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(model); // Unload the models
UnloadModel(cube);
UnloadShader(deferredShader); // Unload shaders
UnloadShader(gbufferShader);
// Unload geometry buffer and all attached textures
rlUnloadFramebuffer(gBuffer.framebuffer);
rlUnloadTexture(gBuffer.positionTexture);
rlUnloadTexture(gBuffer.normalTexture);
rlUnloadTexture(gBuffer.albedoSpecTexture);
rlUnloadTexture(gBuffer.depthRenderbuffer);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -29,7 +29,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -27,7 +27,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -21,7 +21,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -1,4 +1,4 @@
/*******************************************************************************************
/*******************************************************************************************
*
* raylib [shaders] example - Hybrid Rendering
*
@@ -20,7 +20,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
@@ -68,7 +68,7 @@ int main(void)
marchLocs.screenCenter = GetShaderLocation(shdrRaymarch, "screenCenter");
// Transfer screenCenter position to shader. Which is used to calculate ray direction.
Vector2 screenCenter = {.x = screenWidth/2.0, .y = screenHeight/2.0};
Vector2 screenCenter = {.x = screenWidth/2.0f, .y = screenHeight/2.0f};
SetShaderValue(shdrRaymarch, marchLocs.screenCenter , &screenCenter , SHADER_UNIFORM_VEC2);
// Use Customized function to create writable depth texture buffer
@@ -84,7 +84,7 @@ int main(void)
};
// Camera FOV is pre-calculated in the camera Distance.
double camDist = 1.0/(tan(camera.fovy*0.5*DEG2RAD));
float camDist = 1.0f/(tanf(camera.fovy*0.5f*DEG2RAD));
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -113,7 +113,7 @@ int main(void)
// Raymarch Scene
rlEnableDepthTest(); //Manually enable Depth Test to handle multiple rendering methods.
BeginShaderMode(shdrRaymarch);
DrawRectangleRec((Rectangle){0,0,screenWidth,screenHeight},WHITE);
DrawRectangleRec((Rectangle){0,0, (float)screenWidth, (float)screenHeight},WHITE);
EndShaderMode();
// Raserize Scene
@@ -132,7 +132,7 @@ int main(void)
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTextureRec(target.texture, (Rectangle) { 0, 0, screenWidth, -screenHeight }, (Vector2) { 0, 0 }, WHITE);
DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, (Vector2) { 0, 0 }, WHITE);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------

View File

@@ -9,12 +9,12 @@
*
* Example originally created with raylib 2.5, last time updated with raylib 4.0
*
* Example contributed by eggmund (@eggmund) and reviewed by Ramon Santamaria (@raysan5)
* Example contributed by Josh Colclough (@joshcol9232) and reviewed by Ramon Santamaria (@raysan5)
*
* 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) 2019-2023 eggmund (@eggmund) and Ramon Santamaria (@raysan5)
* Copyright (c) 2019-2023 Josh Colclough (@joshcol9232) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
@@ -37,6 +37,13 @@ const float pointsOfInterest[6][2] =
{ -0.70176f, -0.3842f },
};
const int screenWidth = 800;
const int screenHeight = 450;
const float zoomSpeed = 1.01f;
const float offsetSpeedMul = 2.0f;
const float startingZoom = 0.75f;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -44,10 +51,6 @@ int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
//SetConfigFlags(FLAG_WINDOW_HIGHDPI);
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - julia sets");
// Load julia set shader
@@ -61,10 +64,8 @@ int main(void)
float c[2] = { pointsOfInterest[0][0], pointsOfInterest[0][1] };
// Offset and zoom to draw the julia set at. (centered on screen and default size)
float offset[2] = { -(float)GetScreenWidth()/2, -(float)GetScreenHeight()/2 };
float zoom = 1.0f;
Vector2 offsetSpeed = { 0.0f, 0.0f };
float offset[2] = { 0.0f, 0.0f };
float zoom = startingZoom;
// Get variable (uniform) locations on the shader to connect with the program
// NOTE: If uniform variable could not be found in the shader, function returns -1
@@ -72,17 +73,13 @@ int main(void)
int zoomLoc = GetShaderLocation(shader, "zoom");
int offsetLoc = GetShaderLocation(shader, "offset");
// Tell the shader what the screen dimensions, zoom, offset and c are
float screenDims[2] = { (float)GetScreenWidth(), (float)GetScreenHeight() };
SetShaderValue(shader, GetShaderLocation(shader, "screenDims"), screenDims, SHADER_UNIFORM_VEC2);
// Upload the shader uniform values!
SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2);
int incrementSpeed = 0; // Multiplier of speed to change c value
bool showControls = true; // Show controls
bool pause = false; // Pause animation
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -110,42 +107,50 @@ int main(void)
SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
}
if (IsKeyPressed(KEY_SPACE)) pause = !pause; // Pause animation (c change)
if (IsKeyPressed(KEY_F1)) showControls = !showControls; // Toggle whether or not to show controls
if (!pause)
// If "R" is pressed, reset zoom and offset.
if (IsKeyPressed(KEY_R))
{
if (IsKeyPressed(KEY_RIGHT)) incrementSpeed++;
else if (IsKeyPressed(KEY_LEFT)) incrementSpeed--;
// TODO: The idea is to zoom and move around with mouse
// Probably offset movement should be proportional to zoom level
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
{
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) zoom += zoom*0.003f;
if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) zoom -= zoom*0.003f;
Vector2 mousePos = GetMousePosition();
offsetSpeed.x = mousePos.x -(float)screenWidth/2;
offsetSpeed.y = mousePos.y -(float)screenHeight/2;
// Slowly move camera to targetOffset
offset[0] += GetFrameTime()*offsetSpeed.x*0.8f;
offset[1] += GetFrameTime()*offsetSpeed.y*0.8f;
}
else offsetSpeed = (Vector2){ 0.0f, 0.0f };
zoom = startingZoom;
offset[0] = 0.0f;
offset[1] = 0.0f;
SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2);
// Increment c value with time
float amount = GetFrameTime()*incrementSpeed*0.0005f;
c[0] += amount;
c[1] += amount;
SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
}
if (IsKeyPressed(KEY_SPACE)) incrementSpeed = 0; // Pause animation (c change)
if (IsKeyPressed(KEY_F1)) showControls = !showControls; // Toggle whether or not to show controls
if (IsKeyPressed(KEY_RIGHT)) incrementSpeed++;
else if (IsKeyPressed(KEY_LEFT)) incrementSpeed--;
// If either left or right button is pressed, zoom in/out.
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
{
// Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out.
zoom *= IsMouseButtonDown(MOUSE_BUTTON_LEFT)? zoomSpeed : 1.0f/zoomSpeed;
const Vector2 mousePos = GetMousePosition();
Vector2 offsetVelocity;
// Find the velocity at which to change the camera. Take the distance of the mouse
// from the center of the screen as the direction, and adjust magnitude based on
// the current zoom.
offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5f)*offsetSpeedMul/zoom;
offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5f)*offsetSpeedMul/zoom;
// Apply move velocity to camera
offset[0] += GetFrameTime()*offsetVelocity.x;
offset[1] += GetFrameTime()*offsetVelocity.y;
// Update the shader uniform values!
SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2);
}
// Increment c value with time
const float dc = GetFrameTime()*(float)incrementSpeed*0.0005f;
c[0] += dc;
c[1] += dc;
SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
//----------------------------------------------------------------------------------
// Draw
@@ -178,7 +183,8 @@ int main(void)
DrawText("Press KEY_F1 to toggle these controls", 10, 30, 10, RAYWHITE);
DrawText("Press KEYS [1 - 6] to change point of interest", 10, 45, 10, RAYWHITE);
DrawText("Press KEY_LEFT | KEY_RIGHT to change speed", 10, 60, 10, RAYWHITE);
DrawText("Press KEY_SPACE to pause movement animation", 10, 75, 10, RAYWHITE);
DrawText("Press KEY_SPACE to stop movement animation", 10, 75, 10, RAYWHITE);
DrawText("Press KEY_R to recenter the camera", 10, 90, 10, RAYWHITE);
}
EndDrawing();
//----------------------------------------------------------------------------------

View File

@@ -0,0 +1,173 @@
/*******************************************************************************************
*
* raylib [shaders] example - lightmap
*
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
*
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
*
* Example contributed by Jussi Viitala (@nullstare) and reviewed by Ramon Santamaria (@raysan5)
*
* 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) 2019-2023 Jussi Viitala (@nullstare) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "raylib.h"
#include "raymath.h"
#include "rlgl.h"
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
#define MAP_SIZE 10
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - lightmap");
// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 4.0f, 6.0f, 8.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Mesh mesh = GenMeshPlane((float)MAP_SIZE, (float)MAP_SIZE, 1, 1);
// GenMeshPlane doesn't generate texcoords2 so we will upload them separately
mesh.texcoords2 = (float *)RL_MALLOC(mesh.vertexCount*2*sizeof(float));
// X // Y
mesh.texcoords2[0] = 0.0f; mesh.texcoords2[1] = 0.0f;
mesh.texcoords2[2] = 1.0f; mesh.texcoords2[3] = 0.0f;
mesh.texcoords2[4] = 0.0f; mesh.texcoords2[5] = 1.0f;
mesh.texcoords2[6] = 1.0f; mesh.texcoords2[7] = 1.0f;
// Load a new texcoords2 attributes buffer
mesh.vboId[SHADER_LOC_VERTEX_TEXCOORD02] = rlLoadVertexBuffer(mesh.texcoords2, mesh.vertexCount*2*sizeof(float), false);
rlEnableVertexArray(mesh.vaoId);
// Index 5 is for texcoords2
rlSetVertexAttribute(5, 2, RL_FLOAT, 0, 0, 0);
rlEnableVertexAttribute(5);
rlDisableVertexArray();
// Load lightmap shader
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/lightmap.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/lightmap.fs", GLSL_VERSION));
Texture texture = LoadTexture("resources/cubicmap_atlas.png");
Texture light = LoadTexture("resources/spark_flame.png");
GenTextureMipmaps(&texture);
SetTextureFilter(texture, TEXTURE_FILTER_TRILINEAR);
RenderTexture lightmap = LoadRenderTexture(MAP_SIZE, MAP_SIZE);
SetTextureFilter(lightmap.texture, TEXTURE_FILTER_TRILINEAR);
Material material = LoadMaterialDefault();
material.shader = shader;
material.maps[MATERIAL_MAP_ALBEDO].texture = texture;
material.maps[MATERIAL_MAP_METALNESS].texture = lightmap.texture;
// Drawing to lightmap
BeginTextureMode(lightmap);
ClearBackground(BLACK);
BeginBlendMode(BLEND_ADDITIVE);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 0, 0, 20, 20 },
(Vector2){ 10.0, 10.0 },
0.0,
RED
);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 8, 4, 20, 20 },
(Vector2){ 10.0, 10.0 },
0.0,
BLUE
);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 8, 8, 10, 10 },
(Vector2){ 5.0, 5.0 },
0.0,
GREEN
);
BeginBlendMode(BLEND_ALPHA);
EndTextureMode();
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_ORBITAL);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawMesh(mesh, material, MatrixIdentity());
EndMode3D();
DrawFPS(10, 10);
DrawTexturePro(
lightmap.texture,
(Rectangle){ 0, 0, -MAP_SIZE, -MAP_SIZE },
(Rectangle){ GetRenderWidth() - MAP_SIZE*8 - 10, 10, MAP_SIZE*8, MAP_SIZE*8 },
(Vector2){ 0.0, 0.0 },
0.0,
WHITE);
DrawText("lightmap", GetRenderWidth() - 66, 16 + MAP_SIZE*8, 10, GRAY);
DrawText("10x10 pixels", GetRenderWidth() - 76, 30 + MAP_SIZE*8, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadMesh(mesh); // Unload the mesh
UnloadShader(shader); // Unload shader
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

View File

@@ -24,7 +24,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

View File

@@ -22,7 +22,7 @@
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#else // PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif

Some files were not shown because too many files have changed in this diff Show More