967 Commits
5.5 ... master

Author SHA1 Message Date
Ray
16a0b966c3 Update rexm.c 2025-09-06 00:09:22 +02:00
Ray
4af48fba74 REXM: REVIEWED: UpdateSourceMetadata() and TextReplaceBetween() 2025-09-06 00:04:07 +02:00
Ray
446f015ac5 Review formating 2025-09-05 23:10:13 +02:00
Ray
b2684a9c38 Merge branch 'master' of https://github.com/raysan5/raylib 2025-09-05 23:07:46 +02:00
Ray
86ec1c08c2 Update rexm.c 2025-09-05 23:07:29 +02:00
Eike Decker
bd810368b0 Fixing base64 decoding error when input string is bad (#5170)
The following code would crash the previous version when calling MemFree:

	// 53 * A
        const char maliciousBase64Input[] = "AAAAAAAAAAAAAAAAAAAAAAAA"
		"AAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
        int decodedSize = 0;
        unsigned char *decodedData = DecodeDataBase64(
		maliciousBase64Input, &decodedSize);
        if (decodedData) {
		MemFree(decodedData);
        }

The reason is a lack of array bound checks in the decoding loop, which
corrupted here the heap (though this is platform dependent).

Adding the bound checks here prevents the memory corruption.

Tested with encoding random data of sizes 0-1023 and comparing it
with the decoded result.
2025-09-05 23:05:08 +02:00
Ray
eb816898e5 Revert "Added creation-review years to examples"
This reverts commit b5e25916fc.
2025-09-05 23:02:06 +02:00
Ray
84e606b8c7 Update rexm.c 2025-09-05 23:00:36 +02:00
Ray
1d4d8da3e9 Removed temp code to generate updated examples_list.txt 2025-09-05 22:59:42 +02:00
Ray
3e59797a68 REXM: ADDED: Read examples years created/reviewed info
ADDED: `UpdateSourceMetadata()`
2025-09-05 14:10:26 +02:00
Ray
424cdebda5 Updated examples_list.txt to include example year created/reviewed
Reviewed star used, aligned with empty star and examples header
2025-09-05 14:04:28 +02:00
Ray
b5e25916fc Added creation-review years to examples 2025-09-05 11:25:24 +02:00
Ray
47bdfb91a2 Update README.md 2025-09-05 10:57:25 +02:00
Ray
8e52aee853 Update rtext.c 2025-09-05 00:13:32 +02:00
Ray
389800fd34 REXM: REVIEWED: ScanExampleResources() 2025-09-04 23:55:23 +02:00
Ray
43305c4865 REXM: ADDED: RemoveVSProjectFromSolution() 2025-09-04 23:54:57 +02:00
Ray
d980642421 Merge branch 'master' of https://github.com/raysan5/raylib 2025-09-04 23:54:17 +02:00
Ray
51aa8776bb Update rtext.c 2025-09-04 23:53:26 +02:00
github-actions[bot]
55a1c58b64 Update raylib_api.* by CI 2025-09-04 21:26:00 +00:00
Ray
0203a47bf9 REDESIGNED: LoadTextLines()/UnloadTextLines() 2025-09-04 23:25:42 +02:00
Ray
8116ebd9bb Update rexm.c 2025-09-04 19:15:47 +02:00
Ray
a51cb7fe30 REXM: Updated some examples inconsistencies 2025-09-04 19:15:37 +02:00
Ray
91bc8d9b10 REXM: Remove duplicate entries on examples list on Update process 2025-09-04 18:57:32 +02:00
Ray
7646d08751 Updated some examples with inconsistencies 2025-09-04 18:57:00 +02:00
Ray
fb42819eab Added project to folder in solution 2025-09-04 16:56:38 +02:00
Ray
d418704c0b REXM: Update examples collection 2025-09-04 16:17:23 +02:00
Ray
293477e2b5 Reorganized examples list 2025-09-04 16:05:54 +02:00
Ray
6d7dd43c13 Update core_input_gestures_testbed.c 2025-09-04 16:05:38 +02:00
Ray
e21093d434 REXM: RENAME: example: core_input_gestures_web --> core_input_gestures_testbed 2025-09-04 15:59:53 +02:00
Ray
c17f82a78c REMOVED: core_basic_window_web
The example is not following examples conventions and it will be moved to `others` with a new name
2025-09-04 15:43:54 +02:00
Ray
d97e0a8ac7 REXM: RENAME: example: shaders_texture_drawing --> shaders_texture_rendering 2025-09-04 11:27:32 +02:00
Ray
427b0d2653 Update rexm.c 2025-09-04 11:26:39 +02:00
Ray
5f9465d569 Update rexm.c 2025-09-04 11:21:52 +02:00
Ray
d79f294af0 Update rexm.c 2025-09-04 11:20:48 +02:00
Ray
41dee9e9f9 REXM: RENAME: example: shaders_fog --> shaders_fog_rendering 2025-09-04 11:12:01 +02:00
Ray
3cbe911613 REXM: RENAME: example: models_billboard --> models_billboard_rendering 2025-09-04 11:04:00 +02:00
Ray
b17936de22 REXM: RENAME: example: models_billboard --> models_billboard_rendering 2025-09-04 10:55:48 +02:00
Ray
3659eee994 Update rexm.c 2025-09-04 10:50:35 +02:00
Ray
ba046a5d60 REVIEWED: DecompressData(), fixed buffer copying 2025-09-04 10:44:20 +02:00
Ray
f9e6c85cce Update rexm.c 2025-09-04 10:40:17 +02:00
Ray
9b99c5b04e REXM: Adding some UpdateSourceMetadata() -WIP- 2025-09-04 10:34:39 +02:00
Ray
64641c6a01 Update raudio.c 2025-09-04 10:33:26 +02:00
Ray
dd0587e12a Update shaders_texture_drawing.c 2025-09-04 10:33:22 +02:00
Ray
2e376c6f5b Update shaders_spotlight.c 2025-09-04 10:33:14 +02:00
Ray
48eac60171 REVIEWED: Potential issue with animated normals on OpenGL 1.1 2025-09-03 23:14:58 +02:00
Ray
2a295210fb Update shaders_spotlight.c 2025-09-03 19:58:38 +02:00
Ray
1008066644 Removed core_loading_thread project 2025-09-03 19:58:26 +02:00
Ray
a7e62e73d8 REXM: REMOVE: example: core_loading_thread
This example was POSIX only and had some special requirements for web, it made it more difficult to be managed from collection standard examples format.

It will be re-added in the `others` category, that is not processed for web.
2025-09-03 19:00:33 +02:00
Ray
5cbe013273 REXM: RENAME: example: models_skybox --> models_skybox_rendering 2025-09-03 18:48:20 +02:00
Ray
d8ee8a45c4 REXM: RENAME: example: textures_draw_tiled --> textures_tiled_drawing 2025-09-03 18:45:50 +02:00
Ray
33327760f1 REXM: RENAME: example: text_draw_3d --> text_3d_drawing 2025-09-03 18:43:17 +02:00
Ray
785ad4015c REXM: RENAME: example: textures_polygon --> textures_polygon_drawing 2025-09-03 18:40:53 +02:00
Ray
cadd28e5a0 REXM: RENAME: example: text_raylib_fonts -> text_sprite_fonts 2025-09-03 18:33:33 +02:00
Ray
2cb387b50a REVIEWED: Font atlas image generation, added some comments #5141 2025-09-03 18:30:00 +02:00
Ray
f53cd449ce Update config.h 2025-09-03 18:25:27 +02:00
Nikolas
b7eda8159c [build.zig] Make X11 the default display backend instead of choosing at runtime (#5168) 2025-09-03 18:17:07 +02:00
Ray
64d6a90d48 REXM: RENAME: example: text_unicode --> text_unicode_emojis 2025-09-03 18:14:47 +02:00
Ray
3a0c8009af Update rexm.c 2025-09-03 18:14:18 +02:00
Ray
d1768d387c Update utils.c 2025-09-03 13:37:08 +02:00
Ray
c579eef4b7 REVIEWED: Examples section comments, for better organization and consistency 2025-09-03 10:40:31 +02:00
Ray
1fa3c15942 Revert "add const qualifier to the first arg of TextJoin (#5166)"
This reverts commit 4e8d08523f.
2025-09-02 19:00:22 +02:00
JohnnyCena123
4e8d08523f add const qualifier to the first arg of TextJoin (#5166)
* add const qualifier to the first arg of TextJoin

* Update raylib_api.* by CI

* Update raylib.h

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ray <raysan5@gmail.com>
2025-09-02 18:58:39 +02:00
Ray
cb6a64843c Remove raylib logs 2025-09-02 18:52:10 +02:00
Ray
4fa8e23efc Update rexm.c 2025-09-02 18:52:00 +02:00
Ray
1dfff2252d rexm update 2025-09-02 18:44:27 +02:00
Ray
cf61a8b888 REXM: Update examples report 2025-09-02 18:38:20 +02:00
Ray
bcd46fb36b Update rexm.c 2025-09-02 18:38:04 +02:00
Ray
9fab2c8a13 REVIEWED: example: text_unicode_ranges 2025-09-02 18:34:58 +02:00
Ray
0fd5a1a3f5 REDESIGNED: example: text_unicode_ranges 2025-09-02 17:47:25 +02:00
Ray
d5ea6a87d9 Merge branch 'master' of https://github.com/raysan5/raylib 2025-09-02 17:47:13 +02:00
github-actions[bot]
17d9927a4f Update raylib_api.* by CI 2025-09-02 15:46:09 +00:00
Ray
b16d14f5ed Update text_font_sdf.c 2025-09-02 17:45:52 +02:00
Ray
29ce5d8aa9 WARNING: BREAKING: LoadFontData() redesigned, added parameter
This redesign is a big improvement on font loading time and memory requirements. It only loads glyphs available on font from requested codepoints and only processes those glyphs for packaging. When processing +10K codepoints (CJK), the loading time improves considerably.
2025-09-02 17:45:39 +02:00
Ray
aa475b1046 REVIEWED: Code sections description for consistency 2025-09-02 12:34:04 +02:00
Ray
8b3c68f8b5 Update core_random_sequence.c 2025-09-02 12:18:19 +02:00
Ray
8f32c502a7 REVIEWED: Code sections definition 2025-09-02 12:10:40 +02:00
Ray
b6ae380260 REVIEWED: Examples comments, consistent code sections 2025-09-02 12:10:16 +02:00
Ray
864459cbd2 Update core_3d_camera_fps.c 2025-09-01 20:59:37 +02:00
Ray
e18d167c8f REVIEWED: New examples added renaming, avoid duplicated .sln GUIDs 2025-09-01 20:47:59 +02:00
Ray
1777da9056 REVIEWED: Avoid realloc() calls, small security improvement 2025-09-01 20:37:23 +02:00
Ray
6226abb0d3 Merge branch 'master' of https://github.com/raysan5/raylib 2025-09-01 11:39:20 +02:00
Ray
708c1539e4 Update rtextures.c 2025-09-01 11:38:57 +02:00
github-actions[bot]
917533224f Update raylib_api.* by CI 2025-09-01 09:27:38 +00:00
Ray
0a92c863c4 Reverted const codepoints to avoid warnings 2025-09-01 11:27:11 +02:00
Ray
12ce72c32d REVIEWED: ExportImage() 2025-09-01 11:24:53 +02:00
wileyanderssen
998a18b641 removed macro that does nothing (#5163) 2025-09-01 11:17:51 +02:00
github-actions[bot]
223feca13a Update raylib_api.* by CI 2025-09-01 05:56:44 +00:00
0_stamina
7d07d21ee5 Update Camera3D.fovy description in raylib.h (#5164)
Previously stated it was the near plane width in orthographic, in actuality it's the height. The wording has been fixed, with added clarity that it's in world units so no conversion is needed.
2025-09-01 07:56:31 +02:00
Ray
82d65e110a Update build status badges 2025-08-31 12:22:50 +02:00
Jonathan Marler
f61c2c504d [rcore][win32] Adding native win32 backend (#4869)
* win32 backend

* [rcore][win32] use SwapBuffers instead of wglSwapLayerBuffers

I don't understand OpenGL well enough to know the difference between
SwapBuffers and wglSwapLayerBuffers but the former seems to double
my FPS (from 2000 to about 4000 in core_vr_simulator).

* [rcore][win32] stop lying to the OS about when our window is updated

Instead of calling BeginPaint/EndPaint in WM_PAINT which signals to the
OS that our window content is updated, now when we encounter the WM_PAINT
message instead we return back to the raylib application which will
trigger it to render a new frame. We've replaced the call to BeginPaint
and EndPaint with a call to ValidateRect in SwapBuffers, which, means
we're now correctly telling the OS when our window content is actually
up-to-date.

Note that this doesn't fix the window content not being updated during
a window resize/move beacuse thos have their own message loop which
doesn't return early when it's time to paint.

* [rcore][win32] fallback to finding functions from opengl32.dll

* [rcore][win32] fixes from review/for gcc

* [rcore][win32] incorporate style conventions

* [rcore][win32] workaround unused function error SetupFramebuffer

* [rcore][win32] re-enable sanitize flags check for MSAA_4X

* [rcore][win32] more style changes and remove old DPI cases

Added some more missing spaces after conditional statements.  Also
made unsupported MSAA_4X an assert instead of an abort and also
removed dpi-aware cases for older OS's.  More changes would be needed
to support those OS versions, namely, removing the dependency
on shcore.

* [rcore][win32] fixes for compling with w64devkit without -DUNICODE

* Update build.zig

* Update build.zig

---------

Co-authored-by: Ray <raysan5@gmail.com>
2025-08-31 12:13:21 +02:00
Ray
ecf032fe4f REVIEW: Avoid warning on fgets() return value 2025-08-31 12:11:48 +02:00
github-actions[bot]
d7f82aa7ae Update raylib_api.* by CI 2025-08-31 10:11:18 +00:00
Ray
edce3d41b2 REVERT: Making codepoints const, variable is used to generate list in case it was NULL 2025-08-31 12:11:03 +02:00
github-actions[bot]
f2adb0272d Update raylib_api.* by CI 2025-08-31 09:39:29 +00:00
Ray
ecedf40da6 REVIEW: const for codepoints arrays passed to function #5159 2025-08-31 11:39:14 +02:00
wileyanderssen
fce888c0c0 changed function params formatting (#5160) 2025-08-31 11:34:39 +02:00
maiphi
d9cb078299 FindNearestConnectorMode: prefer mode with smallest number of unused pixels (#5158)
Co-authored-by: Philipp Maierhoefer <particle@maierhoefer.net>
2025-08-31 11:34:05 +02:00
HaxSam
0d29d8d4b1 [build.zig]: a concrete approach to build for web with zig-build (#5157) 2025-08-31 11:32:19 +02:00
Ray
bbf884d7b3 Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-29 21:32:34 +02:00
Ray
f0e49787cd minor tweak 2025-08-29 21:32:21 +02:00
JohnnyCena123
0e73e0ea64 reviewed ALL non-external files to follow raylib's convention of no spaces around / or * (#5153) 2025-08-29 14:53:16 +02:00
Hamza RAHAL
507c85900f fix: [digital_clock] minute hand doesn't appear (#5151) 2025-08-28 22:32:41 +02:00
Artem V. Ageev
03617e0bdd Add raylib-ada to BINDINGS.md (#5150) 2025-08-28 22:31:39 +02:00
JohnnyCena123
481daf2423 remove extra backslash in fix_win32_compatibility.h (#5148) 2025-08-28 22:30:25 +02:00
JohnnyCena123
4a4997c615 fix unnecessary warnings in some files (#5152) 2025-08-28 22:28:56 +02:00
github-actions[bot]
7103703313 Update raylib_api.* by CI 2025-08-26 08:17:48 +00:00
Ray
d2f6c4924c ADDED: [rtext] LoadTextLines()/UnloadTextLines() 2025-08-26 10:17:33 +02:00
Ray
ed3b5b2649 Update rexm.c 2025-08-26 09:23:18 +02:00
Ray
42abcb9492 Updated examples init window title 2025-08-26 00:36:32 +02:00
Ray
a72b4b177b Updated examples short description 2025-08-26 00:32:24 +02:00
Ray
a67b49498f Update rexm.c 2025-08-26 00:24:01 +02:00
Ray
3b16a72302 REXM: Allow building web examples locally on Windows platform 2025-08-25 21:23:30 +02:00
Ray
6343251857 Update rexm.c 2025-08-25 21:13:44 +02:00
Ray
60ac8f2a86 Renamed example 2025-08-25 21:11:37 +02:00
Ray
47db1da9ea REXM: RENAMED: example: core_3d_fps_controller to core_3d_camera_fps 2025-08-25 20:58:09 +02:00
Ray
8b68d548c9 Reviewing some examples titles 2025-08-25 20:57:18 +02:00
Ray
b04a94d1e1 Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-25 20:56:20 +02:00
Ray
f9af011965 Update core_window_letterbox.c 2025-08-25 20:56:05 +02:00
annaymone
99c4d4b597 Add pub to compileRaylib (#5143)
This is necessary to allow for using the function in dependent `build.zig`s.
2025-08-25 00:55:13 +02:00
Ray
79497e1c88 REXM: Updated reports 2025-08-24 12:02:24 +02:00
Ray
2e95cdb2b5 Minor comment tweaks 2025-08-24 12:01:58 +02:00
Ray
c9564c0de8 Update update_examples.yml 2025-08-24 12:01:46 +02:00
JohnnyCena123
e796b00eb0 [workflows] (almost) rewrite update_examples.yml workflow (#5130)
* debug print the working directory

* trigger it on any branch (temporarily)

* nope, wrong fix

* dummy commit to trigger the workflow

* lets see if this works

* trigger the workflow when updating it

* nice typo

* add missing dollar signs

* debug list the contents of the repository

* dir/s instead of ls

* remove this, no longer needed

* backslashes maybe? windows...

* this should be a forward slash

* remove no longer needed spam

* debug check if examples dir exists

* LOG is disabled apparently

* ...

* temporarily disable this step to save time

* ubuntu maybe

* bash

* install deps

* link libc

* link libm

* now to test the rest

* emsdk is back

* add missing shaders

* Update examples collection

* add indentation

* remove emsdk cache

* ignore emsdk cache

* Update examples collection

* fix errors with the find command

* remove emsdk cache now

* i forgot to actually add it to gitignore

* fix error with git not finding anything to commit

* global config instead of repo specific

* clone raylib.com repo under the same owner as the raylib repo owner

* add proper access token

* reorganize it all

* remove non-existent example

* clone raylib.com before running rexm

* no extra slash

* Update examples collection

* copy updated examples to the right place

* remove unnecessary debug line from rexm.c

* Update examples collection

* Update examples collection

* use hardcoded absolute path to make

* add debug line

* semicolon

* fix wrong handling of make path

* fix wrong cwd

* rebuild raylib for web after installing it

* cleanuo

* conditionally push to repos, never on PR

* build rexm with make for consistency

* remove workflow run results

* add back the examples report files

* pause automatic commits

* revert makefile changes

* readd removed vs2022 project file

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-24 11:56:49 +02:00
Ray
04a3ab0ca7 REVIEW: Added warning in case of no [rcore] backend defined 2025-08-24 11:23:15 +02:00
Ray
52980c947d REVIEWED: [rtext] Provide more detailed info on glyphs failing to pack #5141 2025-08-24 11:07:55 +02:00
Ray
4d0c3affaa REXM: Update examples and lists 2025-08-24 10:53:47 +02:00
Ray
0e5837fb86 REXM: Fixed some issues, improved make call defining base path 2025-08-24 10:53:19 +02:00
Ray
f60333d9b2 Update update_examples.yml 2025-08-23 22:19:51 +02:00
Ray
785965fcef Update update_examples.yml 2025-08-23 22:18:17 +02:00
Ray
d0e6f60ef3 Update update_examples.yml 2025-08-23 22:13:18 +02:00
Ray
6c4f220e89 Update update_examples.yml 2025-08-23 22:07:39 +02:00
Ray
c95630b7d0 Update update_examples.yml 2025-08-23 22:00:06 +02:00
Ray
e9f655d002 Update update_examples.yml 2025-08-23 21:54:09 +02:00
Ray
41211b0c8c Update update_examples.yml 2025-08-23 21:45:50 +02:00
Ray
d320a029c8 REXM: Reviewed building, using default examples Makefile/Makefile.Web 2025-08-23 21:44:28 +02:00
Ray
f83c5cb6e1 Merge pull request #5138 from maiconpintoabreu/fix-glsl100
[examples][shaders] set glsl100 back to 100
2025-08-23 14:59:32 +02:00
Maicon Santana
69021939e6 fix write_depth.fs glsl120 2025-08-23 13:06:56 +01:00
Ray
9cc9f3bbbe Merge pull request #5139 from Siltnamis/stbtt_rl_malloc
use RL_MALLOC in stb_truetype
2025-08-23 13:07:04 +02:00
Siltnamis
3c9c66e72b use RL_MALLOC in stb_truetype 2025-08-23 13:10:27 +03:00
Maicon Santana
c6d7694286 set glsl100 back to 100 2025-08-23 10:17:11 +01:00
Ray
11bf3996cf REDM: Add web metadata validation and update 2025-08-23 02:00:21 +02:00
Ray
a7aeb2f2b5 REXM: Add example build option 2025-08-23 01:59:24 +02:00
Ray
500494f791 Update core_3d_fps_controller.c 2025-08-23 00:02:19 +02:00
Ray
1d17be6c1c Merge pull request #5137 from feive7/master
Clamp camera pitch
2025-08-22 23:41:34 +02:00
Ray
ce1cd0d7e6 Merge pull request #5128 from CashWasabi/zig-0.15
[build] Update `build.zig` (breaking)
2025-08-22 08:19:35 +02:00
Marcel Ochs
566eb34ff8 Update build.zig 2025-08-21 23:15:05 +02:00
feive7
8b0cbb6f47 Clamp camera pitch 2025-08-21 11:10:13 -07:00
Ray
ce8bcb332b Using internal defined File*() functions 2025-08-21 19:37:59 +02:00
Ray
fc082edccc Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-21 19:37:10 +02:00
Ray
4e71e91a4a REXM: Replace example name on project file 2025-08-21 19:30:44 +02:00
Ray
18c50bb01b Merge pull request #5136 from alexander-nichols/fix-shader_normal_map-solution
[build] Fixed VS2022 broken build
2025-08-21 19:29:15 +02:00
Ray
09bd2df17b Merge pull request #5133 from rossberg/patch-1
[raudio] Properly close FLAC in UnloadMusicStream
2025-08-21 19:24:05 +02:00
Ray
0aa5e8169d Merge pull request #5132 from maiconpintoabreu/fix-examples
[examples][core] refactoring core_input_mouse.c to use IsCursorHidden function for consistency
2025-08-21 19:23:15 +02:00
alexander-nichols
5d9c8c365e [build] Fixed VS2022 broken build
Fixed bad references to shaders_normalmap in the project raylib\projects\VS2022\examples\shaders_normal_map.vcxproj

Changed GUID for shaders_normal_map as it coincided with that for core_3d_fps_controller {6B1A933E-71B8-4C1F-9E79-02D98830E671}
2025-08-21 17:42:07 +01:00
Andreas Rossberg
2deae294c6 [raudio] Properly close FLAC in UnloadMusicStream
Fix  raysan5/raylib#5131.
2025-08-21 13:02:19 +02:00
Maicon Santana
238163c6ca swap local variable isCursorHidden to use new method IsCursorHidden() 2025-08-21 11:31:40 +01:00
Ray
99cb82a82c REVIEWED: [rmodels] LoadGLFT(), avoid loading attributes already loaded, issue a warning. FIX: #4996 2025-08-20 16:39:45 +02:00
Ray
c3c33e9654 Merge pull request #5125 from JohnnyCena123/missing-vox-shaders
add missing shaders for glsl100, glsl120
2025-08-20 12:34:05 +02:00
Johnny Cena
a99649b455 remove unneeded checks 2025-08-20 12:18:51 +02:00
Johnny Cena
df200b942c add versions to new shaders 2025-08-20 12:16:57 +02:00
Johnny Cena
cb05945e76 add missing shaders 2025-08-20 12:09:30 +02:00
Ray
5b88e4fe5f Merge pull request #5124 from JeffM2501/fix_win32_compatibility
[utility] Add helper header to fix compatibility with windows.h
2025-08-19 20:18:00 +02:00
Jeffery Myers
15baf176b2 Add a utility header to external that undefines the parts of windows that conflict with raylib, allowing raylib functions to run unimpeded 2025-08-19 10:39:38 -07:00
Ray
d9392b94c4 Merge pull request #5123 from JeffM2501/clean_sound_alias
[raudio] Initialize sound alias properties as if it was a new sound
2025-08-19 17:26:51 +02:00
Jeffery Myers
572230c8ad Initialize sound alias properties as if it was a new sound 2025-08-19 08:16:20 -07:00
Ray
fd44c26584 Merge pull request #5122 from JohnnyCena123/workflow-typo
fix typo in workflow name
2025-08-19 13:26:28 +02:00
Ray
0658abc64c Update text_raylib_fonts.c 2025-08-19 13:22:15 +02:00
Ray
8ba4ff2143 Renamed directory for sprite fonts 2025-08-19 13:22:04 +02:00
Ray
25d00130a8 REVIEWED: example: text_unicode_ranges 2025-08-19 13:17:50 +02:00
Johnny Cena
01c68d7e75 fix typo in workflow name 2025-08-19 12:30:07 +02:00
Ray
291042352b Merge pull request #4886 from GuvaCode/master
[examples] Possible improvements for `text_codepoints_loading`, adding ranges
2025-08-19 12:00:25 +02:00
Ray
44207b293e RENAMED: GitHub Actions files, clearer naming 2025-08-19 11:54:32 +02:00
Ray
8562841c63 Update linux_examples.yml 2025-08-19 11:51:57 +02:00
Ray
f1796ff143 Update examples_update.yml 2025-08-19 11:50:41 +02:00
Ray
4492707e0e Update webassembly.yml 2025-08-19 11:50:38 +02:00
Ray
e3d714ae41 Update GitHub Actions names 2025-08-19 11:45:19 +02:00
Ray
df886a8abb REXM: Added VS2022 project for GitHub Actions building 2025-08-19 11:38:29 +02:00
Ray
915c02adf3 Update examples_update.yml 2025-08-19 11:20:38 +02:00
Ray
f0471aaddb Update examples_update.yml 2025-08-19 11:20:19 +02:00
Ray
e38e7a8141 Update examples_update.yml 2025-08-19 11:18:38 +02:00
Ray
df1244688e Revert "Update examples collection"
This reverts commit 87d3066428.
2025-08-19 11:17:59 +02:00
github-actions[bot]
87d3066428 Update examples collection 2025-08-19 09:15:28 +00:00
Ray
8bc9f30d87 Update examples_update.yml 2025-08-19 11:14:04 +02:00
Ray
e9b1bb25ab Create examples_update.yml 2025-08-19 11:02:01 +02:00
Ray
304045c63a REXM: Allow external path definition for VS solution file 2025-08-19 11:00:22 +02:00
Ray
a3da39cd81 REXM: Store example resource paths, could be useful... 2025-08-19 10:38:07 +02:00
Ray
87731e3db4 Create rexm.rc.data 2025-08-19 10:36:59 +02:00
Ray
cf1217f5c1 Update Makefile 2025-08-19 10:36:56 +02:00
Ray
a338b9694c Update build_example_web.bat 2025-08-19 10:36:31 +02:00
Ray
1098f41885 Update parse.yml 2025-08-19 10:36:22 +02:00
Ray
b1f6ab38b5 Merge pull request #5119 from jan-beukes/master
Fix SDL3 compilation error with gcc
2025-08-18 20:43:11 +02:00
Ray
595befec40 Update models_mesh_picking.c 2025-08-18 20:37:07 +02:00
Ray
0a513e6fbe Comment unused script instructions... 2025-08-18 15:04:50 +02:00
Ray
60b46062c6 REXM: Reviewed example rename on examples.js 2025-08-18 15:00:54 +02:00
Ray
6bf8249f75 Update examples_report.md 2025-08-18 15:00:24 +02:00
Ray
a8dfd9db76 REXM: RENAMED: shaders_normalmap --> shaders_normal_map 2025-08-18 14:35:04 +02:00
Jan Beukes
8772b0287c Fix SDL3 compilation error with gcc 2025-08-17 23:44:37 +02:00
Ray
284d9ddd89 Merge pull request #5118 from slendidev/sdl3fixes
Fix SDL3 build if using package
2025-08-17 21:35:35 +02:00
Ray
dcd012e00f REXM: Generate second report with examples with issues 2025-08-17 21:32:05 +02:00
Ray
24d1d64417 REXM: REVIEWED: ScanExampleResources() avoid resources to be saved by the program 2025-08-17 21:31:05 +02:00
Ray
6da0a180e6 REXM: Using Makefile.Web for specific web versions generation, only with required resources for every example 2025-08-17 21:30:16 +02:00
λxy.x
16bd18070f Fix SDL3 build if using package 2025-08-17 11:11:54 +03:00
Ray
0dc4ba53dc Minor format tweak 2025-08-16 21:06:13 +02:00
Ray
e4dfb6dbb5 Update rl_gputex.h 2025-08-16 20:24:54 +02:00
Ray
2e652bbef1 Merge pull request #5115 from maiconpintoabreu/web_resizable_window_mouse_issue
[rcore][web] Work around to fix mouse positioning on scaled window
2025-08-15 12:51:15 +02:00
Ray
5236b2420a Update rexm.c 2025-08-15 12:43:45 +02:00
Maicon Santana
73950befca Work around to fix mouse positioning on scaled window 2025-08-15 10:57:44 +01:00
Ray
d1b535c7b8 Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-14 21:23:08 +02:00
Ray
ed06cdbbe4 Update examples_report.md 2025-08-14 21:22:57 +02:00
Ray
81615a91a6 Merge pull request #5111 from didas72/master
Adds more filters for conditional build of GetWindowHandle with GLFW
2025-08-14 21:13:27 +02:00
Ray
6252d92f79 Update rexm.c 2025-08-14 21:11:30 +02:00
Ray
a65bdd6cca REXM: Reviewed automatic validation and update -WIP- 2025-08-14 21:07:36 +02:00
Ray
afdc7972d6 REXM: Automatic validation and update of examples 2025-08-14 21:07:10 +02:00
Diogo Diniz
3ef5ee878c Adjusted formatting to comply with contribution guidelines 2025-08-14 19:58:22 +01:00
Ray
28b804a6ba REXM: Validate examples list against existing examples in repo 2025-08-14 20:38:27 +02:00
Ray
7037f131dc REVIEWED: example: core_3d_fps_controller 2025-08-14 20:37:52 +02:00
Ray
a9970484f3 Remove trailing spaces 2025-08-14 20:37:18 +02:00
Ray
be974bb67e Update CONVENTIONS.md 2025-08-14 20:36:08 +02:00
Diogo Diniz
eae1296b08 Fixed bad macro logic 2025-08-14 18:56:31 +01:00
Diogo Diniz
59c979a59d Added suggestions by planetis-m 2025-08-14 18:46:45 +01:00
Didas72
93f86fa074 fixes #5110
Adds more filters for conditional build of GetWindowHandle with glfw
2025-08-14 14:30:29 +01:00
Ray
3c9d3d9bef REXM: REVIEWED: Update examples status report when examples Updated 2025-08-13 23:54:44 +02:00
Ray
f0131f6ee6 Added missing project to solution 2025-08-13 23:53:35 +02:00
Ray
b17f00b6d9 REXM: Avoid external tool for UUIDv4 generation, implement custom function 2025-08-13 13:25:27 +02:00
Ray
ddebf5d7ac Update Makefile.Web 2025-08-13 12:34:55 +02:00
Ray
a7e66df56d Using define for buffers size 2025-08-13 12:33:38 +02:00
Ray
800be084b6 REXM: Implemented AddVSProjectToSolution() 2025-08-13 12:33:12 +02:00
Ray
ef81145776 Update examples_list.txt 2025-08-13 11:35:23 +02:00
Ray
74339d2008 REVIEWED: IsFileExtension() 2025-08-13 10:43:33 +02:00
Ray
8c7b3b7323 Update examples_report.md 2025-08-13 10:38:04 +02:00
Ray
601091b69e Update raylib.sln 2025-08-13 09:56:22 +02:00
Ray
388bc5075e Update raylib.sln 2025-08-13 08:56:50 +02:00
Ray
b7265c3df1 Update rexm.ico 2025-08-13 08:24:57 +02:00
Ray
cd1c206676 Update rl_gputex.h 2025-08-13 08:22:00 +02:00
Ray
76284f1a16 Corrected typo 2025-08-13 08:13:18 +02:00
Ray
dd19b8d2c2 REVIEWED: Requested window flags application after window initialization 2025-08-12 11:44:20 +02:00
Ray
195b968b86 Merge pull request #4837 from Andersama/support_all_window_flags_at_initialization
[rcore] Support window flags with initialization issues
2025-08-12 11:38:22 +02:00
Ray
95e4494cfe ADDED: cursorLocked variable and review required code #4940 #4955 2025-08-12 11:33:58 +02:00
Ray
c4414fa1ed Revert "Merge pull request #4945 from Moros1138/master"
This reverts commit bab234a160, reversing
changes made to 13e384ce71.
2025-08-12 10:58:56 +02:00
Ray
bab234a160 Merge pull request #4945 from Moros1138/master
[rcore][web] Review resizable canvas on `FLAG_WINDOW_RESIZABLE`
2025-08-12 10:31:12 +02:00
Ray
db2abfb9be Merge branch 'master' into master 2025-08-12 10:28:52 +02:00
Ray
13e384ce71 Merge pull request #5004 from nezvers/example_quake_controller
[examples] New example: `core_3d_fps_controller`
2025-08-12 09:54:23 +02:00
Ray
9aa1b86fdf Merge pull request #5109 from maiconpintoabreu/julia_set
[examples] Increasing julia_set maxInterations glsl100 to 255
2025-08-11 20:26:24 +02:00
Ray
503e6d8bb5 Merge branch 'master' into julia_set 2025-08-11 20:26:16 +02:00
Ray
9b598f6bcf REVIEWED: Shaders formating to follow raylib code conventions 2025-08-11 20:22:31 +02:00
Ray
8dae39fbda ADDED: Missing GLSL120 shaders 2025-08-11 20:22:02 +02:00
Maicon Santana
00f7121b1c Increasing maxInterations glsl100 to 255 to match with glsl330 and add glsl120 2025-08-11 18:16:00 +01:00
Ray
705ce45a33 FIX: Added callback broke keyboard input on web... #5107 2025-08-10 19:59:33 +02:00
Ray
9ff8862826 Merge pull request #5108 from lassade/fix-qoa-music-from-mem
fix: QOA when using with LoadMusicStreamFromMemory
2025-08-10 19:27:08 +02:00
Felipe Jorge
71b7734ce4 fix: QOA when using with LoadMusicStreamFromMemory, reduced the number of allocs and memcpy 2025-08-10 10:05:03 -03:00
Ray
e17e0933af Merge pull request #5104 from matthijskooijman/fix-ssh-backspace
Fix backspace key in Rpi SSH keyboard
2025-08-10 13:22:06 +02:00
Ray
27d7e61f28 Update rexm.c 2025-08-10 09:54:45 +02:00
Matthijs Kooijman
9582d25217 Fix backspace key in Rpi SSH keyboard
There was a typo in the generated keycode.
2025-08-09 21:04:09 +02:00
Ray
852c51343d Merge pull request #5103 from Not-Nik/raylib-zig-update
Update raylib-zig in BINDINGS.md
2025-08-09 19:08:17 +02:00
Nikolas
7bc22f71bd Update raylib-zig in BINDINGS.md 2025-08-09 19:04:00 +02:00
github-actions[bot]
60826855c4 Update raylib_api.* by CI 2025-08-08 21:09:03 +00:00
Ray
5daeffd91b Update parse.yml 2025-08-08 23:08:42 +02:00
Ray
e11bf1c978 Update Makefile 2025-08-08 23:07:08 +02:00
Ray
c6241b91a2 REVIEWED: IsFileExtension() to avoid other modules dependency #5071 2025-08-08 23:01:04 +02:00
Ray
f73b04c42c REXM: Copy examples web-build files to raylib.com 2025-08-08 21:54:15 +02:00
Ray
d6f9988e82 Update Makefile 2025-08-08 13:52:56 +02:00
Ray
c2f2878575 Merge pull request #5099 from JohnnyCena123/raysan-typo
fix typo in 'Ramon Santamaria'
2025-08-08 07:16:07 +02:00
JohnnyCena123
c25e9f641d fix typo in 'Ramon Santamaria' 2025-08-08 03:04:33 +03:00
Ray
17aec580f8 Merge pull request #5096 from wileyanderssen/master
removed unneeded comma
2025-08-07 19:01:53 +02:00
wileyanderssen
c6171d339c removed unneeded comma
hope this gets merged
2025-08-07 19:55:46 +03:00
Ray
df40357f19 Update linux.yml 2025-08-07 18:37:11 +02:00
Ray
570082deba WARNING: **NEW** raylib code CONVENTION: Comments do not end with '.' 2025-08-07 18:23:20 +02:00
Ray
6792e6e2dd Updated required files for new example: shaders_normalmap 2025-08-07 17:50:18 +02:00
Ray
2365ac8def REVIEWED: Example shaders_normalmap #5032 2025-08-07 17:31:11 +02:00
Ray
54473e2c2b REVIEWED: Example shaders_normalmap, it crashes #5032 2025-08-07 17:28:25 +02:00
Ray
47d1cc200d Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-07 17:19:39 +02:00
Ray
8da4887c2d Update examples_list.txt 2025-08-07 17:19:27 +02:00
Ray
ea3932949c Merge pull request #5032 from Sir-Irk/normalmap_example
[examples] New example: `shaders_normalmap`
2025-08-07 17:17:29 +02:00
Ray
a06962ee38 Merge branch 'master' into normalmap_example 2025-08-07 17:17:12 +02:00
Ray
c19c6fc6e0 Merge pull request #5093 from maiconpintoabreu/check-newname-category
[remx] Add check for category on new name
2025-08-07 17:14:45 +02:00
Ray
948b48430d Merge pull request #5092 from maiconpintoabreu/fix-rename-missing-newname
[remx] Add warning for missing new name to avoid segmentation fault
2025-08-07 17:13:27 +02:00
Ray
881c68e323 Merge pull request #5091 from Auios/patch-2
fix: buffer overflow in jar_mod.h memcopy
2025-08-07 17:13:00 +02:00
Ray
ca61b8d555 Merge pull request #5090 from Auios/patch-1
Remove binding link for https://github.com/Rabios/raylib-v7
2025-08-07 17:09:20 +02:00
Ray
f0889a74fe EXAMPLES: Format tweaks 2025-08-07 17:08:22 +02:00
Ray
9f07cfe0b7 Update textures_image_kernel.c 2025-08-07 17:08:02 +02:00
Ray
f02c7fca8a Update shapes_double_pendulum.c 2025-08-07 17:07:45 +02:00
Ray
d45b00b191 Update shaders_rounded_rectangle.c 2025-08-07 17:07:26 +02:00
Ray
7e597dd574 Update rlgl_compute_shader.c 2025-08-07 17:07:10 +02:00
Ray
9003cd32ba Update models_rlgl_solar_system.c 2025-08-07 17:06:50 +02:00
Ray
366887b863 Update models_loading_vox.c 2025-08-07 17:06:39 +02:00
Ray
64fbf07e7b Update audio_sound_multi.c 2025-08-07 17:06:11 +02:00
Ray
5d4a233f52 Update examples_template.c 2025-08-07 17:05:57 +02:00
Ray
fd79b44920 Create distortion.fs 2025-08-07 17:05:50 +02:00
Ray
5eacc872c7 Update README.md 2025-08-07 17:05:45 +02:00
Ray
1fadc67fb3 ADDED: Missing resources on some examples 2025-08-07 17:05:25 +02:00
Ray
ff1087480c ADDED: New projects to VS2022 solution 2025-08-07 17:04:49 +02:00
Ray
c91c185221 Update examples_report.md 2025-08-07 17:04:22 +02:00
Ray
89e6ed2697 REXM: Reviewed VS project adding to solution, no tool to do it! -WIP- 2025-08-07 17:03:54 +02:00
Maicon Santana
fa5560881e Check for category on new name 2025-08-07 12:39:12 +01:00
Maicon Santana
36dc70443a Add warning for missing new name to avoid segmentation fault 2025-08-07 12:01:21 +01:00
Connor O'Connor
1c2ecfd6ab fix: buffer overflow in jar_mod.h memcopy 2025-08-06 23:13:05 -04:00
Connor O'Connor
5dc304b5a7 Remove binding link for https://github.com/Rabios/raylib-v7
This repo (and user) does not exist. Remove it.
2025-08-06 22:41:37 -04:00
Ray
a6f29e4f19 Update examples_report.md 2025-08-06 18:42:33 +02:00
Ray
b3513e4719 ADDED: Missing example VS2022 projects 2025-08-06 18:42:27 +02:00
Ray
c3a4217148 Update rexm.c 2025-08-06 18:25:58 +02:00
Ray
533f06109d Update README.md 2025-08-06 18:23:42 +02:00
Ray
c6f8f06f7e Update rexm.c 2025-08-06 18:20:34 +02:00
Ray
f64d405ef3 Update Makefile.Web 2025-08-06 18:18:39 +02:00
Ray
c477c68419 REXM: Automatically fix not found VS2022 project / solution 2025-08-06 18:14:52 +02:00
Ray
2878f7db22 Create examples_report.md 2025-08-06 15:43:15 +02:00
Ray
8bc1d62e88 REXM: Added legend info to report 2025-08-06 15:43:13 +02:00
Ray
59546eb54a REXM: Support examples data validation and **report generation** 2025-08-06 14:04:30 +02:00
Ray
c95fd5a803 REXM: Support paths customization with environment variables 2025-08-06 14:03:32 +02:00
Ray
c3cad65d30 Update examples_list.txt 2025-08-06 14:02:51 +02:00
Ray
095319602c REVIEWED: Compule for OpenGL 1.1 #5088 2025-08-06 13:09:56 +02:00
Ray
68a1190bf2 REXM: ADDED: Examples validation 2025-08-06 00:56:29 +02:00
Ray
64921e2d8a Merge pull request #5086 from maiconpintoabreu/ignore-compiled-rexm
[rexm] Add compiled rexm to gitignore
2025-08-05 13:18:20 +02:00
Maicon Santana
81eb48cad8 Add compiled rexm to gitignore 2025-08-05 11:44:41 +01:00
Ray
f306685469 Update rexm.c 2025-08-05 12:38:30 +02:00
Ray
99a43457e8 REXM: ADDED: Command; update to validate+update required files 2025-08-05 12:38:11 +02:00
Ray
90cf6a18da REXM: Renamed some variables 2025-08-05 12:37:11 +02:00
Ray
1f2b5d6282 Update examples_template.c 2025-08-05 10:04:54 +02:00
Ray
7b93591676 Added some notes to avoid platform-dependant .BAT scripts 2025-08-05 09:54:51 +02:00
Ray
02992ce63b UPDATE: Get example info from example header when added, to be added to collection 2025-08-05 09:54:17 +02:00
Ray
b683af298c Update examples_template.c 2025-08-05 09:40:01 +02:00
Ray
cdbe9d75ef Merge pull request #5085 from Not-Nik/culling_consistency
Make culling distances consistent across raylib
2025-08-05 00:45:47 +02:00
Nikolas
7267c1c8a1 Make culling distances consistent across raylib 2025-08-05 00:15:52 +02:00
Ray
e09c9ce281 Minor tweaks 2025-08-04 23:36:07 +02:00
Ray
945f1410d2 MOVED: rexm to tools directory 2025-08-04 23:24:43 +02:00
Ray
f5e95029b1 Update rexm.c 2025-08-04 20:44:22 +02:00
Ray
47c186dd87 WARNING: **BREAKING**: Moved raylib parser to tools/parser directory 2025-08-04 20:26:19 +02:00
Ray
cdfb9d7a0b Added some notes for example collection validation 2025-08-04 19:29:28 +02:00
Ray
a436d935f1 Update README.md 2025-08-04 19:28:07 +02:00
Ray
1293461f5e REXM: Some code reviews, README.md generation improvements 2025-08-04 19:27:48 +02:00
Ray
a457ab154e ADDED: Example resources for automatic removal
WARNING: Some of those resources could be shared by other examples in the category so for now we leave removed manual by users...
2025-08-04 18:11:57 +02:00
Ray
1f5fec851d UPDATE: Added Makefile.Web per-example target generation including used resources 2025-08-04 17:52:22 +02:00
Ray
bc0f93baea UPDATE: Added resources scanning from examples for automated copying 2025-08-04 17:51:48 +02:00
Ray
e130775e0d Updated for resources scanning system 2025-08-04 14:13:17 +02:00
Ray
80dd72ce12 REVIEWED: For automation simplification 2025-08-04 13:23:57 +02:00
Ray
d8952958db Update Makefile 2025-08-04 13:23:14 +02:00
Ray
72de562542 REVIEWED: Examples for automation processes 2025-08-04 13:23:04 +02:00
Ray
d43470a3d4 Minor comment reviews 2025-08-03 23:49:52 +02:00
Ray
d182ae7837 UPDATED: Support example removal 2025-08-03 23:32:54 +02:00
Ray
b11d089202 UPDATED: Implementing file rename requirements
Moved files update from collection to separate function
2025-08-03 22:56:15 +02:00
Ray
d194b8d503 ADDED: Some security checks to verify examples categories provided 2025-08-03 21:20:35 +02:00
Ray
8f8a5ada60 REVIEWED: Make sure environment is set in same process and not a child one 2025-08-03 21:19:55 +02:00
Ray
b4ecfb648d Merge pull request #5084 from kariem2k/fix_cmake_sdl3
Removed verbose logging on SDL3.
2025-08-03 19:53:53 +02:00
Karim Ahmed
603219d6d6 Removed verbose logging on SDL3. Happens every time the property is read! 2025-08-03 18:48:24 +01:00
Ray
c146be16cb Update rexm.c 2025-08-03 09:43:38 +02:00
Ray
6ddc9251c2 UPDATE: README.md example addition working 2025-08-03 01:18:19 +02:00
Ray
73baaeeb2e REVIEWED: LoadTextLines() 2025-08-03 01:17:50 +02:00
Ray
361e730f83 Merge pull request #5083 from JeffM2501/obj_double_load
[rModels] Don't Double Upload Meshes in LoadObj,
2025-08-03 00:29:20 +02:00
Jeff Myers
ffe76a4b67 Don't Upload Meshes in LoadObj, LoadModel will upload them. None of the other interchange format readers upload 2025-08-02 14:58:05 -07:00
Ray
1948453394 Update README.md 2025-08-02 20:11:31 +02:00
Ray
b044b52955 UPDATED: examples.js example addition working 2025-08-02 19:43:27 +02:00
Ray
528ad4964d UPDATE: Makefile example addition working 2025-08-02 19:21:36 +02:00
Ray
e76c5f7d64 Update rexm.c 2025-08-02 18:11:30 +02:00
Ray
0533987f80 Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-02 18:01:32 +02:00
Ray
e01f3f158e Remove some testing code 2025-08-02 18:01:23 +02:00
github-actions[bot]
42619ea2df Update raylib_api.* by CI 2025-08-02 16:01:00 +00:00
Ray
c60763d19e UPDATED: LoadExamplesData() to support filtering and sorting 2025-08-02 18:00:41 +02:00
Ray
1c8eef9b0b Update raylib and generate ARM64 libraries for Windows, Linux, macOS 2025-08-02 17:59:34 +02:00
Ray
d3fe9e5036 Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-02 17:58:47 +02:00
Ray
159a9eac4a Update build_example_web.bat 2025-08-02 17:58:44 +02:00
Ray
c4d733e864 Merge pull request #5082 from JeffM2501/render_target_size
[CORE} Make GetRenderWidth/Height return the FBO size if one is active
2025-08-02 17:40:37 +02:00
Jeffery Myers
bf536d68e1 Make GetRenderWidth and GetREnderHeight return the FBO size if one is active. 2025-08-02 08:37:11 -07:00
Ray
b01c8a7a90 UPDATE: Implementing examples commands -WIP- 2025-08-02 00:36:17 +02:00
Ray
a36905607c Update linux.yml 2025-08-01 20:19:35 +02:00
Ray
3e65b23f89 Update windows.yml 2025-08-01 20:10:35 +02:00
Ray
8adccfd521 Update windows.yml 2025-08-01 20:09:49 +02:00
Ray
fde3166e6a Merge pull request #5075 from killerdevildog/add-linux-arm64-builds
[build] Add ARM64 support to Linux builds
2025-08-01 20:07:56 +02:00
Ray
9477838193 ADDED: Some useful functions for examples info loading, using examples_list 2025-08-01 19:40:44 +02:00
Ray
cb91c02bea Merge branch 'master' of https://github.com/raysan5/raylib 2025-08-01 19:40:25 +02:00
Ray
a872de82ed Create examples_list, to be used by rexm or other tools for reference
NOTE: This file should be the source of truth for raylib examples collection, everything will be generated using this file as primary reference.
2025-08-01 19:39:30 +02:00
github-actions[bot]
9d07be6bde Update raylib_api.* by CI 2025-08-01 17:38:20 +00:00
Ray
234f4b2b10 Update raylib.h 2025-08-01 19:38:02 +02:00
Ray
10079e4e65 Reviewed minor formating issues 2025-08-01 18:58:24 +02:00
Ray
6b0174d034 REVIEWED: Examples Makefile to locate examples list: #EXAMPLES_LIST_* 2025-08-01 18:58:05 +02:00
Ray
9fa53aac6f Update examples_template.c 2025-08-01 18:56:54 +02:00
Ray
43bc00379c removed trailing spaces 2025-08-01 10:26:28 +02:00
Ray
ba798e9155 Merge pull request #5079 from zet23t/fixing-obj-loader-crash
[rmodels] Fixing OBJ loading crash when there are no normals present
2025-08-01 08:57:55 +02:00
Eike Decker
121c996c6e fixing OBJ loading crash when there are no normals present 2025-08-01 08:49:48 +02:00
Ray
e7bd177826 Merge pull request #5077 from lpow100/master
Added certain variable assigment to the rename option and fixed some arugment based logs
2025-08-01 01:27:43 +02:00
lpow100
65e3d67eb9 Merge branch 'master' of https://github.com/raysan5/raylib 2025-07-31 16:16:10 -07:00
lpow100
58e3c8604a Added setup for the rename command (NOT TESTED) 2025-07-31 16:16:07 -07:00
Ray
e0b58b7eee Update rexm.c 2025-08-01 01:08:31 +02:00
Ray
d88f27f08d NEW: ADDED: rexm - A simple command-line tool to manage raylib examples -WIP- 2025-08-01 00:30:01 +02:00
Ray
4b2654f851 Create examples_template.png 2025-07-31 23:55:50 +02:00
Ray
968385b5f4 Update examples_template.c 2025-07-31 23:55:46 +02:00
Ray
38ff5d00a0 Create build_example_web.bat 2025-07-31 23:55:26 +02:00
Quaylyn Rimer
11ccf11814 [build] Add ARM64 support to Linux builds
- Add ubuntu-24.04-arm runner for native ARM64 compilation
- Support building both static and shared libraries for ARM64
- Maintain backwards compatibility with existing x86/x64 builds
- Addresses issue #5051 for ARM64 pre-compiled binaries

Expected output: raylib-X.X-linux_arm64.tar.gz in releases
2025-07-30 22:40:54 -06:00
Ray
305c7a2ef9 Merge pull request #5073 from Luca-coder07/master
[examples] Add screenshot for core_basic_window_web
2025-07-31 00:26:26 +02:00
RANDRIA Luca
b273ba930b Add screenshot for core_basic_window_web
The veritable screenshot is this
2025-07-31 01:05:00 +03:00
RANDRIA Luca
756203581e Merge branch 'raysan5:master' into master 2025-07-31 01:00:02 +03:00
Ray
50acba3ce8 REVIEWED: rcore_web, cleaning and reorganizing 2025-07-30 17:31:49 +02:00
Ray
18ae6a377c Merge pull request #4956 from Moros1138/consume-keyboard-events
[rcore][web] Add `EmscriptenKeyboardCallback()` to consume key events
2025-07-30 17:03:10 +02:00
RANDRIA Luca
e662ac80d5 Merge branch 'raysan5:master' into master 2025-07-30 17:37:15 +03:00
Ray
12f0943bd9 Update rcore.c 2025-07-30 16:07:14 +02:00
Ray
b40e53f11c Remove double line spacing 2025-07-30 16:07:08 +02:00
Ray
414235dd17 Update shaders_multi_sample2d.c 2025-07-30 16:06:43 +02:00
RANDRIA Luca
37104195b4 add screenshot core_basic_window_web
There are no screenshot for this and the alt is seen
2025-07-30 16:54:06 +03:00
Ray
138010c1eb Merge branch 'master' of https://github.com/raysan5/raylib 2025-07-28 23:38:00 +02:00
Ray
5ca6bff8ca Update rl_gputex.h 2025-07-28 23:37:48 +02:00
Ray
70daf39eaf Merge pull request #5066 from lepasona/master
[glfw] Update `mappings.h`
2025-07-27 21:23:53 +02:00
Ray
47df461047 Merge pull request #5068 from lepasona/patch-1
[examples] typo: hardcoded gamepad ids in `core_input_gamepad.c`
2025-07-27 21:22:37 +02:00
lepasona
b230720842 example core_input_gamepad.c: fix hardcoded gamepad 0 2025-07-27 14:35:38 +00:00
lepasona
1da6b281de Update glfw mappings.h 2025-07-27 07:37:07 +00:00
Ray
1fc0b4955f REVIEWED: rl_gputex.h, added some info for future improvements 2025-07-26 13:36:03 +02:00
Ray
eb7f8912f8 Minor format tweaks 2025-07-26 12:50:29 +02:00
Ray
8343aed4f6 Avoid fatal errors on OBJ model loading 2025-07-26 12:50:12 +02:00
Ray
c9f9219fa6 REVIEWED: DRM cache buffers support #4988 2025-07-26 12:49:49 +02:00
Ray
5c680739bd Removed platform-specific flag from config.h #4988 2025-07-26 12:49:03 +02:00
Ray
86d9afc10c Merge pull request #4988 from rob-bits/master
[rcore][drm] Replace DRM swap buffer implementation with asynchronous page-flipping and triple framebuffer caching
2025-07-26 12:14:21 +02:00
Ray
715e174d13 Merge pull request #5062 from danilwhale/feat/get-proc-address
[rlgl] Add rlGetProcAddress
2025-07-26 12:07:43 +02:00
Ray
7262be85fd Minor format tweaks 2025-07-26 12:06:24 +02:00
Ray
4da399141a Merge pull request #5063 from kariem2k/fix_cmake_sdl3
Fixed: CMake support for SDL3
2025-07-26 11:49:05 +02:00
Ray
d7893141f3 REVIEWED: rl_gputex.h library to be usable standalone 2025-07-26 11:44:36 +02:00
Ray
94d8d7133b Merge pull request #5045 from sleeptightAnsiC/fix_gputex_logging
[rl_gputex] fix: decouple logging and memory allocation from Raylib
2025-07-26 11:25:58 +02:00
Karim Ahmed
32960af1dc Fixed:
Added CMake support for SDL3.
Now supports including SDL2 or SDL3 as a subdirectory within the project. The system will first check for SDL3, then SDL2. If neither is found, it will attempt find_package(SDL3), followed by find_package(SDL2). If all these checks fail, the process will terminate with an error.
2025-07-24 09:48:52 +01:00
Ray
9a042bc9ad Merge pull request #5061 from myQwil/zig_manual_module
[build][zig] use `addLibrary()` and set root modules manually
2025-07-23 22:13:29 +02:00
danil
d6a897e551 [rlgl]: Add rlGetProcAddress 2025-07-23 21:41:45 +03:00
Mike Will
dfa21c2d1f [build][zig] use addLibrary() and set root modules manually
These changes will be required by Zig version 0.15.0.
2025-07-23 11:56:58 -04:00
Ray
5434ae1100 Merge pull request #5057 from Joecheong2006/example-double-pendulum
[examples]: New example: `shapes_double_pendulum`
2025-07-22 21:01:31 +02:00
Joecheong2006
10fadd9185 Replaced scalar to float 2025-07-22 11:59:46 -07:00
Joecheong2006
b6ae5af4e3 Removed redefined RAD and DEG 2025-07-22 11:57:16 -07:00
Joecheong2006
8a0ab163d3 Changed to 4 spaces 2025-07-22 11:50:48 -07:00
JoeCheong
f3854cb406 Fixed typo 2025-07-22 11:39:24 -07:00
Joecheong2006
f1714a6234 [examples]: New shapes example - double pendulum 2025-07-21 14:59:51 -07:00
Ray
7b017b60d9 Move global variable to right code section 2025-07-21 10:57:21 +02:00
Ray
dedf382f64 Merge pull request #5053 from didas72/master
[rcore][linux] Fixes GetWindowHandle returning a bad handle under Linux X11
2025-07-20 21:23:32 +02:00
Didas72
36364192d5 Fixes GetWindowHandle returning a bad handle under Linux X11 2025-07-19 22:29:08 +01:00
Ray
9b6c09c32f Merge pull request #5049 from wwderw/master
[build] Update Makefile
2025-07-19 12:29:39 +02:00
wwderw
0b125a5fd7 Update Makefile
Remove .bc file removal from clean shell for windows configuration.
2025-07-19 04:54:05 -05:00
Ray
0b7dda8ab1 Merge pull request #5050 from katanya04/master
Update font load message
2025-07-19 11:44:11 +02:00
Catania
3d93b30262 Update font load message 2025-07-18 15:20:38 +02:00
Ray
78a06990c7 Merge pull request #5041 from PanicTitan/master
[example][web] Fix core_custom_frame_control.c to properly register inputs on web platform
2025-07-17 19:01:27 +02:00
Ray
82b80a6998 Review formatting, avoid variable 2025-07-17 18:49:58 +02:00
Ray
71b302846a Review formatting, avoid variable 2025-07-17 18:49:54 +02:00
Ray
8823aba9df Update rprand.h 2025-07-17 18:49:34 +02:00
Ray
6b9a685bae Merge pull request #5048 from veins1/patch-4
[raudio] Fix: music stopping early. Fix: GetMusicTimePlayed for short music
2025-07-17 18:44:29 +02:00
Ray
14582a9f06 Merge pull request #5047 from RomainPlmg/#5009-fix-colorreplace-alpha
[rtextures] Fix ImageColorReplace() alpha issue replacement
2025-07-17 18:43:10 +02:00
wwderw
093e5200d0 Update Makefile
Clean up library build for the web
2025-07-17 05:19:39 -05:00
veins1
0405de794a Fix for music stopping too early 2025-07-16 14:22:57 +00:00
veins1
d03ac97eff GetMusicTimePlayed fix for music shorter than buffer size 2025-07-16 14:18:38 +00:00
Romain Plumaugat
34af70866c [rtextures] Fix ImageColorReplace() alpha issue #5009 2025-07-15 23:19:39 +02:00
Ray
e00c5eb8b1 Merge pull request #5043 from vinnyhorgan/master
Fix warning log macro in rlgl
2025-07-15 20:20:27 +02:00
Ray
cbea2ff502 Merge pull request #5046 from maiconpintoabreu/updatestream-music
[raudio] Prevent UpdateMusicStream to run without music playing
2025-07-15 20:18:46 +02:00
Maicon Santana
3320a2c837 Fix to prevent UpdateMusicStream to run without music playing 2025-07-15 19:07:15 +01:00
katonar
8388160c32 - fixing SUPPORT_DRM_CACHE define check at the end of InitPlatform() 2025-07-15 13:58:23 +02:00
Ray
e7c043529c Merge pull request #5044 from backspaceoverload/fix-HalfToFloat
[rtextures] Fix HalfToFloat Mantissa hex value
2025-07-15 13:12:46 +02:00
sleeptightAnsiC
85bf04c7bf [rl_gputex] fix: decouple logging and memory allocation from Raylib
- make sure that src/external/rl_gputex.h uses it's own macros
    for printing warnings and allocating memory
- add few additional macros in order to decouple rl_gputex from headers
    that are being included by Raylib (e.g. *_MEMSET, *_NULL and so on)
- make sure that rl_gputex uses RL_*ALLOC, TRACELOG and RLAPI macros
    when (and only when) being included by src/rtextures.c
- replace LOG() and RL_GPUTEX_SHOW_LOG_INFO macros with: RL_GPUTEX_WARN
    and RL_GPUTEX_SHOW_WARN_INFO (this is a breaking change, but it was
    broken and unusable anyway, see:
    https://github.com/raysan5/raylib/issues/5039#issuecomment-3065732596 )
- fixes issue all issues mentioned in:
    https://github.com/raysan5/raylib/issues/5039#issuecomment-3065732596
- remove logging upon successfully saving a file; Raylib does this
    anyway and we want rl_gputex to only print WARNings upon failures;
    see: https://discord.com/channels/426912293134270465/541710686468702250/1394406734306480352
- add additional condition when saving a file; now checks for both
    fwrite() and fclose() failures; before it would warn about both,
    but only return result based on fclose()
- add some notes about the current state of compiling rl_gputex
    without depending on Raylib (spoiler: it's still broken...)
- bump rl_gputex version to 1.1 since this is a potential breaking
    change (only for people attempting to use it without Raylib)

Fixes: https://github.com/raysan5/raylib/issues/5039
Reference: https://discord.com/channels/426912293134270465/541710686468702250/1394403611852931255
2025-07-15 07:53:50 +02:00
backspaceoverload
44ebf32389 Fix HalfToFloat Mantissa hex value 2025-07-15 00:52:47 -03:00
Daniel Vincent Horgan
901afadbf1 fix warning log macro in rlgl 2025-07-14 15:36:02 +02:00
Ray
f34e240688 Merge pull request #5042 from Sir-Irk/ImageDrawLineEx_fix
[rtextures] Fix `ImageDrawLineEx()` line thickness
2025-07-14 10:30:34 +02:00
Jeremy Montgomery
fce3102f1c Remove excess comments 2025-07-14 00:11:17 -05:00
sir-irk
9f03d7c426 fixing comments 2025-07-13 23:02:02 -05:00
sir-irk
0c69c43c3a fix ImageDrawLineEx to be able to draw even numbered thicknesses 2025-07-13 22:37:41 -05:00
PanicTitan
9e908e4a76 Update core_custom_frame_control.c to work properly on web 2025-07-14 00:27:56 -03:00
Ray
20a07a65d7 Merge pull request #5037 from garrisonhh/fix-gaussian-blur
[rtextures] fix integer overflow in cast for `ImageBlurGaussian`
2025-07-10 19:06:34 +02:00
garrisonhh
8dbacafbe6 fix overflow in cast for ImageBlurGaussian 2025-07-10 12:48:29 -04:00
Ray
55a5674714 Merge pull request #5036 from sleeptightAnsiC/update_glfw_mappings_h
[glfw] update mappings.h using GenerateMappings.cmake
2025-07-10 09:02:13 +02:00
sleeptightAnsiC
930890555c [glfw] update mappings.h using GenerateMappings.cmake
I did this with the intention of fixing
https://github.com/raysan5/raylib/issues/5027
but it's hard to tell if it will help in that case or not.
Anyway, bumping the header with mappings should be done once in a while.

I haven't found any Raylib script for doing this, so here's how I did it
step-by-step with CMake rule provided by GLFW (I'm on Linux, but this
should be similar on any other POSIX system):
```sh
$ git clone https://github.com/raysan5/raylib.git
$ cd raylib/src/external/glfw/
$ cmake -B ./build -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -G "Unix Makefiles"
$ make -C ./build update_mappings
$ rm -fr ./build
```
then I checked, if any mappings were deleted (without updating) with
following shell one-liner:
```sh
  # you must be at 'raylib/src/external/glfw/' when executing this
$ for i in $(git diff ./src/mappings.h | sed -n -e 's/^-"\([0-9a-z]*\),.*$/\1/p'); do grep <./src/mappings.h "$i" > /dev/null || echo "$i"; done;
```
which gave me the following IDs:
```txt
0300000066f700000500000000000000
030000000d0f00001600000000007803
03000000efbe0000edfe000000000000
03000000786901006e70000000000000
050000005e040000e002000030110000
03000000790000000600000010010000
030000000d0f00000d00000000010000
030000000d0f0000d800000072056800
03000000c0160000dc27000001010000
030000008916000000fd000024010000
```
I have checked all those IDs with `git log -p` against
https://github.com/mdqinc/SDL_GameControllerDB
and it seems that all of them were deleted by upstream (I was afraid that
maybe some mappings were added manually by a Raylib contributor and then
overwritten by my patch, but they weren't; All good!)
2025-07-10 01:37:25 +02:00
Ray
defbeee1a7 Merge pull request #5020 from Emil2010/master
update dr_libs
2025-07-08 21:45:17 +02:00
Ray
d972582bc7 Merge pull request #5025 from zedeckj/master
Fixed typo in example
2025-07-08 21:43:54 +02:00
Ray
5957564983 Merge pull request #5026 from jonathandw743/sdlfix
fixed compile error for PLATFORM sdl
2025-07-08 21:43:30 +02:00
Ray
eaea8e0b0a Merge pull request #5033 from wwderw/master
Update raudio.c
2025-07-08 21:42:47 +02:00
wwderw
8ef51850bf Update raudio.c
Allow for the use of raudio stand alone
2025-07-08 08:51:33 -05:00
sir-irk
32026ca78b fix preview image file name 2025-07-08 06:34:25 -05:00
sir-irk
86d2db2aa9 fix typo on UI and preview image 2025-07-08 05:51:14 -05:00
sir-irk
9a578dbce0 fix formatting 2025-07-08 05:47:11 -05:00
sir-irk
a94feef6d0 update readme 2025-07-08 05:36:39 -05:00
sir-irk
897a8fbc9f adding preview image 2025-07-08 05:28:15 -05:00
sir-irk
510dc763e9 adding normal map example 2025-07-08 05:05:30 -05:00
Ray
a92f67bf34 Merge pull request #5031 from AmityWilder/safety-comments
Safety Comments for Sound/Texture Update Functions
2025-07-08 08:49:11 +02:00
Amy Wilder
205b6a0926 Merge branch 'raysan5:master' into safety-comments 2025-07-07 21:52:54 -04:00
github-actions[bot]
9f6d37ecb4 Update raylib_api.* by CI 2025-07-08 01:51:52 +00:00
Amy Wilder
d4f09984ac Add safety notes to 'Update_' functions 2025-07-07 21:51:27 -04:00
katonar
5b182139ae - implementing Raylib coding convention 2025-07-07 17:55:32 +02:00
katonar
de62be0ec5 - created complier flag SUPPORT_DRM_CACHE, to enable triple buffered DRM caching 2025-07-07 17:28:23 +02:00
jonathandw743
79c29cbe24 fixed compile error for PLATFORM sdl 2025-07-06 11:36:44 +01:00
Jordan Zedeck
e91a3697ff Fixed typo 2025-07-06 01:59:03 -04:00
EmilSylveon
910f4083e1 update dr_libs 2025-07-05 00:53:01 +03:00
Ray
7f8dfc6c69 Merge pull request #5018 from maiconpintoabreu/fix-zig-wasm-win-mac
[Zig] Fix issue on zig build Emscripten run if no emsdk installed
2025-07-04 14:34:07 +02:00
Maicon
f1600a0c7e Fix issue on zig build emscripten run if the user has not installed emsdk 2025-07-04 10:24:32 +01:00
Ray
46f01e315d Merge pull request #5013 from maiconpintoabreu/zig-examples
[zig] Add run examples using zig and emscripten for web
2025-07-01 22:53:22 +02:00
Ray
2e74133a62 Merge pull request #5014 from fosskers/colin/cl-binding
docs: mention another Common Lisp binding
2025-07-01 22:52:52 +02:00
Ray
7f32b9a964 Merge pull request #5015 from Sir-Irk/gltf_model_fix
[rmodels] Fixing offset for processing tangents for GLTF/GLB loading
2025-07-01 22:50:30 +02:00
Ray
8cf932c822 Merge pull request #5016 from Sir-Irk/fix_pbr_example_tangents
[example] Fix pbr example shaders to use vec4 for vertexTangent
2025-07-01 22:48:59 +02:00
sir-irk
ed509193d9 remving w multiply on the tangent itself 2025-07-01 15:30:50 -05:00
sir-irk
f86295732a fixing shader tangents to be vec4 2025-07-01 15:18:11 -05:00
sir-irk
bee524e5e6 fixing offset for processing tangents for gltf loading 2025-07-01 13:23:05 -05:00
Maicon Santana
eef1bac3e2 fix misspelling 2025-06-30 19:38:34 +01:00
Maicon
0cae8890b8 Remove -fno-stack-protector as it is not needed and add requestFullscreen on exported methods 2025-06-30 09:54:20 +01:00
Colin Woodbury
1db006b082 docs: mention another Common Lisp binding 2025-06-30 05:40:17 +09:00
Maicon
8f50436dc9 Fix comments 2025-06-29 09:11:41 +01:00
Maicon
6e9c3acaa4 Add run examples using zig and emscripten for web 2025-06-29 09:04:58 +01:00
Ray
bdda18656b Merge pull request #5011 from maiconpintoabreu/update-emsdk-fix-touch
[zig] Update emsdk version for zig build to fix the issue with the EM_BOOL
2025-06-27 10:18:26 +02:00
Maicon
d659037fbe Update emsdk version for zig build to fix the issue with the EM_BOOL 2025-06-27 08:35:55 +01:00
Ray
c35e136471 Merge branch 'master' of https://github.com/raysan5/raylib 2025-06-24 20:11:37 +02:00
Ray
44f670899c REVIEWED: Avoid rtext dependency on rcore_desktop_sdl #4959 2025-06-24 20:11:35 +02:00
Ray
e09dcf6112 Merge pull request #5006 from ElDigoXD/patch-1
Fix typo on config.h
2025-06-24 19:53:56 +02:00
Diego Sanz
6266d0f419 Fix typo on config.h 2025-06-24 13:48:20 +02:00
Agnis Aldiņš "NeZvērs
ed022e89e5 fix preview crop 2025-06-23 16:22:14 +03:00
Agnis Aldiņš "NeZvērs
f6b7168ed4 Add preview image 2025-06-23 16:06:46 +03:00
Agnis Aldiņš "NeZvērs
fa9653d179 Fix function call 2025-06-23 13:50:24 +03:00
Agnis Aldiņš "NeZvērs
fca2317640 remove //#define PLATFORM_WEB 2025-06-23 13:44:50 +03:00
Agnis Aldiņš "NeZvērs
a2cf878190 cleanup variable shadowing 2025-06-23 13:43:38 +03:00
Agnis Aldiņš "NeZvērs
4233544670 Update core_3d_fps_controller.c 2025-06-23 13:32:08 +03:00
Agnis Aldiņš "NeZvērs
4d5a56a5f8 change game's resolution 2025-06-23 13:15:14 +03:00
Agnis Aldiņš "NeZvērs
eee9dd8c94 Example: core_3d_fps_controller
Quake like camera animations and strafe jump movement
2025-06-23 13:03:35 +03:00
Ray
b677376088 Delete shader in case compilation fails 2025-06-22 23:52:34 +02:00
Ray
1abac023bd Update rcore.c 2025-06-20 23:34:41 +02:00
Ray
8b0230f5b1 Merge pull request #5002 from mlorenc227/master
[rcore] Fix ScanDirectoryFilesRecursively
2025-06-20 23:32:31 +02:00
mlorenc
518ad8b018 Fix ScanDirectoryFilesRecursively
Fixes a regression since 5.5, where `ScanDirectoryFilesRecursively` no
longer does the "recursively" part due to `path` being `static`.

The issue was once already fixed in
5530a3ceb8
but recently made it back it in.
2025-06-20 01:39:01 +02:00
Ray
4bc8d3761c Merge pull request #4999 from danilwhale/raylib-cs.bleedingedge
bindings: add Raylib-cs.BleedingEdge
2025-06-17 16:50:14 +02:00
danil
43bad2612b docs: add Raylib-cs.BleedingEdge to the bindings 2025-06-17 17:15:09 +03:00
Ray
fd4375a74e Merge pull request #4992 from M374LX/rgfw-update
Update RGFW
2025-06-17 11:53:36 +02:00
Ray
17a618758f Merge pull request #4995 from Not-Nik/zig-raygui-options
Allow passing options to raygui in build.zig
2025-06-15 01:46:36 +02:00
Ray
abf255fbe7 Merge pull request #4993 from Marcos-cat/master
add uiua bindings to the list
2025-06-13 05:46:09 +02:00
Marcos Grzesiak
106bcf460a add uiua bindings to the list 2025-06-12 23:41:57 -04:00
M374LX
96c898852c Update RGFW 2025-06-12 19:23:12 -03:00
Ray
3e336e4470 Reviewed warning 2025-06-11 19:52:35 +02:00
Ray
59bcf680aa Code gardening... 2025-06-07 20:14:24 +02:00
Ray
8a3a8ee8e3 Update shapes_digital_clock.c 2025-06-07 20:14:10 +02:00
Ray
533c12c386 Small security tweaks 2025-06-07 15:33:35 +02:00
katonar
060bd787b1 Refactor: Replace DRM swap buffer implementation with asynchronous page-flipping and framebuffer caching
The original implementation created/destroyed framebuffers (FBs) per-frame, leading to kernel overhead and screen tearing. This commit replaces it with a different approach using:
- Asynchronous `drmModePageFlip()` with vblank sync
- Framebuffer caching to reduce repeated FB creation/removal operations
- Proper resource management through BO callbacks and buffer release synchronization
- Added error handling for busy displays, cache overflows, and flip failures
- Event-driven cleanup via page_flip_handler to prevent GPU/scanout conflicts

Co-authored-by: rob-bits
2025-06-05 15:50:07 +02:00
Ray
5f497d0687 REVIEWED: shapes_digital_clock example 2025-06-03 20:42:27 +02:00
Ray
cb369f8df7 Merge pull request #4985 from hmz-rhl/master
[examples] : adding new fancy clock
2025-06-03 20:22:08 +02:00
Hamza RAHAL
3f228f4594 [examples] : adding new fancy clock 2025-06-03 11:40:44 +02:00
Ray
8d319b1004 Merge pull request #4983 from M374LX/miniaudio-update
Update miniaudio to v0.11.22
2025-06-02 18:52:59 +02:00
Ray
d218db9eec Merge pull request #4982 from LainLayer/rgfw-timeout
Change `RGFW_window_eventWait` timeout to -1 to fix `EnableEventWaiting`
2025-06-02 18:50:11 +02:00
github-actions[bot]
59338c2c29 Update raylib_api.* by CI 2025-06-02 16:37:46 +00:00
Ray
714de02a88 Merge pull request #4980 from williewillus/pr4980
[rshapes] Fix incorrect parameter names in DrawRectangleGradientEx
2025-06-02 18:37:34 +02:00
Ray
c81097505c Merge pull request #4981 from garrisonhh/add-build-zig-zon-license
Add LICENSE to build.zig.zon
2025-06-02 18:36:11 +02:00
Ray
53faf7ae74 Merge pull request #4977 from jestarray/patch-2
add const qualifier to ImageDrawTriangleFan and ImageDrawTriangleStrip arguments
2025-06-02 18:35:08 +02:00
M374LX
bb5b5434a7 Update miniaudio to v0.11.22 2025-06-01 14:37:01 -03:00
alqeeu
51958d6e2c changed RGFW_window_eventWait timeout to -1 2025-06-01 17:37:31 +03:00
garrisonhh
b52a9f8a04 Add LICENSE to build.zig.zon 2025-06-01 10:11:42 -04:00
Vincent Lee
19ae6f2c2d [rshapes] Fix incorrect parameter names in DrawRectangleGradientEx
Examining the code shows that the rectangle is drawn winding counterclockwise, starting
with the top left. Therefore the colors used should be in the order: topLeft, bottomLeft,
bottomRight, topRight.

However, the variables actually being used are topLeft, bottomLeft, topRight,
bottomRight. I was confused by this as I was getting striping where I didn't expect any.
Put another way, the last two parameters are misnamed.

This diff swaps the parameter names and their usages. The result is that no runtime
behaviour changes: the same parameter order yields the same visual result both before and
after this change, but the parameter names now correctly reflect what they are actually
used for.

You can actually see this in the implementation of DrawRectangleGradientV, which
(correctly) passes top, bottom, bottom, top to DrawRectangleGradientEx.
2025-05-31 23:00:40 -07:00
github-actions[bot]
58a6846c8f Update raylib_api.* by CI 2025-05-31 21:26:50 +00:00
jestarray
296e3af470 add const qualifier to ImageDrawTriangleFan and ImageDrawTriangleStrip arguments 2025-05-31 14:24:56 -07:00
Ray
924c87db33 Merge pull request #4976 from M374LX/rgfw-update-dev
Update RGFW to 1.7.5-dev
2025-05-31 21:47:54 +02:00
M374LX
6eeaf1dd5b Update RGFW to 1.7.5-dev 2025-05-31 16:43:25 -03:00
Ray
c1bb53738e Merge pull request #4974 from M374LX/rgfw-escape-fix
RGFW: fix Escape always closing the window
2025-05-31 20:43:40 +02:00
Ray
9bf4388a4f Merge pull request #4965 from M374LX/rgfw-update
Update RGFW to 1.7
2025-05-31 20:42:08 +02:00
github-actions[bot]
3414d96eaf Update raylib_api.* by CI 2025-05-31 18:41:49 +00:00
Ray
20c0c92bdb Merge pull request #4963 from meowstr/master
[rshapes] Add DrawEllipseV and DrawEllipseLinesV
2025-05-31 20:41:37 +02:00
M374LX
bc2b2864e0 RGFW: fix Escape always closing the window 2025-05-31 14:24:38 -03:00
Nikolas
b26f6d34ba Allow passing options to raygui in build.zig 2025-05-30 14:30:24 +02:00
Ray
b9c2ecc447 Merge pull request #4969 from M374LX/update-comments
Update comments
2025-05-30 08:05:20 +02:00
github-actions[bot]
8f2ecfba4d Update raylib_api.* by CI 2025-05-30 02:04:09 +00:00
M374LX
3418172617 Update comments 2025-05-29 23:01:48 -03:00
Ray
015db1641f Merge pull request #4964 from M374LX/axes-comment
Update comment (gamepad axes)
2025-05-29 22:45:45 +02:00
M374LX
a9525bfbc2 Update RGFW to 1.7 2025-05-29 16:03:39 -03:00
M374LX
16f398b464 Update comment (gamepad axes) 2025-05-29 15:01:01 -03:00
Meowster
6d5aedbd38 Add DrawEllipseV and DrawEllipseLinesV 2025-05-29 07:10:52 -04:00
Ray
913c236487 REVIEWED: MAX_GAMEPAD_AXES 2025-05-29 12:51:08 +02:00
Ray
341bfb22cc REVIEWED: MAX_GAMEPAD_AXEX for consistency #4960 2025-05-29 12:25:00 +02:00
Ray
2afae1b3e1 Merge pull request #4962 from M374LX/rgfw-rctrl
RGFW backend: add missing Right Control key
2025-05-29 12:09:01 +02:00
Ray
f9fa63366c Merge pull request #4958 from M374LX/unused-var
Remove unused variable
2025-05-29 12:07:14 +02:00
M374LX
c0cf57f8f0 RGFW backend: add missing Right Control key 2025-05-28 22:38:16 -03:00
M374LX
299f5350a4 Remove unused variable 2025-05-28 19:49:57 -03:00
Moros Smith
f7fe8b88cb add EmscriptenKeyboardCallback to consume key events 2025-05-28 17:47:18 -04:00
github-actions[bot]
2d952d8e94 Update raylib_api.* by CI 2025-05-28 15:19:32 +00:00
Ray
d7148f5f9d REDESIGNED: Base64 encoding/decoding functions
Found some issues with output size when padding required, just re-implemented both functions from scratch.
2025-05-28 17:19:19 +02:00
Ray
5ddd13b775 REVIEWED: Hexadecimal formatting to be consistent 2025-05-28 17:18:02 +02:00
Moros Smith
8ef6473d33 return to ray's expected resize behavior 2025-05-25 18:58:35 -04:00
Moros Smith
cf2099f18a the holy grail 2025-05-24 20:33:27 -04:00
github-actions[bot]
8d9c1cecb7 Update raylib_api.* by CI 2025-05-22 15:07:11 +00:00
Ray
afb52b19a4 WARNING: REDESIGNED: EncodeDataBase64(), NULL terminated string returned
Note that returned output size considers the NULL terminator as an additional byte.
2025-05-22 17:06:55 +02:00
Ray
21f0fe2a73 Removed some spaces 2025-05-21 19:06:04 +02:00
Ray
e3b9dbe75b Merge pull request #4947 from padmadevd/master
[rcore] Fixed bug in hovering and input for android
2025-05-19 11:59:14 +02:00
Padmadev D
b6daa48a9c Update rcore_android.c
corrected coding conventions.
2025-05-19 15:09:58 +05:30
Ray
a1d57e83f0 Merge pull request #4948 from parzivail/bug/meshnormals
Fix typo in mesh animNormals
2025-05-19 07:16:48 +02:00
Colby Newman
21e711b13f Fix typo in mesh animNormals 2025-05-18 19:35:21 -04:00
Padmadev D
5da2d10118 Update rcore_android.c
Bug Fix Update
Code to Ignore Hovering Inputs Completely
2025-05-18 18:53:28 +05:30
Ray
2be18e2c54 Merge pull request #4944 from Pivok7/master
[examples] Basic pbr example fix
2025-05-18 15:09:47 +02:00
Moros Smith
358917ffc3 trigger resize event when going into and out of fullscreen mode 2025-05-17 21:08:57 -04:00
Moros Smith
d0d42e78ea inform glfw that a change of window size has taken place 2025-05-17 21:08:35 -04:00
Moros Smith
b618d7b35b use parentElement's dimensions for width/height 2025-05-17 21:08:07 -04:00
Pivok
0ffc8c517f Pbr example fix 2025-05-17 12:32:17 +02:00
Ray
8c99a508c6 REVIEWED: WindowSizeCallback(), GLFW
It is called on window minification and setting internal width/height to 0, that can break things
2025-05-14 23:49:24 +02:00
Ray
a51d334440 Merge branch 'master' of https://github.com/raysan5/raylib 2025-05-14 23:47:32 +02:00
Ray
9d4c31533d Update rtext.c 2025-05-14 23:47:03 +02:00
Ray
15a0cf89b8 Merge pull request #4936 from lumenkeyes/master
build.zig fixes for android targets
2025-05-13 20:54:13 +02:00
Ray
ba31219141 Merge pull request #4937 from Bigfoot71/fix-gen-tangents
[rmodels] Fix and improve `GenMeshTangents`
2025-05-13 20:52:51 +02:00
Ray
5076d5743b Merge pull request #4938 from JeffM2501/const_save_callback
[utils] fix const warning with SaveFileText callback
2025-05-13 20:51:47 +02:00
github-actions[bot]
4a1e9931a6 Update raylib_api.* by CI 2025-05-13 02:55:19 +00:00
Jeffery Myers
aa684a33de make save file callback match const correctness of calling function 2025-05-12 19:54:34 -07:00
Bigfoot71
d135eef462 fix and improve GenMeshTangents 2025-05-12 23:16:06 +02:00
Lumen Keyes
6f11e27bbe fix typo 2025-05-12 11:19:08 -06:00
Lumen Keyes
dea6a24777 build.zig fix: link EGL for Android 2025-05-12 11:13:32 -06:00
github-actions[bot]
63b988ade9 Update raylib_api.* by CI 2025-05-11 09:05:50 +00:00
Ray
f7d03efb49 REVIEWED: DecodeDataBase64(), follow convention:
- All `char *` refer to text strings
- All `unsigned char *` refer to generic byte arrays
2025-05-11 11:05:25 +02:00
Ray
3083f0cd43 REVIEWED: SaveFileText(), const input text 2025-05-11 11:03:49 +02:00
Ray
693c9c292a Formatting tweaks 2025-05-10 22:45:08 +02:00
Ray
4ac31f7cde Merge pull request #4928 from JeffM2501/unload_default_font
[rtext] Properly clean up the default font on unload
2025-05-10 21:47:53 +02:00
Jeffery Myers
ebaa922f6b Properly clean up the default font on unload, it may be reused if the window is created again 2025-05-08 09:57:31 -07:00
Ray
7e07278368 Update rprand.h 2025-05-08 17:06:29 +02:00
Ray
1402e830b4 Merge pull request #4926 from karl-zylinski/draw-sphere-normals
Add normals to DrawSphereEx
2025-05-08 00:26:21 +02:00
Ray
6fad12db73 Merge pull request #4927 from lumenkeyes/master
build.zig fixes for android targets
2025-05-06 18:41:53 +02:00
lumenkeyes
35de7b26a4 catch error in build.zig 2025-05-06 10:08:12 -06:00
lumenkeyes
eae3fd83d5 properly detect if abi is android 2025-05-06 10:04:54 -06:00
lumenkeyes
c4b9c0e039 properly generate android triple in build.zig 2025-05-06 09:46:42 -06:00
Karl Zylinski
a15548fb5a Add normals to DrawSphereEx 2025-05-06 13:09:05 +02:00
Ray
3d6e24af4f Merge pull request #4906 from Bigfoot71/fix-clip
[rlgl] Proposed fix for default near/far clipping range
2025-05-06 11:12:35 +02:00
Ray
512b1bed4f Merge pull request #4925 from JeffM2501/animated_meshes_GL11
[rmodels] support CPU animation in OpenGL 1.1
2025-05-06 00:54:54 +02:00
Jeffery Myers
e07e3354a3 Merge branch 'animated_meshes_GL11' of github.com:JeffM2501/raylib into animated_meshes_GL11 2025-05-05 15:51:13 -07:00
Jeffery Myers
ee2ab11cc5 Use the animated verts and normals in GL 1.1 if they exist 2025-05-05 15:49:23 -07:00
Jeffery Myers
95c96b345c Use the animated verts and normals in GL 1.1 if they exist 2025-05-05 14:54:35 -07:00
Ray
31d63d08e2 Merge pull request #4922 from Bigfoot71/review-file-dir-2
[rcore] Some adjustments for `FilePathList`
2025-05-05 16:57:22 +02:00
Ray
a7ad2d1965 Merge pull request #4918 from JeffM2501/default_font_image_leaks
[rText] Fix issues with default font being used before InitWindow in the image API.
2025-05-05 12:06:55 +02:00
Ray
3d292a6c3c Merge pull request #4923 from JeffM2501/gltf_bone_fix
[rmodels] Fix GLTF bone weight assignments for meshes that are parented to armature bones.
2025-05-05 10:22:21 +02:00
Jeffery Myers
e53a43b7b5 Assign meshes without bone weights to the bone they are attached to so they animate. 2025-05-04 17:32:37 -07:00
Bigfoot71
38aec920b5 makes path static in ScanDirectoryFilesRecursively 2025-05-04 14:47:52 +02:00
Bigfoot71
03988d2ce8 added a NULL check in UnloadDirectoryFiles 2025-05-04 14:46:39 +02:00
Le Juez Victor
c087144385 Merge branch 'raysan5:master' into fix-clip 2025-05-04 12:29:19 +02:00
Ray
82c87d1f69 Merge pull request #4920 from MrScautHD/patch-1
Update BINDINGS.md
2025-05-04 11:41:06 +02:00
MrScautHD
8533d284c1 Update BINDINGS.md 2025-05-04 11:20:11 +02:00
Jeffery Myers
94c5de33a0 Make the default font loadable before InitWindow, for use with the image API.
Make the default font loader early out if we have already loaded parts of it, so we don't leak memory
2025-04-30 17:56:30 -07:00
Ray
3a1d6261e2 Merge pull request #4916 from daniel-abbott/audio_sound_positioning_fix
[examples] PR for #4904, calculate 'right' Vector3 to correctly perform audio positioning.
2025-04-30 19:41:15 +02:00
Daniel Abbott
696f225f29 Update audio_sound_positioning.c
Calculate `right` Vector3 for correct audio stereo positioning.
2025-04-30 10:12:35 -06:00
Ray
1ec281e86f Merge pull request #4914 from Servall4/master
[raudio] fix: GetMusicTimePlayed returns incorrect time after restarting a paused track
2025-04-28 23:13:31 +02:00
Ray
d1a3f93077 Merge pull request #4915 from rael346/cmake-replace-custom-variable
cmake: replace custom variable with built-in one
2025-04-28 23:11:56 +02:00
Duy Tran
f0de896f36 cmake: replace custom variable with built-in one 2025-04-28 11:57:53 -04:00
Ivan Ugryumov
ec5ce8c7fe Update raudio.c 2025-04-28 14:29:51 +03:00
Ray
1d020d6db1 Merge pull request #4913 from rael346/cmake-uninstall-conflict
Only create uninstall target when raylib is top level
2025-04-27 21:12:10 +02:00
Duy Tran
629d4c1721 only create uninstall target when raylib is top level 2025-04-27 14:35:30 -04:00
Ray
27a4fe8851 Merge pull request #4910 from marler8997/fixEmscripten
build.zig: fix building raylib for emscripten
2025-04-26 22:50:49 +02:00
Jonathan Marler
8d03636132 build.zig: fix building raylib for emscripten
build.zig doesn't support the examples for the emscripten OS but it does
support the raylib library. However, the examples panic if emscripten
is configured which prevents it from building the library. I've replaced
this panic with a fail step to fix this.
2025-04-26 10:37:11 -06:00
Ray
5c954c1f52 Merge pull request #4909 from gfaster/alt_fix
Revert GLFW_SCALE_FRAMEBUFFER to pre GLFW 4.3 behavior
2025-04-26 15:14:58 +02:00
Ray
7c6537a34f Merge pull request #4907 from ZeanKey/master
[example] Closes #4901, Fix Problems in 'text_draw_3d.c'
2025-04-26 15:12:44 +02:00
Gavin Rohrer
10478ff756 Revert GLFW_SCALE_FRAMEBUFFER to pre GLFW 4.3 behavior 2025-04-25 14:32:02 -04:00
Z-AKey
12bf30ce04 Merge branch 'raysan5:master' into master 2025-04-22 16:49:12 -04:00
Zean Key
77f31178ed fixed text_draw_3d 2025-04-22 16:48:50 -04:00
Le Juez Victor
461c9c9d90 review tabs 2025-04-22 15:02:09 +02:00
Le Juez Victor
a7333a9dae review near/far 2025-04-22 15:00:54 +02:00
Ray
688a81d333 Update ROADMAP.md 2025-04-20 13:15:28 +02:00
Ray
f3b68184c0 Merge pull request #4903 from JeffM2501/audio_code_formatting
[RAUDIO]Fix code formatting issue from PR #4898
2025-04-20 11:20:28 +02:00
Jeffery Myers
0f6b9ee738 format math the way ray likes it 2025-04-18 07:27:20 -07:00
Ray
b185f482d0 Merge pull request #4896 from mUnicorn/fix_bones_animation_scale
[rmodels] Fix bones animation scale
2025-04-18 10:46:00 +02:00
Ray
73030e02d4 Merge pull request #4895 from AndrewHamel111/descriptive-window-flag-warning
Add Warning to direct users to appropriate WindowState / ConfigFlag function
2025-04-18 10:43:24 +02:00
Ray
cf1713e6dd REVIEWED: VS2022 projects use a custom resource file...
...instead of relying in src/raylib provided one. #4900
2025-04-18 10:25:40 +02:00
Ray
6b85aa7f72 Merge pull request #4900 from JeffM2501/duplicate_resource
[Examples] Remove duplicate resource file
2025-04-18 10:04:49 +02:00
Ray
fdc835d294 Merge pull request #4898 from JeffM2501/better_buffer_defaults
[RAUDIO] Better computation of the default audio stream buffer size
2025-04-18 09:59:14 +02:00
Ray
f6d05cc5e6 Merge pull request #4899 from JeffM2501/examples_casting_4-26-25
[Examples] Fix cast warnings in examples.
2025-04-18 09:56:37 +02:00
Zean Key
869ae8bbd2 [example] fix text size in text_draw_3d 2025-04-17 14:40:36 -04:00
Jeffery Myers
0b37251fbd Remove duplicate resource file 2025-04-16 18:26:06 -07:00
Jeffery Myers
eb3d96a36a Fix cast warnings in examples. 2025-04-16 18:23:55 -07:00
Jeffery Myers
5185d4c427 use the device channels and sample size when computing the default buffer size. 2025-04-16 18:13:41 -07:00
d.isakov
42a40b3920 move first mesh bones calculation under check for its presense 2025-04-16 08:04:58 +02:00
d.isakov
b4f1ff9a00 #4888 fix UpdateModelAnimationBones scale transform 2025-04-16 07:49:26 +02:00
AndrewHamel111
fdb92b373b Warning to direct users to appropriate function 2025-04-15 21:08:35 -04:00
Ray
5b940692ea REVIEWED: ExportFontAsCode() not checking isGpuReady #4894 2025-04-15 13:09:44 +02:00
Ray
80fcca4155 Update rcore_desktop_glfw.c 2025-04-14 12:37:06 +02:00
Ray
cc5739a6d7 REVIEWED: Some PRs formating 2025-04-13 20:55:38 +02:00
Ray
cb111ad15e Merge pull request #4883 from JeffM2501/highdpi_screenshot
[RCORE] Fix issue with screenshots on HIGHDPI displays
2025-04-12 20:56:36 +02:00
Ray
ab901c58bb Merge pull request #4881 from Bigfoot71/raylib-sound-positioning
[examples] Add 3D sound spatialization example
2025-04-12 20:55:29 +02:00
Ray
618adb858a Merge pull request #4884 from eutro/racket-raylib-5.5
Update `racket-raylib` version in BINDING.md
2025-04-12 20:54:43 +02:00
Ray
5000f9f6f8 Merge pull request #4887 from marler8997/buildZigFormat
build.zig: run zig fmt
2025-04-12 20:52:41 +02:00
Gunko Vadim
53cbd3cb11 rename 2025-04-12 07:10:14 +05:00
Gunko Vadim
0d86084709 Update text_unicode_font_example.c
The creation of the array has been rewritten, the size of the example has been reduced
2025-04-12 07:07:14 +05:00
Jonathan Marler
3d792f3363 build.zig: run zig fmt 2025-04-11 09:44:44 -06:00
Gunko Vadim
4184a5b251 Update text_unicode_font_example.c 2025-04-11 18:43:12 +05:00
Gunko Vadim
5d7e8010a5 example unicode font
A review of the code is required.  Since I'm not sure what's written correctly at all.
2025-04-11 14:39:06 +05:00
eutro
7a6b3ebf3a Update racket-raylib version in BINDING.md 2025-04-11 00:06:18 +01:00
Jeffery Myers
60eb3a14d7 Only scale the screenshot by the DPI scale if we are doing automatic High DPI scaling, otherwise the native resolution is correct. 2025-04-10 13:59:09 -07:00
Bigfoot71
59dc53d20e update readme 2025-04-09 18:09:50 +02:00
Bigfoot71
d5733ffb9a update example makefiles 2025-04-09 18:09:32 +02:00
Ray
a5639bb186 Merge pull request #4861 from luis605/view-depth-texture
[examples] Added new shader example: `shader_depth_texture`
2025-04-09 17:57:20 +02:00
Bigfoot71
a554ef339b add audio_sound_positionning example 2025-04-09 17:27:45 +02:00
Ray
5aa3f0ccc3 Merge pull request #4879 from brccabral/cmake_config_verbose
[cmake] set correct description for verbose option
2025-04-07 11:30:26 +02:00
Bruno Cabral
636e239e07 [cmake] set correct description for verbose option 2025-04-06 22:33:46 -07:00
luis605
4960cc74e0 [examples] Reviewed shader view depth 2025-04-04 22:41:34 +01:00
Ray
ceb1a5ea2b REVIEWED: Temporaly fix for issue #4874 2025-04-03 18:31:05 +02:00
Ray
f4f860b343 Merge pull request #4873 from zet23t/bugfix-4872-sdl-touch-handling-error
[rcore][SDL2] First touch position is overwritten with mouse pos
2025-04-02 19:19:54 +02:00
Eike Decker
1c4aa1378f [rcore][SDL2] First touch position is overwritten with mouse pos
I believe it makes sense to only do this when there are no known
touch points. I am not even sure if this should be done at all.

See https://github.com/raysan5/raylib/issues/4872 for more information.
2025-04-01 23:10:19 +02:00
Ray
b529f52dab Merge pull request #4871 from lumenkeyes/add-zig-android-target
small build.zig fix
2025-04-01 20:00:16 +02:00
Lumen Keyes
d0cf8961d3 fix typo 2025-04-01 10:54:51 -06:00
Lumen Keyes
33b2829a89 fix android-libc.txt generation
Previously, the libc paths file `android-libc.txt` was written to
the folder from which the user ran `zig build`. This caused
problems when using raylib as a dependency in other zig
projects, since raylib is not built in the project root, but the
`android-libc.txt` file was still generated in the project root. The file
should now be generated in .zig-cache, which should fix the isssue (and
leave the project root folder cleaner).
2025-04-01 10:43:22 -06:00
Ray
11e15ab2ac Merge pull request #4870 from lumenkeyes/add-zig-android-target
Add Android Target to build.zig
2025-04-01 01:28:20 +02:00
Ray
1a67dcb578 REVIEWED: RGB order on SDL3 #3568 2025-04-01 01:26:51 +02:00
Lumen Keyes
d52687eeee Add Android Target to build.zig
Added an Android target to the zig build script.
This allows a user to easily build with only Android-supported
libraries.
Library paths are automatically inferred as much as possible.
2025-03-31 13:36:51 -06:00
Ray
d4202a09e6 Merge pull request #4868 from marler8997/coreWindowFlagsBorderless
core_window_flags example: add borderless windowed toggle
2025-03-31 19:24:55 +02:00
Jonathan Marler
f19d4c71ab core_window_flags example: add borderless windowed toggle 2025-03-31 10:23:34 -06:00
Ray
902ffde898 Merge pull request #4865 from marler8997/core_highdpi_example
[examples] Adding `core_high_dpi` example
2025-03-29 16:42:45 +01:00
Jonathan Marler
336fd78f74 Add core_highdpi example
This example enables HIGHDPI and renders a scale showing how the logical
size compares to the pixel size of the window.
2025-03-28 16:48:21 -06:00
Ray
9a049d1d27 Merge pull request #4859 from MikiZX1/master
Update rcore_desktop_sdl.c
2025-03-28 18:03:32 +01:00
Ray
61aea2495a Merge pull request #4863 from marler8997/fixImmediateRestore
Prevent immediate window restore from minimize in core_window_flags
2025-03-28 18:02:12 +01:00
Ray
57a00b09b2 Merge pull request #4862 from marler8997/coreFlagsFps
Uncomment SetTargetFPS in core_window_flags
2025-03-28 17:56:30 +01:00
Ray
1f9d7c6f88 Merge pull request #4866 from marler8997/restoreWindowDesc
Improve description of RestoreWindow
2025-03-28 17:55:45 +01:00
Jonathan Marler
af16f7823a Improve description of RestoreWindow
Restore window currently says it sets the window state to:

   "not minimized/maximized"

However, if a window is maximized and then minimized, it's typical that
it would restore back to being maximized, which is what seems to happen
from my testing. I've reworded the description to better reflect
this behavior.
2025-03-28 10:39:22 -06:00
Ray
44f4400f5b Merge pull request #4864 from marler8997/excludeRglfw
[build] only include rglfw.c for glfw platform
2025-03-27 08:30:32 +01:00
Jonathan Marler
508ca5c80f [build] only include rglfw.c for glfw platform
It looks like raylib doesn't require rglfw.c if you're using the RGFW
backend.  I'm guessing the same is true for SDL but I haven't tested.
Excluding this one file brings the raylib library down from 6.9 MB to
6.3 MB for RGFW.

However, one of the examples requires the symbols from rglfw.c,
to accomodate this I added a function that will check whether raylib has
already included rglfw and if not include it for that one example.
2025-03-26 21:14:46 -06:00
Jonathan Marler
00fb09cebf Prevent immediate window restore from minimize in core_window_flags
The core_window_flags example automatically restores the window from
being minimized after 3 seconds. However, it only resets the frameCounter
if the window is minimized through the app from inputting KEY_N.  This
means if you miminize the window by other means (like pressing the minimize
button) then the example will immediately restore the window because the
frame counter wasn't reset. I've fixed this by setting the frameCounter
back to 0 once it's expired. I also added a note in the UI that the example
automatically restores the window so it's not a surprise.
2025-03-26 20:02:03 -06:00
Jonathan Marler
8749ba9ebf Uncomment SetTargetFPS in core_window_flags
I think this line was accidently commented out in this commit:

3d1ae3500c

The FPS limit is needed to get the desired wait time for the "hide window"
test, which uses the frame counter to hide the window for 3 seconds. On
my machine without this limit it runs at over 1000 FPS and it appears
like the hide window state is broken.

I also added some text that tells the user that it only hides the window
for 3 seconds so they're not surprised when the window automatically
reappears.
2025-03-26 16:35:31 -06:00
luis605
8ec52e3b25 Added example to build system 2025-03-26 19:47:45 +00:00
luis605
eeda7a4b82 Added shaders_view_depth example to the build system 2025-03-26 17:41:04 +00:00
Ray
001e78014c Merge pull request #4860 from marler8997/fixDivide0
Avoid divide by 0 in core_custom_frame_control example
2025-03-26 18:01:37 +01:00
luis605
e08fc8ab80 Added new example - [shader] render depth texture 2025-03-26 16:59:05 +00:00
Jonathan Marler
611c43719f Avoid divide by 0 in core_custom_frame_control example 2025-03-26 10:58:59 -06:00
MikiZX1
55c6864092 Update rcore_desktop_sdl.c
raylib app crashing when started and a gamepad is already connected to the PC (even if the gamepad is not used in the app). I only tested this with a gamepad that has a layout which is not recognized. Using SDL3 as backend.
2025-03-26 14:06:58 +01:00
Ray
beaadc9185 Merge pull request #4856 from marler8997/oneBuild
[build] remove examples/build.zig, incorporate into main build.zig
2025-03-25 22:39:13 +01:00
Ray
3d83c1c796 Format tweak 2025-03-25 19:27:55 +01:00
Jonathan Marler
ac17de5074 [build] remove examples/build.zig, incorporate into main build.zig
Removes the second build.zig in the examples directory and incorporates it
into the main build.zig. This gives the zig build system the data needed to
know if the raylib library needs to be rebuilt when running any example.
2025-03-25 11:05:59 -06:00
Ray
909c83fd4a Avoid path filtering on TakeScreenshot() 2025-03-25 16:22:46 +01:00
Ray
32c8f396c2 Merge branch 'master' of https://github.com/raysan5/raylib 2025-03-25 16:21:53 +01:00
Ray
63e608d485 comment tweak 2025-03-24 15:07:36 +01:00
Ray
f5c96302d5 Merge pull request #4850 from sleeptightAnsiC/fix_rcore__ChangeDirectory_TRACELOG
[rcore] fix: TRACELOG upon successfully changing directory
2025-03-23 19:13:12 +01:00
sleeptightAnsiC
8e9c3ceb57 [rcore] fix: TRACELOG upon successfully changing directory
InitWindow() prints CWD during initialization,
but ChangeDirectory() does not, which is quite confusing when you start
messing with CWD. Now said function should log similar message.
2025-03-22 21:20:17 +01:00
Ray
46cd07d2c7 WARNING: REVERTED CHANGE THAT BROKE BATCHING!!! #4849
I'm sorry... I did not detect this change was breaking batching... :(
2025-03-21 17:17:45 +01:00
Ray
266fba1111 Minor tweaks 2025-03-21 17:07:55 +01:00
Ray
add4da8fb3 Merge pull request #4845 from bamless/log-zoom
[examples] use logarithmic zoom scaling in 2d camera examples
2025-03-20 10:38:59 +01:00
Fabrizio Pietrucci
e140aca1b5 Increase zoom factor in core_2d_camera.c
This compensate for slower zoom speed due to log scaling
2025-03-19 20:19:19 +01:00
Fabrizio Pietrucci
8b84c999d2 Use logarithmic zoom scaling in 2d camera zoom examples 2025-03-19 19:48:04 +01:00
Ray
cd9206956c Merge pull request #4843 from theundergroundsorcerer/DrawCircleSector-quickfix
Add early return when angles are equal in DrawCircleSector and DrawCircleSectorLine functions.
2025-03-18 11:29:32 +01:00
Myrddin Krustowski
589ad0a33d Add early return to circle sector functions when angles are equal.
Prevents unnecessary work and division by zero (when segments=0) in DrawCircleSector/DrawCircleSectorLines when startAngle equals endAngle, matching existing behavior in DrawRing/DrawRingLines.
2025-03-18 11:51:58 +02:00
Ray
2f63a15630 Merge pull request #4836 from JeffM2501/unscale_on_resize
[rcore] Correctly handle window size on resize in auto-scaled HIGHDPI environment
2025-03-14 17:15:14 +01:00
Jeffery Myers
d56ab670c3 spaces not tabs 2025-03-14 08:18:26 -07:00
Ray
bbbdd1f080 Merge pull request #4839 from aidonmaster/patch-1
Converting int to char
2025-03-14 08:09:49 +01:00
Aidon
513753c394 Converting int to char
Fixes warning: narrowing conversion caused by trying to convert int to unsigned char
2025-03-13 21:50:20 -03:00
Ray
cb830bed72 Increased depth size and clip distances to avoid z-fighting issues 2025-03-13 16:34:39 +01:00
Ray
d0e638cc31 REVIEWED: Platform DRM messages... 2025-03-13 11:42:16 +01:00
Alex Anderson
99a9ecfaac [rcore] Support window flags with initialization issues
This may not be the correct approach, however this appears to work. The idea is that before modifying `CORE.Window.flags` when first creating the window we keep a copy of the flags in order to call `SetWindowState` after initialization has completed, which should behave as if `MaximizeWindow` or `MinimizeWindow`, or conceptually any other flag modifying function were called after `InitWindow`.

This pull request only performs this for the windows platform, modify as needed in the switch statement at the end for others.
2025-03-12 14:56:02 -07:00
Jeffery Myers
4bed3741c1 Unscale the window size on resize if we are doing automatic HighDPI scaling. 2025-03-12 14:16:50 -07:00
Ray
749a512f13 REVIEWED: ScanDirectoryFiles*() #4833 2025-03-12 12:44:40 +01:00
Ray
654d5c80c2 Merge pull request #4833 from MykBamberg/master
[rcore] Use snprintf to prevent buffer overflow in path construction
2025-03-12 12:40:25 +01:00
Ray
a0318e67aa Merge pull request #4835 from NiamhNightglow/master
Guard against DEBUG Redefinition
2025-03-12 11:29:11 +01:00
Nia Nightglow
fffbbad2f7 Guard against DEBUG Redefinition
Undefine DEBUG to avoid external redefinition
warnings/conflicts.  This is probably a common
definition for many external build systems'
debug configurations.

This ensures raylib will not emit
a warning about the DEBUG definition being
redefined in external build systems.
2025-03-12 00:13:01 -05:00
MykBamberg
daa2921476 [rcore] Use snprintf to prevent buffer overflow in path construction 2025-03-12 01:38:39 +01:00
Ray
b80250bee4 Merge pull request #4807 from RicoP/RicoP/sinfl_bsr
[rcore] sinfl_bsr fix for TCC
2025-03-11 08:32:32 +01:00
Rico P
0934cdba48 fix C++ style cast 2025-03-11 07:09:10 +01:00
Rico P
7dc409d060 potential fix for MSVC compile error 2025-03-11 07:03:57 +01:00
Rico P
e7872a700d update sinfl_bsr 2025-03-10 20:57:48 +01:00
Ray
7f8bf2233c REVIEWED: Formating to follow raylib conventions 2025-03-10 17:08:18 +01:00
Ray
bd8e59f18d Replace size_t by unsigned int 2025-03-10 17:07:18 +01:00
Ray
4c8c72778d Remove trailing spaces 2025-03-10 17:04:29 +01:00
Ray
9c62a7823b Update Makefile 2025-03-10 17:04:14 +01:00
Colleague Riley
0853c5b03f [rcore][RGFW] bug fixes (#4798)
* update RGFW to 1.6

* properly handle RGFW_quit events

* fix rcore_desktop_rgfw bugs

* update

* update

* uncomment out
2025-03-10 16:50:40 +01:00
Amy Wilder
61a026f7ef [examples] Reorganize some conditions to fix overlap bugs (#4829)
* Reorganize some conditions to fix overlap bugs

* Fix edge case where control point selection outlives mouse down
2025-03-09 11:40:24 +01:00
Ray
5bda46960c REVIEWED: Linux workflow to run on ubuntu-latest
Previous runner `ubuntu-20.04` is deprecated and being removed soon: https://github.com/actions/runner-images/issues/11101
2025-03-08 18:49:50 +01:00
David Vanderson
bbeade636c build.zig.zon: update hashes (#4826) 2025-03-08 12:42:17 +01:00
10aded
097e80d1c4 added comment to fingerprint line per recommendation from the standard 'build.zig.zon' file generated by 'zig init' in Zig 0.14.0 (#4827) 2025-03-08 02:21:50 +01:00
sleeptightAnsiC
f430d72a8c [examples] fix: use quotation marks when including raylib.h (#4821)
...so it will always prioritize local version of raylib instead of
system-wide installations, which is a huge problem when testing any
changes done locally to raylib as it might cause silent mismatch issues.
There were only 4 examples affected by this issue which were using
`#include <raylib.h>`. Other examples use proper `#include "raylib.h"`

Fixes: https://github.com/raysan5/raylib/issues/4820
2025-03-07 19:24:53 +00:00
zewenn
590f793755 Update build.zig.zon to use the new zig v0.14 version (#4819) 2025-03-07 19:24:01 +00:00
Kaluub
9ba0cdbe6d Fix GetCurrentMonitor comments. (#4812) 2025-03-07 19:21:08 +00:00
Ashish Bhattarai
f1385f3aec Fix stb_truetype composite glyph scaling logic (#4811) 2025-03-04 18:53:11 +01:00
Ray
cb3168a048 Wow! We surpassed the **8000** commits! AMAZING! :D 2025-03-02 17:42:10 +01:00
sleeptightAnsiC
34159399cf [rcore] fix crash in InitWindow, due to unchecked result of InitPlatform (#4803)
* [rcore] fix crash in InitWindow, due to unchecked result of InitPlatform

Check the result of InitPlatform(), if it isn't 0, report the Error
and return. This prevent crashes and allows for gracefully aborting
or recovering by checking IsWindowReady().

Partially-fixes: https://github.com/raysan5/raylib/issues/4801

* [rcore] style: store the result of InitPlatform() before checking it

Small style change that doesn't impact how the code behaves here.
Variable 'result' is not used anywhere else in this block,
it's just for compliance with Raylib's coding conventions.

Requested in PR: https://github.com/raysan5/raylib/pull/4803#discussion_r1976502788

* [rcore] use LOG_WARNING when InitPlatform() fails

...as this is preferred over LOG_ERROR.

Requested-by: https://github.com/raysan5/raylib/pull/4803#discussion_r1976651724
2025-03-02 17:05:09 +01:00
Rico P
539c45ee23 sinfl_bsr fix for TCC 2025-03-02 16:20:49 +01:00
Ray
b99c2848c1 Merge branch 'master' of https://github.com/raysan5/raylib 2025-03-02 13:43:32 +01:00
Ray
654131799e Minor tweaks 2025-03-02 13:43:15 +01:00
sleeptightAnsiC
a20d9dedf3 [desktop_glfw] fix InitPlatform crash caused by glfwCreateWindow... (#4804)
...returning NULL. This was causing a crash few lines later.

Refs: https://github.com/raysan5/raylib/issues/4801#issuecomment-2691201072
Partially-fixes: https://github.com/raysan5/raylib/issues/4801
2025-03-01 23:42:07 +01:00
Bruno Cabral
eb8a343e31 [cmake] Use STATIC lib ON by default (#4799)
* search raylib in custom directory

* avoid loading dynamic library when both are installed

* raylib_USE_STATIC_LIBS as option ON
2025-02-26 07:48:59 +01:00
Colleague Riley
e4dcdfa1f2 update RGFW to 1.6 (#4795) 2025-02-25 21:49:37 +01:00
Ray
e4993c5557 Merge branch 'master' of https://github.com/raysan5/raylib 2025-02-25 17:50:54 +01:00
Ray
557d071fa2 Reviewed shader loading message 2025-02-25 17:50:46 +01:00
jordan4ibanez
7cae259a6d Reviewed shaders comment wording (#4793) 2025-02-25 14:26:52 +01:00
Ray
da8a08006a Added some comments on latest change 2025-02-25 12:46:06 +01:00
Destructor17
27af359d1c [rlgl] Preserve texture on mode switching (#4364)
* Fix textures on draw mode switch

* formatting fix

* ident
2025-02-25 12:39:00 +01:00
Ray
e1ec595251 ADDED: Resource file to example projects #4790 2025-02-25 12:06:34 +01:00
Ray
0037ee5420 Merge branch 'master' of https://github.com/raysan5/raylib 2025-02-25 11:43:32 +01:00
Ray
256953957f Update Makefile 2025-02-25 11:43:25 +01:00
Ray
a979b10966 Minor format tweak 2025-02-25 11:43:22 +01:00
Rico P
1e2fd94209 fix linkage warnings under windows (#4766) 2025-02-24 13:54:17 +01:00
Slendi
8edbd07b5e Do not check GUI libs for DRM (#4792)
Signed-off-by: Slendi <slendi@socopon.com>
2025-02-24 13:53:30 +01:00
Ray
294da26042 Update raymath.h 2025-02-23 23:07:12 +01:00
Ray
fc5ff8db5c Update raymath.h 2025-02-23 23:06:31 +01:00
Ray
a5907bfdca REVIEWED: MatrixDeterminant() #4780 2025-02-23 23:04:52 +01:00
Mario Nachbaur
85a87baf69 Support IsWindowHidden() on web. (#4789) 2025-02-23 18:19:42 +01:00
Jay Rhoden
015ab9df18 Amend comment to explain what LoadCodepoints is doing. (#4787)
As a beginner, it was not clear to me what the purpose of the LoadCodepoints function is. I am trying to help past me.
2025-02-23 18:19:10 +01:00
Peter0x44
99d2119dd6 [build] Add CI for ARM64 with Visual Studio (#4781)
* [build] Add ARM64 configuration to raylib.sln

* [build] Add ARM64 to windows.yml
2025-02-21 15:31:50 +01:00
Ralph Caraveo
4522ecae1a [raudio] Fixed memory leak on early-return of WaveFormat func (#4779)
In the case of a failure within miniaudio on the function: ma_convert_frames, the dynamic memory allocated for the `data` variable  will leak on the early return.
2025-02-21 15:29:12 +01:00
Colleague Riley
c34ef35433 Update RGFW and ensure it's consistent with the GLFW backend (#4783)
* add PLATFORM_WEB_RGFW

* fix some bugs

* fix web_rgfw gamepad

* send fake screensize

* fix gamepad bugs (linux) | add L3 + R3 (gamepad)

* fix?

* update RGFW (again)

* update raylib (merge)

* fix xinput stuff

* delete makefile added by mistake

* update RGFW

* update RGFW (rename joystick to gamepad to avoid misunderstandings

* update RGFW (fix X11 bug)

* update RGFW

* use RL_MALLOC for RGFW

* update RGFW (fixes xdnd bug)

* fix some formating

* Update RGFW

* update RGFW

* undo change

* undo change

* undo change

* undo change

* have .scroll be 0 by default

* update RGFW

* update RGFW

* update RGFW

* fix year

* fix wasm key event bug

* update RGFW

* link to IOKit

* update
2025-02-21 12:32:09 +01:00
Ray
5ea60dd3ce Minor tweaks 2025-02-20 18:10:01 +01:00
Ray
32fcfd3549 Minor tweaks 2025-02-19 13:38:22 +01:00
sleeptightAnsiC
77df0ab1e8 [rcore_desktop_glfw.c] fix: make sure that GLFW uses RL_*alloc macros (#4777)
Raylib allows for providing custom allocators via macros.
GLFW supports this too, but via function pointers.

Make sure that GLFW uses those Raylib macros, by wrapping them in
function calls and setting them up inside of InitPlatform().
This is possible because of glfwInitAllocator() and GLFWallocator.

Fixes: https://github.com/raysan5/raylib/issues/4776
Relates-to: https://github.com/raysan5/raylib/issues/4751
2025-02-18 22:53:18 +01:00
Brian E
11090ab6cb [raylib.h] Added space after comma (#4774)
args for ImageResizeNN were missing a space in the arguments after a comma, i just added one.
2025-02-17 12:12:59 +01:00
vict-Yang
b49c079b1d Fix typo in rshapes.c (#4772) 2025-02-16 15:43:32 +01:00
Le Juez Victor
2b59e7475f Implement Android-specific functions (#4769)
`GetWindowScaleDPI` and monitor physical dimensions
2025-02-15 19:34:51 +01:00
Le Juez Victor
c647d33703 Better default values for normals and tangents (VBOs) (#4763) 2025-02-14 01:00:05 +01:00
mannikim
ee946b2f16 use strstr instead of TextFindIndex (#4764) 2025-02-14 00:58:33 +01:00
veins1
1d87932d93 TextSubtext fixes (#4759)
Fix buffer write overflow
Fix reading past the end of text
2025-02-12 23:12:10 +01:00
Thomas Anderson
a1de60f3ba added missing file (#4754) 2025-02-08 11:23:15 +01:00
github-actions[bot]
a61c710b45 Update raylib_api.* by CI 2025-02-08 10:22:50 +00:00
goto40
6a644b48f0 doc: audio stream processor, number of channels (#4753)
* doc: audio stream processor

* fixed accidental encoding effect
2025-02-08 11:22:34 +01:00
Ray
cceabf6961 Formatting review 2025-02-02 13:00:20 +01:00
Ray
cfe96931f5 REVIEWED: Formatting #4739 2025-02-02 12:59:34 +01:00
Nikolas
bddb5df0d4 [rmodels] Separate GLTF roughness and metallic channels on load (#4739) 2025-02-02 12:48:18 +01:00
Gil Reis
5a254e3d5e Set PLATFORM to Web by default when configuring web builds with emcmake (#4748) 2025-02-02 12:46:28 +01:00
Henrik A. Glass
4f5a20a634 Add missing increments of k in LoadImageDataNormalized() (#4745) 2025-02-01 21:30:21 +01:00
Chris Dill
1958de4a12 Update raylib-cs binding link (#4746) 2025-02-01 21:29:27 +01:00
whaley
e85ae86f70 [platforms/glfw] fix: allow GetGamepadButtonPressed() to return GAMEPAD_BUTTON_LEFT_TRIGGER_2 / GAME_PAD_BUTTON_RIGHT_TRIGGER_2 if they are pressed (#4742) 2025-02-01 10:50:25 +01:00
sleeptightAnsiC
99dfec070a [rtext] fix: misuse of cast in GetCodepointCount (#4741)
I was really wondering what is going on here :D I believe this code
tried initially to out-cast 'const' specifier but this is not needed here
at all. Currently, it just confuses whoever reads this so I changed it.
The old code would also trigger -Wcast-qual warning on some compilers.
2025-01-31 14:44:23 +01:00
Eike Decker
1f6de0c507 Replacing hardcoded canvas id references with module variable usages (#4735)
Should also have the benefit of being faster.
2025-01-31 00:34:51 +01:00
Ray
d46ba9a671 Merge branch 'master' of https://github.com/raysan5/raylib 2025-01-28 16:19:39 +01:00
Ray
9789ff123b REVERTING: emscripten_sleep() previous removal #4713 2025-01-28 16:19:30 +01:00
Peter0x44
2492dd3d0a [build] [Makefile]: Undefine _GNU_SOURCE for rglfw.c (#4732)
Currently, a warning about _GNU_SOURCE being redefined is emitted when
compiling rglfw.c

In file included from rglfw.c:99:
external/glfw/src/posix_poll.c:27:9: warning: "_GNU_SOURCE" redefined
   27 | #define _GNU_SOURCE
      |         ^~~~~~~~~~~
<command-line>: note: this is the location of the previous definition

This can be avoided by not defining _GNU_SOURCE on the command line for
this file.

Defining feature test macros in source code is not really good practice
so this should probably reviewed in glfw itself, at least to maybe check
 #ifdef _GNU_SOURCE first. But for now this change will suffice.

Fixes #4725
2025-01-27 23:15:09 +01:00
elite0OG
5504983c91 Update CMakeLists.txt (#4727)
Cmake warn remove
2025-01-27 09:20:10 +01:00
Asdqwe
f6f31a9f21 [rtextures] Fix HalfToFloat() and FloatToHalf() dereferencing issues with an union (#4729)
* Fix HalfToFloat() and FloatToHalf() dereferencing issues with an union

* Remove unnecessary initialization

* Moved the union to inside the functions
2025-01-26 21:26:18 +01:00
Ray
53ea275b9c Merge branch 'master' of https://github.com/raysan5/raylib 2025-01-26 19:43:01 +01:00
Ray
861ebafe62 Update shaders_mesh_instancing.c 2025-01-26 19:42:52 +01:00
Asdqwe
139de05e9d [rcore] [SDL2] Fix gamepad event handling by adding joystick instance id tracking (#4724)
* Fix gamepad SDL_JOYDEVICEADDED and SDL_JOYDEVICEREMOVED event handling for PLATFORM_DESKTOP_SDL by adding joystick instance id tracking

* Fix gamepad button handling
2025-01-25 20:49:42 +01:00
Nikolas
49d37b035f [rtexture] Cubemap mipmap loading improvements (#4721)
* [rtextures] Only build cubemap mipmaps when necessary

* [rtextures] Assign correct mipmap count to cubemaps
2025-01-24 10:41:32 +01:00
Anstro Pleuton
7bfc8e8ca7 [example] Add shaders_rounded_rectangle example (#4719)
* Add shaders_rounded_rectangle example

* Minor tweaks to example template (add star, more)

* Combine shaders

* Fix changes after review

---------

Co-authored-by: Anstro Pleuton <anstropleuton@github.com>
2025-01-23 10:51:36 +01:00
Ray
87f17538d0 Reviewed warning on shared library generation for web 2025-01-21 19:23:16 +01:00
sleeptightAnsiC
322ba54c08 Fix(WEB): Makefile: throw an error when trying to build SHARED library (#4718)
When asking Makefile to create SHARED library for WEB
	$ make TARGET_PLATFORM=PLATFORM_WEB RAYLIB_LIBTYPE=SHARED
it would instead silently create STATIC library
thus not fulfilling the request as expected

This commit adds an error in this case and stops further execution.

This is not consistent with Cmake, because Cmake throws the warning and
does not stop, but Cmake can easily recover from this case and people
probably does not even notice it. However, Makefile is something that
you have to handle yourself and you have to recover from any issues so
having an error and aborting with exit code 1 is more expected.
Otherwise people may spend a lot of time debugging Makefile in order to
understand what's even going on.

Fixes: https://github.com/raysan5/raylib/issues/4717
2025-01-21 19:20:51 +01:00
Ray
2c50da9a6a REVIEWED: -sASSERTIONS usage by linker #4717 2025-01-21 19:18:23 +01:00
Ray
d48b8afbb5 Update rcore_web.c 2025-01-20 14:01:57 +01:00
Anthony Carbajal
77c509db6e removed hardcoded sleep (#4713) 2025-01-20 12:14:18 +01:00
Anstro Pleuton
773e3f5f9f Update more examples inconsistencies (#4711)
Co-authored-by: Anstro Pleuton <anstropleuton@github.com>
2025-01-19 17:17:38 +01:00
sleeptightAnsiC
10d0616d1f fix(rtextures): TCC not being able to compile due to: 'emmintrin.h' not found (#4707)
define STBIR_NO_SIMD when __TINYC__ is defined so stb_image_resize2 will
not include *mmintrin which are not supported by all compilers.

There are similar checks for __TINYC__ already elswere in raylib
and they are also mostly there to disable SIMD headers.

Additionally, move similar check for stb_image, to be a little bit
deeper. Before it was defining STBI_NO_SIMD without including stb_image
It was also clashing with note, causing said note to make no sense.

Fixes: https://github.com/raysan5/raylib/discussions/2994
Reference: https://github.com/nothings/stb/issues/1738
2025-01-19 12:06:27 +01:00
github-actions[bot]
e70f9157bc Update raylib_api.* by CI 2025-01-18 19:25:01 +00:00
Chris
09272e2e11 Updted the comment for SetShaderValueTexture to reflect the difference between SetShaderValue using sampler2d and SetShaderValueTexture is the automatic bind of the texture. (#4703) 2025-01-18 20:24:48 +01:00
Ray
a16e26a52a Merge branch 'master' of https://github.com/raysan5/raylib 2025-01-18 20:19:13 +01:00
Ray
896ff68540 REVIEWED: Text functions usage notes #4704 2025-01-18 20:19:11 +01:00
Anstro Pleuton
945f181f1d [examples] Update examples to be consistent (#4699)
* Update examples inconsistencies

* Happy new years, examples!

* Missed one inconsistency

* Update final few examples inconsistencies

---------

Co-authored-by: Anstro Pleuton <anstropleuton@github.com>
2025-01-18 19:41:56 +01:00
Ray
74256943a4 REVIEWED: MAX_GAMEPAD_NAME_LENGTH #4695 2025-01-18 19:39:50 +01:00
Auz
8575150747 Bump BINDINGS.md version number for Raylib.nelua (#4698) 2025-01-18 19:26:47 +01:00
Ray
0275d13aa8 Update README.md 2025-01-17 11:32:23 +01:00
Anthony Carbajal
27e530eb18 update examples with difficulty stars (#4694)
* update examples with difficulty stars

* manual fix script issues

* manual fix script issues
2025-01-17 10:42:30 +01:00
Ray
7c7b087efb REVIEWED: example: shaders_deferred_render -WIP-
Not working but shader compiles and example runs... not sure if deferred rendering could be supported in OpenGL ES 2.0.
2025-01-16 19:48:31 +01:00
Ray
313067d749 Update rlgl.h 2025-01-16 19:47:21 +01:00
Ray
94f261c6d7 Update rmodels.c 2025-01-16 19:47:12 +01:00
Ray
7b570bdfdd Update models_point_rendering.c 2025-01-16 19:47:06 +01:00
Colleague Riley
6bf40eee4f Update to RGFW 1.5 (#4688)
* add PLATFORM_WEB_RGFW

* fix some bugs

* fix web_rgfw gamepad

* send fake screensize

* fix gamepad bugs (linux) | add L3 + R3 (gamepad)

* fix?

* update RGFW (again)

* update raylib (merge)

* fix xinput stuff

* delete makefile added by mistake

* update RGFW

* update RGFW (rename joystick to gamepad to avoid misunderstandings

* update RGFW (fix X11 bug)

* update RGFW

* use RL_MALLOC for RGFW

* update RGFW (fixes xdnd bug)

* fix some formating

* Update RGFW

* update RGFW

* undo change

* undo change

* undo change

* undo change

* have .scroll be 0 by default

* update RGFW

* update RGFW

* update RGFW

* fix year

* fix wasm key event bug
2025-01-16 00:34:27 +01:00
Eike Decker
5c1cce28a7 Using Module provided canvas id for event binding (#4690)
This change is replacing the hardcoded "#canvas" element references in
rcore_web to allow using canvas elements that use different names
(which is necessary when using multiple canvas elements on one page).

Also adding a cursor hiding example to mouse example.
2025-01-16 00:32:58 +01:00
Michael Kearns
35a9257d20 Update BINDINGS.md for official V language binding change (#4691)
The bindings from @EmmaTheMartian were moved to official status, so the link is updated. 
The name was normalized to be consistent with other 'vendored' names in other languages.
2025-01-15 12:00:06 +01:00
Ray
cfbba79bd3 REVIEWED: example: models_textures_tiling shaders 2025-01-12 20:59:12 +01:00
Ray
fddfb58f85 REVIEWED: Potential shader issues 2025-01-12 20:39:07 +01:00
Ray
af163ba22a REVIEWED: example: shaders_julia_set 2025-01-12 20:29:46 +01:00
tea☆
1cdf3bb791 [rshapes] Allow DrawRectangleRounded() to draw rectangles with a size < 1 (#4683)
Closes #4673
2025-01-12 18:46:49 +01:00
Ray
da5a868e2a REMOVED: example: core_gamepad_info 2025-01-12 18:21:59 +01:00
Ray
2f6230e366 Formatting review and examples review 2025-01-12 18:02:36 +01:00
Ray
4bceddd4de ADDED: example: models_tesseract 2025-01-12 16:19:32 +01:00
Ray
a1896c7a90 REVIEWED: Code/Web-Makefile formatting 2025-01-12 16:19:10 +01:00
github-actions[bot]
43db59d1aa Update raylib_api.* by CI 2025-01-11 22:38:42 +00:00
Ray
e227371265 REVIEWED: TextJoin(), convert const char ** to char**
It generates multiple issues: https://c-faq.com/ansi/constmismatch.html
2025-01-11 23:38:21 +01:00
Ray
8e450e4446 Reviewed shaders formating to follow raylib coding conventions 2025-01-11 19:36:46 +01:00
Ray
49b905077d remove trailing spaces 2025-01-11 19:36:26 +01:00
Ray
62d8969a56 Reviewed shader formating 2025-01-10 22:56:25 +01:00
Ray
2b2694a89f Fix #4680 2025-01-10 22:36:11 +01:00
veins1
08b089f620 Reviewed shaders_deferred_render (#4676)
Fixed: g-buffer textures binding
Fixed: Clearing screen with white would leak onto g-buffer textures
Reviewed comments
2025-01-10 17:41:40 +01:00
Michael Kearns
34f431b422 Update xcode-frameworks dependency for latest zig (#4675)
* Update build.zig.zon for latest framework commit

* Update build.zig.zon with correct hash

* Update build.zig.zon with the 'really' correct hash
2025-01-10 17:40:48 +01:00
Hakunamawatta
43dbaf21e7 [examples] Fix broken link (#4674) 2025-01-10 17:40:13 +01:00
Le Juez Victor
eee86dd7c9 [build][CMake] Fix cmake configuration issue for Android (#4671)
* fix cmake configuration issue for Android

* review comment
2025-01-10 17:37:57 +01:00
Le Juez Victor
b554b53ede fix pixel offset issue with DrawRectangleLines (#4669) 2025-01-10 17:36:52 +01:00
github-actions[bot]
433cc23ea4 Update raylib_api.* by CI 2025-01-10 12:06:46 +00:00
Ray
bf8962dbc7 REVIEWED: Remove some const from text buffer return values
Lately got some compilation `errors` related, it seems GCC 14 interprets some `const`-missmatch as errors instead of warnings (as previous versions).

But in any case, I don't see why an user won't be able to operate directly over of those returned buffers; `const` adds a restriction (for security reasons?) that in my opinion is useless.

From an expert on compilers (w64devkit creator), here there are some notes I agree with:

```
No const. It serves no practical role in optimization, and I cannot recall an instance where it caught, or would have caught, a mistake. I held out for awhile as prototype documentation, but on reflection I found that good parameter names were sufficient. Dropping const has made me noticeably more productive by reducing cognitive load and eliminating visual clutter. I now believe its inclusion in C was a costly mistake.

(One small exception: I still like it as a hint to place static tables in read-only memory closer to the code. I’ll cast away the const if needed. This is only of minor importance.)
```

Ref: https://nullprogram.com/blog/2023/10/08/
2025-01-10 13:06:28 +01:00
Le Juez Victor
ddd86a3387 [rshapes] Fix pixel offset issue with line drawing (#4666)
* fix pixel offset issue with `DrawRectangleRoundedLinesEx`

* improve fix - (pixel offset issue with `DrawRectangleRoundedLinesEx`)

* revert radius tweak (`DrawRectangleRoundedLines`)
2025-01-09 00:07:59 +01:00
K. Adam Christensen
5d9aed5d40 [rlgl] Optimize rlReadScreenPixels (#4667)
This optimization works in the following ways:

1. Reduces calls to malloc to 1. Instead of needing an extra array, we
can just swap the top half with the bottom half of the one array.

2. Unroll the inner for loop and remove a condition. Unrolling loops
buys some performance wins, but the real goal was to remove the if check
and just set the alpha channel to 255.

On my hidpi arm64 laptop, I saw ~60% improvement in performance in my
debug build (29 FPS vs 47 FPS). When optimized, the gains were roughly
10% (75 FPS vs 83%).

Signed-off-by: K. Adam Christensen <pope@shifteleven.com>
2025-01-08 18:53:27 +01:00
Maicon Santana
fc29bc27fd Fix Touch pointCount reduction (#4661) 2025-01-06 11:29:24 +01:00
Asdqwe
ad035edfac Fix camera initial position (#4657) 2025-01-05 12:30:43 +01:00
rexept
2f95e8382b typo fix (#4656) 2025-01-05 12:30:06 +01:00
Brian E
05c4d8a652 [rlgl.h] Fixed typo in top comment (#4658)
"renderer" to "rendered"
2025-01-05 12:29:31 +01:00
veins1
97fa3a73e8 Fix: Alt-Tab not working in borderless fullscreen (#3865) (#4655) 2025-01-03 17:36:48 +01:00
Peter0x44
0f6e85a975 [build] CMake: Don't build examples using audio if audio is disabled (#4652) 2025-01-01 12:18:11 +01:00
Ray
fa0eada61a Update year to 2025 2025-01-01 00:02:52 +01:00
Peter Zmanovsky
d1315e8a04 [rmodels] Fix leaks in LoadIQM() and LoadModelAnimationsIQM() (#4649)
Add calls to UnloadFileData() before return in cases of invalid IQM file.
2024-12-29 21:06:40 +01:00
Jeffery Myers
f355d6f1db Transform the vertex normals by the animated matrix (#4646) 2024-12-29 01:07:52 +01:00
Ray
c0f2067dba REVIEWED: LoadShaderFromMemory(), use default locations for default shader #4641 2024-12-28 16:35:42 +01:00
Asdqwe
5b822585e5 [rcore] [GLFW] [SDL2] Updates CORE.Window.eventWaiting and FLAG_WINDOW_ALWAYS_RUN handling (#4642)
* Add implementation for CORE.Window.eventWaiting on PLATFORM_DESKTOP_SDL

* Optimize GetFrameTime() reset

* Optimize FLAG_WINDOW_ALWAYS_RUN and GetFrameTime() reset for PLATFORM_DESKTOP_GLFW
2024-12-28 15:59:05 +01:00
Johannes
75b6b825df using addCMacro instead of defineCMacro (#4620)
Co-authored-by: Johannes Rønning <johannes@picterus.com>
2024-12-28 15:57:10 +01:00
Jeffery Myers
e062dc085c Add filters and platform files so they show up in MSVC for ease of editing (#4644) 2024-12-28 15:56:04 +01:00
Mario Nachbaur
7ecc47d12e Fix IsWindowFocused() on web. (#4640) 2024-12-26 20:12:53 +01:00
Asdqwe
4758867815 [rcore] [SDL2] Add implementation for FLAG_WINDOW_ALWAYS_RUN (#4598)
* Enable FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW

* Revert enabling FLAG_WINDOW_ALWAYS_RUN by default on PLATFORM_DESKTOP_GLFW

* Add implementation for FLAG_WINDOW_ALWAYS_RUN on PLATFORM_DESKTOP_SDL

* Add reset for GetFrameTime()
2024-12-26 19:02:57 +01:00
Bot Randomness
51b9a0acfc Updated BINDINGS.md for Ruby (#4639)
Added a Ruby binding known as raylib-ruby on 4.5. (https://github.com/wilsonsilva/raylib-ruby)
2024-12-26 18:55:38 +01:00
Antonis Geralis
b07967993f Update version number for the nim wrapper (#4638) 2024-12-25 22:08:42 +01:00
Colleague Riley
c333e80497 Update RGFW (#4637)
* add PLATFORM_WEB_RGFW

* fix some bugs

* fix web_rgfw gamepad

* send fake screensize

* fix gamepad bugs (linux) | add L3 + R3 (gamepad)

* fix?

* update RGFW (again)

* update raylib (merge)

* fix xinput stuff

* delete makefile added by mistake

* update RGFW

* update RGFW (rename joystick to gamepad to avoid misunderstandings

* update RGFW (fix X11 bug)

* update RGFW

* use RL_MALLOC for RGFW

* update RGFW (fixes xdnd bug)

* fix some formating

* Update RGFW

* update RGFW

* undo change

* undo change

* undo change

* undo change

* have .scroll be 0 by default
2024-12-25 21:19:51 +01:00
Le Juez Victor
873bf31be3 [rmodels] Fix normal transform in UpdateModelAnimationBones (#4634)
* remove duplicate calculation of `invRotation` in `UpdateModelAnimationBones`

* fix normal transform in `UpdateModelAnimation`
2024-12-24 20:17:37 +01:00
Ray
ae3c0df206 Reviewed formating, removed assert() #4635 2024-12-24 20:14:54 +01:00
Jett
a7686c47b3 resolved a few segfaults with animation system (#4635)
* Update rmodels.c

resolves segfault with missing bone weights or bone IDs

* Update rmodels.c segfault with animation and missing normals/animnormals

* correct place.
2024-12-24 20:11:17 +01:00
Fancy2209
7868d600f4 [rtext] Fix default font alpha on Big Endian systems (#4624)
* Fix rtext default font alpha on Big Endian

* Endian Indepence
2024-12-23 22:25:22 +01:00
James Doyle
4fc908b38f Update BINDINGS.md (#4633)
Add some missing bindings for 5.5
2024-12-23 20:51:11 +01:00
veins1
e5d8de7c63 Fix: Setting flags disables fullscreen #4618 (#4619) 2024-12-23 19:26:50 +01:00
JupiterRider
a3a25da594 Update BINDINGS.md (#4628) 2024-12-23 19:25:41 +01:00
Ray
67b164bc04 Merge branch 'master' of https://github.com/raysan5/raylib 2024-12-23 19:24:09 +01:00
Ray
6f0d8611fe Formating tweaks 2024-12-23 19:24:07 +01:00
Jett
0212ed0a4b setting MAX_LEVEL based on actual mipcount input (#4622) 2024-12-20 14:14:13 +01:00
Fancy2209
26e12d6b35 Fix Typo in rcore_desktop_sdl.c (#4621) 2024-12-20 13:53:51 +01:00
Ray
ab83e6dd41 Image manipulation functions depend on a flag 2024-12-19 13:24:30 +01:00
Ray
03ff864087 Formating tweaks 2024-12-18 18:44:23 +01:00
Le Juez Victor
6eb1206660 fix shaders_deffered_render.c for OpenGL ES 3 (#4617)
This fixes an incomplete framebuffer issue due to the use of a texture format not supported in ES 3.
This commit also adds more information on how to manage deferred rendering.
2024-12-18 18:07:48 +01:00
Asdqwe
99cb4cbc36 Fix SetGamepadVibration() TRACELOG message (#4615) 2024-12-18 14:53:50 +01:00
Ray
783ca612cc Update Makefile 2024-12-18 12:51:00 +01:00
Colleague Riley
58004723d8 [rcore][RGFW] Add new backend option: PLATFORM_WEB_RGFW and update RGFW (#4480)
* add PLATFORM_WEB_RGFW

* fix some bugs

* fix web_rgfw gamepad

* send fake screensize

* fix gamepad bugs (linux) | add L3 + R3 (gamepad)

* fix?

* update RGFW (again)

* update raylib (merge)

* fix xinput stuff

* delete makefile added by mistake

* update RGFW

* update RGFW (rename joystick to gamepad to avoid misunderstandings

* update RGFW (fix X11 bug)

* update RGFW

* use RL_MALLOC for RGFW

* update RGFW (fixes xdnd bug)

* fix some formating
2024-12-18 12:03:42 +01:00
Ray
de6c09ee7a WARNING: REVIEWED: Use libraylib.web.a naming on PLATFORM_WEB
This change allows to have in same directory (currently `raylib/src`) two raylib build versions: Desktop and Web
2024-12-18 11:45:55 +01:00
Ray
f76734fc50 REVIEWED: UpdateModelAnimationBones(), break on first mesh found and formating 2024-12-18 11:43:43 +01:00
Kirandeep-Singh-Khehra
35c2408413 [rmodels] Optimized UpdateModelAnimationBones() function (#4602)
- Updating bones only once instead for each mesh.
 - Updating only one `model.meshes[].boneMatrices` and then using deep copy for other meshes instead of calculating for each bone in each mesh.

**Other points:**
 - Makes it a clean base/template/reference for bone updation functions. Because if using this as template then some calculations done in one mesh can affect bones in other mesh in next iteration(doubles the effect in for next mesh).

Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
2024-12-18 11:39:50 +01:00
Asdqwe
cdaff163cb Fix show, hide, focus and unfocus window/flags states for SDL2 (#4610) 2024-12-18 11:39:30 +01:00
JupiterRider
714cd5ef5c add SetGamepadVibration to rgfw and template (#4612) 2024-12-18 11:38:11 +01:00
Asdqwe
bdfbd6e8cc Fix maximizing, minimizing and restoring windows for SDL2 (#4607) 2024-12-16 22:19:00 +01:00
Le Juez Victor
79facde353 fix rlActiveDrawBuffers for OpenGL ES 3 (#4605) 2024-12-16 00:51:42 +01:00
Per Hallsmark
d0504800d2 install rcamera.h (#4603)
Signed-off-by: Per Hallsmark <per.hallsmark@bitjuggler.se>
2024-12-15 11:16:08 +01:00
Jeffery Myers
93a1e75741 Disable the threading example in MSVC for release and debug build (was disabled for dll builds already) (#4594) 2024-12-13 09:21:45 +01:00
github-actions[bot]
0a26d9a26f Update raylib_api.* by CI 2024-12-13 08:21:27 +00:00
__hexmaster111
8a5a95c13a Removed inaccurate comment about negitves not being supported with TextToFloat And TextToInt Methods (#4596) 2024-12-13 09:21:13 +01:00
Ray
1f704be4e4 Review comments spacing for better alignment 2024-12-12 12:13:38 +01:00
Ray
6b220f2798 Review formating 2024-12-12 12:13:17 +01:00
Legendary Redfox
b747eeefa4 [documentation] Adding a related project (#4589)
* updated raylib-lua version

* Updated some bindings

* removed 404 bindings

* adding my bindings project to the list

* Adding a related project

* fixing the license foi ReiLua
2024-12-10 20:05:46 +01:00
Legendary Redfox
aeb33e6301 Adding my bindings to the list (#4586)
* updated raylib-lua version

* Updated some bindings

* removed 404 bindings

* adding my bindings project to the list
2024-12-08 15:24:02 +01:00
github-actions[bot]
83f6f3dabe Update raylib_api.* by CI 2024-12-08 11:52:21 +00:00
Rico P
2a2acff2d5 Make sure ShaderUniformDataType matches rlShaderUniformDataType (#4577)
* Make sure ShaderUniformDataType matches rlShaderUniformDataType

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ray <raysan5@gmail.com>
2024-12-08 12:52:06 +01:00
github-actions[bot]
732da949b7 Update raylib_api.* by CI 2024-12-08 11:49:07 +00:00
Michael
d2cd2a0152 [rlgl][rmodels] Add instranceTransform shader location index #4538 (#4579) 2024-12-08 12:48:54 +01:00
Asdqwe
93a67417b3 Fix examples Makefile PLATFORM define (#4582) 2024-12-08 12:46:43 +01:00
danil
2820fcc29e [examples] improve input_virtual_controls example (#4584) 2024-12-08 08:52:09 +01:00
0riginaln0
ca6c5f4f3c Update BINDINGS.md | Fennel Bindings (#4585) 2024-12-07 21:28:08 +01:00
Ray
602583bcdb Merge branch 'master' of https://github.com/raysan5/raylib 2024-12-03 19:14:29 +01:00
Ray
1f45e7af76 REVIEWED: Coding conventions 2024-12-03 19:14:14 +01:00
Caleb Heydon
5feccb1bab [rmodels] Fixed null pointer dereference in LoadGLTF (#4564)
* [rmodels] Fixed null pointer dereference in LoadGLTF

* [rmodels] Add parenthesis around conditionals in LoadGLTF
2024-12-03 18:35:24 +01:00
Legendary Redfox
1f0325b52c [documentation] Removing 404 repos from bindings (#4572)
* updated raylib-lua version

* Updated some bindings

* removed 404 bindings
2024-12-03 13:30:17 +01:00
Legendary Redfox
e9e463e8b2 [documentation] Updating keybindings versions (#4570)
* updated raylib-lua version

* Updated some bindings
2024-12-03 12:03:36 +01:00
Legendary Redfox
83587e94c8 updated raylib-lua version (#4567) 2024-12-02 21:01:22 +01:00
JupiterRider
402eab3837 Update BINDINGS.md (#4566) 2024-12-02 18:50:24 +01:00
ahmedqarmout2
87b3085f5c Added new Jai bindings to BINDINGS.md (#4565)
Co-authored-by: Ahmed Qarmout <ahmed.qarmout@mail.utoronto.ca>
2024-12-02 18:48:24 +01:00
Caleb Heydon
f3f5f38c0f [rmodels] Fix crash when NULL is passed to LoadImageFromCgltfImage (#4563) 2024-12-02 13:35:54 +01:00
github-actions[bot]
e5e2bc83c3 Update raylib_api.* by CI 2024-12-01 22:25:46 +00:00
Ray
b50d418ec7 Merge branch 'master' of https://github.com/raysan5/raylib 2024-12-01 23:25:27 +01:00
Ray
dd26df0be8 REVIEWED: Parser issue with comment #4558 2024-12-01 23:25:12 +01:00
Rico P
ff71e3a513 use unused variable. Fixes #4560 (#4561) 2024-12-01 23:22:46 +01:00
Ryan Johnston
e181069c62 Update BINDINGS.md (#4559)
Include CLIPSraylib in the list of language bindings.
2024-12-01 23:12:00 +01:00
Ray
962f1c26ff Review formatting to follow raylib conventions 2024-12-01 23:10:59 +01:00
Caleb Heydon
9047630ae7 [rmodels] Fix null pointer dereference in LoadImageFromCgltfImage (#4557) 2024-12-01 22:46:26 +01:00
Ray
503cd7ba34 Update raymath.h 2024-12-01 22:45:09 +01:00
Jonathan Akaba
1b4e73cf2f Update documentation for Vector2Angle (#4556) 2024-12-01 22:43:32 +01:00
Ray
6fbf08cc1f Update pbr.fs 2024-12-01 22:41:38 +01:00
Ray
f9cf684356 Update pbr.vs 2024-12-01 22:40:46 +01:00
Ray
698bfc48fe Update pbr.fs 2024-12-01 22:40:23 +01:00
Ray
6c59dc4a65 Update BINDINGS.md 2024-12-01 22:39:09 +01:00
devdad
645f9e31c9 I've created bindings for raylib 5.5 for c3-lang at https://c3-lang.org (#4555)
* basic pbr example

pbr implementation  includes rpbr.h and few shader files header only file, which self contain everything needed for pbr rendering. Few textures and one model of the car which is under free licence which is included inside basic_pbr.c example file  currently supported shader versions are 120 and 330 , version 100 has small issue which I have to resolve

* Unloading PBRMAterial

I forgot unloading PBRMaterial

* fix small issue with texOffset assigment.

value was Vector4 at first but I found out it would be unclear for and users, so I change to have two Vector2 instead, but forgot to assign offset .

* Changed size of textures and file name changed

Changed size of textures from 2048x2048 to 1024x1024 and file name changed to shaders_basic_pbr.c ,
Added the function PBRModel PBRModelLoadFromMesh(Mesh mesh);
but GenMeshPlane(2, 2.0, 3, 3) culdn't be used because it crash once GenMeshTangents() is used with that plane mesh

* Update to 5.5 version  of eexample and fix to work in web

set GLSL_VERSION            100

set precision highp float;
removed in keyword
fix for loop has to use only constant

* Update shader_basic_pbr example to work on web

changed to GLSL_VERSION            100
update glsl100 shader
set float  precision  to highp
removed keyword  in
change for loop tu use constant value  gives an error

* Update shader_basic_pbr example to work on web

changed to GLSL_VERSION            100
update glsl100 shader
set float  precision  to highp
removed keyword  in
change for loop tu use constant value  gives an error

* removed rpbr.h

removed rpbr.h

* Bindings for c3-lang    raylib 5.5 and raylib 5.0

I've created raylib 5.5 binding for c3-Lang  https://c3-lang.org
2024-12-01 22:37:28 +01:00
Mossieur-Patate
9d318a6fbf Update CONTRIBUTING.md + FAQ.md: small misprints (#4553)
* Update CONTRIBUTING.md: small misprint

* Update FAQ.md: small misprint
2024-12-01 22:35:19 +01:00
Caleb Heydon
58fe34d9cc [raudio] Fixed buffer overflow when loading WAV files (#4539) 2024-11-28 22:58:35 +01:00
RealDoigt
cd16c9ea91 Add the D Object Oriented Raylib wrapper to the list of BINDINGS.md (#4550)
* add the D Object Oriented Raylib wrapper to the list of BINDINGS.md

* copy pasted correct url

I couldn't do it from the web ui for some reason
2024-11-28 22:50:44 +01:00
github-actions[bot]
31a1047782 Update raylib_api.* by CI 2024-11-28 21:50:14 +00:00
Mossieur-Patate
2c4c6e6201 GetKeyName prototype (#4544)
* Update raylib.h: GeyKeyName prototype

Prototype for GetKeyName, which is already implemented elsewhere.

* Update raylib_to_parse.h: GetKeyName prototype
2024-11-28 22:50:00 +01:00
Kacper Zybała
ba1e14625a [build] CMake: Set CMake version to 3.12 (#4547) 2024-11-28 22:47:39 +01:00
Tymoteusz Moryto
949c31605b CMakeOptions.txt: Added a missing ) (#4545) 2024-11-28 22:46:52 +01:00
glowiak
623c4376cc The Jaylib binding is at 5.5 (#4546) 2024-11-28 22:46:04 +01:00
Ray
abb3c8e9f7 Revert "[build][cmake] Improve cmake config file generation (#4541)"
This reverts commit c53dd8a931.
2024-11-28 22:44:42 +01:00
Leonardo Guilherme de Freitas
c53dd8a931 [build][cmake] Improve cmake config file generation (#4541)
* Improve cmake config file generation

This allows for finding raylib on a non-standard location (eg, not in /usr/lib{,64})

* Only have glfw as private if using internal glfw and not static
2024-11-27 11:39:36 +01:00
Anthony Carbajal
79188f570b fixed spacing in sha1 comment (#4540) 2024-11-25 20:17:22 +01:00
Jeffery Myers
6141489b00 Fixes casting warnings with RGFW platform. (#4534) 2024-11-24 16:25:36 +01:00
listeria
e494c545b8 raymath: fix C++ operator overloads (#4535)
Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
2024-11-24 16:24:34 +01:00
HaxSam
a9aa6b4988 [build.zig] improve build system for zig (#4531)
Is now possible to switch platform

Is now possible to diable raudio, rmodels, and so on

Made getOptions public so it can be used for zig wrappers
2024-11-24 16:22:51 +01:00
Ray
47f83aa58f Merge branch 'master' of https://github.com/raysan5/raylib 2024-11-22 11:06:53 +01:00
Ray
da6fa1d756 Fix #4529 2024-11-22 11:06:34 +01:00
github-actions[bot]
65e0d2cfda Update raylib_api.* by CI 2024-11-22 10:01:29 +00:00
Ray
50a2afff9e Update raylib version to 5.6-dev to avoid confusions with release 2024-11-22 11:01:10 +01:00
Asdqwe
a53a8958f2 Add implementation to GetWindowScaleDPI() for PLATFORM_WEB (#4526) 2024-11-22 10:52:55 +01:00
Ray
0d39e7137b Fix #4527 2024-11-21 12:38:29 +01:00
veins1
11429b48eb Fix for #4521 (#4523) 2024-11-20 21:28:46 +01:00
Gael Pérez
415a98965a update raymath.h: add Vector2CrossProduct function (#4520) 2024-11-20 11:27:14 +01:00
kimierik
532167d28b build.zig: fix raygui inclusion in windows crosscompilation (#4489) 2024-11-20 11:26:29 +01:00
devdad
6af664c04e Update shaders_basic_pbr example to work on web (#4516)
* basic pbr example

pbr implementation  includes rpbr.h and few shader files header only file, which self contain everything needed for pbr rendering. Few textures and one model of the car which is under free licence which is included inside basic_pbr.c example file  currently supported shader versions are 120 and 330 , version 100 has small issue which I have to resolve

* Unloading PBRMAterial

I forgot unloading PBRMaterial

* fix small issue with texOffset assigment.

value was Vector4 at first but I found out it would be unclear for and users, so I change to have two Vector2 instead, but forgot to assign offset .

* Changed size of textures and file name changed

Changed size of textures from 2048x2048 to 1024x1024 and file name changed to shaders_basic_pbr.c ,
Added the function PBRModel PBRModelLoadFromMesh(Mesh mesh);
but GenMeshPlane(2, 2.0, 3, 3) culdn't be used because it crash once GenMeshTangents() is used with that plane mesh

* Update to 5.5 version  of eexample and fix to work in web

set GLSL_VERSION            100

set precision highp float;
removed in keyword
fix for loop has to use only constant

* Update shader_basic_pbr example to work on web

changed to GLSL_VERSION            100
update glsl100 shader
set float  precision  to highp
removed keyword  in
change for loop tu use constant value  gives an error

* Update shader_basic_pbr example to work on web

changed to GLSL_VERSION            100
update glsl100 shader
set float  precision  to highp
removed keyword  in
change for loop tu use constant value  gives an error

* removed rpbr.h

removed rpbr.h
2024-11-20 11:25:31 +01:00
Jorge A. Gomes
57edbc3bab Update BINDINGS.md for raylib-py 5.5 (#4519) 2024-11-20 11:24:47 +01:00
Philipp
a145779e21 Update BINDINGS.md: fortran-raylib is on v5.5 (#4518) 2024-11-19 22:42:34 +01:00
Alexandre B A Villares
481095226d Update BINDINGS.md: github.com/electronstudio/raylib-python-cffi now 5.5 (#4517) 2024-11-19 22:41:14 +01:00
Ray
26548c1062 Remove trail-spaces 2024-11-19 12:33:13 +01:00
Ray
9e4f513a43 Reviewed formating 2024-11-19 12:31:57 +01:00
Ray
c78757a959 REVIEWED: GetClipboardImage(), make symbol available on all platforms 2024-11-19 12:31:49 +01:00
Ray
10789a4d49 Update rlgl.h 2024-11-19 12:31:14 +01:00
mikeemm
95e766472f [rmodels] Improve OBJ vertex data precision and lower memory usage by ExportMesh() (#4496)
* increased vertex data precision to match blender exports

* modified memory allocation to better fit higher precision data

* now accounting for newline characters during allocation

* now accounting for potentially higher vertex counts

* removed unnecessary final newline
2024-11-19 10:35:47 +01:00
Jannis
bd706dfcf2 Update BINDINGS.md for raylib-beef (#4514) 2024-11-19 10:35:10 +01:00
Andrew Dunbar
7127cba5cc typo/spello: arribes->arrives (#4515) 2024-11-19 10:33:36 +01:00
Alexandre B A Villares
21575856f4 Update BINDINGS.md: raylib-python-cffi is on v5.0 (#4512)
According to https://github.com/electronstudio/raylib-python-cffi
2024-11-19 09:05:39 +01:00
kovidomi
65f955a4dc Add missing VS2022 example projects for models_bone_socket and shaders_vertex_displacement (#4510) 2024-11-19 09:05:09 +01:00
Mute
f979cc62ee Fixed grammar mistakes in core_3d_camera_first_person.c (#4508)
Changed line 118 from, "// For advance camera controls, it's reecommended to compute camera movement manually", to, "// For advanced camera controls, it's recommended to compute camera movement manually".
2024-11-19 09:04:14 +01:00
Steven Schveighoffer
05b2603c45 Update raylib-d binding to 5.5 (#4506) 2024-11-19 09:03:39 +01:00
Rob Loach
fde3779ebd BINDINGS: raylib-cpp supports raylib 5.5 (#4511)
[raylib-cpp](https://github.com/RobLoach/raylib-cpp) has been updated to use the new raylib 5.5 functions. This is a great release! Thanks so much.
2024-11-19 00:37:33 +01:00
Ray
8375581f87 Update README.md 2024-11-19 00:19:39 +01:00
Gunko Vadim
71e0b8b581 Update BINDINGS.md (#4504) 2024-11-18 14:38:28 +01:00
640 changed files with 128152 additions and 71173 deletions

View File

@@ -3,7 +3,7 @@
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"
name: Analyze raylib with CodeQL
on:
workflow_dispatch:
@@ -26,7 +26,7 @@ jobs:
# - 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' }}
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read

View File

@@ -1,4 +1,4 @@
name: Android
name: Build raylib - Android
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: CMakeBuilds
name: Build raylib CMake - Windows+Linux
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: Linux Examples
name: Build raylib examples - Linux
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: Windows Examples
name: Build raylib examples - Windows
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: Linux
name: Build raylib - Linux
on:
workflow_dispatch:
@@ -22,22 +22,28 @@ jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ubuntu-20.04
strategy:
fail-fast: false
max-parallel: 1
matrix:
bits: [32, 64]
include:
- bits: 32
ARCH: "i386"
ARCH_NAME: "i386"
COMPILER_PATH: "/user/bin"
COMPILER_PATH: "/usr/bin"
runner: "ubuntu-latest"
- bits: 64
ARCH: "x86_64"
ARCH_NAME: "amd64"
COMPILER_PATH: "/user/bin"
COMPILER_PATH: "/usr/bin"
runner: "ubuntu-latest"
- bits: 64
ARCH: "aarch64"
ARCH_NAME: "arm64"
COMPILER_PATH: "/usr/bin"
runner: "ubuntu-24.04-arm"
runs-on: ${{ matrix.runner }}
env:
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
@@ -54,7 +60,6 @@ jobs:
- 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 libwayland-dev libxkbcommon-dev
mkdir build
cd build
@@ -64,9 +69,14 @@ jobs:
mkdir lib
cd ../../../raylib
# ${{ matrix.ARCH }}-linux-gnu-gcc -v
- name: Setup Environment (x86)
run : |
sudo apt-get install gcc-multilib
if: matrix.bits == 32 && matrix.ARCH == 'i386'
# TODO: Support 32bit (i386) static/shared library building
- name: Build Library
- name: Build Library (32-bit)
run: |
cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-m32" -B
@@ -74,13 +84,21 @@ jobs:
cd ..
if: matrix.bits == 32
- name: Build Library
- name: Build Library (64-bit x86)
run: |
cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 64
if: matrix.bits == 64 && matrix.ARCH == 'x86_64'
- name: Build Library (64-bit ARM)
run: |
cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 64 && matrix.ARCH == 'aarch64'
- name: Generate Artifacts
run: |

View File

@@ -1,4 +1,4 @@
name: macOS
name: Build raylib - macOS
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: WebAssembly
name: Build raylib - WebAssembly
on:
workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: Windows
name: Build raylib - Windows
on:
workflow_dispatch:
@@ -28,27 +28,34 @@ jobs:
max-parallel: 1
matrix:
compiler: [mingw-w64, msvc16]
bits: [32, 64]
ziptarget: [ win32, win64, winarm64 ]
include:
- compiler: mingw-w64
bits: 32
ARCH: "i686"
WINDRES_ARCH: pe-i386
ziptarget: "win32"
- compiler: mingw-w64
bits: 64
ARCH: "x86_64"
WINDRES_ARCH: pe-x86-64
ziptarget: "win64"
- compiler: msvc16
bits: 32
ARCH: "x86"
VSARCHPATH: "Win32"
ziptarget: "win32"
- compiler: msvc16
bits: 64
ARCH: "x64"
VSARCHPATH: "x64"
ziptarget: "win64"
- compiler: msvc16
ARCH: "ARM64"
VSARCHPATH: "ARM64"
ziptarget: "winarm64"
exclude:
- compiler: mingw-w64
ziptarget: winarm64 # We don't build arm64 with mingw-w64 yet
env:
RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
RELEASE_NAME: raylib-dev_${{ matrix.ziptarget }}_${{ matrix.compiler }}
GNUTARGET: default
steps:
@@ -57,7 +64,7 @@ jobs:
- name: Setup Release Version
run: |
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_${{ matrix.ziptarget }}_${{ matrix.compiler }}" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
@@ -90,7 +97,7 @@ jobs:
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 32
matrix.arch == 'i686'
- name: Build Library (MinGW-w64 64bit)
run: |
@@ -105,7 +112,7 @@ jobs:
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
matrix.arch == 'x86_64'
- name: Build Library (MSVC16)
run: |

View File

@@ -1,37 +1,37 @@
name: Parse raylib_api
on:
workflow_dispatch:
push:
paths:
- "src/raylib.h"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update parse files
working-directory: parser
run: |
make raylib_api
mv raylib_api.* output
- name: Diff parse files
id: diff
run: |
git add -N parser
git diff --name-only --exit-code
continue-on-error: true
- name: Commit parse files
if: steps.diff.outcome == 'failure'
run: |
set -x
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add parser
git commit -m "Update raylib_api.* by CI"
git push
name: Parse raylib API
on:
workflow_dispatch:
push:
paths:
- "src/raylib.h"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update parse files
working-directory: tools/parser
run: |
make raylib_api
mv raylib_api.* output
- name: Diff parse files
id: diff
run: |
git add -N parser
git diff --name-only --exit-code
continue-on-error: true
- name: Commit parse files
if: steps.diff.outcome == 'failure'
run: |
set -x
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add tools/parser
git commit -m "Update raylib_api.* by CI"
git push

72
.github/workflows/update_examples.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: Update examples collection
on:
workflow_dispatch:
push:
paths:
- 'examples/**'
pull_request:
paths:
- 'examples/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: 'latest'
actions-cache-folder: 'emsdk-cache'
- name: Clone raylib.com repo to update files
run: |
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/raysan5/raylib.com.git
shell: bash
- name: Build and run rexm tool (requires GNU Makefile)
# "rexm update" validates and updates all required examples in raylib and even raylib.com repos,
# note that it calls examples/Makefile.Web internally, so it requires [make] tool available
run: |
sudo apt-get update && sudo apt-get install -y libopengl0 libglu1-mesa libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
cd "${{ github.workspace }}/src"
make PLATFORM=PLATFORM_DESKTOP
sudo make install
make clean
make PLATFORM=PLATFORM_WEB
cd ../tools/rexm/
make
export REXM_EXAMPLES_BASE_PATH="${{ github.workspace }}/examples"
export REXM_EXAMPLES_WEB_PATH="${{ github.workspace }}/raylib.com/examples"
export REXM_EXAMPLES_TEMPLATE_FILE_PATH="${{ github.workspace }}/examples/examples_template.c"
export REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH="${{ github.workspace }}/examples/examples_template.png"
export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt"
export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln"
export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main"
./rexm update
shell: bash
- name: Commit changes to raylib repo (DISABLED)
if: github.event_name == 'push' && false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Update examples collection" || echo "git exited with code 1, nothing changed"
git push
shell: bash
- name: Push changes to raylib.com repo (DISABLED)
if: github.event_name == 'push' && false
run: |
cd raylib.com
git add -A
git commit -m "Update web examples" || echo "git exited with code 1, nothing changed"
git push origin
shell: bash

10
.gitignore vendored
View File

@@ -111,5 +111,11 @@ build/
build-*/
docgen_tmp/
# Parser stuff
parser/raylib_parser
# Tools stuff
tools/parser/raylib_parser
tools/rexm/rexm.exe
tools/rexm/rexm
# CI
emsdk-cache/
raylib.com/

View File

@@ -6,74 +6,84 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| Name | raylib Version | Language | License |
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
| [raylib](https://github.com/raysan5/raylib) | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.0** | [Beef](https://www.beeflang.org) | MIT |
| [raylib-boo](https://github.com/Rabios/raylib-boo) | 3.7 | [Boo](http://boo-language.github.io) | MIT |
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
| [Raylib-cs](https://github.com/ChrisDill/Raylib-cs) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [raylib](https://github.com/raysan5/raylib) | **5.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
| [raylib-ada](https://github.com/Fabien-Chouteau/raylib-ada) | **5.5** | [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)) | MIT |
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib55.c3l) | **5.5** | [C3](https://c3-lang.org) | MIT |
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.1-dev** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
| [Raylib-cs.BleedingEdge](https://github.com/danilwhale/Raylib-cs.BleedingEdge) | **5.6-dev** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
| [cl-raylib](https://github.com/longlene/cl-raylib) | 4.0 | [Common Lisp](https://common-lisp.net) | MIT |
| [claylib/wrap](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |
| [raylib](https://github.com/fosskers/raylib) | 5.5 | [Common Lisp](https://common-lisp.net) | MPL-2.0 |
| [chez-raylib](https://github.com/Yunoinsky/chez-raylib) | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme) | GPLv3 |
| [CLIPSraylib](https://github.com/mrryanjohnston/CLIPSraylib) | **auto** | [CLIPS](https://www.clipsrules.net/) | MIT |
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.0** | [D](https://dlang.org) | Zlib |
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 4.5 | [Factor](https://factorcode.org) | BSD |
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | 4.5 | [Fortran](https://fortran-lang.org) | ISC |
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.0** | [Go](https://golang.org) | Zlib |
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
| [gforth-raylib](https://github.com/ArnautDaniel/gforth-raylib) | 3.5 | [Gforth](https://gforth.org) | **???** |
| [h-raylib](https://github.com/Anut-py/h-raylib) | **5.5-dev** | [Haskell](https://haskell.org) | Apache-2.0 |
| [raylib-hx](https://github.com/foreignsasquatch/raylib-hx) | 4.2 | [Haxe](https://haxe.org) | Zlib |
| [hb-raylib](https://github.com/MarcosLeonardoMendezGerencir/hb-raylib) | 3.5 | [Harbour](https://harbour.github.io) | MIT |
| [jaylib](https://github.com/janet-lang/jaylib) | **5.0** | [Janet](https://janet-lang.org) | MIT |
| [jaylib](https://github.com/electronstudio/jaylib/) | 4.5 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
| [jaylib](https://github.com/electronstudio/jaylib/) | **5.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
| [raylib-j](https://github.com/CreedVI/Raylib-J) | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib |
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 4.5 | [Lua](http://www.lua.org) | ISC |
| [raylua](https://github.com/Rabios/raylua) | 4.0 | [Lua](http://www.lua.org) | MIT |
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | MIT |
| [Raylib.nelua](https://github.com/AuzFox/Raylib.nelua) | **5.0** | [nelua](https://nelua.io) | Zlib |
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 4.5 | [Ruby](https://www.ruby-lang.org/en) | Zlib |
| [naylib](https://github.com/planetis-m/naylib) | **5.1-dev** | [Nim](https://nim-lang.org) | MIT |
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.0 | [Lua](http://www.lua.org) | ISC |
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 5.5 | [Lua](http://www.lua.org) | Zlib |
| [raylib-luajit](https://github.com/homma/raylib-luajit) | 5.5 | [Lua](http://www.lua.org) | MIT |
| [raylib-luajit-generated](https://github.com/james2doyle/raylib-luajit-generated) | 5.5 | [Lua](http://www.lua.org) | MIT |
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | **???** |
| [Raylib.nelua](https://github.com/AuzFox/Raylib.nelua) | **5.5** | [nelua](https://nelua.io) | Zlib |
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
| [naylib](https://github.com/planetis-m/naylib) | **5.6-dev** | [Nim](https://nim-lang.org) | MIT |
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.0** | [Odin](https://odin-lang.org) | BSD-3Clause |
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | BSD-3Clause |
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | 4.2 | [Python](https://www.python.org) | EPL-2.0 |
| [raylibpyctbg](https://github.com/overdev/raylibpyctbg) | 4.5 | [Python](https://www.python.org) | MIT |
| [raylib-py](https://github.com/overdev/raylib-py) | **5.0b1** | [Python](https://www.python.org) | MIT |
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
| [raylibpyctbg](https://github.com/overdev/raylibpyctbg) | 5.5 | [Python](https://www.python.org) | MIT |
| [raylib-py](https://github.com/overdev/raylib-py) | 5.5 | [Python](https://www.python.org) | MIT |
| [raylib-python-ctypes](https://github.com/sDos280/raylib-python-ctypes) | 4.6-dev | [Python](https://www.python.org) | MIT |
| [raylib-pkpy-bindings](https://github.com/blueloveTH/pkpy-bindings) | 4.6-dev | [pocketpy](https://pocketpy.dev) | MIT |
| [raylib-pkpy-bindings](https://github.com/blueloveTH/pkpy-bindings) | 5.1-dev | [pocketpy](https://pocketpy.dev) | MIT |
| [raylib-php](https://github.com/joseph-montanez/raylib-php) | 4.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
| [raylib-phpcpp](https://github.com/oraoto/raylib-phpcpp) | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
| [raylibr](https://github.com/jeroenjanssens/raylibr) | 4.0 | [R](https://www.r-project.org) | MIT |
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 4.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.0** | [Rust](https://www.rust-lang.org) | Zlib |
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 5.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.5** | [Rust](https://www.rust-lang.org) | Zlib |
| [raylib-ruby](https://github.com/wilsonsilva/raylib-ruby) | 4.5 | [Ruby](https://www.ruby-lang.org) | Zlib |
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | **???** |
| [racket-raylib](https://github.com/eutro/racket-raylib) | 4.0 | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
| [racket-raylib](https://github.com/eutro/racket-raylib) | **5.5** | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
| [raylib-swift](https://github.com/STREGAsGate/Raylib) | 4.0 | [Swift](https://swift.org) | MIT |
| [raylib-scopes](https://github.com/salotz/raylib-scopes) | auto | [Scopes](http://scopes.rocks) | MIT |
| [raylib-SmallBASIC](https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib) | **5.0** | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 |
| [raylib-SmallBASIC](https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib) | **5.5** | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 |
| [raylib-umka](https://github.com/robloach/raylib-umka) | 4.5 | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib |
| [raylib-v](https://github.com/vlang/raylib) | 5.5 | [V](https://vlang.io) | MIT/Unlicense |
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.0 | [Wren](http://wren.io) | ISC |
| [raylib-zig](https://github.com/Not-Nik/raylib-zig) | **5.0** | [Zig](https://ziglang.org) | MIT |
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
@@ -84,15 +94,20 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
### 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 paradigm.
| Name | raylib Version | Language | License |
| ---------------------------------------------------- | :------------: | :------------------------------------------: | :-----: |
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
| [DOOR](https://github.com/RealDoigt/DOOR) | 4.0 | [D](https://dlang.org) | MIT |
| [Iris](https://github.com/Marcos-cat/iris) | **5.5** | [Uiua](https://www.uiua.org/) | MIT |
### Older or Unmaintained Language Bindings
@@ -131,7 +146,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
| [clj-raylib](https://github.com/lsevero/clj-raylib) | 3.0 | [Clojure](https://clojure.org) |
| [QuickJS-raylib](https://github.com/sntg-p/QuickJS-raylib) | 3.0 | [QuickJS](https://bellard.org/quickjs) |
| [raylib-duktape](https://github.com/RobLoach/raylib-duktape) | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) |
| [raylib-v7](https://github.com/Rabios/raylib-v7) | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) |
| [raylib-chaiscript](https://github.com/RobLoach/raylib-chaiscript) | 2.6 | [ChaiScript](http://chaiscript.com) |
| [raylib-squirrel](https://github.com/RobLoach/raylib-squirrel) | 2.5 | [Squirrel](http://www.squirrel-lang.org) |
| [racket-raylib-2d](https://github.com/arvyy/racket-raylib-2d) | 2.5 | [Racket](https://racket-lang.org) |
@@ -152,7 +166,7 @@ These are older raylib bindings that are more than 2 versions old or have not be
| [ray.mod](https://github.com/bmx-ng/ray.mod) | 3.0 | [BlitzMax](https://blitzmax.org) |
| [raylib-mosaic](https://github.com/pluckyporcupine/raylib-mosaic) | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) |
| [raylib-xdpw](https://github.com/vtereshkov/raylib-xdpw) | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) |
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
| [raylib-fb](https://github.com/IchMagBier/raylib-fb) | 3.0 | [FreeBasic](https://www.freebasic.net) |
| [raylib-purebasic](https://github.com/D-a-n-i-l-o/raylib-purebasic) | 3.0 | [PureBasic](https://www.purebasic.com) |
| [raylib-ats2](https://github.com/mephistopheles-8/raylib-ats2) | 3.0 | [ATS2](http://www.ats-lang.org) |

View File

@@ -1671,7 +1671,7 @@ Detailed changes:
[examples] ADDED: models_waving_cubes, by @codecat
[examples] ADDED: models_solar_system, by @aldrinmartoq
[examples] ADDED: shaders_fog, by @chriscamacho
[examples] ADDED: shaders_texture_waves, by @Anata
[examples] ADDED: shaders_texture_waves, by @anatagawa
[examples] ADDED: shaders_basic_lighting, by @chriscamacho
[examples] ADDED: shaders_simple_mask, by @chriscamacho
[examples] ADDED: audio_multichannel_sound, by @chriscamacho

View File

@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.25)
#this change avoid the warning that appear when we include raylib using Cmake fatch content
project(raylib)
# Avoid excessive expansion of variables in conditionals. In particular, if
@@ -22,21 +23,13 @@ cmake_policy(SET CMP0063 NEW)
# Anywhere you see include(...) you can check <root>/cmake for that file
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# RAYLIB_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example).
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(RAYLIB_IS_MAIN TRUE)
else()
set(RAYLIB_IS_MAIN FALSE)
endif()
# Sets compiler flags and language standard
include(CompilerFlags)
# Registers build options that are exposed to cmake
include(CMakeOptions.txt)
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM")
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
endif()
@@ -45,8 +38,9 @@ endif()
# Main sources directory (the second parameter sets the output directory name to raylib)
add_subdirectory(src raylib)
# Uninstall target
if(NOT TARGET uninstall)
# Uninstall target, only create when building raylib by itself
# Avoid conflicting target names when using raylib with other libraries
if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"

View File

@@ -2,12 +2,16 @@
include(CMakeDependentOption)
include(EnumOption)
if(EMSCRIPTEN)
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
SET(PLATFORM Web CACHE STRING "Platform to build for.")
endif()
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
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})
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
@@ -24,7 +28,7 @@ enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system G
option(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" OFF)
option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage)" OFF)
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
include(ParseConfigHeader)

View File

@@ -54,7 +54,7 @@ To open new issues for raylib (bug, enhancement, discussion...), just try to fol
- If applicable, attach some screenshot of the issue and a .zip file with the code sample and required resources.
- On issue description, add a brackets tag about the raylib module that relates to this issue.
If don't know which module, just report the issue, I will review it.
- You can check other issues to see how is being done!
- You can check other issues to see how it's being done!
### Sending a Pull-Request

View File

@@ -11,7 +11,7 @@ Local variables | lowerCase | `Vector2 playerPosition = { 0 };`
Global variables | lowerCase | `bool windowReady = false;`
Constants | lowerCase | `const int maxValue = 8;`
Pointers | MyType *pointer | `Texture2D *array = NULL;`
float values | always x.xf | `float gravity = 10.0f`
float values | always x.xf | `float gravity = 10.0f` (avoid `10.f`)
Operators | value1*value2 | `int product = value*6;`
Operators | value1/value2 | `int division = value/4;`
Operators | value1 + value2 | `int sum = value + 10;`
@@ -28,6 +28,10 @@ Some other conventions to follow:
- **ALWAYS** initialize all defined variables.
- **Do not use TABS**, use 4 spaces instead.
- Avoid trailing spaces, please, avoid them
- Comments always start with space + capital letter and never end with a '.', place them **before** the line(s) they refer to
```c
// This is a comment in raylib or raylib examples
```
- Control flow statements always are followed **by a space**:
```c
if (condition) value = 0;
@@ -68,19 +72,19 @@ void SomeFunction()
**If proposing new functions, please try to use a clear naming for function-name and functions-parameters, in case of doubt, open an issue for discussion.**
## Files and Directories Naming Conventions
- Directories will be named using `snake_case`: `resources/models`, `resources/fonts`
- Files will be named using `snake_case`: `main_title.png`, `cubicmap.png`, `sound.wav`
_NOTE: Avoid any space or special character in the files/dir naming!_
## Games/Examples Directories Organization Conventions
- Data files should be organized by context and usage in the game, think about the loading requirements for data and put all the resources that need to be loaded at the same time together.
- Use descriptive names for the files, it would be perfect if just reading the name of the file, it was possible to know what is that file and where fits in the game.
- Here is an example, note that some resources require to be loaded all at once while other require to be loaded only at initialization (gui, font).
```
resources/audio/fx/long_jump.wav
resources/audio/music/main_theme.ogg

2
FAQ.md
View File

@@ -90,7 +90,7 @@ I personally consider raylib a graphics library with some high-level features ra
### What does raylib provide that other engines or libraries don't?
I would say "simplicity" and "enjoyment" at a really low level of coding but actually is up to the user to discover it, to try it and to see if it fits their needs. raylib is not good for everyone but it's worth a try.
I would say "simplicity" and "enjoyment" at a really low level of coding but actually it is up to the user to discover it, to try it and to see if it fits their needs. raylib is not good for everyone but it's worth a try.
### How does raylib compare to Unity/Unreal/Godot?

View File

@@ -475,7 +475,7 @@ Undoubtedly, this is the **biggest raylib update in 10 years**. Many new feature
notes on raylib 5.5
-------------------
One year after raylib 5.0 release, arribes `raylib 5.5`, the next big revision of the library. It's been **11 years** since raylib 1.0 release and in all this time it has never stopped growing and improving. With an outstanding number of new contributors and improvements, it's, again, the biggest raylib release to date.
One year after raylib 5.0 release, arrives `raylib 5.5`, the next big revision of the library. It's been **11 years** since raylib 1.0 release and in all this time it has never stopped growing and improving. With an outstanding number of new contributors and improvements, it's, again, the biggest raylib release to date.
Some numbers for this release:

View File

@@ -1,4 +1,4 @@
Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software.

View File

@@ -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/5.0)](https://github.com/raysan5/raylib/commits/master)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/5.5)](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)
@@ -24,21 +24,21 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
[![Youtube Subscribers](https://img.shields.io/youtube/channel/subscribers/UC8WIBkhYb5sBNqXO1mZ7WSQ?style=flat&label=Youtube&logo=youtube)](https://www.youtube.com/c/raylib)
[![Twitch Status](https://img.shields.io/twitch/status/raysan5?style=flat&label=Twitch&logo=twitch)](https://www.twitch.tv/raysan5)
[![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)
[![WebAssembly](https://github.com/raysan5/raylib/workflows/WebAssembly/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
[![Build Windows](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml)
[![Build Linux](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml)
[![Build macOS](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml)
[![Build WebAssembly](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml)
[![CMakeBuilds](https://github.com/raysan5/raylib/workflows/CMakeBuilds/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
[![Windows Examples](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml)
[![Linux Examples](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml)
[![Build CMake](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml)
[![Build examples Windows](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml)
[![Build examples Linux](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml)
features
--------
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
- **NO external dependencies**, all required libraries are [included 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, ES 2.0, ES 3.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, OTF, FNT, BDF, sprite fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
@@ -130,6 +130,7 @@ raylib is present in several networks and raylib community is growing everyday.
- Webpage: [https://www.raylib.com](https://www.raylib.com)
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
- Twitter: [https://www.twitter.com/raysan5](https://www.twitter.com/raysan5)
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)

View File

@@ -3,16 +3,18 @@
Here is a wishlist with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements and ideas:
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
- [GitHub PRs](https://github.com/raysan5/raylib/pulls) open with improvements to be reviewed.
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
- raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
- [raylib wishlist 2021](https://github.com/raysan5/raylib/discussions/1502)
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
- [raylib 6.0 wishlist](https://github.com/raysan5/raylib/discussions/4660)
- [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
- [raylib wishlist 2021](https://github.com/raysan5/raylib/discussions/1502)
_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`: Support additional platforms: iOS, consoles?
- [ ] `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

575
build.zig
View File

@@ -2,7 +2,10 @@ const std = @import("std");
const builtin = @import("builtin");
/// Minimum supported version of Zig
const min_ver = "0.13.0";
const min_ver = "0.15.1";
const emccOutputDir = "zig-out" ++ std.fs.path.sep_str ++ "htmlout" ++ std.fs.path.sep_str;
const emccOutputFile = "index.html";
comptime {
const order = std.SemanticVersion.order;
@@ -11,41 +14,82 @@ comptime {
@compileError("Raylib requires zig version " ++ min_ver);
}
pub const emsdk = struct {
const zemscripten = @import("zemscripten");
pub fn shell(b: *std.Build) std.Build.LazyPath {
return b.dependency("raylib", .{}).path("src/shell.html");
}
pub const FlagsOptions = struct {
optimize: std.builtin.OptimizeMode,
asyncify: bool = true,
};
pub fn emccDefaultFlags(allocator: std.mem.Allocator, options: FlagsOptions) zemscripten.EmccFlags {
var emcc_flags = zemscripten.emccDefaultFlags(allocator, .{
.optimize = options.optimize,
.fsanitize = true,
});
if (options.asyncify)
emcc_flags.put("-sASYNCIFY", {}) catch unreachable;
return emcc_flags;
}
pub const SettingsOptions = struct {
optimize: std.builtin.OptimizeMode,
es3: bool = true,
emsdk_allocator: zemscripten.EmsdkAllocator = .emmalloc,
};
pub fn emccDefaultSettings(allocator: std.mem.Allocator, options: SettingsOptions) zemscripten.EmccSettings {
var emcc_settings = zemscripten.emccDefaultSettings(allocator, .{
.optimize = options.optimize,
.emsdk_allocator = options.emsdk_allocator,
});
if (options.es3)
emcc_settings.put("FULL_ES3", "1") catch unreachable;
emcc_settings.put("USE_GLFW", "3") catch unreachable;
emcc_settings.put("EXPORTED_RUNTIME_METHODS", "['requestFullscreen']") catch unreachable;
return emcc_settings;
}
pub fn emccStep(b: *std.Build, raylib: *std.Build.Step.Compile, wasm: *std.Build.Step.Compile, options: zemscripten.StepOptions) *std.Build.Step {
const activate_emsdk_step = zemscripten.activateEmsdkStep(b);
const emsdk_dep = b.dependency("emsdk", .{});
raylib.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include"));
wasm.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include"));
const emcc_step = zemscripten.emccStep(b, wasm, options);
emcc_step.dependOn(activate_emsdk_step);
return emcc_step;
}
pub fn emrunStep(
b: *std.Build,
html_path: []const u8,
extra_args: []const []const u8,
) *std.Build.Step {
return zemscripten.emrunStep(b, html_path, extra_args);
}
};
fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend) void {
raylib.defineCMacro("PLATFORM_DESKTOP", null);
switch (platform) {
.glfw => raylib.defineCMacro("PLATFORM_DESKTOP_GLFW", null),
.rgfw => raylib.defineCMacro("PLATFORM_DESKTOP_RGFW", null),
.sdl => raylib.defineCMacro("PLATFORM_DESKTOP_SDL", null),
.glfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_GLFW", ""),
.rgfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_RGFW", ""),
.sdl => raylib.root_module.addCMacro("PLATFORM_DESKTOP_SDL", ""),
.android => raylib.root_module.addCMacro("PLATFORM_ANDROID", ""),
else => {},
}
}
fn createEmsdkStep(b: *std.Build, emsdk: *std.Build.Dependency) *std.Build.Step.Run {
if (builtin.os.tag == .windows) {
return b.addSystemCommand(&.{emsdk.path("emsdk.bat").getPath(b)});
} else {
return b.addSystemCommand(&.{emsdk.path("emsdk").getPath(b)});
}
}
fn emSdkSetupStep(b: *std.Build, emsdk: *std.Build.Dependency) !?*std.Build.Step.Run {
const dot_emsc_path = emsdk.path(".emscripten").getPath(b);
const dot_emsc_exists = !std.meta.isError(std.fs.accessAbsolute(dot_emsc_path, .{}));
if (!dot_emsc_exists) {
const emsdk_install = createEmsdkStep(b, emsdk);
emsdk_install.addArgs(&.{ "install", "latest" });
const emsdk_activate = createEmsdkStep(b, emsdk);
emsdk_activate.addArgs(&.{ "activate", "latest" });
emsdk_activate.step.dependOn(&emsdk_install.step);
return emsdk_activate;
} else {
return null;
}
}
/// A list of all flags from `src/config.h` that one may override
const config_h_flags = outer: {
// Set this value higher if compile errors happen as `src/config.h` gets larger
@@ -58,6 +102,7 @@ const config_h_flags = outer: {
var lines = std.mem.tokenizeScalar(u8, config_h, '\n');
while (lines.next()) |line| {
if (!std.mem.containsAtLeast(u8, line, 1, "SUPPORT")) continue;
if (std.mem.containsAtLeast(u8, line, 1, "MODULE")) continue;
if (std.mem.startsWith(u8, line, "//")) continue;
if (std.mem.startsWith(u8, line, "#if")) continue;
@@ -77,27 +122,42 @@ const config_h_flags = outer: {
};
fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
var raylib_flags_arr = std.ArrayList([]const u8).init(b.allocator);
defer raylib_flags_arr.deinit();
var raylib_flags_arr: std.ArrayList([]const u8) = .empty;
defer raylib_flags_arr.deinit(b.allocator);
try raylib_flags_arr.appendSlice(&[_][]const u8{
"-std=gnu99",
"-D_GNU_SOURCE",
"-DGL_SILENCE_DEPRECATION=199309L",
"-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/3674
const raylib = b.addLibrary(.{
.name = "raylib",
.linkage = options.linkage,
.root_module = b.createModule(.{
.optimize = optimize,
.target = target,
.link_libc = true,
}),
});
if (options.shared) {
try raylib_flags_arr.appendSlice(&[_][]const u8{
"-fPIC",
"-DBUILD_LIBTYPE_SHARED",
});
try raylib_flags_arr.appendSlice(
b.allocator,
&[_][]const u8{
"-std=gnu99",
"-D_GNU_SOURCE",
"-DGL_SILENCE_DEPRECATION=199309L",
"-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/3674
},
);
if (options.linkage == .dynamic) {
try raylib_flags_arr.appendSlice(
b.allocator,
&[_][]const u8{
"-fPIC",
"-DBUILD_LIBTYPE_SHARED",
},
);
}
// Sets a flag indiciating the use of a custom `config.h`
try raylib_flags_arr.append(b.allocator, "-DEXTERNAL_CONFIG_FLAGS");
if (options.config.len > 0) {
// Sets a flag indiciating the use of a custom `config.h`
try raylib_flags_arr.append("-DEXTERNAL_CONFIG_FLAGS");
// Splits a space-separated list of config flags into multiple flags
//
// Note: This means certain flags like `-x c++` won't be processed properly.
@@ -106,7 +166,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
// Apply config flags supplied by the user
while (config_iter.next()) |config_flag|
try raylib_flags_arr.append(config_flag);
try raylib_flags_arr.append(b.allocator, config_flag);
// Apply all relevant configs from `src/config.h` *except* the user-specified ones
//
@@ -124,76 +184,142 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
}
// Otherwise, append default value from config.h to compile flags
try raylib_flags_arr.append(flag);
try raylib_flags_arr.append(b.allocator, flag);
}
} else {
// Set default config if no custome config got set
try raylib_flags_arr.appendSlice(b.allocator, &config_h_flags);
}
const raylib = if (options.shared)
b.addSharedLibrary(.{
.name = "raylib",
.target = target,
.optimize = optimize,
})
else
b.addStaticLibrary(.{
.name = "raylib",
.target = target,
.optimize = optimize,
});
raylib.linkLibC();
// No GLFW required on PLATFORM_DRM
if (options.platform != .drm) {
raylib.addIncludePath(b.path("src/external/glfw/include"));
}
var c_source_files = try std.ArrayList([]const u8).initCapacity(b.allocator, 2);
var c_source_files: std.ArrayList([]const u8) = try .initCapacity(b.allocator, 2);
c_source_files.appendSliceAssumeCapacity(&.{ "src/rcore.c", "src/utils.c" });
if (options.raudio) {
try c_source_files.append("src/raudio.c");
}
if (options.rmodels) {
try c_source_files.append("src/rmodels.c");
}
if (options.rshapes) {
try c_source_files.append("src/rshapes.c");
}
if (options.rtext) {
try c_source_files.append("src/rtext.c");
try c_source_files.append(b.allocator, "src/rshapes.c");
try raylib_flags_arr.append(b.allocator, "-DSUPPORT_MODULE_RSHAPES");
}
if (options.rtextures) {
try c_source_files.append("src/rtextures.c");
try c_source_files.append(b.allocator, "src/rtextures.c");
try raylib_flags_arr.append(b.allocator, "-DSUPPORT_MODULE_RTEXTURES");
}
if (options.rtext) {
try c_source_files.append(b.allocator, "src/rtext.c");
try raylib_flags_arr.append(b.allocator, "-DSUPPORT_MODULE_RTEXT");
}
if (options.rmodels) {
try c_source_files.append(b.allocator, "src/rmodels.c");
try raylib_flags_arr.append(b.allocator, "-DSUPPORT_MODULE_RMODELS");
}
if (options.raudio) {
try c_source_files.append(b.allocator, "src/raudio.c");
try raylib_flags_arr.append(b.allocator, "-DSUPPORT_MODULE_RAUDIO");
}
if (options.opengl_version != .auto) {
raylib.defineCMacro(options.opengl_version.toCMacroStr(), null);
raylib.root_module.addCMacro(options.opengl_version.toCMacroStr(), "");
}
raylib.addIncludePath(b.path("src/platforms"));
switch (target.result.os.tag) {
.windows => {
try c_source_files.append("src/rglfw.c");
raylib.linkSystemLibrary("winmm");
raylib.linkSystemLibrary("gdi32");
raylib.linkSystemLibrary("opengl32");
switch (options.platform) {
.glfw => try c_source_files.append(b.allocator, "src/rglfw.c"),
.rgfw, .sdl, .drm, .android => {},
}
raylib.root_module.linkSystemLibrary("winmm", .{});
raylib.root_module.linkSystemLibrary("gdi32", .{});
raylib.root_module.linkSystemLibrary("opengl32", .{});
setDesktopPlatform(raylib, options.platform);
},
.linux => {
if (options.platform != .drm) {
try c_source_files.append("src/rglfw.c");
if (options.platform == .drm) {
if (options.opengl_version == .auto) {
raylib.root_module.linkSystemLibrary("GLESv2", .{});
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
}
raylib.root_module.linkSystemLibrary("EGL", .{});
raylib.root_module.linkSystemLibrary("gbm", .{});
raylib.root_module.linkSystemLibrary("libdrm", .{ .use_pkg_config = .force });
raylib.root_module.addCMacro("PLATFORM_DRM", "");
raylib.root_module.addCMacro("EGL_NO_X11", "");
raylib.root_module.addCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "");
} else if (target.result.abi.isAndroid()) {
//these are the only tag options per https://developer.android.com/ndk/guides/other_build_systems
const hostTuple = switch (builtin.target.os.tag) {
.linux => "linux-x86_64",
.windows => "windows-x86_64",
.macos => "darwin-x86_64",
else => @panic("unsupported host OS"),
};
const androidTriple = switch (target.result.cpu.arch) {
.x86 => "i686-linux-android",
.x86_64 => "x86_64-linux-android",
.arm => "arm-linux-androideabi",
.aarch64 => "aarch64-linux-android",
.riscv64 => "riscv64-linux-android",
else => error.InvalidAndroidTarget,
} catch @panic("invalid android target!");
const androidNdkPathString: []const u8 = options.android_ndk;
if (androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set");
const androidApiLevel: []const u8 = options.android_api_version;
const androidSysroot = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/toolchains/llvm/prebuilt/", hostTuple, "/sysroot" });
const androidLibPath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/lib/", androidTriple });
const androidApiSpecificPath = try std.fs.path.join(b.allocator, &.{ androidLibPath, androidApiLevel });
const androidIncludePath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/include" });
const androidArchIncludePath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, androidTriple });
const androidAsmPath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, "/asm-generic" });
const androidGluePath = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/sources/android/native_app_glue/" });
raylib.root_module.addLibraryPath(.{ .cwd_relative = androidLibPath });
raylib.root_module.addLibraryPath(.{ .cwd_relative = androidApiSpecificPath });
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidIncludePath });
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidArchIncludePath });
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidAsmPath });
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidGluePath });
var libcData: std.ArrayList(u8) = .empty;
var aw: std.Io.Writer.Allocating = .fromArrayList(b.allocator, &libcData);
try (std.zig.LibCInstallation{
.include_dir = androidIncludePath,
.sys_include_dir = androidIncludePath,
.crt_dir = androidApiSpecificPath,
}).render(&aw.writer);
const libcFile = b.addWriteFiles().add("android-libc.txt", try libcData.toOwnedSlice(b.allocator));
raylib.setLibCFile(libcFile);
if (options.opengl_version == .auto) {
raylib.root_module.linkSystemLibrary("GLESv2", .{});
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
}
raylib.root_module.linkSystemLibrary("EGL", .{});
setDesktopPlatform(raylib, .android);
} else {
try c_source_files.append(b.allocator, "src/rglfw.c");
if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) {
raylib.defineCMacro("_GLFW_X11", null);
raylib.linkSystemLibrary("GLX");
raylib.linkSystemLibrary("X11");
raylib.linkSystemLibrary("Xcursor");
raylib.linkSystemLibrary("Xext");
raylib.linkSystemLibrary("Xfixes");
raylib.linkSystemLibrary("Xi");
raylib.linkSystemLibrary("Xinerama");
raylib.linkSystemLibrary("Xrandr");
raylib.linkSystemLibrary("Xrender");
raylib.root_module.addCMacro("_GLFW_X11", "");
raylib.root_module.linkSystemLibrary("GLX", .{});
raylib.root_module.linkSystemLibrary("X11", .{});
raylib.root_module.linkSystemLibrary("Xcursor", .{});
raylib.root_module.linkSystemLibrary("Xext", .{});
raylib.root_module.linkSystemLibrary("Xfixes", .{});
raylib.root_module.linkSystemLibrary("Xi", .{});
raylib.root_module.linkSystemLibrary("Xinerama", .{});
raylib.root_module.linkSystemLibrary("Xrandr", .{});
raylib.root_module.linkSystemLibrary("Xrender", .{});
}
if (options.linux_display_backend == .Wayland or options.linux_display_backend == .Both) {
@@ -204,10 +330,10 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
, .{});
@panic("`wayland-scanner` not found");
};
raylib.defineCMacro("_GLFW_WAYLAND", null);
raylib.linkSystemLibrary("EGL");
raylib.linkSystemLibrary("wayland-client");
raylib.linkSystemLibrary("xkbcommon");
raylib.root_module.addCMacro("_GLFW_WAYLAND", "");
raylib.root_module.linkSystemLibrary("EGL", .{});
raylib.root_module.linkSystemLibrary("wayland-client", .{});
raylib.root_module.linkSystemLibrary("xkbcommon", .{});
waylandGenerate(b, raylib, "wayland.xml", "wayland-client-protocol");
waylandGenerate(b, raylib, "xdg-shell.xml", "xdg-shell-client-protocol");
waylandGenerate(b, raylib, "xdg-decoration-unstable-v1.xml", "xdg-decoration-unstable-v1-client-protocol");
@@ -218,74 +344,51 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
}
setDesktopPlatform(raylib, options.platform);
} else {
if (options.opengl_version == .auto) {
raylib.linkSystemLibrary("GLESv2");
raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null);
}
raylib.linkSystemLibrary("EGL");
raylib.linkSystemLibrary("gbm");
raylib.linkSystemLibrary2("libdrm", .{ .use_pkg_config = .force });
raylib.defineCMacro("PLATFORM_DRM", null);
raylib.defineCMacro("EGL_NO_X11", null);
raylib.defineCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "2048");
}
},
.freebsd, .openbsd, .netbsd, .dragonfly => {
try c_source_files.append("rglfw.c");
raylib.linkSystemLibrary("GL");
raylib.linkSystemLibrary("rt");
raylib.linkSystemLibrary("dl");
raylib.linkSystemLibrary("m");
raylib.linkSystemLibrary("X11");
raylib.linkSystemLibrary("Xrandr");
raylib.linkSystemLibrary("Xinerama");
raylib.linkSystemLibrary("Xi");
raylib.linkSystemLibrary("Xxf86vm");
raylib.linkSystemLibrary("Xcursor");
try c_source_files.append(b.allocator, "rglfw.c");
raylib.root_module.linkSystemLibrary("GL", .{});
raylib.root_module.linkSystemLibrary("rt", .{});
raylib.root_module.linkSystemLibrary("dl", .{});
raylib.root_module.linkSystemLibrary("m", .{});
raylib.root_module.linkSystemLibrary("X11", .{});
raylib.root_module.linkSystemLibrary("Xrandr", .{});
raylib.root_module.linkSystemLibrary("Xinerama", .{});
raylib.root_module.linkSystemLibrary("Xi", .{});
raylib.root_module.linkSystemLibrary("Xxf86vm", .{});
raylib.root_module.linkSystemLibrary("Xcursor", .{});
setDesktopPlatform(raylib, options.platform);
},
.macos => {
// Include xcode_frameworks for cross compilation
if (b.lazyDependency("xcode_frameworks", .{})) |dep| {
raylib.addSystemFrameworkPath(dep.path("Frameworks"));
raylib.addSystemIncludePath(dep.path("include"));
raylib.addLibraryPath(dep.path("lib"));
raylib.root_module.addSystemFrameworkPath(dep.path("Frameworks"));
raylib.root_module.addSystemIncludePath(dep.path("include"));
raylib.root_module.addLibraryPath(dep.path("lib"));
}
// On macos rglfw.c include Objective-C files.
try raylib_flags_arr.append("-ObjC");
try raylib_flags_arr.append(b.allocator, "-ObjC");
raylib.root_module.addCSourceFile(.{
.file = b.path("src/rglfw.c"),
.flags = raylib_flags_arr.items,
});
_ = raylib_flags_arr.pop();
raylib.linkFramework("Foundation");
raylib.linkFramework("CoreServices");
raylib.linkFramework("CoreGraphics");
raylib.linkFramework("AppKit");
raylib.linkFramework("IOKit");
raylib.root_module.linkFramework("Foundation", .{});
raylib.root_module.linkFramework("CoreServices", .{});
raylib.root_module.linkFramework("CoreGraphics", .{});
raylib.root_module.linkFramework("AppKit", .{});
raylib.root_module.linkFramework("IOKit", .{});
setDesktopPlatform(raylib, options.platform);
},
.emscripten => {
// Include emscripten for cross compilation
if (b.lazyDependency("emsdk", .{})) |dep| {
if (try emSdkSetupStep(b, dep)) |emSdkStep| {
raylib.step.dependOn(&emSdkStep.step);
}
raylib.addIncludePath(dep.path("upstream/emscripten/cache/sysroot/include"));
}
raylib.defineCMacro("PLATFORM_WEB", null);
raylib.root_module.addCMacro("PLATFORM_WEB", "");
if (options.opengl_version == .auto) {
raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null);
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES3", "");
}
},
else => {
@@ -301,13 +404,15 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
return raylib;
}
pub fn addRaygui(b: *std.Build, raylib: *std.Build.Step.Compile, raygui_dep: *std.Build.Dependency) void {
pub fn addRaygui(b: *std.Build, raylib: *std.Build.Step.Compile, raygui_dep: *std.Build.Dependency, options: Options) void {
const raylib_dep = b.dependencyFromBuildZig(@This(), options);
var gen_step = b.addWriteFiles();
raylib.step.dependOn(&gen_step.step);
const raygui_c_path = gen_step.add("raygui.c", "#define RAYGUI_IMPLEMENTATION\n#include \"raygui.h\"\n");
raylib.addCSourceFile(.{ .file = raygui_c_path });
raylib.addIncludePath(raygui_dep.path("src"));
raylib.root_module.addCSourceFile(.{ .file = raygui_c_path });
raylib.root_module.addIncludePath(raygui_dep.path("src"));
raylib.root_module.addIncludePath(raylib_dep.path("src"));
raylib.installHeader(raygui_dep.path("src/raygui.h"), "raygui.h");
}
@@ -319,15 +424,17 @@ pub const Options = struct {
rtext: bool = true,
rtextures: bool = true,
platform: PlatformBackend = .glfw,
shared: bool = false,
linux_display_backend: LinuxDisplayBackend = .Both,
linkage: std.builtin.LinkMode = .static,
linux_display_backend: LinuxDisplayBackend = .X11,
opengl_version: OpenglVersion = .auto,
android_ndk: []const u8 = "",
android_api_version: []const u8 = "35",
/// config should be a list of space-separated cflags, eg, "-DSUPPORT_CUSTOM_FRAME_CONTROL"
config: []const u8 = &.{},
const defaults = Options{};
fn getOptions(b: *std.Build) Options {
pub fn getOptions(b: *std.Build) Options {
return .{
.platform = b.option(PlatformBackend, "platform", "Choose the platform backedn for desktop target") orelse defaults.platform,
.raudio = b.option(bool, "raudio", "Compile with audio support") orelse defaults.raudio,
@@ -335,10 +442,12 @@ pub const Options = struct {
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
.rtextures = b.option(bool, "rtextures", "Compile with textures support") orelse defaults.rtextures,
.rshapes = b.option(bool, "rshapes", "Compile with shapes support") orelse defaults.rshapes,
.shared = b.option(bool, "shared", "Compile as shared library") orelse defaults.shared,
.linkage = b.option(std.builtin.LinkMode, "linkage", "Compile as shared or static library") orelse defaults.linkage,
.linux_display_backend = b.option(LinuxDisplayBackend, "linux_display_backend", "Linux display backend to use") orelse defaults.linux_display_backend,
.opengl_version = b.option(OpenglVersion, "opengl_version", "OpenGL version to use") orelse defaults.opengl_version,
.config = b.option([]const u8, "config", "Compile with custom define macros overriding config.h") orelse &.{},
.android_ndk = b.option([]const u8, "android_ndk", "specify path to android ndk") orelse std.process.getEnvVarOwned(b.allocator, "ANDROID_NDK_HOME") catch "",
.android_api_version = b.option([]const u8, "android_api_version", "specify target android API level") orelse defaults.android_api_version,
};
}
};
@@ -376,26 +485,170 @@ pub const PlatformBackend = enum {
rgfw,
sdl,
drm,
android,
};
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 = try compileRaylib(b, target, optimize, Options.getOptions(b));
lib.installHeader(b.path("src/raylib.h"), "raylib.h");
lib.installHeader(b.path("src/rcamera.h"), "rcamera.h");
lib.installHeader(b.path("src/raymath.h"), "raymath.h");
lib.installHeader(b.path("src/rlgl.h"), "rlgl.h");
b.installArtifact(lib);
const examples = b.step("examples", "Build/Install all examples");
examples.dependOn(try addExamples("audio", b, target, optimize, lib));
examples.dependOn(try addExamples("core", b, target, optimize, lib));
examples.dependOn(try addExamples("models", b, target, optimize, lib));
examples.dependOn(try addExamples("others", b, target, optimize, lib));
examples.dependOn(try addExamples("shaders", b, target, optimize, lib));
examples.dependOn(try addExamples("shapes", b, target, optimize, lib));
examples.dependOn(try addExamples("text", b, target, optimize, lib));
examples.dependOn(try addExamples("textures", b, target, optimize, lib));
}
fn addExamples(
comptime module: []const u8,
b: *std.Build,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
raylib: *std.Build.Step.Compile,
) !*std.Build.Step {
const all = b.step(module, "All " ++ module ++ " examples");
const module_subpath = b.pathJoin(&.{ "examples", module });
var dir = try std.fs.cwd().openDir(b.pathFromRoot(module_subpath), .{ .iterate = true });
defer dir.close();
var iter = dir.iterate();
while (try iter.next()) |entry| {
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 = b.pathJoin(&.{ module_subpath, entry.name });
// zig's mingw headers do not include pthread.h
if (std.mem.eql(u8, "core_loading_thread", name) and target.result.os.tag == .windows) continue;
const exe_mod = b.createModule(.{
.target = target,
.optimize = optimize,
});
exe_mod.addCSourceFile(.{ .file = b.path(path), .flags = &.{} });
exe_mod.linkLibrary(raylib);
const run_step = b.step(name, name);
if (target.result.os.tag == .emscripten) {
const wasm = b.addLibrary(.{
.name = name,
.linkage = .static,
.root_module = exe_mod,
});
if (std.mem.eql(u8, name, "rlgl_standalone")) {
//TODO: Make rlgl_standalone example work
continue;
}
if (std.mem.eql(u8, name, "raylib_opengl_interop")) {
//TODO: Make raylib_opengl_interop example work
continue;
}
const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize });
const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize });
const install_dir: std.Build.InstallDir = .{ .custom = "htmlout" };
const emcc_step = emsdk.emccStep(b, raylib, wasm, .{
.optimize = optimize,
.flags = emcc_flags,
.settings = emcc_settings,
.shell_file_path = b.path("src/shell.html"),
.embed_paths = &.{
.{
.src_path = b.pathJoin(&.{ module_subpath, "resources" }),
.virtual_path = "resources",
},
},
.install_dir = install_dir,
});
const html_filename = try std.fmt.allocPrint(b.allocator, "{s}.html", .{wasm.name});
const emrun_step = emsdk.emrunStep(
b,
b.getInstallPath(install_dir, html_filename),
&.{"--no_browser"},
);
emrun_step.dependOn(emcc_step);
run_step.dependOn(emrun_step);
all.dependOn(emcc_step);
} else {
// special examples that test using these external dependencies directly
// alongside raylib
if (std.mem.eql(u8, name, "rlgl_standalone")) {
exe_mod.addIncludePath(b.path("src"));
exe_mod.addIncludePath(b.path("src/external/glfw/include"));
if (!hasCSource(raylib.root_module, "rglfw.c")) {
exe_mod.addCSourceFile(.{ .file = b.path("src/rglfw.c"), .flags = &.{} });
}
}
if (std.mem.eql(u8, name, "raylib_opengl_interop")) {
exe_mod.addIncludePath(b.path("src/external"));
}
switch (target.result.os.tag) {
.windows => {
exe_mod.linkSystemLibrary("winmm", .{});
exe_mod.linkSystemLibrary("gdi32", .{});
exe_mod.linkSystemLibrary("opengl32", .{});
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
},
.linux => {
exe_mod.linkSystemLibrary("GL", .{});
exe_mod.linkSystemLibrary("rt", .{});
exe_mod.linkSystemLibrary("dl", .{});
exe_mod.linkSystemLibrary("m", .{});
exe_mod.linkSystemLibrary("X11", .{});
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
},
.macos => {
exe_mod.linkFramework("Foundation", .{});
exe_mod.linkFramework("Cocoa", .{});
exe_mod.linkFramework("OpenGL", .{});
exe_mod.linkFramework("CoreAudio", .{});
exe_mod.linkFramework("CoreVideo", .{});
exe_mod.linkFramework("IOKit", .{});
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
},
else => {
@panic("Unsupported OS");
},
}
const exe = b.addExecutable(.{
.name = name,
.root_module = exe_mod,
});
const install_cmd = b.addInstallArtifact(exe, .{});
const run_cmd = b.addRunArtifact(exe);
run_cmd.cwd = b.path(module_subpath);
run_cmd.step.dependOn(&install_cmd.step);
run_step.dependOn(&run_cmd.step);
all.dependOn(&install_cmd.step);
}
}
return all;
}
fn waylandGenerate(
@@ -411,12 +664,24 @@ fn waylandGenerate(
const client_step = b.addSystemCommand(&.{ "wayland-scanner", "client-header" });
client_step.addFileArg(b.path(protocolDir));
raylib.addIncludePath(client_step.addOutputFileArg(clientHeader).dirname());
raylib.root_module.addIncludePath(client_step.addOutputFileArg(clientHeader).dirname());
const private_step = b.addSystemCommand(&.{ "wayland-scanner", "private-code" });
private_step.addFileArg(b.path(protocolDir));
raylib.addIncludePath(private_step.addOutputFileArg(privateCode).dirname());
raylib.root_module.addIncludePath(private_step.addOutputFileArg(privateCode).dirname());
raylib.step.dependOn(&client_step.step);
raylib.step.dependOn(&private_step.step);
}
fn hasCSource(module: *std.Build.Module, name: []const u8) bool {
for (module.link_objects.items) |o| switch (o) {
.c_source_file => |c| if (switch (c.file) {
.src_path => |s| std.ascii.endsWithIgnoreCase(s.sub_path, name),
.generated, .cwd_relative, .dependency => false,
}) return true,
.c_source_files => |s| for (s.files) |c| if (std.ascii.endsWithIgnoreCase(c, name)) return true,
else => {},
};
return false;
}

View File

@@ -1,18 +1,23 @@
.{
.name = "raylib",
.version = "5.5.0",
.minimum_zig_version = "0.13.0",
.name = .raylib,
.version = "5.6.0-dev",
.minimum_zig_version = "0.15.1",
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
.dependencies = .{
.xcode_frameworks = .{
.url = "git+https://github.com/hexops/xcode-frameworks#a6bf82e032d4d9923ad5c222d466710fcc05f249",
.hash = "12208da4dfcd9b53fb367375fb612ec73f38e53015f1ce6ae6d6e8437a637078e170",
.url = "git+https://github.com/hexops/xcode-frameworks#9a45f3ac977fd25dff77e58c6de1870b6808c4a7",
.hash = "N-V-__8AABHMqAWYuRdIlflwi8gksPnlUMQBiSxAqQAAZFms",
.lazy = true,
},
.emsdk = .{
.url = "git+https://github.com/emscripten-core/emsdk#3.1.50",
.hash = "1220e8fe9509f0843e5e22326300ca415c27afbfbba3992f3c3184d71613540b5564",
.lazy = true,
.url = "git+https://github.com/emscripten-core/emsdk#4.0.9",
.hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ",
},
.zemscripten = .{
.url = "git+https://github.com/zig-gamedev/zemscripten#3fa4b778852226c7346bdcc3c1486e875a9a6d02",
.hash = "zemscripten-0.2.0-dev-sRlDqApRAACspTbAZnuNKWIzfWzSYgYkb2nWAXZ-tqqt",
},
},
@@ -20,5 +25,7 @@
"build.zig",
"build.zig.zon",
"src",
"examples",
"LICENSE",
},
}

View File

@@ -69,6 +69,14 @@ elseif (${PLATFORM} MATCHES "Android")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND raylib_sources ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
# NOTE: We remove '-Wl,--no-undefined' (set by default) as it conflicts with '-Wl,-undefined,dynamic_lookup' needed
# for compiling with the missing 'void main(void)' declaration in `android_main()`.
# We also remove other unnecessary or problematic flags.
string(REPLACE "-Wl,--no-undefined -Qunused-arguments" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-static-libstdc++" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")
find_library(OPENGL_LIBRARY OpenGL)
@@ -93,10 +101,37 @@ elseif ("${PLATFORM}" MATCHES "DRM")
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
elseif ("${PLATFORM}" MATCHES "SDL")
find_package(SDL2 REQUIRED)
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
set(LIBS_PRIVATE SDL2::SDL2)
# First, check if SDL is included as a subdirectory
if(TARGET SDL3::SDL3)
message(STATUS "Using SDL3 from subdirectory")
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
set(LIBS_PRIVATE SDL3::SDL3)
add_compile_definitions(USING_SDL3_PROJECT)
elseif(TARGET SDL2::SDL2)
message(STATUS "Using SDL2 from subdirectory")
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
set(LIBS_PRIVATE SDL2::SDL2)
add_compile_definitions(USING_SDL2_PROJECT)
else()
# No SDL added via add_subdirectory(), try find_package()
message(STATUS "No SDL target from subdirectory, searching via find_package()...")
# First try SDL3
find_package(SDL3 QUIET)
if(SDL3_FOUND)
message(STATUS "Found SDL3 via find_package()")
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
set(LIBS_PRIVATE SDL3::SDL3)
add_compile_definitions(USING_SDL3_PACKAGE)
else()
# Fallback to SDL2
find_package(SDL2 REQUIRED)
message(STATUS "Found SDL2 via find_package()")
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
set(LIBS_PRIVATE SDL2::SDL2)
add_compile_definitions(USING_SDL2_PACKAGE)
endif()
endif()
endif ()
if (NOT ${OPENGL_VERSION} MATCHES "OFF")

View File

@@ -1,6 +1,6 @@
# - Try to find raylib
# Options:
# raylib_USE_STATIC_LIBS - OFF by default
# raylib_USE_STATIC_LIBS - ON by default
# raylib_VERBOSE - OFF by default
# Once done, this defines a raylib target that can be passed to
# target_link_libraries as well as following variables:
@@ -11,6 +11,9 @@
# raylib_LDFLAGS - The linker flags needed with raylib
# raylib_DEFINITIONS - Compiler switches required for using raylib
option(raylib_USE_STATIC_LIBS "Use static libs" ON)
option(raylib_VERBOSE "Show raylib verbose messages" OFF)
if (NOT TARGET raylib)
set(XPREFIX PC_RAYLIB)
@@ -25,23 +28,22 @@ if (NOT TARGET raylib)
find_path(raylib_INCLUDE_DIR
NAMES raylib.h
HINTS ${${XPREFIX}_INCLUDE_DIRS}
HINTS ${${XPREFIX}_INCLUDE_DIRS} ${raylib_DIR}/../../../include/
)
set(RAYLIB_NAMES raylib)
if (raylib_USE_STATIC_LIBS)
set(RAYLIB_NAMES libraylib.a raylib.lib ${RAYLIB_NAMES})
endif()
set(RAYLIB_NAMES libraylib.a raylib.lib)
else ()
set(RAYLIB_NAMES raylib)
endif ()
find_library(raylib_LIBRARY
NAMES ${RAYLIB_NAMES}
HINTS ${${XPREFIX}_LIBRARY_DIRS}
HINTS ${${XPREFIX}_LIBRARY_DIRS} ${raylib_DIR}/../../
)
set(raylib_LIBRARIES ${raylib_LIBRARY})
set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})
set(raylib_LIBRARY_DIR ${raylib_LIBRARY_DIRS})
set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})

View File

@@ -90,13 +90,14 @@ if (${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_view_depth.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_raymarching.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_palette_switch.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
elseif (${PLATFORM} MATCHES "Web")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1 --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
@@ -124,7 +125,21 @@ endif ()
# The rlgl_standalone example only targets desktop, without shared libraries.
if (BUILD_SHARED_LIBS OR NOT ${PLATFORM} MATCHES "Desktop")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
endif()
# The audio examples fail to link if raylib is built without raudio
if (NOT SUPPORT_MODULE_RAUDIO)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_mixed_processor.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_module_playing.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_music_stream.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_raw_stream.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_sound_loading.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_sound_multi.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_stream_effects.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/embedded_files_loading.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_sprite_button.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_sprite_explosion.c)
endif()
include_directories(BEFORE SYSTEM others/external/include)

View File

@@ -20,6 +20,8 @@
# - Linux (X11 desktop mode)
# - macOS/OSX (x64, arm64 (not tested))
# - Others (not tested)
# > PLATFORM_WEB_RGFW:
# - HTML5 (WebAssembly)
# > PLATFORM_WEB:
# - HTML5 (WebAssembly)
# > PLATFORM_DRM:
@@ -28,7 +30,7 @@
# > PLATFORM_ANDROID:
# - Android (ARM, ARM64)
#
# Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
@@ -51,13 +53,18 @@
# Define required environment variables
#------------------------------------------------------------------------------------------------
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB, PLATFORM_WEB_RGFW
PLATFORM ?= PLATFORM_DESKTOP
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
TARGET_PLATFORM := $(PLATFORM)
override PLATFORM = PLATFORM_DESKTOP
else
TARGET_PLATFORM = $(PLATFORM)
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
else
TARGET_PLATFORM = $(PLATFORM)
endif
endif
# Define required raylib variables
@@ -89,7 +96,6 @@ SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib
SDL_LIBRARIES ?= -lSDL2 -lSDL2main
# 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
@@ -100,9 +106,12 @@ BUILD_WEB_SHELL ?= $(RAYLIB_PATH)/src/minshell.html
BUILD_WEB_HEAP_SIZE ?= 134217728
BUILD_WEB_RESOURCES ?= TRUE
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
# Use WebGL2 backend (OpenGL 3.0)
# WARNING: Requires raylib compiled with GRAPHICS_API_OPENGL_ES3
BUILD_WEB_WEBGL2 ?= FALSE
# Determine PLATFORM_OS when required
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_WEB_RGFW))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
@@ -153,7 +162,7 @@ endif
# Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables
EMSDK_PATH ?= C:/raylib/emsdk
@@ -179,7 +188,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
CC = clang
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
# HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned
# to use emscripten.h and emscripten_set_main_loop()
@@ -198,7 +207,7 @@ endif
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(OS),Windows_NT)
MAKE = mingw32-make
else
@@ -226,11 +235,8 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -g -D_DEBUG
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
CFLAGS += -sASSERTIONS=1 --profiling
endif
else
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3
else
@@ -266,8 +272,8 @@ endif
# NOTE: Some external/extras libraries could be required (stb, easings...)
#------------------------------------------------------------------------------------------------
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external $(EXTRA_INCLUDE_PATHS)
# Define additional directories containing required header files
# Define additional directories containing required header files
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),BSD)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) -I/usr/pkg/include -I/usr/X11R7/include
@@ -284,11 +290,6 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
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
@@ -320,29 +321,41 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
endif
LDFLAGS += -L$(SDL_LIBRARY_PATH)
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
# -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
# -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
# -sUSE_PTHREADS=1 # multithreading support
# -sWASM=0 # disable Web Assembly, emitted by default
# -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
# -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
# -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
# -sUSE_PTHREADS=1 # multithreading support
# -sWASM=0 # disable Web Assembly, emitted by default
# -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# -sMINIFY_HTML=0 # minify generated html from shell.html
# --profiling # include information for code profiling
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map
LDFLAGS += -sUSE_GLFW=3 -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1
# --shell-file shell.html # define a custom shell .html and output extension
LDFLAGS += -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1 -sEXPORTED_RUNTIME_METHODS=ccall -sMINIFY_HTML=0
# Using GLFW3 library (instead of RGFW)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
LDFLAGS += -sUSE_GLFW=3
endif
# Build using asyncify
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
LDFLAGS += -sASYNCIFY
endif
# NOTE: Flags required for WebGL 2.0 (OpenGL ES 3.0)
# WARNING: Requires raylib compiled with GRAPHICS_API_OPENGL_ES3
ifeq ($(BUILD_WEB_WEBGL2),TRUE)
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2
endif
# Add resources building if required
ifeq ($(BUILD_WEB_RESOURCES),TRUE)
LDFLAGS += --preload-file $(BUILD_WEB_RESOURCES_PATH)
@@ -467,7 +480,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
# NOTE: Required packages: libegl1-mesa-dev
LDFLAGS += -L../src
LDLIBS = -lraylib -lm
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
LDLIBS += -framework Foundation -framework AppKit -framework IOKit -framework OpenGL -framework CoreVideo
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
@@ -475,19 +488,23 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
# Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.web.a
endif
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
# Define source code object files required
#------------------------------------------------------------------------------------------------
#EXAMPLES_LIST_START
CORE = \
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_fps \
core/core_3d_camera_free \
core/core_3d_camera_mode \
core/core_3d_camera_split_screen \
@@ -495,20 +512,18 @@ CORE = \
core/core_automation_events \
core/core_basic_screen_manager \
core/core_basic_window \
core/core_basic_window_web \
core/core_custom_frame_control \
core/core_custom_logging \
core/core_drop_files \
core/core_high_dpi \
core/core_input_gamepad \
core/core_input_gamepad_info \
core/core_input_gestures \
core/core_input_gestures_web \
core/core_input_gestures_testbed \
core/core_input_keys \
core/core_input_mouse \
core/core_input_mouse_wheel \
core/core_input_multitouch \
core/core_input_virtual_controls \
core/core_loading_thread \
core/core_random_sequence \
core/core_random_values \
core/core_scissor_test \
@@ -525,6 +540,8 @@ SHAPES = \
shapes/shapes_bouncing_ball \
shapes/shapes_collision_area \
shapes/shapes_colors_palette \
shapes/shapes_digital_clock \
shapes/shapes_double_pendulum \
shapes/shapes_draw_circle_sector \
shapes/shapes_draw_rectangle_rounded \
shapes/shapes_draw_ring \
@@ -535,16 +552,15 @@ SHAPES = \
shapes/shapes_lines_bezier \
shapes/shapes_logo_raylib \
shapes/shapes_logo_raylib_anim \
shapes/shapes_rectangle_advanced \
shapes/shapes_rectangle_scaling \
shapes/shapes_splines_drawing \
shapes/shapes_top_down_lights \
shapes/shapes_rectangle_advanced
shapes/shapes_top_down_lights
TEXTURES = \
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_channel \
@@ -559,38 +575,41 @@ TEXTURES = \
textures/textures_mouse_painting \
textures/textures_npatch_drawing \
textures/textures_particles_blending \
textures/textures_polygon \
textures/textures_polygon_drawing \
textures/textures_raw_data \
textures/textures_sprite_anim \
textures/textures_sprite_button \
textures/textures_sprite_explosion \
textures/textures_srcrec_dstrec \
textures/textures_textured_curve \
textures/textures_tiled_drawing \
textures/textures_to_image
TEXT = \
text/text_3d_drawing \
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_raylib_fonts \
text/text_rectangle_bounds \
text/text_unicode \
text/text_sprite_fonts \
text/text_unicode_emojis \
text/text_unicode_ranges \
text/text_writing_anim
MODELS = \
models/models_animation \
models/models_billboard \
models/models_billboard_rendering \
models/models_bone_socket \
models/models_box_collisions \
models/models_cubicmap \
models/models_draw_cube_texture \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_gpu_skinning \
models/models_heightmap \
models/models_loading \
models/models_loading_gltf \
@@ -601,10 +620,10 @@ MODELS = \
models/models_orthographic_projection \
models/models_point_rendering \
models/models_rlgl_solar_system \
models/models_skybox \
models/models_skybox_rendering \
models/models_tesseract_view \
models/models_waving_cubes \
models/models_yaw_pitch_roll \
models/models_gpu_skinning
models/models_yaw_pitch_roll
SHADERS = \
shaders/shaders_basic_lighting \
@@ -612,7 +631,7 @@ SHADERS = \
shaders/shaders_custom_uniform \
shaders/shaders_deferred_render \
shaders/shaders_eratosthenes \
shaders/shaders_fog \
shaders/shaders_fog_rendering \
shaders/shaders_hot_reloading \
shaders/shaders_hybrid_render \
shaders/shaders_julia_set \
@@ -620,19 +639,22 @@ SHADERS = \
shaders/shaders_mesh_instancing \
shaders/shaders_model_shader \
shaders/shaders_multi_sample2d \
shaders/shaders_normal_map \
shaders/shaders_palette_switch \
shaders/shaders_postprocessing \
shaders/shaders_raymarching \
shaders/shaders_rounded_rectangle \
shaders/shaders_shadowmap \
shaders/shaders_shapes_textures \
shaders/shaders_simple_mask \
shaders/shaders_spotlight \
shaders/shaders_texture_drawing \
shaders/shaders_texture_outline \
shaders/shaders_texture_rendering \
shaders/shaders_texture_tiling \
shaders/shaders_texture_waves \
shaders/shaders_write_depth \
shaders/shaders_vertex_displacement
shaders/shaders_vertex_displacement \
shaders/shaders_view_depth \
shaders/shaders_write_depth
AUDIO = \
audio/audio_mixed_processor \
@@ -641,6 +663,7 @@ AUDIO = \
audio/audio_raw_stream \
audio/audio_sound_loading \
audio/audio_sound_multi \
audio/audio_sound_positioning \
audio/audio_stream_effects
OTHERS = \
@@ -648,19 +671,14 @@ OTHERS = \
others/embedded_files_loading \
others/raylib_opengl_interop \
others/raymath_vector_angle \
others/rlgl_compute_shader
ifeq ($(TARGET_PLATFORM), PLATFORM_DESKTOP_GFLW)
OTHERS += others/rlgl_standalone
endif
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
others/rlgl_compute_shader \
others/rlgl_standalone
#EXAMPLES_LIST_END
# Define processes to execute
#------------------------------------------------------------------------------------------------
# Default target entry
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(OTHERS)
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO)
core: $(CORE)
shapes: $(SHAPES)
@@ -669,14 +687,13 @@ text: $(TEXT)
models: $(MODELS)
shaders: $(SHADERS)
audio: $(AUDIO)
others: $(OTHERS)
# Generic compilation pattern
# NOTE: Examples must be ready for Android compilation!
%: %.c
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
else ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
else ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
$(MAKE) -f Makefile.Web $@
else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
@@ -705,7 +722,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete
rm -fv *.o
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS)
del *.wasm *.html *.js *.data
else

View File

@@ -2,7 +2,7 @@
#
# raylib makefile for Android project (APK building)
#
# Copyright (c) 2017-2024 Ramon Santamaria (@raysan5)
# Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ The examples assume you have already built the `raylib` library in `../src`.
- `make` builds all examples
- `make [module]` builds all examples for a particular module (e.g `make core`)
- `make [module]/[name]` builds one examples for a particular module (e.g `make core/core_basic_window`)
### With Zig
@@ -16,194 +17,223 @@ You may find it easier to use than other toolchains, especially when it comes to
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
## EXAMPLES LIST
## EXAMPLES COLLECTION [TOTAL: 160]
### category: core
### category: core [35]
Examples using raylib core platform functionality like window creation, inputs, drawing modes and system functionality.
Examples using raylib[core](../src/rcore.c) platform functionality like window creation, inputs, drawing modes and system functionality.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 01 | [core_basic_window](core/core_basic_window.c) | <img src="core/core_basic_window.png" alt="core_basic_window" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 02 | [core_input_keys](core/core_input_keys.c) | <img src="core/core_input_keys.png" alt="core_input_keys" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 03 | [core_input_mouse](core/core_input_mouse.c) | <img src="core/core_input_mouse.png" alt="core_input_mouse" width="80"> | ⭐☆☆☆ | 1.0 | **4.0** | [Ray](https://github.com/raysan5) |
| 04 | [core_input_mouse_wheel](core/core_input_mouse_wheel.c) | <img src="core/core_input_mouse_wheel.png" alt="core_input_mouse_wheel" width="80"> | ⭐☆☆☆ | 1.1 | 1.3 | [Ray](https://github.com/raysan5) |
| 05 | [core_input_gamepad](core/core_input_gamepad.c) | <img src="core/core_input_gamepad.png" alt="core_input_gamepad" width="80"> | ⭐☆☆☆ | 1.1 | **4.2** | [Ray](https://github.com/raysan5) |
| 06 | [core_input_multitouch](core/core_input_multitouch.c) | <img src="core/core_input_multitouch.png" alt="core_input_multitouch" width="80"> | ⭐☆☆☆ | 2.1 | 2.5 | [Berni](https://github.com/Berni8k) |
| 07 | [core_input_gestures](core/core_input_gestures.c) | <img src="core/core_input_gestures.png" alt="core_input_gestures" width="80"> | ⭐️⭐️☆☆ | 1.4 | **4.2** | [Ray](https://github.com/raysan5) |
| 08 | [core_input_virtual_controls](core/core_input_virtual_controls.c) | <img src="core/core_input_virtual_controls.png" alt="core_input_virtual_controls" width="80"> | ⭐️⭐️☆☆ | **5.0** | **5.0** | [oblerion](https://github.com/oblerion) |
| 09 | [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) |
| 10 | [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) |
| 11 | [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) |
| 12 | [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) |
| 13 | [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) |
| 14 | [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) |
| 15 | [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) |
| 16 | [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) |
| 17 | [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) |
| 18 | [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) |
| 19 | [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) |
| 20 | [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) |
| 21 | [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) |
| 22 | [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) |
| 23 | [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) |
| 24 | [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) |
| 25 | [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) |
| 26 | [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) |
| 27 | [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) |
| 28 | [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) |
| 29 | [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) |
| 30 | [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) |
| 31 | [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) |
| 32 | [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) |
| 33 | [core_random_sequence](core/core_random_sequence.c) | <img src="core/core_random_sequence.png" alt="core_random_sequence" width="80"> | ⭐☆☆☆ | **5.0** | **5.0** | [REDl3east](https://github.com/REDl3east) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [core_basic_window](core/core_basic_window.c) | <img src="core/core_basic_window.png" alt="core_basic_window" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_keys](core/core_input_keys.c) | <img src="core/core_input_keys.png" alt="core_input_keys" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_mouse](core/core_input_mouse.c) | <img src="core/core_input_mouse.png" alt="core_input_mouse" width="80"> | ⭐☆☆☆ | 1.0 | 5.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_mouse_wheel](core/core_input_mouse_wheel.c) | <img src="core/core_input_mouse_wheel.png" alt="core_input_mouse_wheel" width="80"> | ⭐☆☆☆ | 1.1 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_gamepad](core/core_input_gamepad.c) | <img src="core/core_input_gamepad.png" alt="core_input_gamepad" width="80"> | ⭐☆☆☆ | 1.1 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_multitouch](core/core_input_multitouch.c) | <img src="core/core_input_multitouch.png" alt="core_input_multitouch" width="80"> | ⭐☆☆☆ | 2.1 | 2.5 | [Berni](https://github.com/Berni8k) |
| [core_input_gestures](core/core_input_gestures.c) | <img src="core/core_input_gestures.png" alt="core_input_gestures" width="80"> | ⭐☆☆ | 1.4 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_input_gestures_testbed](core/core_input_gestures_testbed.c) | <img src="core/core_input_gestures_testbed.png" alt="core_input_gestures_testbed" width="80"> | ⭐⭐⭐☆ | 4.6 | 5.6 | [ubkp](https://github.com/ubkp) |
| [core_input_virtual_controls](core/core_input_virtual_controls.c) | <img src="core/core_input_virtual_controls.png" alt="core_input_virtual_controls" width="80"> | ⭐☆☆ | 5.0 | 5.0 | [oblerion](https://github.com/oblerion) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [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 | [arvyy](https://github.com/arvyy) |
| [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) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [core_3d_camera_fps](core/core_3d_camera_fps.c) | <img src="core/core_3d_camera_fps.png" alt="core_3d_camera_fps" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Agnis Aldins](https://github.com/nezvers) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [core_random_sequence](core/core_random_sequence.c) | <img src="core/core_random_sequence.png" alt="core_random_sequence" width="80"> | ⭐☆☆☆ | 5.0 | 5.0 | [Dalton Overmyer](https://github.com/REDl3east) |
| [core_automation_events](core/core_automation_events.c) | <img src="core/core_automation_events.png" alt="core_automation_events" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
### category: shapes
### category: shapes [20]
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/shapes.c) module.
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 34 | [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | **4.0** | [Ray](https://github.com/raysan5) |
| 35 | [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 36 | [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐️⭐️☆☆ | 1.0 | 2.5 | [Ray](https://github.com/raysan5) |
| 37 | [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 38 | [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐️⭐️☆☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
| 39 | [shapes_rectangle_scaling](shapes/shapes_rectangle_scaling.c) | <img src="shapes/shapes_rectangle_scaling.png" alt="shapes_rectangle_scaling" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| 40 | [shapes_lines_bezier](shapes/shapes_lines_bezier.c) | <img src="shapes/shapes_lines_bezier.png" alt="shapes_lines_bezier" width="80"> | ⭐☆☆☆ | 1.7 | 1.7 | [Ray](https://github.com/raysan5) |
| 41 | [shapes_collision_area](shapes/shapes_collision_area.c) | <img src="shapes/shapes_collision_area.png" alt="shapes_collision_area" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 42 | [shapes_following_eyes](shapes/shapes_following_eyes.c) | <img src="shapes/shapes_following_eyes.png" alt="shapes_following_eyes" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 43 | [shapes_easings_ball_anim](shapes/shapes_easings_ball_anim.c) | <img src="shapes/shapes_easings_ball_anim.png" alt="shapes_easings_ball_anim" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 44 | [shapes_easings_box_anim](shapes/shapes_easings_box_anim.c) | <img src="shapes/shapes_easings_box_anim.png" alt="shapes_easings_box_anim" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 45 | [shapes_easings_rectangle_array](shapes/shapes_easings_rectangle_array.c) | <img src="shapes/shapes_easings_rectangle_array.png" alt="shapes_easings_rectangle_array" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 46 | [shapes_draw_ring](shapes/shapes_draw_ring.c) | <img src="shapes/shapes_draw_ring.png" alt="shapes_draw_ring" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| 47 | [shapes_draw_circle_sector](shapes/shapes_draw_circle_sector.c) | <img src="shapes/shapes_draw_circle_sector.png" alt="shapes_draw_circle_sector" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| 48 | [shapes_draw_rectangle_rounded](shapes/shapes_draw_rectangle_rounded.c) | <img src="shapes/shapes_draw_rectangle_rounded.png" alt="shapes_draw_rectangle_rounded" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| 49 | [shapes_top_down_lights](shapes/shapes_top_down_lights.c) | <img src="shapes/shapes_top_down_lights.png" alt="shapes_top_down_lights" width="80"> | ⭐️⭐️⭐️⭐️ | **4.2** | **4.2** | [Jeffery Myers](https://github.com/JeffM2501) |
| 50 | [shapes_rectangle_advanced](shapes/shapes_rectangle_advanced.c) | <img src="shapes/shapes_rectangle_advanced.png" alt="shapes_rectangle_advanced" width="80"> | ⭐️⭐️⭐️⭐️⭐️| **5.0** | **5.0** | [ExCyber](https://github.com/evertonse) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐☆☆ | 1.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐☆☆ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_rectangle_scaling](shapes/shapes_rectangle_scaling.c) | <img src="shapes/shapes_rectangle_scaling.png" alt="shapes_rectangle_scaling" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| [shapes_lines_bezier](shapes/shapes_lines_bezier.c) | <img src="shapes/shapes_lines_bezier.png" alt="shapes_lines_bezier" width="80"> | ⭐☆☆☆ | 1.7 | 1.7 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_collision_area](shapes/shapes_collision_area.c) | <img src="shapes/shapes_collision_area.png" alt="shapes_collision_area" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_following_eyes](shapes/shapes_following_eyes.c) | <img src="shapes/shapes_following_eyes.png" alt="shapes_following_eyes" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_easings_ball_anim](shapes/shapes_easings_ball_anim.c) | <img src="shapes/shapes_easings_ball_anim.png" alt="shapes_easings_ball_anim" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_easings_box_anim](shapes/shapes_easings_box_anim.c) | <img src="shapes/shapes_easings_box_anim.png" alt="shapes_easings_box_anim" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_easings_rectangle_array](shapes/shapes_easings_rectangle_array.c) | <img src="shapes/shapes_easings_rectangle_array.png" alt="shapes_easings_rectangle_array" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_draw_ring](shapes/shapes_draw_ring.c) | <img src="shapes/shapes_draw_ring.png" alt="shapes_draw_ring" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| [shapes_draw_circle_sector](shapes/shapes_draw_circle_sector.c) | <img src="shapes/shapes_draw_circle_sector.png" alt="shapes_draw_circle_sector" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| [shapes_draw_rectangle_rounded](shapes/shapes_draw_rectangle_rounded.c) | <img src="shapes/shapes_draw_rectangle_rounded.png" alt="shapes_draw_rectangle_rounded" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
| [shapes_top_down_lights](shapes/shapes_top_down_lights.c) | <img src="shapes/shapes_top_down_lights.png" alt="shapes_top_down_lights" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) |
| [shapes_rectangle_advanced](shapes/shapes_rectangle_advanced.c) | <img src="shapes/shapes_rectangle_advanced.png" alt="shapes_rectangle_advanced" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.5 | [Everton Jr.](https://github.com/evertonse) |
| [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
| [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
### category: textures
### category: textures [26]
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/textures.c) module.
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/rtextures.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 51 | [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 52 | [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 53 | [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
| 54 | [textures_image_generation](textures/textures_image_generation.c) | <img src="textures/textures_image_generation.png" alt="textures_image_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | 1.8 | [Ray](https://github.com/raysan5) |
| 55 | [textures_image_loading](textures/textures_image_loading.c) | <img src="textures/textures_image_loading.png" alt="textures_image_loading" width="80"> | ⭐☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 56 | [textures_image_processing](textures/textures_image_processing.c) | <img src="textures/textures_image_processing.png" alt="textures_image_processing" width="80"> | ⭐️⭐️⭐️☆ | 1.4 | 3.5 | [Ray](https://github.com/raysan5) |
| 57 | [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
| 58 | [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="80"> | ⭐☆☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 59 | [textures_raw_data](textures/textures_raw_data.c) | <img src="textures/textures_raw_data.png" alt="textures_raw_data" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
| 60 | [textures_particles_blending](textures/textures_particles_blending.c) | <img src="textures/textures_particles_blending.png" alt="textures_particles_blending" width="80"> | ⭐☆☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
| 61 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) | <img src="textures/textures_npatch_drawing.png" alt="textures_npatch_drawing" width="80"> | ⭐️⭐️⭐️☆ | 2.0 | 2.5 | [Jorge A. Gomes](https://github.com/overdev) |
| 62 | [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="80"> | ⭐☆☆☆ | 2.0 | 2.5 | [Ray](https://github.com/raysan5) |
| 63 | [textures_sprite_anim](textures/textures_sprite_anim.c) | <img src="textures/textures_sprite_anim.png" alt="textures_sprite_anim" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
| 64 | [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="80"> | ⭐️⭐️☆☆ | 2.5 | 2.5 | [Ray](https://github.com/raysan5) |
| 65 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 66 | [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | 2.5 | [Ray](https://github.com/raysan5) |
| 67 | [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
| 68 | [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="80"> | ⭐☆☆☆ | 3.5 | 3.5 | [Karlo Licudine](https://github.com/accidentalrebel) |
| 69 | [textures_draw_tiled](textures/textures_draw_tiled.c) | <img src="textures/textures_draw_tiled.png" alt="textures_draw_tiled" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | **4.2** | [Vlad Adrian](https://github.com/demizdor) |
| 70 | [textures_polygon](textures/textures_polygon.c) | <img src="textures/textures_polygon.png" alt="textures_polygon" width="80"> | ⭐☆☆☆ | 3.7 | 3.7 | [Chris Camacho](https://github.com/codifies) |
| 71 | [textures_fog_of_war](textures/textures_fog_of_war.c) | <img src="textures/textures_fog_of_war.png" alt="textures_fog_of_war" width="80"> | ⭐️⭐️⭐️☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| 72 | [textures_gif_player](textures/textures_gif_player.c) | <img src="textures/textures_gif_player.png" alt="textures_gif_player" width="80"> | ⭐️⭐️⭐️☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐⭐⭐☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_image_generation](textures/textures_image_generation.c) | <img src="textures/textures_image_generation.png" alt="textures_image_generation" width="80"> | ⭐☆☆ | 1.8 | 1.8 | [Wilhem Barbier](https://github.com/nounoursheureux) |
| [textures_image_loading](textures/textures_image_loading.c) | <img src="textures/textures_image_loading.png" alt="textures_image_loading" width="80"> | ⭐☆☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_image_processing](textures/textures_image_processing.c) | <img src="textures/textures_image_processing.png" alt="textures_image_processing" width="80"> | ⭐⭐⭐☆ | 1.4 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="80"> | ⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="80"> | ⭐☆☆☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_raw_data](textures/textures_raw_data.c) | <img src="textures/textures_raw_data.png" alt="textures_raw_data" width="80"> | ⭐⭐⭐☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_particles_blending](textures/textures_particles_blending.c) | <img src="textures/textures_particles_blending.png" alt="textures_particles_blending" width="80"> | ⭐☆☆☆ | 1.7 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_npatch_drawing](textures/textures_npatch_drawing.c) | <img src="textures/textures_npatch_drawing.png" alt="textures_npatch_drawing" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Jorge A. Gomes](https://github.com/overdev) |
| [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="80"> | ⭐☆☆☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_sprite_anim](textures/textures_sprite_anim.c) | <img src="textures/textures_sprite_anim.png" alt="textures_sprite_anim" width="80"> | ⭐☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="80"> | ⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="80"> | ⭐☆☆ | 2.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="80"> | ⭐⭐⭐☆ | 1.6 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="80"> | ⭐⭐⭐☆ | 3.0 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
| [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="80"> | ⭐☆☆☆ | 3.5 | 3.5 | [Karlo Licudine](https://github.com/accidentalrebel) |
| [textures_tiled_drawing](textures/textures_tiled_drawing.c) | <img src="textures/textures_tiled_drawing.png" alt="textures_tiled_drawing" width="80"> | ⭐⭐⭐☆ | 3.0 | 4.2 | [Vlad Adrian](https://github.com/demizdor) |
| [textures_polygon_drawing](textures/textures_polygon_drawing.c) | <img src="textures/textures_polygon_drawing.png" alt="textures_polygon_drawing" width="80"> | ⭐☆☆☆ | 3.7 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
| [textures_fog_of_war](textures/textures_fog_of_war.c) | <img src="textures/textures_fog_of_war.png" alt="textures_fog_of_war" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_gif_player](textures/textures_gif_player.c) | <img src="textures/textures_gif_player.png" alt="textures_gif_player" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_image_kernel](textures/textures_image_kernel.c) | <img src="textures/textures_image_kernel.png" alt="textures_image_kernel" width="80"> | ⭐⭐⭐⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) |
| [textures_image_channel](textures/textures_image_channel.c) | <img src="textures/textures_image_channel.png" alt="textures_image_channel" width="80"> | ⭐⭐☆☆ | 5.1 | 5.1 | [Bruno Cabral](https://github.com/brccabral) |
| [textures_image_rotate](textures/textures_image_rotate.c) | <img src="textures/textures_image_rotate.png" alt="textures_image_rotate" width="80"> | ⭐⭐☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [textures_textured_curve](textures/textures_textured_curve.c) | <img src="textures/textures_textured_curve.png" alt="textures_textured_curve" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) |
### category: text
### category: text [13]
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/text.c) module.
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/rtext.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 73 | [text_raylib_fonts](text/text_raylib_fonts.c) | <img src="text/text_raylib_fonts.png" alt="text_raylib_fonts" width="80"> | ⭐☆☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
| 74 | [text_font_spritefont](text/text_font_spritefont.c) | <img src="text/text_font_spritefont.png" alt="text_font_spritefont" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
| 75 | [text_font_filters](text/text_font_filters.c) | <img src="text/text_font_filters.png" alt="text_font_filters" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 76 | [text_font_loading](text/text_font_loading.c) | <img src="text/text_font_loading.png" alt="text_font_loading" width="80"> | ⭐☆☆☆ | 1.4 | 3.0 | [Ray](https://github.com/raysan5) |
| 77 | [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 78 | [text_format_text](text/text_format_text.c) | <img src="text/text_format_text.png" alt="text_format_text" width="80"> | ⭐☆☆☆ | 1.1 | 3.0 | [Ray](https://github.com/raysan5) |
| 79 | [text_input_box](text/text_input_box.c) | <img src="text/text_input_box.png" alt="text_input_box" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.5 | [Ray](https://github.com/raysan5) |
| 80 | [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐️⭐️☆☆ | 1.4 | 1.4 | [Ray](https://github.com/raysan5) |
| 81 | [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Vlad Adrian](https://github.com/demizdor) |
| 82 | [text_unicode](text/text_unicode.c) | <img src="text/text_unicode.png" alt="text_unicode" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Vlad Adrian](https://github.com/demizdor) |
| 83 | [text_draw_3d](text/text_draw_3d.c) | <img src="text/text_draw_3d.png" alt="text_draw_3d" width="80"> | ⭐️⭐️⭐️⭐️ | 3.5 | **4.0** | [Vlad Adrian](https://github.com/demizdor) |
| 84 | [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐️⭐️⭐️ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [text_sprite_fonts](text/text_sprite_fonts.c) | <img src="text/text_sprite_fonts.png" alt="text_sprite_fonts" width="80"> | ⭐☆☆☆ | 1.7 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_font_spritefont](text/text_font_spritefont.c) | <img src="text/text_font_spritefont.png" alt="text_font_spritefont" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_font_filters](text/text_font_filters.c) | <img src="text/text_font_filters.png" alt="text_font_filters" width="80"> | ⭐☆☆ | 1.3 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_font_loading](text/text_font_loading.c) | <img src="text/text_font_loading.png" alt="text_font_loading" width="80"> | ⭐☆☆☆ | 1.4 | 3.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="80"> | ⭐⭐⭐☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_format_text](text/text_format_text.c) | <img src="text/text_format_text.png" alt="text_format_text" width="80"> | ⭐☆☆☆ | 1.1 | 3.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_input_box](text/text_input_box.c) | <img src="text/text_input_box.png" alt="text_input_box" width="80"> | ⭐☆☆ | 1.7 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
| [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
| [text_unicode_emojis](text/text_unicode_emojis.c) | <img src="text/text_unicode_emojis.png" alt="text_unicode_emojis" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
| [text_unicode_ranges](text/text_unicode_ranges.c) | <img src="text/text_unicode_ranges.png" alt="text_unicode_ranges" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Vlad Adrian](https://github.com/demizdor) |
| [text_3d_drawing](text/text_3d_drawing.c) | <img src="text/text_3d_drawing.png" alt="text_3d_drawing" width="80"> | ⭐⭐⭐⭐️ | 3.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
| [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
### category: models
### category: models [23]
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/models.c) module.
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 85 | [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [culacant](https://github.com/culacant) |
| 86 | [models_billboard](models/models_billboard.c) | <img src="models/models_billboard.png" alt="models_billboard" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
| 87 | [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐☆☆☆ | 1.3 | 3.5 | [Ray](https://github.com/raysan5) |
| 88 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="80"> | ⭐️⭐️☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
| 89 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 90 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 3.5 | [Ray](https://github.com/raysan5) |
| 91 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
| 92 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="80"> | ⭐️⭐️⭐️☆ | 1.7 | **4.0** | [Joel Davis](https://github.com/joeld42) |
| 93 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="80"> | ⭐☆☆☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
| 94 | [models_loading_gltf](models/models_loading_gltf.c) | <img src="models/models_loading_gltf.png" alt="models_loading_gltf" width="80"> | ⭐☆☆☆ | 3.7 | **4.2** | [Ray](https://github.com/raysan5) |
| 95 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐☆☆☆ | **4.0** | **4.0** | [Johann Nadalutti](https://github.com/procfxgen) |
| 96 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
| 97 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
| 98 | [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐️⭐️☆☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
| 99 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
| 100 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Berni](https://github.com/Berni8k) |
| 101 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [codecat](https://github.com/codecat) |
| 102 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
| 103 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="80"> | ⭐☆☆ | 2.5 | 3.5 | [Culacant](https://github.com/culacant) |
| [models_billboard_rendering](models/models_billboard_rendering.c) | <img src="models/models_billboard_rendering.png" alt="models_billboard_rendering" width="80"> | ⭐⭐⭐☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐☆☆☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="80"> | ⭐☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="80"> | ⭐☆☆ | 2.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="80"> | ⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="80"> | ⭐⭐⭐☆ | 1.7 | 4.0 | [Joel Davis](https://github.com/joeld42) |
| [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="80"> | ⭐☆☆☆ | 2.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_loading_gltf](models/models_loading_gltf.c) | <img src="models/models_loading_gltf.png" alt="models_loading_gltf" width="80"> | ⭐☆☆☆ | 3.7 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐☆☆☆ | 4.0 | 4.0 | [Johann Nadalutti](https://github.com/procfxgen) |
| [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐☆☆ | 4.5 | 4.5 | [bzt](https://github.com/bztsrc) |
| [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
| [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
| [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐☆☆ | 1.8 | 4.0 | [Berni](https://github.com/Berni8k) |
| [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.7 | [Codecat](https://github.com/codecat) |
| [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐☆☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_skybox_rendering](models/models_skybox_rendering.c) | <img src="models/models_skybox_rendering.png" alt="models_skybox_rendering" width="80"> | ⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_draw_cube_texture](models/models_draw_cube_texture.c) | <img src="models/models_draw_cube_texture.png" alt="models_draw_cube_texture" width="80"> | ⭐⭐☆☆ | 4.5 | 4.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [models_gpu_skinning](models/models_gpu_skinning.c) | <img src="models/models_gpu_skinning.png" alt="models_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 5.6 | 5.6 | [Timothy van der Valk](https://github.com/arceryz) |
### category: shaders
### category: shaders [29]
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 104 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | **4.2** | [Chris Camacho](https://github.com/codifies) |
| 105 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
| 106 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
| 107 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 108 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
| 109 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
| 110 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | **4.2** | [Ray](https://github.com/raysan5) |
| 111 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/) |
| 112 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | **4.0** | **4.0** | [Samuel Skiff](https://github.com/GoldenThumbs) |
| 113 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
| 114 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [eggmund](https://github.com/eggmund) |
| 115 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [ProfJski](https://github.com/ProfJski) |
| 116 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
| 117 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
| 118 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
| 119 | [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) |
| 120 | [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) |
| 121 | [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) |
| 122 | [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) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐⭐⭐⭐️ | 3.0 | 4.2 | [Chris Camacho](https://github.com/chriscamacho) |
| [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐☆☆ | 1.3 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐☆☆ | 1.7 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐☆☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐⭐⭐☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
| [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐⭐⭐⭐️ | 2.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_texture_rendering](shaders/shaders_texture_rendering.c) | <img src="shaders/shaders_texture_rendering.png" alt="shaders_texture_rendering" width="80"> | ⭐☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/ciessielski) |
| [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐⭐⭐☆ | 4.0 | 4.0 | [Serenity Skiff](https://github.com/GoldenThumbs) |
| [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
| [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [Josh Colclough](https://github.com/joshcol9232) |
| [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [ProfJski](https://github.com/ProfJski) |
| [shaders_fog_rendering](shaders/shaders_fog_rendering.c) | <img src="shaders/shaders_fog_rendering.png" alt="shaders_fog_rendering" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
| [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
| [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐⭐⭐☆ | 3.0 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
| [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) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [shaders_normal_map](shaders/shaders_normal_map.c) | <img src="shaders/shaders_normal_map.png" alt="shaders_normal_map" width="80"> | ⭐⭐⭐⭐️ | 5.6 | 5.6 | [Jeremy Montgomery](https://github.com/Sir_Irk) |
| [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/chriscamacho) |
| [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) |
| [shaders_hybrid_render](shaders/shaders_hybrid_render.c) | <img src="shaders/shaders_hybrid_render.png" alt="shaders_hybrid_render" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
| [shaders_texture_tiling](shaders/shaders_texture_tiling.c) | <img src="shaders/shaders_texture_tiling.png" alt="shaders_texture_tiling" width="80"> | ⭐⭐☆☆ | 4.5 | 4.5 | [Luis Almeida](https://github.com/luis605) |
| [shaders_shadowmap](shaders/shaders_shadowmap.c) | <img src="shaders/shaders_shadowmap.png" alt="shaders_shadowmap" width="80"> | ⭐⭐⭐⭐️ | 5.0 | 5.0 | [TheManTheMythTheGameDev](https://github.com/TheManTheMythTheGameDev) |
| [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_vertex_displacement" width="80"> | ⭐⭐⭐☆ | 5.0 | 4.5 | [Alex ZH](https://github.com/ZzzhHe) |
| [shaders_write_depth](shaders/shaders_write_depth.c) | <img src="shaders/shaders_write_depth.png" alt="shaders_write_depth" width="80"> | ⭐⭐☆☆ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
| [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | <img src="shaders/shaders_basic_pbr.png" alt="shaders_basic_pbr" width="80"> | ⭐⭐⭐⭐️ | 5.0 | 5.1 | [Afan OLOVCIC](https://github.com/_DevDad) |
| [shaders_lightmap](shaders/shaders_lightmap.c) | <img src="shaders/shaders_lightmap.png" alt="shaders_lightmap" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) |
| [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | <img src="shaders/shaders_rounded_rectangle.png" alt="shaders_rounded_rectangle" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) |
| [shaders_view_depth](shaders/shaders_view_depth.c) | <img src="shaders/shaders_view_depth.png" alt="shaders_view_depth" width="80"> | ⭐⭐⭐☆ | 5.6 | 5.6 | [Luís Almeida](https://github.com/luis605) |
### category: audio
### category: audio [8]
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib, check [raudio_standalone](others/raudio_standalone.c) example.
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 123 | [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) |
| 124 | [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) |
| 125 | [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) |
| 126 | [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) |
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [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 | [Ramon Santamaria](https://github.com/raysan5) |
| [audio_mixed_processor](audio/audio_mixed_processor.c) | <img src="audio/audio_mixed_processor.png" alt="audio_mixed_processor" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) |
| [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐⭐☆☆ | 4.6 | 4.6 | [Jeffery Myers](https://github.com/JeffM2501) |
| [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
### category: others
### category: others [6]
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 127 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | **4.0** | [Ray](https://github.com/raysan5) |
| 128 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Teddy Astie](https://github.com/tsnake41) |
| 129 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
| 130 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Stephan Soller](https://github.com/arkanis) |
| 131 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
| [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐⭐⭐⭐️ | 1.6 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐⭐⭐⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) |
| [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
| [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐⭐⭐⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) |
| [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
| [raymath_vector_angle](others/raymath_vector_angle.c) | <img src="others/raymath_vector_angle.png" alt="raymath_vector_angle" width="80"> | ⭐⭐☆☆ | 1.0 | 4.6 | [Ramon Santamaria](https://github.com/raysan5) |
Some example missing? As always, contributions are welcome, feel free to send new examples!
Here is an[examples template](examples_template.c) with instructions to start with!

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [audio] example - Mixed audio processing
* raylib [audio] example - mixed audio processing
*
* Example complexity rating: [★★★★] 4/4
*
* Example originally created with raylib 4.2, last time updated with raylib 4.2
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2023 hkc (@hatkidchan)
* Copyright (c) 2023-2025 hkc (@hatkidchan)
*
********************************************************************************************/
#include "raylib.h"
@@ -28,13 +30,13 @@ void ProcessAudio(void *buffer, unsigned int frames)
for (unsigned int frame = 0; frame < frames; frame++)
{
float *left = &samples[frame * 2 + 0], *right = &samples[frame * 2 + 1];
float *left = &samples[frame*2 + 0], *right = &samples[frame*2 + 1];
*left = powf(fabsf(*left), exponent) * ( (*left < 0.0f)? -1.0f : 1.0f );
*right = powf(fabsf(*right), exponent) * ( (*right < 0.0f)? -1.0f : 1.0f );
*left = powf(fabsf(*left), exponent)*( (*left < 0.0f)? -1.0f : 1.0f );
*right = powf(fabsf(*right), exponent)*( (*right < 0.0f)? -1.0f : 1.0f );
average += fabsf(*left) / frames; // accumulating average volume
average += fabsf(*right) / frames;
average += fabsf(*left)/frames; // accumulating average volume
average += fabsf(*right)/frames;
}
// Moving history to the left
@@ -53,7 +55,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - processing mixed output");
InitWindow(screenWidth, screenHeight, "raylib [audio] example - mixed audio processing");
InitAudioDevice(); // Initialize audio device
@@ -97,7 +99,7 @@ int main(void)
DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
for (int i = 0; i < 400; i++)
{
DrawLine(201 + i, 232 - (int)(averageVolume[i] * 32), 201 + i, 232, MAROON);
DrawLine(201 + i, 232 - (int)(averageVolume[i]*32), 201 + i, 232, MAROON);
}
DrawRectangleLines(199, 199, 402, 34, GRAY);

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [audio] example - Module playing (streaming)
* raylib [audio] example - module playing (streaming)
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.5, last time updated with raylib 3.5
*
* 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) 2016-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2016-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [audio] example - Music playing (streaming)
* raylib [audio] example - music streaming
*
* Example originally created with raylib 1.3, last time updated with raylib 4.0
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.3, last time updated with raylib 4.2
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -23,7 +25,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music streaming");
InitAudioDevice(); // Initialize audio device
@@ -43,7 +45,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
UpdateMusicStream(music); // Update music buffer with new stream data
// Restart music playing (stop and play)
if (IsKeyPressed(KEY_SPACE))
{

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [audio] example - Raw audio streaming
* raylib [audio] example - raw audio streaming
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 1.6, last time updated with raylib 4.2
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox)
*
********************************************************************************************/
@@ -106,8 +108,6 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
// Sample mouse input.
mousePosition = GetMousePosition();
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
@@ -115,7 +115,7 @@ int main(void)
float fp = (float)(mousePosition.y);
frequency = 40.0f + (float)(fp);
float pan = (float)(mousePosition.x) / (float)screenWidth;
float pan = (float)(mousePosition.x)/(float)screenWidth;
SetAudioStreamPan(stream, pan);
}
@@ -123,7 +123,7 @@ int main(void)
// Compute two cycles to allow the buffer padding, simplifying any modulation, resampling, etc.
if (frequency != oldFrequency)
{
// Compute wavelength. Limit size in both directions.
// Compute wavelength. Limit size in both directions
//int oldWavelength = waveLength;
waveLength = (int)(22050/frequency);
if (waveLength > MAX_SAMPLES/2) waveLength = MAX_SAMPLES/2;
@@ -141,7 +141,7 @@ int main(void)
}
// Scale read cursor's position to minimize transition artifacts
//readCursor = (int)(readCursor * ((float)waveLength / (float)oldWavelength));
//readCursor = (int)(readCursor*((float)waveLength/(float)oldWavelength));
oldFrequency = frequency;
}

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [audio] example - Sound loading and playing
* raylib [audio] example - sound loading and playing
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.1, last time updated with raylib 3.5
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,13 +1,17 @@
/*******************************************************************************************
*
* raylib [audio] example - Playing sound multiple times
* raylib [audio] example - sound alias
*
* Example originally created with raylib 4.6
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 4.6, last time updated with raylib 4.6
*
* Example contributed by Jeffery Myers (@JeffM2501) 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 Jeffery Myers (@JeffM2501)
* Copyright (c) 2023-2025 Jeffery Myers (@JeffM2501)
*
********************************************************************************************/
@@ -27,18 +31,18 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - playing sound multiple times");
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound alias");
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
// Load audio file into the first slot as the 'source' sound,
// this sound owns the sample data
soundArray[0] = LoadSound("resources/sound.wav");
// Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played
for (int i = 1; i < MAX_SOUNDS; i++) soundArray[i] = LoadSoundAlias(soundArray[0]);
currentSound = 0; // Set the sound list to the start
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -50,14 +54,15 @@ int main(void)
//----------------------------------------------------------------------------------
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;
PlaySound(soundArray[currentSound]); // Play the next open sound slot
currentSound++; // Increment the sound slot
// Note: a better way would be to look at the list for the first sound that is not playing and use that slot
// If the sound slot is out of bounds, go back to 0
if (currentSound >= MAX_SOUNDS) currentSound = 0;
// NOTE: Another approach would be to look at the list for the first sound
// that is not playing and use that slot
}
//----------------------------------------------------------------------------------
// Draw
@@ -74,9 +79,8 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
for (int i = 1; i < MAX_SOUNDS; i++)
UnloadSoundAlias(soundArray[i]); // Unload sound aliases
UnloadSound(soundArray[0]); // Unload source sound data
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

View File

@@ -0,0 +1,128 @@
/*******************************************************************************************
*
* raylib [audio] example - 3d sound positioning
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 5.5, last time updated with raylib 5.5
*
* Example contributed by Le Juez Victor (@Bigfoot71) 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) 2025 Le Juez Victor (@Bigfoot71)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - 3d sound positioning");
InitAudioDevice();
Sound sound = LoadSound("resources/coin.wav");
Camera camera = {
.position = (Vector3) { 0, 5, 5 },
.target = (Vector3) { 0, 0, 0 },
.up = (Vector3) { 0, 1, 0 },
.fovy = 60,
.projection = CAMERA_PERSPECTIVE
};
DisableCursor();
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose())
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_FREE);
float th = GetTime();
Vector3 spherePos = {
.x = 5.0f*cosf(th),
.y = 0.0f,
.z = 5.0f*sinf(th)
};
SetSoundPosition(camera, sound, spherePos, 20.0f);
if (!IsSoundPlaying(sound)) PlaySound(sound);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawGrid(10, 2);
DrawSphere(spherePos, 0.5f, RED);
EndMode3D();
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSound(sound);
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}
//------------------------------------------------------------------------------------
// Module Functions Definition
//------------------------------------------------------------------------------------
// Set sound 3d position
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist)
{
// Calculate direction vector and distance between listener and sound source
Vector3 direction = Vector3Subtract(position, listener.position);
float distance = Vector3Length(direction);
// Apply logarithmic distance attenuation and clamp between 0-1
float attenuation = 1.0f/(1.0f + (distance/maxDist));
attenuation = Clamp(attenuation, 0.0f, 1.0f);
// Calculate normalized vectors for spatial positioning
Vector3 normalizedDirection = Vector3Normalize(direction);
Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position));
Vector3 right = Vector3Normalize(Vector3CrossProduct(listener.up, forward));
// Reduce volume for sounds behind the listener
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
if (dotProduct < 0.0f) attenuation *= (1.0f + dotProduct*0.5f);
// Set stereo panning based on sound position relative to listener
float pan = 0.5f + 0.5f*Vector3DotProduct(normalizedDirection, right);
// Apply final sound properties
SetSoundVolume(sound, attenuation);
SetSoundPan(sound, pan);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [audio] example - Music stream processing effects
* raylib [audio] example - stream effects
*
* Example complexity rating: [★★★★] 4/4
*
* Example originally created with raylib 4.2, last time updated with raylib 5.0
*
* 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) 2022-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2022-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -15,7 +17,9 @@
#include <stdlib.h> // Required for: NULL
// Required delay effect variables
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
static float *delayBuffer = NULL;
static unsigned int delayBufferSize = 0;
static unsigned int delayReadIndex = 2;
@@ -51,7 +55,7 @@ int main(void)
float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f]
bool pause = false; // Music playing paused
bool enableEffectLPF = false; // Enable effect low-pass-filter
bool enableEffectDelay = false; // Enable effect delay (1 second)
@@ -96,7 +100,7 @@ int main(void)
if (enableEffectDelay) AttachAudioStreamProcessor(music.stream, AudioProcessEffectDelay);
else DetachAudioStreamProcessor(music.stream, AudioProcessEffectDelay);
}
// Get normalized time played for current music stream
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music);
@@ -117,7 +121,7 @@ int main(void)
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 230, 20, LIGHTGRAY);
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 260, 20, LIGHTGRAY);
DrawText(TextFormat("PRESS F TO TOGGLE LPF EFFECT: %s", enableEffectLPF? "ON" : "OFF"), 200, 320, 20, GRAY);
DrawText(TextFormat("PRESS D TO TOGGLE DELAY EFFECT: %s", enableEffectDelay? "ON" : "OFF"), 180, 350, 20, GRAY);
@@ -146,8 +150,8 @@ int main(void)
static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
{
static float low[2] = { 0.0f, 0.0f };
static const float cutoff = 70.0f / 44100.0f; // 70 Hz lowpass filter
const float k = cutoff / (cutoff + 0.1591549431f); // RC filter formula
static const float cutoff = 70.0f/44100.0f; // 70 Hz lowpass filter
const float k = cutoff/(cutoff + 0.1591549431f); // RC filter formula
// Converts the buffer data before using it
float *bufferData = (float *)buffer;
@@ -156,8 +160,8 @@ static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
const float l = bufferData[i];
const float r = bufferData[i + 1];
low[0] += k * (l - low[0]);
low[1] += k * (r - low[1]);
low[0] += k*(l - low[0]);
low[1] += k*(r - low[1]);
bufferData[i] = low[0];
bufferData[i + 1] = low[1];
}

View File

@@ -1,110 +0,0 @@
const std = @import("std");
const builtin = @import("builtin");
// This has been tested to work with zig 0.12.0
fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step {
if (target.result.os.tag == .emscripten) {
@panic("Emscripten building via Zig unsupported");
}
const all = b.step(module, "All " ++ module ++ " examples");
var dir = try std.fs.cwd().openDir(module, .{ .iterate = true });
defer if (comptime builtin.zig_version.minor >= 12) dir.close();
var iter = dir.iterate();
while (try iter.next()) |entry| {
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 });
// zig's mingw headers do not include pthread.h
if (std.mem.eql(u8, "core_loading_thread", name) and target.result.os.tag == .windows) continue;
const exe = b.addExecutable(.{
.name = name,
.target = target,
.optimize = optimize,
});
exe.addCSourceFile(.{ .file = b.path(path), .flags = &.{} });
exe.linkLibC();
exe.addObjectFile(switch (target.result.os.tag) {
.windows => b.path("../zig-out/lib/raylib.lib"),
.linux => b.path("../zig-out/lib/libraylib.a"),
.macos => b.path("../zig-out/lib/libraylib.a"),
.emscripten => b.path("../zig-out/lib/libraylib.a"),
else => @panic("Unsupported OS"),
});
exe.addIncludePath(b.path("../src"));
exe.addIncludePath(b.path("../src/external"));
exe.addIncludePath(b.path("../src/external/glfw/include"));
switch (target.result.os.tag) {
.windows => {
exe.linkSystemLibrary("winmm");
exe.linkSystemLibrary("gdi32");
exe.linkSystemLibrary("opengl32");
exe.defineCMacro("PLATFORM_DESKTOP", null);
},
.linux => {
exe.linkSystemLibrary("GL");
exe.linkSystemLibrary("rt");
exe.linkSystemLibrary("dl");
exe.linkSystemLibrary("m");
exe.linkSystemLibrary("X11");
exe.defineCMacro("PLATFORM_DESKTOP", null);
},
.macos => {
exe.linkFramework("Foundation");
exe.linkFramework("Cocoa");
exe.linkFramework("OpenGL");
exe.linkFramework("CoreAudio");
exe.linkFramework("CoreVideo");
exe.linkFramework("IOKit");
exe.defineCMacro("PLATFORM_DESKTOP", null);
},
else => {
@panic("Unsupported OS");
},
}
const install_cmd = b.addInstallArtifact(exe, .{});
const run_cmd = b.addRunArtifact(exe);
run_cmd.cwd = b.path(module);
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;
}
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 all = b.getInstallStep();
all.dependOn(try add_module("audio", b, target, optimize));
all.dependOn(try add_module("core", b, target, optimize));
all.dependOn(try add_module("models", b, target, optimize));
all.dependOn(try add_module("others", b, target, optimize));
all.dependOn(try add_module("shaders", b, target, optimize));
all.dependOn(try add_module("shapes", b, target, optimize));
all.dependOn(try add_module("text", b, target, optimize));
all.dependOn(try add_module("textures", b, target, optimize));
}

View File

@@ -0,0 +1,44 @@
::@echo off
:: .
:: Compile your examples for web using: build_example_web.bat <example_category>/<example_name>
:: .
SET "INPUT_FILE=%1"
:: Change delimiter for the FOR loop
FOR /f "tokens=1-10 delims=/" %%a IN ("%INPUT_FILE%") DO (
SET CATEGORY=%%a
SET FILENAME=%%b
)
:: > SETup required Environment
:: -------------------------------------
SET RAYLIB_PATH=C:\GitHub\raylib
SET EMSDK_PATH=C:\raylib\emsdk
SET COMPILER_PATH=C:\raylib\w64devkit\bin
ENV_SET PATH=%COMPILER_PATH%
SET MAKE=mingw32-make
echo
:: Set required web compilation options
:: -------------------------------------
::SET CC=%EMSDK_PATH%\upstream\emscripten\emcc
::SET CFLAGS=-Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result -O3 -I. -Iexternal -I%RAYLIB_PATH%\src -I%RAYLIB_PATH%\external -DPLATFORM_WEB
::SET LDFLAGS=-L. -L$(RAYLIB_PATH)\src -sUSE_GLFW=3 -sEXPORTED_RUNTIME_METHODS=ccall -sASYNCIFY --shell-file %RAYLIB_PATH%\src\shell.html
::SET LDLIBS=%RAYLIB_PATH%\src\libraylib.web.a
echo
:: Clean latest build
:: ------------------------
cmd /c if exist %FILENAME%.html del /F %FILENAME%.html
cmd /c if exist %FILENAME%.wasm del /F %FILENAME%.wasm
cmd /c if exist %FILENAME%.js del /F %FILENAME%.js
cmd /c if exist %FILENAME%.data del /F %FILENAME%.data
echo
:: Setup emsdk environment
:: --------------------------
call %EMSDK_PATH%\emsdk_env.bat
echo on
:: Compile program
:: -----------------------
C:
cd %RAYLIB_PATH%\examples
%MAKE% -f Makefile.Web %CATEGORY%/%FILENAME% PLATFORM=PLATFORM_WEB -B
::%CC% -o %FILENAME%.html %FILENAME%.c %CFLAGS% %LDFLAGS% %LDLIBS% %RESOURCES%
cd ..
echo

View File

@@ -1,17 +1,20 @@
/*******************************************************************************************
*
* raylib [core] example - 2D Camera system
* raylib [core] example - 2d camera
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.5, last time updated with raylib 3.0
*
* 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) 2016-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2016-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <math.h>
#define MAX_BUILDINGS 100
@@ -42,7 +45,11 @@ int main(void)
spacing += (int)buildings[i].width;
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
buildColors[i] = (Color){
(unsigned char)GetRandomValue(200, 240),
(unsigned char)GetRandomValue(200, 240),
(unsigned char)GetRandomValue(200, 250),
255};
}
Camera2D camera = { 0 };
@@ -75,7 +82,8 @@ int main(void)
else if (camera.rotation < -40) camera.rotation = -40;
// Camera zoom controls
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
// Uses log scaling to provide consistent zoom speed
camera.zoom = expf(logf(camera.zoom) + ((float)GetMouseWheelMove()*0.1f));
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
else if (camera.zoom < 0.1f) camera.zoom = 0.1f;

View File

@@ -2,12 +2,16 @@
*
* raylib [core] example - 2d camera mouse zoom
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 4.2, last time updated with raylib 4.2
*
* Example contributed by Jeffery Myers (@JeffM2501) 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) 2022-2024 Jeffery Myers (@JeffM2501)
* Copyright (c) 2022-2025 Jeffery Myers (@JeffM2501)
*
********************************************************************************************/
@@ -43,7 +47,7 @@ int main ()
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_ONE)) zoomMode = 0;
else if (IsKeyPressed(KEY_TWO)) zoomMode = 1;
// Translate based on mouse right click
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
{
@@ -64,14 +68,14 @@ int main ()
// Set the offset to where the mouse is
camera.offset = GetMousePosition();
// Set the target to match, so that the camera maps the world space point
// Set the target to match, so that the camera maps the world space point
// under the cursor to the screen space point under the cursor at any zoom
camera.target = mouseWorldPos;
// Zoom increment
float scaleFactor = 1.0f + (0.25f*fabsf(wheel));
if (wheel < 0) scaleFactor = 1.0f/scaleFactor;
camera.zoom = Clamp(camera.zoom*scaleFactor, 0.125f, 64.0f);
// Uses log scaling to provide consistent zoom speed
float scale = 0.2f*wheel;
camera.zoom = Clamp(expf(logf(camera.zoom)+scale), 0.125f, 64.0f);
}
}
else
@@ -85,17 +89,17 @@ int main ()
// Set the offset to where the mouse is
camera.offset = GetMousePosition();
// Set the target to match, so that the camera maps the world space point
// Set the target to match, so that the camera maps the world space point
// under the cursor to the screen space point under the cursor at any zoom
camera.target = mouseWorldPos;
}
if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
{
// Zoom increment
// Uses log scaling to provide consistent zoom speed
float deltaX = GetMouseDelta().x;
float scaleFactor = 1.0f + (0.01f*fabsf(deltaX));
if (deltaX < 0) scaleFactor = 1.0f/scaleFactor;
camera.zoom = Clamp(camera.zoom*scaleFactor, 0.125f, 64.0f);
float scale = 0.005f*deltaX;
camera.zoom = Clamp(expf(logf(camera.zoom)+scale), 0.125f, 64.0f);
}
}
//----------------------------------------------------------------------------------
@@ -107,7 +111,7 @@ int main ()
BeginMode2D(camera);
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
// just so we have something in the XY plane
rlPushMatrix();
rlTranslatef(0, 25*50, 0);
@@ -117,19 +121,19 @@ int main ()
// Draw a reference circle
DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON);
EndMode2D();
// Draw mouse reference
//Vector2 mousePos = GetWorldToScreen2D(GetMousePosition(), camera)
DrawCircleV(GetMousePosition(), 4, DARKGRAY);
DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()),
DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()),
Vector2Add(GetMousePosition(), (Vector2){ -44, -24 }), 20, 2, BLACK);
DrawText("[1][2] Select mouse zoom mode (Wheel or Move)", 20, 20, 20, DARKGRAY);
if (zoomMode == 0) DrawText("Mouse left button drag to move, mouse wheel to zoom", 20, 50, 20, DARKGRAY);
else DrawText("Mouse left button drag to move, mouse press and move to zoom", 20, 50, 20, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -139,4 +143,4 @@ int main ()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - 2D Camera platformer
* raylib [core] example - 2d camera platformer
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 2.5, last time updated with raylib 3.0
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2019-2024 arvyy (@arvyy)
* Copyright (c) 2019-2025 arvyy (@arvyy)
*
********************************************************************************************/
@@ -20,6 +22,9 @@
#define PLAYER_JUMP_SPD 350.0f
#define PLAYER_HOR_SPD 200.0f
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef struct Player {
Vector2 position;
float speed;
@@ -33,7 +38,7 @@ typedef struct EnvItem {
} EnvItem;
//----------------------------------------------------------------------------------
// Module functions declaration
// Module Functions Declaration
//----------------------------------------------------------------------------------
void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float delta);
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);
@@ -52,7 +57,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera platformer");
Player player = { 0 };
player.position = (Vector2){ 400, 280 };
@@ -135,7 +140,7 @@ int main(void)
Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40.0f, 40.0f };
DrawRectangleRec(playerRect, RED);
DrawCircleV(player.position, 5.0f, GOLD);
EndMode2D();
@@ -292,7 +297,7 @@ void UpdateCameraPlayerBoundsPush(Camera2D *camera, Player *player, EnvItem *env
Vector2 bboxWorldMin = GetScreenToWorld2D((Vector2){ (1 - bbox.x)*0.5f*width, (1 - bbox.y)*0.5f*height }, *camera);
Vector2 bboxWorldMax = GetScreenToWorld2D((Vector2){ (1 + bbox.x)*0.5f*width, (1 + bbox.y)*0.5f*height }, *camera);
camera->offset = (Vector2){ (1 - bbox.x)*0.5f * width, (1 - bbox.y)*0.5f*height };
camera->offset = (Vector2){ (1 - bbox.x)*0.5f*width, (1 - bbox.y)*0.5f*height };
if (player->position.x < bboxWorldMin.x) camera->target.x = player->position.x;
if (player->position.y < bboxWorldMin.y) camera->target.y = player->position.y;

View File

@@ -2,7 +2,9 @@
*
* raylib [core] example - 2d camera split screen
*
* Addapted from the core_3d_camera_split_screen example:
* Example complexity rating: [★★★★] 4/4
*
* 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
@@ -12,7 +14,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2023 Gabriel dos Santos Sanches (@gabrielssanches)
* Copyright (c) 2023-2025 Gabriel dos Santos Sanches (@gabrielssanches)
*
********************************************************************************************/
@@ -79,9 +81,9 @@ int main(void)
//----------------------------------------------------------------------------------
BeginTextureMode(screenCamera1);
ClearBackground(RAYWHITE);
BeginMode2D(camera1);
// Draw full scene with first camera
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
{
@@ -104,17 +106,17 @@ int main(void)
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++)
{
@@ -136,21 +138,21 @@ int main(void)
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();
}

View File

@@ -2,12 +2,14 @@
*
* raylib [core] example - 3d camera first person
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.3, last time updated with raylib 1.3
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -98,8 +100,8 @@ int main(void)
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.projection = CAMERA_ORTHOGRAPHIC;
camera.fovy = 20.0f; // near plane width in CAMERA_ORTHOGRAPHIC
CameraYaw(&camera, -135 * DEG2RAD, true);
CameraPitch(&camera, -45 * DEG2RAD, true, true, false);
CameraYaw(&camera, -135*DEG2RAD, true);
CameraPitch(&camera, -45*DEG2RAD, true, true, false);
}
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
{
@@ -115,7 +117,7 @@ int main(void)
// Update camera computes movement internally depending on the camera mode
// Some default standard keyboard/mouse inputs are hardcoded to simplify use
// For advance camera controls, it's reecommended to compute camera movement manually
// For advanced camera controls, it's recommended to compute camera movement manually
UpdateCamera(&camera, cameraMode); // Update camera
/*
@@ -125,7 +127,7 @@ int main(void)
UpdateCameraPro(&camera,
(Vector3){
(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f - // Move forward-backward
(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT))*0.1f - // Move right-left
(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT))*0.1f,
0.0f // Move up-down
@@ -203,4 +205,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View File

@@ -0,0 +1,330 @@
/*******************************************************************************************
*
* raylib [core] example - 3d first-person camera controller
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 5.5, last time updated with raylib 5.5
*
* Example contributed by Agnis Aldins (@nezvers) 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) 2025-2025 Agnis Aldins (@nezvers)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
// Movement constants
#define GRAVITY 32.0f
#define MAX_SPEED 20.0f
#define CROUCH_SPEED 5.0f
#define JUMP_FORCE 12.0f
#define MAX_ACCEL 150.0f
// Grounded drag
#define FRICTION 0.86f
// Increasing air drag, increases strafing speed
#define AIR_DRAG 0.98f
// Responsiveness for turning movement direction to looked direction
#define CONTROL 15.0f
#define CROUCH_HEIGHT 0.0f
#define STAND_HEIGHT 1.0f
#define BOTTOM_HEIGHT 0.5f
#define NORMALIZE_INPUT 0
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
// Body structure
typedef struct {
Vector3 position;
Vector3 velocity;
Vector3 dir;
bool isGrounded;
} Body;
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
static Vector2 sensitivity = { 0.001f, 0.001f };
static Body player = { 0 };
static Vector2 lookRotation = { 0 };
static float headTimer = 0.0f;
static float walkLerp = 0.0f;
static float headLerp = STAND_HEIGHT;
static Vector2 lean = { 0 };
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
static void DrawLevel(void);
static void UpdateCameraFPS(Camera *camera);
static void UpdateBody(Body *body, float rot, char side, char forward, bool jumpPressed, bool crouchHold);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d first-person camera controller");
// Initialize camera variables
// NOTE: UpdateCameraFPS() takes care of the rest
Camera camera = { 0 };
camera.fovy = 60.0f;
camera.projection = CAMERA_PERSPECTIVE;
camera.position = (Vector3){
player.position.x,
player.position.y + (BOTTOM_HEIGHT + headLerp),
player.position.z,
};
UpdateCameraFPS(&camera); // Update camera parameters
DisableCursor(); // Limit cursor to relative movement inside the window
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
//----------------------------------------------------------------------------------
Vector2 mouseDelta = GetMouseDelta();
lookRotation.x -= mouseDelta.x*sensitivity.x;
lookRotation.y += mouseDelta.y*sensitivity.y;
char sideway = (IsKeyDown(KEY_D) - IsKeyDown(KEY_A));
char forward = (IsKeyDown(KEY_W) - IsKeyDown(KEY_S));
bool crouching = IsKeyDown(KEY_LEFT_CONTROL);
UpdateBody(&player, lookRotation.x, sideway, forward, IsKeyPressed(KEY_SPACE), crouching);
float delta = GetFrameTime();
headLerp = Lerp(headLerp, (crouching ? CROUCH_HEIGHT : STAND_HEIGHT), 20.0f*delta);
camera.position = (Vector3){
player.position.x,
player.position.y + (BOTTOM_HEIGHT + headLerp),
player.position.z,
};
if (player.isGrounded && ((forward != 0) || (sideway != 0)))
{
headTimer += delta*3.0f;
walkLerp = Lerp(walkLerp, 1.0f, 10.0f*delta);
camera.fovy = Lerp(camera.fovy, 55.0f, 5.0f*delta);
}
else
{
walkLerp = Lerp(walkLerp, 0.0f, 10.0f*delta);
camera.fovy = Lerp(camera.fovy, 60.0f, 5.0f*delta);
}
lean.x = Lerp(lean.x, sideway*0.02f, 10.0f*delta);
lean.y = Lerp(lean.y, forward*0.015f, 10.0f*delta);
UpdateCameraFPS(&camera);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawLevel();
EndMode3D();
// Draw info box
DrawRectangle(5, 5, 330, 75, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(5, 5, 330, 75, BLUE);
DrawText("Camera controls:", 15, 15, 10, BLACK);
DrawText("- Move keys: W, A, S, D, Space, Left-Ctrl", 15, 30, 10, BLACK);
DrawText("- Look around: arrow keys or mouse", 15, 45, 10, BLACK);
DrawText(TextFormat("- Velocity Len: (%06.3f)", Vector2Length((Vector2){ player.velocity.x, player.velocity.z })), 15, 60, 10, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
// Update body considering current world state
void UpdateBody(Body *body, float rot, char side, char forward, bool jumpPressed, bool crouchHold)
{
Vector2 input = (Vector2){ (float)side, (float)-forward };
#if defined(NORMALIZE_INPUT)
// Slow down diagonal movement
if ((side != 0) && (forward != 0)) input = Vector2Normalize(input);
#endif
float delta = GetFrameTime();
if (!body->isGrounded) body->velocity.y -= GRAVITY*delta;
if (body->isGrounded && jumpPressed)
{
body->velocity.y = JUMP_FORCE;
body->isGrounded = false;
// Sound can be played at this moment
//SetSoundPitch(fxJump, 1.0f + (GetRandomValue(-100, 100)*0.001));
//PlaySound(fxJump);
}
Vector3 front = (Vector3){ sin(rot), 0.f, cos(rot) };
Vector3 right = (Vector3){ cos(-rot), 0.f, sin(-rot) };
Vector3 desiredDir = (Vector3){ input.x*right.x + input.y*front.x, 0.0f, input.x*right.z + input.y*front.z, };
body->dir = Vector3Lerp(body->dir, desiredDir, CONTROL*delta);
float decel = (body->isGrounded ? FRICTION : AIR_DRAG);
Vector3 hvel = (Vector3){ body->velocity.x*decel, 0.0f, body->velocity.z*decel };
float hvelLength = Vector3Length(hvel); // Magnitude
if (hvelLength < (MAX_SPEED*0.01f)) hvel = (Vector3){ 0 };
// This is what creates strafing
float speed = Vector3DotProduct(hvel, body->dir);
// Whenever the amount of acceleration to add is clamped by the maximum acceleration constant,
// a Player can make the speed faster by bringing the direction closer to horizontal velocity angle
// More info here: https://youtu.be/v3zT3Z5apaM?t=165
float maxSpeed = (crouchHold? CROUCH_SPEED : MAX_SPEED);
float accel = Clamp(maxSpeed - speed, 0.f, MAX_ACCEL*delta);
hvel.x += body->dir.x*accel;
hvel.z += body->dir.z*accel;
body->velocity.x = hvel.x;
body->velocity.z = hvel.z;
body->position.x += body->velocity.x*delta;
body->position.y += body->velocity.y*delta;
body->position.z += body->velocity.z*delta;
// Fancy collision system against the floor
if (body->position.y <= 0.0f)
{
body->position.y = 0.0f;
body->velocity.y = 0.0f;
body->isGrounded = true; // Enable jumping
}
}
// Update camera for FPS behaviour
static void UpdateCameraFPS(Camera *camera)
{
const Vector3 up = (Vector3){ 0.0f, 1.0f, 0.0f };
const Vector3 targetOffset = (Vector3){ 0.0f, 0.0f, -1.0f };
// Left and right
Vector3 yaw = Vector3RotateByAxisAngle(targetOffset, up, lookRotation.x);
// Clamp view up
float maxAngleUp = Vector3Angle(up, yaw);
maxAngleUp -= 0.001f; // Avoid numerical errors
if ( -(lookRotation.y) > maxAngleUp) { lookRotation.y = -maxAngleUp; }
// Clamp view down
float maxAngleDown = Vector3Angle(Vector3Negate(up), yaw);
maxAngleDown *= -1.0f; // Downwards angle is negative
maxAngleDown += 0.001f; // Avoid numerical errors
if ( -(lookRotation.y) < maxAngleDown) { lookRotation.y = -maxAngleDown; }
// Up and down
Vector3 right = Vector3Normalize(Vector3CrossProduct(yaw, up));
// Rotate view vector around right axis
float pitchAngle = -lookRotation.y -
lean.y;
pitchAngle = Clamp(pitchAngle, -PI/2 + 0.0001f, PI/2 - 0.0001f); // Clamp angle so it doesn't go past straight up or straight down
Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, pitchAngle);
// Head animation
// Rotate up direction around forward axis
float headSin = sin(headTimer*PI);
float headCos = cos(headTimer*PI);
const float stepRotation = 0.01f;
camera->up = Vector3RotateByAxisAngle(up, pitch, headSin*stepRotation + lean.x);
// Camera BOB
const float bobSide = 0.1f;
const float bobUp = 0.15f;
Vector3 bobbing = Vector3Scale(right, headSin*bobSide);
bobbing.y = fabsf(headCos*bobUp);
camera->position = Vector3Add(camera->position, Vector3Scale(bobbing, walkLerp));
camera->target = Vector3Add(camera->position, pitch);
}
// Draw game level
static void DrawLevel(void)
{
const int floorExtent = 25;
const float tileSize = 5.0f;
const Color tileColor1 = (Color){ 150, 200, 200, 255 };
// Floor tiles
for (int y = -floorExtent; y < floorExtent; y++)
{
for (int x = -floorExtent; x < floorExtent; x++)
{
if ((y & 1) && (x & 1))
{
DrawPlane((Vector3){ x*tileSize, 0.0f, y*tileSize}, (Vector2){ tileSize, tileSize }, tileColor1);
}
else if (!(y & 1) && !(x & 1))
{
DrawPlane((Vector3){ x*tileSize, 0.0f, y*tileSize}, (Vector2){ tileSize, tileSize }, LIGHTGRAY);
}
}
}
const Vector3 towerSize = (Vector3){ 16.0f, 32.0f, 16.0f };
const Color towerColor = (Color){ 150, 200, 200, 255 };
Vector3 towerPos = (Vector3){ 16.0f, 16.0f, 16.0f };
DrawCubeV(towerPos, towerSize, towerColor);
DrawCubeWiresV(towerPos, towerSize, DARKBLUE);
towerPos.x *= -1;
DrawCubeV(towerPos, towerSize, towerColor);
DrawCubeWiresV(towerPos, towerSize, DARKBLUE);
towerPos.z *= -1;
DrawCubeV(towerPos, towerSize, towerColor);
DrawCubeWiresV(towerPos, towerSize, DARKBLUE);
towerPos.x *= -1;
DrawCubeV(towerPos, towerSize, towerColor);
DrawCubeWiresV(towerPos, towerSize, DARKBLUE);
// Red sun
DrawSphere((Vector3){ 300.0f, 300.0f, 0.0f }, 100.0f, (Color){ 255, 0, 0, 255 });
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Initialize 3d camera free
* raylib [core] example - 3d camera free
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.3, last time updated with raylib 1.3
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Initialize 3d camera mode
* raylib [core] example - 3d camera mode
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.0, last time updated with raylib 1.0
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - 3d cmaera split screen
* raylib [core] example - 3d camera split screen
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 3.7, last time updated with raylib 4.0
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2021-2024 Jeffery Myers (@JeffM2501)
* Copyright (c) 2021-2025 Jeffery Myers (@JeffM2501)
*
********************************************************************************************/
@@ -45,11 +47,11 @@ int main(void)
cameraPlayer2.position.x = -3.0f;
cameraPlayer2.position.y = 3.0f;
RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth / 2, screenHeight);
RenderTexture screenPlayer2 = 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)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
// Grid data
int count = 5;
float spacing = 4;
@@ -63,7 +65,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
// If anyone moves this frame, how far will they move based on the time since the last frame
// this moves thigns at 10 world units per second, regardless of the actual FPS
// this moves things at 10 world units per second, regardless of the actual FPS
float offsetThisFrame = 10.0f*GetFrameTime();
// Move Player1 forward and backwards (no turning)
@@ -96,9 +98,9 @@ int main(void)
// Draw Player1 view to the render texture
BeginTextureMode(screenPlayer1);
ClearBackground(SKYBLUE);
BeginMode3D(cameraPlayer1);
// 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
@@ -114,20 +116,20 @@ int main(void)
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
EndMode3D();
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);
// 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
@@ -143,21 +145,21 @@ int main(void)
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
EndMode3D();
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();
}
@@ -171,4 +173,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Picking in 3d mode
* raylib [core] example - 3d picking
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.3, last time updated with raylib 4.0
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -99,7 +101,7 @@ int main(void)
DrawText("Try clicking on the box with your mouse!", 240, 10, 20, DARKGRAY);
if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30))/2, (int)(screenHeight*0.1f), 30, GREEN);
DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);

View File

@@ -2,6 +2,8 @@
*
* raylib [core] example - automation events
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 5.0, last time updated with raylib 5.0
*
* Example based on 2d_camera_platformer example by arvyy (@arvyy)
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2023 Ramon Santamaria (@raysan5)
* Copyright (c) 2023-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -22,6 +24,9 @@
#define MAX_ENVIRONMENT_ELEMENTS 5
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef struct Player {
Vector2 position;
float speed;
@@ -34,7 +39,6 @@ typedef struct EnvElement {
Color color;
} EnvElement;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -52,7 +56,7 @@ int main(void)
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 },
@@ -68,13 +72,13 @@ int main(void)
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;
@@ -88,7 +92,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
float deltaTime = 0.015f;//GetFrameTime();
// Dropped files logic
//----------------------------------------------------------------------------------
if (IsFileDropped())
@@ -100,14 +104,14 @@ int main(void)
{
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;
@@ -172,7 +176,7 @@ int main(void)
//----------------------------------------------------------------------------------
// Events playing
// NOTE: Logic must be before Camera update because it depends on mouse-wheel value,
// NOTE: Logic must be before Camera update because it depends on mouse-wheel value,
// that can be set by the played event... but some other inputs could be affected
//----------------------------------------------------------------------------------
if (eventPlaying)
@@ -226,7 +230,7 @@ int main(void)
if (min.x > 0) camera.offset.x = screenWidth/2 - min.x;
if (min.y > 0) camera.offset.y = screenHeight/2 - min.y;
//----------------------------------------------------------------------------------
// Events management
if (IsKeyPressed(KEY_S)) // Toggle events recording
{
@@ -236,12 +240,12 @@ int main(void)
{
StopAutomationEventRecording();
eventRecording = false;
ExportAutomationEventList(aelist, "automation.rae");
TraceLog(LOG_INFO, "RECORDED FRAMES: %i", aelist.count);
}
else
else
{
SetAutomationEventBaseFrame(180);
StartAutomationEventRecording();
@@ -291,7 +295,7 @@ int main(void)
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));
@@ -321,7 +325,7 @@ int main(void)
if (((frameCounter/15)%2) == 1) DrawText(TextFormat("PLAYING RECORDED EVENTS... [%i]", currentPlayFrame), 50, 170, 10, DARKGREEN);
}
EndDrawing();
//----------------------------------------------------------------------------------

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] examples - basic screen manager
* raylib [core] example - basic screen manager
*
* Example complexity rating: [★☆☆☆] 1/4
*
* NOTE: This example illustrates a very simple screen manager based on a states machines
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2021-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2021-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -46,7 +48,7 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
switch(currentScreen)
switch (currentScreen)
{
case LOGO:
{

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Basic window
* raylib [core] example - basic window
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Welcome to raylib!
*
@@ -20,7 +22,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,87 +0,0 @@
/*******************************************************************************************
*
* raylib [core] example - Basic window (adapted for HTML5 platform)
*
* 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
*
* Example originally created with raylib 1.3, last time updated with raylib 1.3
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
//#define PLATFORM_WEB
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
//----------------------------------------------------------------------------------
// Module functions declaration
//----------------------------------------------------------------------------------
void UpdateDrawFrame(void); // Update and Draw one frame
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
UpdateDrawFrame();
}
#endif
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
void UpdateDrawFrame(void)
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}

View File

@@ -2,6 +2,8 @@
*
* raylib [core] example - custom frame control
*
* Example complexity rating: [★★★★] 4/4
*
* NOTE: WARNING: This is an example for advanced users willing to have full control over
* the frame processes. By default, EndDrawing() calls the following processes:
* 1. Draw remaining batch data: rlDrawRenderBatchActive()
@@ -10,7 +12,7 @@
* 4. PollInputEvents()
*
* To avoid steps 2, 3 and 4, flag SUPPORT_CUSTOM_FRAME_CONTROL can be enabled in
* config.h (it requires recompiling raylib). This way those steps are up to the user.
* config.h (it requires recompiling raylib). This way those steps are up to the user
*
* Note that enabling this flag invalidates some functions:
* - GetFrameTime()
@@ -22,7 +24,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2021-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2021-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -37,7 +39,7 @@ int main(void)
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control");
// Custom timming variables
@@ -46,11 +48,11 @@ int main(void)
double updateDrawTime = 0.0; // Update + Draw time
double waitTime = 0.0; // Wait time (if target fps required)
float deltaTime = 0.0f; // Frame time (Update + Draw + Wait time)
float timeCounter = 0.0f; // Accumulative time counter (seconds)
float position = 0.0f; // Circle position
bool pause = false; // Pause control flag
int targetFPS = 60; // Our initial target fps
//--------------------------------------------------------------------------------------
@@ -59,13 +61,15 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
#ifndef PLATFORM_WEB // NOTE: On non web platforms the PollInputEvents just works before the inputs checks
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
#endif
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
else if (IsKeyPressed(KEY_DOWN)) targetFPS -= 20;
if (targetFPS < 0) targetFPS = 0;
if (!pause)
@@ -74,6 +78,10 @@ int main(void)
if (position >= GetScreenWidth()) position = 0;
timeCounter += deltaTime; // We count time (seconds)
}
#ifdef PLATFORM_WEB // NOTE: On web platform for some reason the PollInputEvents only works after the inputs check, so just call it after check all your inputs (on web)
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
#endif
//----------------------------------------------------------------------------------
// Draw
@@ -83,32 +91,35 @@ int main(void)
ClearBackground(RAYWHITE);
for (int i = 0; i < GetScreenWidth()/200; i++) DrawRectangle(200*i, 0, 1, GetScreenHeight(), SKYBLUE);
DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED);
DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), (int)position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
DrawText(TextFormat("PosX: %03.0f", position), (int)position - 50, GetScreenHeight()/2 + 40, 20, BLACK);
DrawText("Circle is moving at a constant 200 pixels/sec,\nindependently of the frame rate.", 10, 10, 20, DARKGRAY);
DrawText("PRESS SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY);
DrawText("PRESS UP | DOWN to CHANGE TARGET FPS", 10, GetScreenHeight() - 30, 20, GRAY);
DrawText(TextFormat("TARGET FPS: %i", targetFPS), GetScreenWidth() - 220, 10, 20, LIME);
DrawText(TextFormat("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
if (deltaTime != 0)
{
DrawText(TextFormat("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
}
EndDrawing();
// NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL,
// NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL,
// Events polling, screen buffer swap and frame time control must be managed by the user
SwapScreenBuffer(); // Flip the back buffer to screen (front buffer)
currentTime = GetTime();
updateDrawTime = currentTime - previousTime;
if (targetFPS > 0) // We want a fixed frame rate
{
waitTime = (1.0f/(float)targetFPS) - updateDrawTime;
if (waitTime > 0.0)
if (waitTime > 0.0)
{
WaitTime((float)waitTime);
currentTime = GetTime();

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Custom logging
* raylib [core] example - custom logging
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 2.5, last time updated with raylib 2.5
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2018-2024 Pablo Marcos Oltra (@pamarcos) and Ramon Santamaria (@raysan5)
* Copyright (c) 2018-2025 Pablo Marcos Oltra (@pamarcos) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Windows drop files
* raylib [core] example - drop files
*
* Example complexity rating: [★★☆☆] 2/4
*
* NOTE: This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -0,0 +1,134 @@
/*******************************************************************************************
*
* raylib [core] example - high dpi
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 5.0, last time updated with raylib 5.5
*
* Example contributed by Jonathan Marler (@marler8997) 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) 2025 Jonathan Marler (@marler8997)
*
********************************************************************************************/
#include "raylib.h"
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "raylib [core] example - high dpi");
SetWindowMinSize(450, 450);
int logicalGridDescY = 120;
int logicalGridLabelY = logicalGridDescY + 30;
int logicalGridTop = logicalGridLabelY + 30;
int logicalGridBottom = logicalGridTop + 80;
int pixelGridTop = logicalGridBottom - 20;
int pixelGridBottom = pixelGridTop + 80;
int pixelGridLabelY = pixelGridBottom + 30;
int pixelGridDescY = pixelGridLabelY + 30;
int cellSize = 50;
float cellSizePx = (float)cellSize;
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
//----------------------------------------------------------------------------------
int monitorCount = GetMonitorCount();
if ((monitorCount > 1) && IsKeyPressed(KEY_N))
{
SetWindowMonitor((GetCurrentMonitor() + 1)%monitorCount);
}
int currentMonitor = GetCurrentMonitor();
Vector2 dpiScale = GetWindowScaleDPI();
cellSizePx = ((float)cellSize)/dpiScale.x;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
int windowCenter = GetScreenWidth()/2;
DrawTextCenter(TextFormat("Dpi Scale: %f", dpiScale.x), windowCenter, 30, 40, DARKGRAY);
DrawTextCenter(TextFormat("Monitor: %d/%d ([N] next monitor)", currentMonitor+1, monitorCount), windowCenter, 70, 20, LIGHTGRAY);
DrawTextCenter(TextFormat("Window is %d \"logical points\" wide", GetScreenWidth()), windowCenter, logicalGridDescY, 20, ORANGE);
bool odd = true;
for (int i = cellSize; i < GetScreenWidth(); i += cellSize, odd = !odd)
{
if (odd) DrawRectangle(i, logicalGridTop, cellSize, logicalGridBottom-logicalGridTop, ORANGE);
DrawTextCenter(TextFormat("%d", i), i, logicalGridLabelY, 10, LIGHTGRAY);
DrawLine(i, logicalGridLabelY + 10, i, logicalGridBottom, GRAY);
}
odd = true;
const int minTextSpace = 30;
int lastTextX = -minTextSpace;
for (int i = cellSize; i < GetRenderWidth(); i += cellSize, odd = !odd)
{
int x = (int)(((float)i)/dpiScale.x);
if (odd) DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom - pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 });
DrawLine(x, pixelGridTop, (int)(((float)i)/dpiScale.x), pixelGridLabelY - 10, GRAY);
if ((x - lastTextX) >= minTextSpace)
{
DrawTextCenter(TextFormat("%d", i), x, pixelGridLabelY, 10, LIGHTGRAY);
lastTextX = x;
}
}
DrawTextCenter(TextFormat("Window is %d \"physical pixels\" wide", GetRenderWidth()), windowCenter, pixelGridDescY, 20, BLUE);
const char *text = "Can you see this?";
Vector2 size = MeasureTextEx(GetFontDefault(), text, 20, 3);
Vector2 pos = (Vector2){ GetScreenWidth() - size.x - 5, GetScreenHeight() - size.y - 5 };
DrawTextEx(GetFontDefault(), text, pos, 20, 3, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//------------------------------------------------------------------------------------
// Module Functions Definition
//------------------------------------------------------------------------------------
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color)
{
Vector2 size = MeasureTextEx(GetFontDefault(), text, (float)fontSize, 3);
Vector2 pos = (Vector2){ x - size.x/2, y - size.y/2 };
DrawTextEx(GetFontDefault(), text, pos, (float)fontSize, 3, color);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Gamepad input
* raylib [core] example - gamepad input
*
* Example complexity rating: [★☆☆☆] 1/4
*
* NOTE: This example requires a Gamepad connected to the system
* raylib is configured to work with the following gamepads:
@@ -13,7 +15,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -254,11 +256,11 @@ int main(void)
}
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(0)), 10, 50, 10, MAROON);
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(gamepad)), 10, 50, 10, MAROON);
for (int i = 0; i < GetGamepadAxisCount(0); i++)
for (int i = 0; i < GetGamepadAxisCount(gamepad); i++)
{
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(0, i)), 20, 70 + 20*i, 10, DARKGRAY);
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(gamepad, i)), 20, 70 + 20*i, 10, DARKGRAY);
}
if (GetGamepadButtonPressed() != GAMEPAD_BUTTON_UNKNOWN) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);

View File

@@ -1,83 +0,0 @@
/*******************************************************************************************
*
* 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-2024 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 = 5; i < 4; i++) // MAX_GAMEPADS = 4
{
if (IsGamepadAvailable(i))
{
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 10, BLACK);
y += 11;
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 10, BLACK);
y += 11;
for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
{
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 10, BLACK);
y += 11;
}
for (int button = 0; button < 32; button++)
{
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 10, BLACK);
y += 11;
}
}
}
DrawFPS(GetScreenWidth() - 100, 100);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Input Gestures Detection
* raylib [core] example - input gestures
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.4, last time updated with raylib 4.2
*
* 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) 2016-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2016-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,105 +1,113 @@
/*******************************************************************************************
*
* raylib [core] example - Input Gestures for Web
* raylib [core] example - input gestures testbed
*
* Example originally created with raylib 4.6-dev, last time updated with raylib 4.6-dev
* Example complexity rating: [] 3/4
*
* Example originally created with raylib 4.6-dev, last time updated with raylib 5.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)
* Copyright (c) 2023-2025 ubkp (@ubkp)
*
********************************************************************************************/
#include "raylib.h"
#include "math.h" // Required for the protractor angle graphic drawing
#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
//--------------------------------------------------------------------------------------
#define GESTURE_LOG_SIZE 20
#define MAX_TOUCH_COUNT 32
// Common variables definitions
//--------------------------------------------------------------------------------------
int screenWidth = 800; // Update depending on web canvas
const int screenHeight = 450;
Vector2 messagePosition = { 160, 7 };
// Global Variables Definition
//--------------------------------------------------------------------------------------
static int screenWidth = 800; // Update depending on web canvas
static const int screenHeight = 450;
static Vector2 messagePosition = { 160, 7 };
// Last gesture variables definitions
//--------------------------------------------------------------------------------------
int lastGesture = 0;
Vector2 lastGesturePosition = { 165, 130 };
static int lastGesture = 0;
static 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;
// Gesture log variables definitions
// NOTE: The gesture log uses an array (as an inverted circular queue) to store the performed gestures
static char gestureLog[GESTURE_LOG_SIZE][12] = { "" };
// NOTE: The index for the inverted circular queue (moving from last to first direction, then looping around)
static int gestureLogIndex = GESTURE_LOG_SIZE;
static 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;
}
}
// 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
static int logMode = 1;
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 };
static Color gestureColor = { 0, 0, 0, 255 };
static Rectangle logButton1 = { 53, 7, 48, 26 };
static Rectangle logButton2 = { 108, 7, 36, 26 };
static 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 };
static float angleLength = 90.0f;
static float currentAngleDegrees = 0.0f;
static Vector2 finalVector = { 0.0f, 0.0f };
static char currentAngleStr[7] = "";
static Vector2 protractorPosition = { 266.0f, 315.0f };
// Update
//--------------------------------------------------------------------------------------
void Update(void)
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
static void UpdateDrawFrame(void); // Update and Draw one frame
static char const *GetGestureName(int i);
static Color GetGestureColor(int i);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Handle common
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures testbed");
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
UpdateDrawFrame();
}
#endif
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
static void UpdateDrawFrame(void)
{
// Update
//--------------------------------------------------------------------------------------
// Handle common gestures data
int i, ii; // Iterators that will be reused by all for loops
const int currentGesture = GetGestureDetected();
const float currentDragDegrees = GetGestureDragAngle();
@@ -107,11 +115,10 @@ void Update(void)
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
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))
@@ -169,7 +176,6 @@ void Update(void)
}
// Handle protractor
//--------------------------------------------------------------------------------------
if (currentGesture > 255) // aka Pinch In and Pinch Out
{
currentAngleDegrees = currentPitchDegrees;
@@ -187,9 +193,6 @@ void Update(void)
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)
@@ -200,22 +203,20 @@ void Update(void)
}
else mousePosition = GetMousePosition();
}
//--------------------------------------------------------------------------------------
// Draw
//--------------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw common
//--------------------------------------------------------------------------------------
// Draw common elements
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);
@@ -233,7 +234,6 @@ void Update(void)
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)
@@ -254,7 +254,6 @@ void Update(void)
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, ".");
@@ -276,7 +275,6 @@ void Update(void)
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
// Draw touch and mouse pointer points
//--------------------------------------------------------------------------------------
if (currentGesture != GESTURE_NONE)
{
if ( touchCount != 0 )
@@ -298,33 +296,42 @@ void Update(void)
EndDrawing();
//--------------------------------------------------------------------------------------
}
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
static char const *GetGestureName(int i)
{
// 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;
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;
}
}
static 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;
}
}

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Keyboard input
* raylib [core] example - keyboard input
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.0, last time updated with raylib 1.0
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Mouse input
* raylib [core] example - mouse input
*
* Example originally created with raylib 1.0, last time updated with raylib 4.0
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.0, last time updated with raylib 5.5
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -36,6 +38,18 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_H))
{
if (IsCursorHidden())
{
ShowCursor();
}
else
{
HideCursor();
}
}
ballPosition = GetMousePosition();
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) ballColor = MAROON;
@@ -56,6 +70,10 @@ int main(void)
DrawCircleV(ballPosition, 40, ballColor);
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
if (!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
EndDrawing();
//----------------------------------------------------------------------------------

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] examples - Mouse wheel input
* raylib [core] example - input mouse wheel
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.1, last time updated with raylib 1.3
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Input multitouch
* raylib [core] example - input multitouch
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 2.1, last time updated with raylib 2.5
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2019-2024 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
* Copyright (c) 2019-2025 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -42,7 +44,7 @@ int main(void)
// Get the touch point count ( how many fingers are touching the screen )
int tCount = GetTouchPointCount();
// Clamp touch points available ( set the maximum touch points allowed )
if(tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
if (tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
// Get touch points positions
for (int i = 0; i < tCount; ++i) touchPositions[i] = GetTouchPosition(i);
//----------------------------------------------------------------------------------
@@ -52,7 +54,7 @@ int main(void)
BeginDrawing();
ClearBackground(RAYWHITE);
for (int i = 0; i < tCount; ++i)
{
// Make sure point is not (0, 0) as this means there is no touch for it

View File

@@ -2,21 +2,33 @@
*
* raylib [core] example - input virtual controls
*
* Example complexity rating: [★★☆☆] 3/4
*
* Example originally created with raylib 5.0, last time updated with raylib 5.0
*
* Example create by GreenSnakeLinux (@GreenSnakeLinux),
* lighter by oblerion (@oblerion) and
* reviewed by Ramon Santamaria (@raysan5)
* Example contributed by GreenSnakeLinux (@GreenSnakeLinux),
* reviewed by Ramon Santamaria (@raysan5), oblerion (@oblerion) and danilwhale (@danilwhale)
*
* 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) 2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2024-2025 oblerion (@oblerion) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <math.h>
typedef enum {
BUTTON_NONE = -1,
BUTTON_UP,
BUTTON_LEFT,
BUTTON_RIGHT,
BUTTON_DOWN,
BUTTON_MAX
} PadButton;
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -29,24 +41,35 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - input virtual controls");
const float dpadX = 90;
const float dpadY = 300;
const float dpadRad = 25.0f;//radius of each pad
Color dpadColor = BLUE;
int dpadKeydown = -1;//-1 if not down, else 0,1,2,3
Vector2 padPosition = { 100, 350 };
float buttonRadius = 30;
const float dpadCollider[4][2]= // collider array with x,y position
{
{dpadX,dpadY-dpadRad*1.5f},//up
{dpadX-dpadRad*1.5f,dpadY},//left
{dpadX+dpadRad*1.5f,dpadY},//right
{dpadX,dpadY+dpadRad*1.5f}//down
Vector2 buttonPositions[BUTTON_MAX] = {
{ padPosition.x,padPosition.y - buttonRadius*1.5f }, // Up
{ padPosition.x - buttonRadius*1.5f, padPosition.y }, // Left
{ padPosition.x + buttonRadius*1.5f, padPosition.y }, // Right
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
};
const char dpadLabel[4]="XYBA";//label of Dpad
float playerX=100;
float playerY=100;
const char *buttonLabels[BUTTON_MAX] = {
"Y", // Up
"X", // Left
"B", // Right
"A" // Down
};
Color buttonLabelColors[BUTTON_MAX] = {
YELLOW, // Up
BLUE, // Left
RED, // Right
GREEN // Down
};
int pressedButton = BUTTON_NONE;
Vector2 inputPosition = { 0, 0 };
Vector2 playerPosition = { (float)screenWidth/2, (float)screenHeight/2 };
float playerSpeed = 75;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@@ -54,63 +77,66 @@ int main(void)
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//--------------------------------------------------------------------------
dpadKeydown = -1; //reset
int inputX = 0;
int inputY = 0;
if(GetTouchPointCount()>0)
{//use touch pos
inputX = GetTouchX();
inputY = GetTouchY();
}
else
{//use mouse pos
inputX = GetMouseX();
inputY = GetMouseY();
}
for(int i=0;i<4;i++)
// Update
//--------------------------------------------------------------------------
if ((GetTouchPointCount() > 0)) inputPosition = GetTouchPosition(0); // Use touch position
else inputPosition = GetMousePosition(); // Use mouse position
// Reset pressed button to none
pressedButton = BUTTON_NONE;
// Make sure user is pressing left mouse button if they're from desktop
if ((GetTouchPointCount() > 0) ||
((GetTouchPointCount() == 0) && IsMouseButtonDown(MOUSE_BUTTON_LEFT)))
{
//test distance each collider and input < radius
if( fabsf(dpadCollider[i][1]-inputY) + fabsf(dpadCollider[i][0]-inputX) < dpadRad)
// Find nearest D-Pad button to the input position
for (int i = 0; i < BUTTON_MAX; i++)
{
dpadKeydown = i;
break;
}
}
// move player
switch(dpadKeydown){
case 0: playerY -= 50*GetFrameTime();
break;
case 1: playerX -= 50*GetFrameTime();
break;
case 2: playerX += 50*GetFrameTime();
break;
case 3: playerY += 50*GetFrameTime();
default:;
};
//--------------------------------------------------------------------------
// Draw
//--------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
for(int i=0;i<4;i++)
{
//draw all pad
DrawCircleV((Vector2) { dpadCollider[i][0], dpadCollider[i][1] }, dpadRad, dpadColor);
if(i!=dpadKeydown)
float distX = fabsf(buttonPositions[i].x - inputPosition.x);
float distY = fabsf(buttonPositions[i].y - inputPosition.y);
if ((distX + distY < buttonRadius))
{
//draw label
DrawText(TextSubtext(dpadLabel,i,1),
(int)dpadCollider[i][0]-7,
(int)dpadCollider[i][1]-8,20,BLACK);
pressedButton = i;
break;
}
}
}
// Move player according to pressed button
switch (pressedButton)
{
case BUTTON_UP: playerPosition.y -= playerSpeed*GetFrameTime(); break;
case BUTTON_LEFT: playerPosition.x -= playerSpeed*GetFrameTime(); break;
case BUTTON_RIGHT: playerPosition.x += playerSpeed*GetFrameTime(); break;
case BUTTON_DOWN: playerPosition.y += playerSpeed*GetFrameTime(); break;
default: break;
};
//--------------------------------------------------------------------------
// Draw
//--------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw world
DrawCircleV(playerPosition, 50, MAROON);
// Draw GUI
for (int i = 0; i < BUTTON_MAX; i++)
{
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
DrawText(buttonLabels[i],
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
20, buttonLabelColors[i]);
}
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
DrawRectangleRec((Rectangle) { playerX - 4, playerY - 4, 75, 28 }, RED);
DrawText("Player", (int)playerX, (int)playerY, 20, WHITE);
EndDrawing();
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
}
// De-Initialization
@@ -120,4 +146,3 @@ int main(void)
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,156 +0,0 @@
/*******************************************************************************************
*
* raylib [core] example - loading thread
*
* NOTE: This example requires linking with pthreads library on MinGW,
* it can be accomplished passing -static parameter to compiler
*
* Example originally created with raylib 2.5, last time updated with raylib 3.0
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
*
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#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
#include <time.h> // Required for: clock()
// Using C11 atomics for synchronization
// NOTE: A plain bool (or any plain data type for that matter) can't be used for inter-thread synchronization
static atomic_bool dataLoaded = false; // Data Loaded completion indicator
static void *LoadDataThread(void *arg); // Loading data thread function declaration
static atomic_int dataProgress = 0; // Data progress accumulator
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - loading thread");
pthread_t threadId = { 0 }; // Loading data thread id
enum { STATE_WAITING, STATE_LOADING, STATE_FINISHED } state = STATE_WAITING;
int framesCounter = 0;
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
//----------------------------------------------------------------------------------
switch (state)
{
case STATE_WAITING:
{
if (IsKeyPressed(KEY_ENTER))
{
int error = pthread_create(&threadId, NULL, &LoadDataThread, NULL);
if (error != 0) TraceLog(LOG_ERROR, "Error creating loading thread");
else TraceLog(LOG_INFO, "Loading thread initialized successfully");
state = STATE_LOADING;
}
} break;
case STATE_LOADING:
{
framesCounter++;
if (atomic_load_explicit(&dataLoaded, memory_order_relaxed))
{
framesCounter = 0;
int error = pthread_join(threadId, NULL);
if (error != 0) TraceLog(LOG_ERROR, "Error joining loading thread");
else TraceLog(LOG_INFO, "Loading thread terminated successfully");
state = STATE_FINISHED;
}
} break;
case STATE_FINISHED:
{
if (IsKeyPressed(KEY_ENTER))
{
// Reset everything to launch again
atomic_store_explicit(&dataLoaded, false, memory_order_relaxed);
atomic_store_explicit(&dataProgress, 0, memory_order_relaxed);
state = STATE_WAITING;
}
} break;
default: break;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
switch (state)
{
case STATE_WAITING: DrawText("PRESS ENTER to START LOADING DATA", 150, 170, 20, DARKGRAY); break;
case STATE_LOADING:
{
DrawRectangle(150, 200, atomic_load_explicit(&dataProgress, memory_order_relaxed), 60, SKYBLUE);
if ((framesCounter/15)%2) DrawText("LOADING DATA...", 240, 210, 40, DARKBLUE);
} break;
case STATE_FINISHED:
{
DrawRectangle(150, 200, 500, 60, LIME);
DrawText("DATA LOADED!", 250, 210, 40, GREEN);
} break;
default: break;
}
DrawRectangleLines(150, 200, 500, 60, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
// Loading data thread function definition
static void *LoadDataThread(void *arg)
{
int timeCounter = 0; // Time counted in ms
clock_t prevTime = clock(); // Previous time
// We simulate data loading with a time counter for 5 seconds
while (timeCounter < 5000)
{
clock_t currentTime = clock() - prevTime;
timeCounter = currentTime*1000/CLOCKS_PER_SEC;
// We accumulate time over a global variable to be used in
// main thread as a progress bar
atomic_store_explicit(&dataProgress, timeCounter/10, memory_order_relaxed);
}
// When data has finished loading, we set global variable
atomic_store_explicit(&dataLoaded, true, memory_order_relaxed);
return NULL;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - Generates a random sequence
* raylib [core] example - generate random sequence
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 5.0, last time updated with raylib 5.0
*
@@ -9,168 +11,168 @@
* 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 Dalton Overmyer (@REDl3east)
* Copyright (c) 2023-2025 Dalton Overmyer (@REDl3east)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#include <stdlib.h> // Required for: malloc() and free()
#include <stdlib.h> // Required for: malloc(), free()
typedef struct ColorRect{
Color c;
Rectangle r;
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef struct ColorRect {
Color color;
Rectangle rect;
} ColorRect;
static Color GenerateRandomColor();
static ColorRect* GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight);
static void ShuffleColorRectSequence(ColorRect* rectangles, int rectCount);
static void DrawTextCenterKeyHelp(const char* key, const char* text, int posX, int posY, int fontSize, Color color);
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
static Color GenerateRandomColor(void);
static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight);
static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount);
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void) {
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - Generates a random sequence");
int rectCount = 20;
float rectSize = (float)screenWidth/rectCount;
ColorRect* rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight);
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if(IsKeyPressed(KEY_SPACE))
{
ShuffleColorRectSequence(rectangles, rectCount);
}
if(IsKeyPressed(KEY_UP))
{
rectCount++;
rectSize = (float)screenWidth/rectCount;
free(rectangles);
rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight);
}
if(IsKeyPressed(KEY_DOWN))
{
if(rectCount >= 4){
rectCount--;
rectSize = (float)screenWidth/rectCount;
free(rectangles);
rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight);
}
}
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
int fontSize = 20;
for(int x=0;x<rectCount;x++)
{
DrawRectangleRec(rectangles[x].r, rectangles[x].c);
DrawTextCenterKeyHelp("SPACE", "to shuffle the sequence.", 10, screenHeight - 96, fontSize, BLACK);
DrawTextCenterKeyHelp("UP", "to add a rectangle and generate a new sequence.", 10, screenHeight - 64, fontSize, BLACK);
DrawTextCenterKeyHelp("DOWN", "to remove a rectangle and generate a new sequence.", 10, screenHeight - 32, fontSize, BLACK);
}
const char* rectCountText = TextFormat("%d rectangles", rectCount);
int rectCountTextSize = MeasureText(rectCountText, fontSize);
DrawText(rectCountText, screenWidth - rectCountTextSize - 10, 10, fontSize, BLACK);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
free(rectangles);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
static Color GenerateRandomColor()
int main(void)
{
return CLITERAL(Color){
GetRandomValue(0, 255),
GetRandomValue(0, 255),
GetRandomValue(0, 255),
255,
};
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random sequence");
int rectCount = 20;
float rectSize = (float)screenWidth/rectCount;
ColorRect *rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f*screenHeight);
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) ShuffleColorRectSequence(rectangles, rectCount);
if (IsKeyPressed(KEY_UP))
{
rectCount++;
rectSize = (float)screenWidth/rectCount;
RL_FREE(rectangles);
// Re-generate random sequence with new count
rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f*screenHeight);
}
if (IsKeyPressed(KEY_DOWN))
{
if (rectCount >= 4)
{
rectCount--;
rectSize = (float)screenWidth/rectCount;
RL_FREE(rectangles);
// Re-generate random sequence with new count
rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f*screenHeight);
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
for (int i = 0; i < rectCount; i++)
{
DrawRectangleRec(rectangles[i].rect, rectangles[i].color);
DrawText("Press SPACE to shuffle the sequence", 10, screenHeight - 96, 20, BLACK);
DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK);
DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK);
DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK);
}
DrawText(TextFormat("Count: %d rectangles", rectCount), 10, 10, 20, MAROON);
DrawFPS(screenWidth - 80, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
free(rectangles);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
static ColorRect* GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight){
int *seq = LoadRandomSequence((unsigned int)rectCount, 0, (unsigned int)rectCount-1);
ColorRect* rectangles = (ColorRect *)malloc((int)rectCount*sizeof(ColorRect));
float rectSeqWidth = rectCount * rectWidth;
float startX = (screenWidth - rectSeqWidth) * 0.5f;
for(int x=0;x<rectCount;x++){
int rectHeight = (int)Remap((float)seq[x], 0, rectCount-1, 0, screenHeight);
rectangles[x].c = GenerateRandomColor();
rectangles[x].r = CLITERAL(Rectangle){
startX + x * rectWidth, screenHeight - rectHeight, rectWidth, (float)rectHeight
//------------------------------------------------------------------------------------
// Module Functions Definition
//------------------------------------------------------------------------------------
static Color GenerateRandomColor(void)
{
Color color = {
GetRandomValue(0, 255),
GetRandomValue(0, 255),
GetRandomValue(0, 255),
255
};
}
UnloadRandomSequence(seq);
return rectangles;
return color;
}
static void ShuffleColorRectSequence(ColorRect* rectangles, int rectCount)
static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight)
{
int *seq = LoadRandomSequence(rectCount, 0, rectCount-1);
for(int i1=0;i1<rectCount;i1++){
ColorRect* r1 = &rectangles[i1];
ColorRect* r2 = &rectangles[seq[i1]];
ColorRect *rectangles = (ColorRect *)RL_CALLOC((int)rectCount, sizeof(ColorRect));
// swap only the color and height
ColorRect tmp = *r1;
r1->c = r2->c;
r1->r.height = r2->r.height;
r1->r.y = r2->r.y;
r2->c = tmp.c;
r2->r.height = tmp.r.height;
r2->r.y = tmp.r.y;
int *seq = LoadRandomSequence((unsigned int)rectCount, 0, (unsigned int)rectCount - 1);
float rectSeqWidth = rectCount*rectWidth;
float startX = (screenWidth - rectSeqWidth)*0.5f;
}
UnloadRandomSequence(seq);
for (int i = 0; i < rectCount; i++)
{
int rectHeight = (int)Remap((float)seq[i], 0, rectCount - 1, 0, screenHeight);
rectangles[i].color = GenerateRandomColor();
rectangles[i].rect = CLITERAL(Rectangle){ startX + i*rectWidth, screenHeight - rectHeight, rectWidth, (float)rectHeight };
}
UnloadRandomSequence(seq);
return rectangles;
}
static void DrawTextCenterKeyHelp(const char* key, const char* text, int posX, int posY, int fontSize, Color color)
static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount)
{
int spaceSize = MeasureText(" ", fontSize);
int pressSize = MeasureText("Press", fontSize);
int keySize = MeasureText(key, fontSize);
int textSize = MeasureText(text, fontSize);
int totalSize = pressSize + 2 * spaceSize + keySize + 2 * spaceSize + textSize;
int textSizeCurrent = 0;
int *seq = LoadRandomSequence(rectCount, 0, rectCount - 1);
DrawText("Press", posX, posY, fontSize, color);
textSizeCurrent += pressSize + 2 * spaceSize;
DrawText(key, posX + textSizeCurrent, posY, fontSize, RED);
DrawRectangle(posX + textSizeCurrent, posY + fontSize, keySize, 3, RED);
textSizeCurrent += keySize + 2 * spaceSize;
DrawText(text, posX + textSizeCurrent, posY, fontSize, color);
}
for (int i1 = 0; i1 < rectCount; i1++)
{
ColorRect *r1 = &rectangles[i1];
ColorRect *r2 = &rectangles[seq[i1]];
// Swap only the color and height
ColorRect tmp = *r1;
r1->color = r2->color;
r1->rect.height = r2->rect.height;
r1->rect.y = r2->rect.y;
r2->color = tmp.color;
r2->rect.height = tmp.rect.height;
r2->rect.y = tmp.rect.y;
}
UnloadRandomSequence(seq);
}

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Generate random values
* raylib [core] example - generate random values
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.1, last time updated with raylib 1.1
*
* 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) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -28,9 +30,9 @@ int main(void)
// SetRandomSeed(0xaabbccff); // Set a custom random seed if desired, by default: "time(NULL)"
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
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,8 @@
/*******************************************************************************************
*
* raylib [core] example - Scissor test
* raylib [core] example - scissor test
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 2.5, last time updated with raylib 3.0
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2019-2024 Chris Dill (@MysteriousSpace)
* Copyright (c) 2019-2025 Chris Dill (@MysteriousSpace)
*
********************************************************************************************/

View File

@@ -1,16 +1,18 @@
/*******************************************************************************************
*
* raylib [core] example - Smooth Pixel-perfect camera
* raylib [core] example - smooth pixel-perfect camera
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 3.7, last time updated with raylib 4.0
*
*
* Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) 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) 2021-2024 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
* Copyright (c) 2021-2025 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -41,7 +43,8 @@ int main(void)
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
screenSpaceCamera.zoom = 1.0f;
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
// Load render texture to draw all our objects
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight);
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Storage save/load values
* raylib [core] example - storage save/load values
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.4, last time updated with raylib 4.2
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -23,7 +25,9 @@ typedef enum {
STORAGE_POSITION_HISCORE = 1
} StorageData;
// Persistent storage functions
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
static bool SaveStorageValue(unsigned int position, int value);
static int LoadStorageValue(unsigned int position);
@@ -99,6 +103,9 @@ int main(void)
return 0;
}
//------------------------------------------------------------------------------------
// Module Functions Declaration
//------------------------------------------------------------------------------------
// Save integer value to storage file (to defined position)
// NOTE: Storage positions is directly related to file memory layout (4 bytes each integer)
bool SaveStorageValue(unsigned int position, int value)

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - VR Simulator (Oculus Rift CV1 parameters)
* raylib [core] example - vr simulator
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 2.5, last time updated with raylib 4.0
*
* 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) 2017-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -59,7 +61,7 @@ int main(void)
VrStereoConfig config = LoadVrStereoConfig(device);
// Distortion shader (uses device lens distortion and chroma)
Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION));
Shader distortion = LoadShader(0, TextFormat("resources/shaders/glsl%i/distortion.fs", GLSL_VERSION));
// Update distortion shader with lens and distortion-scale parameters
SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"),
@@ -125,7 +127,7 @@ int main(void)
EndMode3D();
EndVrStereoMode();
EndTextureMode();
BeginDrawing();
ClearBackground(RAYWHITE);
BeginShaderMode(distortion);

View File

@@ -2,12 +2,14 @@
*
* raylib [core] example - window flags
*
* Example complexity rating: [★★★☆] 3/4
*
* Example originally created with raylib 3.5, last time updated with raylib 3.5
*
* 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) 2020-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2020-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -44,13 +46,13 @@ int main(void)
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
Vector2 ballPosition = { GetScreenWidth() / 2.0f, GetScreenHeight() / 2.0f };
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
Vector2 ballSpeed = { 5.0f, 4.0f };
float ballRadius = 20;
int framesCounter = 0;
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//----------------------------------------------------------
// Main game loop
@@ -95,7 +97,10 @@ int main(void)
if (IsWindowState(FLAG_WINDOW_MINIMIZED))
{
framesCounter++;
if (framesCounter >= 240) RestoreWindow(); // Restore window after 3 seconds
if (framesCounter >= 240) {
RestoreWindow(); // Restore window after 3 seconds
framesCounter = 0;
}
}
if (IsKeyPressed(KEY_M))
@@ -129,6 +134,9 @@ int main(void)
else SetWindowState(FLAG_VSYNC_HINT);
}
if (IsKeyPressed(KEY_B)) ToggleBorderlessWindowed();
// Bouncing ball logic
ballPosition.x += ballSpeed.x;
ballPosition.y += ballSpeed.y;
@@ -161,9 +169,9 @@ int main(void)
if (IsWindowState(FLAG_WINDOW_UNDECORATED)) DrawText("[D] FLAG_WINDOW_UNDECORATED: on", 10, 120, 10, LIME);
else DrawText("[D] FLAG_WINDOW_UNDECORATED: off", 10, 120, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_HIDDEN)) DrawText("[H] FLAG_WINDOW_HIDDEN: on", 10, 140, 10, LIME);
else DrawText("[H] FLAG_WINDOW_HIDDEN: off", 10, 140, 10, MAROON);
else DrawText("[H] FLAG_WINDOW_HIDDEN: off (hides for 3 seconds)", 10, 140, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_MINIMIZED)) DrawText("[N] FLAG_WINDOW_MINIMIZED: on", 10, 160, 10, LIME);
else DrawText("[N] FLAG_WINDOW_MINIMIZED: off", 10, 160, 10, MAROON);
else DrawText("[N] FLAG_WINDOW_MINIMIZED: off (restores after 3 seconds)", 10, 160, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_MAXIMIZED)) DrawText("[M] FLAG_WINDOW_MAXIMIZED: on", 10, 180, 10, LIME);
else DrawText("[M] FLAG_WINDOW_MAXIMIZED: off", 10, 180, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_UNFOCUSED)) DrawText("[G] FLAG_WINDOW_UNFOCUSED: on", 10, 200, 10, LIME);
@@ -174,14 +182,16 @@ int main(void)
else DrawText("[A] FLAG_WINDOW_ALWAYS_RUN: off", 10, 240, 10, MAROON);
if (IsWindowState(FLAG_VSYNC_HINT)) DrawText("[V] FLAG_VSYNC_HINT: on", 10, 260, 10, LIME);
else DrawText("[V] FLAG_VSYNC_HINT: off", 10, 260, 10, MAROON);
if (IsWindowState(FLAG_BORDERLESS_WINDOWED_MODE)) DrawText("[B] FLAG_BORDERLESS_WINDOWED_MODE: on", 10, 280, 10, LIME);
else DrawText("[B] FLAG_BORDERLESS_WINDOWED_MODE: off", 10, 280, 10, MAROON);
DrawText("Following flags can only be set before window creation:", 10, 300, 10, GRAY);
if (IsWindowState(FLAG_WINDOW_HIGHDPI)) DrawText("FLAG_WINDOW_HIGHDPI: on", 10, 320, 10, LIME);
else DrawText("FLAG_WINDOW_HIGHDPI: off", 10, 320, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_TRANSPARENT)) DrawText("FLAG_WINDOW_TRANSPARENT: on", 10, 340, 10, LIME);
else DrawText("FLAG_WINDOW_TRANSPARENT: off", 10, 340, 10, MAROON);
if (IsWindowState(FLAG_MSAA_4X_HINT)) DrawText("FLAG_MSAA_4X_HINT: on", 10, 360, 10, LIME);
else DrawText("FLAG_MSAA_4X_HINT: off", 10, 360, 10, MAROON);
DrawText("Following flags can only be set before window creation:", 10, 320, 10, GRAY);
if (IsWindowState(FLAG_WINDOW_HIGHDPI)) DrawText("FLAG_WINDOW_HIGHDPI: on", 10, 340, 10, LIME);
else DrawText("FLAG_WINDOW_HIGHDPI: off", 10, 340, 10, MAROON);
if (IsWindowState(FLAG_WINDOW_TRANSPARENT)) DrawText("FLAG_WINDOW_TRANSPARENT: on", 10, 360, 10, LIME);
else DrawText("FLAG_WINDOW_TRANSPARENT: off", 10, 360, 10, MAROON);
if (IsWindowState(FLAG_MSAA_4X_HINT)) DrawText("FLAG_MSAA_4X_HINT: on", 10, 380, 10, LIME);
else DrawText("FLAG_MSAA_4X_HINT: off", 10, 380, 10, MAROON);
EndDrawing();
//-----------------------------------------------------

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [core] example - window scale letterbox (and virtual mouse)
* raylib [core] example - window scale letterbox
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 2.5, last time updated with raylib 4.0
*
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2019-2024 Anata (@anatagawa) and Ramon Santamaria (@raysan5)
* Copyright (c) 2019-2025 Anata (@anatagawa) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -25,12 +27,12 @@
//------------------------------------------------------------------------------------
int main(void)
{
const int windowWidth = 800;
const int windowHeight = 450;
const int screenWidth = 800;
const int screenHeight = 450;
// Enable config flags for resizable window and vertical synchro
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
InitWindow(windowWidth, windowHeight, "raylib [core] example - window scale letterbox");
InitWindow(screenWidth, screenHeight, "raylib [core] example - window scale letterbox");
SetWindowMinSize(320, 240);
int gameScreenWidth = 640;
@@ -84,7 +86,7 @@ int main(void)
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
EndTextureMode();
BeginDrawing();
ClearBackground(BLACK); // Clear screen background

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - Window should close
* raylib [core] example - window should close
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 4.2, last time updated with raylib 4.2
*
* 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-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -24,9 +26,9 @@ int main()
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - window should close");
SetExitKey(KEY_NULL); // Disable KEY_ESCAPE to close window, X-button still works
bool exitWindowRequested = false; // Flag to request window to exit
bool exitWindow = false; // Flag to set window to exit
@@ -40,12 +42,12 @@ int main()
//----------------------------------------------------------------------------------
// Detect if X-button or KEY_ESCAPE have been pressed to close window
if (WindowShouldClose() || IsKeyPressed(KEY_ESCAPE)) exitWindowRequested = true;
if (exitWindowRequested)
{
// A request for close window has been issued, we can save data before closing
// or just show a message asking for confirmation
if (IsKeyPressed(KEY_Y)) exitWindow = true;
else if (IsKeyPressed(KEY_N)) exitWindowRequested = false;
}

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [core] example - World to screen
* raylib [core] example - core world screen
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.3, last time updated with raylib 1.4
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -67,8 +69,8 @@ int main(void)
EndMode3D();
DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK);
DrawText("Enemy: 100/100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK);
DrawText(TextFormat("Cube position in screen space coordinates: [%i, %i]", (int)cubeScreenPosition.x, (int)cubeScreenPosition.y), 10, 10, 20, LIME);
DrawText("Text 2d should be always on top of the cube", 10, 40, 20, GRAY);
@@ -82,4 +84,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View File

@@ -10,7 +10,7 @@ varying vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
// NOTE: Add your custom variables here
uniform vec2 leftLensCenter;
uniform vec2 rightLensCenter;
uniform vec2 leftScreenCenter;

View File

@@ -0,0 +1,50 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add your custom variables here
uniform vec2 leftLensCenter;
uniform vec2 rightLensCenter;
uniform vec2 leftScreenCenter;
uniform vec2 rightScreenCenter;
uniform vec2 scale;
uniform vec2 scaleIn;
uniform vec4 deviceWarpParam;
uniform vec4 chromaAbParam;
void main()
{
// Compute lens distortion
vec2 lensCenter = fragTexCoord.x < 0.5? leftLensCenter : rightLensCenter;
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
float rSq = theta.x*theta.x + theta.y*theta.y;
vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq);
vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
vec2 tcBlue = lensCenter + scale*thetaBlue;
if (any(bvec2(clamp(tcBlue, screenCenter - vec2(0.25, 0.5), screenCenter + vec2(0.25, 0.5)) - tcBlue)))
{
// Set black fragment for everything outside the lens border
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
else
{
// Compute color chroma aberration
float blue = texture2D(texture0, tcBlue).b;
vec2 tcGreen = lensCenter + scale*theta1;
float green = texture2D(texture0, tcGreen).g;
vec2 thetaRed = theta1*(chromaAbParam.x + chromaAbParam.y*rSq);
vec2 tcRed = lensCenter + scale*thetaRed;
float red = texture2D(texture0, tcRed).r;
gl_FragColor = vec4(red, green, blue, 1.0);
}
}

View File

@@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
// NOTE: Add your custom variables here
uniform vec2 leftLensCenter = vec2(0.288, 0.5);
uniform vec2 rightLensCenter = vec2(0.712, 0.5);
uniform vec2 leftScreenCenter = vec2(0.25, 0.5);

View File

@@ -1,27 +1,27 @@
GLFW_ICON ICON "raylib.ico"
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 5,5,0,0
PRODUCTVERSION 5,5,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
//BLOCK "080904E4" // English UK
BLOCK "040904E4" // English US
//BLOCK "080904E4" // English UK
BLOCK "040904E4" // English US
BEGIN
VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib example"
VALUE "FileVersion", "1.0"
VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib application (www.raylib.com)"
VALUE "FileVersion", "5.5.0"
VALUE "InternalName", "raylib-example"
VALUE "LegalCopyright", "(c) 2024 raylib technologies (@raylibtech)"
//VALUE "OriginalFilename", "raylib_app.exe"
VALUE "LegalCopyright", "(c) 2025 Ramon Santamaria (@raysan5)"
VALUE "OriginalFilename", "raylib-example"
VALUE "ProductName", "raylib-example"
VALUE "ProductVersion", "1.0"
VALUE "ProductVersion", "5.5.0"
END
END
BLOCK "VarFileInfo"
BEGIN
//VALUE "Translation", 0x809, 1252 // English UK
VALUE "Translation", 0x409, 1252 // English US
//VALUE "Translation", 0x809, 1252 // English UK
VALUE "Translation", 0x409, 1252 // English US
END
END

169
examples/examples_list.txt Normal file
View File

@@ -0,0 +1,169 @@
#
# raylib examples list used to generate/update collection
# examples must be provided as: <example_category>;<example_name>;<example_stars>;<raylib_created_version>;<raylib_last_update_version>;<year_created>;<year_reviewed>;"<example_author_name>";<author_github_user>
#
# This list is used as the main reference by [rexm] tool for examples collection validation and management
# New examples must be added to this list and any possible rename must be made on this list first
#
# WARNING: List is not ordered by example name but by the display order on web
#
core;core_basic_window;★☆☆☆;1.0;1.0;2013;2025;"Ramon Santamaria";@raysan5
core;core_input_keys;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
core;core_input_mouse;★☆☆☆;1.0;5.5;2014;2025;"Ramon Santamaria";@raysan5
core;core_input_mouse_wheel;★☆☆☆;1.1;1.3;2014;2025;"Ramon Santamaria";@raysan5
core;core_input_gamepad;★☆☆☆;1.1;4.2;2013;2025;"Ramon Santamaria";@raysan5
core;core_input_multitouch;★☆☆☆;2.1;2.5;2019;2025;"Berni";@Berni8k
core;core_input_gestures;★★☆☆;1.4;4.2;2016;2025;"Ramon Santamaria";@raysan5
core;core_input_gestures_testbed;★★★☆;4.6-dev;5.6-dev;2023;2025;"ubkp";@ubkp
core;core_input_virtual_controls;★★☆☆;5.0;5.0;2024;2025;"oblerion";@oblerion
core;core_2d_camera;★★☆☆;1.5;3.0;2016;2025;"Ramon Santamaria";@raysan5
core;core_2d_camera_mouse_zoom;★★☆☆;4.2;4.2;2022;2025;"Jeffery Myers";@JeffM2501
core;core_2d_camera_platformer;★★★☆;2.5;3.0;2019;2025;"arvyy";@arvyy
core;core_2d_camera_split_screen;★★★★;4.5;4.5;2023;2025;"Gabriel dos Santos Sanches";@gabrielssanches
core;core_3d_camera_mode;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
core;core_3d_camera_free;★☆☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
core;core_3d_camera_first_person;★★☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
core;core_3d_camera_split_screen;★★★☆;3.7;4.0;2021;2025;"Jeffery Myers";@JeffM2501
core;core_3d_camera_fps;★★★☆;5.5;5.5;2025;2025;"Agnis Aldins";@nezvers
core;core_3d_picking;★★☆☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
core;core_world_screen;★★☆☆;1.3;1.4;2015;2025;"Ramon Santamaria";@raysan5
core;core_window_flags;★★★☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
core;core_window_letterbox;★★☆☆;2.5;4.0;2019;2025;"Anata";@anatagawa
core;core_window_should_close;★☆☆☆;4.2;4.2;2013;2025;"Ramon Santamaria";@raysan5
core;core_custom_logging;★★★☆;2.5;2.5;2018;2025;"Pablo Marcos Oltra";@pamarcos
core;core_drop_files;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
core;core_random_values;★☆☆☆;1.1;1.1;2014;2025;"Ramon Santamaria";@raysan5
core;core_storage_values;★★☆☆;1.4;4.2;2015;2025;"Ramon Santamaria";@raysan5
core;core_vr_simulator;★★★☆;2.5;4.0;2017;2025;"Ramon Santamaria";@raysan5
core;core_scissor_test;★☆☆☆;2.5;3.0;2019;2025;"Chris Dill";@MysteriousSpace
core;core_basic_screen_manager;★☆☆☆;4.0;4.0;2021;2025;"Ramon Santamaria";@raysan5
core;core_custom_frame_control;★★★★;4.0;4.0;2021;2025;"Ramon Santamaria";@raysan5
core;core_smooth_pixelperfect;★★★☆;3.7;4.0;2021;2025;"Giancamillo Alessandroni";@NotManyIdeasDev
core;core_random_sequence;★☆☆☆;5.0;5.0;2023;2025;"Dalton Overmyer";@REDl3east
core;core_automation_events;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
core;core_high_dpi;★★☆☆;5.0;5.5;2025;0;"Jonathan Marler";@marler8997
shapes;shapes_basic_shapes;★☆☆☆;1.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_bouncing_ball;★☆☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
shapes;shapes_colors_palette;★★☆☆;1.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_logo_raylib_anim;★★☆☆;2.5;4.0;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_rectangle_scaling;★★☆☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
shapes;shapes_lines_bezier;★☆☆☆;1.7;1.7;2017;2025;"Ramon Santamaria";@raysan5
shapes;shapes_collision_area;★★☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
shapes;shapes_following_eyes;★★☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
shapes;shapes_easings_ball_anim;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_easings_box_anim;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_easings_rectangle_array;★★★☆;2.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
shapes;shapes_draw_ring;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
shapes;shapes_draw_circle_sector;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
shapes;shapes_draw_rectangle_rounded;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
shapes;shapes_top_down_lights;★★★★;4.2;4.2;2022;2025;"Jeffery Myers";@JeffM2501
shapes;shapes_rectangle_advanced;★★★★;5.5;5.5;2024;2025;"Everton Jr.";@evertonse
shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
shapes;shapes_digital_clock;★★☆☆;5.5;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
shapes;shapes_double_pendulum;★★☆☆;5.5;5.5;2025;2025;"JoeCheong";@Joecheong2006
textures;textures_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
textures;textures_srcrec_dstrec;★★★☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
textures;textures_image_drawing;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
textures;textures_image_generation;★★☆☆;1.8;1.8;2017;2025;"Wilhem Barbier";@nounoursheureux
textures;textures_image_loading;★☆☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
textures;textures_image_processing;★★★☆;1.4;3.5;2016;2025;"Ramon Santamaria";@raysan5
textures;textures_image_text;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
textures;textures_to_image;★☆☆☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
textures;textures_raw_data;★★★☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
textures;textures_particles_blending;★☆☆☆;1.7;3.5;2017;2025;"Ramon Santamaria";@raysan5
textures;textures_npatch_drawing;★★★☆;2.0;2.5;2018;2025;"Jorge A. Gomes";@overdev
textures;textures_background_scrolling;★☆☆☆;2.0;2.5;2019;2025;"Ramon Santamaria";@raysan5
textures;textures_sprite_anim;★★☆☆;1.3;1.3;2014;2025;"Ramon Santamaria";@raysan5
textures;textures_sprite_button;★★☆☆;2.5;2.5;2019;2025;"Ramon Santamaria";@raysan5
textures;textures_sprite_explosion;★★☆☆;2.5;3.5;2019;2025;"Ramon Santamaria";@raysan5
textures;textures_bunnymark;★★★☆;1.6;2.5;2014;2025;"Ramon Santamaria";@raysan5
textures;textures_mouse_painting;★★★☆;3.0;3.0;2019;2025;"Chris Dill";@MysteriousSpace
textures;textures_blend_modes;★☆☆☆;3.5;3.5;2020;2025;"Karlo Licudine";@accidentalrebel
textures;textures_tiled_drawing;★★★☆;3.0;4.2;2020;2025;"Vlad Adrian";@demizdor
textures;textures_polygon_drawing;★☆☆☆;3.7;3.7;2021;2025;"Chris Camacho";@chriscamacho
textures;textures_fog_of_war;★★★☆;4.2;4.2;2018;2025;"Ramon Santamaria";@raysan5
textures;textures_gif_player;★★★☆;4.2;4.2;2021;2025;"Ramon Santamaria";@raysan5
textures;textures_image_kernel;★★★★;1.3;1.3;2015;2025;"Karim Salem";@kimo-s
textures;textures_image_channel;★★☆☆;5.1-dev;5.1-dev;2024;2025;"Bruno Cabral";@brccabral
textures;textures_image_rotate;★★☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
textures;textures_textured_curve;★★★☆;4.5;4.5;2022;2025;"Jeffery Myers";@JeffM2501
text;text_sprite_fonts;★☆☆☆;1.7;3.7;2017;2025;"Ramon Santamaria";@raysan5
text;text_font_spritefont;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
text;text_font_filters;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
text;text_font_loading;★☆☆☆;1.4;3.0;2016;2025;"Ramon Santamaria";@raysan5
text;text_font_sdf;★★★☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
text;text_format_text;★☆☆☆;1.1;3.0;2014;2025;"Ramon Santamaria";@raysan5
text;text_input_box;★★☆☆;1.7;3.5;2017;2025;"Ramon Santamaria";@raysan5
text;text_writing_anim;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
text;text_rectangle_bounds;★★★★;2.5;4.0;2018;2025;"Vlad Adrian";@demizdor
text;text_unicode_emojis;★★★★;2.5;4.0;2019;2025;"Vlad Adrian";@demizdor
text;text_unicode_ranges;★★★★;5.5;5.6;2025;0;"Vlad Adrian";@demizdor
text;text_3d_drawing;★★★★;3.5;4.0;2021;2025;"Vlad Adrian";@demizdor
text;text_codepoints_loading;★★★☆;4.2;4.2;2022;2025;"Ramon Santamaria";@raysan5
models;models_animation;★★☆☆;2.5;3.5;2019;2025;"Culacant";@culacant
models;models_billboard_rendering;★★★☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
models;models_box_collisions;★☆☆☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
models;models_cubicmap;★★☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
models;models_first_person_maze;★★☆☆;2.5;3.5;2019;2025;"Ramon Santamaria";@raysan5
models;models_geometric_shapes;★☆☆☆;1.0;3.5;2014;2025;"Ramon Santamaria";@raysan5
models;models_mesh_generation;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
models;models_mesh_picking;★★★☆;1.7;4.0;2017;2025;"Joel Davis";@joeld42
models;models_loading;★☆☆☆;2.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
models;models_loading_gltf;★☆☆☆;3.7;4.2;2020;2025;"Ramon Santamaria";@raysan5
models;models_loading_vox;★☆☆☆;4.0;4.0;2021;2025;"Johann Nadalutti";@procfxgen
models;models_loading_m3d;★★☆☆;4.5;4.5;2022;2025;"bzt";@bztsrc
models;models_orthographic_projection;★☆☆☆;2.0;3.7;2018;2025;"Max Danielsson";@autious
models;models_point_rendering;★★★☆;5.0;5.0;2024;2025;"Reese Gallagher";@satchelfrost
models;models_rlgl_solar_system;★★★★;2.5;4.0;2018;2025;"Ramon Santamaria";@raysan5
models;models_yaw_pitch_roll;★★☆☆;1.8;4.0;2017;2025;"Berni";@Berni8k
models;models_waving_cubes;★★★☆;2.5;3.7;2019;2025;"Codecat";@codecat
models;models_heightmap;★☆☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
models;models_skybox_rendering;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
models;models_draw_cube_texture;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@raysan5
models;models_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
shaders;shaders_model_shader;★★☆☆;1.3;3.7;2014;2025;"Ramon Santamaria";@raysan5
shaders;shaders_shapes_textures;★★☆☆;1.7;3.7;2015;2025;"Ramon Santamaria";@raysan5
shaders;shaders_custom_uniform;★★☆☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
shaders;shaders_postprocessing;★★★☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
shaders;shaders_palette_switch;★★★☆;2.5;3.7;2019;2025;"Marco Lizza";@MarcoLizza
shaders;shaders_raymarching;★★★★;2.0;4.2;2018;2025;"Ramon Santamaria";@raysan5
shaders;shaders_texture_rendering;★★☆☆;2.0;3.7;2019;2025;"Michał Ciesielski";@ciessielski
shaders;shaders_texture_outline;★★★☆;4.0;4.0;2021;2025;"Serenity Skiff";@GoldenThumbs
shaders;shaders_texture_waves;★★☆☆;2.5;3.7;2019;2025;"Anata";@anatagawa
shaders;shaders_julia_set;★★★☆;2.5;4.0;2019;2025;"Josh Colclough";@joshcol9232
shaders;shaders_eratosthenes;★★★☆;2.5;4.0;2019;2025;"ProfJski";@ProfJski
shaders;shaders_fog_rendering;★★★☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
shaders;shaders_simple_mask;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
shaders;shaders_hot_reloading;★★★☆;3.0;3.5;2020;2025;"Ramon Santamaria";@raysan5
shaders;shaders_mesh_instancing;★★★★;3.7;4.2;2020;2025;"seanpringle";@seanpringle
shaders;shaders_multi_sample2d;★★☆☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
shaders;shaders_normal_map;★★★★;5.6;5.6;2025;2025;"Jeremy Montgomery";@Sir_Irk
shaders;shaders_spotlight;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
shaders;shaders_deferred_render;★★★★;4.5;4.5;2023;2025;"Justin Andreas Lacoste";@27justin
shaders;shaders_hybrid_render;★★★★;4.2;4.2;2022;2025;"Buğra Alptekin Sarı";@BugraAlptekinSari
shaders;shaders_texture_tiling;★★☆☆;4.5;4.5;2023;2025;"Luis Almeida";@luis605
shaders;shaders_shadowmap;★★★★;5.0;5.0;2023;2025;"TheManTheMythTheGameDev";@TheManTheMythTheGameDev
shaders;shaders_vertex_displacement;★★★☆;5.0;4.5;2023;2025;"Alex ZH";@ZzzhHe
shaders;shaders_write_depth;★★☆☆;4.2;4.2;2022;2025;"Buğra Alptekin Sarı";@BugraAlptekinSari
shaders;shaders_basic_pbr;★★★★;5.0;5.1-dev;2023;2025;"Afan OLOVCIC";@_DevDad
shaders;shaders_lightmap;★★★☆;4.5;4.5;2019;2025;"Jussi Viitala";@nullstare
shaders;shaders_rounded_rectangle;★★★☆;5.5;5.5;2025;2025;"Anstro Pleuton";@anstropleuton
shaders;shaders_view_depth;★★★☆;5.6-dev;5.6-dev;2025;2025;"Luís Almeida";@luis605
audio;audio_module_playing;★☆☆☆;1.5;3.5;2016;2025;"Ramon Santamaria";@raysan5
audio;audio_music_stream;★☆☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
audio;audio_raw_stream;★★★☆;1.6;4.2;2015;2025;"Ramon Santamaria";@raysan5
audio;audio_sound_loading;★☆☆☆;1.1;3.5;2014;2025;"Ramon Santamaria";@raysan5
audio;audio_mixed_processor;★★★★;4.2;4.2;2023;2025;"hkc";@hatkidchan
audio;audio_stream_effects;★★★★;4.2;5.0;2022;2025;"Ramon Santamaria";@raysan5
audio;audio_sound_multi;★★☆☆;4.6;4.6;2023;2025;"Jeffery Myers";@JeffM2501
audio;audio_sound_positioning;★★☆☆;5.5;5.5;2025;0;"Le Juez Victor";@Bigfoot71
others;rlgl_standalone;★★★★;1.6;4.0;2014;2025;"Ramon Santamaria";@raysan5
others;rlgl_compute_shader;★★★★;4.0;4.0;2021;2025;"Teddy Astie";@tsnake41
others;easings_testbed;★★★☆;2.5;3.0;2019;2025;"Juan Miguel López";@flashback-fx
others;raylib_opengl_interop;★★★★;3.8;4.0;2021;2025;"Stephan Soller";@arkanis
others;embedded_files_loading;★★☆☆;3.0;3.5;2020;2025;"Kristian Holmgren";@defutura
others;raymath_vector_angle;★★☆☆;1.0;4.6;2023;2025;"Ramon Santamaria";@raysan5

View File

@@ -6,30 +6,30 @@
1. File naming: <module>_<description> - Lower case filename, words separated by underscore,
no more than 3-4 words in total to describe the example. <module> referes to the primary
raylib module the example is more related with (code, shapes, textures, models, shaders, raudio).
raylib module the example is more related with (code, shapes, textures, models, shaders, raudio)
i.e: core_input_multitouch, shapes_lines_bezier, shaders_palette_switch
2. Follow below template structure, example info should list the module, the short description
and the author of the example, twitter or github info could be also provided for the author.
Short description should also be used on the title of the window.
and the author of the example, twitter or github info could be also provided for the author
Short description should also be used on the title of the window
3. Code should be organized by sections:[Initialization]- [Update] - [Draw] - [De-Initialization]
Place your code between the dotted lines for every section, please don't mix update logic with drawing
and remember to unload all loaded resources.
and remember to unload all loaded resources
4. Code should follow raylib conventions: https://github.com/raysan5/raylib/wiki/raylib-coding-conventions
Try to be very organized, using line-breaks appropiately.
Try to be very organized, using line-breaks appropiately
5. Add comments to the specific parts of code the example is focus on.
Don't abuse with comments, try to be clear and impersonal on the comments.
5. Add comments to the specific parts of code the example is focus on
Don't abuse with comments, try to be clear and impersonal on the comments
6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies.
Try to avoid defining functions outside the main(). Example should be as self-contained as possible.
6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies
Try to avoid defining functions outside the main(). Example should be as self-contained as possible
7. About external resources, they should be placed in a [resources] folder and those resources
should be open and free for use and distribution. Avoid propietary content.
should be open and free for use and distribution. Avoid propietary content
8. Try to keep the example simple but with a creative touch.
8. Try to keep the example simple but with a creative touch
Simple but beautiful examples are more appealing to users!
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
@@ -37,11 +37,11 @@
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.
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/<category>/resources/..
- raylib/examples/Makefile
- raylib/examples/Makefile.Web
- raylib/examples/README.md
@@ -56,16 +56,18 @@
/*******************************************************************************************
*
* raylib [core] example - Basic window
* raylib [<module>] example - <name/short description>
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
* Example complexity rating: [★☆☆☆] 1/4
*
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
* Example originally created with raylib 5.5, last time updated with raylib 5.6
*
* Example contributed by <author_name> (@<user_github>) 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 <user_name> (@<user_github>)
* Copyright (c) <year_created>-<year_updated> <author_name> (@<user_github>)
*
********************************************************************************************/
@@ -81,7 +83,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
InitWindow(screenWidth, screenHeight, "raylib [<module>] example - <name>");
// TODO: Load resources / Initialize variables at this point
@@ -102,9 +104,11 @@ int main(void)
ClearBackground(RAYWHITE);
// TODO: Draw everything that requires to be drawn at this point:
// TODO: Draw everything that requires to be drawn at this point
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); // Example
DrawLineEx((Vector2){ 0, 0 }, (Vector2){ screenWidth, screenHeight }, 2.0f, RED);
DrawLineEx((Vector2){ 0, screenHeight }, (Vector2){ screenWidth, 0 }, 2.0f, RED);
DrawText("example base code template", 260, 400, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,6 +1,8 @@
/*******************************************************************************************
*
* raylib [models] example - Load 3d model with animations and play them
* raylib [models] example - model animation
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 2.5, last time updated with raylib 3.5
*
@@ -9,13 +11,13 @@
* 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-2024 Culacant (@culacant) and Ramon Santamaria (@raysan5)
* Copyright (c) 2019-2025 Culacant (@culacant) and Ramon Santamaria (@raysan5)
*
********************************************************************************************
*
* NOTE: To export a model from blender, make sure it is not posed, the vertices need to be
* in the same position as they would be in edit mode and the scale of your models is
* set to 0. Scaling can be done from the export menu.
* NOTE: To export a model from blender, make sure it is not posed, the vertices need to be
* in the same position as they would be in edit mode and the scale of your models is
* set to 0. Scaling can be done from the export menu
*
********************************************************************************************/

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [models] example - Drawing billboards
* raylib [models] example - billboard render
*
* Example complexity rating: [] 3/4
*
* Example originally created with raylib 1.3, last time updated with raylib 3.5
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -24,7 +26,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
InitWindow(screenWidth, screenHeight, "raylib [models] example - billboard render");
// Define the camera to look into our 3d world
Camera camera = { 0 };
@@ -38,7 +40,7 @@ int main(void)
Vector3 billPositionStatic = { 0.0f, 2.0f, 0.0f }; // Position of static billboard
Vector3 billPositionRotating = { 1.0f, 2.0f, 1.0f }; // Position of rotating billboard
// Entire billboard texture, source is used to take a segment from a larger texture.
// Entire billboard texture, source is used to take a segment from a larger texture
Rectangle source = { 0.0f, 0.0f, (float)bill.width, (float)bill.height };
// NOTE: Billboard locked on axis-Y
@@ -52,7 +54,7 @@ int main(void)
Vector2 origin = Vector2Scale(size, 0.5f);
// Distance is needed for the correct billboard draw order
// Larger distance (further away from the camera) should be drawn prior to smaller distance.
// Larger distance (further away from the camera) should be drawn prior to smaller distance
float distanceStatic;
float distanceRotating;
float rotation = 0.0f;
@@ -83,17 +85,17 @@ int main(void)
DrawGrid(10, 1.0f); // Draw a grid
// Draw order matters!
if (distanceStatic > distanceRotating)
if (distanceStatic > distanceRotating)
{
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE);
}
}
else
{
DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE);
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
}
EndMode3D();
DrawFPS(10, 10);

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -1,7 +1,9 @@
/*******************************************************************************************
*
* raylib [core] example - Using bones as socket for calculating the positioning of something
*
* raylib [models] example - bone socket
*
* Example complexity rating: [★★★★] 4/4
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by iP (@ipzaur) and reviewed by Ramon Santamaria (@raysan5)
@@ -9,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2024 iP (@ipzaur)
* Copyright (c) 2024-2025 iP (@ipzaur)
*
********************************************************************************************/
@@ -49,7 +51,7 @@ int main(void)
LoadModel("resources/models/gltf/greenman_sword.glb"), // Index for the sword model is the same as BONE_SOCKET_HAND_R
LoadModel("resources/models/gltf/greenman_shield.glb") // Index for the shield model is the same as BONE_SOCKET_HAND_L
};
bool showEquip[3] = { true, true, true }; // Toggle on/off equip
// Load gltf model animations
@@ -61,7 +63,7 @@ int main(void)
// indices of bones for sockets
int boneSocketIndex[BONE_SOCKETS] = { -1, -1, -1 };
// search bones for sockets
// search bones for sockets
for (int i = 0; i < characterModel.boneCount; i++)
{
if (TextIsEqual(characterModel.bones[i].name, "socket_hat"))
@@ -69,13 +71,13 @@ int main(void)
boneSocketIndex[BONE_SOCKET_HAT] = i;
continue;
}
if (TextIsEqual(characterModel.bones[i].name, "socket_hand_R"))
{
boneSocketIndex[BONE_SOCKET_HAND_R] = i;
continue;
}
if (TextIsEqual(characterModel.bones[i].name, "socket_hand_L"))
{
boneSocketIndex[BONE_SOCKET_HAND_L] = i;
@@ -97,7 +99,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
// Rotate character
if (IsKeyDown(KEY_F)) angle = (angle + 1)%360;
else if (IsKeyDown(KEY_H)) angle = (360 + angle - 1)%360;
@@ -110,7 +112,7 @@ int main(void)
if (IsKeyPressed(KEY_ONE)) showEquip[BONE_SOCKET_HAT] = !showEquip[BONE_SOCKET_HAT];
if (IsKeyPressed(KEY_TWO)) showEquip[BONE_SOCKET_HAND_R] = !showEquip[BONE_SOCKET_HAND_R];
if (IsKeyPressed(KEY_THREE)) showEquip[BONE_SOCKET_HAND_L] = !showEquip[BONE_SOCKET_HAND_L];
// Update model animation
ModelAnimation anim = modelAnimations[animIndex];
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
@@ -138,7 +140,7 @@ int main(void)
Transform *transform = &anim.framePoses[animCurrentFrame][boneSocketIndex[i]];
Quaternion inRotation = characterModel.bindPose[boneSocketIndex[i]].rotation;
Quaternion outRotation = transform->rotation;
// Calculate socket rotation (angle between bone in initial pose and same bone in current animation frame)
Quaternion rotate = QuaternionMultiply(outRotation, QuaternionInvert(inRotation));
Matrix matrixTransform = QuaternionToMatrix(rotate);
@@ -146,7 +148,7 @@ int main(void)
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(transform->translation.x, transform->translation.y, transform->translation.z));
// Transform the socket using the transform of the character (angle and translate)
matrixTransform = MatrixMultiply(matrixTransform, characterModel.transform);
// Draw mesh at socket position with socket angle rotation
DrawMesh(equipModel[i].meshes[0], equipModel[i].materials[1], matrixTransform);
}
@@ -166,7 +168,7 @@ int main(void)
//--------------------------------------------------------------------------------------
UnloadModelAnimations(modelAnimations, animsCount);
UnloadModel(characterModel); // Unload character model and meshes/material
// Unload equipment model and meshes/material
for (int i = 0; i < BONE_SOCKETS; i++) UnloadModel(equipModel[i]);

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [models] example - Detect basic 3d collisions (box vs sphere vs box)
* raylib [models] example - box collisions
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 1.3, last time updated with raylib 3.5
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -1,13 +1,15 @@
/*******************************************************************************************
*
* raylib [models] example - Cubicmap loading and drawing
* raylib [models] example - cubicmap loading and drawing
*
* Example complexity rating: [★★☆☆] 2/4
*
* Example originally created with raylib 1.8, last time updated with raylib 3.5
*
* 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) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -23,7 +25,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubicmap loading and drawing");
// Define the camera to look into our 3d world
Camera camera = { 0 };

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