369 Commits
4.2.0 ... 4.5.0

Author SHA1 Message Date
ashn
fec96137e8 Update Makefile comment to indicate arm64 as a supported Linux desktop platform (#2965) 2023-03-18 17:37:04 +01:00
Ray
18a36b3e06 Update raylib.sln 2023-03-18 17:35:14 +01:00
Ray
40d01162b9 Merge branch 'master' of https://github.com/raysan5/raylib 2023-03-17 00:05:51 +01:00
Ray
e8a5d7b85c Update CHANGELOG 2023-03-17 00:05:40 +01:00
Brian E
e06047419c Added my BQN Library to the list (#2962)
I'm the only maintainer and have been working hard recently to get my library to be as nice to use as possible. I found out about this language list, and getting a new language on it didn't seem so bad. A bonus for my efforts.
2023-03-16 22:45:42 +01:00
Ray
03516b1c68 Update npes_saved_w64devkit.txt 2023-03-15 19:09:30 +01:00
Ray
7ab24b94ee Delete c_raylib.xml 2023-03-15 19:09:27 +01:00
Ray
bf3e527dab Update config.h 2023-03-15 17:51:23 +01:00
Ray
b31c836456 Update CHANGELOG 2023-03-15 17:51:03 +01:00
ashn
1aacefd6fa Add raylib-sunder to BINDINGS.md (#2958) 2023-03-15 14:56:24 +01:00
Ray
3b4f9faebc UPDATED: Notepad++ instellisense data 2023-03-15 13:17:14 +01:00
Ray
159e6b6f24 UPDATED: raylib-parser output files (TXT, XML, JSON, LUA) 2023-03-15 13:13:48 +01:00
Ray
ad2067340f REVIEWED: TraceLog(), avoid possible buffer overflow 2023-03-15 13:03:55 +01:00
veins1
cf04425bc2 Spelling (#2957) 2023-03-14 19:23:17 +01:00
Ray
796d96408b Update HISTORY.md 2023-03-14 14:06:37 +01:00
Ray
54ccb18e87 Update write_depth.fs 2023-03-14 13:39:33 +01:00
Ray
3d64598e11 Update Makefile 2023-03-14 13:14:19 +01:00
Ray
7ac2b4a226 Update HISTORY.md 2023-03-14 13:07:24 +01:00
Ray
2b9ef7d15c Update ROADMAP.md 2023-03-14 13:06:22 +01:00
Ray
975c70d2b7 Update rlgl.h 2023-03-14 13:06:17 +01:00
Ray
a6300d828a Update CHANGELOG 2023-03-14 13:05:58 +01:00
Ray
1a361fdfe2 Update Makefile.Web 2023-03-13 23:24:30 +01:00
Ray
5a2c49b954 Updated Makefiles to include all missing new examples 2023-03-13 23:13:02 +01:00
Ray
90ec0d52e0 Reviewed filename 2023-03-13 23:12:23 +01:00
Ray
a7f81b06b9 Remove trailing spaces 2023-03-13 12:08:23 +01:00
Ray
393b0d1a80 Delete rcamera.old.h 2023-03-13 12:06:54 +01:00
Ray
9a115106b4 Update miniaudio.h 2023-03-13 11:48:34 +01:00
Ray
a3b7bd0891 Update webassembly.yml 2023-03-13 11:44:49 +01:00
Ray
dad0e64aa8 Update HISTORY.md 2023-03-13 11:44:02 +01:00
Ray
90e36d1883 Update ROADMAP.md 2023-03-13 10:54:06 +01:00
Ray
8873aca268 Update CHANGELOG 2023-03-12 21:09:50 +01:00
Ray
ce28dfbdeb Update CHANGELOG 2023-03-12 21:03:21 +01:00
Ray
e4bc2c643e Update README.md 2023-03-12 20:52:24 +01:00
Ray
54f01e151c Update CHANGELOG 2023-03-12 20:50:19 +01:00
Ray
11e9a0d41c Update CHANGELOG 2023-03-12 20:48:49 +01:00
Ray
4f38830058 Some tweaks 2023-03-12 20:14:32 +01:00
Ray
520ea94de8 Update version to raylib 4.5 2023-03-12 19:52:24 +01:00
Ray
8ca3212701 REVIEWED: UpdateCameraPro() to use Vector3 2023-03-12 19:40:43 +01:00
Ray
f9c4cc2040 ADDED: UpdateCameraPro() -Experimental-
REVIEWED: rcamera module formating
REVIEWED: `core_3d_camera_example`
2023-03-12 19:28:42 +01:00
Ray
b436c8d7e5 ADDED: Security check for emscripten_run_script() #2954 2023-03-12 13:48:11 +01:00
Ray
ee3e40c663 Update rcore.c 2023-03-12 13:47:02 +01:00
Ray
4fd1e04e70 Update CHANGELOG 2023-03-07 21:03:44 +01:00
Ray
4f7b5ff59f WARNING: REMOVED: UnloadModelKeepMeshes() 2023-03-07 20:40:45 +01:00
Ray
ab1e246367 REVIEWED: Data types validation 2023-03-07 20:33:45 +01:00
Ray
15716e59dc Update CHANGELOG 2023-03-07 20:07:54 +01:00
Ray
aa3c7f4614 Merge branch 'master' of https://github.com/raysan5/raylib 2023-03-07 19:55:02 +01:00
Ray
ae53600d31 WARNING: REMOVED: Multichannel audio support API 2023-03-07 19:54:53 +01:00
Ray
57f0015a08 Update CHANGELOG 2023-03-07 19:51:17 +01:00
Ray
1b873b028f WARNING: REMOVED: Multichannel audio support API
It was quite restrictive and hacky implementation, just load multiple types same sound to play multiple instances.
2023-03-07 19:48:47 +01:00
Ray
3a332d241c Update CHANGELOG 2023-03-07 11:32:37 +01:00
Sid K
0b18882a94 fix(build): Fix DLL build on Windows (#2951)
Changes the DLL export condition to apply to platform WIN32 instead of
compiler MSVC
2023-03-06 21:10:18 +01:00
Ray
8f7e2cd179 Replace TABS by 4 spaces 2023-03-06 15:05:57 +01:00
Ray
614e0518a7 Remove trailing spaces 2023-03-06 14:58:58 +01:00
Ray
cf1ebada0e Tweak WindowDropCallback() #2943 2023-03-06 13:15:13 +01:00
Ray
aae7ab64c7 Update raudio.c 2023-03-06 13:00:30 +01:00
Ray
68ee0bb8dd ADDED: QOA music streaming (with auxiliar lib)
Some format tweaks
2023-03-06 12:33:49 +01:00
Ray
d3f5bc4043 REVIEWED: GetWindowHandle() #2950 2023-03-05 20:06:45 +01:00
Ray
f4f6e25340 Support QOA audio file format by default 2023-03-05 14:07:02 +01:00
Ray
9614d3353b REVIEWED: QOA audio file export 2023-03-05 13:49:18 +01:00
Ray
ab14ad5d75 Close issue #2949 2023-03-05 11:26:37 +01:00
Ray
0eeb499288 Update qoa.h 2023-03-05 11:17:47 +01:00
Ray
5492f52adc Change default threading model for COM objects
It shouldn't matter much but it could avoid some conflicts with other libraries in the future (like `tinyfiledialogs`).
2023-03-05 00:09:56 +01:00
Ray
1611cd54e7 REVIEWED: GetWindowHandle() #2938 2023-03-04 18:56:04 +01:00
Ray
6897b43599 REVIEWED: core_drop_files #2943 2023-03-03 20:13:35 +01:00
Antonis Geralis
394b31faff Add GL_MIN GL_MAX blending equations (#2945) 2023-02-26 12:01:42 +01:00
Ray
73c9f72c52 Update rtextures.c 2023-02-25 22:32:50 +01:00
Ray
7fd2bf1a32 Minimal tweak 2023-02-25 01:07:52 +01:00
Ray
215eb967e8 Update rcore.c 2023-02-24 18:31:16 +01:00
Ray
cb2ba3675c REVIEWED: rlUnloadFramebuffer() #2937 2023-02-24 16:19:25 +01:00
Ray
ca98a84d68 Update rtext.c 2023-02-24 15:27:25 +01:00
fubark
110eab56a7 Add Cyber to BINDINGS.md (#2939) 2023-02-24 00:48:28 +01:00
Ray
d5a31168ce REVIEWED: Data validation 2023-02-23 18:08:15 +01:00
Ray
d652b95fbf ADDED: Security checks 2023-02-22 17:28:25 +01:00
Ray
153470d605 REVIEWED: GenMeshTangents(), avoid crash on missing texcoords data #2927 2023-02-21 23:55:55 +01:00
Ray
b4d824d6fc REVIEWED: GetMonitorWidth() and GetMonitorHeight() #2934 2023-02-21 23:10:03 +01:00
Ray
8169d0eab2 REVIEWED: IsWindowFocused() to consider Android App state #2935 2023-02-21 23:01:23 +01:00
Ray
b2926b2d28 Update rtextures.c 2023-02-21 13:20:52 +01:00
Ray
3cade2a1a0 REVIEWED: IsImageReady() and IsTexureReady()
Reordered some functions to avoid config.h issues when disabling some features.
2023-02-21 13:20:04 +01:00
Ray
bcae065c88 REVIEWED: IsShaderReady() 2023-02-21 13:15:11 +01:00
Ray
1347a15539 ADDED: SetWindowIcons() to set multiple icon image sizes 2023-02-21 13:14:51 +01:00
hkc
d26a56d4e1 Added mixed audio processor (#2929)
* Use RL_QUADS/RL_TRIANGLES for single-pixel drawing

Addresses problem mentioned in
https://github.com/raysan5/raylib/issues/2744#issuecomment-1273568263
(in short: when drawing pixels using DrawPixel{,V} in camera mode,
upscaled pixel becomes a line instead of bigger pixel)

* [rtextures] Fixed scaling down in ImageTextEx

Closes #2755

* Added global audio processor

* Renamed struct member to follow naming conventions

* Added example for AttachAudioMixedProcessor
2023-02-20 11:13:24 +01:00
Ray
47dd842e81 Minor format tweaks 2023-02-15 18:11:46 +01:00
Ray
f594f14510 Reviewed typo and formating 2023-02-15 18:01:42 +01:00
Ray
2766835ed4 REPLACE: TABS by 4 spaces 2023-02-15 17:36:31 +01:00
Jeffery Myers
9eaed07b77 Make the oribital camera work like it used to (it is not just a copy of third person) (#2926) 2023-02-15 17:17:00 +01:00
Ray
beb44f1dac Avoid centering mouse when program launches 2023-02-15 13:11:26 +01:00
Ray
903d85e323 Make sure window position always inits in the middle of the current monitor 2023-02-15 12:53:41 +01:00
Ray
5dedb27ce0 REVIEWED: Issue with camera jump on first frame 2023-02-14 22:51:34 +01:00
veins1
ec95aa2e04 Move camera after rotation (#2923)
Moving camera after rotation is set to avoid 1 frame delay in movement direction
2023-02-14 22:29:32 +01:00
Ray
1cfb484100 ADDED: Example project to VS 2023-02-14 20:31:42 +01:00
Ray
e843be7ea5 ADDED: rcamera dependencies details 2023-02-14 20:13:13 +01:00
Ray
547819766f ADDED: Example project to VS2022 solution 2023-02-14 20:12:53 +01:00
Ray
50d17393a5 Create models_loading_m3d.vcxproj 2023-02-14 20:00:56 +01:00
Ray
ea590c44a9 REVIEWED: Camera redesign PR 2023-02-14 20:00:51 +01:00
Crydsch Cube
73989a4981 WIP rcamera redesign vector (#2563)
* core functionality CAMERA_FREE

* fix example

* add remaining camera modes

* add view bobbing

* view bobbing

* catch curser in SetCameraMode

* adjust examples

* fix compilation on linux

* fix example text_draw_3d

* actually fix text_draw_3d

* Updated camera API

* Improve Vector3RotateByAxisAngle() function

* remove camera.mode dependency from low-level functions

* remove camera.mode from struct

* fixes after rebase

* adjust examples for new UpdateCamera function

* adjust example models_loading_m3d

---------

Co-authored-by: Ray <raysan5@gmail.com>
2023-02-14 17:47:21 +01:00
Ray
f1bcabcc37 Update CHANGELOG 2023-02-12 13:48:11 +01:00
Ray
a9c28d7583 Update CHANGELOG 2023-02-12 13:46:26 +01:00
Ray
22287a78c5 Update qoa.h 2023-02-12 13:29:39 +01:00
Ray
96a9b4e1f2 REVIEWED: config.h format and inconsistencies 2023-02-12 13:28:35 +01:00
Ray
21961a786d REVIEWED: Vertex colors support on M3D loading #2878 2023-02-12 12:10:01 +01:00
Ray
4647441ad8 Update rl_gputex.h 2023-02-12 01:10:54 +01:00
BugraAlptekinSari
4ae0a416f4 Added raymarch example and thumbnail for write depth (#2919) 2023-02-11 13:37:50 +01:00
Julio C. Galindo
6ae21d6581 Fixed some grammar mistakes and typos. (#2914)
* Fixed some grammar mistakes.

* Fixed some typos.
2023-02-09 13:17:47 +01:00
Sasquatch ヽ(´ー` )┌
5c6a756014 Update raylib-hx bindings to 4.2 in BINDINGS.md (#2916) 2023-02-08 13:45:34 +01:00
Nikolas
f784961b9c Enable GetWindowHandle() on macOS (#2915) 2023-02-07 22:18:14 +01:00
Ray
e187b693ea Update raudio.c 2023-02-06 11:02:46 +01:00
star-tek-mb
04ab76b889 zig build: do not use deprecated functions (#2913) 2023-02-06 10:28:24 +01:00
Ray
1fea266472 Clean trailing spaces 2023-02-05 16:30:23 +01:00
Ray
c91190fc6e Review QOA sound loading -WIP- 2023-02-05 16:28:04 +01:00
star-tek-mb
ff70a04bf5 update zig build to latest master (#2910)
also, adds package manager support
2023-02-05 13:03:03 +01:00
Ray
60d0ab418a some typos review 2023-02-05 11:44:12 +01:00
HKrogstie
8c50da167d fix DrawMesh using SHADER_LOC_COLOR_SPECULAR as a material map (#2908) (#2909) 2023-02-05 11:04:30 +01:00
Ray
589892af07 Support QOA audio format on ExportWave() -WIP- 2023-02-04 20:27:47 +01:00
Ray
901c4553d2 ADDED: QOA audio format support -WIP- 2023-02-04 20:20:21 +01:00
Ray
43e45cbb81 Replace TABS by 4 spaces 2023-02-04 20:19:51 +01:00
Ray
7914332c40 Update qoi.h 2023-02-03 14:54:28 +01:00
Ian McFarlane
b9e49cdca6 rcamera: move y clamp to before 3d projection (#2905) 2023-02-03 14:52:15 +01:00
Antonis Geralis
212f331583 Update core_input_gamepad.c (#2903) 2023-02-01 15:13:25 +01:00
Ray
d827a65e59 Update external libraries
Switch to official `stb_vorbis.c` instead of using an outdated fork
2023-02-01 11:45:42 +01:00
Ray
a151cbd37a ADDED: Vector2LineAngle() #2887
REVIEWED: `Vector2Angle()`
2023-02-01 11:18:55 +01:00
Nikolas
89171a2608 Add WASM support for Zig build (#2901)
* Add WASM support for Zig build

* Improve Web example building

* Remove emscript example building with Zig again

* Readd windows emscripten variables
2023-02-01 11:09:03 +01:00
Ray
c94c666d04 Review formatting for M3D loading vertex colors 2023-01-30 17:05:12 +01:00
Uneven Prankster
929a46cbab [models] Fix M3D vertex color import. (#2878)
* Fix vertex color import for .m3d

* Only load vertex colors when color map and/or materials are present

* Only execute when color array is present

---------

Co-authored-by: Uneven Prankster <unevenprankster@pm.me>
2023-01-30 17:00:39 +01:00
Dor Shapira
df5a736c00 fix typo (#2899)
patrix=>matrix
2023-01-28 19:26:41 +01:00
Rob Loach
7fff1ba0b0 ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895) 2023-01-28 12:13:09 +01:00
Antonis Geralis
0b42da4085 Raylib.h has exceeded 512 functions! (#2896) 2023-01-27 23:33:15 +01:00
Rob Loach
83ff7b2466 ADDED: IsShaderReady(), IsImageReady(), IsFontReady(), IsWaveReady(), IsSoundReady(), IsMusicReady() (#2892)
These IsReady() functions provide a method in order to verify whether or not the object was loaded successfully. They're useful to make sure the assets are there prior to using them.
2023-01-27 19:24:03 +01:00
Jeffery Myers
81ca2f0bf3 Fix warnings and bad project settings for 4.5 release (#2894) 2023-01-27 19:20:42 +01:00
Ray
af66e751db Update CHANGELOG 2023-01-26 23:20:14 +01:00
Ray
000cb5a47d Update CHANGELOG 2023-01-26 23:18:06 +01:00
Kenta
f088548261 Update BINDINGS.md (#2889)
Update Kaylib license to Zlib
2023-01-26 10:52:59 +01:00
Ray
0125790801 Update rmodels.c 2023-01-25 23:13:17 +01:00
Jeffery Myers
63da7cdec6 add include guards on config.h (#2888) 2023-01-25 22:26:03 +01:00
Antonis Geralis
4adba0d3c3 Add wayland support (#2883) 2023-01-25 22:25:25 +01:00
Dor Shapira
7cdffcec52 fixed typo (#2886)
pilepine=>pipeline
chosing=>choosing
additioanlly=>additionally
attachmment=>attachment
initialize=>inititialize
Binded=>Bound
lattest=>latest

hi @raysan5, I ran rlgl.h into some "typo checking" program(basically a JetBrains IDE), and here are all the things that the program was able to spot and fix. as my English isn't really well I would like it if you could check that I didn't make any mistakes in the typo fixing...
2023-01-24 23:43:09 +01:00
Ray
f68bb8c707 REVIEWED: rlGenTextureMipmaps(), GPU generation only 2023-01-24 17:17:25 +01:00
Ray
5149da5719 Merge branch 'master' of https://github.com/raysan5/raylib 2023-01-24 17:16:44 +01:00
Ray
5b3c5e1a16 REVIEWED: ProcessMaterialsOBJ() available when required 2023-01-24 17:16:35 +01:00
PencilAmazing
542ef8904a [models] Load bone names from IQM file if available (#2882)
* Load bone names from IQM file if available

* Formatting and default bone name
2023-01-23 19:55:02 +01:00
Ray
393a03a46e Removed twitter badge, twitter API seems to be limited 2023-01-23 15:28:45 +01:00
Rob Loach
4706891cae Add RAYLIB_VERSION numbers to raylib.h (#2856)
Ran into an issue in raylib-cpp where a user was using raylib 4.5-dev, even though the library currently only targets 4.2. With having RAYLIB_VERSION_MAJOR and RAYLIB_VERSION_MINOR, we will be able to target different versions of raylib in different ways, via C preprocessor conditionals.

For example:
``` c
newColor = ColorTint(BLUE, RED);
TraceLog(LOG_INFO, "The color should be tinted, but this isn't supported in ryalib <= 4.2");
```
2023-01-22 15:29:29 +01:00
Rob Loach
d8af76f67c Fix to use TRACELOG() instead of TraceLog() for internal modules (#2881)
There were a few raylib modules that continued to use TraceLog() instead of the TRACELOG() macro. This change ensures that all the internal raylib modules use the TRACELOG() pattern consistently.
2023-01-22 11:10:38 +01:00
Ray
78ae3b38a6 minor format tweak 2023-01-21 19:31:47 +01:00
Antonis Geralis
e539aad118 Fix android sound issue #2118 (#2875) 2023-01-21 18:52:31 +01:00
Uneven Prankster
19715546b3 Stub out rlCubemapParameters if under GL 1.1. (#2876)
Co-authored-by: Uneven Prankster <unevenprankster@pm.me>
2023-01-21 18:51:33 +01:00
KOLANICH
342b18da03 Add packaging for distros with deb- and rpm-based packages. (#2877) 2023-01-21 18:50:38 +01:00
Jeffery Myers
c649bec26c Have LoadMaterials call the same code that OBJ loader does so that we can read MTL files (#2872) 2023-01-20 16:13:19 +01:00
Masoud Naservand
e64606a82f Correct the set paths in bat files in examples/ (#2870)
Co-authored-by: Masoud Naservand <masoud.naservand@gmail.com>
2023-01-20 16:07:43 +01:00
Jeffery Myers
edaca16d7c Fix warnings in raylib project from MSVC (#2871) 2023-01-20 16:05:19 +01:00
Jeffery Myers
116603e61c don't try to free a void* buffer as if it's a cgltf_data structure (#2867) 2023-01-19 21:21:05 +01:00
Uneven Prankster
76468bb8d8 Add rlCubemapParameters to rlgl.h (#2862)
Co-authored-by: Uneven Prankster <unevenprankster@pm.me>
2023-01-19 20:53:30 +01:00
Ghost
2a2f2b20b8 Fixed bug : touches become sticky (#2857)
Touches became sticky and didn't disappear after using more than 2 fingers, fixed by getting the touch count of how many fingers are on the screen, and only looping through the available/pressed down touch points instead of looping through the maximum touch points.
Tested with more than 10 touch points, and with different MAX points value, working perfectly.
2023-01-14 19:41:42 +01:00
Kenta
aed131a8f0 Update BINDINGS.md (#2858)
* Update BINDINGS.md

Add Kaylib - Kotlin/Native binding for 4.5-dev (proper binding).
Add Raylib-Nelua - Nelua binding for 4.5-dev with working wasm export.

* Update BINDINGS.md
2023-01-14 19:40:48 +01:00
Tobias Mock
d224414eb1 Update raylib-ocaml to 4.2.0 (#2853) 2023-01-11 18:07:35 +01:00
Daijiro Fukuda
c6376acfc4 Set initial window position for display-sized fullscreen (#2742) 2023-01-10 12:45:53 +01:00
Ray
3028bffd4c Minor tweaks 2023-01-10 12:38:21 +01:00
Go Watanabe
f549f67be9 OpenGLES 2.0 support on PLATFORM_DESKTOP (#2840)
* OpenGLES 2.0 support on PLATFORM_DESKTOP

* exmples raylib_opengl_interop desktop GLES2 support

* rename gles2.h -> glad_gles2.h
2023-01-10 12:34:06 +01:00
Ray
6dd1d2d931 ADDED: Required define on Linux #2729 2023-01-10 12:20:45 +01:00
Ray
bba6ae5622 RENAME: type to projection #2851 2023-01-10 12:16:42 +01:00
Ray
ce8000ee7e REVIEWED: GetClipboardText() on PLATFORM_WEB 2023-01-04 20:13:44 +01:00
Ray
89755e52bf REVIEWED: rLoadTextureDepth() fixed issue 2023-01-04 17:35:51 +01:00
Ray
73234d2a28 Avoid trying to setup uniform for invalid locations 2023-01-03 17:44:06 +01:00
Ray
39f9045703 Update models_loading_gltf.c 2023-01-02 20:59:25 +01:00
Ray
b854909803 Update models_loading_gltf.c 2023-01-02 20:48:02 +01:00
Ray
d3c1a04983 REVIEWED: GLTF animations support #2844 2023-01-02 20:46:33 +01:00
Charles
f2e3d6eca7 [models] Add GLTF animation support (#2844)
* add GLTF animation support

* use correct index when allocating animVertices and animNormals

* early exit LoadModelAnimationsGLTF if the gtlf file fails to parse

* update models/models_loading_gltf.c to play gltf animation

Updated the .blend file to use weights rather than bone parents so it
fits into the framework. Exported with weights to the .glb file.

* fix order of operations for bone scale in UpdateModelAnimation

* minor doc cleanup and improvements

* fix formatting

* fix float formatting

* fix brace alignment and replace asserts with log messages
2023-01-02 20:23:48 +01:00
Ray
fabedf7636 Merge branch 'master' of https://github.com/raysan5/raylib 2023-01-02 17:06:55 +01:00
Ray
62f63f9e48 REVIEWED: Avoid possible gamepad index as -1 #2839
WARNING: It could require further review of `GamepadThread()` function where `js_event gamepadEvent.number` detecting current pressed button could generate a missmatch with index 0 (reserved for button unknow). Or maybe `0` could just be `GAMEPAD_BUTTON_NONE`? In that case, consistency with other inputs should be carefully considered...
2023-01-02 17:06:52 +01:00
Antonis Geralis
1dbcce8b56 Use explicit atomics (#2849)
* Use explicit atomics

* missed one

* use relaced ordering
2023-01-02 16:48:53 +01:00
Ray
0ccc1d3686 Update year to 2023 2023-01-01 19:07:58 +01:00
Ray
5ba41e4f7f REVIEWED: shaders_write_depth example 2023-01-01 18:31:03 +01:00
BugraAlptekinSari
3cfb9a6e83 [example] Writing into the depth buffer (#2836)
* Add a depth buffer example.

* Fixed a typo
2023-01-01 18:17:28 +01:00
Ray
30b75702df Update year to 2023 2023-01-01 18:09:22 +01:00
Ray
e2a8066fca Update year to 2023 2023-01-01 16:07:51 +01:00
Ray
b59fab7ee6 Update year to 2023 2023-01-01 16:00:56 +01:00
Wytek01
713e26332f Update year to 2023 (#2846)
* Update year to 2023

* Update raylib.h year to 2023
2023-01-01 12:55:49 +01:00
Antonis Geralis
ba38fe5b97 core_loading_thread example join thread on completion (#2845)
* core_loading_thread example join thread on completion

* error checking
2022-12-31 19:25:35 +01:00
turborium
dbdbbea471 Add new Delphi/Lazarus bindings (#2838)
TurboRaylib - dynamic bindings of ray lib for Delphi/Lazarus
2022-12-28 11:04:55 +01:00
Ray
03cc540d5f Minor tweak 2022-12-18 18:00:21 +01:00
Ray
d7f7c94c4d REVIEWED: Vector2Angle() 2022-12-18 18:00:14 +01:00
Ray
72b9f3c5de Minor tweaks 2022-12-17 12:15:19 +01:00
Antonis Geralis
d1a104bba4 Fix vector2angle (#2832)
* Fix vector2angle

* Fix ;

* use acosf

* need a break

* add comments
2022-12-17 12:13:40 +01:00
Ray
c2b56c583a Merge branch 'master' of https://github.com/raysan5/raylib 2022-12-14 13:00:29 +01:00
Ray
619331f4a7 REVIEWED: Issue with depth textures on WebGL #2824 2022-12-14 12:57:39 +01:00
Alexander Heinrich
3419aef677 Fix Vector2Angle() (#2829)
With this fix the function still returns negative values, which is
wrong. But we keep this behaviour to maintain backwards compatibility.
2022-12-13 18:59:00 +01:00
Ray
445ce51e51 Update Makefile 2022-12-13 10:46:49 +01:00
simendsjo
884d30b85a Use GLVND also for old cmake versions (#2826)
Use GLVND also when legacy implementations exist for old cmake versions
<= 3.10. This is a breaking change for old cmake versions (prior to
around 2017-10-05) which will now use GLVND rather than defaulting to
libGL.

This fixes the following warning when building:

    CMake Warning (dev) at /gnu/store/qv13zgbmyx0vjav8iiqp772kp6rxvwnd-cmake-3.24.2/share/cmake-3.24/Modules/FindOpenGL.cmake:315 (message):
      Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
      available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.

      FindOpenGL found both a legacy GL library:

        OPENGL_gl_LIBRARY: /home/simendsjo/.guix-profile/lib/libGL.so

      and GLVND libraries for OpenGL and GLX:

        OPENGL_opengl_LIBRARY: /home/simendsjo/.guix-profile/lib/libOpenGL.so
        OPENGL_glx_LIBRARY: /home/simendsjo/.guix-profile/lib/libGLX.so

      OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
      compatibility with CMake 3.10 and below the legacy GL library will be used.
    Call Stack (most recent call first):
      cmake/LibraryConfigurations.cmake:21 (find_package)
      src/CMakeLists.txt:46 (include)
    This warning is for project developers.  Use -Wno-dev to suppress it.

See https://cmake.org/cmake/help/latest/policy/CMP0072.html

Closes #2825
2022-12-11 13:37:38 +01:00
Ray
c04c3668cb Update windows.yml 2022-12-10 13:09:05 +01:00
Ray
855a5f3701 Update windows.yml 2022-12-10 13:06:13 +01:00
Ray
6d59a21e99 Update windows.yml 2022-12-10 13:01:57 +01:00
Ray
935a306b29 Update windows.yml 2022-12-10 12:44:25 +01:00
Ray
2c9d116a5c ADDED: ColorTint(), ColorContrast() 2022-12-07 12:52:42 +01:00
Ray
f1368c36dd ADDED: ColorBrightness() 2022-12-05 00:24:55 +01:00
Ray
4de64f5750 Expose OpenGL blending mode factors and functions/equations 2022-12-04 13:22:37 +01:00
Ray
89698844a1 REVIEWED: Example: textures_textured_curve 2022-12-04 11:01:59 +01:00
Jeffery Myers
57dd345dc3 Add a textured curve example (#2821) 2022-12-03 22:55:05 +01:00
Ray
5b5dff3f9e format tweak 2022-12-02 11:59:54 +01:00
Ray
a4079ad565 Update Makefile 2022-12-02 11:59:43 +01:00
Hristo Iliev
387c060006 Fix an issue when compiling for web (#2820)
It would try to use the glfw on the system but we're cross-compiling for web where the implementation is provided by emscripten's team
2022-11-30 10:36:01 +01:00
Ray
0b6d4b376f REVIEWED: Image fileformat support: PIC, PNM 2022-11-29 17:28:23 +01:00
Ray
d241ee8516 ADDED: Optional support for PNM images (.ppm, .pgm) 2022-11-29 10:58:27 +01:00
Ray
2edf5a9584 REVIEWED: Issue with shader linkage 2022-11-29 10:45:10 +01:00
jtainer
50a716c0d9 Updated rcore.c, renamed 'time' to 'nanoSeconds' (#2816)
* Updated rcore.c, renamed 'time' to 'time_nsec'

When PLATFORM_ANDROID, PLATFORM_RPI or PLATFORM_DRM were defined, there is a compilation error to redefinition of the variable 'time', so the second instance of 'time' was changed to 'time_nsec' which both fixes the name collision and more accurately describes what that variable represents.

* Renamed 'time_nsec' to 'nanoSeconds'
2022-11-29 00:46:10 +01:00
Daijiro Fukuda
57bd84510f Fix wrong compile definition (#2815) 2022-11-28 22:36:22 +01:00
Daijiro Fukuda
66a2cdee40 Fix array out of range (#2814)
This breaks other values of the struct.
2022-11-28 22:35:44 +01:00
Ray
bbf9935828 Update github workflows 2022-11-28 21:03:21 +01:00
Ray
fc5894e734 REVIEWED: Some compilation warnings (for strict rules) 2022-11-28 14:16:59 +01:00
Antonis Geralis
2fd6d7e8c0 Use const for pointer float array (#2807)
* Use const for pointer float array

* missed a definition
2022-11-24 00:58:56 +01:00
Antonis Geralis
2c77b31e30 Correct types for rlBindImageTexture (#2808) 2022-11-24 00:58:31 +01:00
gtrxAC
c48de2d1af Rename lighting_instanced shader (glsl100) to lighting_instancing (#2805)
* JSON parser: Use array for function params (#2255)

* Parser: follow C convention of type before name

* Update file names in build scripts

* Rename lighting_instanced shader to instancing
2022-11-22 18:16:44 +01:00
Ray
c0010105c2 REVIEWED: UnloadDirectoryFiles() 2022-11-22 17:09:39 +01:00
Ray
f6558fe6e0 Minor tweaks 2022-11-22 01:02:54 +01:00
Alex Macafee
36bb57d1be Add raylib-vapi (#2804) 2022-11-21 13:14:20 +01:00
Ray
e6306e5e76 REVIEWED: rlCullFace() -> rlSetCullFace()
Reviewed formating to follow raylib coding conventions.
2022-11-15 12:34:01 +01:00
jtainer
2761aa40dd Added function rlCullFace (#2797)
rlCullFace sets the face culling mode to RL_FRONT or RL_BACK which correspond to GL_FRONT and GL_BACK respectively.
2022-11-15 12:30:32 +01:00
Pere001
c8fd93d356 Warning on GetRandomValue range limit (#2800)
Added a comment explaining the range limitations of GetRandomValue.
Added a run-time warning TRACELOG when GetRandomValue is called with an invalid range.
2022-11-15 12:29:19 +01:00
Ray
2604b9f72b Merge branch 'master' of https://github.com/raysan5/raylib 2022-11-15 12:26:30 +01:00
Ray
3c51d066f1 Avoid using DrawCubeTexture() 2022-11-15 12:26:22 +01:00
Ray
656f47b7cc Update cmake.yml 2022-11-15 12:23:24 +01:00
Ray
2a88dc9bb7 Update linux_examples.yml 2022-11-15 12:22:26 +01:00
Ray
fadc29d811 WARNING: REMOVED: DrawCubeTexture(), DrawCubeTextureRec()
Those two functions have been moved to a new example: `models_draw_cube_texture`. The reasons for this decision:
 - Function inflexibility: Many users with the need to draw a textured cube could need to customize the texture applied to every face, that function did not allow that kind of functionality.
 - rlgl functionality exposure: The implementation exposed will teach users how to implement custom textured triangles drawing.
2022-11-15 12:16:28 +01:00
Jorge A. Gomes
4bb71c8fa2 Raylib-py updated to 4.2, plus parallel project (#2798)
Now Raylib-py is a releases-only project.
For now on, code maintenance will happen in a parallel project created to automate the binding generation: RaylibpyCtbg
2022-11-12 18:56:54 +01:00
Scott Helvick
baabe22f7a Add Claylib (CL bindings + convenience layer) (#2796) 2022-11-11 17:23:02 +01:00
Ray
025db8f227 Merge branch 'master' of https://github.com/raysan5/raylib 2022-11-10 12:03:26 +01:00
Ray
31edd13a72 Minor formating tweaks 2022-11-10 12:03:17 +01:00
Julianiolo
82e0644195 Fix Makefile emscripten path (#2785) 2022-11-10 11:51:51 +01:00
Ray
3888299bf5 WARNING: REMOVED: DrawTextureTiled()
This function implementation has been moved to the related example. Current implementation can be probably customized depending on user needs.
2022-11-10 10:17:37 +01:00
Ray
7f68c65406 WARNING: REMOVED: DrawTextureQuad()
This function can be easely replicated using `DrawtexturePro()` and actually it was doing some assumptions not transparent to the user. Even the function name was confusing. No example was available for it and actually noone requested one example.
2022-11-10 10:11:28 +01:00
Ray
84a2a88572 WARNING: REMOVED: DrawTexturePoly()
Function moved to `examples/textures/textures_polygon.c`, so users can learn from the implementation and create custom variants as required.
2022-11-10 10:05:11 +01:00
red thing
fca58c8e2f dray is now 4.2.0 (#2792) 2022-11-09 07:42:58 +01:00
Martin Wickham
311a57f9fc Add frameworks needed on macos (#2793) 2022-11-09 07:40:59 +01:00
Dor Shapira
773c0d78d8 removing typo (#2790) 2022-11-08 21:47:05 +01:00
Ray
ca6f58eed1 Update rcore.c 2022-11-05 00:31:13 +01:00
RGDTAB
dbdfad7ace Fix ExportDataAsCode() data types (#2787) 2022-11-04 20:39:04 +01:00
Roman Akberov
1cb81e3f4c Fix examples/build.zig for the latest Zig version (#2786) 2022-11-02 18:41:21 +01:00
IsaacTCB
4c4a703841 Fix Android x86 Architecture name (#2783)
When building a x86 project, the folder inside lib is named i686. However Android x86 actually expects the folder to be called x86.
2022-10-30 12:18:12 +01:00
Angga Permana
d91f30958f Fix deprecation error on android api higher than 23 (#2778) 2022-10-27 11:38:25 +02:00
nobytesgiven
5113817507 Improved billboards example, highlighting rotation and draw order (#2779)
* Improved billboards example, highlighting rotation and draw order

* changes to conform to the raylib conventions

* NOW it conforms

Co-authored-by: nobytesgiven <nobytesgiven@users.noreply.github.com>
2022-10-26 19:16:35 +02:00
Ray
28e8b2add3 REVIEWED: Issue with OpenURL() 2022-10-26 18:04:20 +02:00
Dor Shapira
bcb47255b9 fixing typo (#2781)
fixing typo
2022-10-26 17:14:52 +02:00
Dor Shapira
bc60812d68 added raylib-python-ctypes bindings (#2780) 2022-10-26 17:14:24 +02:00
Yunoinsky
df4199e2c1 Add ChezScheme support (#2776) 2022-10-26 09:12:14 +02:00
nobytesgiven
c4abf68351 fixed blur issue on opaque pictures & added example (#2775)
Co-authored-by: nobytesgiven <nobytesgiven@users.noreply.github.com>
2022-10-26 09:11:14 +02:00
Ray
865f823835 Review -s 2022-10-25 21:03:33 +02:00
nobytesgiven
dbecb95024 Added Box and Gaussian blurring (#2770)
* Added Box and Gaussian blurring

* Removed dependence of gaussian blur to box blur & Fixed precision errors

Co-authored-by: nobytesgiven <nobytesgiven@users.noreply.github.com>
2022-10-25 17:56:06 +02:00
Ian Rash
072e92615a Updated support for crystal (#2774)
All fresh and current.
2022-10-25 10:51:40 +02:00
nobytesgiven
e5d332dea2 Fix bezier line breaking #2735 (#2767)
* Fixed bezier line breaking #2735

* converted tabs to spaces

* typo

* Changed doubles to floats

* removed heap allocations\

Co-authored-by: nobytesgiven <nobytesgiven@users.noreply.github.com>
2022-10-24 16:35:47 +02:00
Ray
d5cd5ebd80 Update to latest miniaudio (dev) 2022-10-24 13:37:20 +02:00
Ray
d71505bdc6 Update Makefile 2022-10-24 13:37:08 +02:00
Ray
483f10397e review note 2022-10-20 20:09:54 +02:00
Ray
d9f434afb9 Added -s EXPORTED_RUNTIME_METHODS=ccall to examples web build #2739 2022-10-20 20:07:29 +02:00
InKryption
40cf84e7e5 build.zig: let user decide how to set build mode + fix linker warning (#2763)
* build.zig: let user decide how to set build mode

This should delegate the responsibility of calling `standardReleaseOptions` and setting the build mode of the `*LibExeObjStep` step to the caller, especially since this might not be the process by which one wants to determine the build mode.

Also changes hides `getSrcDir` to enforce usage of `srcdir`, and asserts that the file is in fact inside a directory.

* build.zig: set root_src param to `null`

Supplying the header file as the root source here appears to cause a linker warning of the form:
```
LLD Link... warning(link): unexpected LLD stderr:
ld.lld: warning: {build_root}/zig-cache/o/{hash}/libraylib.a: archive member '{build_root}/zig-cache/o/{hash}/raylib.o' is neither ET_REL nor LLVM bitcode
```
Passing `null` instead fixes it.
2022-10-20 18:33:12 +02:00
Peter0x44
b8e14a4f99 Review parser Makefile (#2765)
* parser: Fail gracefully if a nonexistent file is passed on the command line

Before, if a nonexistent file was passed to LoadFileText(), it would
return NULL, and the parser would happily dereference it.

* parser: Refactor Makefile and update the path to easings.h (now reasings.h)

Before, the `make all` target would simply segfault, see 0a679d79
Now, if a file in the `make all` target doesn't exist, make will write
an error.

Individual API files can be generated likeso, provided the header file
the target depends on exists:

FORMAT=JSON EXTENSION=json make raygui_api.json

In order for the `make all` target to succeed, raygui.h, physac.h and
rmem.h need to be added to the correct directory.
2022-10-20 17:29:03 +02:00
ianband
7e7939e1ad Add DrawCapsule(Wires) (#2761)
* Add DrawCapsule & DrawCapsuleWires

* Add DrawCapsule & DrawCapsuleWires to example

Co-authored-by: Ian Band <ian.r.band@gmail.com>
2022-10-17 11:36:53 +02:00
Rob Loach
c5e89241c5 BINDINGS: Add Umka bindings to BINDINGS.md (#2760)
[raylib-umka](https://github.com/robloach/raylib-umka) provides [Umka scripting language](https://github.com/vtereshkov/umka-lang) bindings to raylib.
2022-10-16 00:25:52 +02:00
hkc
0b69bc28c6 Fix ImageTextEx and ImageDrawTextEx scaling (#2756)
* Use RL_QUADS/RL_TRIANGLES for single-pixel drawing

Addresses problem mentioned in
https://github.com/raysan5/raylib/issues/2744#issuecomment-1273568263
(in short: when drawing pixels using DrawPixel{,V} in camera mode,
upscaled pixel becomes a line instead of bigger pixel)

* [rtextures] Fixed scaling down in ImageTextEx

Closes #2755
2022-10-14 17:43:12 +02:00
Ray
e61639f6fc ADDED: GenImageText()
Probably useless but interesting for education. It generated a grayscale image directly from text data.
2022-10-14 10:51:43 +02:00
Kenta
ccd4f8b5ae Add C3 binding to BINDINGS.md (#2757) 2022-10-13 23:00:53 +02:00
Anut-py
11fd883ee4 Add Haskell bindings to BINDINGS.md (#2753) 2022-10-12 22:04:11 +02:00
CrezyDud
aa67f7c39a Fix & Simplify .vox signature check (#2752)
and make version check be only 150 not over 150
2022-10-12 17:14:18 +02:00
hartmannathan
f080367a0c examples/core/core_custom_logging.c: Fix typo (#2751) 2022-10-12 17:12:28 +02:00
Ray
07bbfe86b9 Update core_basic_window.c 2022-10-11 22:28:40 +02:00
hkc
8ebe62b4dd Use RL_QUADS/RL_TRIANGLES for single-pixel drawing (#2750)
Addresses problem mentioned in
https://github.com/raysan5/raylib/issues/2744#issuecomment-1273568263
(in short: when drawing pixels using DrawPixel{,V} in camera mode,
upscaled pixel becomes a line instead of bigger pixel)
2022-10-11 18:45:34 +02:00
Szieberth Ádám
4cca234f46 avoid leading spaces in text_rectangle_bounds (#2746) 2022-10-11 12:14:40 +02:00
Dor Shapira
0d04ceafbf build raylib_api without the 'vectex' tyops (#2749) 2022-10-11 12:14:01 +02:00
Dor Shapira
8025b052b3 fixing typo (#2748) 2022-10-11 11:20:29 +02:00
JupiterRider
cb085a1b50 Update BINDINGS.md (#2745) 2022-10-07 19:03:08 +02:00
Ray
cee0fc5d78 Update README.md 2022-10-07 16:33:39 +02:00
Ray
38025362ee Update version to raylib 4.5-dev to avoid confusions with 4.2 2022-10-07 16:22:44 +02:00
Ray
7a15861d44 Update rlgl.h 2022-10-06 00:56:18 +02:00
Ray
26969c2c38 Added BLEND_CUSTOM_SEPARATE #2741 2022-10-05 13:57:38 +02:00
Ray
25d846aa9a Avoid early return calls 2022-10-05 13:34:19 +02:00
Ray
9017be3259 Reviewed latest PR formating and variables naming #2741 2022-10-05 13:29:34 +02:00
凌溢狐
2d88958d35 Add rlSetBlendFactorsSeparate and custom blend mode modification checks (#2741) 2022-10-05 13:05:44 +02:00
Ray
2e26cf48e8 Merge branch 'master' of https://github.com/raysan5/raylib 2022-10-03 00:07:34 +02:00
Ray
7459d906de Update rtext.c 2022-10-03 00:07:22 +02:00
_Tradam
62d228346b Update build.zig to work with last GLFW update (#2737) 2022-10-02 20:29:48 +02:00
veins1
2872b2fff5 Clear PCM buffer state when closing audio device (#2736)
Fix for #2714
2022-10-02 19:30:26 +02:00
Ray
33e7f7cc59 WARNING: DrawLineBezier() implementation needs review #2721 2022-10-02 11:11:13 +02:00
Rob Loach
0daaaddeef Fix Gestures to use GetTime() if it's available (#2733) 2022-10-02 10:47:17 +02:00
Random
03f5fce672 removed glfwSetWindowPos on InitWindow (#2732)
* removed glfwSetWindowPos on InitWindow

* removed execute permission from CMakeLists
2022-10-02 10:46:33 +02:00
Ray
178a356cb4 minor tweaks 2022-09-30 23:07:29 +02:00
Random
f14955512f fix issue #2728 (#2731)
* fix issue #2728

* updated gamecontrollerdb: fixes GLFW warning due to invalid entry
2022-09-30 10:09:49 +02:00
Ray
45da03df23 Reviewed monitor checking order 2022-09-29 12:00:20 +02:00
Ray
4fe6f885f7 Update gamepad mappings with latest gamecontrollerdb, fix #2725 2022-09-29 11:23:25 +02:00
Ray
357f782f4e Merge branch 'master' of https://github.com/raysan5/raylib 2022-09-29 11:08:02 +02:00
Ray
0ced04f0df Fix #2722 2022-09-29 11:08:00 +02:00
Dor Shapira
587e61def9 fixing new typoes (#2727) 2022-09-28 20:04:59 +02:00
Dor Shapira
5c404c79da Update raylib.h (#2726) 2022-09-28 20:04:41 +02:00
Michael Scherbakow
8f88c61bdf update build.zig (#2720)
zig `master` now enforces to use addIncludePath instead of addIncludeDir
2022-09-27 01:27:22 +02:00
bXi
e9ca38fafa Clarified working of ImageDrawCircle and ImageDrawCircleV (#2719) 2022-09-26 12:24:10 +02:00
Ray
7ab056b6ef REVIEWED: GeneshHeightmap(), fix #2716 2022-09-25 15:41:49 +02:00
Ray
2ef0b064e5 Fix isssue #2718 2022-09-25 14:09:28 +02:00
Ray
ea87491a82 ADDED: Support CAPS/NUM lock keys registering if locked 2022-09-25 00:14:59 +02:00
Ray
810a0330ab WARNING: Several changes on UTF-8/Codepoints API
- ADDED: `GetCodepointPrevious()`
 - RENAMED: `GetCodepoint()` -> `GetCodepointNext()`, actually, reimplemented
 - `GetCodepoint()` has been kept for the moment, for compatibility and also because implementation is different
 - RENAMED: `TextCodepointsToUTF8()` to `LoadUTF8()`, simpler name and more aligned with raylib conventions (functions loading memory start with Load*()), parameters should be descriptive of functionailty.
 - ADDED: `UnloadUTF8()`, aligned with `LoadUTF8()` to avoid allocators issues.
2022-09-22 20:35:55 +02:00
Ray
4b1d4b4f6b Update rcore.c 2022-09-22 20:30:02 +02:00
Ray
907e9e1fe2 Update text_codepoints_loading.c 2022-09-22 20:29:54 +02:00
Ray
4311ffc9e1 REVIEWED: New functions coding conventions 2022-09-19 18:47:16 +02:00
Rob Loach
2093fdcc53 Added: ImageDrawCircleLines, ImageDrawCircleLinesV (#2713)
This adds `ImageDrawCircleLines()` and `ImageDrawCircleLinesV()` to draw outlines of circles, and updates `ImageDrawCircle()` draw a filled circle to match the effect of `DrawCircle()` and `DrawCircleLines()`.
2022-09-19 18:41:17 +02:00
Ray
0e5cd442be REVIEWED: Renamed some shaders, fix #2707 2022-09-19 18:29:08 +02:00
Ray
5530a3ceb8 REVIEWED: ScanDirectoryFilesRecursively(), fix #2704 2022-09-19 18:20:36 +02:00
Ray
6e8f3b0f45 Update rlgl.h 2022-09-19 10:35:34 +02:00
Ray
12e8cef9cf REMOVED: Mipmaps software generation for OpenGL 1.1
As generation is done in software, it's up to the user to do it. `ImageMipmaps()` is already provided for reference.
2022-09-19 10:31:55 +02:00
Denis Pobedrya
27781a4767 Remove touch points on touch up events on Android (#2711)
Fixes #2683

Remove elements from touch point related arrays when touch up and
similar events are processed. This makes GetTouchPointCount() always
report the actual count of touch points, and all positions returned by
GetTouchPosition() correspond to positions of currently happening
touches.
2022-09-18 23:01:10 +02:00
Gunko Vadim
7e3a50b4ac Update BINDINGS.md (#2710) 2022-09-18 22:36:59 +02:00
Nikolas
42ecd72547 [rlgl] Check for extensions before enabling them (#2706)
* [rlgl] Check for extensions before enabling them

* Shift to glad on macOS

* #undef CORE_OPENGL_33

* Remove version hack and fix ASTC compression assumption

* Remove loader from glad

* Use GLAD_MALLOC/FREE instead of malloc/free

* More explicit extension checking
2022-09-18 21:08:51 +02:00
Denis Pobedrya
8f597b3cc3 Basic gamepad support for Android (#2709)
Currently assumes a single gamepad, has no code specific to gamepad
detection (gamepad is "detected" when an event related to gamepad
arrives). Also assumes that all gamepads look roughly like an xbox/ps
controller. Both assumptions are not strictly true, but an
implementation like that probably covers 85% of usecases.

Also it doesn't update previousButtonState so functions
IsGamepadButtonPressed() and IsGamepadButtonReleased() don't work, but
they didn't work previously on Android anyway, and they are flaky on
desktop as they are now, so the mechanism for these two functions
probably should be reworked anyway.

It's certainly an improvement compared to the previous android gamepad
handling code, which put gamepad events into touch related structs.
2022-09-18 19:58:52 +02:00
Denis Pobedrya
ff25402f68 Fix viewport scaling bug on android after context rebind (#2703)
On android after rebinding context (which happens when you minimize and
navigate back to an app, or when you turn a screen off and back on)
there's a bug that viewport has a wrong scale and part of it is off
screen.

The change fixes it on devices I tried, but the solution feels hacky to
me. However when I attempted instead to call SetupViewport() again which
feels like a more proper solution, it didn't fix it.
2022-09-18 11:28:55 +02:00
Denis Pobedrya
8e57c8ace3 Fix touchscreen input related functions on Android (#2702)
Fix display -> screen coordinate conversion for android platform and
move it to the platform event handling code, simplifying
GetTouchPosition() function implementation.

Co-authored-by: Denis Pobedrya <denis.pobedrya@gmail.com>
2022-09-17 23:15:11 +02:00
AQuantumPotato
494a581339 Update BINDINGS.md (#2701)
Updated the list of projects that support 4.2
2022-09-17 23:14:00 +02:00
Rob Loach
4c3d577ddb CMake: Project template fix to easily target raylib version (#2700) 2022-09-17 23:12:57 +02:00
Ray
c328f09efc Move compressed textures loading to a separate self-contained library 2022-09-17 19:26:23 +02:00
Ray
cb9b8f73c0 ADDED: GenImagePerlinNoise() 2022-09-17 13:39:49 +02:00
murilluhenrique
eaa0b9102b Fix typo (#2696) 2022-09-16 00:06:25 +02:00
Nikolas
a12ddacb7b Enable DXT compression on __APPLE__ targets (#2694) 2022-09-12 12:21:41 +02:00
Ray
853c66baed REVIEWED: CheckCollisionPointPoly() 2022-09-10 23:56:52 +02:00
Ray
cf76d23476 Minor format tweaks 2022-09-10 10:23:38 +02:00
Ray
cf24c021a3 WARNING: BREAKING: Reviewed SSBO usage to avoid long long
raylib library tries to avoid `long long` usage. Several SSBO functions have been reviewed (including some renames for consistency) to minimize `long long` type usage.
2022-09-09 00:26:47 +02:00
Ray
b478364914 REVIEWED: Removed comment, fixes #2691 2022-09-09 00:04:08 +02:00
hartmannathan
c1b4881e8a examples/core/core_custom_logging.c: Fix typo (#2692) 2022-09-08 16:10:15 +02:00
Ray
ac1ffbad1d REVIEWED: Data type to unsigned 2022-09-07 00:39:38 +02:00
Ray
b09725fa84 REPLACED: rlVertex2i() by rlVertex2f() 2022-09-05 18:45:33 +02:00
Ray
e59442bfab REMOVED: rlPushMatrix()/rlPopMatrix() from rshapes
This simplification will allow the usage of `rshapes` as STANDALONE mode in a future. Only a small set of `rlgl` functions are required and they can be "more" easely replaced if no `rlPushMatrix()`/`rlPopMatrix()` are involved.

More simplification planned for the future, maybe the textures dependencies.
2022-09-05 18:23:25 +02:00
Ray
9996e328cb WARNING: BREAKING: Removed rlCheckRenderBatchLimit() requirement
Updated version to `rlgl 4.2`
2022-09-05 13:20:09 +02:00
Ray
ad5ffd78d6 REVIEWED: rlgl enums and comments 2022-09-05 11:15:28 +02:00
Ray
0917290e95 REVIEWED: M3D model loading #2688 2022-09-04 18:49:54 +02:00
Ray
ac3420faac Update core_custom_frame_control.c 2022-09-04 12:32:40 +02:00
skylar
ee5a87826d Fixed a bug in the 2d camera platformer example (#2687)
canJump used to alternate between true and false when on ground
2022-09-04 11:48:33 +02:00
Ray
f4b4054de5 REVIEWED: CheckCollisionPointPoly() 2022-09-04 10:45:01 +02:00
Jacek
aff98d7f2a Check collision point polygon (#2685)
* Update raylib.h

* CheckCollisionPointPolygon()

* typo
2022-09-04 10:39:03 +02:00
Ray
082920eb80 WARNING: RENAMED exported symbol to raylib_version #2671 2022-09-02 21:35:08 +02:00
Ray
de968e3623 WARNING: RENAMED symbol raylibVersion to raylib_version
I want to note this is a special symbol exported
2022-09-02 21:32:58 +02:00
Ray
2a798d64a2 Export raylibVersion symbol. Fixes #2671 2022-09-02 21:28:19 +02:00
Stan
234576da71 Removed raylib_opengl_interop.c from PLATFORM=Web build (#2682) 2022-09-02 09:13:35 +02:00
Ray
fb1037a241 ADDED: Complete support for M3D animations! #2648 2022-09-01 20:46:06 +02:00
Ray
64cca24526 ADDED: RL_TEXTURE_MIPMAP_BIAS_RATIO support to rlTextureParameters() for OpenGL 3.3 #2674 2022-09-01 11:18:22 +02:00
Ray
a598754b5b Update windows.yml 2022-09-01 11:04:10 +02:00
Ray
bb4d9297b5 Update windows.yml 2022-09-01 10:52:03 +02:00
Ray
4938966e76 Update windows.yml 2022-09-01 10:45:30 +02:00
Ray
cabaa53302 Update windows.yml 2022-09-01 10:44:25 +02:00
Ray
bfab101ac2 Update windows.yml 2022-09-01 10:42:11 +02:00
Ray
23cc39a265 Implemented latest .M3D improvements #2648 2022-09-01 10:27:16 +02:00
Ray
0c7ba773ec Fixed issue with LoadIQM() #2676 2022-09-01 10:14:45 +02:00
Ray
4b76aa09dd ADDED: lighting.fs for GLSL120 Fix #2651 2022-08-29 14:36:07 +02:00
Ray
d66692149b Update README.md 2022-08-28 18:04:47 +02:00
Ray
7f5567eec0 Reviewed GLFW compilation requirements on Linux: _GNU_SOURCE
Reasons to NOT define `_GNU_SOURCE`:

 - access to lots of nonstandard GNU/Linux extension functions
 - access to traditional functions which were omitted from the POSIX standard (often for good reason, such as being replaced with better alternatives, or being tied to particular legacy implementations)
 - access to low-level functions that cannot be portable, but that you sometimes need for implementing system utilities like mount, ifconfig, etc.
 - broken behavior for lots of POSIX-specified functions, where the GNU folks disagreed with the standards committee on how the functions should behave and decided to do their own thing.
2022-08-28 15:48:12 +02:00
Ray
be2328f848 Update Makefile 2022-08-28 15:39:22 +02:00
Ray
568fe42cb1 Reviewed GLFW issue with ppoll() function 2022-08-28 15:37:09 +02:00
Ray
482dbfc52e Avoid error on implicit-function-declaration 2022-08-28 15:28:57 +02:00
Ray
10ae54379a Update posix_poll.c 2022-08-28 15:25:34 +02:00
Ray
2236197d49 Update rglfw.c 2022-08-28 15:20:16 +02:00
Ray
9e0e08cba4 WARNING: UPDATED GLFW to latest master branch!
WARNING: This could be a BREAKING CHANGE for some platforms! I'm afraid something could be wrong on `rglfw.c` module.

To be able to compile on Windows I had to modify `glfw/src/platform.c` line 74. I couldn't manage to compile without that change, help is welcome!
2022-08-28 14:16:51 +02:00
Dmitry Matveyev
8508ae3d15 Update NimraylibNow! bindings version (#2667) 2022-08-28 13:35:39 +02:00
Milan Nikolic
99948a86e1 Update raylib-go bindings (#2665) 2022-08-27 18:07:30 +02:00
Ray
f66b1a3136 REVIEWED: Support M3D file loading #2648 2022-08-26 10:04:38 +02:00
Ray
ae745e4fa8 ADDED: -latomic library on Linux (only required for ARM32)
This linkage is only required for arm 32bit but I don't know how to detect that specific architecture in the Makefile...
2022-08-22 11:25:35 +02:00
Ray
e92bc8ca4e REVIEWED: M3D implementation #2648 2022-08-22 11:11:05 +02:00
Rodrigo Escar
aa4111a3b2 Fix PATH for Web target (#2647) 2022-08-21 11:45:37 +02:00
Daijiro Fukuda
7bb8ffc29e Win32: resolve some symbols re-definition of windows.h in glfw3native.h (#2643)
* Win32: resolve some symbols re-definition of windows.h in glfw3native.h

This reflects GLFW's fix: https://github.com/glfw/glfw/issues/1348

This enables to build with a external GLFW containing the
following fix:

* 05f6c13d11

Currently, glfw3native.h of the internal GLFW is customized at
2feea87b61

This fix is compatible with the current customized glfw3native.h.

This fix enables us to update it to the latest and remove the
customization.

* Win32: remove unneeded typedef
2022-08-21 11:44:16 +02:00
Rob Loach
e835311d0d BINDINGS: raylib-cpp has support for raylib 4.2 (#2652)
https://github.com/robloach/raylib-cpp
2022-08-21 11:43:27 +02:00
Ray
4ee5fdf619 ADDED: Support M3D model file format (meshes and materials) #2648 2022-08-20 14:01:54 +02:00
Ray
35c777ef2c REVIEWED: Avoid crash on bad data provided 2022-08-18 15:11:23 +02:00
Ray
904c505125 minor tweak 2022-08-18 15:10:40 +02:00
irishgreencitrus
d8ed3fb31e Update raylib.jl and raylib.v to 4.2.0 (#2644) 2022-08-17 16:36:03 +02:00
Ray
2ad7967db8 REVIEW: Fix issue with external GLFW missing define #2638 2022-08-17 10:19:52 +02:00
Michael Scherbakow
95d3a6ac52 update raylib.zig to 4.2 (#2642) 2022-08-15 23:55:58 +02:00
moosey
f049f9dd3a Tiny documentation fix in reasings.h (#2640) 2022-08-15 09:15:43 +02:00
WIITD
67f8424eb0 raylib-freebasic updated to 4.2 (#2639) 2022-08-15 09:12:30 +02:00
Ray
7db6fe02fd Fixed issue with new output format 2022-08-14 12:56:55 +02:00
348 changed files with 52816 additions and 22231 deletions

View File

@@ -82,7 +82,7 @@ jobs:
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.RELEASE_NAME }}.tar.gz name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz path: ./build/${{ env.RELEASE_NAME }}.tar.gz

View File

@@ -36,7 +36,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Create Build Environment - name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory # Some projects don't allow in-source building, so create a separate build directory
@@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Create Build Environment - name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory # Some projects don't allow in-source building, so create a separate build directory

View File

@@ -94,7 +94,7 @@ jobs:
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.RELEASE_NAME }}.tar.gz name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz path: ./build/${{ env.RELEASE_NAME }}.tar.gz

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Environment - name: Setup Environment
run: | run: |

View File

@@ -99,7 +99,7 @@ jobs:
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }} tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.RELEASE_NAME }}.tar.gz name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz path: ./build/${{ env.RELEASE_NAME }}.tar.gz

View File

@@ -29,7 +29,7 @@ jobs:
- name: Setup emsdk - name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11 uses: mymindstorm/setup-emsdk@v11
with: with:
version: 3.0.0 version: 3.1.30
actions-cache-folder: 'emsdk-cache' actions-cache-folder: 'emsdk-cache'
- name: Setup Release Version - name: Setup Release Version
@@ -69,7 +69,7 @@ jobs:
shell: cmd shell: cmd
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.RELEASE_NAME }}.zip name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip path: ./build/${{ env.RELEASE_NAME }}.zip

View File

@@ -33,12 +33,10 @@ jobs:
- compiler: mingw-w64 - compiler: mingw-w64
bits: 32 bits: 32
ARCH: "i686" ARCH: "i686"
COMPILER_PATH: "C:\\msys64\\mingw32\\bin"
WINDRES_ARCH: pe-i386 WINDRES_ARCH: pe-i386
- compiler: mingw-w64 - compiler: mingw-w64
bits: 64 bits: 64
ARCH: "x86_64" ARCH: "x86_64"
COMPILER_PATH: "C:\\msys64\\mingw64\\bin"
WINDRES_ARCH: pe-x86-64 WINDRES_ARCH: pe-x86-64
- compiler: msvc16 - compiler: msvc16
bits: 32 bits: 32
@@ -76,21 +74,38 @@ jobs:
# Setup MSBuild.exe path if required # Setup MSBuild.exe path if required
- name: Setup MSBuild - name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2 uses: microsoft/setup-msbuild@v1.1
if: matrix.compiler == 'msvc16' if: matrix.compiler == 'msvc16'
- name: Build Library (MinGW-w64) - name: Build Library (MinGW-w64 32bit)
run: |
cd src
x86_64-w64-mingw32-gcc.exe --version
windres.exe --version
dir C:\msys64\mingw64\bin
make PLATFORM=PLATFORM_DESKTOP CC=x86_64-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS=-m32
//windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
//make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 32
- name: Build Library (MinGW-w64 64bit)
run: | run: |
cd src cd src
set PATH=%PATH%;${{ matrix.COMPILER_PATH }}
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version ${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
${{ matrix.COMPILER_PATH }}/windres.exe --version windres.exe --version
dir C:\msys64\mingw64\bin
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
${{ matrix.COMPILER_PATH }}/windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }} windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
shell: cmd shell: cmd
if: matrix.compiler == 'mingw-w64' if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
- name: Build Library (MSVC16) - name: Build Library (MSVC16)
run: | run: |
@@ -118,7 +133,7 @@ jobs:
shell: cmd shell: cmd
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.RELEASE_NAME }}.zip name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip path: ./build/${{ env.RELEASE_NAME }}.zip

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Add MSBuild to PATH - name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1 uses: microsoft/setup-msbuild@v1

View File

@@ -6,43 +6,54 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| name | raylib version | language | license | repo | | name | raylib version | language | license | repo |
|:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------| |:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------|
| raylib | **4.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | | raylib | **4.2** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib |
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo | | raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo |
| Raylib-cs | **4.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs | | Raylib-cs | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs |
| Raylib-CsLo | **4.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo | | Raylib-CsLo | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo |
| cl-raylib | **4.0** | [Common Lisp](https://common-lisp.net/) | MIT | https://github.com/longlene/cl-raylib | | cl-raylib | **4.0** | [Common Lisp](https://common-lisp.net/) | MIT | https://github.com/longlene/cl-raylib |
| raylib-cr | **4.0** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr | | claylib/wrap | **4.2** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
| chez-raylib | auto | [Chez Scheme](https://cisco.github.io/ChezScheme/) | GPLv3 | https://github.com/Yunoinsky/chez-raylib |
| raylib-cr | **4.5-dev (7e7939e)** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr |
| ray-cyber | **4.2** | [Cyber](https://cyberscript.dev) | MIT | https://github.com/fubark/ray-cyber |
| raylib-c3 | **4.5-dev** | [C3](https://c3-lang.org/) | MIT | https://github.com/Its-Kenta/Raylib-C3 |
| dart-raylib | **4.0** | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib | | dart-raylib | **4.0** | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib |
| bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 | | bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 |
| dray | **4.0** | [D](https://dlang.org/) | Apache-2.0 | https://github.com/xdrie/dray | | dray | **4.2** | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray |
| raylib-d | **4.0** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d | | raylib-d | **4.2** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d |
| dlang_raylib | **4.0** | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib | | dlang_raylib | **4.0** | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib |
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex | | rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex |
| raylib-factor | **4.0** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor | | raylib-factor | **4.0** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor |
| raylib-freebasic | **4.0** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic | | raylib-freebasic | **4.2** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic |
| raylib-go | **4.0** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | | raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | | raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib | | gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
| raylib-hx | 4.0 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
| raylib-hx | **4.2** | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
| jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ | | jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |
| raylib-j | **4.0** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J | | raylib-j | **4.0** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J |
| raylib.jl | **4.0** | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl | | raylib.jl | **4.2** | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl |
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib | | kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib |
| raylib-lua | **4.0** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua | | kaylib | **4.5-dev**| [Kotlin/native](https://kotlinlang.org) | Zlib | https://codeberg.org/Kenta/Kaylib |
| raylib-lua | **4.2** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua |
| raylua | **4.0** | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua | | raylua | **4.0** | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua |
| nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib | | nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib |
| NimraylibNow! | 4.0 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now | | Raylib-Nelua | **4.5-dev** | [nelua](https://nelua.io/) | MIT | https://github.com/Its-Kenta/Raylib-Nelua |
| NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now |
| raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever | | raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever |
| naylib | auto | [Nim](https://nim-lang.org/) | MIT | https://github.com/planetis-m/naylib | | naylib | auto | [Nim](https://nim-lang.org/) | MIT | https://github.com/planetis-m/naylib |
| node-raylib | **4.0** | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib | | node-raylib | **4.0** | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib |
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings | | raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings |
| raylib-odin | **4.0** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib | | raylib-odin | **4.0** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
| raylib-ocaml | **4.0** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml | | raylib-ocaml | **4.2** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml |
| Ray4Laz | **4.2** | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))| Zlib | https://github.com/GuvaCode/Ray4Laz | | TurboRaylib | **4.2** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib |
| Ray4Laz | **4.2** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz |
| Raylib.4.0.Pascal | **4.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal | | Raylib.4.0.Pascal | **4.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal |
| pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib | | pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib |
| raylib-python-cffi | **4.2** | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi | | raylib-python-cffi | **4.2** | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi |
| raylibpyctbg | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylibpyctbg |
| raylib-py | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/overdev/raylib-py |
| raylib-python-ctypes | **4.2** | [Python](https://www.python.org/) | MIT | https://github.com/sDos280/raylib-python-ctypes |
| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php | | raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php |
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp | | raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp |
| raylibr | **4.0** | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr | | raylibr | **4.0** | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr |
@@ -52,19 +63,23 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| raylib-swift | **4.0** | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib | | raylib-swift | **4.0** | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib |
| raylib-scopes | auto | [Scopes](http://scopes.rocks) | MIT | https://github.com/salotz/raylib-scopes | | raylib-scopes | auto | [Scopes](http://scopes.rocks) | MIT | https://github.com/salotz/raylib-scopes |
| raylib-smallBasic | 4.1-dev | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib | | raylib-smallBasic | 4.1-dev | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib |
| raylib.v | **4.0** | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v | | raylib-umka | **4.2** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka |
| raylib.v | **4.2** | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v |
| raylib-vapi | **4.2** | [Vala](https://vala.dev/) | Zlib | https://github.com/lxmcf/raylib-vapi |
| raylib-wren | **4.0** | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren | | raylib-wren | **4.0** | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren |
| raylib-zig | **4.0** | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig | | raylib-zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
| raylib.zig | **4.1-dev** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig | | raylib.zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
| hare-raylib | auto | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib | | hare-raylib | auto | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib |
| raylib-sunder | auto | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD | https://github.com/ashn-dot-dev/raylib-sunder |
| rayed-bqn | auto | [BQN](https://mlochbaum.github.io/BQN/) | MIT | https://github.com/Brian-ED/rayed-bqn |
### Utility Wrapers ### Utility Wrapers
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm. These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
| name | raylib version | language | license | repo | | name | raylib version | language | license | repo |
|:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------| |:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------|
| raylib-cpp | **4.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | | raylib-cpp | **4.2** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp |
| claylib | **4.2** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
### Older or Unmaintained Language Bindings ### Older or Unmaintained Language Bindings
These are older raylib bindings that are more than 2 versions old or have not been maintained. These are older raylib bindings that are more than 2 versions old or have not been maintained.
@@ -96,8 +111,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby | | raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi | | raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby | | raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java | | raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib | | clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib | | QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |

182
CHANGELOG
View File

@@ -1,7 +1,187 @@
changelog changelog
--------- ---------
Current Release: raylib 4.2.0 (11 August 2022) Current Release: raylib 4.5.0 (18 March 2023)
-------------------------------------------------------------------------
Release: raylib 4.5 (18 March 2023)
-------------------------------------------------------------------------
KEY CHANGES:
- ADDED: Improved ANGLE support on Desktop platforms
- ADDED: rcamera module, simpler and more extendable
- ADDED: Support for M3D models and M3D/GLTF animations
- ADDED: Support QOA audio format (import/export)
- ADDED: rl_gputex module for compressed textures loading
- REDESIGNED: rlgl module for automatic render-batch limits checking
- REDESIGNED: rshapes module to minimize the rlgl dependency
Detailed changes:
[core] ADDED: RAYLIB_VERSION_* values to raylib.h (#2856) by @RobLoach
[core] ADDED: Basic gamepad support for Android (#2709) by @deniska
[core] ADDED: Support CAPS/NUM lock keys registering if locked
[core] ADDED: _GNU_SOURCE define on Linux (#2729)
[core] ADDED: SetWindowIcons() to set multiple icon image sizes
[core] `WARNING`: RENAMED: Exported raylib version symbol to raylib_version #2671
[core] REMOVED: Touch points on touch up events on Android (#2711) by @deniska
[core] REVIEWED: Window position setup on InitWindow() (#2732) by @RandomErrorMessage
[core] REVIEWED: Touchscreen input related functions on Android (#2702) by @deniska
[core] REVIEWED: Viewport scaling on Android after context rebind (#2703) by @deniska
[core] REVIEWED: ScanDirectoryFilesRecursively() (#2704)
[core] REVIEWED: Gamepad mappings with latest gamecontrollerdb (#2725)
[core] REVIEWED: Monitor order check on app initialization
[core] REVIEWED: Application monitor when opening (#2728, #2731) by @RandomErrorMessage
[core] REVIEWED: Gestures module to use GetTime() if available (#2733) by @RobLoach
[core] REVIEWED: Resolve GLFW3 some symbols re-definition of windows.h in glfw3native (#2643) by @daipom
[core] REVIEWED: OpenURL(), string buffer too short sometimes
[core] REVIEWED: GetRandomValue() range limit warning (#2800) by @Pere001
[core] REVIEWED: UnloadDirectoryFiles()
[core] REVIEWED: GetKeyPressed(), out of range issue (#2814) by @daipom
[core] REVIEWED: GetTime(), renamed variable 'time' to 'nanoSeconds' (#2816) by @jtainer
[core] REVIEWED: LoadShaderFromMemory(), issue with shader linkage
[core] REVIEWED: Avoid possible gamepad index as -1 (#2839)
[core] REVIEWED: SetShaderValue*(), avoid setup uniforms for invalid locations
[core] REVIEWED: GetClipboardText() on PLATFORM_WEB, permissions issues
[core] REVIEWED: Initial window position for display-sized fullscreen (#2742) by @daipom
[core] REVIEWED: Sticky touches input (#2857) by @ImazighenGhost
[core] REVIEWED: Enable GetWindowHandle() on macOS (#2915) by @Not-Nik
[core] REVIEWED: Window position always inits centered in current monitor
[core] REVIEWED: IsWindowFocused() to consider Android App state (#2935)
[core] REVIEWED: GetMonitorWidth() and GetMonitorHeight() (#2934)
[core] REVIEWED: GetWindowHandle() to return Linux window (#2938)
[core] REVIEWED: WindowDropCallback(), additional security check (#2943)
[core] REVIEWED: Security checks for emscripten_run_script() (#2954)
[utils] REVIEWED: TraceLog() message size limit overflow
[rcamera] REDESIGNED: New implementation from scratch (#2563) by @Crydsch
[rcamera] REVIEWED: Make orbital camera work as expected (#2926) by @JeffM2501
[rcamera] REVIEWED: Multiple reviews on the new implementation
[rcamera] ADDED: UpdateCameraPro(), supporting custom user inputs
[rlgl] ADDED: OpenGL ES 2.0 support on PLATFORM_DESKTOP (#2840) by @wtnbgo
[rlgl] ADDED: Separate blending modes for color and alpha, BLEND_CUSTOM_SEPARATE (#2741)
[rlgl] ADDED: rlSetBlendFactorsSeparate and custom blend mode modification checks (#2741) by @pure01fx
[rlgl] ADDED: RL_TEXTURE_MIPMAP_BIAS_RATIO support to `rlTextureParameters()` for OpenGL 3.3 #2674
[rlgl] ADDED: rlCubemapParameters() (#2862) by @GithubPrankster
[rlgl] ADDED: rlSetCullFace() (#2797) by @jtainer
[rlgl] REMOVED: Mipmaps software generation for OpenGL 1.1
[rlgl] REVIEWED: Check for extensions before enabling them (#2706) by @Not-Nik
[rlgl] REVIEWED: SSBO usage to avoid long long data types
[rlgl] REVIEWED: Enable DXT compression on __APPLE__ targets (#2694) by @Not-Nik
[rlgl] REVIEWED: enums exposed and description comments
[rlgl] REVIEWED: rlBindImageTexture(), correct data types (#2808) by @planetis-m
[rlgl] REVIEWED: rlMultMatrixf(), use const pointer (#2807) by @planetis-m
[rlgl] REVIEWED: Expose OpenGL blending mode factors and functions/equations
[rlgl] REVIEWED: rLoadTextureDepth(), issue with depth textures on WebGL (#2824)
[rlgl] REVIEWED: rlUnloadFramebuffer() (#2937)
[raymath] ADDED: Vector2LineAngle() (#2887)
[raymath] REVIEWED: Vector2Angle() (#2829, #2832) by @AlxHnr, @planetis-m
[shapes] ADDED: CheckCollisionPointPoly() (#2685) by @acejacek
[shapes] REVIEWED: DrawPixel*(), use RL_QUADS/RL_TRIANGLES (#2750) by @hatkidchan
[shapes] REVIEWED: DrawLineBezier*(), fix bezier line breaking (#2735, #2767) by @nobytesgiven
[textures] ADDED: ColorBrightness()
[textures] ADDED: ColorTint()
[textures] ADDED: ColorContrast()
[textures] ADDED: Support for PNM images (.ppm, .pgm)
[textures] ADDED: GenImagePerlinNoise()
[textures] ADDED: GenImageText(), generate grayscale image from text byte data
[textures] ADDED: ImageDrawCircleLines(), ImageDrawCircleLinesV() (#2713) by @RobLoach
[textures] ADDED: ImageBlurGaussian() (#2770) by @nobytesgiven
[textures] REVIEWED: Image fileformat support: PIC, PNM
[textures] REVIEWED: ImageTextEx() and ImageDrawTextEx() scaling (#2756) by @hatkidchan
[textures] `WARNING`: REMOVED: DrawTextureQuad()
[textures] `WARNING`: REMOVED: DrawTexturePoly(), function moved to example: `textures_polygon`
[textures] `WARNING`: REMOVED: DrawTextureTiled(),function implementation moved to the textures_tiled.c
[text] ADDED: GetCodepointPrevious()
[text] ADDED: UnloadUTF8(), aligned with LoadUTF8()
[text] `WARNING`: RENAMED: TextCodepointsToUTF8() to LoadUTF8()
[text] `WARNING`: RENAMED: GetCodepoint() -> GetCodepointNext()
[text] REDESIGNED: GetCodepointNext()
[text] REVIEWED: MeasureTextEx(), avoid crash on bad data
[text] REVIEWED: UnloadFontData(), avoid crash on invalid font data
[models] ADDED: Support M3D model file format (meshes and materials) (#2648) by @bztsrc
[models] ADDED: Support for M3D animations (#2648) by @bztsrc
[models] ADDED: GLTF animation support (#2844) by @charles-l
[models] ADDED: DrawCapsule() and DrawCapsuleWires() (#2761) by @IanBand
[models] ADDED: LoadMaterials(), MTL files loading, same code as OBJ loader (#2872) by @JeffM2501
[models] `WARNING`: REMOVED: UnloadModelKeepMeshes()
[models] `WARNING`: REMOVED: DrawCubeTexture(), DrawCubeTextureRec(), functions moved to new example: `models_draw_cube_texture`
[models] REVIEWED: DrawMesh(), using SHADER_LOC_COLOR_SPECULAR as a material map (#2908) by @haved
[models] REVIEWED: LoadM3D() vertex color support (#2878) by @GithubPrankster, @bztsrc
[models] REVIEWED: GenMeshHeightmap() (#2716)
[models] REVIEWED: LoadIQM() (#2676)
[models] REVIEWED: Simplify .vox signature check (#2752) by @CrezyDud
[models] REVIEWED: LoadIQM(), support bone names loading if available (#2882) by @PencilAmazing
[models] REVIEWED: GenMeshTangents(), avoid crash on missing texcoords data (#2927)
[audio] ADDED: Full support for QOA audio file format
[audio] ADDED: Mixed audio processor (#2929) by @hatkidchan
[audio] ADDED: IsWaveReady()`, IsSoundReady(), IsMusicReady() (#2892) by @RobLoach
[audio] `WARNING`: REMOVED: Multichannel audio API: PlaySoundMulti(), StopSoundMulti()
[audio] REVIEWED: Clear PCM buffer state when closing audio device (#2736) by @veins1
[audio] REVIEWED: Android backend selected (#2118, #2875) by @planetis-m
[audio] REVIEWED: Change default threading model for COM objects in miniaudio
[multi] ADDED: IsShaderReady(), IsImageReady(), IsFontReady() (#2892) by @RobLoach
[multi] ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895) by @RobLoach
[multi] REVIEWED: Multiple code/comment typos by @sDos280
[multi] REVIEWED: Grammar mistakes and typos (#2914) by @stickM4N
[multi] REVIEWED: Use TRACELOG() macro instead of TraceLog() in internal modules (#2881) by @RobLoach
[examples] ADDED: textures_textured_curve (#2821) by @JeffM2501
[examples] ADDED: models_draw_cube_texture
[examples] ADDED: models_loading_m3d (#2648) by @bztsrc
[examples] ADDED: shaders_write_depth (#2836) by @BugraAlptekinSari
[examples] ADDED: shaders_hybrid_render (#2919) by @BugraAlptekinSari
[examples] REMOVED: audio_multichannel_sound
[examples] RENAMED: Several shaders for naming consistency (#2707)
[examples] RENAMED: lighting_instanced.fs to lighting_instancing.fs (glsl100) (#2805) by @gtrxAC
[examples] REVIEWED: core_custom_logging.c (#2692) by @hartmannathan
[examples] REVIEWED: core_camera_2d_platformer (#2687) by @skylar779
[examples] REVIEWED: core_input_gamepad.c (#2903) by @planetis-m
[examples] REVIEWED: core_custom_frame_control
[examples] REVIEWED: core_drop_files (#2943)
[examples] REVIEWED: text_rectangle_bounds (#2746) by @SzieberthAdam
[examples] REVIEWED: textures_image_processing, added gaussian blurring (#2775) by @nobytesgiven
[examples] REVIEWED: models_billboard, highlighting rotation and draw order (#2779) by @nobytesgiven
[examples] REVIEWED: core_loading_thread, join thread on completion (#2845) by @planetis-m
[examples] REVIEWED: models_loading_gltf
[examples] REVIEWED: Shader lighting.fs for GLSL120 (#2651)
[examples] REVIEWED: text_codepoints_loading.c
[parser] REVIEWED: raylib-parser Makefile (#2765) by @Peter0x44
[build] ADDED: Packaging for distros with deb-based and rpm-based packages (#2877) by @KOLANICH
[build] ADDED: Linkage library -latomic on Linux (only required for ARM32)
[build] ADDED: Required frameworks on macOS (#2793) by @SpexGuy
[build] ADDED: WASM support for Zig build (#2901) by @Not-Nik
[build] ADDED: New raylib examples as VS2022 project (to raylib solution)
[build] REVIEWED: config.h format and inconsistencies
[build] REVIEWED: Zig build to latest master, avoid deprecated functions (#2910) by @star-tek-mb
[build] REVIEWED: CMake project template to easily target raylib version (#2700) by @RobLoach
[build] REVIEWED: PATH for PLATFORM_WEB target (#2647) by @futureapricot
[build] REVIEWED: build.zig to let user decide how to set build mode and linker fixes by @InKryption
[build] REVIEWED: Deprecation error on Android API higher than 23 (#2778) by @anggape
[build] REVIEWED: Android x86 Architecture name (#2783) by @IsaacTCB
[build] REVIEWED: examples/build.zig for the latest Zig version (#2786) by @RomanAkberov
[utils] REVIEWED: ExportDataAsCode() data types (#2787) by @RGDTAB
[build] REVIEWED: Makefile emscripten path (#2785) by @Julianiolo
[build] REVIEWED: Several compilation warnings (for strict rules)
[build] REVIEWED: All github workflows using deprecated actions
[build] REVIEWED: CMake when compiling for web (#2820) by @object71
[build] REVIEWED: DLL build on Windows (#2951) by @Skaytacium
[build] REVIEWED: Avoid MSVC warnings in raylib project (#2871) by @JeffM2501
[build] REVIEWED: Paths in .bat files to build examples (#2870) by @masoudd
[build] REVIEWED: CMake, use GLVND for old cmake versions (#2826) by @simendsjo
[build] REVIEWED: Makefile, multiple tweaks
[build] REVIEWED: CI action: linux_examples.yml
[build] REVIEWED: CI action: cmake.yml
[bindings] ADDED: h-raylib (Haskell) by @Anut-py
[bindings] ADDED: raylib-c3 (C3) by @Its-Kenta
[bindings] ADDED: raylib-umka (Umka) by @RobLoach
[bindings] ADDED: chez-raylib (Chez Scheme) by @Yunoinsky
[bindings] ADDED: raylib-python-ctypes (Python) by @sDos280
[bindings] ADDED: claylib (Common Lisp) by @shelvick
[bindings] ADDED: raylib-vapi (Vala) by @lxmcf
[bindings] ADDED: TurboRaylib (Object Pascal) by @turborium
[bindings] ADDED: Kaylib (Kotlin/Native) by @Its-Kenta
[bindings] ADDED: Raylib-Nelua (Nelua) by @Its-Kenta
[bindings] ADDED: Cyber (Cyber) by @fubark
[bindings] ADDED: raylib-sunder (Sunder) by @ashn-dot-dev
[bindings] ADDED: raylib BQN (#2962) by @Brian-ED
[misc] REVIEWED: Update external libraries to latest versions
------------------------------------------------------------------------- -------------------------------------------------------------------------
Release: raylib 4.2 (11 August 2022) Release: raylib 4.2 (11 August 2022)

0
CMakeLists.txt Executable file → Normal file
View File

View File

@@ -57,6 +57,7 @@ cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editin
cmake_dependent_option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_DDS "Support loading DDS as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_HDR "Support loading HDR as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_PNM "Support loading PNM as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)

View File

@@ -395,3 +395,40 @@ Highlights for `raylib 4.2`:
As always, there are more improvements than the key features listed, make sure to check raylib [CHANGELOG](CHANGELOG) for the detailed list of changes; for this release a `WARNING` flag has been added to all the changes that could affect bindings or productivity code. **raylib keeps improving one more version** and a special focus on maintainability has been put on the library for the future. Specific/advance functionality will be provided through **raylib-extras** repos and raylib main repo devlelopment will be focused on what made raylib popular: being a simple and easy-to-use library to **enjoy videogames programming**. As always, there are more improvements than the key features listed, make sure to check raylib [CHANGELOG](CHANGELOG) for the detailed list of changes; for this release a `WARNING` flag has been added to all the changes that could affect bindings or productivity code. **raylib keeps improving one more version** and a special focus on maintainability has been put on the library for the future. Specific/advance functionality will be provided through **raylib-extras** repos and raylib main repo devlelopment will be focused on what made raylib popular: being a simple and easy-to-use library to **enjoy videogames programming**.
**Enjoy gamedev/tools/graphics programming!** :) **Enjoy gamedev/tools/graphics programming!** :)
notes on raylib 4.5
-------------------
It's been **7 months** since latest raylib release. As usual, **many parts of the library have been reviewed and improved** along those months. Many issues have been closed, staying under 10 open issues at the moment of this writting and also many PRs from contributors have been received, reviewed and merged into raylib library. Some new functions have been added and some others have been removed to improve library coherence and avoid moving too high level, giving the users the tools to implement advance functionality themselfs over raylib. Again, this is a big release with a considerable amount of changes and improvements. Here it is a small summary highlighting this new **rayib 4.5**.
Some numbers for this release:
- **+100** closed issues (for a TOTAL of **+1340**!)
- **+350** commits since previous RELEASE (for a TOTAL of **+6350**!)
- **+25** functions ADDED to raylib API (for a TOTAL of **516**!)
- **+40** functions REVIEWED/REDESIGNED
- **+40** new contributors (for a TOTAL of **405**!)
Highlights for `raylib 4.5`:
- **`NEW` Improved ANGLE support on Desktop platforms**: Support for OpenGL ES 2.0 on Desktop platforms (Windows, Linux, macOS) has been reviewed by @wtnbgo GitHub user. Now raylib can be compiled on desktop for OpenGL ES 2.0 and linked against [`ANGLE`](https://github.com/google/angle). This _small_ addition open the door to building raylib for all **ANGLE supported backends: Direct3D 11, Vulkan and Metal**. Please note that this new feature is still experimental and requires further testing!
- **`NEW` Camera module**: A brand new implementation from scratch for `rcamera` module, contributed by @Crydsch GitHub user! **New camera system is simpler, more flexible, more granular and more extendable**. Specific camera math transformations (movement/rotation) have been moved to individual functions, exposing them to users if required. Global state has been removed from the module and standalone usage has been greatly improved; now `rcamera.h` single-file header-only library can be used externally, independently of raylib. A new `UpdateCameraPro()` function has been added to address input-dependency of `UpdateCamera()`, now advance users have **full control over camera inputs and movement/rotation speeds**!
- **`NEW` Support for M3D models and M3D/GLTF animations**: 3d models animations support has been a limited aspect of raylib for long time, some versions ago IQM animations were supported but raylib 4.5 also adds support for the brand new [M3D file format](https://bztsrc.gitlab.io/model3d/), including animations and the long expected support for **GLTF animations**! The new M3D file format is **simple, portable, feature complete, extensible and open source**. It also provides a complete set of tools to export/visualize M3D models from/to Blender! Now raylib supports up to **3 model file-formats with animations**: `IQM`, `GLTF` and `M3D`.
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rl_gputex.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
- **Reviewed `rshapes` module to minimize the rlgl dependency**: Now `rshapes` 2d shapes drawing functions **only depend on 6 low-level functions**: `rlBegin()`, `rlEnd()`, `rlVertex3f()`, `rlTexCoord2f()`, `rlNormal3f()`, `rlSetTexture()`. With only those pseudo-OpenGl 1.1 minimal functionality, everything can be drawn! This improvement converts `rshapes` module in a **self-contained, portable shapes-drawing library that can be used independently of raylib**, as far as entry points for those 6 functions are provided by the user. It even allows to be used for software rendering, with the proper backend!
- **Added data structures validation functions**: Multiple functions have been added by @RobLoach GitHub user to ease the validation of raylib data structures: `IsImageReady()`, `IsTextureReady()`, `IsSoundReady()`... Now users have a simple mechanism to **make sure data has been correctly loaded**, instead of checking internal structure values by themselfs.
As usual, those are only some highlights but there is much more! New image generators, new color transformation functionality, improved blending support for color/alpha, etc... Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes! Please, note that all breaking changes have been flagged with a `WARNING` in the CHANGELOG, specially useful for binding creators!
**raylib keeps improving one more version** with a special focus on maintainability and sustainability. Always working towards making the library more **simple and easy-to-use**.
Let's keep **enjoying games/tools/graphics programming!** :)

View File

@@ -1,4 +1,4 @@
Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event 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. will the authors be held liable for any damages arising from the use of this software.

View File

@@ -12,10 +12,10 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
<br> <br>
[![GitHub Contributors](https://img.shields.io/github/contributors/raysan5/raylib)](https://github.com/raysan5/raylib/graphs/contributors)
[![GitHub Releases Downloads](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases) [![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 Stars](https://img.shields.io/github/stars/raysan5/raylib?style=flat&label=stars)](https://github.com/raysan5/raylib/stargazers)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.0.0)](https://github.com/raysan5/raylib/commits/master) [![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.2.0)](https://github.com/raysan5/raylib/commits/master)
[![GitHub 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) [![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) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
@@ -23,8 +23,6 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
[![Subreddit Subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?label=reddit%20r%2Fraylib&logo=reddit)](https://www.reddit.com/r/raylib/) [![Subreddit Subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?label=reddit%20r%2Fraylib&logo=reddit)](https://www.reddit.com/r/raylib/)
[![Youtube Subscribers](https://img.shields.io/youtube/channel/subscribers/UC8WIBkhYb5sBNqXO1mZ7WSQ?style=flat&label=Youtube&logo=youtube)](https://www.youtube.com/c/raylib) [![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) [![Twitch Status](https://img.shields.io/twitch/status/raysan5?style=flat&label=Twitch&logo=twitch)](https://www.twitch.tv/raysan5)
[![Twitter Followers](https://img.shields.io/twitter/follow/raysan5?style=flat&label=@raysan5&color=1da1f2&logo=twitter)](https://twitter.com/raysan5)
[![Windows](https://github.com/raysan5/raylib/workflows/Windows/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows) [![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) [![Linux](https://github.com/raysan5/raylib/workflows/Linux/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
@@ -40,10 +38,10 @@ 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 [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!** - Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
- Written in plain C code (C99) in PascalCase/camelCase notation - Written in plain C code (C99) using PascalCase/camelCase notation
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**) - Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) - **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts) - Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC) - Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more! - **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps** - Flexible Materials system, supporting classic maps and **PBR maps**
@@ -53,7 +51,7 @@ features
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
- **VR stereo rendering** support with configurable HMD device parameters - **VR stereo rendering** support with configurable HMD device parameters
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)! - Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)! - Bindings to [+60 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**. - **Free and open source**.
basic example basic example

View File

@@ -4,15 +4,20 @@ Here it is a wishlist with features and ideas to improve the library. Note that
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix. - [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
- [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 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 (https://github.com/raysan5/raylib/discussions/1502, https://github.com/raysan5/raylib/discussions/2272) are open to everyone to ask for improvements, feel free to check and comment. - 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 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
_Current version of raylib is complete and functional but there is always room for improvements._ _Current version of raylib is complete and functional but there is always room for improvements._
**raylib 4.x** **raylib 4.x**
- [ ] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507) - [ ] Split core module into separate platforms?
- [ ] Basic 2d software renderer, using `Image` provided API
- [ ] Redesign gestures system, improve touch inputs management - [ ] Redesign gestures system, improve touch inputs management
- [ ] Redesign raudio module, implement miniaudio high-level provided features - [ ] Redesign audio module, implement miniaudio high-level provided features
- [x] Better documentation and improved examples - [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
- [x] Better documentation and improved examples, reviewed webpage with examples complexity level
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs) - [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres) - [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)

18
build.zig Normal file
View File

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

View File

@@ -35,6 +35,7 @@ if (${CUSTOMIZE_BUILD})
define_if("raylib" SUPPORT_FILEFORMAT_PNG) define_if("raylib" SUPPORT_FILEFORMAT_PNG)
define_if("raylib" SUPPORT_FILEFORMAT_DDS) define_if("raylib" SUPPORT_FILEFORMAT_DDS)
define_if("raylib" SUPPORT_FILEFORMAT_HDR) define_if("raylib" SUPPORT_FILEFORMAT_HDR)
define_if("raylib" SUPPORT_FILEFORMAT_PNM)
define_if("raylib" SUPPORT_FILEFORMAT_KTX) define_if("raylib" SUPPORT_FILEFORMAT_KTX)
define_if("raylib" SUPPORT_FILEFORMAT_ASTC) define_if("raylib" SUPPORT_FILEFORMAT_ASTC)
define_if("raylib" SUPPORT_FILEFORMAT_BMP) define_if("raylib" SUPPORT_FILEFORMAT_BMP)
@@ -76,7 +77,7 @@ if (${CUSTOMIZE_BUILD})
target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16") target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"") target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"")
target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16") target_compile_definitions("raylib" PUBLIC "MAX_CHAR_PRESSED_QUEUE=16")
target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64") target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64")
if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11") if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11")

View File

@@ -1,3 +1,12 @@
# Set OpenGL_GL_PREFERENCE to new "GLVND" even when legacy library exists and
# cmake is <= 3.10
#
# See https://cmake.org/cmake/help/latest/policy/CMP0072.html for more
# information.
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
if (${PLATFORM} MATCHES "Desktop") if (${PLATFORM} MATCHES "Desktop")
set(PLATFORM_CPP "PLATFORM_DESKTOP") set(PLATFORM_CPP "PLATFORM_DESKTOP")
@@ -45,7 +54,6 @@ elseif (${PLATFORM} MATCHES "Android")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2") set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND raylib_sources ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) list(APPEND raylib_sources ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
add_definitions(-DANDROID -D__ANDROID_API__=21)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue) include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
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") 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")
@@ -85,7 +93,7 @@ elseif ("${PLATFORM}" MATCHES "DRM")
endif () endif ()
if (${OPENGL_VERSION}) if (NOT ${OPENGL_VERSION})
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}") set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
if (${OPENGL_VERSION} MATCHES "4.3") if (${OPENGL_VERSION} MATCHES "4.3")
set(GRAPHICS "GRAPHICS_API_OPENGL_43") set(GRAPHICS "GRAPHICS_API_OPENGL_43")

View File

@@ -1,5 +1,6 @@
# Packaging # Packaging
SET(CPACK_PACKAGE_NAME "raylib") SET(CPACK_PACKAGE_NAME "raylib")
SET(CPACK_PACKAGE_CONTACT "raysan5")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple and easy-to-use library to enjoy videogames programming") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple and easy-to-use library to enjoy videogames programming")
SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
@@ -9,5 +10,9 @@ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README.md")
SET(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/../README.md") SET(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/../README.md")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE") SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE")
SET(CPACK_PACKAGE_FILE_NAME "raylib-${PROJECT_VERSION}$ENV{RAYLIB_PACKAGE_SUFFIX}") SET(CPACK_PACKAGE_FILE_NAME "raylib-${PROJECT_VERSION}$ENV{RAYLIB_PACKAGE_SUFFIX}")
SET(CPACK_GENERATOR "ZIP;TGZ") # Remove this, if you want the NSIS installer on Windows SET(CPACK_GENERATOR "ZIP;TGZ;DEB;RPM") # Remove this, if you want the NSIS installer on Windows
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # can be used to generate deps, slow and requires tools.
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libatomic1, libc6, libglfw3, libglu1-mesa | libglu1, libglx0, libopengl0")
SET(CPACK_DEBIAN_PACKAGE_NAME "lib${CPACK_PACKAGE_NAME}-dev")
SET(CPACK_RPM_PACKAGE_NAME "lib${CPACK_PACKAGE_NAME}-devel")
include(CPack) include(CPack)

View File

@@ -85,7 +85,7 @@ if (${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
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_custom_uniform.c)
@@ -102,6 +102,8 @@ elseif (${PLATFORM} MATCHES "Web")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
set(CMAKE_EXECUTABLE_SUFFIX ".html") set(CMAKE_EXECUTABLE_SUFFIX ".html")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
# Remove the -rdynamic flag because otherwise emscripten # Remove the -rdynamic flag because otherwise emscripten
# does not generate HTML+JS+WASM files, only a non-working # does not generate HTML+JS+WASM files, only a non-working
# and fat HTML # and fat HTML

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # will the authors be held liable for any damages arising from the use of this software.
@@ -30,7 +30,7 @@ PLATFORM ?= PLATFORM_DESKTOP
# Define required raylib variables # Define required raylib variables
PROJECT_NAME ?= raylib_examples PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 4.2.0 RAYLIB_VERSION ?= 4.5.0
RAYLIB_PATH ?= .. RAYLIB_PATH ?= ..
# Locations of raylib.h and libraylib.a/libraylib.so # Locations of raylib.h and libraylib.a/libraylib.so
@@ -51,6 +51,13 @@ USE_EXTERNAL_GLFW ?= FALSE
# NOTE: This variable is only used for PLATFORM_OS: LINUX # NOTE: This variable is only used for PLATFORM_OS: LINUX
USE_WAYLAND_DISPLAY ?= FALSE USE_WAYLAND_DISPLAY ?= FALSE
# PLATFORM_WEB: Default properties
BUILD_WEB_ASYNCIFY ?= TRUE
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 cross-compiler for PLATFORM_RPI # Use cross-compiler for PLATFORM_RPI
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
USE_RPI_CROSS_COMPILER ?= FALSE USE_RPI_CROSS_COMPILER ?= FALSE
@@ -60,8 +67,8 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
endif endif
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows # ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@@ -119,16 +126,18 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
endif endif
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables ifeq ($(PLATFORM_OS),WINDOWS)
EMSDK_PATH ?= C:/emsdk # Emscripten required variables
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten EMSDK_PATH ?= C:/emsdk
CLANG_PATH = $(EMSDK_PATH)/upstream/bin EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit CLANG_PATH = $(EMSDK_PATH)/upstream/bin
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH) NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
endif
endif endif
# Define default C compiler: CC # Define default C compiler: CC
@@ -195,9 +204,13 @@ ifeq ($(BUILD_MODE),DEBUG)
endif endif
else else
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS += -Os ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3
else
CFLAGS += -Os
endif
else else
CFLAGS += -s -O1 CFLAGS += -O2
endif endif
endif endif
@@ -283,16 +296,32 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation # --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map # --source-map-base # allow debugging in browser with source map
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources LDFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -s FORCE_FILESYSTEM=1
# Build using asyncify
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
LDFLAGS += -s ASYNCIFY
endif
# Add resources building if required
ifeq ($(BUILD_WEB_RESOURCES),TRUE)
LDFLAGS += --preload-file $(BUILD_WEB_RESOURCES_PATH)
endif
# Add debug mode flags if required
ifeq ($(BUILD_MODE),DEBUG)
LDFLAGS += -s ASSERTIONS=1 --profiling
endif
# Define a custom shell .html and output extension
LDFLAGS += --shell-file $(BUILD_WEB_SHELL)
EXT = .html
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way, # NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
# we can compile same code for ALL platforms with no change required, but, working on bigger # we can compile same code for ALL platforms with no change required, but, working on bigger
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw # projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference. # logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
# Define a custom shell .html and output extension
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
@@ -325,6 +354,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
LDLIBS += -lc LDLIBS += -lc
endif endif
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
LDLIBS += -latomic
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
@@ -430,6 +462,7 @@ TEXTURES = \
textures/textures_sprite_anim \ textures/textures_sprite_anim \
textures/textures_sprite_button \ textures/textures_sprite_button \
textures/textures_sprite_explosion \ textures/textures_sprite_explosion \
textures/textures_textured_curve \
textures/textures_bunnymark \ textures/textures_bunnymark \
textures/textures_blend_modes \ textures/textures_blend_modes \
textures/textures_draw_tiled \ textures/textures_draw_tiled \
@@ -456,6 +489,7 @@ MODELS = \
models/models_billboard \ models/models_billboard \
models/models_box_collisions \ models/models_box_collisions \
models/models_cubicmap \ models/models_cubicmap \
models/models_draw_cube_texture \
models/models_first_person_maze \ models/models_first_person_maze \
models/models_geometric_shapes \ models/models_geometric_shapes \
models/models_mesh_generation \ models/models_mesh_generation \
@@ -463,6 +497,7 @@ MODELS = \
models/models_loading \ models/models_loading \
models/models_loading_vox \ models/models_loading_vox \
models/models_loading_gltf \ models/models_loading_gltf \
models/models_loading_m3d \
models/models_orthographic_projection \ models/models_orthographic_projection \
models/models_rlgl_solar_system \ models/models_rlgl_solar_system \
models/models_skybox \ models/models_skybox \
@@ -488,15 +523,17 @@ SHADERS = \
shaders/shaders_spotlight \ shaders/shaders_spotlight \
shaders/shaders_hot_reloading \ shaders/shaders_hot_reloading \
shaders/shaders_mesh_instancing \ shaders/shaders_mesh_instancing \
shaders/shaders_multi_sample2d shaders/shaders_multi_sample2d \
shaders/shaders_write_depth \
shaders/shaders_hybrid_render
AUDIO = \ AUDIO = \
audio/audio_module_playing \ audio/audio_module_playing \
audio/audio_music_stream \ audio/audio_music_stream \
audio/audio_raw_stream \ audio/audio_raw_stream \
audio/audio_sound_loading \ audio/audio_sound_loading \
audio/audio_multichannel_sound \ audio/audio_stream_effects \
audio/audio_stream_effects audio/audio_mixed_processor
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST)) CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
@@ -546,7 +583,10 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
rm -fv *.o rm -fv *.o
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js ifeq ($(PLATFORM_OS),WINDOWS)
del *.wasm *.html *.js *.data
else
rm -f */*.wasm */*.html */*.js */*.data
endif
endif endif
@echo Cleaning done @echo Cleaning done

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Android project (APK building) # raylib makefile for Android project (APK building)
# #
# Copyright (c) 2017-2022 Ramon Santamaria (@raysan5) # Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # will the authors be held liable for any damages arising from the use of this software.
@@ -48,7 +48,7 @@ ifeq ($(ANDROID_ARCH),ARM64)
ANDROID_ARCH_NAME = arm64-v8a ANDROID_ARCH_NAME = arm64-v8a
endif endif
ifeq ($(ANDROID_ARCH),x86) ifeq ($(ANDROID_ARCH),x86)
ANDROID_ARCH_NAME = i686 ANDROID_ARCH_NAME = x86
endif endif
ifeq ($(ANDROID_ARCH),x86_64) ifeq ($(ANDROID_ARCH),x86_64)
ANDROID_ARCH_NAME = x86_64 ANDROID_ARCH_NAME = x86_64

View File

@@ -2,7 +2,7 @@
# #
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
# #
# Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # will the authors be held liable for any damages arising from the use of this software.
@@ -30,7 +30,7 @@ PLATFORM ?= PLATFORM_WEB
# Define required raylib variables # Define required raylib variables
PROJECT_NAME ?= raylib_examples PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 4.2.0 RAYLIB_VERSION ?= 4.5.0
RAYLIB_PATH ?= .. RAYLIB_PATH ?= ..
# Locations of raylib.h and libraylib.a/libraylib.so # Locations of raylib.h and libraylib.a/libraylib.so
@@ -60,8 +60,8 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
endif endif
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows # ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@@ -119,16 +119,18 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
endif endif
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables ifeq ($(PLATFORM_OS),WINDOWS)
EMSDK_PATH ?= C:/emsdk # Emscripten required variables
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten EMSDK_PATH ?= C:/emsdk
CLANG_PATH = $(EMSDK_PATH)/upstream/bin EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit CLANG_PATH = $(EMSDK_PATH)/upstream/bin
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH) NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
endif
endif endif
# Define default C compiler: CC # Define default C compiler: CC
@@ -195,9 +197,13 @@ ifeq ($(BUILD_MODE),DEBUG)
endif endif
else else
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS += -Os ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3
else
CFLAGS += -Os
endif
else else
CFLAGS += -s -O1 CFLAGS += -s -O2
endif endif
endif endif
@@ -279,11 +285,12 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS # -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# -s EXPORTED_RUNTIME_METHODS=ccall # require exporting some LEGACY_RUNTIME functions, ccall() is required by miniaudio
# --profiling # include information for code profiling # --profiling # include information for code profiling
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation # --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map # --source-map-base # allow debugging in browser with source map
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s EXPORTED_RUNTIME_METHODS=ccall
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way, # NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
# we can compile same code for ALL platforms with no change required, but, working on bigger # we can compile same code for ALL platforms with no change required, but, working on bigger
@@ -328,6 +335,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
LDLIBS += -lc LDLIBS += -lc
endif endif
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
LDLIBS += -latomic
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling # Libraries for OSX 10.9 desktop compiling
@@ -390,13 +400,13 @@ CORE = \
core/core_scissor_test \ core/core_scissor_test \
core/core_storage_values \ core/core_storage_values \
core/core_vr_simulator \ core/core_vr_simulator \
core/core_loading_thread \
core/core_window_flags \ core/core_window_flags \
core/core_window_letterbox \ core/core_window_letterbox \
core/core_window_should_close \ core/core_window_should_close \
core/core_split_screen \ core/core_split_screen \
core/core_smooth_pixelperfect \ core/core_smooth_pixelperfect \
core/core_custom_frame_control core/core_custom_frame_control \
core/core_loading_thread
SHAPES = \ SHAPES = \
shapes/shapes_basic_shapes \ shapes/shapes_basic_shapes \
@@ -433,6 +443,7 @@ TEXTURES = \
textures/textures_sprite_anim \ textures/textures_sprite_anim \
textures/textures_sprite_button \ textures/textures_sprite_button \
textures/textures_sprite_explosion \ textures/textures_sprite_explosion \
textures/textures_textured_curve \
textures/textures_bunnymark \ textures/textures_bunnymark \
textures/textures_blend_modes \ textures/textures_blend_modes \
textures/textures_draw_tiled \ textures/textures_draw_tiled \
@@ -459,6 +470,7 @@ MODELS = \
models/models_billboard \ models/models_billboard \
models/models_box_collisions \ models/models_box_collisions \
models/models_cubicmap \ models/models_cubicmap \
models/models_draw_cube_texture \
models/models_first_person_maze \ models/models_first_person_maze \
models/models_geometric_shapes \ models/models_geometric_shapes \
models/models_mesh_generation \ models/models_mesh_generation \
@@ -466,6 +478,7 @@ MODELS = \
models/models_loading \ models/models_loading \
models/models_loading_vox \ models/models_loading_vox \
models/models_loading_gltf \ models/models_loading_gltf \
models/models_loading_m3d \
models/models_orthographic_projection \ models/models_orthographic_projection \
models/models_rlgl_solar_system \ models/models_rlgl_solar_system \
models/models_skybox \ models/models_skybox \
@@ -491,15 +504,17 @@ SHADERS = \
shaders/shaders_spotlight \ shaders/shaders_spotlight \
shaders/shaders_hot_reloading \ shaders/shaders_hot_reloading \
shaders/shaders_mesh_instancing \ shaders/shaders_mesh_instancing \
shaders/shaders_multi_sample2d shaders/shaders_multi_sample2d \
shaders/shaders_write_depth \
shaders/shaders_hybrid_render
AUDIO = \ AUDIO = \
audio/audio_module_playing \ audio/audio_module_playing \
audio/audio_music_stream \ audio/audio_music_stream \
audio/audio_raw_stream \ audio/audio_raw_stream \
audio/audio_sound_loading \ audio/audio_sound_loading \
audio/audio_multichannel_sound \ audio/audio_stream_effects \
audio/audio_stream_effects audio/audio_mixed_processor
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST)) CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
@@ -589,13 +604,6 @@ core/core_vr_simulator: core/core_vr_simulator.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file core/resources/distortion100.fs@resources/distortion100.fs --preload-file core/resources/distortion100.fs@resources/distortion100.fs
# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
# WARNING: For security reasons multi-threading is not supported on browsers, it requires cross-origin isolation (Oct.2021)
# WARNING: It requires raylib to be compiled using -pthread, so atomic operations and thread-local data (if any)
# in its source were transformed to non-atomic operations and non-thread-local data
core/core_loading_thread: core/core_loading_thread.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
core/core_window_flags: core/core_window_flags.c core/core_window_flags: core/core_window_flags.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@@ -611,6 +619,14 @@ core/core_custom_frame_control: core/core_custom_frame_control.c
core/core_window_should_close: core/core_window_should_close.c core/core_window_should_close: core/core_window_should_close.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
# WARNING: For security reasons multi-threading is not supported on browsers, it requires cross-origin isolation (Oct.2021)
# WARNING: It requires raylib to be compiled using -pthread, so atomic operations and thread-local data (if any)
# in its source were transformed to non-atomic operations and non-thread-local data
core/core_loading_thread: core/core_loading_thread.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
# Compile SHAPES examples # Compile SHAPES examples
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@@ -730,6 +746,10 @@ textures/textures_sprite_explosion: textures/textures_sprite_explosion.c
--preload-file textures/resources/explosion.png@resources/explosion.png \ --preload-file textures/resources/explosion.png@resources/explosion.png \
--preload-file textures/resources/boom.wav@resources/boom.wav --preload-file textures/resources/boom.wav@resources/boom.wav
textures/textures_textured_curve: textures/textures_textured_curve.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/road.png@resources/road.png
textures/textures_bunnymark: textures/textures_bunnymark.c textures/textures_bunnymark: textures/textures_bunnymark.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/wabbit_alpha.png@resources/wabbit_alpha.png --preload-file textures/resources/wabbit_alpha.png@resources/wabbit_alpha.png
@@ -835,6 +855,10 @@ models/models_cubicmap: models/models_cubicmap.c
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \ --preload-file models/resources/cubicmap.png@resources/cubicmap.png \
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png --preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
models/models_draw_cube_texture: models/models_draw_cube_texture.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
models/models_first_person_maze: models/models_first_person_maze.c models/models_first_person_maze: models/models_first_person_maze.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \ --preload-file models/resources/cubicmap.png@resources/cubicmap.png \
@@ -866,6 +890,10 @@ models/models_loading_gltf: models/models_loading_gltf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb --preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb
models/models_loading_m3d: models/models_loading_m3d.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
models/models_orthographic_projection: models/models_orthographic_projection.c models/models_orthographic_projection: models/models_orthographic_projection.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@@ -946,13 +974,13 @@ shaders/shaders_basic_lighting: shaders/shaders_basic_lighting.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \ --preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \
--preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs \ --preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs \
--preload-file shaders/resources/shaders/glsl100/base_lighting.vs@resources/shaders/glsl100/base_lighting.vs --preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs
shaders/shaders_fog: shaders/shaders_fog.c shaders/shaders_fog: shaders/shaders_fog.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \ --preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \
--preload-file shaders/resources/shaders/glsl100/fog.fs@resources/shaders/glsl100/fog.fs \ --preload-file shaders/resources/shaders/glsl100/fog.fs@resources/shaders/glsl100/fog.fs \
--preload-file shaders/resources/shaders/glsl100/base_lighting.vs@resources/shaders/glsl100/base_lighting.vs --preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs
shaders/shaders_simple_mask: shaders/shaders_simple_mask.c shaders/shaders_simple_mask: shaders/shaders_simple_mask.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@@ -971,10 +999,9 @@ shaders/shaders_hot_reloading: shaders/shaders_hot_reloading.c
shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/base_lighting_instanced.vs@resources/shaders/glsl100/base_lighting_instanced.vs \ --preload-file shaders/resources/shaders/glsl100/lighting_instancing.vs@resources/shaders/glsl100/lighting_instancing.vs \
--preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs --preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs
shaders/shaders_multi_sample2d: shaders/shaders_multi_sample2d.c shaders/shaders_multi_sample2d: shaders/shaders_multi_sample2d.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/color_mix.fs@resources/shaders/glsl100/color_mix.fs --preload-file shaders/resources/shaders/glsl100/color_mix.fs@resources/shaders/glsl100/color_mix.fs
@@ -984,6 +1011,15 @@ shaders/shaders_texture_outline: shaders/shaders_texture_outline.c
--preload-file shaders/resources/shaders/glsl100/outline.fs@resources/shaders/glsl100/outline.fs \ --preload-file shaders/resources/shaders/glsl100/outline.fs@resources/shaders/glsl100/outline.fs \
--preload-file shaders/resources/fudesumi.png@resources/fudesumi.png --preload-file shaders/resources/fudesumi.png@resources/fudesumi.png
shaders/shaders_write_depth: shaders/shaders_write_depth.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/write_depth.fs@resources/shaders/glsl100/write_depth.fs
shaders/shaders_hybrid_render: shaders/shaders_hybrid_render.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/hybrid_raymarch.fs@resources/shaders/glsl100/hybrid_raymarch.fs \
--preload-file shaders/resources/shaders/glsl100/hybrid_raster.fs@resources/shaders/glsl100/hybrid_raster.fs
# Compile AUDIO examples # Compile AUDIO examples
audio/audio_module_playing: audio/audio_module_playing.c audio/audio_module_playing: audio/audio_module_playing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@@ -1001,15 +1037,15 @@ audio/audio_sound_loading: audio/audio_sound_loading.c
--preload-file audio/resources/sound.wav@resources/sound.wav \ --preload-file audio/resources/sound.wav@resources/sound.wav \
--preload-file audio/resources/target.ogg@resources/target.ogg --preload-file audio/resources/target.ogg@resources/target.ogg
audio/audio_multichannel_sound: audio/audio_multichannel_sound.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/sound.wav@resources/sound.wav \
--preload-file audio/resources/target.ogg@resources/target.ogg
audio/audio_stream_effects: audio/audio_stream_effects.c audio/audio_stream_effects: audio/audio_stream_effects.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file audio/resources/country.mp3@resources/country.mp3 --preload-file audio/resources/country.mp3@resources/country.mp3
audio/audio_mixed_processor: audio/audio_mixed_processor.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file audio/resources/country.mp3@resources/country.mp3 \
--preload-file audio/resources/coin.wav@resources/coin.wav
# Clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)

View File

@@ -143,12 +143,13 @@ Examples using raylib models functionality, including models loading/generation
| 89 | [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) | | 89 | [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) |
| 90 | [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) | | 90 | [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) |
| 91 | [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) | | 91 | [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) |
| 92 | [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) | | 92 | [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) |
| 93 | [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) | | 93 | [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) |
| 94 | [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) | | 94 | [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) |
| 95 | [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) | | 95 | [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) |
| 96 | [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) | | 96 | [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) |
| 97 | [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) | | 97 | [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) |
| 98 | [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) |
### category: shaders ### category: shaders
@@ -156,24 +157,24 @@ Examples using raylib shaders functionality, including shaders loading, paramete
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer | | ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------| |----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 98 | [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) | | 99 | [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) |
| 99 | [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) | | 100 | [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) |
| 100 | [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) | | 101 | [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) |
| 101 | [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) | | 102 | [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) |
| 102 | [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) | | 103 | [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) |
| 103 | [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) | | 104 | [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) |
| 104 | [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) | | 105 | [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) |
| 105 | [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/) | | 106 | [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/) |
| 106 | [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) | | 107 | [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) |
| 107 | [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) | | 108 | [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) |
| 108 | [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) | | 109 | [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) |
| 109 | [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) | | 110 | [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) |
| 110 | [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) | | 111 | [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) |
| 111 | [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) | | 112 | [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) |
| 112 | [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) | | 113 | [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) |
| 113 | [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) | | 114 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
| 114 | [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) | | 115 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 115 | [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) | | 116 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
### category: audio ### category: audio
@@ -181,11 +182,10 @@ Examples using raylib audio functionality, including sound/music loading and pla
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer | | ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------| |----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 116 | [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) | | 117 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 117 | [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) | | 118 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 118 | [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) | | 119 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 119 | [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) | | 120 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
| 120 | [audio_multichannel_sound](audio/audio_multichannel_sound.c) | <img src="audio/audio_multichannel_sound.png" alt="audio_multichannel_sound" width="80"> | ⭐️☆☆☆ | 3.0 | 3.5 | [Chris Camacho](https://github.com/codifies) |
### category: others ### category: others
@@ -193,11 +193,11 @@ Examples showing raylib misc functionality that does not fit in other categories
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer | | ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------| |----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 121 | [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) | | 122 | [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) |
| 122 | [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) | | 123 | [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) |
| 123 | [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) | | 124 | [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) |
| 124 | [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) | | 125 | [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) |
| 125 | [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) | | 126 | [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 it is an [examples template](examples_template.c) to start with! As always contributions are welcome, feel free to send new examples! Here it is an [examples template](examples_template.c) to start with!

View File

@@ -0,0 +1,123 @@
/*******************************************************************************************
*
* raylib [audio] example - Mixed audio processing
*
* Example originally created with raylib 4.2, last time updated with raylib 4.2
*
* Example contributed by hkc (@hatkidchan) 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 hkc (@hatkidchan)
*
********************************************************************************************/
#include "raylib.h"
#include <math.h>
static float exponent = 1.0f; // Audio exponentiation value
static float averageVolume[400] = { 0.0f }; // Average volume history
//------------------------------------------------------------------------------------
// Audio processing function
//------------------------------------------------------------------------------------
void ProcessAudio(void *buffer, unsigned int frames)
{
float *samples = (float *)buffer; // Samples internally stored as <float>s
float average = 0.0f; // Temporary average volume
for (unsigned int frame = 0; frame < frames; frame++)
{
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 );
average += fabsf(*left) / frames; // accumulating average volume
average += fabsf(*right) / frames;
}
// Moving history to the left
for (int i = 0; i < 399; i++) averageVolume[i] = averageVolume[i + 1];
averageVolume[399] = average; // Adding last average value
}
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - processing mixed output");
InitAudioDevice(); // Initialize audio device
AttachAudioMixedProcessor(ProcessAudio);
Music music = LoadMusicStream("resources/country.mp3");
Sound sound = LoadSound("resources/coin.wav");
PlayMusicStream(music);
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
//----------------------------------------------------------------------------------
UpdateMusicStream(music); // Update music buffer with new stream data
// Modify processing variables
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_LEFT)) exponent -= 0.05f;
if (IsKeyPressed(KEY_RIGHT)) exponent += 0.05f;
if (exponent <= 0.5f) exponent = 0.5f;
if (exponent >= 3.0f) exponent = 3.0f;
if (IsKeyPressed(KEY_SPACE)) PlaySound(sound);
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
DrawText(TextFormat("EXPONENT = %.2f", exponent), 215, 180, 20, LIGHTGRAY);
DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
for (int i = 0; i < 400; i++)
{
DrawLine(201 + i, 232 - averageVolume[i] * 32, 201 + i, 232, MAROON);
}
DrawRectangleLines(199, 199, 402, 34, GRAY);
DrawText("PRESS SPACE TO PLAY OTHER SOUND", 200, 250, 20, LIGHTGRAY);
DrawText("USE LEFT AND RIGHT ARROWS TO ALTER DISTORTION", 140, 280, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadMusicStream(music); // Unload music stream buffers from RAM
DetachAudioMixedProcessor(ProcessAudio); // Disconnect audio processor
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2016-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -1,78 +0,0 @@
/*******************************************************************************************
*
* raylib [audio] example - Multichannel sound playing
*
* Example originally created with raylib 3.0, last time updated with raylib 3.5
*
* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2019-2022 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - Multichannel sound playing");
InitAudioDevice(); // Initialize audio device
Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
SetSoundVolume(fxWav, 0.2f);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_ENTER)) PlaySoundMulti(fxWav); // Play a new wav sound instance
if (IsKeyPressed(KEY_SPACE)) PlaySoundMulti(fxOgg); // Play a new ogg sound instance
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("MULTICHANNEL SOUND PLAYING", 20, 20, 20, GRAY);
DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
DrawText(TextFormat("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
StopSoundMulti(); // We must stop the buffer pool before unloading
UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -34,7 +34,7 @@ int main(void)
float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f] float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f]
bool pause = false; // Music playing paused bool pause = false; // Music playing paused
SetTargetFPS(30); // Set our game to run at 60 frames-per-second SetTargetFPS(30); // Set our game to run at 30 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -43,7 +43,7 @@ void AudioInputCallback(void *buffer, unsigned int frames)
float incr = audioFrequency/44100.0f; float incr = audioFrequency/44100.0f;
short *d = (short *)buffer; short *d = (short *)buffer;
for (int i = 0; i < frames; i++) for (unsigned int i = 0; i < frames; i++)
{ {
d[i] = (short)(32000.0f*sinf(2*PI*sineIdx)); d[i] = (short)(32000.0f*sinf(2*PI*sineIdx));
sineIdx += incr; sineIdx += incr;

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2022 Ramon Santamaria (@raysan5) * Copyright (c) 2022-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

Binary file not shown.

View File

@@ -1,10 +1,10 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zig.CrossTarget) !*std.build.Step { fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step {
// Standard release options allow the person running `zig build` to select if (target.getOsTag() == .emscripten) {
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. @panic("Emscripten building via Zig unsupported");
const mode = b.standardReleaseOptions(); }
const all = b.step(module, "All " ++ module ++ " examples"); const all = b.step(module, "All " ++ module ++ " examples");
const dir = try std.fs.cwd().openIterableDir(module, .{}); const dir = try std.fs.cwd().openIterableDir(module, .{});
@@ -18,33 +18,33 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
// zig's mingw headers do not include pthread.h // zig's mingw headers do not include pthread.h
if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue; if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue;
const exe = b.addExecutable(name, null); const exe = b.addExecutable(.{
exe.addCSourceFile(path, switch (target.getOsTag()) { .name = name,
.windows => &[_][]const u8{}, .target = target,
.linux => &[_][]const u8{}, .optimize = optimize,
.macos => &[_][]const u8{"-DPLATFORM_DESKTOP"},
else => @panic("Unsupported OS"),
}); });
exe.setTarget(target); exe.addCSourceFile(path, &[_][]const u8{});
exe.setBuildMode(mode);
exe.linkLibC(); exe.linkLibC();
exe.addObjectFile(switch (target.getOsTag()) { exe.addObjectFile(switch (target.getOsTag()) {
.windows => "../src/raylib.lib", .windows => "../src/raylib.lib",
.linux => "../src/libraylib.a", .linux => "../src/libraylib.a",
.macos => "../src/libraylib.a", .macos => "../src/libraylib.a",
.emscripten => "../src/libraylib.a",
else => @panic("Unsupported OS"), else => @panic("Unsupported OS"),
}); });
exe.addIncludeDir("../src"); exe.addIncludePath("../src");
exe.addIncludeDir("../src/external"); exe.addIncludePath("../src/external");
exe.addIncludeDir("../src/external/glfw/include"); exe.addIncludePath("../src/external/glfw/include");
switch (exe.target.toTarget().os.tag) { switch (target.getOsTag()) {
.windows => { .windows => {
exe.linkSystemLibrary("winmm"); exe.linkSystemLibrary("winmm");
exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("gdi32");
exe.linkSystemLibrary("opengl32"); exe.linkSystemLibrary("opengl32");
exe.addIncludeDir("external/glfw/deps/mingw"); exe.addIncludePath("external/glfw/deps/mingw");
exe.defineCMacro("PLATFORM_DESKTOP", null);
}, },
.linux => { .linux => {
exe.linkSystemLibrary("GL"); exe.linkSystemLibrary("GL");
@@ -52,6 +52,8 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
exe.linkSystemLibrary("dl"); exe.linkSystemLibrary("dl");
exe.linkSystemLibrary("m"); exe.linkSystemLibrary("m");
exe.linkSystemLibrary("X11"); exe.linkSystemLibrary("X11");
exe.defineCMacro("PLATFORM_DESKTOP", null);
}, },
.macos => { .macos => {
exe.linkFramework("Foundation"); exe.linkFramework("Foundation");
@@ -60,6 +62,8 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
exe.linkFramework("CoreAudio"); exe.linkFramework("CoreAudio");
exe.linkFramework("CoreVideo"); exe.linkFramework("CoreVideo");
exe.linkFramework("IOKit"); exe.linkFramework("IOKit");
exe.defineCMacro("PLATFORM_DESKTOP", null);
}, },
else => { else => {
@panic("Unsupported OS"); @panic("Unsupported OS");
@@ -77,21 +81,25 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
return all; return all;
} }
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.Build) !void {
// Standard target options allows the person running `zig build` to choose // Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which // 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 // means any target is allowed, and the default is native. Other options
// for restricting supported target set are available. // for restricting supported target set are available.
const target = b.standardTargetOptions(.{}); 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(); const all = b.getInstallStep();
all.dependOn(try add_module("audio", b, target)); all.dependOn(try add_module("audio", b, target, optimize));
all.dependOn(try add_module("core", b, target)); all.dependOn(try add_module("core", b, target, optimize));
all.dependOn(try add_module("models", b, target)); all.dependOn(try add_module("models", b, target, optimize));
all.dependOn(try add_module("others", b, target)); all.dependOn(try add_module("others", b, target, optimize));
all.dependOn(try add_module("shaders", b, target)); all.dependOn(try add_module("shaders", b, target, optimize));
all.dependOn(try add_module("shapes", b, target)); all.dependOn(try add_module("shapes", b, target, optimize));
all.dependOn(try add_module("text", b, target)); all.dependOn(try add_module("text", b, target, optimize));
all.dependOn(try add_module("textures", b, target)); all.dependOn(try add_module("textures", b, target, optimize));
} }

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2016-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2022 Jeffery Myers (@JeffM2501) * Copyright (c) 2022-2023 Jeffery Myers (@JeffM2501)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 arvyy (@arvyy) * Copyright (c) 2019-2023 arvyy (@arvyy)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -177,7 +177,7 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
ei->rect.x <= p->x && ei->rect.x <= p->x &&
ei->rect.x + ei->rect.width >= p->x && ei->rect.x + ei->rect.width >= p->x &&
ei->rect.y >= p->y && ei->rect.y >= p->y &&
ei->rect.y < p->y + player->speed*delta) ei->rect.y <= p->y + player->speed*delta)
{ {
hitObstacle = 1; hitObstacle = 1;
player->speed = 0.0f; player->speed = 0.0f;

View File

@@ -7,11 +7,12 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include "rcamera.h"
#define MAX_COLUMNS 20 #define MAX_COLUMNS 20
@@ -29,11 +30,13 @@ int main(void)
// Define the camera to look into our 3d world (position, target, up vector) // Define the camera to look into our 3d world (position, target, up vector)
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 4.0f, 2.0f, 4.0f }; camera.position = (Vector3){ 0.0f, 2.0f, 4.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 1.8f, 0.0f }; camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 60.0f; camera.fovy = 60.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
int cameraMode = CAMERA_FIRST_PERSON;
// Generates some random columns // Generates some random columns
float heights[MAX_COLUMNS] = { 0 }; float heights[MAX_COLUMNS] = { 0 };
@@ -47,17 +50,93 @@ int main(void)
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 }; colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
} }
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode DisableCursor(); // Limit cursor to relative movement inside the window
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 // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); // Switch camera mode
if (IsKeyPressed(KEY_ONE))
{
cameraMode = CAMERA_FREE;
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Reset roll
}
if (IsKeyPressed(KEY_TWO))
{
cameraMode = CAMERA_FIRST_PERSON;
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Reset roll
}
if (IsKeyPressed(KEY_THREE))
{
cameraMode = CAMERA_THIRD_PERSON;
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Reset roll
}
if (IsKeyPressed(KEY_FOUR))
{
cameraMode = CAMERA_ORBITAL;
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Reset roll
}
// Switch camera projection
if (IsKeyPressed(KEY_P))
{
if (camera.projection == CAMERA_PERSPECTIVE)
{
// Create isometric view
cameraMode = CAMERA_THIRD_PERSON;
// Note: The target distance is related to the render distance in the orthographic projection
camera.position = (Vector3){ 0.0f, 2.0f, -100.0f };
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f };
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);
}
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
{
// Reset to default view
cameraMode = CAMERA_THIRD_PERSON;
camera.position = (Vector3){ 0.0f, 2.0f, 10.0f };
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.projection = CAMERA_PERSPECTIVE;
camera.fovy = 60.0f;
}
}
// 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
UpdateCamera(&camera, cameraMode); // Update camera
/*
// Camera PRO usage example (EXPERIMENTAL)
// This new camera function allows custom movement/rotation values to be directly provided
// as input parameters, with this approach, rcamera module is internally independent of raylib inputs
UpdateCameraPro(&camera,
(Vector3){
(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f - // Move forward-backward
(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
},
(Vector3){
GetMouseDelta().x*0.05f, // Rotation: yaw
GetMouseDelta().y*0.05f, // Rotation: pitch
0.0f // Rotation: roll
},
GetMouseWheelMove()*2.0f); // Move to target (zoom)
*/
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -80,14 +159,39 @@ int main(void)
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON); DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
} }
// Draw player cube
if (cameraMode == CAMERA_THIRD_PERSON)
{
DrawCube(camera.target, 0.5f, 0.5f, 0.5f, PURPLE);
DrawCubeWires(camera.target, 0.5f, 0.5f, 0.5f, DARKPURPLE);
}
EndMode3D(); EndMode3D();
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f)); // Draw info boxes
DrawRectangleLines( 10, 10, 220, 70, BLUE); DrawRectangle(5, 5, 330, 100, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(5, 5, 330, 100, BLUE);
DrawText("First person camera default controls:", 20, 20, 10, BLACK); DrawText("Camera controls:", 15, 15, 10, BLACK);
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY); DrawText("- Move keys: W, A, S, D, Space, Left-Ctrl", 15, 30, 10, BLACK);
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY); DrawText("- Look around: arrow keys or mouse", 15, 45, 10, BLACK);
DrawText("- Camera mode keys: 1, 2, 3, 4", 15, 60, 10, BLACK);
DrawText("- Zoom keys: num-plus, num-minus or mouse scroll", 15, 75, 10, BLACK);
DrawText("- Camera projection key: P", 15, 90, 10, BLACK);
DrawRectangle(600, 5, 195, 100, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(600, 5, 195, 100, BLUE);
DrawText("Camera status:", 610, 15, 10, BLACK);
DrawText(TextFormat("- Mode: %s", (cameraMode == CAMERA_FREE) ? "FREE" :
(cameraMode == CAMERA_FIRST_PERSON) ? "FIRST_PERSON" :
(cameraMode == CAMERA_THIRD_PERSON) ? "THIRD_PERSON" :
(cameraMode == CAMERA_ORBITAL) ? "ORBITAL" : "CUSTOM"), 610, 30, 10, BLACK);
DrawText(TextFormat("- Projection: %s", (camera.projection == CAMERA_PERSPECTIVE) ? "PERSPECTIVE" :
(camera.projection == CAMERA_ORTHOGRAPHIC) ? "ORTHOGRAPHIC" : "CUSTOM"), 610, 45, 10, BLACK);
DrawText(TextFormat("- Position: (%06.3f, %06.3f, %06.3f)", camera.position.x, camera.position.y, camera.position.z), 610, 60, 10, BLACK);
DrawText(TextFormat("- Target: (%06.3f, %06.3f, %06.3f)", camera.target.x, camera.target.y, camera.target.z), 610, 75, 10, BLACK);
DrawText(TextFormat("- Up: (%06.3f, %06.3f, %06.3f)", camera.up.x, camera.up.y, camera.up.z), 610, 90, 10, BLACK);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -31,11 +31,11 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -45,7 +45,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FREE);
if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -31,16 +31,13 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f }; Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f }; Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
Ray ray = { 0 }; // Picking line ray Ray ray = { 0 }; // Picking line ray
RayCollision collision = { 0 }; // Ray collision hit info
RayCollision collision = { 0 };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -50,7 +47,14 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); if (IsCursorHidden()) UpdateCamera(&camera, CAMERA_FIRST_PERSON);
// Toggle camera controls
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT))
{
if (IsCursorHidden()) EnableCursor();
else DisableCursor();
}
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{ {
@@ -93,10 +97,12 @@ int main(void)
EndMode3D(); EndMode3D();
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY); 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);
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2021-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -13,11 +13,11 @@
* Enjoy using raylib. :) * Enjoy using raylib. :)
* *
* Example originally created with raylib 1.0, last time updated with raylib 1.0 * 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, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -11,7 +11,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -22,7 +22,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2021-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -86,8 +86,8 @@ int main(void)
DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED); DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED);
DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), position - 40, GetScreenHeight()/2 - 100, 20, MAROON); DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), (int)position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
DrawText(TextFormat("PosX: %03.0f", position), position - 50, GetScreenHeight()/2 + 40, 20, BLACK); 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("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 SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY);
@@ -110,12 +110,12 @@ int main(void)
waitTime = (1.0f/(float)targetFPS) - updateDrawTime; waitTime = (1.0f/(float)targetFPS) - updateDrawTime;
if (waitTime > 0.0) if (waitTime > 0.0)
{ {
WaitTime((float)waitTime*1000.0f); WaitTime((float)waitTime);
currentTime = GetTime(); currentTime = GetTime();
deltaTime = (float)(currentTime - previousTime); deltaTime = (float)(currentTime - previousTime);
} }
} }
else deltaTime = updateDrawTime; // Framerate could be variable else deltaTime = (float)updateDrawTime; // Framerate could be variable
previousTime = currentTime; previousTime = currentTime;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2018-2022 Pablo Marcos Oltra (@pamarcos) and Ramon Santamaria (@raysan5) * Copyright (c) 2018-2023 Pablo Marcos Oltra (@pamarcos) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,7 +18,7 @@
#include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen() #include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen()
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime() #include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
// Custom logging funtion // Custom logging function
void CustomLog(int msgType, const char *text, va_list args) void CustomLog(int msgType, const char *text, va_list args)
{ {
char timeStr[64] = { 0 }; char timeStr[64] = { 0 };

View File

@@ -9,12 +9,17 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include <stdlib.h> // Required for: calloc(), free()
#define MAX_FILEPATH_RECORDED 4096
#define MAX_FILEPATH_SIZE 2048
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -27,7 +32,14 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files"); InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
FilePathList droppedFiles = { 0 }; int filePathCounter = 0;
char *filePaths[MAX_FILEPATH_RECORDED] = { 0 }; // We will register a maximum of filepaths
// Allocate space for the required file paths
for (int i = 0; i < MAX_FILEPATH_RECORDED; i++)
{
filePaths[i] = (char *)RL_CALLOC(MAX_FILEPATH_SIZE, 1);
}
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -39,11 +51,18 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsFileDropped()) if (IsFileDropped())
{ {
// Is some files have been previously loaded, unload them FilePathList droppedFiles = LoadDroppedFiles();
if (droppedFiles.count > 0) UnloadDroppedFiles(droppedFiles);
// Load new dropped files for (int i = 0, offset = filePathCounter; i < droppedFiles.count; i++)
droppedFiles = LoadDroppedFiles(); {
if (filePathCounter < (MAX_FILEPATH_RECORDED - 1))
{
TextCopy(filePaths[offset + i], droppedFiles.paths[i]);
filePathCounter++;
}
}
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -53,20 +72,20 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
if (droppedFiles.count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY); if (filePathCounter == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
else else
{ {
DrawText("Dropped files:", 100, 40, 20, DARKGRAY); DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
for (int i = 0; i < droppedFiles.count; i++) for (unsigned int i = 0; i < filePathCounter; i++)
{ {
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f)); if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f)); else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
DrawText(droppedFiles.paths[i], 120, 100 + 40*i, 10, GRAY); DrawText(filePaths[i], 120, 100 + 40*i, 10, GRAY);
} }
DrawText("Drop new files...", 100, 110 + 40*droppedFiles.count, 20, DARKGRAY); DrawText("Drop new files...", 100, 110 + 40*filePathCounter, 20, DARKGRAY);
} }
EndDrawing(); EndDrawing();
@@ -75,7 +94,10 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadDroppedFiles(droppedFiles); // Unload files memory for (int i = 0; i < MAX_FILEPATH_RECORDED; i++)
{
RL_FREE(filePaths[i]); // Free allocated memory for all filepaths
}
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -13,7 +13,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -174,7 +174,7 @@ int main(void)
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(0, i)), 20, 70 + 20*i, 10, DARKGRAY); DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(0, i)), 20, 70 + 20*i, 10, DARKGRAY);
} }
if (GetGamepadButtonPressed() != -1) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED); if (GetGamepadButtonPressed() != GAMEPAD_BUTTON_UNKNOWN) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY); else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
} }
else else

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2016-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Berni (@Berni8k) and Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -39,8 +39,12 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Get multiple touchpoints // Get the touch point count ( how many fingers are touching the screen )
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) touchPositions[i] = GetTouchPosition(i); int tCount = GetTouchPointCount();
// Clamp touch points available ( set the maximum touch points allowed )
if(tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
// Get touch points positions
for (int i = 0; i < tCount; ++i) touchPositions[i] = GetTouchPosition(i);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -49,7 +53,7 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) for (int i = 0; i < tCount; ++i)
{ {
// Make sure point is not (0, 0) as this means there is no touch for it // Make sure point is not (0, 0) as this means there is no touch for it
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0)) if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))

View File

@@ -1,6 +1,6 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib [cpre] example - loading thread * raylib [core] example - loading thread
* *
* NOTE: This example requires linking with pthreads library on MinGW, * NOTE: This example requires linking with pthreads library on MinGW,
* it can be accomplished passing -static parameter to compiler * it can be accomplished passing -static parameter to compiler
@@ -9,7 +9,7 @@
* *
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -23,10 +23,10 @@
// Using C11 atomics for synchronization // 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 // NOTE: A plain bool (or any plain data type for that matter) can't be used for inter-thread synchronization
static atomic_bool dataLoaded = ATOMIC_VAR_INIT(false); // Data Loaded completion indicator static atomic_bool dataLoaded = false; // Data Loaded completion indicator
static void *LoadDataThread(void *arg); // Loading data thread function declaration static void *LoadDataThread(void *arg); // Loading data thread function declaration
static int dataProgress = 0; // Data progress accumulator static atomic_int dataProgress = 0; // Data progress accumulator
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
@@ -69,9 +69,13 @@ int main(void)
case STATE_LOADING: case STATE_LOADING:
{ {
framesCounter++; framesCounter++;
if (atomic_load(&dataLoaded)) if (atomic_load_explicit(&dataLoaded, memory_order_relaxed))
{ {
framesCounter = 0; 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; state = STATE_FINISHED;
} }
} break; } break;
@@ -80,8 +84,8 @@ int main(void)
if (IsKeyPressed(KEY_ENTER)) if (IsKeyPressed(KEY_ENTER))
{ {
// Reset everything to launch again // Reset everything to launch again
atomic_store(&dataLoaded, false); atomic_store_explicit(&dataLoaded, false, memory_order_relaxed);
dataProgress = 0; atomic_store_explicit(&dataProgress, 0, memory_order_relaxed);
state = STATE_WAITING; state = STATE_WAITING;
} }
} break; } break;
@@ -100,7 +104,7 @@ int main(void)
case STATE_WAITING: DrawText("PRESS ENTER to START LOADING DATA", 150, 170, 20, DARKGRAY); break; case STATE_WAITING: DrawText("PRESS ENTER to START LOADING DATA", 150, 170, 20, DARKGRAY); break;
case STATE_LOADING: case STATE_LOADING:
{ {
DrawRectangle(150, 200, dataProgress, 60, SKYBLUE); DrawRectangle(150, 200, atomic_load_explicit(&dataProgress, memory_order_relaxed), 60, SKYBLUE);
if ((framesCounter/15)%2) DrawText("LOADING DATA...", 240, 210, 40, DARKBLUE); if ((framesCounter/15)%2) DrawText("LOADING DATA...", 240, 210, 40, DARKBLUE);
} break; } break;
@@ -141,11 +145,11 @@ static void *LoadDataThread(void *arg)
// We accumulate time over a global variable to be used in // We accumulate time over a global variable to be used in
// main thread as a progress bar // main thread as a progress bar
dataProgress = timeCounter/10; atomic_store_explicit(&dataProgress, timeCounter/10, memory_order_relaxed);
} }
// When data has finished loading, we set global variable // When data has finished loading, we set global variable
atomic_store(&dataLoaded, true); atomic_store_explicit(&dataLoaded, true, memory_order_relaxed);
return NULL; return NULL;
} }

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Chris Dill (@MysteriousSpace) * Copyright (c) 2019-2023 Chris Dill (@MysteriousSpace)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -10,7 +10,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5) * Copyright (c) 2021-2023 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,13 +9,12 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Jeffery Myers (@JeffM2501) * Copyright (c) 2021-2023 Jeffery Myers (@JeffM2501)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
Texture2D textureGrid = { 0 };
Camera cameraPlayer1 = { 0 }; Camera cameraPlayer1 = { 0 };
Camera cameraPlayer2 = { 0 }; Camera cameraPlayer2 = { 0 };
@@ -32,8 +31,8 @@ void DrawScene(void)
{ {
for (float z = -count*spacing; z <= count*spacing; z += spacing) for (float z = -count*spacing; z <= count*spacing; z += spacing)
{ {
DrawCubeTexture(textureGrid, (Vector3) { x, 1.5f, z }, 1, 1, 1, GREEN); DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
DrawCubeTexture(textureGrid, (Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN); DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
} }
} }
@@ -54,13 +53,6 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen"); InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
// Generate a simple texture to use for trees
Image img = GenImageChecked(256, 256, 32, 32, DARKGRAY, WHITE);
textureGrid = LoadTextureFromImage(img);
UnloadImage(img);
SetTextureFilter(textureGrid, TEXTURE_FILTER_ANISOTROPIC_16X);
SetTextureWrap(textureGrid, TEXTURE_WRAP_CLAMP);
// Setup player 1 camera and screen // Setup player 1 camera and screen
cameraPlayer1.fovy = 45.0f; cameraPlayer1.fovy = 45.0f;
cameraPlayer1.up.y = 1.0f; cameraPlayer1.up.y = 1.0f;
@@ -151,7 +143,6 @@ int main(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadRenderTexture(screenPlayer1); // Unload render texture UnloadRenderTexture(screenPlayer1); // Unload render texture
UnloadRenderTexture(screenPlayer2); // Unload render texture UnloadRenderTexture(screenPlayer2); // Unload render texture
UnloadTexture(textureGrid); // Unload texture
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2017-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -95,11 +95,11 @@ int main(void)
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector
camera.fovy = 60.0f; // Camera field-of-view Y camera.fovy = 60.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(90); // Set our game to run at 90 frames-per-second SetTargetFPS(90); // Set our game to run at 90 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -109,7 +109,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FIRST_PERSON);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2020-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2020-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Anata (@anatagawa) and Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Anata (@anatagawa) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -23,20 +23,20 @@ int main(void)
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); InitWindow(screenWidth, screenHeight, "raylib [core] example - core world screen");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
Vector2 cubeScreenPosition = { 0.0f, 0.0f }; Vector2 cubeScreenPosition = { 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -46,7 +46,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_THIRD_PERSON);
// Calculate cube screen space position (with a little offset to be in top) // Calculate cube screen space position (with a little offset to be in top)
cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera); cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
@@ -68,7 +68,9 @@ int main(void)
EndMode3D(); 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("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))/2, 25, 20, GRAY);
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);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -48,7 +48,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2022 <user_name> (@<user_github>) * Copyright (c) 2023 <user_name> (@<user_github>)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Culacant (@culacant) and Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Culacant (@culacant) and Ramon Santamaria (@raysan5)
* *
******************************************************************************************** ********************************************************************************************
* *
@@ -21,8 +21,6 @@
#include "raylib.h" #include "raylib.h"
#include <stdlib.h>
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -54,8 +52,7 @@ int main(void)
ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount); ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
int animFrameCounter = 0; int animFrameCounter = 0;
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode DisableCursor(); // Catch cursor
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -64,7 +61,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FIRST_PERSON);
// Play animation when spacebar is held down // Play animation when spacebar is held down
if (IsKeyDown(KEY_SPACE)) if (IsKeyDown(KEY_SPACE))
@@ -103,15 +100,11 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture UnloadTexture(texture); // Unload texture
UnloadModelAnimations(anims, animsCount); // Unload model animations data
UnloadModel(model); // Unload model
// Unload model animations data CloseWindow(); // Close window and OpenGL context
for (unsigned int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
RL_FREE(anims);
UnloadModel(model); // Unload model
CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;

View File

@@ -7,11 +7,12 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include "raymath.h"
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Program main entry point // Program main entry point
@@ -27,26 +28,46 @@ int main(void)
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 5.0f, 4.0f, 5.0f }; camera.position = (Vector3){ 5.0f, 4.0f, 5.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard Texture2D bill = LoadTexture("resources/billboard.png"); // Our billboard texture
Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard Vector3 billPositionStatic = { 0.0f, 2.0f, 0.0f }; // Position of static billboard
Vector3 billPositionRotating = { 1.0f, 2.0f, 1.0f }; // Position of rotating billboard
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode // 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 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second // NOTE: Billboard locked on axis-Y
Vector3 billUp = { 0.0f, 1.0f, 0.0f };
// Rotate around origin
// Here we choose to rotate around the image center
// NOTE: (-1, 1) is the range where origin.x, origin.y is inside the texture
Vector2 rotateOrigin = { 0.0f };
// Distance is needed for the correct billboard draw order
// Larger distance (further away from the camera) should be drawn prior to smaller distance.
float distanceStatic;
float distanceRotating;
float rotation = 0.0f;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
rotation += 0.4f;
distanceStatic = Vector3Distance(camera.position, billPositionStatic);
distanceRotating = Vector3Distance(camera.position, billPositionRotating);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -59,7 +80,17 @@ int main(void)
DrawGrid(10, 1.0f); // Draw a grid DrawGrid(10, 1.0f); // Draw a grid
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); // Draw order matters!
if (distanceStatic > distanceRotating)
{
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, (Vector2) {1.0f, 1.0f}, rotateOrigin, rotation, WHITE);
}
else
{
DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, (Vector2) {1.0f, 1.0f}, rotateOrigin, rotation, WHITE);
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
}
EndMode3D(); EndMode3D();

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -26,7 +26,12 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { { 16.0f, 14.0f, 16.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 16.0f, 14.0f, 16.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM) Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM) Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
@@ -36,23 +41,21 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas // NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode 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 // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@@ -0,0 +1,245 @@
/*******************************************************************************************
*
* raylib [models] example - Draw textured cube
*
* Example originally created with raylib 4.5, last time updated with raylib 4.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) 2022-2023 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "rlgl.h" // Required to define vertex data (immediate-mode style)
//------------------------------------------------------------------------------------
// Custom Functions Declaration
//------------------------------------------------------------------------------------
void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color); // Draw cube textured
void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, float width, float height, float length, Color color); // Draw cube with a region of a texture
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - draw cube texture");
// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f };
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
camera.projection = CAMERA_PERSPECTIVE;
// Load texture to be applied to the cubes sides
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png");
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);
BeginMode3D(camera);
// Draw cube with an applied texture
DrawCubeTexture(texture, (Vector3){ -2.0f, 2.0f, 0.0f }, 2.0f, 4.0f, 2.0f, WHITE);
// Draw cube with an applied texture, but only a defined rectangle piece of the texture
DrawCubeTextureRec(texture, (Rectangle){ 0, texture.height/2, texture.width/2, texture.height/2 },
(Vector3){ 2.0f, 1.0f, 0.0f }, 2.0f, 2.0f, 2.0f, WHITE);
DrawGrid(10, 1.0f); // Draw a grid
EndMode3D();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//------------------------------------------------------------------------------------
// Custom Functions Definition
//------------------------------------------------------------------------------------
// Draw cube textured
// NOTE: Cube position is the center position
void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color)
{
float x = position.x;
float y = position.y;
float z = position.z;
// Set desired texture to be enabled while drawing following vertex data
rlSetTexture(texture.id);
// Vertex data transformation can be defined with the commented lines,
// but in this example we calculate the transformed vertex data directly when calling rlVertex3f()
//rlPushMatrix();
// NOTE: Transformation is applied in inverse order (scale -> rotate -> translate)
//rlTranslatef(2.0f, 0.0f, 0.0f);
//rlRotatef(45, 0, 1, 0);
//rlScalef(2.0f, 2.0f, 2.0f);
rlBegin(RL_QUADS);
rlColor4ub(color.r, color.g, color.b, color.a);
// Front Face
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal Pointing Towards Viewer
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - width/2, y - height/2, z + length/2); // Bottom Left Of The Texture and Quad
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + width/2, y - height/2, z + length/2); // Bottom Right Of The Texture and Quad
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + width/2, y + height/2, z + length/2); // Top Right Of The Texture and Quad
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - width/2, y + height/2, z + length/2); // Top Left Of The Texture and Quad
// Back Face
rlNormal3f(0.0f, 0.0f, - 1.0f); // Normal Pointing Away From Viewer
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - width/2, y - height/2, z - length/2); // Bottom Right Of The Texture and Quad
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - width/2, y + height/2, z - length/2); // Top Right Of The Texture and Quad
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + width/2, y + height/2, z - length/2); // Top Left Of The Texture and Quad
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + width/2, y - height/2, z - length/2); // Bottom Left Of The Texture and Quad
// Top Face
rlNormal3f(0.0f, 1.0f, 0.0f); // Normal Pointing Up
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - width/2, y + height/2, z - length/2); // Top Left Of The Texture and Quad
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - width/2, y + height/2, z + length/2); // Bottom Left Of The Texture and Quad
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + width/2, y + height/2, z + length/2); // Bottom Right Of The Texture and Quad
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + width/2, y + height/2, z - length/2); // Top Right Of The Texture and Quad
// Bottom Face
rlNormal3f(0.0f, - 1.0f, 0.0f); // Normal Pointing Down
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - width/2, y - height/2, z - length/2); // Top Right Of The Texture and Quad
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + width/2, y - height/2, z - length/2); // Top Left Of The Texture and Quad
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + width/2, y - height/2, z + length/2); // Bottom Left Of The Texture and Quad
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - width/2, y - height/2, z + length/2); // Bottom Right Of The Texture and Quad
// Right face
rlNormal3f(1.0f, 0.0f, 0.0f); // Normal Pointing Right
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x + width/2, y - height/2, z - length/2); // Bottom Right Of The Texture and Quad
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x + width/2, y + height/2, z - length/2); // Top Right Of The Texture and Quad
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x + width/2, y + height/2, z + length/2); // Top Left Of The Texture and Quad
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x + width/2, y - height/2, z + length/2); // Bottom Left Of The Texture and Quad
// Left Face
rlNormal3f( - 1.0f, 0.0f, 0.0f); // Normal Pointing Left
rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x - width/2, y - height/2, z - length/2); // Bottom Left Of The Texture and Quad
rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x - width/2, y - height/2, z + length/2); // Bottom Right Of The Texture and Quad
rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x - width/2, y + height/2, z + length/2); // Top Right Of The Texture and Quad
rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x - width/2, y + height/2, z - length/2); // Top Left Of The Texture and Quad
rlEnd();
//rlPopMatrix();
rlSetTexture(0);
}
// Draw cube with texture piece applied to all faces
void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, float width, float height, float length, Color color)
{
float x = position.x;
float y = position.y;
float z = position.z;
float texWidth = (float)texture.width;
float texHeight = (float)texture.height;
// Set desired texture to be enabled while drawing following vertex data
rlSetTexture(texture.id);
// We calculate the normalized texture coordinates for the desired texture-source-rectangle
// It means converting from (tex.width, tex.height) coordinates to [0.0f, 1.0f] equivalent
rlBegin(RL_QUADS);
rlColor4ub(color.r, color.g, color.b, color.a);
// Front face
rlNormal3f(0.0f, 0.0f, 1.0f);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y - height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y - height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y + height/2, z + length/2);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y + height/2, z + length/2);
// Back face
rlNormal3f(0.0f, 0.0f, - 1.0f);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y - height/2, z - length/2);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y + height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y + height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y - height/2, z - length/2);
// Top face
rlNormal3f(0.0f, 1.0f, 0.0f);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y + height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y + height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y + height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y + height/2, z - length/2);
// Bottom face
rlNormal3f(0.0f, - 1.0f, 0.0f);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y - height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y - height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y - height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y - height/2, z + length/2);
// Right face
rlNormal3f(1.0f, 0.0f, 0.0f);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y - height/2, z - length/2);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y + height/2, z - length/2);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x + width/2, y + height/2, z + length/2);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x + width/2, y - height/2, z + length/2);
// Left face
rlNormal3f( - 1.0f, 0.0f, 0.0f);
rlTexCoord2f(source.x/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y - height/2, z - length/2);
rlTexCoord2f((source.x + source.width)/texWidth, (source.y + source.height)/texHeight);
rlVertex3f(x - width/2, y - height/2, z + length/2);
rlTexCoord2f((source.x + source.width)/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y + height/2, z + length/2);
rlTexCoord2f(source.x/texWidth, source.y/texHeight);
rlVertex3f(x - width/2, y + height/2, z - length/2);
rlEnd();
rlSetTexture(0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -28,7 +28,13 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - first person maze"); InitWindow(screenWidth, screenHeight, "raylib [models] example - first person maze");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { { 0.2f, 0.4f, 0.2f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 0.2f, 0.4f, 0.2f }; // Camera position
camera.target = (Vector3){ 0.185f, 0.4f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
Image imMap = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM) Image imMap = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D cubicmap = LoadTextureFromImage(imMap); // Convert image to texture to display (VRAM) Texture2D cubicmap = LoadTextureFromImage(imMap); // Convert image to texture to display (VRAM)
@@ -37,7 +43,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas // NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
// Get map image data to be used for collision detection // Get map image data to be used for collision detection
Color *mapPixels = LoadImageColors(imMap); Color *mapPixels = LoadImageColors(imMap);
@@ -45,7 +51,7 @@ int main(void)
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set camera mode DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -57,7 +63,7 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
Vector3 oldCamPos = camera.position; // Store old camera position Vector3 oldCamPos = camera.position; // Store old camera position
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FIRST_PERSON);
// Check player collision (we simplify to 2D collision detection) // Check player collision (we simplify to 2D collision detection)
Vector2 playerPos = { camera.position.x, camera.position.z }; Vector2 playerPos = { camera.position.x, camera.position.z };

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -66,6 +66,9 @@ int main(void)
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD); DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK); DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
DrawCapsule ((Vector3){-3.0f, 1.5f, -4.0f}, (Vector3){-4.0f, -1.0f, -4.0f}, 1.2f, 8, 8, VIOLET);
DrawCapsuleWires((Vector3){-3.0f, 1.5f, -4.0f}, (Vector3){-4.0f, -1.0f, -4.0f}, 1.2f, 8, 8, PURPLE);
DrawGrid(10, 1.0f); // Draw a grid DrawGrid(10, 1.0f); // Draw a grid
EndMode3D(); EndMode3D();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -26,30 +26,33 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
// Define our custom camera to look into our 3d world // Define our custom camera to look into our 3d world
Camera camera = { { 18.0f, 18.0f, 18.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 18.0f, 21.0f, 18.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM) Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM) Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM) Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM)
Model model = LoadModelFromMesh(mesh); // Load model from generated mesh Model model = LoadModelFromMesh(mesh); // Load model from generated mesh
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Define model position Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Define model position
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode 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 // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@@ -12,13 +12,15 @@
* raylib can load .iqm animations. * raylib can load .iqm animations.
* - VOX > Binary file format. MagikaVoxel mesh format: * - VOX > Binary file format. MagikaVoxel mesh format:
* https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt * https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt
* - M3D > Binary file format. Model 3D format:
* https://bztsrc.gitlab.io/model3d
* *
* Example originally created with raylib 2.0, last time updated with raylib 4.2 * Example originally created with raylib 2.0, last time updated with raylib 4.2
* *
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -55,10 +57,10 @@ int main(void)
// NOTE: bounds are calculated from the original size of the model, // NOTE: bounds are calculated from the original size of the model,
// if model is scaled on drawing, bounds must be also scaled // if model is scaled on drawing, bounds must be also scaled
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
bool selected = false; // Selected object flag bool selected = false; // Selected object flag
DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -67,7 +69,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FIRST_PERSON);
// Load new models/textures on drag&drop // Load new models/textures on drag&drop
if (IsFileDropped()) if (IsFileDropped())
@@ -80,7 +82,8 @@ int main(void)
IsFileExtension(droppedFiles.paths[0], ".gltf") || IsFileExtension(droppedFiles.paths[0], ".gltf") ||
IsFileExtension(droppedFiles.paths[0], ".glb") || IsFileExtension(droppedFiles.paths[0], ".glb") ||
IsFileExtension(droppedFiles.paths[0], ".vox") || IsFileExtension(droppedFiles.paths[0], ".vox") ||
IsFileExtension(droppedFiles.paths[0], ".iqm")) // Model file formats supported IsFileExtension(droppedFiles.paths[0], ".iqm") ||
IsFileExtension(droppedFiles.paths[0], ".m3d")) // Model file formats supported
{ {
UnloadModel(model); // Unload previous model UnloadModel(model); // Unload previous model
model = LoadModel(droppedFiles.paths[0]); // Load new model model = LoadModel(droppedFiles.paths[0]); // Load new model

View File

@@ -1,13 +1,20 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib [models] example - loading gltf * raylib [models] example - loading gltf with animations
*
* LIMITATIONS:
* - Only supports 1 armature per file, and skips loading it if there are multiple armatures
* - Only supports linear interpolation (default method in Blender when checked
* "Always Sample Animations" when exporting a GLTF file)
* - Only supports translation/rotation/scale animation channel.path,
* weights not considered (i.e. morph targets)
* *
* Example originally created with raylib 3.7, last time updated with raylib 4.2 * Example originally created with raylib 3.7, last time updated with raylib 4.2
* *
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2020-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2020-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -27,18 +34,24 @@ int main(void)
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Loaf gltf model // Load gltf model
Model model = LoadModel("resources/models/gltf/robot.glb"); Model model = LoadModel("resources/models/gltf/robot.glb");
// Load gltf model animations
unsigned int animsCount = 0;
unsigned int animIndex = 0;
unsigned int animCurrentFrame = 0;
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/robot.glb", &animsCount);
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode DisableCursor(); // Limit cursor to relative movement inside the window
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -48,22 +61,32 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_THIRD_PERSON);
// Select current animation
if (IsKeyPressed(KEY_UP)) animIndex = (animIndex + 1)%animsCount;
else if (IsKeyPressed(KEY_DOWN)) animIndex = (animIndex + animsCount - 1)%animsCount;
// Update model animation
ModelAnimation anim = modelAnimations[animIndex];
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
UpdateModelAnimation(model, anim, animCurrentFrame);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(SKYBLUE); ClearBackground(RAYWHITE);
BeginMode3D(camera); BeginMode3D(camera);
DrawModel(model, position, 1.0f, WHITE); DrawModel(model, position, 1.0f, WHITE); // Draw animated model
DrawGrid(10, 1.0f); // Draw a grid DrawGrid(10, 1.0f);
EndMode3D(); EndMode3D();
DrawText("Use the UP/DOWN arrow keys to switch animation", 10, 10, 20, GRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,173 @@
/*******************************************************************************************
*
* raylib [models] example - Load models M3D
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by bzt (@bztsrc) and reviewed by Ramon Santamaria (@raysan5)
*
* NOTES:
* - Model3D (M3D) fileformat specs: https://gitlab.com/bztsrc/model3d
* - Bender M3D exported: https://gitlab.com/bztsrc/model3d/-/tree/master/blender
*
* 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-2023 bzt (@bztsrc)
*
********************************************************************************************/
#include "raylib.h"
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - M3D model loading");
// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 1.5f, 1.5f, 1.5f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.4f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
bool drawMesh = 1;
bool drawSkeleton = 1;
bool animPlaying = false; // Store anim state, what to draw
// Load model
Model model = LoadModel(modelFileName); // Load the bind-pose model mesh and basic data
// Load animations
unsigned int animsCount = 0;
int animFrameCounter = 0, animId = 0;
ModelAnimation *anims = LoadModelAnimations(modelFileName, &animsCount); // Load skeletal animation data
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
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_FIRST_PERSON);
if (animsCount)
{
// Play animation when spacebar is held down (or step one frame with N)
if (IsKeyDown(KEY_SPACE) || IsKeyPressed(KEY_N))
{
animFrameCounter++;
if (animFrameCounter >= anims[animId].frameCount) animFrameCounter = 0;
UpdateModelAnimation(model, anims[animId], animFrameCounter);
animPlaying = true;
}
// Select animation by pressing A
if (IsKeyPressed(KEY_A))
{
animFrameCounter = 0;
animId++;
if (animId >= animsCount) animId = 0;
UpdateModelAnimation(model, anims[animId], 0);
animPlaying = true;
}
}
// Toggle skeleton drawing
if (IsKeyPressed(KEY_S)) drawSkeleton ^= 1;
// Toggle mesh drawing
if (IsKeyPressed(KEY_M)) drawMesh ^= 1;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
// Draw 3d model with texture
if (drawMesh) DrawModel(model, position, 1.0f, WHITE);
// Draw the animated skeleton
if (drawSkeleton)
{
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
// needed to workaround buggy models
// without a -1, we would always draw a cube at the origin
for (int i = 0; i < model.boneCount - 1; i++)
{
// By default the model is loaded in bind-pose by LoadModel().
// But if UpdateModelAnimation() has been called at least once
// then the model is already in animation pose, so we need the animated skeleton
if (!animPlaying || !animsCount)
{
// Display the bind-pose skeleton
DrawCube(model.bindPose[i].translation, 0.04f, 0.04f, 0.04f, RED);
if (model.bones[i].parent >= 0)
{
DrawLine3D(model.bindPose[i].translation,
model.bindPose[model.bones[i].parent].translation, RED);
}
}
else
{
// Display the frame-pose skeleton
DrawCube(anims[animId].framePoses[animFrameCounter][i].translation, 0.05f, 0.05f, 0.05f, RED);
if (anims[animId].bones[i].parent >= 0)
{
DrawLine3D(anims[animId].framePoses[animFrameCounter][i].translation,
anims[animId].framePoses[animFrameCounter][anims[animId].bones[i].parent].translation, RED);
}
}
}
}
DrawGrid(10, 1.0f); // Draw a grid
EndMode3D();
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 60, 10, MAROON);
DrawText("PRESS A to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
DrawText("PRESS M to toggle MESH, S to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
DrawText("(c) CesiumMan model by KhronosGroup", GetScreenWidth() - 210, GetScreenHeight() - 20, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload model animations data
UnloadModelAnimations(anims, animsCount);
UnloadModel(model); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5) * Copyright (c) 2021-2023 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -43,7 +43,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load MagicaVoxel files // Load MagicaVoxel files
Model models[MAX_VOX_FILES] = { 0 }; Model models[MAX_VOX_FILES] = { 0 };
@@ -69,8 +69,6 @@ int main(void)
int currentModel = 0; int currentModel = 0;
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -79,7 +77,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
// Cycle between models on mouse click // Cycle between models on mouse click
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES; if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES;

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2017-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -68,8 +68,6 @@ int main(void)
int currentModel = 0; int currentModel = 0;
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -78,7 +76,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{ {

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2017-2022 Joel Davis (@joeld42) and Ramon Santamaria (@raysan5) * Copyright (c) 2017-2023 Joel Davis (@joeld42) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -36,7 +36,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Ray ray = { 0 }; // Picking ray Ray ray = { 0 }; // Picking ray
@@ -64,8 +64,6 @@ int main(void)
Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f }; Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f };
float sr = 4.0f; float sr = 4.0f;
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
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 // Main game loop
@@ -73,7 +71,14 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); if (IsCursorHidden()) UpdateCamera(&camera, CAMERA_FIRST_PERSON); // Update camera
// Toggle camera controls
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT))
{
if (IsCursorHidden()) EnableCursor();
else DisableCursor();
}
// Display information about closest hit // Display information about closest hit
RayCollision collision = { 0 }; RayCollision collision = { 0 };
@@ -219,7 +224,7 @@ int main(void)
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
} }
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY); DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY); DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2018-2022 Max Danielsson (@autious) and Ramon Santamaria (@raysan5) * Copyright (c) 2018-2023 Max Danielsson (@autious) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2018-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2018-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -43,13 +43,11 @@ int main(void)
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 16.0f, 16.0f, 16.0f }; camera.position = (Vector3){ 16.0f, 16.0f, 16.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
SetCameraMode(camera, CAMERA_FREE);
float rotationSpeed = 0.2f; // General system rotation speed float rotationSpeed = 0.2f; // General system rotation speed
@@ -66,7 +64,7 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_ORBITAL);
earthRotation += (5.0f*rotationSpeed); earthRotation += (5.0f*rotationSpeed);
earthOrbitRotation += (365/360.0f*(5.0f*rotationSpeed)*rotationSpeed); earthOrbitRotation += (365/360.0f*(5.0f*rotationSpeed)*rotationSpeed);

View File

@@ -7,7 +7,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2017-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2017-2023 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -38,7 +38,12 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - skybox loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [models] example - skybox loading and drawing");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { { 1.0f, 1.0f, 1.0f }, { 4.0f, 1.0f, 4.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 1.0f, 1.0f, 1.0f }; // Camera position
camera.target = (Vector3){ 4.0f, 1.0f, 4.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load skybox model // Load skybox model
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f); Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
@@ -87,17 +92,17 @@ int main(void)
UnloadImage(img); UnloadImage(img);
} }
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode DisableCursor(); // Limit cursor to relative movement inside the window
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 // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera, CAMERA_FIRST_PERSON);
// Load new cubemap texture on drag&drop // Load new cubemap texture on drag&drop
if (IsFileDropped()) if (IsFileDropped())

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Codecat (@codecat) and Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Codecat (@codecat) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -31,11 +31,11 @@ int main()
// Initialize the camera // Initialize the camera
Camera3D camera = { 0 }; Camera3D camera = { 0 };
camera.position = (Vector3){ 30.0f, 20.0f, 30.0f }; camera.position = (Vector3){ 30.0f, 20.0f, 30.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 70.0f; camera.fovy = 70.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Specify the amount of blocks in each direction // Specify the amount of blocks in each direction
const int numBlocks = 15; const int numBlocks = 15;

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2017-2022 Berni (@Berni8k) and Ramon Santamaria (@raysan5) * Copyright (c) 2017-2023 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2019-2022 Juan Miguel López (@flashback-fx ) and Ramon Santamaria (@raysan5) * Copyright (c) 2019-2023 Juan Miguel López (@flashback-fx ) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2020-2022 Kristian Holmgren (@defutura) and Ramon Santamaria (@raysan5) * Copyright (c) 2020-2023 Kristian Holmgren (@defutura) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software * BSD-like license that allows static linking with closed source software
* *
* Copyright (c) 2021-2022 Stephan Soller (@arkanis) and Ramon Santamaria (@raysan5) * Copyright (c) 2021-2023 Stephan Soller (@arkanis) and Ramon Santamaria (@raysan5)
* *
******************************************************************************************** ********************************************************************************************
* *
@@ -26,21 +26,29 @@
#include "raylib.h" #include "raylib.h"
#include "rlgl.h" // Required for: rlDrawRenderBatchActive(), rlGetMatrixModelview(), rlGetMatrixProjection()
#if defined(__APPLE__)
#include <OpenGL/gl3.h> // OpenGL 3 library for OSX
#include <OpenGL/gl3ext.h> // OpenGL 3 extensions library for OSX
#else
#include "glad.h" // Required for: OpenGL functionality
#endif
#include "raymath.h" // Required for: MatrixMultiply(), MatrixToFloat()
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330 #if defined(GRAPHICS_API_OPENGL_ES2)
#include "glad_gles2.h" // Required for: OpenGL functionality
#define glGenVertexArrays glGenVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glDeleteVertexArrays glDeleteVertexArraysOES
#define GLSL_VERSION 100
#else
#if defined(__APPLE__)
#include <OpenGL/gl3.h> // OpenGL 3 library for OSX
#include <OpenGL/gl3ext.h> // OpenGL 3 extensions library for OSX
#else
#include "glad.h" // Required for: OpenGL functionality
#endif
#define GLSL_VERSION 330
#endif
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100 #define GLSL_VERSION 100
#endif #endif
#include "rlgl.h" // Required for: rlDrawRenderBatchActive(), rlGetMatrixModelview(), rlGetMatrixProjection()
#include "raymath.h" // Required for: MatrixMultiply(), MatrixToFloat()
#define MAX_PARTICLES 1000 #define MAX_PARTICLES 1000
// Particle type // Particle type
@@ -97,7 +105,9 @@ int main(void)
glBindVertexArray(0); glBindVertexArray(0);
// Allows the vertex shader to set the point size of each particle individually // Allows the vertex shader to set the point size of each particle individually
#ifndef GRAPHICS_API_OPENGL_ES2
glEnable(GL_PROGRAM_POINT_SIZE); glEnable(GL_PROGRAM_POINT_SIZE);
#endif
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -60,7 +60,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* --------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------
* *
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2023 Ramon Santamaria (@raysan5)
* *
* This software is provided "as-is", without any express or implied warranty. In no event * 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. * will the authors be held liable for any damages arising from the use of this software.
@@ -109,7 +109,7 @@ EASEDEF float EaseLinearInOut(float t, float b, float c, float d) { return (c*t/
// Sine Easing functions // Sine Easing functions
EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cosf(t/d*(PI/2.0f)) + c + b); } // Ease: Sine In EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cosf(t/d*(PI/2.0f)) + c + b); } // Ease: Sine In
EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t/d*(PI/2.0f)) + b); } // Ease: Sine Out EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t/d*(PI/2.0f)) + b); } // Ease: Sine Out
EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } // Ease: Sine Out EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } // Ease: Sine In Out
// Circular Easing functions // Circular Easing functions
EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); } // Ease: Circular In EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); } // Ease: Circular In

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