Compare commits
320 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1327b570e3 | ||
![]() |
be8eea9eda | ||
![]() |
97c2744a16 | ||
![]() |
52ba44c474 | ||
![]() |
da5407b776 | ||
![]() |
bc15c19518 | ||
![]() |
7351240218 | ||
![]() |
c3a1c8c8eb | ||
![]() |
73b54c862e | ||
![]() |
411d0ee437 | ||
![]() |
8d5a90ea3c | ||
![]() |
9ff47fc807 | ||
![]() |
115ba2b079 | ||
![]() |
f2389a1e55 | ||
![]() |
f7c3035b8c | ||
![]() |
c8a6093d52 | ||
![]() |
557aeff253 | ||
![]() |
a3a5aa7c63 | ||
![]() |
83d82b6697 | ||
![]() |
f27ea1f0c8 | ||
![]() |
7eb49d1c7b | ||
![]() |
477f5e5436 | ||
![]() |
577a8de7c0 | ||
![]() |
a2b3b1ebe4 | ||
![]() |
36e99860ee | ||
![]() |
c9020ece5d | ||
![]() |
b335927665 | ||
![]() |
eb461512a7 | ||
![]() |
4d2906b0a5 | ||
![]() |
5c9cc3f9f7 | ||
![]() |
b9acbbbc66 | ||
![]() |
421ae5bbd8 | ||
![]() |
97c4333803 | ||
![]() |
acf211a5fa | ||
![]() |
33cc18ed51 | ||
![]() |
f9c6ca468a | ||
![]() |
06986f36b3 | ||
![]() |
18b22523cc | ||
![]() |
8a1779b2ad | ||
![]() |
97ef81914c | ||
![]() |
528b879955 | ||
![]() |
719365f209 | ||
![]() |
2b1849e57d | ||
![]() |
2e7a7877a5 | ||
![]() |
3ab7f70e31 | ||
![]() |
9d230d753b | ||
![]() |
e75f85ce58 | ||
![]() |
30f8dd6e37 | ||
![]() |
b8cd10264b | ||
![]() |
37f60e75e7 | ||
![]() |
b68d0850b1 | ||
![]() |
10e4aa32f8 | ||
![]() |
1896268775 | ||
![]() |
2d5d0c2999 | ||
![]() |
ecc80bbcea | ||
![]() |
30a9a24db9 | ||
![]() |
18e9784c6d | ||
![]() |
8cf76ec113 | ||
![]() |
b0c6972e5c | ||
![]() |
d7debba222 | ||
![]() |
d55527953a | ||
![]() |
9cce5a93ff | ||
![]() |
76fe16259d | ||
![]() |
97a8fe1e15 | ||
![]() |
a316f9e7fc | ||
![]() |
c104a97590 | ||
![]() |
bdda1efd44 | ||
![]() |
8a82e17a79 | ||
![]() |
c147ab51c9 | ||
![]() |
a69d401433 | ||
![]() |
8bd6bb622c | ||
![]() |
67a693fc5b | ||
![]() |
d6f3891009 | ||
![]() |
c03ab03627 | ||
![]() |
75e5cd86d7 | ||
![]() |
6e18d96e7a | ||
![]() |
0f447f1fb6 | ||
![]() |
d41e3141f1 | ||
![]() |
0f39051562 | ||
![]() |
ec6d3bb688 | ||
![]() |
927a030bbf | ||
![]() |
3d0d54e070 | ||
![]() |
fefe8fcda9 | ||
![]() |
46bac461ce | ||
![]() |
1d2b43402e | ||
![]() |
752baac00c | ||
![]() |
8157d4283e | ||
![]() |
150663f78a | ||
![]() |
d047597244 | ||
![]() |
fc0d132566 | ||
![]() |
de3dc94d5b | ||
![]() |
9393500bff | ||
![]() |
76adf883fd | ||
![]() |
71a8d09a63 | ||
![]() |
9646497216 | ||
![]() |
b27e98a428 | ||
![]() |
9c9fba6a6c | ||
![]() |
828d273698 | ||
![]() |
21f5482e0d | ||
![]() |
4fa66f2635 | ||
![]() |
8f228626a2 | ||
![]() |
5ed83dfa29 | ||
![]() |
dfd0436428 | ||
![]() |
b3f82a148a | ||
![]() |
83628933f0 | ||
![]() |
8189bddefb | ||
![]() |
820343e7ac | ||
![]() |
f95dc2d565 | ||
![]() |
5a33f19964 | ||
![]() |
016b7d0a3a | ||
![]() |
e4dcbd5180 | ||
![]() |
a86c93ebc0 | ||
![]() |
e2d4463886 | ||
![]() |
e0afb8942e | ||
![]() |
7a1c0d2547 | ||
![]() |
bf705a63de | ||
![]() |
d873d0f173 | ||
![]() |
9161c55d59 | ||
![]() |
fc88518067 | ||
![]() |
c25b52b1b3 | ||
![]() |
93f59a6f59 | ||
![]() |
f1c31bee27 | ||
![]() |
0959f6ebf6 | ||
![]() |
90f1749965 | ||
![]() |
42cfabc670 | ||
![]() |
03ecf2202e | ||
![]() |
bef818e210 | ||
![]() |
db55bed72b | ||
![]() |
c9864d8ac1 | ||
![]() |
b82217eaaa | ||
![]() |
dc621ca388 | ||
![]() |
6094869e3e | ||
![]() |
62f5382d56 | ||
![]() |
601cadbae6 | ||
![]() |
d3058fe589 | ||
![]() |
5b4aaf4eb1 | ||
![]() |
464e714a2e | ||
![]() |
04678bc585 | ||
![]() |
b60c691816 | ||
![]() |
e7664d5684 | ||
![]() |
4fd40f0333 | ||
![]() |
d3ea649832 | ||
![]() |
44659b7ba8 | ||
![]() |
962030e70a | ||
![]() |
5d28bad0ad | ||
![]() |
ac6f889dfc | ||
![]() |
298f93ef50 | ||
![]() |
32b54be5cb | ||
![]() |
090b857912 | ||
![]() |
295e8c2a2f | ||
![]() |
ad2338b994 | ||
![]() |
1310617a92 | ||
![]() |
5635e4214c | ||
![]() |
055fd752c2 | ||
![]() |
7124a14a60 | ||
![]() |
d6f16b7664 | ||
![]() |
954c60100f | ||
![]() |
a9ff13a367 | ||
![]() |
52541b4a1f | ||
![]() |
e0c80f5ddd | ||
![]() |
86f95d7150 | ||
![]() |
70286c7cdc | ||
![]() |
b980268ba7 | ||
![]() |
22895ba14f | ||
![]() |
bc9c063254 | ||
![]() |
8096f142ec | ||
![]() |
290ec11e7c | ||
![]() |
7f21cf1dcf | ||
![]() |
e8181a5ddf | ||
![]() |
2061bfc5e8 | ||
![]() |
bc40012ca3 | ||
![]() |
b807c590cb | ||
![]() |
0b9fae3c53 | ||
![]() |
4b6cbd2340 | ||
![]() |
91e4eea52d | ||
![]() |
334e96d470 | ||
![]() |
685d47938b | ||
![]() |
668b37e111 | ||
![]() |
4f9235f6eb | ||
![]() |
58bd10edb2 | ||
![]() |
13a26a0fa2 | ||
![]() |
3c4ce9c99b | ||
![]() |
225b4fb3e2 | ||
![]() |
dd2d64e058 | ||
![]() |
ffe4d36e0a | ||
![]() |
fdc28fce80 | ||
![]() |
e8af875756 | ||
![]() |
64bb2fe3ec | ||
![]() |
d1ab031a27 | ||
![]() |
5361d498c3 | ||
![]() |
4fc5e82e30 | ||
![]() |
3e4e4b32fd | ||
![]() |
48e2663d03 | ||
![]() |
df90da0b37 | ||
![]() |
e190b7eee9 | ||
![]() |
ceafbcf9d2 | ||
![]() |
5834e970eb | ||
![]() |
0c126af717 | ||
![]() |
2d518bfbcd | ||
![]() |
77d025ebda | ||
![]() |
974460b072 | ||
![]() |
fa698fb05e | ||
![]() |
5e1a81555c | ||
![]() |
3a90acf08e | ||
![]() |
830e328df0 | ||
![]() |
2209e5b0ca | ||
![]() |
a0a18384cb | ||
![]() |
7392c4b0c5 | ||
![]() |
f385d0ce1c | ||
![]() |
2e00d16f3d | ||
![]() |
6aada7d5ec | ||
![]() |
753c0b3853 | ||
![]() |
f8b352f6d9 | ||
![]() |
ba802fdd5e | ||
![]() |
b1b6ae3905 | ||
![]() |
2dec56e7b7 | ||
![]() |
e497603678 | ||
![]() |
a18667c2e9 | ||
![]() |
45c00ab9d4 | ||
![]() |
924bb7226b | ||
![]() |
15cbf313bb | ||
![]() |
4a371a5197 | ||
![]() |
aad51d4704 | ||
![]() |
20860e2ba0 | ||
![]() |
5ef50ae139 | ||
![]() |
144ae120ab | ||
![]() |
e465ed0850 | ||
![]() |
bf69b38056 | ||
![]() |
2937f2010c | ||
![]() |
a4a6d4da8a | ||
![]() |
84ae26cdc0 | ||
![]() |
e96dc46d38 | ||
![]() |
1b4634702c | ||
![]() |
3a841ac130 | ||
![]() |
f31df7521a | ||
![]() |
51387dfbfb | ||
![]() |
a3e78c5453 | ||
![]() |
fe6973a4f6 | ||
![]() |
76e39e502c | ||
![]() |
3a3e672804 | ||
![]() |
c3f049fd74 | ||
![]() |
675efbda3b | ||
![]() |
e17cf9ecd7 | ||
![]() |
3f8ef4e05f | ||
![]() |
3438325e7d | ||
![]() |
6b92d71ea1 | ||
![]() |
26a3536958 | ||
![]() |
818312683e | ||
![]() |
cc17a7656c | ||
![]() |
5978358e58 | ||
![]() |
452e3b494c | ||
![]() |
af4b97a301 | ||
![]() |
152262dbfc | ||
![]() |
fe595d60f7 | ||
![]() |
81e2c97095 | ||
![]() |
204c6765bd | ||
![]() |
05e71f990c | ||
![]() |
53b7b26c45 | ||
![]() |
de748dfffe | ||
![]() |
5573f0f1c7 | ||
![]() |
abcbd9817e | ||
![]() |
a48bb6e1ed | ||
![]() |
fc56940055 | ||
![]() |
3a21301724 | ||
![]() |
7d68aa6869 | ||
![]() |
a4a5a798bd | ||
![]() |
ed2caa1277 | ||
![]() |
59596e4266 | ||
![]() |
66f0de2807 | ||
![]() |
662dfad670 | ||
![]() |
98cb7a19a1 | ||
![]() |
e2996f167e | ||
![]() |
64f2f86d32 | ||
![]() |
6472928cf1 | ||
![]() |
ac2e9cd00f | ||
![]() |
b9b045cdd8 | ||
![]() |
838fc7e303 | ||
![]() |
05af08080e | ||
![]() |
2d04dd8b88 | ||
![]() |
7b7c0c83ef | ||
![]() |
535680668b | ||
![]() |
771957458d | ||
![]() |
9d38363e09 | ||
![]() |
e2da32e2da | ||
![]() |
70d7f67bd8 | ||
![]() |
709b14180a | ||
![]() |
9aa71f04f2 | ||
![]() |
8f741d894a | ||
![]() |
e57ee9c0e8 | ||
![]() |
06c17ab7f1 | ||
![]() |
d8c7b01a3c | ||
![]() |
8367abad1a | ||
![]() |
17c443ee6d | ||
![]() |
1a110dcbd7 | ||
![]() |
02bd709043 | ||
![]() |
1fc8f1bdbf | ||
![]() |
57082d6600 | ||
![]() |
6287f68c0b | ||
![]() |
0925851f89 | ||
![]() |
770e239f73 | ||
![]() |
0d4db7ad7f | ||
![]() |
19892a3c3a | ||
![]() |
ecb6a6af32 | ||
![]() |
8b8eddc8e2 | ||
![]() |
e55bdd5d8a | ||
![]() |
02a8a49961 | ||
![]() |
7565e274b1 | ||
![]() |
d61303b1b0 | ||
![]() |
04229c5854 | ||
![]() |
a139ba9c48 | ||
![]() |
4f43ceb0d2 | ||
![]() |
9f7a49bec3 | ||
![]() |
ace7aef0e6 | ||
![]() |
e450c75f6f | ||
![]() |
08670ecea1 | ||
![]() |
03e19c7f43 | ||
![]() |
3c02f0c75b | ||
![]() |
2e02474b7a | ||
![]() |
c14c7f0b69 | ||
![]() |
76b5959bb5 |
1
.github/ISSUE_TEMPLATE/new-issue-template.md
vendored
@@ -21,6 +21,7 @@ Please, before submitting a new issue verify and check:
|
|||||||
|
|
||||||
- [ ] I tested it on latest raylib version from master branch
|
- [ ] I tested it on latest raylib version from master branch
|
||||||
- [ ] I checked there is no similar issue already reported
|
- [ ] I checked there is no similar issue already reported
|
||||||
|
- [ ] I checked the documentation on the [wiki](https://github.com/raysan5/raylib/wiki)
|
||||||
- [ ] My code has no errors or misuse of raylib
|
- [ ] My code has no errors or misuse of raylib
|
||||||
|
|
||||||
### Issue description
|
### Issue description
|
||||||
|
2
.github/workflows/linux.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for actions/upload-release-asset to upload release asset
|
contents: write # for actions/upload-release-asset to upload release asset
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 1
|
max-parallel: 1
|
||||||
|
2
.github/workflows/webassembly.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
|
|
||||||
- name: Setup emsdk
|
- name: Setup emsdk
|
||||||
uses: mymindstorm/setup-emsdk@v11
|
uses: mymindstorm/setup-emsdk@v12
|
||||||
with:
|
with:
|
||||||
version: 3.1.30
|
version: 3.1.30
|
||||||
actions-cache-folder: 'emsdk-cache'
|
actions-cache-folder: 'emsdk-cache'
|
||||||
|
115
BINDINGS.md
@@ -6,80 +6,88 @@ 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.2** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib |
|
| raylib | **4.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib |
|
||||||
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo |
|
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo |
|
||||||
| Raylib-cs | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs |
|
| Raylib-cs | **4.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs |
|
||||||
| Raylib-CsLo | **4.2** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo |
|
| 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 |
|
||||||
| claylib/wrap | **4.2** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib |
|
| claylib/wrap | **4.5** | [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 |
|
| claw-raylib | **auto** | [Common Lisp](https://common-lisp.net/) | Apache-2.0 | https://github.com/bohonghuang/claw-raylib |
|
||||||
| raylib-cr | **4.5-dev (7e7939e)** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr |
|
| chez-raylib | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme/) | GPLv3 | https://github.com/Yunoinsky/chez-raylib |
|
||||||
| ray-cyber | **4.2** | [Cyber](https://cyberscript.dev) | MIT | https://github.com/fubark/ray-cyber |
|
| raylib-cr | **4.6-dev (5e1a81)** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr |
|
||||||
| raylib-c3 | **4.5-dev** | [C3](https://c3-lang.org/) | MIT | https://github.com/Its-Kenta/Raylib-C3 |
|
| ray-cyber | 4.5 | [Cyber](https://cyberscript.dev) | MIT | https://github.com/fubark/ray-cyber |
|
||||||
| dart-raylib | **4.0** | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib |
|
| raylib-c3 | **4.5** | [C3](https://c3-lang.org/) | Zlib | https://github.com/Its-Kenta/Raylib-C3 |
|
||||||
| bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 |
|
| dart-raylib | 4.0 | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib |
|
||||||
| dray | **4.2** | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray |
|
| bindbc-raylib3 | **4.5** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 |
|
||||||
| raylib-d | **4.2** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d |
|
| dray | 4.2 | [D](https://dlang.org/) | Apache-2.0 | https://github.com/redthing1/dray |
|
||||||
| dlang_raylib | **4.0** | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib |
|
| raylib-d | **4.5** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d |
|
||||||
|
| dlang_raylib | 4.0 | [D](https://dlang.org) | MPL-2.0 |https://github.com/rc-05/dlang_raylib |
|
||||||
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex |
|
| 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.5** | [Factor](https://factorcode.org/) | BSD | https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor |
|
||||||
| raylib-freebasic | **4.2** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic |
|
| raylib-freebasic | **4.5** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic |
|
||||||
| raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
|
| fortran-raylib | **4.5** | [Fortran](https://fortran-lang.org/) | ISC | https://github.com/interkosmos/fortran-raylib |
|
||||||
| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
|
| raylib for Pascal | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | Modified Zlib | https://github.com/tinyBigGAMES/raylib |
|
||||||
|
| raylib-go | 4.5 | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
|
||||||
|
| raylib-guile | **auto** | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
|
||||||
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
|
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
|
||||||
| h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
|
| h-raylib | **4.6-dev** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
|
||||||
| raylib-hx | **4.2** | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
|
| 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.5 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib |
|
||||||
| raylib-j | **4.0** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J |
|
| jaylib | 4.2 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |
|
||||||
| raylib.jl | **4.2** | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl |
|
| raylib-j | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J |
|
||||||
|
| raylib.jl | 4.2 | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl |
|
||||||
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib |
|
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib |
|
||||||
| kaylib | **4.5-dev**| [Kotlin/native](https://kotlinlang.org) | Zlib | https://codeberg.org/Kenta/Kaylib |
|
| KaylibKit | **4.5**| [Kotlin/native](https://kotlinlang.org) | Zlib | https://codeberg.org/Kenta/KaylibKit |
|
||||||
| raylib-lua | **4.2** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua |
|
| raylib-lua | **4.5** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua |
|
||||||
| raylua | **4.0** | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua |
|
| 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 |
|
||||||
| Raylib-Nelua | **4.5-dev** | [nelua](https://nelua.io/) | MIT | https://github.com/Its-Kenta/Raylib-Nelua |
|
| Raylib.nelua | **4.5** | [nelua](https://nelua.io/) | Zlib | https://github.com/Its-Kenta/Raylib-Nelua |
|
||||||
| NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now |
|
| NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now |
|
||||||
|
| raylib-bindings | **4.5** | [Ruby](https://www.ruby-lang.org/en/) | Zlib | https://github.com/vaiorabbit/raylib-bindings |
|
||||||
| raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever |
|
| 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.5** | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib |
|
||||||
|
| raylib-odin | **4.5** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
|
||||||
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings |
|
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings |
|
||||||
| raylib-odin | **4.0** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
|
| raylib-ocaml | **4.5** | [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 |
|
| TurboRaylib | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib |
|
||||||
| TurboRaylib | **4.2** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib |
|
| Ray4Laz | **4.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz |
|
||||||
| 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 |
|
| raylibpyctbg | **4.5** | [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-py | **4.5** | [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-python-ctypes | 4.6-dev | [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-pkpy-bindings | 4.6-dev | [pocketpy](https://pocketpy.dev/) | MIT | https://github.com/blueloveTH/pkpy-bindings |
|
||||||
|
| raylib-php | **4.5** | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php |
|
||||||
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp |
|
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp |
|
||||||
| raylibr | **4.0** | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr |
|
| raylibr | 4.0 | [R](https://www.r-project.org) | MIT | https://github.com/jeroenjanssens/raylibr |
|
||||||
|
| raylib-ffi | 4.5 | [Rust](https://www.rust-lang.org/) | GPLv3 | https://github.com/ewpratten/raylib-ffi |
|
||||||
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | Zlib | https://github.com/deltaphc/raylib-rs |
|
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | Zlib | https://github.com/deltaphc/raylib-rs |
|
||||||
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | ? | https://github.com/RedCubeDev-ByteSpace/Relib |
|
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | ? | https://github.com/RedCubeDev-ByteSpace/Relib |
|
||||||
| racket-raylib | **4.0** | [Racket](https://racket-lang.org/) | MIT/Apache-2.0 | https://github.com/eutro/racket-raylib |
|
| racket-raylib | 4.0 | [Racket](https://racket-lang.org/) | MIT/Apache-2.0 | https://github.com/eutro/racket-raylib |
|
||||||
| raylib-swift | **4.0** | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib |
|
| raylib-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-umka | **4.2** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka |
|
| raylib-umka | **4.5** | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib | https://github.com/robloach/raylib-umka |
|
||||||
| raylib.v | **4.2** | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v |
|
| raylib.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-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.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
|
| raylib-zig | 4.2 | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
|
||||||
| raylib.zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
|
| raylib.zig | **4.5** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
|
||||||
| hare-raylib | auto | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib |
|
| 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 |
|
| 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 |
|
| rayed-bqn | **auto** | [BQN](https://mlochbaum.github.io/BQN/) | MIT | https://github.com/Brian-ED/rayed-bqn |
|
||||||
|
| rayjs | 4.6-dev | [QuickJS](https://bellard.org/quickjs/) | MIT | https://github.com/mode777/rayjs |
|
||||||
|
| raylib-raku | **auto** | [Raku](https://www.raku.org/) | Artistic License 2.0 | https://github.com/vushu/raylib-raku |
|
||||||
|
|
||||||
### 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.2** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp |
|
| raylib-cpp | **4.5** | [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 |
|
| claylib | **4.5** | [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.
|
||||||
@@ -132,7 +140,6 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
|||||||
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kujukuju/raylib-jai |
|
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kujukuju/raylib-jai |
|
||||||
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
|
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
|
||||||
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
||||||
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
|
|
||||||
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
||||||
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
||||||
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
||||||
|
@@ -38,14 +38,16 @@ cmake_dependent_option(SUPPORT_MODULE_RAUDIO "Include module: raudio" ON CUSTOMI
|
|||||||
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" OFF CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
|
||||||
|
cmake_dependent_option(SUPPORT_EVENTS_AUTOMATION "Support automatic generated events, loading and recording of those events when required" OFF CUSTOMIZE_BUILD OFF)
|
||||||
|
cmake_dependent_option(SUPPORT_CUSTOM_FRAME_CONTROL "Enabling this flag allows manual control of the frame processes, use at your own risk" OFF CUSTOMIZE_BUILD OFF)
|
||||||
|
|
||||||
# rshapes.c
|
# rshapes.c
|
||||||
cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
|
||||||
@@ -57,22 +59,25 @@ cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editin
|
|||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PNG "Support loading PNG as textures" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_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_PIC "Support loading PIC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_PNM "Support loading PNM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
|
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
|
cmake_dependent_option(SUPPORT_FILEFORMAT_SVG "Support loading SVG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
|
|
||||||
# rtext.c
|
# rtext.c
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
|
||||||
|
cmake_dependent_option(SUPPORT_FONT_ATLAS_WHITE_REC "Support white rec on font atlas bottom-right corner" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
||||||
# rmodels.c
|
# rmodels.c
|
||||||
cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
|
||||||
@@ -81,6 +86,7 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format"
|
|||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
|
||||||
|
cmake_dependent_option(SUPPORT_FILEFORMAT_M3D "Support loading M3D file format" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
||||||
# raudio.c
|
# raudio.c
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
|
||||||
@@ -88,6 +94,7 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_OGG "Support loading OGG for sound" O
|
|||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_XM "Support loading XM for sound" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_MOD "Support loading MOD for sound" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_MP3 "Support loading MP3 for sound" ON CUSTOMIZE_BUILD ON)
|
||||||
|
cmake_dependent_option(SUPPORT_FILEFORMAT_QOA "Support loading QOA for sound" ON CUSTOMIZE_BUILD ON)
|
||||||
cmake_dependent_option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF} CUSTOMIZE_BUILD OFF)
|
cmake_dependent_option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||||
|
|
||||||
# utils.c
|
# utils.c
|
||||||
|
7
FAQ.md
@@ -14,12 +14,13 @@
|
|||||||
- [What does raylib provide that other engines or libraries don't?](#what-does-raylib-provide-that-other-engines-or-libraries-dont)
|
- [What does raylib provide that other engines or libraries don't?](#what-does-raylib-provide-that-other-engines-or-libraries-dont)
|
||||||
- [How does raylib compare to Unity/Unreal/Godot?](#how-does-raylib-compare-to-unityunrealgodot)
|
- [How does raylib compare to Unity/Unreal/Godot?](#how-does-raylib-compare-to-unityunrealgodot)
|
||||||
- [What development tools are required for raylib?](#what-development-tools-are-required-for-raylib)
|
- [What development tools are required for raylib?](#what-development-tools-are-required-for-raylib)
|
||||||
- [Which are raylib external dependencies?](#which-are-raylib-external-dependencies)
|
- [What are raylib's external dependencies?](#what-are-raylibs-external-dependencies)
|
||||||
- [Can I use raylib with other technologies or libraries?](#can-i-use-raylib-with-other-technologies-or-libraries)
|
- [Can I use raylib with other technologies or libraries?](#can-i-use-raylib-with-other-technologies-or-libraries)
|
||||||
- [What file formats are supported by raylib?](#what-file-formats-are-supported-by-raylib)
|
- [What file formats are supported by raylib?](#what-file-formats-are-supported-by-raylib)
|
||||||
- [Does raylib support the Vulkan API?](#does-raylib-support-the-vulkan-api)
|
- [Does raylib support the Vulkan API?](#does-raylib-support-the-vulkan-api)
|
||||||
- [What could I expect to see in raylib in the future?](#what-could-i-expect-to-see-in-raylib-in-the-future)
|
- [What could I expect to see in raylib in the future?](#what-could-i-expect-to-see-in-raylib-in-the-future)
|
||||||
- [Who are the raylib developers?](#who-are-the-raylib-developers)
|
- [Who are the raylib developers?](#who-are-the-raylib-developers)
|
||||||
|
- [MORE QUESTIONS...](https://github.com/raysan5/raylib/wiki/Frequently-Asked-Questions)
|
||||||
|
|
||||||
### What is raylib?
|
### What is raylib?
|
||||||
|
|
||||||
@@ -119,8 +120,8 @@ raylib can load data from multiple standard file formats:
|
|||||||
|
|
||||||
- Image/Textures: PNG, BMP, TGA, JPG, GIF, QOI, PSD, DDS, HDR, KTX, ASTC, PKM, PVR
|
- Image/Textures: PNG, BMP, TGA, JPG, GIF, QOI, PSD, DDS, HDR, KTX, ASTC, PKM, PVR
|
||||||
- Fonts: FNT (sprite font), TTF, OTF
|
- Fonts: FNT (sprite font), TTF, OTF
|
||||||
- Models/Meshes: OBJ, IQM, GLTF, VOX
|
- Models/Meshes: OBJ, IQM, GLTF, VOX, M3D
|
||||||
- Audio: WAV, OGG, MP3, FLAC, XM, MOD
|
- Audio: WAV, OGG, MP3, FLAC, XM, MOD, QOA
|
||||||
|
|
||||||
### Does raylib support the Vulkan API?
|
### Does raylib support the Vulkan API?
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ introduction
|
|||||||
|
|
||||||
I started developing videogames in 2006 and some years later I started teaching videogames development to young people with artistic profile, most of students had never written a single line of code.
|
I started developing videogames in 2006 and some years later I started teaching videogames development to young people with artistic profile, most of students had never written a single line of code.
|
||||||
|
|
||||||
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](http://www.codecutter.net/tools/winbgim/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
|
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](https://winbgim.codecutter.org/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
|
||||||
|
|
||||||
But WinBGI was not the clearer and most organized library for my taste. There were lots of things I found confusing and some function names were not clear enough for most of the students; not to mention the lack of transparencies support and no hardware acceleration.
|
But WinBGI was not the clearer and most organized library for my taste. There were lots of things I found confusing and some function names were not clear enough for most of the students; not to mention the lack of transparencies support and no hardware acceleration.
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||||
|
|
||||||
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||||
|
|
||||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||||
|
|
||||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
|||||||
|
|
||||||
[](https://github.com/raysan5/raylib/releases)
|
[](https://github.com/raysan5/raylib/releases)
|
||||||
[](https://github.com/raysan5/raylib/stargazers)
|
[](https://github.com/raysan5/raylib/stargazers)
|
||||||
[](https://github.com/raysan5/raylib/commits/master)
|
[](https://github.com/raysan5/raylib/commits/master)
|
||||||
[](https://github.com/sponsors/raysan5)
|
[](https://github.com/sponsors/raysan5)
|
||||||
[](https://repology.org/project/raylib/versions)
|
[](https://repology.org/project/raylib/versions)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
17
build.zig
@@ -1,18 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const raylib = @import("src/build.zig");
|
const raylib = @import("src/build.zig");
|
||||||
|
|
||||||
|
// This has been tested to work with zig master branch as of commit 87de821 or May 14 2023
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
raylib.build(b);
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
|
@@ -28,6 +28,8 @@ if (${CUSTOMIZE_BUILD})
|
|||||||
define_if("raylib" SUPPORT_EVENTS_WAITING)
|
define_if("raylib" SUPPORT_EVENTS_WAITING)
|
||||||
define_if("raylib" SUPPORT_WINMM_HIGHRES_TIMER)
|
define_if("raylib" SUPPORT_WINMM_HIGHRES_TIMER)
|
||||||
define_if("raylib" SUPPORT_COMPRESSION_API)
|
define_if("raylib" SUPPORT_COMPRESSION_API)
|
||||||
|
define_if("raylib" SUPPORT_EVENTS_AUTOMATION)
|
||||||
|
define_if("raylib" SUPPORT_CUSTOM_FRAME_CONTROL)
|
||||||
define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
|
define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
|
||||||
define_if("raylib" SUPPORT_IMAGE_EXPORT)
|
define_if("raylib" SUPPORT_IMAGE_EXPORT)
|
||||||
define_if("raylib" SUPPORT_IMAGE_GENERATION)
|
define_if("raylib" SUPPORT_IMAGE_GENERATION)
|
||||||
@@ -35,6 +37,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_PIC)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_PNM)
|
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)
|
||||||
@@ -46,6 +49,7 @@ if (${CUSTOMIZE_BUILD})
|
|||||||
define_if("raylib" SUPPORT_FILEFORMAT_PSD)
|
define_if("raylib" SUPPORT_FILEFORMAT_PSD)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_PKM)
|
define_if("raylib" SUPPORT_FILEFORMAT_PKM)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_PVR)
|
define_if("raylib" SUPPORT_FILEFORMAT_PVR)
|
||||||
|
define_if("raylib" SUPPORT_FILEFORMAT_SVG)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_FNT)
|
define_if("raylib" SUPPORT_FILEFORMAT_FNT)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_TTF)
|
define_if("raylib" SUPPORT_FILEFORMAT_TTF)
|
||||||
define_if("raylib" SUPPORT_TEXT_MANIPULATION)
|
define_if("raylib" SUPPORT_TEXT_MANIPULATION)
|
||||||
@@ -55,11 +59,13 @@ if (${CUSTOMIZE_BUILD})
|
|||||||
define_if("raylib" SUPPORT_FILEFORMAT_IQM)
|
define_if("raylib" SUPPORT_FILEFORMAT_IQM)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
|
define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_VOX)
|
define_if("raylib" SUPPORT_FILEFORMAT_VOX)
|
||||||
|
define_if("raylib" SUPPORT_FILEFORMAT_M3D)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_WAV)
|
define_if("raylib" SUPPORT_FILEFORMAT_WAV)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_OGG)
|
define_if("raylib" SUPPORT_FILEFORMAT_OGG)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_XM)
|
define_if("raylib" SUPPORT_FILEFORMAT_XM)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_MOD)
|
define_if("raylib" SUPPORT_FILEFORMAT_MOD)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_MP3)
|
define_if("raylib" SUPPORT_FILEFORMAT_MP3)
|
||||||
|
define_if("raylib" SUPPORT_FILEFORMAT_QOA)
|
||||||
define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
|
define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
|
||||||
define_if("raylib" SUPPORT_STANDARD_FILEIO)
|
define_if("raylib" SUPPORT_STANDARD_FILEIO)
|
||||||
define_if("raylib" SUPPORT_TRACELOG)
|
define_if("raylib" SUPPORT_TRACELOG)
|
||||||
@@ -69,17 +75,17 @@ if (${CUSTOMIZE_BUILD})
|
|||||||
else ()
|
else ()
|
||||||
target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
|
target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
|
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
|
||||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
|
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
|
||||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
|
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
|
||||||
target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
|
target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
|
||||||
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_CHAR_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")
|
||||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
|
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
|
||||||
elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")
|
elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
@@ -9,8 +9,7 @@ install(
|
|||||||
# PKG_CONFIG_LIBS_PRIVATE is used in raylib.pc.in
|
# PKG_CONFIG_LIBS_PRIVATE is used in raylib.pc.in
|
||||||
if (NOT BUILD_SHARED_LIBS)
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
include(LibraryPathToLinkerFlags)
|
include(LibraryPathToLinkerFlags)
|
||||||
library_path_to_linker_flags(__PKG_CONFIG_LIBS_PRIVATE "${LIBS_PRIVATE}")
|
set(PKG_CONFIG_LIBS_PRIVATE ${GLFW_PKG_LIBS})
|
||||||
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
|
|
||||||
string(REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
string(REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
||||||
elseif (BUILD_SHARED_LIBS)
|
elseif (BUILD_SHARED_LIBS)
|
||||||
set(PKG_CONFIG_LIBS_EXTRA "")
|
set(PKG_CONFIG_LIBS_EXTRA "")
|
||||||
|
@@ -25,7 +25,7 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
||||||
else ()
|
elseif (UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||||
@@ -36,9 +36,22 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
find_library(OSS_LIBRARY ossaudio)
|
find_library(OSS_LIBRARY ossaudio)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
else ()
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_package(OpenGL QUIET)
|
||||||
|
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||||
|
set(OPENGL_LIBRARIES "GL")
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
|
||||||
if (USE_AUDIO)
|
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||||
|
find_library(OSS_LIBRARY ossaudio)
|
||||||
|
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} dl)
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} dl)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
@@ -60,19 +73,6 @@ elseif (${PLATFORM} MATCHES "Android")
|
|||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Raspberry Pi")
|
|
||||||
set(PLATFORM_CPP "PLATFORM_RPI")
|
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
|
||||||
|
|
||||||
add_definitions(-D_DEFAULT_SOURCE)
|
|
||||||
|
|
||||||
find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
|
|
||||||
find_library(EGL brcmEGL HINTS /opt/vc/lib)
|
|
||||||
find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
|
|
||||||
include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
|
|
||||||
link_directories(/opt/vc/lib)
|
|
||||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
|
|
||||||
|
|
||||||
elseif ("${PLATFORM}" MATCHES "DRM")
|
elseif ("${PLATFORM}" MATCHES "DRM")
|
||||||
set(PLATFORM_CPP "PLATFORM_DRM")
|
set(PLATFORM_CPP "PLATFORM_DRM")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
@@ -93,7 +93,7 @@ elseif ("${PLATFORM}" MATCHES "DRM")
|
|||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT ${OPENGL_VERSION})
|
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
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")
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
# Define required environment variables
|
# Define required environment variables
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
@@ -58,15 +58,6 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
|
|||||||
BUILD_WEB_RESOURCES ?= TRUE
|
BUILD_WEB_RESOURCES ?= TRUE
|
||||||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||||
|
|
||||||
# Use cross-compiler for PLATFORM_RPI
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
|
||||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
||||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
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!
|
||||||
@@ -95,12 +86,6 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
UNAMEOS = $(shell uname)
|
|
||||||
ifeq ($(UNAMEOS),Linux)
|
|
||||||
PLATFORM_OS = LINUX
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
UNAMEOS = $(shell uname)
|
UNAMEOS = $(shell uname)
|
||||||
ifeq ($(UNAMEOS),Linux)
|
ifeq ($(UNAMEOS),Linux)
|
||||||
@@ -118,9 +103,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Default path for raylib on Raspberry Pi
|
# Default path for raylib on Raspberry Pi
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
RAYLIB_PATH ?= /home/pi/raylib
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
RAYLIB_PATH ?= /home/pi/raylib
|
RAYLIB_PATH ?= /home/pi/raylib
|
||||||
endif
|
endif
|
||||||
@@ -154,13 +136,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
# Define RPI cross-compiler
|
|
||||||
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
|
||||||
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# HTML5 emscripten compiler
|
# HTML5 emscripten compiler
|
||||||
# WARNING: To compile to HTML5, code must be redesigned
|
# WARNING: To compile to HTML5, code must be redesigned
|
||||||
@@ -231,9 +206,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
CFLAGS += -std=gnu99
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||||
endif
|
endif
|
||||||
@@ -252,15 +224,15 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Include GLFW required for examples/others/rlgl_standalone.c
|
||||||
|
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||||
|
all others: INCLUDE_PATHS += -I$(RAYLIB_PATH)/src/external/glfw/include
|
||||||
|
endif
|
||||||
|
|
||||||
# Define library paths containing required libs: LDFLAGS
|
# Define library paths containing required libs: LDFLAGS
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
@@ -323,9 +295,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# 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.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define libraries required on linking: LDLIBS
|
# Define libraries required on linking: LDLIBS
|
||||||
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
||||||
@@ -376,14 +345,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
LDLIBS += -lglfw
|
LDLIBS += -lglfw
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
# Libraries for Raspberry Pi compiling
|
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
|
||||||
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
LDLIBS += -lvchiq_arm -lvcos
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
# Libraries for DRM compiling
|
# Libraries for DRM compiling
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
@@ -405,12 +366,15 @@ CORE = \
|
|||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_multitouch \
|
core/core_input_multitouch \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
|
core/core_input_gestures_web \
|
||||||
core/core_2d_camera \
|
core/core_2d_camera \
|
||||||
core/core_2d_camera_platformer \
|
core/core_2d_camera_platformer \
|
||||||
core/core_2d_camera_mouse_zoom \
|
core/core_2d_camera_mouse_zoom \
|
||||||
|
core/core_2d_camera_split_screen \
|
||||||
core/core_3d_camera_mode \
|
core/core_3d_camera_mode \
|
||||||
core/core_3d_camera_free \
|
core/core_3d_camera_free \
|
||||||
core/core_3d_camera_first_person \
|
core/core_3d_camera_first_person \
|
||||||
|
core/core_3d_camera_split_screen \
|
||||||
core/core_3d_picking \
|
core/core_3d_picking \
|
||||||
core/core_world_screen \
|
core/core_world_screen \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
@@ -423,7 +387,6 @@ CORE = \
|
|||||||
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_smooth_pixelperfect \
|
core/core_smooth_pixelperfect \
|
||||||
core/core_custom_frame_control
|
core/core_custom_frame_control
|
||||||
|
|
||||||
@@ -453,6 +416,7 @@ TEXTURES = \
|
|||||||
textures/textures_image_generation \
|
textures/textures_image_generation \
|
||||||
textures/textures_image_loading \
|
textures/textures_image_loading \
|
||||||
textures/textures_image_processing \
|
textures/textures_image_processing \
|
||||||
|
textures/textures_image_rotate \
|
||||||
textures/textures_image_text \
|
textures/textures_image_text \
|
||||||
textures/textures_to_image \
|
textures/textures_to_image \
|
||||||
textures/textures_raw_data \
|
textures/textures_raw_data \
|
||||||
@@ -468,7 +432,8 @@ TEXTURES = \
|
|||||||
textures/textures_draw_tiled \
|
textures/textures_draw_tiled \
|
||||||
textures/textures_polygon \
|
textures/textures_polygon \
|
||||||
textures/textures_gif_player \
|
textures/textures_gif_player \
|
||||||
textures/textures_fog_of_war
|
textures/textures_fog_of_war \
|
||||||
|
textures/textures_svg_loading
|
||||||
|
|
||||||
TEXT = \
|
TEXT = \
|
||||||
text/text_raylib_fonts \
|
text/text_raylib_fonts \
|
||||||
@@ -522,6 +487,7 @@ SHADERS = \
|
|||||||
shaders/shaders_simple_mask \
|
shaders/shaders_simple_mask \
|
||||||
shaders/shaders_spotlight \
|
shaders/shaders_spotlight \
|
||||||
shaders/shaders_hot_reloading \
|
shaders/shaders_hot_reloading \
|
||||||
|
shaders/shaders_lightmap \
|
||||||
shaders/shaders_mesh_instancing \
|
shaders/shaders_mesh_instancing \
|
||||||
shaders/shaders_multi_sample2d \
|
shaders/shaders_multi_sample2d \
|
||||||
shaders/shaders_write_depth \
|
shaders/shaders_write_depth \
|
||||||
@@ -532,15 +498,24 @@ AUDIO = \
|
|||||||
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_sound_multi \
|
||||||
audio/audio_stream_effects \
|
audio/audio_stream_effects \
|
||||||
audio/audio_mixed_processor
|
audio/audio_mixed_processor
|
||||||
|
|
||||||
|
OTHERS = \
|
||||||
|
others/easings_testbed \
|
||||||
|
others/embedded_files_loading \
|
||||||
|
others/raylib_opengl_interop \
|
||||||
|
others/raymath_vector_angle \
|
||||||
|
others/rlgl_compute_shader \
|
||||||
|
others/rlgl_standalone
|
||||||
|
|
||||||
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
|
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
# Define processes to execute
|
# Define processes to execute
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
# Default target entry
|
# Default target entry
|
||||||
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO)
|
all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(OTHERS)
|
||||||
|
|
||||||
core: $(CORE)
|
core: $(CORE)
|
||||||
shapes: $(SHAPES)
|
shapes: $(SHAPES)
|
||||||
@@ -549,6 +524,7 @@ text: $(TEXT)
|
|||||||
models: $(MODELS)
|
models: $(MODELS)
|
||||||
shaders: $(SHADERS)
|
shaders: $(SHADERS)
|
||||||
audio: $(AUDIO)
|
audio: $(AUDIO)
|
||||||
|
others: $(OTHERS)
|
||||||
|
|
||||||
# Generic compilation pattern
|
# Generic compilation pattern
|
||||||
# NOTE: Examples must be ready for Android compilation!
|
# NOTE: Examples must be ready for Android compilation!
|
||||||
@@ -574,10 +550,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
rm -f *.o
|
rm -f *.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
find . -type f -executable -delete
|
|
||||||
rm -fv *.o
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
find . -type f -executable -delete
|
find . -type f -executable -delete
|
||||||
rm -fv *.o
|
rm -fv *.o
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
# Define required environment variables
|
# Define required environment variables
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
PLATFORM ?= PLATFORM_WEB
|
PLATFORM ?= PLATFORM_WEB
|
||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
@@ -51,15 +51,6 @@ 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
|
||||||
|
|
||||||
# Use cross-compiler for PLATFORM_RPI
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
|
||||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
||||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
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!
|
||||||
@@ -88,12 +79,6 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
UNAMEOS = $(shell uname)
|
|
||||||
ifeq ($(UNAMEOS),Linux)
|
|
||||||
PLATFORM_OS = LINUX
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
UNAMEOS = $(shell uname)
|
UNAMEOS = $(shell uname)
|
||||||
ifeq ($(UNAMEOS),Linux)
|
ifeq ($(UNAMEOS),Linux)
|
||||||
@@ -111,9 +96,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Default path for raylib on Raspberry Pi
|
# Default path for raylib on Raspberry Pi
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
RAYLIB_PATH ?= /home/pi/raylib
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
RAYLIB_PATH ?= /home/pi/raylib
|
RAYLIB_PATH ?= /home/pi/raylib
|
||||||
endif
|
endif
|
||||||
@@ -147,13 +129,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
# Define RPI cross-compiler
|
|
||||||
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
|
||||||
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# HTML5 emscripten compiler
|
# HTML5 emscripten compiler
|
||||||
# WARNING: To compile to HTML5, code must be redesigned
|
# WARNING: To compile to HTML5, code must be redesigned
|
||||||
@@ -224,9 +199,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
CFLAGS += -std=gnu99
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||||
endif
|
endif
|
||||||
@@ -245,11 +217,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
|
||||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||||
endif
|
endif
|
||||||
@@ -304,9 +271,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
EXT = .html
|
EXT = .html
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define libraries required on linking: LDLIBS
|
# Define libraries required on linking: LDLIBS
|
||||||
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
||||||
@@ -357,14 +321,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
LDLIBS += -lglfw
|
LDLIBS += -lglfw
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
# Libraries for Raspberry Pi compiling
|
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
|
||||||
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic
|
|
||||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
|
||||||
LDLIBS += -lvchiq_arm -lvcos
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
# Libraries for DRM compiling
|
# Libraries for DRM compiling
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
@@ -386,12 +342,15 @@ CORE = \
|
|||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_multitouch \
|
core/core_input_multitouch \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
|
core/core_input_gestures_web \
|
||||||
core/core_2d_camera \
|
core/core_2d_camera \
|
||||||
core/core_2d_camera_platformer \
|
core/core_2d_camera_platformer \
|
||||||
core/core_2d_camera_mouse_zoom \
|
core/core_2d_camera_mouse_zoom \
|
||||||
|
core/core_2d_camera_split_screen \
|
||||||
core/core_3d_camera_mode \
|
core/core_3d_camera_mode \
|
||||||
core/core_3d_camera_free \
|
core/core_3d_camera_free \
|
||||||
core/core_3d_camera_first_person \
|
core/core_3d_camera_first_person \
|
||||||
|
core/core_3d_camera_split_screen \
|
||||||
core/core_3d_picking \
|
core/core_3d_picking \
|
||||||
core/core_world_screen \
|
core/core_world_screen \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
@@ -403,7 +362,6 @@ CORE = \
|
|||||||
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_smooth_pixelperfect \
|
core/core_smooth_pixelperfect \
|
||||||
core/core_custom_frame_control \
|
core/core_custom_frame_control \
|
||||||
core/core_loading_thread
|
core/core_loading_thread
|
||||||
@@ -449,7 +407,8 @@ TEXTURES = \
|
|||||||
textures/textures_draw_tiled \
|
textures/textures_draw_tiled \
|
||||||
textures/textures_polygon \
|
textures/textures_polygon \
|
||||||
textures/textures_gif_player \
|
textures/textures_gif_player \
|
||||||
textures/textures_fog_of_war
|
textures/textures_fog_of_war \
|
||||||
|
textures/textures_svg_loading
|
||||||
|
|
||||||
TEXT = \
|
TEXT = \
|
||||||
text/text_raylib_fonts \
|
text/text_raylib_fonts \
|
||||||
@@ -503,6 +462,7 @@ SHADERS = \
|
|||||||
shaders/shaders_simple_mask \
|
shaders/shaders_simple_mask \
|
||||||
shaders/shaders_spotlight \
|
shaders/shaders_spotlight \
|
||||||
shaders/shaders_hot_reloading \
|
shaders/shaders_hot_reloading \
|
||||||
|
shaders/shaders_lightmap \
|
||||||
shaders/shaders_mesh_instancing \
|
shaders/shaders_mesh_instancing \
|
||||||
shaders/shaders_multi_sample2d \
|
shaders/shaders_multi_sample2d \
|
||||||
shaders/shaders_write_depth \
|
shaders/shaders_write_depth \
|
||||||
@@ -558,14 +518,20 @@ core/core_input_multitouch: core/core_input_multitouch.c
|
|||||||
core/core_input_gestures: core/core_input_gestures.c
|
core/core_input_gestures: core/core_input_gestures.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_input_gestures_web: core/core_input_gestures_web.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_2d_camera: core/core_2d_camera.c
|
core/core_2d_camera: core/core_2d_camera.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_2d_camera_platformer: core/core_2d_camera_platformer.c
|
core/core_2d_camera_platformer: core/core_2d_camera_platformer.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_2d_camera_mouse_zoom: core/core_2d_camera_mouse_zoom.c
|
core/core_2d_camera_mouse_zoom: core/core_2d_camera_mouse_zoom.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_2d_camera_split_screen: core/core_2d_camera_split_screen.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_3d_camera_mode: core/core_3d_camera_mode.c
|
core/core_3d_camera_mode: core/core_3d_camera_mode.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
@@ -575,6 +541,9 @@ core/core_3d_camera_free: core/core_3d_camera_free.c
|
|||||||
|
|
||||||
core/core_3d_camera_first_person: core/core_3d_camera_first_person.c
|
core/core_3d_camera_first_person: core/core_3d_camera_first_person.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_3d_camera_split_screen: core/core_3d_camera_split_screen.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_3d_picking: core/core_3d_picking.c
|
core/core_3d_picking: core/core_3d_picking.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
@@ -607,9 +576,6 @@ core/core_vr_simulator: core/core_vr_simulator.c
|
|||||||
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)
|
||||||
|
|
||||||
core/core_split_screen: core/core_split_screen.c
|
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
|
||||||
|
|
||||||
core/core_smooth_pixelperfect: core/core_smooth_pixelperfect.c
|
core/core_smooth_pixelperfect: core/core_smooth_pixelperfect.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
@@ -618,10 +584,10 @@ 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)
|
# 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: 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)
|
# 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
|
# in its source were transformed to non-atomic operations and non-thread-local data
|
||||||
core/core_loading_thread: core/core_loading_thread.c
|
core/core_loading_thread: core/core_loading_thread.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
|
||||||
@@ -745,7 +711,7 @@ textures/textures_sprite_explosion: textures/textures_sprite_explosion.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/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
|
textures/textures_textured_curve: textures/textures_textured_curve.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/road.png@resources/road.png
|
--preload-file textures/resources/road.png@resources/road.png
|
||||||
@@ -857,8 +823,8 @@ models/models_cubicmap: models/models_cubicmap.c
|
|||||||
|
|
||||||
models/models_draw_cube_texture: models/models_draw_cube_texture.c
|
models/models_draw_cube_texture: models/models_draw_cube_texture.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_atlas.png@resources/cubicmap_atlas.png
|
--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 \
|
||||||
@@ -889,7 +855,7 @@ models/models_loading_vox: models/models_loading_vox.c
|
|||||||
models/models_loading_gltf: models/models_loading_gltf.c
|
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
|
models/models_loading_m3d: models/models_loading_m3d.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/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
|
--preload-file models/resources/models/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
|
||||||
@@ -1010,16 +976,16 @@ shaders/shaders_texture_outline: shaders/shaders_texture_outline.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/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
|
shaders/shaders_write_depth: shaders/shaders_write_depth.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/write_depth.fs@resources/shaders/glsl100/write_depth.fs
|
--preload-file shaders/resources/shaders/glsl100/write_depth.fs@resources/shaders/glsl100/write_depth.fs
|
||||||
|
|
||||||
shaders/shaders_hybrid_render: shaders/shaders_hybrid_render.c
|
shaders/shaders_hybrid_render: shaders/shaders_hybrid_render.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/hybrid_raymarch.fs@resources/shaders/glsl100/hybrid_raymarch.fs \
|
--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
|
--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) \
|
||||||
@@ -1040,7 +1006,7 @@ audio/audio_sound_loading: audio/audio_sound_loading.c
|
|||||||
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
|
audio/audio_mixed_processor: audio/audio_mixed_processor.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 \
|
||||||
@@ -1061,10 +1027,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
rm -f *.o
|
rm -f *.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
||||||
find . -type f -executable -delete
|
|
||||||
rm -fv *.o
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
find . -type f -executable -delete
|
find . -type f -executable -delete
|
||||||
rm -fv *.o
|
rm -fv *.o
|
||||||
|
@@ -34,26 +34,27 @@ Examples using raylib core platform functionality like window creation, inputs,
|
|||||||
| 08 | [core_2d_camera](core/core_2d_camera.c) | <img src="core/core_2d_camera.png" alt="core_2d_camera" width="80"> | ⭐️⭐️☆☆ | 1.5 | 3.0 | [Ray](https://github.com/raysan5) |
|
| 08 | [core_2d_camera](core/core_2d_camera.c) | <img src="core/core_2d_camera.png" alt="core_2d_camera" width="80"> | ⭐️⭐️☆☆ | 1.5 | 3.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 09 | [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | <img src="core/core_2d_camera_mouse_zoom.png" alt="core_2d_camera_mouse_zoom" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Jeffery Myers](https://github.com/JeffM2501) |
|
| 09 | [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | <img src="core/core_2d_camera_mouse_zoom.png" alt="core_2d_camera_mouse_zoom" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| 10 | [core_2d_camera_platformer](core/core_2d_camera_platformer.c) | <img src="core/core_2d_camera_platformer.png" alt="core_2d_camera_platformer" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [avyy](https://github.com/avyy) |
|
| 10 | [core_2d_camera_platformer](core/core_2d_camera_platformer.c) | <img src="core/core_2d_camera_platformer.png" alt="core_2d_camera_platformer" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [avyy](https://github.com/avyy) |
|
||||||
| 11 | [core_3d_camera_mode](core/core_3d_camera_mode.c) | <img src="core/core_3d_camera_mode.png" alt="core_3d_camera_mode" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
| 11 | [core_2d_camera_split_screen](core/core_2d_camera_split_screen.c) | <img src="core/core_2d_camera_split_screen.png" alt="core_2d_camera_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | **4.5** | **4.5** | [Gabriel dos Santos Sanches](https://github.com/gabrielssanches) |
|
||||||
| 12 | [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐️☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
| 12 | [core_3d_camera_mode](core/core_3d_camera_mode.c) | <img src="core/core_3d_camera_mode.png" alt="core_3d_camera_mode" width="80"> | ⭐️☆☆☆ | 1.0 | 1.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 13 | [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
| 13 | [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐️☆☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
||||||
| 14 | [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 14 | [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.3 | [Ray](https://github.com/raysan5) |
|
||||||
| 15 | [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.4 | [Ray](https://github.com/raysan5) |
|
| 15 | [core_3d_camera:split_screen](core/core_3d_camera_split_screen.c) | <img src="core/core_3d_camera_split_screen.png" alt="core_3d_camera_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.0** | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| 16 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
|
| 16 | [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 17 | [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐️⭐️⭐️☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 17 | [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐️⭐️☆☆ | 1.3 | 1.4 | [Ray](https://github.com/raysan5) |
|
||||||
| 18 | [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐️⭐️☆☆ | 2.5 | **4.0** | [Anata](https://github.com/anatagawa) |
|
| 18 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
|
||||||
| 19 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
|
| 19 | [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐️⭐️⭐️☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 20 | [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
|
| 20 | [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐️⭐️☆☆ | 2.5 | **4.0** | [Anata](https://github.com/anatagawa) |
|
||||||
| 21 | [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐️☆☆☆ | 1.1 | 1.1 | [Ray](https://github.com/raysan5) |
|
| 21 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 22 | [core_storage_values](core/core_storage_values.c) | <img src="core/core_storage_values.png" alt="core_storage_values" width="80"> | ⭐️⭐️☆☆ | 1.4 | **4.2** | [Ray](https://github.com/raysan5) |
|
| 22 | [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 23 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 23 | [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐️☆☆☆ | 1.1 | 1.1 | [Ray](https://github.com/raysan5) |
|
||||||
| 24 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Ray](https://github.com/raysan5) |
|
| 24 | [core_storage_values](core/core_storage_values.c) | <img src="core/core_storage_values.png" alt="core_storage_values" width="80"> | ⭐️⭐️☆☆ | 1.4 | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 25 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="80"> | ⭐️☆☆☆ | 2.5 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
|
| 25 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 26 | [core_basic_screen_manager](core/core_basic_screen_manager.c) | <img src="core/core_basic_screen_manager.png" alt="core_basic_screen_manager" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
|
| 26 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Ray](https://github.com/raysan5) |
|
||||||
| 27 | [core_custom_frame_control](core/core_custom_frame_control.c) | <img src="core/core_custom_frame_control.png" alt="core_custom_frame_control" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
|
| 27 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="80"> | ⭐️☆☆☆ | 2.5 | 3.0 | [Chris Dill](https://github.com/MysteriousSpace) |
|
||||||
| 28 | [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐️⭐️⭐️☆ | 3.7 | **4.0** | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
|
| 28 | [core_basic_screen_manager](core/core_basic_screen_manager.c) | <img src="core/core_basic_screen_manager.png" alt="core_basic_screen_manager" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 29 | [core_split_screen](core/core_split_screen.c) | <img src="core/core_split_screen.png" alt="core_split_screen" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.0** | [Jeffery Myers](https://github.com/JeffM2501) |
|
| 29 | [core_custom_frame_control](core/core_custom_frame_control.c) | <img src="core/core_custom_frame_control.png" alt="core_custom_frame_control" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 30 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
|
| 30 | [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐️⭐️⭐️☆ | 3.7 | **4.0** | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
|
||||||
|
| 31 | [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐️⭐️☆☆ | **4.2** | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
|
|
||||||
### category: shapes
|
### category: shapes
|
||||||
|
|
||||||
|
@@ -79,6 +79,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
StopMusicStream(music);
|
StopMusicStream(music);
|
||||||
PlayMusicStream(music);
|
PlayMusicStream(music);
|
||||||
|
pause = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause/Resume music playing
|
// Pause/Resume music playing
|
||||||
@@ -134,6 +135,14 @@ int main(void)
|
|||||||
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
||||||
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
|
||||||
|
|
||||||
|
// Draw help instructions
|
||||||
|
DrawRectangle(20, 20, 425, 145, WHITE);
|
||||||
|
DrawRectangleLines(20, 20, 425, 145, GRAY);
|
||||||
|
DrawText("PRESS SPACE TO RESTART MUSIC", 40, 40, 20, BLACK);
|
||||||
|
DrawText("PRESS P TO PAUSE/RESUME", 40, 70, 20, BLACK);
|
||||||
|
DrawText("PRESS UP/DOWN TO CHANGE SPEED", 40, 100, 20, BLACK);
|
||||||
|
DrawText(TextFormat("SPEED: %f", pitch), 40, 130, 20, MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -148,4 +157,4 @@ int main(void)
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 44 KiB |
87
examples/audio/audio_sound_multi.c
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Playing sound multiple times
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.6
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Jeffery Myers (@JeffM2501)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_SOUNDS 10
|
||||||
|
Sound soundArray[MAX_SOUNDS] = { 0 };
|
||||||
|
int currentSound;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - playing sound multiple times");
|
||||||
|
|
||||||
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
// load the sound list
|
||||||
|
soundArray[0] = LoadSound("resources/sound.wav"); // Load WAV audio file into the first slot as the 'source' sound
|
||||||
|
// this sound owns the sample data
|
||||||
|
for (int i = 1; i < MAX_SOUNDS; i++)
|
||||||
|
{
|
||||||
|
soundArray[i] = LoadSoundAlias(soundArray[0]); // Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played
|
||||||
|
}
|
||||||
|
currentSound = 0; // set the sound list to the start
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
PlaySound(soundArray[currentSound]); // play the next open sound slot
|
||||||
|
currentSound++; // increment the sound slot
|
||||||
|
if (currentSound >= MAX_SOUNDS) // if the sound slot is out of bounds, go back to 0
|
||||||
|
currentSound = 0;
|
||||||
|
|
||||||
|
// Note: a better way would be to look at the list for the first sound that is not playing and use that slot
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Press SPACE to PLAY a WAV sound!", 200, 180, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
for (int i = 1; i < MAX_SOUNDS; i++)
|
||||||
|
UnloadSoundAlias(soundArray[i]); // Unload sound aliases
|
||||||
|
UnloadSound(soundArray[0]); // Unload source sound data
|
||||||
|
|
||||||
|
CloseAudioDevice(); // Close audio device
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/audio/audio_sound_multi.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -1,6 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
|
// This has been tested to work with zig master branch as of commit 87de821 or May 14 2023
|
||||||
fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step {
|
fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step {
|
||||||
if (target.getOsTag() == .emscripten) {
|
if (target.getOsTag() == .emscripten) {
|
||||||
@panic("Emscripten building via Zig unsupported");
|
@panic("Emscripten building via Zig unsupported");
|
||||||
@@ -26,10 +27,10 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT
|
|||||||
exe.addCSourceFile(path, &[_][]const u8{});
|
exe.addCSourceFile(path, &[_][]const u8{});
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
exe.addObjectFile(switch (target.getOsTag()) {
|
exe.addObjectFile(switch (target.getOsTag()) {
|
||||||
.windows => "../src/raylib.lib",
|
.windows => "../src/zig-out/lib/raylib.lib",
|
||||||
.linux => "../src/libraylib.a",
|
.linux => "../src/zig-out/lib/libraylib.a",
|
||||||
.macos => "../src/libraylib.a",
|
.macos => "../src/zig-out/lib/libraylib.a",
|
||||||
.emscripten => "../src/libraylib.a",
|
.emscripten => "../src/zig-out/lib/libraylib.a",
|
||||||
else => @panic("Unsupported OS"),
|
else => @panic("Unsupported OS"),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,10 +71,8 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
exe.setOutputDir(module);
|
b.installArtifact(exe);
|
||||||
|
var run = b.addRunArtifact(exe);
|
||||||
var run = exe.run();
|
|
||||||
run.step.dependOn(&b.addInstallArtifact(exe).step);
|
|
||||||
run.cwd = module;
|
run.cwd = module;
|
||||||
b.step(name, name).dependOn(&run.step);
|
b.step(name, name).dependOn(&run.step);
|
||||||
all.dependOn(&exe.step);
|
all.dependOn(&exe.step);
|
||||||
|
@@ -90,7 +90,7 @@ int main(void)
|
|||||||
"Follow player center",
|
"Follow player center",
|
||||||
"Follow player center, but clamp to map edges",
|
"Follow player center, but clamp to map edges",
|
||||||
"Follow player center; smoothed",
|
"Follow player center; smoothed",
|
||||||
"Follow player center horizontally; updateplayer center vertically after landing",
|
"Follow player center horizontally; update player center vertically after landing",
|
||||||
"Player push camera on getting too close to screen edge"
|
"Player push camera on getting too close to screen edge"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB |
167
examples/core/core_2d_camera_split_screen.c
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - 2d camera split screen
|
||||||
|
*
|
||||||
|
* Addapted from the core_3d_camera_split_screen example:
|
||||||
|
* https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_split_screen.c
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.5, last time updated with raylib 4.5
|
||||||
|
*
|
||||||
|
* Example contributed by Gabriel dos Santos Sanches (@gabrielssanches) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Gabriel dos Santos Sanches (@gabrielssanches)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define PLAYER_SIZE 40
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 440;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera split screen");
|
||||||
|
|
||||||
|
Rectangle player1 = { 200, 200, PLAYER_SIZE, PLAYER_SIZE };
|
||||||
|
Rectangle player2 = { 250, 200, PLAYER_SIZE, PLAYER_SIZE };
|
||||||
|
|
||||||
|
Camera2D camera1 = { 0 };
|
||||||
|
camera1.target = (Vector2){ player1.x, player1.y };
|
||||||
|
camera1.offset = (Vector2){ 200.0f, 200.0f };
|
||||||
|
camera1.rotation = 0.0f;
|
||||||
|
camera1.zoom = 1.0f;
|
||||||
|
|
||||||
|
Camera2D camera2 = { 0 };
|
||||||
|
camera2.target = (Vector2){ player2.x, player2.y };
|
||||||
|
camera2.offset = (Vector2){ 200.0f, 200.0f };
|
||||||
|
camera2.rotation = 0.0f;
|
||||||
|
camera2.zoom = 1.0f;
|
||||||
|
|
||||||
|
RenderTexture screenCamera1 = LoadRenderTexture(screenWidth/2, screenHeight);
|
||||||
|
RenderTexture screenCamera2 = LoadRenderTexture(screenWidth/2, screenHeight);
|
||||||
|
|
||||||
|
// Build a flipped rectangle the size of the split view to use for drawing later
|
||||||
|
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenCamera1.texture.width, (float)-screenCamera1.texture.height };
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyDown(KEY_S)) player1.y += 3.0f;
|
||||||
|
else if (IsKeyDown(KEY_W)) player1.y -= 3.0f;
|
||||||
|
if (IsKeyDown(KEY_D)) player1.x += 3.0f;
|
||||||
|
else if (IsKeyDown(KEY_A)) player1.x -= 3.0f;
|
||||||
|
|
||||||
|
if (IsKeyDown(KEY_UP)) player2.y -= 3.0f;
|
||||||
|
else if (IsKeyDown(KEY_DOWN)) player2.y += 3.0f;
|
||||||
|
if (IsKeyDown(KEY_RIGHT)) player2.x += 3.0f;
|
||||||
|
else if (IsKeyDown(KEY_LEFT)) player2.x -= 3.0f;
|
||||||
|
|
||||||
|
camera1.target = (Vector2){ player1.x, player1.y };
|
||||||
|
camera2.target = (Vector2){ player2.x, player2.y };
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginTextureMode(screenCamera1);
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode2D(camera1);
|
||||||
|
|
||||||
|
// Draw full scene with first camera
|
||||||
|
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineV((Vector2){PLAYER_SIZE*i, 0}, (Vector2){PLAYER_SIZE*i, screenHeight}, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < screenHeight/PLAYER_SIZE + 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineV((Vector2){0, PLAYER_SIZE*i}, (Vector2){screenWidth, PLAYER_SIZE*i}, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < screenWidth/PLAYER_SIZE; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < screenHeight/PLAYER_SIZE; j++)
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("[%i,%i]", i, j), 10 + PLAYER_SIZE*i, 15 + PLAYER_SIZE*j, 10, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawRectangleRec(player1, RED);
|
||||||
|
DrawRectangleRec(player2, BLUE);
|
||||||
|
EndMode2D();
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
|
||||||
|
DrawText("PLAYER1: W/S/A/D to move", 10, 10, 10, MAROON);
|
||||||
|
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
BeginTextureMode(screenCamera2);
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode2D(camera2);
|
||||||
|
|
||||||
|
// Draw full scene with second camera
|
||||||
|
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineV((Vector2){PLAYER_SIZE*i, 0}, (Vector2){PLAYER_SIZE*i, screenHeight}, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < screenHeight/PLAYER_SIZE + 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineV((Vector2){0, PLAYER_SIZE*i}, (Vector2){screenWidth, PLAYER_SIZE*i}, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < screenWidth/PLAYER_SIZE; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < screenHeight/PLAYER_SIZE; j++)
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("[%i,%i]", i, j), 10 + PLAYER_SIZE*i, 15 + PLAYER_SIZE*j, 10, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawRectangleRec(player1, RED);
|
||||||
|
DrawRectangleRec(player2, BLUE);
|
||||||
|
|
||||||
|
EndMode2D();
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
|
||||||
|
DrawText("PLAYER2: UP/DOWN/LEFT/RIGHT to move", 10, 10, 10, DARKBLUE);
|
||||||
|
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
// Draw both views render textures to the screen side by side
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
DrawTextureRec(screenCamera1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
||||||
|
DrawTextureRec(screenCamera2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
|
||||||
|
|
||||||
|
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadRenderTexture(screenCamera1); // Unload render texture
|
||||||
|
UnloadRenderTexture(screenCamera2); // Unload render texture
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core/core_2d_camera_split_screen.png
Normal file
After Width: | Height: | Size: 21 KiB |
@@ -72,7 +72,7 @@ int main(void)
|
|||||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
|
||||||
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
|
||||||
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
|
||||||
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
|
//DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
|
||||||
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - split screen
|
* raylib [core] example - 3d cmaera split screen
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 3.7, last time updated with raylib 4.0
|
* Example originally created with raylib 3.7, last time updated with raylib 4.0
|
||||||
*
|
*
|
||||||
@@ -15,32 +15,6 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
Camera cameraPlayer1 = { 0 };
|
|
||||||
Camera cameraPlayer2 = { 0 };
|
|
||||||
|
|
||||||
// Scene drawing
|
|
||||||
void DrawScene(void)
|
|
||||||
{
|
|
||||||
int count = 5;
|
|
||||||
float spacing = 4;
|
|
||||||
|
|
||||||
// Grid of cube trees on a plane to make a "world"
|
|
||||||
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
|
|
||||||
|
|
||||||
for (float x = -count*spacing; x <= count*spacing; x += spacing)
|
|
||||||
{
|
|
||||||
for (float z = -count*spacing; z <= count*spacing; z += spacing)
|
|
||||||
{
|
|
||||||
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
|
|
||||||
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw a cube at each player's position
|
|
||||||
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
|
|
||||||
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@@ -51,9 +25,10 @@ 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 - split screen");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera split screen");
|
||||||
|
|
||||||
// Setup player 1 camera and screen
|
// Setup player 1 camera and screen
|
||||||
|
Camera cameraPlayer1 = { 0 };
|
||||||
cameraPlayer1.fovy = 45.0f;
|
cameraPlayer1.fovy = 45.0f;
|
||||||
cameraPlayer1.up.y = 1.0f;
|
cameraPlayer1.up.y = 1.0f;
|
||||||
cameraPlayer1.target.y = 1.0f;
|
cameraPlayer1.target.y = 1.0f;
|
||||||
@@ -63,6 +38,7 @@ int main(void)
|
|||||||
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
|
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
|
||||||
|
|
||||||
// Setup player two camera and screen
|
// Setup player two camera and screen
|
||||||
|
Camera cameraPlayer2 = { 0 };
|
||||||
cameraPlayer2.fovy = 45.0f;
|
cameraPlayer2.fovy = 45.0f;
|
||||||
cameraPlayer2.up.y = 1.0f;
|
cameraPlayer2.up.y = 1.0f;
|
||||||
cameraPlayer2.target.y = 3.0f;
|
cameraPlayer2.target.y = 3.0f;
|
||||||
@@ -73,6 +49,10 @@ int main(void)
|
|||||||
|
|
||||||
// Build a flipped rectangle the size of the split view to use for drawing later
|
// Build a flipped rectangle the size of the split view to use for drawing later
|
||||||
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
|
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
|
||||||
|
|
||||||
|
// Grid data
|
||||||
|
int count = 5;
|
||||||
|
float spacing = 4;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -116,26 +96,69 @@ int main(void)
|
|||||||
// Draw Player1 view to the render texture
|
// Draw Player1 view to the render texture
|
||||||
BeginTextureMode(screenPlayer1);
|
BeginTextureMode(screenPlayer1);
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
|
|
||||||
BeginMode3D(cameraPlayer1);
|
BeginMode3D(cameraPlayer1);
|
||||||
DrawScene();
|
|
||||||
|
// Draw scene: grid of cube trees on a plane to make a "world"
|
||||||
|
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
|
||||||
|
|
||||||
|
for (float x = -count*spacing; x <= count*spacing; x += spacing)
|
||||||
|
{
|
||||||
|
for (float z = -count*spacing; z <= count*spacing; z += spacing)
|
||||||
|
{
|
||||||
|
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
|
||||||
|
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a cube at each player's position
|
||||||
|
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
|
||||||
|
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
DrawText("PLAYER1 W/S to move", 10, 10, 20, RED);
|
|
||||||
|
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
|
||||||
|
DrawText("PLAYER1: W/S to move", 10, 10, 20, MAROON);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw Player2 view to the render texture
|
// Draw Player2 view to the render texture
|
||||||
BeginTextureMode(screenPlayer2);
|
BeginTextureMode(screenPlayer2);
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
|
|
||||||
BeginMode3D(cameraPlayer2);
|
BeginMode3D(cameraPlayer2);
|
||||||
DrawScene();
|
|
||||||
|
// Draw scene: grid of cube trees on a plane to make a "world"
|
||||||
|
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
|
||||||
|
|
||||||
|
for (float x = -count*spacing; x <= count*spacing; x += spacing)
|
||||||
|
{
|
||||||
|
for (float z = -count*spacing; z <= count*spacing; z += spacing)
|
||||||
|
{
|
||||||
|
DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
|
||||||
|
DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a cube at each player's position
|
||||||
|
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
|
||||||
|
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
DrawText("PLAYER2 UP/DOWN to move", 10, 10, 20, BLUE);
|
|
||||||
|
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
|
||||||
|
DrawText("PLAYER2: UP/DOWN to move", 10, 10, 20, DARKBLUE);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw both views render textures to the screen side by side
|
// Draw both views render textures to the screen side by side
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
||||||
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
|
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
|
||||||
|
|
||||||
|
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
BIN
examples/core/core_3d_camera_split_screen.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||||
*
|
*
|
||||||
* NOTE: This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
* NOTE: This example is prepared to compile for PLATFORM_WEB, and PLATFORM_DESKTOP
|
||||||
* As you will notice, code structure is slightly diferent to the other examples...
|
* As you will notice, code structure is slightly diferent to the other examples...
|
||||||
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||||
*
|
*
|
||||||
|
@@ -21,13 +21,8 @@
|
|||||||
|
|
||||||
// NOTE: Gamepad name ID depends on drivers and OS
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
||||||
#if defined(PLATFORM_RPI)
|
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||||
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
|
||||||
#else
|
|
||||||
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
|
||||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@@ -49,6 +44,8 @@ int main(void)
|
|||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int gamepad = 0; // which gamepad to display
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
@@ -63,102 +60,114 @@ int main(void)
|
|||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
if (IsGamepadAvailable(0))
|
if (IsKeyPressed(KEY_LEFT) && gamepad > 0) gamepad--;
|
||||||
{
|
if (IsKeyPressed(KEY_RIGHT)) gamepad++;
|
||||||
DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK);
|
|
||||||
|
|
||||||
if (TextIsEqual(GetGamepadName(0), XBOX360_NAME_ID) || TextIsEqual(GetGamepadName(0), XBOX360_LEGACY_NAME_ID))
|
if (IsGamepadAvailable(gamepad))
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
|
||||||
|
|
||||||
|
if (true)
|
||||||
{
|
{
|
||||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: xbox home
|
// Draw buttons: xbox home
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(317, 202, 19, 71, BLACK);
|
DrawRectangle(317, 202, 19, 71, BLACK);
|
||||||
DrawRectangle(293, 228, 69, 19, BLACK);
|
DrawRectangle(293, 228, 69, 19, BLACK);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back
|
// Draw buttons: left-right back
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
|
|
||||||
|
Color leftGamepadColor = BLACK;
|
||||||
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||||
DrawCircle(259, 152, 39, BLACK);
|
DrawCircle(259, 152, 39, BLACK);
|
||||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||||
DrawCircle(259 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20),
|
DrawCircle(259 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X)*20),
|
||||||
152 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
152 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y)*20), 25, leftGamepadColor);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
|
Color rightGamepadColor = BLACK;
|
||||||
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||||
DrawCircle(461, 237, 38, BLACK);
|
DrawCircle(461, 237, 38, BLACK);
|
||||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||||
DrawCircle(461 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20),
|
DrawCircle(461 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||||
237 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
237 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y)*20), 25, rightGamepadColor);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||||
DrawRectangle(604, 30, 15, 70, GRAY);
|
DrawRectangle(604, 30, 15, 70, GRAY);
|
||||||
DrawRectangle(170, 30, 15, (int)(((1 + GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
|
DrawRectangle(170, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
|
||||||
DrawRectangle(604, 30, 15, (int)(((1 + GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
|
DrawRectangle(604, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
|
||||||
|
|
||||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||||
}
|
}
|
||||||
else if (TextIsEqual(GetGamepadName(0), PS3_NAME_ID))
|
else if (TextIsEqual(GetGamepadName(gamepad), PS3_NAME_ID))
|
||||||
{
|
{
|
||||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: ps
|
// Draw buttons: ps
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(225, 132, 24, 84, BLACK);
|
DrawRectangle(225, 132, 24, 84, BLACK);
|
||||||
DrawRectangle(195, 161, 84, 25, BLACK);
|
DrawRectangle(195, 161, 84, 25, BLACK);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back buttons
|
// Draw buttons: left-right back buttons
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
|
||||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
DrawCircle(319, 255, 35, BLACK);
|
Color leftGamepadColor = BLACK;
|
||||||
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||||
|
DrawCircle(319, 255, 35, leftGamepadColor);
|
||||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(319 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X) * 20),
|
DrawCircle(319 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X) * 20),
|
||||||
255 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y) * 20), 25, BLACK);
|
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y) * 20), 25, leftGamepadColor);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
|
Color rightGamepadColor = BLACK;
|
||||||
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||||
DrawCircle(475, 255, 35, BLACK);
|
DrawCircle(475, 255, 35, BLACK);
|
||||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(475 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X) * 20),
|
DrawCircle(475 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X) * 20),
|
||||||
255 + (int)(GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y) * 20), 25, BLACK);
|
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y) * 20), 25, rightGamepadColor);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||||
DrawRectangle(611, 48, 15, 70, GRAY);
|
DrawRectangle(611, 48, 15, 70, GRAY);
|
||||||
DrawRectangle(169, 48, 15, (int)(((1 - GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
|
DrawRectangle(169, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
|
||||||
DrawRectangle(611, 48, 15, (int)(((1 - GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
|
DrawRectangle(611, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -179,7 +188,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
|
DrawText(TextFormat("GP%d: NOT DETECTED", gamepad), 10, 10, 10, GRAY);
|
||||||
|
|
||||||
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
338
examples/core/core_input_gestures_web.c
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Input Gestures for Web
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.6-dev, last time updated with raylib 4.6-dev
|
||||||
|
*
|
||||||
|
* Example contributed by ubkp (@ubkp) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 ubkp (@ubkp)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "math.h" // Required for the protractor angle graphic drawing
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
#include <emscripten/emscripten.h> // Required for the Web/HTML5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Global definitions and declarations
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Common variables definitions
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800; // Update depending on web canvas
|
||||||
|
const int screenHeight = 450;
|
||||||
|
Vector2 messagePosition = { 160, 7 };
|
||||||
|
|
||||||
|
// Last gesture variables definitions
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int lastGesture = 0;
|
||||||
|
Vector2 lastGesturePosition = { 165, 130 };
|
||||||
|
|
||||||
|
// Gesture log variables definitions and functions declarations
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
#define GESTURE_LOG_SIZE 20
|
||||||
|
char gestureLog[GESTURE_LOG_SIZE][12] = { "" }; // The gesture log uses an array (as an inverted circular queue) to store the performed gestures
|
||||||
|
int gestureLogIndex = GESTURE_LOG_SIZE; // The index for the inverted circular queue (moving from last to first direction, then looping around)
|
||||||
|
int previousGesture = 0;
|
||||||
|
|
||||||
|
char const *GetGestureName(int i)
|
||||||
|
{
|
||||||
|
switch (i) {
|
||||||
|
case 0: return "None"; break;
|
||||||
|
case 1: return "Tap"; break;
|
||||||
|
case 2: return "Double Tap"; break;
|
||||||
|
case 4: return "Hold"; break;
|
||||||
|
case 8: return "Drag"; break;
|
||||||
|
case 16: return "Swipe Right"; break;
|
||||||
|
case 32: return "Swipe Left"; break;
|
||||||
|
case 64: return "Swipe Up"; break;
|
||||||
|
case 128: return "Swipe Down"; break;
|
||||||
|
case 256: return "Pinch In"; break;
|
||||||
|
case 512: return "Pinch Out"; break;
|
||||||
|
default: return "Unknown"; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color GetGestureColor(int i)
|
||||||
|
{
|
||||||
|
switch (i) {
|
||||||
|
case 0: return BLACK; break;
|
||||||
|
case 1: return BLUE; break;
|
||||||
|
case 2: return SKYBLUE; break;
|
||||||
|
case 4: return BLACK; break;
|
||||||
|
case 8: return LIME; break;
|
||||||
|
case 16: return RED; break;
|
||||||
|
case 32: return RED; break;
|
||||||
|
case 64: return RED; break;
|
||||||
|
case 128: return RED; break;
|
||||||
|
case 256: return VIOLET; break;
|
||||||
|
case 512: return ORANGE; break;
|
||||||
|
default: return BLACK; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int logMode = 1; // Log mode values: 0 shows repeated events; 1 hides repeated events; 2 shows repeated events but hide hold events; 3 hides repeated events and hide hold events
|
||||||
|
|
||||||
|
Color gestureColor = { 0, 0, 0, 255 };
|
||||||
|
Rectangle logButton1 = { 53, 7, 48, 26 };
|
||||||
|
Rectangle logButton2 = { 108, 7, 36, 26 };
|
||||||
|
Vector2 gestureLogPosition = { 10, 10 };
|
||||||
|
|
||||||
|
// Protractor variables definitions
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
float angleLength = 90.0f;
|
||||||
|
float currentAngleDegrees = 0.0f;
|
||||||
|
Vector2 finalVector = { 0.0f, 0.0f };
|
||||||
|
char currentAngleStr[7] = "";
|
||||||
|
Vector2 protractorPosition = { 266.0f, 315.0f };
|
||||||
|
|
||||||
|
// Update
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
void Update(void)
|
||||||
|
{
|
||||||
|
// Handle common
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int i, ii; // Iterators that will be reused by all for loops
|
||||||
|
const int currentGesture = GetGestureDetected();
|
||||||
|
const float currentDragDegrees = GetGestureDragAngle();
|
||||||
|
const float currentPitchDegrees = GetGesturePinchAngle();
|
||||||
|
const int touchCount = GetTouchPointCount();
|
||||||
|
|
||||||
|
// Handle last gesture
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
if ((currentGesture != 0) && (currentGesture != 4) && (currentGesture != previousGesture)) lastGesture = currentGesture; // Filter the meaningful gestures (1, 2, 8 to 512) for the display
|
||||||
|
|
||||||
|
// Handle gesture log
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||||
|
{
|
||||||
|
if (CheckCollisionPointRec(GetMousePosition(), logButton1))
|
||||||
|
{
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logMode=2; break;
|
||||||
|
case 2: logMode=3; break;
|
||||||
|
case 1: logMode=0; break;
|
||||||
|
default: logMode=1; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CheckCollisionPointRec(GetMousePosition(), logButton2))
|
||||||
|
{
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logMode=1; break;
|
||||||
|
case 2: logMode=0; break;
|
||||||
|
case 1: logMode=3; break;
|
||||||
|
default: logMode=2; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int fillLog = 0; // Gate variable to be used to allow or not the gesture log to be filled
|
||||||
|
if (currentGesture !=0)
|
||||||
|
{
|
||||||
|
if (logMode == 3) // 3 hides repeated events and hide hold events
|
||||||
|
{
|
||||||
|
if (((currentGesture != 4) && (currentGesture != previousGesture)) || (currentGesture < 3)) fillLog = 1;
|
||||||
|
}
|
||||||
|
else if (logMode == 2) // 2 shows repeated events but hide hold events
|
||||||
|
{
|
||||||
|
if (currentGesture != 4) fillLog = 1;
|
||||||
|
}
|
||||||
|
else if (logMode == 1) // 1 hides repeated events
|
||||||
|
{
|
||||||
|
if (currentGesture != previousGesture) fillLog = 1;
|
||||||
|
}
|
||||||
|
else // 0 shows repeated events
|
||||||
|
{
|
||||||
|
fillLog = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fillLog) // If one of the conditions from logMode was met, fill the gesture log
|
||||||
|
{
|
||||||
|
previousGesture = currentGesture;
|
||||||
|
gestureColor = GetGestureColor(currentGesture);
|
||||||
|
if (gestureLogIndex <= 0) gestureLogIndex = GESTURE_LOG_SIZE;
|
||||||
|
gestureLogIndex--;
|
||||||
|
|
||||||
|
// Copy the gesture respective name to the gesture log array
|
||||||
|
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle protractor
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
if (currentGesture > 255) // aka Pinch In and Pinch Out
|
||||||
|
{
|
||||||
|
currentAngleDegrees = currentPitchDegrees;
|
||||||
|
}
|
||||||
|
else if (currentGesture > 15) // aka Swipe Right, Swipe Left, Swipe Up and Swipe Down
|
||||||
|
{
|
||||||
|
currentAngleDegrees = currentDragDegrees;
|
||||||
|
}
|
||||||
|
else if (currentGesture > 0) // aka Tap, Doubletap, Hold and Grab
|
||||||
|
{
|
||||||
|
currentAngleDegrees = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float currentAngleRadians = ((currentAngleDegrees +90.0f)*PI/180); // Convert the current angle to Radians
|
||||||
|
finalVector = (Vector2){ (angleLength*sinf(currentAngleRadians)) + protractorPosition.x, (angleLength*cosf(currentAngleRadians)) + protractorPosition.y }; // Calculate the final vector for display
|
||||||
|
|
||||||
|
// Handle touch and mouse pointer points
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
#define MAX_TOUCH_COUNT 32
|
||||||
|
|
||||||
|
Vector2 touchPosition[MAX_TOUCH_COUNT] = { 0 };
|
||||||
|
Vector2 mousePosition = {0, 0};
|
||||||
|
if (currentGesture != GESTURE_NONE)
|
||||||
|
{
|
||||||
|
if (touchCount != 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < touchCount; i++) touchPosition[i] = GetTouchPosition(i); // Fill the touch positions
|
||||||
|
}
|
||||||
|
else mousePosition = GetMousePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw common
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
DrawText("*", messagePosition.x + 5, messagePosition.y + 5, 10, BLACK);
|
||||||
|
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", messagePosition.x + 15, messagePosition.y + 5, 10, BLACK);
|
||||||
|
DrawText("*", messagePosition.x + 5, messagePosition.y + 35, 10, BLACK);
|
||||||
|
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", messagePosition.x + 15, messagePosition.y + 35, 10, BLACK);
|
||||||
|
|
||||||
|
// Draw last gesture
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
DrawText("Last gesture", lastGesturePosition.x + 33, lastGesturePosition.y - 47, 20, BLACK);
|
||||||
|
DrawText("Swipe Tap Pinch Touch", lastGesturePosition.x + 17, lastGesturePosition.y - 18, 10, BLACK);
|
||||||
|
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle(lastGesturePosition.x, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle(lastGesturePosition.x + 40, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
|
||||||
|
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
|
||||||
|
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
|
||||||
|
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
|
DrawCircle(lastGesturePosition.x + 103, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
|
for (i = 0; i < 4; i++) DrawCircle(lastGesturePosition.x + 180, lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
|
||||||
|
|
||||||
|
// Draw gesture log
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
DrawText("Log", gestureLogPosition.x, gestureLogPosition.y, 20, BLACK);
|
||||||
|
|
||||||
|
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
|
||||||
|
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], gestureLogPosition.x, gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
|
||||||
|
Color logButton1Color, logButton2Color;
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logButton1Color=MAROON; logButton2Color=MAROON; break;
|
||||||
|
case 2: logButton1Color=GRAY; logButton2Color=MAROON; break;
|
||||||
|
case 1: logButton1Color=MAROON; logButton2Color=GRAY; break;
|
||||||
|
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
|
||||||
|
}
|
||||||
|
DrawRectangleRec(logButton1, logButton1Color);
|
||||||
|
DrawText("Hide", logButton1.x + 7, logButton1.y + 3, 10, WHITE);
|
||||||
|
DrawText("Repeat", logButton1.x + 7, logButton1.y + 13, 10, WHITE);
|
||||||
|
DrawRectangleRec(logButton2, logButton2Color);
|
||||||
|
DrawText("Hide", logButton1.x + 62, logButton1.y + 3, 10, WHITE);
|
||||||
|
DrawText("Hold", logButton1.x + 62, logButton1.y + 13, 10, WHITE);
|
||||||
|
|
||||||
|
// Draw protractor
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
DrawText("Angle", protractorPosition.x + 55, protractorPosition.y + 76, 10, BLACK);
|
||||||
|
const char *angleString = TextFormat("%f", currentAngleDegrees);
|
||||||
|
const int angleStringDot = TextFindIndex(angleString, ".");
|
||||||
|
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
|
||||||
|
DrawText( angleStringTrim, protractorPosition.x + 55, protractorPosition.y + 92, 20, gestureColor);
|
||||||
|
DrawCircle(protractorPosition.x, protractorPosition.y, 80.0f, WHITE);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
|
||||||
|
DrawText("0", protractorPosition.x + 96, protractorPosition.y - 9, 20, BLACK);
|
||||||
|
DrawText("30", protractorPosition.x + 74, protractorPosition.y - 68, 20, BLACK);
|
||||||
|
DrawText("90", protractorPosition.x - 11, protractorPosition.y - 110, 20, BLACK);
|
||||||
|
DrawText("150", protractorPosition.x - 100, protractorPosition.y - 68, 20, BLACK);
|
||||||
|
DrawText("180", protractorPosition.x - 124, protractorPosition.y - 9, 20, BLACK);
|
||||||
|
DrawText("210", protractorPosition.x - 100, protractorPosition.y + 50, 20, BLACK);
|
||||||
|
DrawText("270", protractorPosition.x - 18, protractorPosition.y + 92, 20, BLACK);
|
||||||
|
DrawText("330", protractorPosition.x + 72, protractorPosition.y + 50, 20, BLACK);
|
||||||
|
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
|
||||||
|
|
||||||
|
// Draw touch and mouse pointer points
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
if (currentGesture != GESTURE_NONE)
|
||||||
|
{
|
||||||
|
if ( touchCount != 0 )
|
||||||
|
{
|
||||||
|
for (i = 0; i < touchCount; i++)
|
||||||
|
{
|
||||||
|
DrawCircleV(touchPosition[i], 50.0f, Fade(gestureColor, 0.5f));
|
||||||
|
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8 : 12), gestureColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawCircleV(mousePosition, 35.0f, Fade(gestureColor, 0.5f));
|
||||||
|
DrawCircleV(mousePosition, 5.0f, gestureColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
#if defined( PLATFORM_WEB )
|
||||||
|
// Using Emscripten EM_ASM_INT macro, get the page canvas width
|
||||||
|
const int canvasWidth = EM_ASM_INT( return document.getElementById('canvas').getBoundingClientRect().width; );
|
||||||
|
|
||||||
|
if (canvasWidth > 400) screenWidth = canvasWidth;
|
||||||
|
else screenWidth = 400; // Set a minimum width for the screen
|
||||||
|
#endif
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures web");
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_set_main_loop(Update, 0, 1);
|
||||||
|
#else
|
||||||
|
SetTargetFPS(60);
|
||||||
|
while (!WindowShouldClose()) Update(); // Detect window close button or ESC key
|
||||||
|
#endif
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core/core_input_gestures_web.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// WARNING: This example does not build on Windows with MSVC compiler
|
||||||
#include "pthread.h" // POSIX style threads management
|
#include "pthread.h" // POSIX style threads management
|
||||||
|
|
||||||
#include <stdatomic.h> // C11 atomic data types
|
#include <stdatomic.h> // C11 atomic data types
|
||||||
|
Before Width: | Height: | Size: 21 KiB |
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -35,13 +35,30 @@
|
|||||||
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
|
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
|
||||||
|
|
||||||
10. Have fun!
|
10. Have fun!
|
||||||
|
|
||||||
|
The following files should be updated when adding a new example, it's planned to create some
|
||||||
|
script to automatize this process but not available yet.
|
||||||
|
|
||||||
|
- raylib/examples/<category>/<category>_example_name.c
|
||||||
|
- raylib/examples/<category>/<category>_example_name.png
|
||||||
|
- raylib/examples/<category>/resources/*.*
|
||||||
|
- raylib/examples/Makefile
|
||||||
|
- raylib/examples/Makefile.Web
|
||||||
|
- raylib/examples/README.md
|
||||||
|
- raylib/projects/VS2022/examples/<category>_example_name.vcxproj
|
||||||
|
- raylib/projects/VS2022/raylib.sln
|
||||||
|
- raylib.com/common/examples.js
|
||||||
|
- raylib.com/examples/<category>/<category>_example_name.html
|
||||||
|
- raylib.com/examples/<category>/<category>_example_name.data
|
||||||
|
- raylib.com/examples/<category>/<category>_example_name.wasm
|
||||||
|
- raylib.com/examples/<category>/<category>_example_name.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - Basic window
|
* raylib [core] example - Basic window
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 4.2, last time updated with raylib 4.2
|
* Example originally created with raylib 4.5, last time updated with raylib 4.5
|
||||||
*
|
*
|
||||||
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
|
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* LIMITATIONS:
|
* LIMITATIONS:
|
||||||
* - Only supports 1 armature per file, and skips loading it if there are multiple armatures
|
* - Only supports 1 armature per file, and skips loading it if there are multiple armatures
|
||||||
* - Only supports linear interpolation (default method in Blender when checked
|
* - Only supports linear interpolation (default method in Blender when checked
|
||||||
* "Always Sample Animations" when exporting a GLTF file)
|
* "Always Sample Animations" when exporting a GLTF file)
|
||||||
* - Only supports translation/rotation/scale animation channel.path,
|
* - Only supports translation/rotation/scale animation channel.path,
|
||||||
* weights not considered (i.e. morph targets)
|
* 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
|
||||||
@@ -42,7 +42,7 @@ int main(void)
|
|||||||
|
|
||||||
// Load 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
|
// Load gltf model animations
|
||||||
unsigned int animsCount = 0;
|
unsigned int animsCount = 0;
|
||||||
unsigned int animIndex = 0;
|
unsigned int animIndex = 0;
|
||||||
@@ -63,9 +63,9 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
|
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
|
||||||
// Select current animation
|
// Select current animation
|
||||||
if (IsKeyPressed(KEY_UP)) animIndex = (animIndex + 1)%animsCount;
|
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) animIndex = (animIndex + 1)%animsCount;
|
||||||
else if (IsKeyPressed(KEY_DOWN)) animIndex = (animIndex + animsCount - 1)%animsCount;
|
else if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) animIndex = (animIndex + animsCount - 1)%animsCount;
|
||||||
|
|
||||||
// Update model animation
|
// Update model animation
|
||||||
ModelAnimation anim = modelAnimations[animIndex];
|
ModelAnimation anim = modelAnimations[animIndex];
|
||||||
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
|
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
|
||||||
@@ -85,7 +85,8 @@ int main(void)
|
|||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Use the UP/DOWN arrow keys to switch animation", 10, 10, 20, GRAY);
|
DrawText("Use the LEFT/RIGHT mouse buttons to switch animation", 10, 10, 20, GRAY);
|
||||||
|
DrawText(TextFormat("Animation: %s", anim.name), 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
@@ -40,7 +40,7 @@ int main(void)
|
|||||||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
|
char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
|
||||||
bool drawMesh = 1;
|
bool drawMesh = 1;
|
||||||
bool drawSkeleton = 1;
|
bool drawSkeleton = 1;
|
||||||
@@ -72,27 +72,27 @@ int main(void)
|
|||||||
if (IsKeyDown(KEY_SPACE) || IsKeyPressed(KEY_N))
|
if (IsKeyDown(KEY_SPACE) || IsKeyPressed(KEY_N))
|
||||||
{
|
{
|
||||||
animFrameCounter++;
|
animFrameCounter++;
|
||||||
|
|
||||||
if (animFrameCounter >= anims[animId].frameCount) animFrameCounter = 0;
|
if (animFrameCounter >= anims[animId].frameCount) animFrameCounter = 0;
|
||||||
|
|
||||||
UpdateModelAnimation(model, anims[animId], animFrameCounter);
|
UpdateModelAnimation(model, anims[animId], animFrameCounter);
|
||||||
animPlaying = true;
|
animPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select animation by pressing A
|
// Select animation by pressing C
|
||||||
if (IsKeyPressed(KEY_A))
|
if (IsKeyPressed(KEY_C))
|
||||||
{
|
{
|
||||||
animFrameCounter = 0;
|
animFrameCounter = 0;
|
||||||
animId++;
|
animId++;
|
||||||
|
|
||||||
if (animId >= animsCount) animId = 0;
|
if (animId >= animsCount) animId = 0;
|
||||||
UpdateModelAnimation(model, anims[animId], 0);
|
UpdateModelAnimation(model, anims[animId], 0);
|
||||||
animPlaying = true;
|
animPlaying = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle skeleton drawing
|
// Toggle skeleton drawing
|
||||||
if (IsKeyPressed(KEY_S)) drawSkeleton ^= 1;
|
if (IsKeyPressed(KEY_B)) drawSkeleton ^= 1;
|
||||||
|
|
||||||
// Toggle mesh drawing
|
// Toggle mesh drawing
|
||||||
if (IsKeyPressed(KEY_M)) drawMesh ^= 1;
|
if (IsKeyPressed(KEY_M)) drawMesh ^= 1;
|
||||||
@@ -112,19 +112,19 @@ int main(void)
|
|||||||
// Draw the animated skeleton
|
// Draw the animated skeleton
|
||||||
if (drawSkeleton)
|
if (drawSkeleton)
|
||||||
{
|
{
|
||||||
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
|
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
|
||||||
// needed to workaround buggy models
|
// needed to workaround buggy models
|
||||||
// without a -1, we would always draw a cube at the origin
|
// without a -1, we would always draw a cube at the origin
|
||||||
for (int i = 0; i < model.boneCount - 1; i++)
|
for (int i = 0; i < model.boneCount - 1; i++)
|
||||||
{
|
{
|
||||||
// By default the model is loaded in bind-pose by LoadModel().
|
// By default the model is loaded in bind-pose by LoadModel().
|
||||||
// But if UpdateModelAnimation() has been called at least once
|
// But if UpdateModelAnimation() has been called at least once
|
||||||
// then the model is already in animation pose, so we need the animated skeleton
|
// then the model is already in animation pose, so we need the animated skeleton
|
||||||
if (!animPlaying || !animsCount)
|
if (!animPlaying || !animsCount)
|
||||||
{
|
{
|
||||||
// Display the bind-pose skeleton
|
// Display the bind-pose skeleton
|
||||||
DrawCube(model.bindPose[i].translation, 0.04f, 0.04f, 0.04f, RED);
|
DrawCube(model.bindPose[i].translation, 0.04f, 0.04f, 0.04f, RED);
|
||||||
|
|
||||||
if (model.bones[i].parent >= 0)
|
if (model.bones[i].parent >= 0)
|
||||||
{
|
{
|
||||||
DrawLine3D(model.bindPose[i].translation,
|
DrawLine3D(model.bindPose[i].translation,
|
||||||
@@ -135,7 +135,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Display the frame-pose skeleton
|
// Display the frame-pose skeleton
|
||||||
DrawCube(anims[animId].framePoses[animFrameCounter][i].translation, 0.05f, 0.05f, 0.05f, RED);
|
DrawCube(anims[animId].framePoses[animFrameCounter][i].translation, 0.05f, 0.05f, 0.05f, RED);
|
||||||
|
|
||||||
if (anims[animId].bones[i].parent >= 0)
|
if (anims[animId].bones[i].parent >= 0)
|
||||||
{
|
{
|
||||||
DrawLine3D(anims[animId].framePoses[animFrameCounter][i].translation,
|
DrawLine3D(anims[animId].framePoses[animFrameCounter][i].translation,
|
||||||
@@ -149,9 +149,10 @@ int main(void)
|
|||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 60, 10, MAROON);
|
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 80, 10, MAROON);
|
||||||
DrawText("PRESS A to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
|
DrawText("PRESS N to STEP ONE ANIMATION FRAME", 10, GetScreenHeight() - 60, 10, DARKGRAY);
|
||||||
DrawText("PRESS M to toggle MESH, S to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
DrawText("PRESS C to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
|
||||||
|
DrawText("PRESS M to toggle MESH, B to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
||||||
DrawText("(c) CesiumMan model by KhronosGroup", GetScreenWidth() - 210, GetScreenHeight() - 20, 10, GRAY);
|
DrawText("(c) CesiumMan model by KhronosGroup", GetScreenWidth() - 210, GetScreenHeight() - 20, 10, GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 25 KiB |
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -108,7 +108,7 @@ int main(void)
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [easings] example - easings testbed");
|
InitWindow(screenWidth, screenHeight, "raylib [easings] example - easings testbed");
|
||||||
|
|
||||||
Vector2 ballPosition = { 100.0f, 200.0f };
|
Vector2 ballPosition = { 100.0f, 100.0f };
|
||||||
|
|
||||||
float t = 0.0f; // Current time (in any unit measure, but same unit as duration)
|
float t = 0.0f; // Current time (in any unit measure, but same unit as duration)
|
||||||
float d = 300.0f; // Total time it should take to complete (duration)
|
float d = 300.0f; // Total time it should take to complete (duration)
|
||||||
@@ -180,8 +180,8 @@ int main(void)
|
|||||||
// Movement computation
|
// Movement computation
|
||||||
if (!paused && ((boundedT && t < d) || !boundedT))
|
if (!paused && ((boundedT && t < d) || !boundedT))
|
||||||
{
|
{
|
||||||
ballPosition.x = Easings[easingX].func(t, 100.0f, 700.0f - 100.0f, d);
|
ballPosition.x = Easings[easingX].func(t, 100.0f, 700.0f - 170.0f, d);
|
||||||
ballPosition.y = Easings[easingY].func(t, 100.0f, 400.0f - 100.0f, d);
|
ballPosition.y = Easings[easingY].func(t, 100.0f, 400.0f - 170.0f, d);
|
||||||
t += 1.0f;
|
t += 1.0f;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@@ -193,15 +193,15 @@ int main(void)
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw information text
|
// Draw information text
|
||||||
DrawText(TextFormat("Easing x: %s", Easings[easingX].name), 0, FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
|
DrawText(TextFormat("Easing x: %s", Easings[easingX].name), 20, FONT_SIZE, FONT_SIZE, LIGHTGRAY);
|
||||||
DrawText(TextFormat("Easing y: %s", Easings[easingY].name), 0, FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
|
DrawText(TextFormat("Easing y: %s", Easings[easingY].name), 20, FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
|
||||||
DrawText(TextFormat("t (%c) = %.2f d = %.2f", (boundedT == true)? 'b' : 'u', t, d), 0, FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
|
DrawText(TextFormat("t (%c) = %.2f d = %.2f", (boundedT == true)? 'b' : 'u', t, d), 20, FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
|
||||||
|
|
||||||
// Draw instructions text
|
// Draw instructions text
|
||||||
DrawText("Use ENTER to play or pause movement, use SPACE to restart", 0, GetScreenHeight() - FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
|
DrawText("Use ENTER to play or pause movement, use SPACE to restart", 20, GetScreenHeight() - FONT_SIZE*2, FONT_SIZE, LIGHTGRAY);
|
||||||
DrawText("Use D and W or A and S keys to change duration", 0, GetScreenHeight() - FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
|
DrawText("Use Q and W or A and S keys to change duration", 20, GetScreenHeight() - FONT_SIZE*3, FONT_SIZE, LIGHTGRAY);
|
||||||
DrawText("Use LEFT or RIGHT keys to choose easing for the x axis", 0, GetScreenHeight() - FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
|
DrawText("Use LEFT or RIGHT keys to choose easing for the x axis", 20, GetScreenHeight() - FONT_SIZE*4, FONT_SIZE, LIGHTGRAY);
|
||||||
DrawText("Use UP or DOWN keys to choose easing for the y axis", 0, GetScreenHeight() - FONT_SIZE*5, FONT_SIZE, LIGHTGRAY);
|
DrawText("Use UP or DOWN keys to choose easing for the y axis", 20, GetScreenHeight() - FONT_SIZE*5, FONT_SIZE, LIGHTGRAY);
|
||||||
|
|
||||||
// Draw ball
|
// Draw ball
|
||||||
DrawCircleV(ballPosition, 16.0f, MAROON);
|
DrawCircleV(ballPosition, 16.0f, MAROON);
|
||||||
@@ -226,4 +226,4 @@ static float NoEase(float t, float b, float c, float d)
|
|||||||
d += burn;
|
d += burn;
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -42,7 +42,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#endif
|
#endif
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
106
examples/others/raymath_vector_angle.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - Vector Angle
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 1.0, last time updated with raylib 4.2
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [math] example - vector angle");
|
||||||
|
|
||||||
|
Vector2 v0 = { screenWidth/2, screenHeight/2 };
|
||||||
|
Vector2 v1 = { 100.0f, 80.0f };
|
||||||
|
Vector2 v2 = { 0 }; // Updated with mouse position
|
||||||
|
|
||||||
|
float angle = 0.0f; // Angle in degrees
|
||||||
|
int angleMode = 0; // 0-Vector2Angle(), 1-Vector2LineAngle()
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) angleMode = !angleMode;
|
||||||
|
|
||||||
|
if (angleMode == 0)
|
||||||
|
{
|
||||||
|
// Calculate angle between two vectors, considering a common origin (v0)
|
||||||
|
v1 = Vector2Add(v0, (Vector2){ 100.0f, 80.0f });
|
||||||
|
v2 = GetMousePosition();
|
||||||
|
angle = Vector2Angle(Vector2Normalize(Vector2Subtract(v1, v0)), Vector2Normalize(Vector2Subtract(v2, v0)))*RAD2DEG;
|
||||||
|
}
|
||||||
|
else if (angleMode == 1)
|
||||||
|
{
|
||||||
|
// Calculate angle defined by a two vectors line, in reference to horizontal line
|
||||||
|
v1 = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||||
|
v2 = GetMousePosition();
|
||||||
|
angle = Vector2LineAngle(v1, v2)*RAD2DEG;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
if (angleMode == 0) DrawText("v0", v0.x, v0.y, 10, DARKGRAY);
|
||||||
|
DrawText("v1", v1.x, v1.y, 10, DARKGRAY);
|
||||||
|
DrawText("v2", v2.x, v2.y, 10, DARKGRAY);
|
||||||
|
|
||||||
|
if (angleMode == 0)
|
||||||
|
{
|
||||||
|
DrawText("MODE: Angle between V1 and V2", 10, 10, 20, BLACK);
|
||||||
|
|
||||||
|
DrawLineEx(v0, v1, 2.0f, BLACK);
|
||||||
|
DrawLineEx(v0, v2, 2.0f, RED);
|
||||||
|
|
||||||
|
float startangle = 90 - Vector2LineAngle(v0, v1)*RAD2DEG;
|
||||||
|
DrawCircleSector(v0, 40.0f, startangle, startangle + angle - 360.0f*(angle > 180.0f), 32, Fade(GREEN, 0.6f));
|
||||||
|
}
|
||||||
|
else if (angleMode == 1)
|
||||||
|
{
|
||||||
|
DrawText("MODE: Angle formed by line V1 to V2", 10, 10, 20, BLACK);
|
||||||
|
|
||||||
|
DrawLine(0, screenHeight/2, screenWidth, screenHeight/2, LIGHTGRAY);
|
||||||
|
DrawLineEx(v1, v2, 2.0f, RED);
|
||||||
|
|
||||||
|
DrawCircleSector(v1, 40.0f, 90.0f, 180 - angle - 90, 32, Fade(GREEN, 0.6f));
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("Press SPACE to change MODE", 460, 10, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("ANGLE: %2.2f", angle), 10, 40, 20, LIME);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/others/raymath_vector_angle.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -74,10 +74,10 @@ int main(void)
|
|||||||
unsigned int ssboA = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
|
unsigned int ssboA = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
|
||||||
unsigned int ssboB = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
|
unsigned int ssboB = rlLoadShaderBuffer(GOL_WIDTH*GOL_WIDTH*sizeof(unsigned int), NULL, RL_DYNAMIC_COPY);
|
||||||
unsigned int ssboTransfert = rlLoadShaderBuffer(sizeof(GolUpdateSSBO), NULL, RL_DYNAMIC_COPY);
|
unsigned int ssboTransfert = rlLoadShaderBuffer(sizeof(GolUpdateSSBO), NULL, RL_DYNAMIC_COPY);
|
||||||
|
|
||||||
GolUpdateSSBO transfertBuffer = { 0 };
|
GolUpdateSSBO transfertBuffer = { 0 };
|
||||||
|
|
||||||
// Create a white texture of the size of the window to update
|
// Create a white texture of the size of the window to update
|
||||||
// each pixel of the window using the fragment shader: golRenderShader
|
// each pixel of the window using the fragment shader: golRenderShader
|
||||||
Image whiteImage = GenImageColor(GOL_WIDTH, GOL_WIDTH, WHITE);
|
Image whiteImage = GenImageColor(GOL_WIDTH, GOL_WIDTH, WHITE);
|
||||||
Texture whiteTex = LoadTextureFromImage(whiteImage);
|
Texture whiteTex = LoadTextureFromImage(whiteImage);
|
||||||
@@ -105,7 +105,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Send SSBO buffer to GPU
|
// Send SSBO buffer to GPU
|
||||||
rlUpdateShaderBuffer(ssboTransfert, &transfertBuffer, sizeof(GolUpdateSSBO), 0);
|
rlUpdateShaderBuffer(ssboTransfert, &transfertBuffer, sizeof(GolUpdateSSBO), 0);
|
||||||
|
|
||||||
// Process SSBO commands on GPU
|
// Process SSBO commands on GPU
|
||||||
rlEnableShader(golTransfertProgram);
|
rlEnableShader(golTransfertProgram);
|
||||||
rlBindShaderBuffer(ssboA, 1);
|
rlBindShaderBuffer(ssboA, 1);
|
||||||
@@ -143,7 +143,7 @@ int main(void)
|
|||||||
BeginShaderMode(golRenderShader);
|
BeginShaderMode(golRenderShader);
|
||||||
DrawTexture(whiteTex, 0, 0, WHITE);
|
DrawTexture(whiteTex, 0, 0, WHITE);
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawRectangleLines(GetMouseX() - brushSize/2, GetMouseY() - brushSize/2, brushSize, brushSize, RED);
|
DrawRectangleLines(GetMouseX() - brushSize/2, GetMouseY() - brushSize/2, brushSize, brushSize, RED);
|
||||||
|
|
||||||
DrawText("Use Mouse wheel to increase/decrease brush size", 10, 10, 20, WHITE);
|
DrawText("Use Mouse wheel to increase/decrease brush size", 10, 10, 20, WHITE);
|
||||||
|
@@ -9,3 +9,5 @@
|
|||||||
| raysan.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
| raysan.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||||
| space.png | ❔ | ❔ | - |
|
| space.png | ❔ | ❔ | - |
|
||||||
| texel_checker.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [UV Checker Map Maker](http://uvchecker.byvalle.com/) |
|
| texel_checker.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [UV Checker Map Maker](http://uvchecker.byvalle.com/) |
|
||||||
|
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||||
|
| spark_flame.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [EffectTextureMaker](https://mebiusbox.github.io/contents/EffectTextureMaker/) |
|
BIN
examples/shaders/resources/cubicmap_atlas.png
Normal file
After Width: | Height: | Size: 36 KiB |
@@ -10,7 +10,7 @@ varying vec4 fragColor;
|
|||||||
uniform sampler2D texture0;
|
uniform sampler2D texture0;
|
||||||
uniform vec4 colDiffuse;
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
uniform float secondes;
|
uniform float seconds;
|
||||||
|
|
||||||
uniform vec2 size;
|
uniform vec2 size;
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@ void main() {
|
|||||||
float boxTop = 0.0;
|
float boxTop = 0.0;
|
||||||
|
|
||||||
vec2 p = fragTexCoord;
|
vec2 p = fragTexCoord;
|
||||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
|
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
|
||||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
|
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
|
||||||
|
|
||||||
gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor;
|
gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor;
|
||||||
}
|
}
|
||||||
|
23
examples/shaders/resources/shaders/glsl330/lightmap.fs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec2 fragTexCoord2;
|
||||||
|
in vec3 fragPosition;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform sampler2D texture1;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||||
|
vec4 texelColor2 = texture(texture1, fragTexCoord2);
|
||||||
|
|
||||||
|
finalColor = texelColor * texelColor2;
|
||||||
|
}
|
29
examples/shaders/resources/shaders/glsl330/lightmap.vs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec2 vertexTexCoord2;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvp;
|
||||||
|
uniform mat4 matModel;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
out vec3 fragPosition;
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec2 fragTexCoord2;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragTexCoord2 = vertexTexCoord2;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
14
examples/shaders/resources/shaders/glsl330/tiling.fs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#version 330 core
|
||||||
|
|
||||||
|
uniform sampler2D diffuseMap;
|
||||||
|
uniform vec2 tiling;
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 texCoord = fragTexCoord * tiling;
|
||||||
|
fragColor = texture(diffuseMap, texCoord);
|
||||||
|
}
|
@@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
|
|||||||
// Output fragment color
|
// Output fragment color
|
||||||
out vec4 finalColor;
|
out vec4 finalColor;
|
||||||
|
|
||||||
uniform float secondes;
|
uniform float seconds;
|
||||||
|
|
||||||
uniform vec2 size;
|
uniform vec2 size;
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@ void main() {
|
|||||||
float boxTop = 0.0;
|
float boxTop = 0.0;
|
||||||
|
|
||||||
vec2 p = fragTexCoord;
|
vec2 p = fragTexCoord;
|
||||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
|
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
|
||||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
|
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
|
||||||
|
|
||||||
finalColor = texture(texture0, p)*colDiffuse*fragColor;
|
finalColor = texture(texture0, p)*colDiffuse*fragColor;
|
||||||
}
|
}
|
||||||
|
BIN
examples/shaders/resources/spark_flame.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
94
examples/shaders/shader_texture_tiling.c
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - Texture Tiling
|
||||||
|
*
|
||||||
|
* Example demonstrates how to tile a texture on a 3D model using raylib.
|
||||||
|
*
|
||||||
|
* Example contributed by Luís Almeida (https://github.com/luis605)
|
||||||
|
*
|
||||||
|
* 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 Luís Almeida (https://github.com/luis605)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 600;
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
InitWindow(screenWidth, screenHeight, "Raylib Texture Tiling");
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
// Load a texture
|
||||||
|
Texture2D texture = LoadTexture("resources/raylib_logo.png");
|
||||||
|
|
||||||
|
// Create a cube mesh
|
||||||
|
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
// Load the texture onto the GPU
|
||||||
|
Model model = LoadModelFromMesh(cube);
|
||||||
|
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
||||||
|
|
||||||
|
// Set the tiling of the texture
|
||||||
|
float tiling[2] = {3.0f, 3.0f};
|
||||||
|
Shader shader = LoadShader(0, "resources/shaders/glsl330/tiling.fs"); // Create a custom shader in a .glsl file
|
||||||
|
SetShaderValue(shader, GetShaderLocation(shader, "tiling"), tiling, SHADER_UNIFORM_VEC2);
|
||||||
|
model.materials[0].shader = shader;
|
||||||
|
|
||||||
|
// Camera setup
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 3.0f, 3.0f, 3.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;
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
UpdateCamera(&camera, CAMERA_FREE);
|
||||||
|
|
||||||
|
// Draw the model
|
||||||
|
{
|
||||||
|
BeginMode3D(camera);
|
||||||
|
BeginShaderMode(shader);
|
||||||
|
|
||||||
|
DrawModel(model, (Vector3){ 0.0f, 0.0f, 0.0f }, 5.0f, WHITE);
|
||||||
|
|
||||||
|
EndShaderMode();
|
||||||
|
EndMode3D();
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("Use mouse to rotate the camera", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
UnloadTexture(texture); // Unload texture
|
||||||
|
UnloadModel(model); // Unload model
|
||||||
|
UnloadShader(shader); // Unload shader
|
||||||
|
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
173
examples/shaders/shaders_lightmap.c
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shaders] example - lightmap
|
||||||
|
*
|
||||||
|
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||||
|
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||||
|
*
|
||||||
|
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||||
|
*
|
||||||
|
* Example contributed by Jussi Viitala (@nullstare) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019-2023 Jussi Viitala (@nullstare) and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "raymath.h"
|
||||||
|
#include "rlgl.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAP_SIZE 10
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - lightmap");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 4.0f, 6.0f, 8.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
|
Mesh mesh = GenMeshPlane((float)MAP_SIZE, (float)MAP_SIZE, 1, 1);
|
||||||
|
|
||||||
|
// GenMeshPlane doesn't generate texcoords2 so we will upload them separately
|
||||||
|
mesh.texcoords2 = (float *)RL_MALLOC(mesh.vertexCount*2*sizeof(float));
|
||||||
|
|
||||||
|
// X // Y
|
||||||
|
mesh.texcoords2[0] = 0.0f; mesh.texcoords2[1] = 0.0f;
|
||||||
|
mesh.texcoords2[2] = 1.0f; mesh.texcoords2[3] = 0.0f;
|
||||||
|
mesh.texcoords2[4] = 0.0f; mesh.texcoords2[5] = 1.0f;
|
||||||
|
mesh.texcoords2[6] = 1.0f; mesh.texcoords2[7] = 1.0f;
|
||||||
|
|
||||||
|
// Load a new texcoords2 attributes buffer
|
||||||
|
mesh.vboId[SHADER_LOC_VERTEX_TEXCOORD02] = rlLoadVertexBuffer(mesh.texcoords2, mesh.vertexCount*2*sizeof(float), false);
|
||||||
|
rlEnableVertexArray(mesh.vaoId);
|
||||||
|
|
||||||
|
// Index 5 is for texcoords2
|
||||||
|
rlSetVertexAttribute(5, 2, RL_FLOAT, 0, 0, 0);
|
||||||
|
rlEnableVertexAttribute(5);
|
||||||
|
rlDisableVertexArray();
|
||||||
|
|
||||||
|
// Load lightmap shader
|
||||||
|
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/lightmap.vs", GLSL_VERSION),
|
||||||
|
TextFormat("resources/shaders/glsl%i/lightmap.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
Texture texture = LoadTexture("resources/cubicmap_atlas.png");
|
||||||
|
Texture light = LoadTexture("resources/spark_flame.png");
|
||||||
|
|
||||||
|
GenTextureMipmaps(&texture);
|
||||||
|
SetTextureFilter(texture, TEXTURE_FILTER_TRILINEAR);
|
||||||
|
|
||||||
|
RenderTexture lightmap = LoadRenderTexture(MAP_SIZE, MAP_SIZE);
|
||||||
|
|
||||||
|
SetTextureFilter(lightmap.texture, TEXTURE_FILTER_TRILINEAR);
|
||||||
|
|
||||||
|
Material material = LoadMaterialDefault();
|
||||||
|
material.shader = shader;
|
||||||
|
material.maps[MATERIAL_MAP_ALBEDO].texture = texture;
|
||||||
|
material.maps[MATERIAL_MAP_METALNESS].texture = lightmap.texture;
|
||||||
|
|
||||||
|
// Drawing to lightmap
|
||||||
|
BeginTextureMode(lightmap);
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
BeginBlendMode(BLEND_ADDITIVE);
|
||||||
|
DrawTexturePro(
|
||||||
|
light,
|
||||||
|
(Rectangle){ 0, 0, light.width, light.height },
|
||||||
|
(Rectangle){ 0, 0, 20, 20 },
|
||||||
|
(Vector2){ 10.0, 10.0 },
|
||||||
|
0.0,
|
||||||
|
RED
|
||||||
|
);
|
||||||
|
DrawTexturePro(
|
||||||
|
light,
|
||||||
|
(Rectangle){ 0, 0, light.width, light.height },
|
||||||
|
(Rectangle){ 8, 4, 20, 20 },
|
||||||
|
(Vector2){ 10.0, 10.0 },
|
||||||
|
0.0,
|
||||||
|
BLUE
|
||||||
|
);
|
||||||
|
DrawTexturePro(
|
||||||
|
light,
|
||||||
|
(Rectangle){ 0, 0, light.width, light.height },
|
||||||
|
(Rectangle){ 8, 8, 10, 10 },
|
||||||
|
(Vector2){ 5.0, 5.0 },
|
||||||
|
0.0,
|
||||||
|
GREEN
|
||||||
|
);
|
||||||
|
BeginBlendMode(BLEND_ALPHA);
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
DrawMesh(mesh, material, MatrixIdentity());
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
DrawTexturePro(
|
||||||
|
lightmap.texture,
|
||||||
|
(Rectangle){ 0, 0, -MAP_SIZE, -MAP_SIZE },
|
||||||
|
(Rectangle){ GetRenderWidth() - MAP_SIZE*8 - 10, 10, MAP_SIZE*8, MAP_SIZE*8 },
|
||||||
|
(Vector2){ 0.0, 0.0 },
|
||||||
|
0.0,
|
||||||
|
WHITE);
|
||||||
|
|
||||||
|
DrawText("lightmap", GetRenderWidth() - 66, 16 + MAP_SIZE*8, 10, GRAY);
|
||||||
|
DrawText("10x10 pixels", GetRenderWidth() - 76, 30 + MAP_SIZE*8, 10, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadMesh(mesh); // Unload the mesh
|
||||||
|
UnloadShader(shader); // Unload shader
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
BIN
examples/shaders/shaders_lightmap.png
Normal file
After Width: | Height: | Size: 205 KiB |
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB -> Not supported at this moment
|
#else // PLATFORM_ANDROID, PLATFORM_WEB -> Not supported at this moment
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -37,18 +37,18 @@ int main(void)
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
||||||
|
|
||||||
Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));
|
Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));
|
||||||
|
|
||||||
float outlineSize = 2.0f;
|
float outlineSize = 2.0f;
|
||||||
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
|
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
|
||||||
float textureSize[2] = { (float)texture.width, (float)texture.height };
|
float textureSize[2] = { (float)texture.width, (float)texture.height };
|
||||||
|
|
||||||
// Get shader locations
|
// Get shader locations
|
||||||
int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize");
|
int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize");
|
||||||
int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor");
|
int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor");
|
||||||
int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize");
|
int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize");
|
||||||
|
|
||||||
// Set shader values (they can be changed later)
|
// Set shader values (they can be changed later)
|
||||||
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
||||||
SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4);
|
SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4);
|
||||||
@@ -64,7 +64,7 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
outlineSize += GetMouseWheelMove();
|
outlineSize += GetMouseWheelMove();
|
||||||
if (outlineSize < 1.0f) outlineSize = 1.0f;
|
if (outlineSize < 1.0f) outlineSize = 1.0f;
|
||||||
|
|
||||||
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -75,13 +75,13 @@ int main(void)
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginShaderMode(shdrOutline);
|
BeginShaderMode(shdrOutline);
|
||||||
|
|
||||||
DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE);
|
DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawText("Shader-based\ntexture\noutline", 10, 10, 20, GRAY);
|
DrawText("Shader-based\ntexture\noutline", 10, 10, 20, GRAY);
|
||||||
|
DrawText("Scroll mouse wheel to\nchange outline size", 10, 72, 20, GRAY);
|
||||||
DrawText(TextFormat("Outline size: %i px", (int)outlineSize), 10, 120, 20, MAROON);
|
DrawText(TextFormat("Outline size: %i px", (int)outlineSize), 10, 120, 20, MAROON);
|
||||||
|
|
||||||
DrawFPS(710, 10);
|
DrawFPS(710, 10);
|
||||||
@@ -99,4 +99,4 @@ int main(void)
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 258 KiB After Width: | Height: | Size: 258 KiB |
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ int main(void)
|
|||||||
// Load shader and setup location points and values
|
// Load shader and setup location points and values
|
||||||
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/wave.fs", GLSL_VERSION));
|
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/wave.fs", GLSL_VERSION));
|
||||||
|
|
||||||
int secondsLoc = GetShaderLocation(shader, "secondes");
|
int secondsLoc = GetShaderLocation(shader, "seconds");
|
||||||
int freqXLoc = GetShaderLocation(shader, "freqX");
|
int freqXLoc = GetShaderLocation(shader, "freqX");
|
||||||
int freqYLoc = GetShaderLocation(shader, "freqY");
|
int freqYLoc = GetShaderLocation(shader, "freqY");
|
||||||
int ampXLoc = GetShaderLocation(shader, "ampX");
|
int ampXLoc = GetShaderLocation(shader, "ampX");
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ int main(void)
|
|||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - bouncing ball");
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - bouncing ball");
|
||||||
|
|
||||||
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
@@ -61,11 +62,14 @@ int main(void)
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
||||||
DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
|
//DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
|
||||||
|
|
||||||
// On pause, we draw a blinking message
|
// On pause, we draw a blinking message
|
||||||
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", 350, 200, 30, GRAY);
|
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", 350, 200, 30, GRAY);
|
||||||
|
|
||||||
|
DrawCircle(400.5, 300.5, 50, BLACK);
|
||||||
|
DrawCircle(528.0, 172.0, 26, BLACK);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
@@ -99,6 +99,9 @@ int main(void)
|
|||||||
DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
|
DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw help instructions
|
||||||
|
DrawText("Press SPACE to PAUSE/RESUME", 20, screenHeight - 35, 20, LIGHTGRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
@@ -111,4 +114,4 @@ int main(void)
|
|||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -35,8 +35,8 @@ int main(void)
|
|||||||
float outerRadius = 180.0f;
|
float outerRadius = 180.0f;
|
||||||
float startAngle = 0.0f;
|
float startAngle = 0.0f;
|
||||||
float endAngle = 180.0f;
|
float endAngle = 180.0f;
|
||||||
int segments = 0;
|
float segments = 10.0f;
|
||||||
int minSegments = 4;
|
float minSegments = 4;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -58,16 +58,16 @@ int main(void)
|
|||||||
DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f));
|
DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f));
|
||||||
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
DrawCircleSector(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.3f));
|
DrawCircleSector(center, outerRadius, startAngle, endAngle, (int)segments, Fade(MAROON, 0.3f));
|
||||||
DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.6f));
|
DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, (int)segments, Fade(MAROON, 0.6f));
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", NULL, startAngle, 0, 720);
|
GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", NULL, &startAngle, 0, 720);
|
||||||
endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", NULL, endAngle, 0, 720);
|
GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", NULL, &endAngle, 0, 720);
|
||||||
|
|
||||||
outerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", NULL, outerRadius, 0, 200);
|
GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", NULL, &outerRadius, 0, 200);
|
||||||
segments = (int)GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", NULL, (float)segments, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", NULL, &segments, 0, 100);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
minSegments = (int)ceilf((endAngle - startAngle) / 90);
|
minSegments = (int)ceilf((endAngle - startAngle) / 90);
|
||||||
|
@@ -31,10 +31,10 @@ int main(void)
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw rectangle rounded");
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw rectangle rounded");
|
||||||
|
|
||||||
float roundness = 0.2f;
|
float roundness = 0.2f;
|
||||||
int width = 200;
|
float width = 200.0f;
|
||||||
int height = 100;
|
float height = 100.0f;
|
||||||
int segments = 0;
|
float segments = 0.0f;
|
||||||
int lineThick = 1;
|
float lineThick = 1.0f;
|
||||||
|
|
||||||
bool drawRect = false;
|
bool drawRect = false;
|
||||||
bool drawRoundedRect = true;
|
bool drawRoundedRect = true;
|
||||||
@@ -61,20 +61,20 @@ int main(void)
|
|||||||
DrawRectangle(560, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
DrawRectangle(560, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
if (drawRect) DrawRectangleRec(rec, Fade(GOLD, 0.6f));
|
if (drawRect) DrawRectangleRec(rec, Fade(GOLD, 0.6f));
|
||||||
if (drawRoundedRect) DrawRectangleRounded(rec, roundness, segments, Fade(MAROON, 0.2f));
|
if (drawRoundedRect) DrawRectangleRounded(rec, roundness, (int)segments, Fade(MAROON, 0.2f));
|
||||||
if (drawRoundedLines) DrawRectangleRoundedLines(rec,roundness, segments, (float)lineThick, Fade(MAROON, 0.4f));
|
if (drawRoundedLines) DrawRectangleRoundedLines(rec, roundness, (int)segments, lineThick, Fade(MAROON, 0.4f));
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
width = (int)GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", NULL, (float)width, 0, (float)GetScreenWidth() - 300);
|
GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", NULL, &width, 0, (float)GetScreenWidth() - 300);
|
||||||
height = (int)GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", NULL, (float)height, 0, (float)GetScreenHeight() - 50);
|
GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", NULL, &height, 0, (float)GetScreenHeight() - 50);
|
||||||
roundness = GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", NULL, roundness, 0.0f, 1.0f);
|
GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", NULL, &roundness, 0.0f, 1.0f);
|
||||||
lineThick = (int)GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", NULL, (float)lineThick, 0, 20);
|
GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", NULL, &lineThick, 0, 20);
|
||||||
segments = (int)GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", NULL, (float)segments, 0, 60);
|
GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", NULL, &segments, 0, 60);
|
||||||
|
|
||||||
drawRoundedRect = GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", drawRoundedRect);
|
GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", &drawRoundedRect);
|
||||||
drawRoundedLines = GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", drawRoundedLines);
|
GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", &drawRoundedLines);
|
||||||
drawRect = GuiCheckBox((Rectangle){ 640, 380, 20, 20}, "DrawRect", drawRect);
|
GuiCheckBox((Rectangle){ 640, 380, 20, 20}, "DrawRect", &drawRect);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 640, 280, 10, (segments >= 4)? MAROON : DARKGRAY);
|
DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 640, 280, 10, (segments >= 4)? MAROON : DARKGRAY);
|
||||||
|
@@ -37,7 +37,7 @@ int main(void)
|
|||||||
|
|
||||||
float startAngle = 0.0f;
|
float startAngle = 0.0f;
|
||||||
float endAngle = 360.0f;
|
float endAngle = 360.0f;
|
||||||
int segments = 0;
|
float segments = 0.0f;
|
||||||
|
|
||||||
bool drawRing = true;
|
bool drawRing = true;
|
||||||
bool drawRingLines = false;
|
bool drawRingLines = false;
|
||||||
@@ -63,23 +63,23 @@ int main(void)
|
|||||||
DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f));
|
DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f));
|
||||||
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
if (drawRing) DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.3f));
|
if (drawRing) DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, (int)segments, Fade(MAROON, 0.3f));
|
||||||
if (drawRingLines) DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, segments, Fade(BLACK, 0.4f));
|
if (drawRingLines) DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, (int)segments, Fade(BLACK, 0.4f));
|
||||||
if (drawCircleLines) DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, segments, Fade(BLACK, 0.4f));
|
if (drawCircleLines) DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, (int)segments, Fade(BLACK, 0.4f));
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", NULL, startAngle, -450, 450);
|
GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", NULL, &startAngle, -450, 450);
|
||||||
endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", NULL, endAngle, -450, 450);
|
GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", NULL, &endAngle, -450, 450);
|
||||||
|
|
||||||
innerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, "InnerRadius", NULL, innerRadius, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, "InnerRadius", NULL, &innerRadius, 0, 100);
|
||||||
outerRadius = GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, "OuterRadius", NULL, outerRadius, 0, 200);
|
GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, "OuterRadius", NULL, &outerRadius, 0, 200);
|
||||||
|
|
||||||
segments = (int)GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", NULL, (float)segments, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", NULL, &segments, 0, 100);
|
||||||
|
|
||||||
drawRing = GuiCheckBox((Rectangle){ 600, 320, 20, 20 }, "Draw Ring", drawRing);
|
GuiCheckBox((Rectangle){ 600, 320, 20, 20 }, "Draw Ring", &drawRing);
|
||||||
drawRingLines = GuiCheckBox((Rectangle){ 600, 350, 20, 20 }, "Draw RingLines", drawRingLines);
|
GuiCheckBox((Rectangle){ 600, 350, 20, 20 }, "Draw RingLines", &drawRingLines);
|
||||||
drawCircleLines = GuiCheckBox((Rectangle){ 600, 380, 20, 20 }, "Draw CircleLines", drawCircleLines);
|
GuiCheckBox((Rectangle){ 600, 380, 20, 20 }, "Draw CircleLines", &drawCircleLines);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
int minSegments = (int)ceilf((endAngle - startAngle)/90);
|
int minSegments = (int)ceilf((endAngle - startAngle)/90);
|
||||||
|
@@ -28,6 +28,9 @@ int main(void)
|
|||||||
|
|
||||||
Vector2 start = { 0, 0 };
|
Vector2 start = { 0, 0 };
|
||||||
Vector2 end = { (float)screenWidth, (float)screenHeight };
|
Vector2 end = { (float)screenWidth, (float)screenHeight };
|
||||||
|
|
||||||
|
Vector2 startControl = { 100, 0 };
|
||||||
|
Vector2 endControl = { GetScreenWidth() - 100, GetScreenHeight() };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -37,8 +40,16 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) start = GetMousePosition();
|
if (IsKeyDown(KEY_LEFT_CONTROL))
|
||||||
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) end = GetMousePosition();
|
{
|
||||||
|
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) startControl = GetMousePosition();
|
||||||
|
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) endControl = GetMousePosition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) start = GetMousePosition();
|
||||||
|
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) end = GetMousePosition();
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -49,7 +60,14 @@ int main(void)
|
|||||||
|
|
||||||
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, GRAY);
|
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, GRAY);
|
||||||
|
|
||||||
DrawLineBezier(start, end, 2.0f, RED);
|
//DrawLineBezier(start, end, 2.0f, RED);
|
||||||
|
|
||||||
|
DrawLineBezierCubic(start, end, startControl, endControl, 2.0f, RED);
|
||||||
|
|
||||||
|
DrawLineEx(start, startControl, 1.0, LIGHTGRAY);
|
||||||
|
DrawLineEx(end, endControl, 1.0, LIGHTGRAY);
|
||||||
|
DrawCircleV(startControl, 10, RED);
|
||||||
|
DrawCircleV(endControl, 10, RED);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
155
examples/shapes/shapes_lines_splines.c
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - splines drawing
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.6-dev, last time updated with raylib 4.6-dev
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_CONTROL_POINTS 32
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Vector2 start;
|
||||||
|
Vector2 end;
|
||||||
|
} ControlPoint;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - splines drawing");
|
||||||
|
|
||||||
|
Vector2 points[MAX_CONTROL_POINTS] = {
|
||||||
|
{ 100.0f, 200.0f },
|
||||||
|
{ 300.0f, 400.0f },
|
||||||
|
{ 500.0f, 300.0f },
|
||||||
|
{ 700.0f, 100.0f },
|
||||||
|
{ 200.0f, 100.0f },
|
||||||
|
};
|
||||||
|
|
||||||
|
int pointCount = 5;
|
||||||
|
int selectedPoint = -1;
|
||||||
|
|
||||||
|
int splineType = 0; // 0-Linear, 1-BSpline, 2-CatmullRom, 3-Bezier
|
||||||
|
|
||||||
|
// Cubic Bezier control points
|
||||||
|
ControlPoint control[MAX_CONTROL_POINTS] = { 0 };
|
||||||
|
for (int i = 0; i < pointCount - 1; i++)
|
||||||
|
{
|
||||||
|
control[i].start = points[i];
|
||||||
|
control[i].end = points[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Points movement logic
|
||||||
|
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON) && (pointCount < MAX_CONTROL_POINTS))
|
||||||
|
{
|
||||||
|
points[pointCount] = GetMousePosition();
|
||||||
|
pointCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < pointCount; i++)
|
||||||
|
{
|
||||||
|
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) && CheckCollisionPointCircle(GetMousePosition(), points[i], 6.0f))
|
||||||
|
{
|
||||||
|
selectedPoint = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedPoint >= 0)
|
||||||
|
{
|
||||||
|
points[selectedPoint] = GetMousePosition();
|
||||||
|
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) selectedPoint = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Cubic Bezier spline control points logic
|
||||||
|
|
||||||
|
|
||||||
|
// Spline selection logic
|
||||||
|
if (IsKeyPressed(KEY_ONE)) splineType = 0;
|
||||||
|
else if (IsKeyPressed(KEY_TWO)) splineType = 1;
|
||||||
|
else if (IsKeyPressed(KEY_THREE)) splineType = 2;
|
||||||
|
else if (IsKeyPressed(KEY_FOUR)) splineType = 3;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
if (splineType == 0) // Linear
|
||||||
|
{
|
||||||
|
// Draw linear spline
|
||||||
|
for (int i = 0; i < pointCount - 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineEx(points[i], points[i + 1], 2.0f, RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (splineType == 1) // B-Spline
|
||||||
|
{
|
||||||
|
// Draw b-spline
|
||||||
|
DrawLineBSpline(points, pointCount, 2.0f, RED);
|
||||||
|
//for (int i = 0; i < (pointCount - 3); i++) DrawLineBSplineSegment(points[i], points[i + 1], points[i + 2], points[i + 3], 24.0f, BLUE);
|
||||||
|
}
|
||||||
|
else if (splineType == 2) // CatmullRom Spline
|
||||||
|
{
|
||||||
|
// Draw spline: catmull-rom
|
||||||
|
DrawLineCatmullRom(points, pointCount, 2.0f, RED);
|
||||||
|
//for (int i = 0; i < (pointCount - 3); i++) DrawLineCatmullRomSegment(points[i], points[i + 1], points[i + 2], points[i + 3], 24.0f, Fade(BLUE, 0.4f));
|
||||||
|
}
|
||||||
|
else if (splineType == 3) // Cubic Bezier
|
||||||
|
{
|
||||||
|
// Draw line bezier cubic (with control points)
|
||||||
|
for (int i = 0; i < pointCount - 1; i++)
|
||||||
|
{
|
||||||
|
DrawLineBezierCubic(points[i], points[i + 1], control[i].start, control[i + 1].end, 2.0f, RED);
|
||||||
|
|
||||||
|
// TODO: Every cubic bezier point should have two control points
|
||||||
|
DrawCircleV(control[i].start, 4, GOLD);
|
||||||
|
DrawCircleV(control[i].end, 4, GOLD);
|
||||||
|
DrawLineEx(points[i], control[i].start, 1.0, LIGHTGRAY);
|
||||||
|
DrawLineEx(points[i + 1], control[i].end, 1.0, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw control points
|
||||||
|
for (int i = 0; i < pointCount; i++)
|
||||||
|
{
|
||||||
|
DrawCircleV(points[i], 6.0f, RED);
|
||||||
|
if ((splineType != 0) && (i < pointCount - 1)) DrawLineV(points[i], points[i + 1], GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@@ -52,6 +52,8 @@ int main(void)
|
|||||||
// Set bilinear scale filter for better font scaling
|
// Set bilinear scale filter for better font scaling
|
||||||
SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR);
|
SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR);
|
||||||
|
|
||||||
|
SetTextLineSpacing(54); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||||
|
|
||||||
// Free codepoints, atlas has already been generated
|
// Free codepoints, atlas has already been generated
|
||||||
free(codepointsNoDups);
|
free(codepointsNoDups);
|
||||||
|
|
||||||
|
@@ -47,6 +47,8 @@ int main(void)
|
|||||||
// NOTE: We define a font base size of 32 pixels tall and up-to 250 characters
|
// NOTE: We define a font base size of 32 pixels tall and up-to 250 characters
|
||||||
Font fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250);
|
Font fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250);
|
||||||
|
|
||||||
|
SetTextLineSpacing(48); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||||
|
|
||||||
bool useTtf = false;
|
bool useTtf = false;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -187,12 +187,11 @@ int main(void)
|
|||||||
// Add a new set of emojis when SPACE is pressed
|
// Add a new set of emojis when SPACE is pressed
|
||||||
if (IsKeyPressed(KEY_SPACE)) RandomizeEmoji();
|
if (IsKeyPressed(KEY_SPACE)) RandomizeEmoji();
|
||||||
|
|
||||||
// Set the selected emoji and copy its text to clipboard
|
// Set the selected emoji
|
||||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && (hovered != -1) && (hovered != selected))
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && (hovered != -1) && (hovered != selected))
|
||||||
{
|
{
|
||||||
selected = hovered;
|
selected = hovered;
|
||||||
selectedPos = hoveredPos;
|
selectedPos = hoveredPos;
|
||||||
SetClipboardText(messages[emoji[selected].message].text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 mouse = GetMousePosition();
|
Vector2 mouse = GetMousePosition();
|
||||||
@@ -267,7 +266,7 @@ int main(void)
|
|||||||
a = b;
|
a = b;
|
||||||
b = tmp;
|
b = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
|
if (msgRect.x + msgRect.width > screenWidth) msgRect.x -= (msgRect.x + msgRect.width) - screenWidth + 10;
|
||||||
|
|
||||||
// Draw chat bubble
|
// Draw chat bubble
|
||||||
@@ -287,11 +286,11 @@ int main(void)
|
|||||||
DrawText(info, (int)pos.x, (int)pos.y, 10, RAYWHITE);
|
DrawText(info, (int)pos.x, (int)pos.y, 10, RAYWHITE);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw the info text
|
// Draw the info text
|
||||||
DrawText("These emojis have something to tell you, click each to find out!", (screenWidth - 650)/2, screenHeight - 40, 20, GRAY);
|
DrawText("These emojis have something to tell you, click each to find out!", (screenWidth - 650)/2, screenHeight - 40, 20, GRAY);
|
||||||
DrawText("Each emoji is a unicode character from a font, not a texture... Press [SPACEBAR] to refresh", (screenWidth - 484)/2, screenHeight - 16, 10, GRAY);
|
DrawText("Each emoji is a unicode character from a font, not a texture... Press [SPACEBAR] to refresh", (screenWidth - 484)/2, screenHeight - 16, 10, GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -342,7 +341,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
|
|||||||
{
|
{
|
||||||
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop
|
||||||
|
|
||||||
float textOffsetY = 0; // Offset between lines (on line break '\n')
|
float textOffsetY = 0.0f; // Offset between lines (on line break '\n')
|
||||||
float textOffsetX = 0.0f; // Offset X to next character to draw
|
float textOffsetX = 0.0f; // Offset X to next character to draw
|
||||||
|
|
||||||
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
|
float scaleFactor = fontSize/(float)font.baseSize; // Character rectangle scaling factor
|
||||||
@@ -465,4 +464,4 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
|
|||||||
|
|
||||||
textOffsetX += glyphWidth;
|
textOffsetX += glyphWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
examples/textures/resources/test.svg
Normal file
After Width: | Height: | Size: 5.6 KiB |
@@ -134,7 +134,8 @@ int main(void)
|
|||||||
(Vector2){ 0, 0 }, 0.0f, WHITE);
|
(Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||||
|
|
||||||
// Draw player current tile
|
// Draw player current tile
|
||||||
DrawText(TextFormat("Current tile: [%i,%i]", playerTileX, playerTileY), 10, 10, 20, LIME);
|
DrawText(TextFormat("Current tile: [%i,%i]", playerTileX, playerTileY), 10, 10, 20, RAYWHITE);
|
||||||
|
DrawText("ARROW KEYS to move", 10, screenHeight-25, 20, RAYWHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 37 KiB |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#define NUM_TEXTURES 6 // Currently we have 7 generation algorithms
|
#define NUM_TEXTURES 9 // Currently we have 8 generation algorithms but some are have multiple purposes (Linear and Square Gradients)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@@ -27,28 +27,37 @@ int main(void)
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
|
||||||
|
|
||||||
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
|
Image verticalGradient = GenImageGradientLinear(screenWidth, screenHeight, 0, RED, BLUE);
|
||||||
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
|
Image horizontalGradient = GenImageGradientLinear(screenWidth, screenHeight, 90, RED, BLUE);
|
||||||
|
Image diagonalGradient = GenImageGradientLinear(screenWidth, screenHeight, 45, RED, BLUE);
|
||||||
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
|
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
|
||||||
|
Image squareGradient = GenImageGradientSquare(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
|
||||||
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
|
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
|
||||||
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
|
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
|
||||||
|
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
|
||||||
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
|
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
|
||||||
|
|
||||||
Texture2D textures[NUM_TEXTURES] = { 0 };
|
Texture2D textures[NUM_TEXTURES] = { 0 };
|
||||||
|
|
||||||
textures[0] = LoadTextureFromImage(verticalGradient);
|
textures[0] = LoadTextureFromImage(verticalGradient);
|
||||||
textures[1] = LoadTextureFromImage(horizontalGradient);
|
textures[1] = LoadTextureFromImage(horizontalGradient);
|
||||||
textures[2] = LoadTextureFromImage(radialGradient);
|
textures[2] = LoadTextureFromImage(diagonalGradient);
|
||||||
textures[3] = LoadTextureFromImage(checked);
|
textures[3] = LoadTextureFromImage(radialGradient);
|
||||||
textures[4] = LoadTextureFromImage(whiteNoise);
|
textures[4] = LoadTextureFromImage(squareGradient);
|
||||||
textures[5] = LoadTextureFromImage(cellular);
|
textures[5] = LoadTextureFromImage(checked);
|
||||||
|
textures[6] = LoadTextureFromImage(whiteNoise);
|
||||||
|
textures[7] = LoadTextureFromImage(perlinNoise);
|
||||||
|
textures[8] = LoadTextureFromImage(cellular);
|
||||||
|
|
||||||
// Unload image data (CPU RAM)
|
// Unload image data (CPU RAM)
|
||||||
UnloadImage(verticalGradient);
|
UnloadImage(verticalGradient);
|
||||||
UnloadImage(horizontalGradient);
|
UnloadImage(horizontalGradient);
|
||||||
|
UnloadImage(diagonalGradient);
|
||||||
UnloadImage(radialGradient);
|
UnloadImage(radialGradient);
|
||||||
|
UnloadImage(squareGradient);
|
||||||
UnloadImage(checked);
|
UnloadImage(checked);
|
||||||
UnloadImage(whiteNoise);
|
UnloadImage(whiteNoise);
|
||||||
|
UnloadImage(perlinNoise);
|
||||||
UnloadImage(cellular);
|
UnloadImage(cellular);
|
||||||
|
|
||||||
int currentTexture = 0;
|
int currentTexture = 0;
|
||||||
@@ -83,10 +92,13 @@ int main(void)
|
|||||||
{
|
{
|
||||||
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
|
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
|
||||||
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break;
|
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break;
|
||||||
case 2: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
|
case 2: DrawText("DIAGONAL GRADIENT", 540, 10, 20, RAYWHITE); break;
|
||||||
case 3: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
|
case 3: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
|
||||||
case 4: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
|
case 4: DrawText("SQUARE GRADIENT", 580, 10, 20, LIGHTGRAY); break;
|
||||||
case 5: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
|
case 5: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
|
||||||
|
case 6: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
|
||||||
|
case 7: DrawText("PERLIN NOISE", 640, 10, 20, RED); break;
|
||||||
|
case 8: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
81
examples/textures/textures_image_rotate.c
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - Image Rotation
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 1.0, last time updated with raylib 1.0
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define NUM_TEXTURES 3
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture rotation");
|
||||||
|
|
||||||
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
Image image45 = LoadImage("resources/raylib_logo.png");
|
||||||
|
Image image90 = LoadImage("resources/raylib_logo.png");
|
||||||
|
Image imageNeg90 = LoadImage("resources/raylib_logo.png");
|
||||||
|
|
||||||
|
ImageRotate(&image45, 45);
|
||||||
|
ImageRotate(&image90, 90);
|
||||||
|
ImageRotate(&imageNeg90, -90);
|
||||||
|
|
||||||
|
Texture2D textures[NUM_TEXTURES] = { 0 };
|
||||||
|
|
||||||
|
textures[0] = LoadTextureFromImage(image45);
|
||||||
|
textures[1] = LoadTextureFromImage(image90);
|
||||||
|
textures[2] = LoadTextureFromImage(imageNeg90);
|
||||||
|
|
||||||
|
int currentTexture = 0;
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsKeyPressed(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
currentTexture = (currentTexture + 1)%NUM_TEXTURES; // Cycle between the textures
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawTexture(textures[currentTexture], screenWidth/2 - textures[currentTexture].width/2, screenHeight/2 - textures[currentTexture].height/2, WHITE);
|
||||||
|
|
||||||
|
DrawText("Press LEFT MOUSE BUTTON to rotate the image clockwise", 250, 420, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures/textures_image_rotate.png
Normal file
After Width: | Height: | Size: 35 KiB |
72
examples/textures/textures_svg_loading.c
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - SVG loading and texture creation
|
||||||
|
*
|
||||||
|
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 4.2, last time updated with raylib 4.2
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022 Dennis Meinen (@bixxy#4258 on Discord)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - svg loading");
|
||||||
|
|
||||||
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
|
Image image = LoadImageSvg("resources/test.svg", 400, 350); // Loaded in CPU memory (RAM)
|
||||||
|
Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
|
||||||
|
UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
|
||||||
|
|
||||||
|
//Red border to illustrate how the SVG is centered within the specified dimensions
|
||||||
|
DrawRectangleLines((screenWidth / 2 - texture.width / 2) - 1, (screenHeight / 2 - texture.height / 2) - 1, texture.width + 2, texture.height + 2, RED);
|
||||||
|
|
||||||
|
DrawText("this IS a texture loaded from an SVG file!", 300, 410, 10, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texture); // Texture unloading
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures/textures_svg_loading.png
Normal file
After Width: | Height: | Size: 14 KiB |
@@ -15,7 +15,7 @@
|
|||||||
{
|
{
|
||||||
"name": "RAYLIB_VERSION_MINOR",
|
"name": "RAYLIB_VERSION_MINOR",
|
||||||
"type": "INT",
|
"type": "INT",
|
||||||
"value": 5,
|
"value": 6,
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
{
|
{
|
||||||
"name": "RAYLIB_VERSION",
|
"name": "RAYLIB_VERSION",
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "4.5",
|
"value": "4.6-dev",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1032,6 +1032,11 @@
|
|||||||
"type": "Transform **",
|
"type": "Transform **",
|
||||||
"name": "framePoses",
|
"name": "framePoses",
|
||||||
"description": "Poses array by frame"
|
"description": "Poses array by frame"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "char[32]",
|
||||||
|
"name": "name",
|
||||||
|
"description": "Animation name"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1423,6 +1428,11 @@
|
|||||||
"value": 16384,
|
"value": 16384,
|
||||||
"description": "Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED"
|
"description": "Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "FLAG_BORDERLESS_WINDOWED_MODE",
|
||||||
|
"value": 32768,
|
||||||
|
"description": "Set to run program in borderless windowed mode"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "FLAG_MSAA_4X_HINT",
|
"name": "FLAG_MSAA_4X_HINT",
|
||||||
"value": 32,
|
"value": 32,
|
||||||
@@ -2600,58 +2610,73 @@
|
|||||||
"description": "32*4 bpp (4 channels - float)"
|
"description": "32*4 bpp (4 channels - float)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_DXT1_RGB",
|
"name": "PIXELFORMAT_UNCOMPRESSED_R16",
|
||||||
"value": 11,
|
"value": 11,
|
||||||
|
"description": "16 bpp (1 channel - half float)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_UNCOMPRESSED_R16G16B16",
|
||||||
|
"value": 12,
|
||||||
|
"description": "16*3 bpp (3 channels - half float)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_UNCOMPRESSED_R16G16B16A16",
|
||||||
|
"value": 13,
|
||||||
|
"description": "16*4 bpp (4 channels - half float)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_COMPRESSED_DXT1_RGB",
|
||||||
|
"value": 14,
|
||||||
"description": "4 bpp (no alpha)"
|
"description": "4 bpp (no alpha)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_DXT1_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_DXT1_RGBA",
|
||||||
"value": 12,
|
"value": 15,
|
||||||
"description": "4 bpp (1 bit alpha)"
|
"description": "4 bpp (1 bit alpha)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_DXT3_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_DXT3_RGBA",
|
||||||
"value": 13,
|
"value": 16,
|
||||||
"description": "8 bpp"
|
"description": "8 bpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_DXT5_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_DXT5_RGBA",
|
||||||
"value": 14,
|
|
||||||
"description": "8 bpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "PIXELFORMAT_COMPRESSED_ETC1_RGB",
|
|
||||||
"value": 15,
|
|
||||||
"description": "4 bpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "PIXELFORMAT_COMPRESSED_ETC2_RGB",
|
|
||||||
"value": 16,
|
|
||||||
"description": "4 bpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA",
|
|
||||||
"value": 17,
|
"value": 17,
|
||||||
"description": "8 bpp"
|
"description": "8 bpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_PVRT_RGB",
|
"name": "PIXELFORMAT_COMPRESSED_ETC1_RGB",
|
||||||
"value": 18,
|
"value": 18,
|
||||||
"description": "4 bpp"
|
"description": "4 bpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_PVRT_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_ETC2_RGB",
|
||||||
"value": 19,
|
"value": 19,
|
||||||
"description": "4 bpp"
|
"description": "4 bpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA",
|
||||||
"value": 20,
|
"value": 20,
|
||||||
"description": "8 bpp"
|
"description": "8 bpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA",
|
"name": "PIXELFORMAT_COMPRESSED_PVRT_RGB",
|
||||||
"value": 21,
|
"value": 21,
|
||||||
|
"description": "4 bpp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_COMPRESSED_PVRT_RGBA",
|
||||||
|
"value": 22,
|
||||||
|
"description": "4 bpp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA",
|
||||||
|
"value": 23,
|
||||||
|
"description": "8 bpp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA",
|
||||||
|
"value": 24,
|
||||||
"description": "2 bpp"
|
"description": "2 bpp"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -2981,8 +3006,8 @@
|
|||||||
"name": "fileName"
|
"name": "fileName"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int *",
|
"type": "int *",
|
||||||
"name": "bytesRead"
|
"name": "dataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -3000,8 +3025,8 @@
|
|||||||
"name": "data"
|
"name": "data"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int",
|
"type": "int",
|
||||||
"name": "bytesToWrite"
|
"name": "dataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -3150,6 +3175,11 @@
|
|||||||
"description": "Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)",
|
"description": "Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)",
|
||||||
"returnType": "void"
|
"returnType": "void"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ToggleBorderlessWindowed",
|
||||||
|
"description": "Toggle window state: borderless windowed (only PLATFORM_DESKTOP)",
|
||||||
|
"returnType": "void"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "MaximizeWindow",
|
"name": "MaximizeWindow",
|
||||||
"description": "Set window state: maximized, if resizable (only PLATFORM_DESKTOP)",
|
"description": "Set window state: maximized, if resizable (only PLATFORM_DESKTOP)",
|
||||||
@@ -3193,7 +3223,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SetWindowTitle",
|
"name": "SetWindowTitle",
|
||||||
"description": "Set title for window (only PLATFORM_DESKTOP)",
|
"description": "Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -3219,7 +3249,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SetWindowMonitor",
|
"name": "SetWindowMonitor",
|
||||||
"description": "Set monitor for the current window (fullscreen mode)",
|
"description": "Set monitor for the current window",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -3243,6 +3273,21 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "SetWindowMaxSize",
|
||||||
|
"description": "Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "width"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "height"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "SetWindowSize",
|
"name": "SetWindowSize",
|
||||||
"description": "Set window dimensions",
|
"description": "Set window dimensions",
|
||||||
@@ -3269,6 +3314,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "SetWindowFocused",
|
||||||
|
"description": "Set window focused (only PLATFORM_DESKTOP)",
|
||||||
|
"returnType": "void"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "GetWindowHandle",
|
"name": "GetWindowHandle",
|
||||||
"description": "Get native window handle",
|
"description": "Get native window handle",
|
||||||
@@ -3382,7 +3432,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GetMonitorName",
|
"name": "GetMonitorName",
|
||||||
"description": "Get the human-readable, UTF-8 encoded name of the primary monitor",
|
"description": "Get the human-readable, UTF-8 encoded name of the specified monitor",
|
||||||
"returnType": "const char *",
|
"returnType": "const char *",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -4127,8 +4177,8 @@
|
|||||||
"name": "fileName"
|
"name": "fileName"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int *",
|
"type": "int *",
|
||||||
"name": "bytesRead"
|
"name": "dataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -4157,8 +4207,8 @@
|
|||||||
"name": "data"
|
"name": "data"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int",
|
"type": "int",
|
||||||
"name": "bytesToWrite"
|
"name": "dataSize"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -4172,8 +4222,8 @@
|
|||||||
"name": "data"
|
"name": "data"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int",
|
"type": "int",
|
||||||
"name": "size"
|
"name": "dataSize"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "const char *",
|
"type": "const char *",
|
||||||
@@ -4328,7 +4378,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GetApplicationDirectory",
|
"name": "GetApplicationDirectory",
|
||||||
"description": "Get the directory if the running application (uses static string)",
|
"description": "Get the directory of the running application (uses static string)",
|
||||||
"returnType": "const char *"
|
"returnType": "const char *"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -4509,6 +4559,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "IsKeyPressedRepeat",
|
||||||
|
"description": "Check if a key has been pressed again (Only PLATFORM_DESKTOP)",
|
||||||
|
"returnType": "bool",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "IsKeyDown",
|
"name": "IsKeyDown",
|
||||||
"description": "Check if a key is being pressed",
|
"description": "Check if a key is being pressed",
|
||||||
@@ -4871,7 +4932,7 @@
|
|||||||
"returnType": "bool",
|
"returnType": "bool",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "unsigned int",
|
||||||
"name": "gesture"
|
"name": "gesture"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -5143,6 +5204,52 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "DrawLineBSpline",
|
||||||
|
"description": "Draw a B-Spline line, minimum 4 points",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Vector2 *",
|
||||||
|
"name": "points"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "pointCount"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "thick"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "color"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DrawLineCatmullRom",
|
||||||
|
"description": "Draw a Catmull Rom spline line, minimum 4 points",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Vector2 *",
|
||||||
|
"name": "points"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "pointCount"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "thick"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "color"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "DrawLineStrip",
|
"name": "DrawLineStrip",
|
||||||
"description": "Draw lines sequence",
|
"description": "Draw lines sequence",
|
||||||
@@ -6114,6 +6221,25 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "LoadImageSvg",
|
||||||
|
"description": "Load image from SVG file data or string with specified size",
|
||||||
|
"returnType": "Image",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "fileNameOrString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "width"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "height"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "LoadImageAnim",
|
"name": "LoadImageAnim",
|
||||||
"description": "Load image sequence from file (frames appended to image.data)",
|
"description": "Load image sequence from file (frames appended to image.data)",
|
||||||
@@ -6201,6 +6327,25 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ExportImageToMemory",
|
||||||
|
"description": "Export image to memory buffer",
|
||||||
|
"returnType": "unsigned char *",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Image",
|
||||||
|
"name": "image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "fileType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int *",
|
||||||
|
"name": "fileSize"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ExportImageAsCode",
|
"name": "ExportImageAsCode",
|
||||||
"description": "Export image as code file defining an array of bytes, returns true on success",
|
"description": "Export image as code file defining an array of bytes, returns true on success",
|
||||||
@@ -6236,8 +6381,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GenImageGradientV",
|
"name": "GenImageGradientLinear",
|
||||||
"description": "Generate image: vertical gradient",
|
"description": "Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient",
|
||||||
"returnType": "Image",
|
"returnType": "Image",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -6248,36 +6393,17 @@
|
|||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "height"
|
"name": "height"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "Color",
|
|
||||||
"name": "top"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Color",
|
|
||||||
"name": "bottom"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "GenImageGradientH",
|
|
||||||
"description": "Generate image: horizontal gradient",
|
|
||||||
"returnType": "Image",
|
|
||||||
"params": [
|
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "width"
|
"name": "direction"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "int",
|
|
||||||
"name": "height"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Color",
|
"type": "Color",
|
||||||
"name": "left"
|
"name": "start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Color",
|
"type": "Color",
|
||||||
"name": "right"
|
"name": "end"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -6308,6 +6434,33 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "GenImageGradientSquare",
|
||||||
|
"description": "Generate image: square gradient",
|
||||||
|
"returnType": "Image",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "width"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "height"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "float",
|
||||||
|
"name": "density"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "inner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "outer"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "GenImageChecked",
|
"name": "GenImageChecked",
|
||||||
"description": "Generate image: checked",
|
"description": "Generate image: checked",
|
||||||
@@ -6744,6 +6897,21 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ImageRotate",
|
||||||
|
"description": "Rotate image by input angle in degrees (-359 to 359)",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Image *",
|
||||||
|
"name": "image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "degrees"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ImageRotateCW",
|
"name": "ImageRotateCW",
|
||||||
"description": "Rotate image clockwise 90deg",
|
"description": "Rotate image clockwise 90deg",
|
||||||
@@ -7902,7 +8070,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "LoadFontEx",
|
"name": "LoadFontEx",
|
||||||
"description": "Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set",
|
"description": "Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character setFont",
|
||||||
"returnType": "Font",
|
"returnType": "Font",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -7915,11 +8083,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "fontChars"
|
"name": "codepoints"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "glyphCount"
|
"name": "codepointCount"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -7965,11 +8133,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "fontChars"
|
"name": "codepoints"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "glyphCount"
|
"name": "codepointCount"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -8003,11 +8171,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int *",
|
"type": "int *",
|
||||||
"name": "fontChars"
|
"name": "codepoints"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "glyphCount"
|
"name": "codepointCount"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
@@ -8022,11 +8190,11 @@
|
|||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
"type": "const GlyphInfo *",
|
"type": "const GlyphInfo *",
|
||||||
"name": "chars"
|
"name": "glyphs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Rectangle **",
|
"type": "Rectangle **",
|
||||||
"name": "recs"
|
"name": "glyphRecs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
@@ -8053,7 +8221,7 @@
|
|||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
"type": "GlyphInfo *",
|
"type": "GlyphInfo *",
|
||||||
"name": "chars"
|
"name": "glyphs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
@@ -8241,7 +8409,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"name": "count"
|
"name": "codepointCount"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Vector2",
|
"type": "Vector2",
|
||||||
@@ -8261,6 +8429,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "SetTextLineSpacing",
|
||||||
|
"description": "Set vertical line spacing when drawing with line-breaks",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "spacing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "MeasureText",
|
"name": "MeasureText",
|
||||||
"description": "Measure string width for default font",
|
"description": "Measure string width for default font",
|
||||||
@@ -9909,7 +10088,7 @@
|
|||||||
"name": "fileName"
|
"name": "fileName"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int *",
|
"type": "int *",
|
||||||
"name": "animCount"
|
"name": "animCount"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -9954,8 +10133,8 @@
|
|||||||
"name": "animations"
|
"name": "animations"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "unsigned int",
|
"type": "int",
|
||||||
"name": "count"
|
"name": "animCount"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -10223,6 +10402,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "LoadSoundAlias",
|
||||||
|
"description": "Create a new sound that shares the same sample data as the source sound, does not own the sound data",
|
||||||
|
"returnType": "Sound",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Sound",
|
||||||
|
"name": "source"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "IsSoundReady",
|
"name": "IsSoundReady",
|
||||||
"description": "Checks if a sound is ready",
|
"description": "Checks if a sound is ready",
|
||||||
@@ -10275,6 +10465,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "UnloadSoundAlias",
|
||||||
|
"description": "Unload a sound alias (does not deallocate sample data)",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Sound",
|
||||||
|
"name": "alias"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ExportWave",
|
"name": "ExportWave",
|
||||||
"description": "Export wave data to file, returns true on success",
|
"description": "Export wave data to file, returns true on success",
|
||||||
@@ -10879,7 +11080,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "AttachAudioStreamProcessor",
|
"name": "AttachAudioStreamProcessor",
|
||||||
"description": "Attach audio stream processor to stream",
|
"description": "Attach audio stream processor to stream, receives the samples as <float>s",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
@@ -10909,7 +11110,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "AttachAudioMixedProcessor",
|
"name": "AttachAudioMixedProcessor",
|
||||||
"description": "Attach audio stream processor to the entire audio pipeline",
|
"description": "Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s",
|
||||||
"returnType": "void",
|
"returnType": "void",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|