Compare commits
989 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0851960397 | ||
![]() |
a31784759d | ||
![]() |
453a5b49a0 | ||
![]() |
e7f24ade0b | ||
![]() |
e14c6441ce | ||
![]() |
d18f3fca30 | ||
![]() |
7f4ae653f3 | ||
![]() |
703df42586 | ||
![]() |
13376de059 | ||
![]() |
677f5b0795 | ||
![]() |
d32bbabe0e | ||
![]() |
c3d32c156c | ||
![]() |
1aaa55c38e | ||
![]() |
de0fca51a8 | ||
![]() |
5e3db0aa83 | ||
![]() |
fadef24b62 | ||
![]() |
689a534c66 | ||
![]() |
9d93ca6fc8 | ||
![]() |
86d3e68d55 | ||
![]() |
9e17134949 | ||
![]() |
290d68c11e | ||
![]() |
2c8bc8ad47 | ||
![]() |
de070ba25f | ||
![]() |
e930ad3102 | ||
![]() |
2fe488a71c | ||
![]() |
0af2c139e2 | ||
![]() |
191e8cf02b | ||
![]() |
8737d697dc | ||
![]() |
765a31597a | ||
![]() |
70a2118c49 | ||
![]() |
b02e737074 | ||
![]() |
fdb7cd0587 | ||
![]() |
bba035c20c | ||
![]() |
be361ed3dc | ||
![]() |
8c0f9c7f5a | ||
![]() |
8abba960c7 | ||
![]() |
8649032428 | ||
![]() |
6e8387468f | ||
![]() |
27987f3fe6 | ||
![]() |
ef32377336 | ||
![]() |
a2b69c0905 | ||
![]() |
1fac09d0f4 | ||
![]() |
f090f5444c | ||
![]() |
2bb4d36c43 | ||
![]() |
b7240d6a36 | ||
![]() |
65076464d5 | ||
![]() |
72758de6ea | ||
![]() |
25642cff36 | ||
![]() |
cd61463d23 | ||
![]() |
0171bdfb9c | ||
![]() |
daeccd03ac | ||
![]() |
086f76ba7a | ||
![]() |
e5cdfab97d | ||
![]() |
affb707dd9 | ||
![]() |
4c497779a2 | ||
![]() |
08441e8b2d | ||
![]() |
d02310e8ce | ||
![]() |
62965aa6d7 | ||
![]() |
04a4efb591 | ||
![]() |
c4f0e80895 | ||
![]() |
ebee8ba3bb | ||
![]() |
8f5bd3e185 | ||
![]() |
fcc6a61d9e | ||
![]() |
ae13f438ba | ||
![]() |
18db2c4f01 | ||
![]() |
1fd8052527 | ||
![]() |
6ce38e599a | ||
![]() |
83b6cd00c6 | ||
![]() |
1883343944 | ||
![]() |
ebad28d831 | ||
![]() |
befdb5963e | ||
![]() |
83cd22ee5a | ||
![]() |
dd6e006d78 | ||
![]() |
cbeb29d9d1 | ||
![]() |
317db34059 | ||
![]() |
1d61be5804 | ||
![]() |
13bb656a91 | ||
![]() |
16f5a04983 | ||
![]() |
9afda9359b | ||
![]() |
2d82788e42 | ||
![]() |
5761bf7e19 | ||
![]() |
fba117478d | ||
![]() |
8e599908d9 | ||
![]() |
ae7127232d | ||
![]() |
2e151408bb | ||
![]() |
fec0ce34c5 | ||
![]() |
719c1551cc | ||
![]() |
9f2ff3e4d6 | ||
![]() |
963021d393 | ||
![]() |
7763ccd8ad | ||
![]() |
d8e0b2e27c | ||
![]() |
6ac3043e88 | ||
![]() |
2ec8ce649a | ||
![]() |
bc47d36e90 | ||
![]() |
1c9093fd24 | ||
![]() |
0543f897a9 | ||
![]() |
b28e353626 | ||
![]() |
a3f9ba8704 | ||
![]() |
ccf4329792 | ||
![]() |
a6fb2dafc6 | ||
![]() |
7a16834124 | ||
![]() |
628e6e52f3 | ||
![]() |
f437f7b405 | ||
![]() |
cf12992b6a | ||
![]() |
67a1e84859 | ||
![]() |
6243466770 | ||
![]() |
0f8caeb186 | ||
![]() |
c20df9aa47 | ||
![]() |
c41e0f0c45 | ||
![]() |
16d015d81e | ||
![]() |
d47d7c0001 | ||
![]() |
c87e91d27a | ||
![]() |
99f6707e2c | ||
![]() |
e36dc01b91 | ||
![]() |
8523d13683 | ||
![]() |
dba29e4405 | ||
![]() |
0aefe256d0 | ||
![]() |
1b793e76dc | ||
![]() |
226c0e362c | ||
![]() |
84edd22612 | ||
![]() |
2a6bd973bd | ||
![]() |
d7266ea8f3 | ||
![]() |
ef858b0dbb | ||
![]() |
588131c9d5 | ||
![]() |
52c1a4e7d0 | ||
![]() |
f9c8e31ed7 | ||
![]() |
9ac5a96408 | ||
![]() |
8a5bc933de | ||
![]() |
3e604a8645 | ||
![]() |
83b3478fe4 | ||
![]() |
51b147cd32 | ||
![]() |
4390d3a122 | ||
![]() |
a77afd5c8f | ||
![]() |
32c9d411b2 | ||
![]() |
1350361f58 | ||
![]() |
e545286369 | ||
![]() |
942731cc22 | ||
![]() |
4e88160e78 | ||
![]() |
a1db0220a1 | ||
![]() |
f9d4601057 | ||
![]() |
f1659d78d3 | ||
![]() |
007e840be1 | ||
![]() |
d92531b81d | ||
![]() |
670eab8b17 | ||
![]() |
252bd22738 | ||
![]() |
0b0711027a | ||
![]() |
e168c6dd81 | ||
![]() |
526e68afa8 | ||
![]() |
1b91ac0b0d | ||
![]() |
599d6e810f | ||
![]() |
75b5cc0084 | ||
![]() |
9a568654be | ||
![]() |
4a1bd12e2d | ||
![]() |
282ec9bb76 | ||
![]() |
a91f61262e | ||
![]() |
f8719e7ec3 | ||
![]() |
7c36f3f6b8 | ||
![]() |
3d6d5558c9 | ||
![]() |
a39a44c12f | ||
![]() |
60bedb4f87 | ||
![]() |
62554db48d | ||
![]() |
94650f0def | ||
![]() |
33ed452439 | ||
![]() |
bb2763cc1f | ||
![]() |
3e71232a04 | ||
![]() |
700d448d75 | ||
![]() |
8722ff7043 | ||
![]() |
8d7f97ee04 | ||
![]() |
9a4fb25285 | ||
![]() |
7439c7547b | ||
![]() |
c8b16d72e2 | ||
![]() |
b972b8d324 | ||
![]() |
67de7c4483 | ||
![]() |
9f4a839853 | ||
![]() |
6541895901 | ||
![]() |
5d8c477d12 | ||
![]() |
79f36799e7 | ||
![]() |
369cb0a3c5 | ||
![]() |
9b3d74db6b | ||
![]() |
92417c4485 | ||
![]() |
22345ff62a | ||
![]() |
3fc4a4c974 | ||
![]() |
03a88678da | ||
![]() |
f60e0e6c94 | ||
![]() |
9fce26bb06 | ||
![]() |
f869229b7f | ||
![]() |
239c37246a | ||
![]() |
9882796df0 | ||
![]() |
e34c0911f9 | ||
![]() |
93efa565f9 | ||
![]() |
dfbb134bfe | ||
![]() |
92f6290dbb | ||
![]() |
2474d50dba | ||
![]() |
e40ece55d5 | ||
![]() |
18c92b3104 | ||
![]() |
dd7d65a6b4 | ||
![]() |
206e1def6f | ||
![]() |
b7063ab879 | ||
![]() |
10d7718011 | ||
![]() |
ddc1fdf6d5 | ||
![]() |
7fa521fae4 | ||
![]() |
08ea5e419e | ||
![]() |
00a763ea44 | ||
![]() |
dcd289d931 | ||
![]() |
025246620f | ||
![]() |
19ef765382 | ||
![]() |
9607ea5c0a | ||
![]() |
8a434b4fd4 | ||
![]() |
0e037555fe | ||
![]() |
de173a93c8 | ||
![]() |
37c047eabc | ||
![]() |
c1432386a5 | ||
![]() |
b5f281bacd | ||
![]() |
23b827b66c | ||
![]() |
d851208413 | ||
![]() |
3caa15e696 | ||
![]() |
99ab4d6cb8 | ||
![]() |
8b3d054408 | ||
![]() |
7d995d95eb | ||
![]() |
a09311a8fc | ||
![]() |
339fdf4c31 | ||
![]() |
c96de3a23a | ||
![]() |
1627f34032 | ||
![]() |
59cabc7d11 | ||
![]() |
89f031673b | ||
![]() |
3c55f067a8 | ||
![]() |
23fabb1d67 | ||
![]() |
e9d3d4fa1f | ||
![]() |
024adc2538 | ||
![]() |
72983d4e20 | ||
![]() |
b63c2619e3 | ||
![]() |
40ec7a6236 | ||
![]() |
352ea80a1f | ||
![]() |
a422d2fc8b | ||
![]() |
803094f41f | ||
![]() |
2c13e43c32 | ||
![]() |
18d73eef19 | ||
![]() |
7bf31dd468 | ||
![]() |
1a6adc5f74 | ||
![]() |
b15715ca80 | ||
![]() |
8d3ff3fda8 | ||
![]() |
24a38dbd3f | ||
![]() |
4120f12375 | ||
![]() |
dfc465ca6d | ||
![]() |
93168304cd | ||
![]() |
9ff8ad853c | ||
![]() |
59e7275464 | ||
![]() |
fa79ae8a3d | ||
![]() |
9362eaf9c6 | ||
![]() |
dfadb3ee37 | ||
![]() |
6e76baa6a9 | ||
![]() |
a0f8682905 | ||
![]() |
e8fa7ceb79 | ||
![]() |
68bcfa1192 | ||
![]() |
d98e61c6eb | ||
![]() |
66c6ec4465 | ||
![]() |
936199d8de | ||
![]() |
18af18479f | ||
![]() |
b7ae0df3d9 | ||
![]() |
cac856119c | ||
![]() |
1286bc076f | ||
![]() |
3d33c559e7 | ||
![]() |
14e443afba | ||
![]() |
7749a2805c | ||
![]() |
a04dbe7ffd | ||
![]() |
913f185f82 | ||
![]() |
6575d31379 | ||
![]() |
7c1889c282 | ||
![]() |
45fd75952d | ||
![]() |
51fbde178f | ||
![]() |
b154bc33f5 | ||
![]() |
d98779abef | ||
![]() |
aefdb9f9cf | ||
![]() |
ff523d55ac | ||
![]() |
6d20430ccc | ||
![]() |
a5beb940f8 | ||
![]() |
f3385b6ad2 | ||
![]() |
ef8526ae36 | ||
![]() |
92a13878dc | ||
![]() |
1b4c58b66f | ||
![]() |
e203fb58c6 | ||
![]() |
462e7aec52 | ||
![]() |
aae60e1e44 | ||
![]() |
848cdb267a | ||
![]() |
760cfd361e | ||
![]() |
092435d51c | ||
![]() |
1dff5814be | ||
![]() |
26db391576 | ||
![]() |
ce3214b82d | ||
![]() |
621a8766a8 | ||
![]() |
b6541b7a55 | ||
![]() |
7e27c2ffa8 | ||
![]() |
b55418effd | ||
![]() |
5a259fa10f | ||
![]() |
0ba49cce45 | ||
![]() |
b54422c970 | ||
![]() |
ef9fdd0fa5 | ||
![]() |
e3f0a11053 | ||
![]() |
311fe8f35b | ||
![]() |
a135d9c25d | ||
![]() |
ee72497eef | ||
![]() |
5e63cd3c97 | ||
![]() |
e6fe8169c2 | ||
![]() |
7ca9131fd4 | ||
![]() |
07e0b10515 | ||
![]() |
aa67903f96 | ||
![]() |
5b6d83b533 | ||
![]() |
3e75a2109d | ||
![]() |
7013e60926 | ||
![]() |
559f1919c6 | ||
![]() |
73c8ddc8bf | ||
![]() |
b805754aa1 | ||
![]() |
0f8cfd6031 | ||
![]() |
dffd1435e9 | ||
![]() |
a8e9e1387f | ||
![]() |
1613057881 | ||
![]() |
b4fddf146b | ||
![]() |
aeb1a0da84 | ||
![]() |
71373ee524 | ||
![]() |
1cc25d1a2d | ||
![]() |
bd70a22412 | ||
![]() |
8b7f43f89b | ||
![]() |
58e9a0894f | ||
![]() |
6ef3ab3d3a | ||
![]() |
a9f6ff6fe3 | ||
![]() |
cd1464390c | ||
![]() |
d8ca13f4c6 | ||
![]() |
8fecf45f4c | ||
![]() |
96aadec503 | ||
![]() |
c219fc02cd | ||
![]() |
75d675ab4d | ||
![]() |
69a82c7a0d | ||
![]() |
0c3902b543 | ||
![]() |
7c7ee1cdc8 | ||
![]() |
0c17d1e14f | ||
![]() |
0352aa2094 | ||
![]() |
a9230a6c07 | ||
![]() |
c706b33b30 | ||
![]() |
e9c7ab925f | ||
![]() |
70ed52dd5d | ||
![]() |
4e363b5479 | ||
![]() |
9839ea6667 | ||
![]() |
87b542085b | ||
![]() |
647b54a2dc | ||
![]() |
548961aea1 | ||
![]() |
00911b0842 | ||
![]() |
ff2b8d6db1 | ||
![]() |
0fa295c72d | ||
![]() |
4a01139c8d | ||
![]() |
64e786fe28 | ||
![]() |
5c76c33d7d | ||
![]() |
53bb87c8fb | ||
![]() |
9aaf7a8057 | ||
![]() |
56cab4b6a9 | ||
![]() |
c4804c4c0c | ||
![]() |
8809ae66c6 | ||
![]() |
85dc2cc03a | ||
![]() |
db4cfc9fbd | ||
![]() |
7d2845a661 | ||
![]() |
30a3dae8a6 | ||
![]() |
59acb6dbea | ||
![]() |
8277597bcf | ||
![]() |
8a46b5e6c0 | ||
![]() |
ae230dae46 | ||
![]() |
7062415aec | ||
![]() |
5ed814e950 | ||
![]() |
2156cd4a84 | ||
![]() |
3a74534c39 | ||
![]() |
4d438ed68d | ||
![]() |
bfff2c432c | ||
![]() |
bcf3ad87e8 | ||
![]() |
a958cebdd9 | ||
![]() |
e6aa713a37 | ||
![]() |
e18aad0653 | ||
![]() |
9aedfbec69 | ||
![]() |
c0ca8a74bc | ||
![]() |
63b1860010 | ||
![]() |
0c78b8d182 | ||
![]() |
4e79e23a20 | ||
![]() |
dbb2bbf207 | ||
![]() |
64916ba232 | ||
![]() |
8a7812f1f5 | ||
![]() |
d432d03aea | ||
![]() |
c15d08d6ec | ||
![]() |
f8753bda01 | ||
![]() |
652b17d68d | ||
![]() |
efba81442a | ||
![]() |
1aec0a90bc | ||
![]() |
f81dfce19f | ||
![]() |
2a70638e26 | ||
![]() |
1fe137db44 | ||
![]() |
fe8dad48e2 | ||
![]() |
2cda1502a3 | ||
![]() |
a6728a2203 | ||
![]() |
9e7ca41f58 | ||
![]() |
0776f1e106 | ||
![]() |
de4611ecf6 | ||
![]() |
ee24d17895 | ||
![]() |
da8d76d826 | ||
![]() |
6f30a19dd7 | ||
![]() |
2911cf2a48 | ||
![]() |
e5cf3f9555 | ||
![]() |
5f03201616 | ||
![]() |
8eb7cf1fee | ||
![]() |
0624af09fd | ||
![]() |
2f75657350 | ||
![]() |
00c8795385 | ||
![]() |
89708edf7f | ||
![]() |
71700254b4 | ||
![]() |
aa86e9d399 | ||
![]() |
4b6e6ce20e | ||
![]() |
7cbfca8bd1 | ||
![]() |
e0720a0a55 | ||
![]() |
d4c03b47ec | ||
![]() |
a226e11aac | ||
![]() |
d3d362090c | ||
![]() |
f3eff740ce | ||
![]() |
f4c171aa45 | ||
![]() |
953882e86f | ||
![]() |
46ad7b87e8 | ||
![]() |
4e9afac2a5 | ||
![]() |
2cce5a24c9 | ||
![]() |
43efe92e21 | ||
![]() |
f7a6b94f46 | ||
![]() |
7203acdef9 | ||
![]() |
3db26f82ea | ||
![]() |
716e26aa37 | ||
![]() |
f989048bda | ||
![]() |
49d2897b24 | ||
![]() |
6f60622619 | ||
![]() |
429c5a9a9a | ||
![]() |
7f2a071c51 | ||
![]() |
2efb50cc63 | ||
![]() |
9095dd9e82 | ||
![]() |
30a0f6f292 | ||
![]() |
52f1c7df6d | ||
![]() |
906c7f591e | ||
![]() |
115cc7dede | ||
![]() |
96d5dd24aa | ||
![]() |
28093c46a8 | ||
![]() |
c37f776e87 | ||
![]() |
1dd9fbae94 | ||
![]() |
8be5ec2288 | ||
![]() |
1a420b77e3 | ||
![]() |
0e65e5877f | ||
![]() |
e07054d0d4 | ||
![]() |
b733e76c86 | ||
![]() |
19b71f5f13 | ||
![]() |
ab032919df | ||
![]() |
68e408474d | ||
![]() |
942657fc7c | ||
![]() |
4decbb2586 | ||
![]() |
f3d38018cd | ||
![]() |
3ae40c35e6 | ||
![]() |
4b93feb172 | ||
![]() |
d875891a3c | ||
![]() |
3e68059556 | ||
![]() |
213c990eda | ||
![]() |
929fa5780d | ||
![]() |
7d03048f1d | ||
![]() |
ae9cea03f0 | ||
![]() |
de7b8ad551 | ||
![]() |
4dd5643402 | ||
![]() |
0b8e0f05a7 | ||
![]() |
b188008a1c | ||
![]() |
7bc2e922c9 | ||
![]() |
b0dcdf688f | ||
![]() |
d3387c952a | ||
![]() |
3643974949 | ||
![]() |
8980bcfe4b | ||
![]() |
e1babab3cc | ||
![]() |
97b074ac26 | ||
![]() |
76a907bb79 | ||
![]() |
9681a072d0 | ||
![]() |
32f3f53718 | ||
![]() |
246798a0ba | ||
![]() |
88a8395b8e | ||
![]() |
e95d8bc655 | ||
![]() |
6445200a93 | ||
![]() |
e00d2439b9 | ||
![]() |
7e68e733f5 | ||
![]() |
0565fb9fb6 | ||
![]() |
121c689b78 | ||
![]() |
edeaff4bd4 | ||
![]() |
2370af598e | ||
![]() |
deaa84d28d | ||
![]() |
2efb5a36ca | ||
![]() |
d1ac38171c | ||
![]() |
1a7dace57e | ||
![]() |
0870295a7c | ||
![]() |
5e3cf28642 | ||
![]() |
23398f0198 | ||
![]() |
e991fefb89 | ||
![]() |
d39d26f275 | ||
![]() |
9cc2cee936 | ||
![]() |
b359a1575e | ||
![]() |
8f4261e9d4 | ||
![]() |
565319184c | ||
![]() |
2760304d66 | ||
![]() |
9bd3d78374 | ||
![]() |
1c5de9721a | ||
![]() |
7bcb2ad4f1 | ||
![]() |
89e734de6b | ||
![]() |
cc4de1d1f9 | ||
![]() |
71995d52b3 | ||
![]() |
a178a2170b | ||
![]() |
3c1c13b660 | ||
![]() |
0369ec9adf | ||
![]() |
c828e481fb | ||
![]() |
e3ba11bead | ||
![]() |
beeac18eb1 | ||
![]() |
470574517a | ||
![]() |
c5ef96272f | ||
![]() |
1c7c8c682c | ||
![]() |
ded6754de4 | ||
![]() |
05aff1e097 | ||
![]() |
7959d95db0 | ||
![]() |
6fe0a229e2 | ||
![]() |
9f45fea31e | ||
![]() |
e5e401c640 | ||
![]() |
6c874feb7b | ||
![]() |
03710c9d8e | ||
![]() |
cb698dd37d | ||
![]() |
b36422083e | ||
![]() |
5765b7895c | ||
![]() |
4aa680d6d3 | ||
![]() |
60ca8acd0a | ||
![]() |
352db3a183 | ||
![]() |
4a099c3658 | ||
![]() |
23a08a483e | ||
![]() |
f33cec64aa | ||
![]() |
e401d5c48e | ||
![]() |
9360e4e2c1 | ||
![]() |
7b6b87ec5b | ||
![]() |
b90ac7bd31 | ||
![]() |
a84e98ba6c | ||
![]() |
232378ed2d | ||
![]() |
3baba7ffe8 | ||
![]() |
45b0dc63cd | ||
![]() |
fff06d24da | ||
![]() |
6c56fe2670 | ||
![]() |
dbe1c9c6e6 | ||
![]() |
d8e1a77da5 | ||
![]() |
6bd63de8d0 | ||
![]() |
ac204a11f7 | ||
![]() |
4ab28fffb4 | ||
![]() |
e39e45824d | ||
![]() |
5d831f3f18 | ||
![]() |
1d0767022d | ||
![]() |
2545f62565 | ||
![]() |
2565c01158 | ||
![]() |
133e6f097d | ||
![]() |
b62c86572e | ||
![]() |
c82d9cb89a | ||
![]() |
1269ce8a6f | ||
![]() |
a41ed986bd | ||
![]() |
c4eaf0076d | ||
![]() |
e5708a8f36 | ||
![]() |
2015828fc6 | ||
![]() |
4c1af4cc90 | ||
![]() |
ecc00357b4 | ||
![]() |
a3e7664dcf | ||
![]() |
ffadeeeb84 | ||
![]() |
f516f4099b | ||
![]() |
d6708de7b0 | ||
![]() |
a113d3326b | ||
![]() |
fe607323aa | ||
![]() |
131672f199 | ||
![]() |
9b6a005819 | ||
![]() |
399894ac90 | ||
![]() |
89d5b3df44 | ||
![]() |
6ebe76cba7 | ||
![]() |
1aa8a4ff90 | ||
![]() |
fcf3a04825 | ||
![]() |
5751776a73 | ||
![]() |
b6c8d343dc | ||
![]() |
b663724293 | ||
![]() |
bb33033389 | ||
![]() |
a44815e939 | ||
![]() |
30db611e92 | ||
![]() |
6c518008a5 | ||
![]() |
8719858655 | ||
![]() |
0e2845ec26 | ||
![]() |
c4041043f5 | ||
![]() |
7ad17386f6 | ||
![]() |
f4abc05d62 | ||
![]() |
8a55c60e47 | ||
![]() |
03815ec4fe | ||
![]() |
9a0accddb8 | ||
![]() |
dcf52c132f | ||
![]() |
f92ee46d86 | ||
![]() |
2a9ffcc0a1 | ||
![]() |
b4e586f272 | ||
![]() |
cf201e0794 | ||
![]() |
1161df0ee4 | ||
![]() |
715a46277e | ||
![]() |
5ef777219a | ||
![]() |
ac79d22a9b | ||
![]() |
0a6694708d | ||
![]() |
52f91bc652 | ||
![]() |
8812213c01 | ||
![]() |
ca8329c330 | ||
![]() |
dec9f24673 | ||
![]() |
1e65817d05 | ||
![]() |
a599fd1095 | ||
![]() |
3bf9ea1a4b | ||
![]() |
bb743e8c6e | ||
![]() |
d533183b7f | ||
![]() |
f903686060 | ||
![]() |
f21e520c9c | ||
![]() |
1c5cf90a52 | ||
![]() |
d1537bfd61 | ||
![]() |
9b0dd543e0 | ||
![]() |
9011b936cf | ||
![]() |
93d3212914 | ||
![]() |
63a1bf373c | ||
![]() |
899afcbdca | ||
![]() |
7f1068ef96 | ||
![]() |
1c45a882f7 | ||
![]() |
581bd0eb02 | ||
![]() |
63432724c7 | ||
![]() |
223091f44c | ||
![]() |
d4ccca81db | ||
![]() |
2ad3eb1d57 | ||
![]() |
640fc4d0a0 | ||
![]() |
657b527bc6 | ||
![]() |
74fc4b1a03 | ||
![]() |
e91eabdb09 | ||
![]() |
a3a9416b33 | ||
![]() |
815a064abe | ||
![]() |
929ff45568 | ||
![]() |
c96304c83f | ||
![]() |
8453ff837b | ||
![]() |
4badff1c2f | ||
![]() |
68f664afa4 | ||
![]() |
fbf1f32807 | ||
![]() |
ac95a2e27c | ||
![]() |
45823a36eb | ||
![]() |
37f523fdeb | ||
![]() |
646f1f06c4 | ||
![]() |
d7b6505f64 | ||
![]() |
dc8a86557e | ||
![]() |
d289085ce3 | ||
![]() |
06f16f199a | ||
![]() |
afb254b985 | ||
![]() |
d2cb628a66 | ||
![]() |
fcab72f915 | ||
![]() |
caa375412b | ||
![]() |
88089f22f3 | ||
![]() |
44f7f8a997 | ||
![]() |
c74230a9ea | ||
![]() |
d17c519f88 | ||
![]() |
f6f9a3d925 | ||
![]() |
09e6f42f2e | ||
![]() |
3cdac3e11e | ||
![]() |
8a8948780e | ||
![]() |
49e17044c9 | ||
![]() |
15ee280632 | ||
![]() |
45c964c1e6 | ||
![]() |
bafa13f207 | ||
![]() |
bdc5686e4c | ||
![]() |
ed96bc6441 | ||
![]() |
6719c3a1cd | ||
![]() |
85ef9d8f2e | ||
![]() |
b3f75b91ff | ||
![]() |
84d0d21f23 | ||
![]() |
71b86bf4d0 | ||
![]() |
fd663024ea | ||
![]() |
6d3c66a179 | ||
![]() |
68124599e1 | ||
![]() |
b2545e053a | ||
![]() |
109d00cb14 | ||
![]() |
551944e15b | ||
![]() |
0a34a35403 | ||
![]() |
802ca161d3 | ||
![]() |
a8dd4127f3 | ||
![]() |
0e04ae561e | ||
![]() |
7b37caa96c | ||
![]() |
abf481023b | ||
![]() |
c2c141f941 | ||
![]() |
b52cd8f605 | ||
![]() |
5fd441969d | ||
![]() |
14aa29d18b | ||
![]() |
4c9d2e719e | ||
![]() |
66f3434571 | ||
![]() |
d58b7b509e | ||
![]() |
c21baf0d92 | ||
![]() |
46650b5fb1 | ||
![]() |
51f3129c5d | ||
![]() |
ccdf7ff335 | ||
![]() |
67dda62867 | ||
![]() |
7e2531fe35 | ||
![]() |
38df0760cc | ||
![]() |
d64f27bad1 | ||
![]() |
2b6e7c8632 | ||
![]() |
b54d96205f | ||
![]() |
1da0176cad | ||
![]() |
aed0fee2ca | ||
![]() |
b4975619ed | ||
![]() |
736d5920c7 | ||
![]() |
cdc3754449 | ||
![]() |
2488d361b6 | ||
![]() |
c772de702b | ||
![]() |
434a3a276d | ||
![]() |
8e51e6d1df | ||
![]() |
fd3e2fda00 | ||
![]() |
8f1d81df0f | ||
![]() |
3d1a05d588 | ||
![]() |
98a2e16d4d | ||
![]() |
b5aaf33058 | ||
![]() |
aaf0d8b839 | ||
![]() |
00e71faed6 | ||
![]() |
6a24dd8945 | ||
![]() |
b8c3b8277c | ||
![]() |
8f3e91ae83 | ||
![]() |
23a764190e | ||
![]() |
bc6b16beb2 | ||
![]() |
668ba870e4 | ||
![]() |
7eaeffc8d9 | ||
![]() |
f38ced15e7 | ||
![]() |
b6ca524bdd | ||
![]() |
f9bab14fdb | ||
![]() |
c6828070dc | ||
![]() |
fb9a437f8a | ||
![]() |
cba412cc31 | ||
![]() |
9569d6a802 | ||
![]() |
dd59350485 | ||
![]() |
7e58838895 | ||
![]() |
13f97471a2 | ||
![]() |
bb73a8089a | ||
![]() |
9bea64b5e4 | ||
![]() |
9047025ab7 | ||
![]() |
c2bc3d22a1 | ||
![]() |
60bfee4a7d | ||
![]() |
c5b0a1f005 | ||
![]() |
2532c396ed | ||
![]() |
71fe0bff95 | ||
![]() |
89278953ae | ||
![]() |
3e6ee028e5 | ||
![]() |
6f5a4a9351 | ||
![]() |
5325d8d2ba | ||
![]() |
81738bfa98 | ||
![]() |
e48b9a6da1 | ||
![]() |
c6dd41495b | ||
![]() |
2ce28f75ad | ||
![]() |
24dae29a03 | ||
![]() |
2c0a533948 | ||
![]() |
8e1e1ef970 | ||
![]() |
b573ff3e7a | ||
![]() |
c37f61d31f | ||
![]() |
e0e68aad54 | ||
![]() |
2f943aaff0 | ||
![]() |
ed4ca6a7f3 | ||
![]() |
f4f6f665f7 | ||
![]() |
dcde99bbb8 | ||
![]() |
364fbbd283 | ||
![]() |
95f9a6171b | ||
![]() |
f4d6bad607 | ||
![]() |
a76fcaba3e | ||
![]() |
4fba09794f | ||
![]() |
5049137715 | ||
![]() |
4fb6f4af75 | ||
![]() |
95282edaf9 | ||
![]() |
96e5e0dfb2 | ||
![]() |
75882f3254 | ||
![]() |
442abaab72 | ||
![]() |
5967c1ba1a | ||
![]() |
be8d5a7ae2 | ||
![]() |
9909068714 | ||
![]() |
e28f754fbe | ||
![]() |
45670fbf2d | ||
![]() |
2f367a905e | ||
![]() |
7a566a07ea | ||
![]() |
fe9181c1b4 | ||
![]() |
3e25760950 | ||
![]() |
8527dbc6e2 | ||
![]() |
07d82a91c5 | ||
![]() |
d4e2c331b1 | ||
![]() |
a1d9987e7c | ||
![]() |
664fbb87f5 | ||
![]() |
ca1f2f9078 | ||
![]() |
8b0574a217 | ||
![]() |
0cbb3878c9 | ||
![]() |
2b9d81c9bc | ||
![]() |
45b1e3c72c | ||
![]() |
e5834210d3 | ||
![]() |
1cc838cef4 | ||
![]() |
bae423be41 | ||
![]() |
ff6d5c8ddb | ||
![]() |
aba69146f2 | ||
![]() |
3c76b5cc8e | ||
![]() |
811e241f22 | ||
![]() |
bc9194690c | ||
![]() |
f7e48c95cd | ||
![]() |
1afd56dbf6 | ||
![]() |
f9b79403d1 | ||
![]() |
01e28263be | ||
![]() |
75038baf71 | ||
![]() |
fe3256be9f | ||
![]() |
0872365938 | ||
![]() |
755ed388b2 | ||
![]() |
5c2983f510 | ||
![]() |
f0ab4723b9 | ||
![]() |
b7f2059dc3 | ||
![]() |
ef9f67749a | ||
![]() |
19651cfaad | ||
![]() |
8dc3057fe5 | ||
![]() |
915b0780d6 | ||
![]() |
55bf595cae | ||
![]() |
955d4d3d1a | ||
![]() |
8a30a2408c | ||
![]() |
3e6f0d7372 | ||
![]() |
0d096b43c2 | ||
![]() |
b084552808 | ||
![]() |
7ad1370193 | ||
![]() |
1ed72b7812 | ||
![]() |
c4a7c702b4 | ||
![]() |
af3926af4b | ||
![]() |
c8ed231eca | ||
![]() |
ca22a87949 | ||
![]() |
c938d71d15 | ||
![]() |
0b108c2087 | ||
![]() |
dfe797060a | ||
![]() |
408f5aedb8 | ||
![]() |
81908f7960 | ||
![]() |
e09f5179e6 | ||
![]() |
ab36fbf24a | ||
![]() |
2a5ce96047 | ||
![]() |
01b3c97c42 | ||
![]() |
8df56c5843 | ||
![]() |
c514431e79 | ||
![]() |
bcc4418ff0 | ||
![]() |
2ff5fa73e9 | ||
![]() |
742206c1f2 | ||
![]() |
4e6253b546 | ||
![]() |
5902cc6d9b | ||
![]() |
3f6a08535f | ||
![]() |
0f10c44578 | ||
![]() |
b64fe4dfed | ||
![]() |
58e4efbba8 | ||
![]() |
4e1c7a9f46 | ||
![]() |
ead339fa96 | ||
![]() |
24839c7cfb | ||
![]() |
84ab4ce007 | ||
![]() |
0cb748f30b | ||
![]() |
209445ccde | ||
![]() |
478f4de7ae | ||
![]() |
ef8318f5e3 | ||
![]() |
34f5532fad | ||
![]() |
d84a015725 | ||
![]() |
48a7cd3c87 | ||
![]() |
82cdd88ffe | ||
![]() |
0726491ef8 | ||
![]() |
eb47cc5e93 | ||
![]() |
4604271c6a | ||
![]() |
0a8cb60eee | ||
![]() |
2375464213 | ||
![]() |
d96b422809 | ||
![]() |
0f5aab3a1c | ||
![]() |
b530b584b5 | ||
![]() |
e300d268f9 | ||
![]() |
ccb083af52 | ||
![]() |
c7476f0aa5 | ||
![]() |
f3df64210b | ||
![]() |
7035435948 | ||
![]() |
0c63c7c907 | ||
![]() |
2b1ec5d8d2 | ||
![]() |
a474511356 | ||
![]() |
6037adcace | ||
![]() |
83f0c771d5 | ||
![]() |
44a6b86d68 | ||
![]() |
02d6402f4f | ||
![]() |
ccdf2a3a9e | ||
![]() |
aaab355df7 | ||
![]() |
d93b8f6544 | ||
![]() |
36e434099d | ||
![]() |
bf008234e2 | ||
![]() |
16c0f92f18 | ||
![]() |
a5af604b2d | ||
![]() |
4f40b4a961 | ||
![]() |
043eb5882b | ||
![]() |
00a0461c7a | ||
![]() |
cdf8ea7e30 | ||
![]() |
9619e5cbf8 | ||
![]() |
4e68524871 | ||
![]() |
52d0e86cc6 | ||
![]() |
cdd35d4b09 | ||
![]() |
70965f20d5 | ||
![]() |
67206a5415 | ||
![]() |
9081defd46 | ||
![]() |
090c790e50 | ||
![]() |
6be1be4573 | ||
![]() |
c49ce58f02 | ||
![]() |
b2215cf017 | ||
![]() |
b7b718a545 | ||
![]() |
0f309b9b16 | ||
![]() |
edb54c6cb1 | ||
![]() |
5663c81803 | ||
![]() |
56ff944def | ||
![]() |
62ccec0ac5 | ||
![]() |
421e5d4829 | ||
![]() |
e831bf02c5 | ||
![]() |
97a7875648 | ||
![]() |
4407533a41 | ||
![]() |
3431d58586 | ||
![]() |
005bc4c414 | ||
![]() |
ed9c10a3e6 | ||
![]() |
c8e427ad23 | ||
![]() |
2884b88101 | ||
![]() |
aebcd9b551 | ||
![]() |
96db787657 | ||
![]() |
e818dc27cd | ||
![]() |
bc332018f6 | ||
![]() |
731ab15d57 | ||
![]() |
88a6f16c9a | ||
![]() |
65b299c6cf | ||
![]() |
f3ce3a6f74 | ||
![]() |
4bf7b00013 | ||
![]() |
1d23e15692 | ||
![]() |
a0d2b64747 | ||
![]() |
f4f208c4ae | ||
![]() |
721768bdb0 | ||
![]() |
f2c0981c57 | ||
![]() |
05dfbf3cd4 | ||
![]() |
18ab694f70 | ||
![]() |
677f420bf0 | ||
![]() |
b845f3886a | ||
![]() |
d20efde49d | ||
![]() |
01b7509a39 | ||
![]() |
407c014eb4 | ||
![]() |
5e6eb0b847 | ||
![]() |
3e3e41eaba | ||
![]() |
f21aa0352b | ||
![]() |
6cc27e9797 | ||
![]() |
1866be0475 | ||
![]() |
eb7820b2b0 | ||
![]() |
b7f275efb3 | ||
![]() |
186e52c4d8 | ||
![]() |
a3c56d9052 | ||
![]() |
8d3381b490 | ||
![]() |
9821725c6b | ||
![]() |
3d22709808 | ||
![]() |
a0a840101c | ||
![]() |
5d1d590692 | ||
![]() |
dfa11e22cf | ||
![]() |
c256b26629 | ||
![]() |
12e7be63f7 | ||
![]() |
477653a0d6 | ||
![]() |
04a1bb1390 | ||
![]() |
bbc09288bd | ||
![]() |
b76dc06297 | ||
![]() |
33ed142306 | ||
![]() |
49f9bff260 | ||
![]() |
22da9087b1 | ||
![]() |
a6cd6eedbe | ||
![]() |
7bd33e4406 | ||
![]() |
5d4aada526 | ||
![]() |
551597d579 | ||
![]() |
4bce0f27e6 | ||
![]() |
320732ae6b | ||
![]() |
d7b4b9e485 | ||
![]() |
f5815b781a | ||
![]() |
10b5e2e73a | ||
![]() |
57fef97433 | ||
![]() |
03278a74bf | ||
![]() |
9fe153ae29 | ||
![]() |
2f966531a7 | ||
![]() |
4c8bebc0d7 | ||
![]() |
24b6dcf29f | ||
![]() |
22b179e66c | ||
![]() |
9ed29725a0 | ||
![]() |
59bb759855 | ||
![]() |
75c6fd047b | ||
![]() |
d3db690c42 | ||
![]() |
abdd57db0b | ||
![]() |
227496bea7 | ||
![]() |
068fc48fda | ||
![]() |
af39344e99 | ||
![]() |
92b7e63bb5 | ||
![]() |
b74be185c2 | ||
![]() |
ad8a46d261 | ||
![]() |
10626ad6f8 | ||
![]() |
f5db106eb6 | ||
![]() |
521ed1cef0 | ||
![]() |
de13fca3b1 | ||
![]() |
b59ca95a16 | ||
![]() |
6631fc4c6d | ||
![]() |
23208357c1 | ||
![]() |
9f3351cf7b |
4
.github/ISSUE_TEMPLATE/new-issue-template.md
vendored
@@ -11,7 +11,7 @@ assignees: ''
|
||||
|
||||
It is important to realise that **this is NOT A SUPPORT FORUM**, this is for reproducible BUGS with raylib ONLY.
|
||||
|
||||
There are lots of generous and helpful people ready to help you out on [raylib Discord forum](https://discord.gg/VkzNHUE) or [raylib reddit](https://www.reddit.com/r/raylib/).
|
||||
There are lots of generous and helpful people ready to help you out on [raylib Discord forum](https://discord.gg/raylib) or [raylib reddit](https://www.reddit.com/r/raylib/).
|
||||
|
||||
Remember that asking for support questions here actively takes developer time away from improving raylib.
|
||||
|
||||
@@ -25,7 +25,7 @@ Please, before submitting a new issue verify and check:
|
||||
|
||||
### Issue description
|
||||
|
||||
*Briefly describe the issue you are experiencing (or the feature you want to see added to raylib). Tell us what you were trying to do and what happened instead. Remember, this is not the best place to ask questions. For questions, go to [raylib Discord server](https://discord.gg/VkzNHUE).*
|
||||
*Briefly describe the issue you are experiencing (or the feature you want to see added to raylib). Tell us what you were trying to do and what happened instead. Remember, this is not the best place to ask questions. For questions, go to [raylib Discord server](https://discord.gg/raylib).*
|
||||
|
||||
### Environment
|
||||
|
||||
|
15
.github/workflows/android.yml
vendored
@@ -1,8 +1,18 @@
|
||||
name: Android
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/android.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -50,6 +60,11 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
|
108
.github/workflows/cmake.yml
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
name: CMakeBuilds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/cmake.yml'
|
||||
- 'CMakeList.txt'
|
||||
- 'CMakeOptions.txt'
|
||||
- 'cmake/**'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build_windows:
|
||||
name: Windows Build
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: powershell
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $env:GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE -DPLATFORM=Desktop
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: powershell
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $env:BUILD_TYPE
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: powershell
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $env:BUILD_TYPE
|
||||
|
||||
build_linux:
|
||||
name: Linux Build
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install gcc-multilib
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $BUILD_TYPE
|
20
.github/workflows/linux.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -55,7 +64,7 @@ jobs:
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32"
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 32
|
||||
@@ -63,7 +72,7 @@ jobs:
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
if: matrix.bits == 64
|
||||
@@ -71,6 +80,11 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
|
39
.github/workflows/linux_examples.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Linux Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/linux_examples.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
|
||||
|
||||
- name: Build Library
|
||||
run: |
|
||||
cd src
|
||||
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC
|
||||
cd ..
|
||||
|
||||
- name: Build Examples
|
||||
run: |
|
||||
cd examples
|
||||
make PLATFORM=PLATFORM_DESKTOP -B
|
||||
cd ..
|
20
.github/workflows/macos.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: macOS
|
||||
|
||||
on:
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/macos.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -40,12 +49,12 @@ jobs:
|
||||
run: |
|
||||
cd src
|
||||
clang --version
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
|
||||
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a
|
||||
make clean
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
||||
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
|
||||
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B
|
||||
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib
|
||||
@@ -56,6 +65,11 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
|
||||
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
||||
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
||||
cd build
|
||||
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
||||
|
||||
|
20
.github/workflows/webassembly.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: WebAssembly
|
||||
|
||||
on:
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/webassembly.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -18,7 +27,7 @@ jobs:
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup emsdk
|
||||
uses: mymindstorm/setup-emsdk@v7
|
||||
uses: mymindstorm/setup-emsdk@v9
|
||||
with:
|
||||
version: 2.0.0
|
||||
actions-cache-folder: 'emsdk-cache'
|
||||
@@ -43,12 +52,17 @@ jobs:
|
||||
run: |
|
||||
cd src
|
||||
emcc -v
|
||||
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
|
||||
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
|
||||
cd ..
|
||||
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
|
||||
dir
|
||||
|
28
.github/workflows/windows.yml
vendored
@@ -1,8 +1,17 @@
|
||||
name: Windows
|
||||
|
||||
on:
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows.yml'
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@@ -29,11 +38,11 @@ jobs:
|
||||
- compiler: msvc16
|
||||
bits: 32
|
||||
ARCH: "x86"
|
||||
VSBINPATH: "Win32"
|
||||
VSARCHPATH: "Win32"
|
||||
- compiler: msvc16
|
||||
bits: 64
|
||||
ARCH: "x64"
|
||||
VSBINPATH: "x64"
|
||||
VSARCHPATH: "x64"
|
||||
|
||||
env:
|
||||
RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
|
||||
@@ -80,12 +89,12 @@ jobs:
|
||||
|
||||
- name: Build Library (MSVC16)
|
||||
run: |
|
||||
cd projects/VS2017
|
||||
cd projects/VS2019
|
||||
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
|
||||
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
|
||||
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
|
||||
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
|
||||
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
|
||||
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
|
||||
cd ../..
|
||||
shell: cmd
|
||||
if: matrix.compiler == 'msvc16'
|
||||
@@ -93,6 +102,11 @@ jobs:
|
||||
- name: Generate Artifacts
|
||||
run: |
|
||||
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
|
||||
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
|
||||
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
|
||||
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
|
||||
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
|
||||
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
|
||||
cd build
|
||||
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
|
||||
dir
|
||||
|
33
.github/workflows/windows_examples.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Windows Examples
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- '.github/workflows/windows_examples.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
|
||||
- name: Build Library (MSVC16)
|
||||
run: |
|
||||
cd projects/VS2019
|
||||
msbuild.exe raylib.sln /property:Configuration=Release /property:Platform=x86
|
||||
cd ../..
|
||||
shell: cmd
|
||||
|
31
.gitignore
vendored
@@ -45,6 +45,7 @@ ipch/
|
||||
*.db
|
||||
*.opendb
|
||||
packages/
|
||||
!examples/models/resources/models/obj/
|
||||
|
||||
# Ignore compiled binaries
|
||||
*.o
|
||||
@@ -52,19 +53,13 @@ packages/
|
||||
*.a
|
||||
*.bc
|
||||
*.so
|
||||
*.so.*
|
||||
|
||||
# Ignore all examples files
|
||||
examples/*
|
||||
# Unignore all examples dirs
|
||||
!examples/*/
|
||||
# Unignore all examples files with extension
|
||||
!examples/*.c
|
||||
!examples/*.png
|
||||
# Unignore examples Makefile
|
||||
!examples/Makefile
|
||||
!examples/Makefile.Android
|
||||
!examples/raylib_compile_execute.bat
|
||||
!examples/raylib_makefile_example.bat
|
||||
# Ignore wasm data in examples/
|
||||
examples/**/*.wasm
|
||||
examples/**/*.data
|
||||
examples/**/*.js
|
||||
examples/**/*.html
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
@@ -82,7 +77,7 @@ DerivedData/
|
||||
|
||||
# Jetbrains project
|
||||
.idea/
|
||||
cmake-build-debug/
|
||||
cmake-build-*/
|
||||
|
||||
# CMake stuff
|
||||
CMakeCache.txt
|
||||
@@ -95,10 +90,14 @@ compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
build
|
||||
|
||||
# Unignore These makefiles...
|
||||
!examples/CMakeLists.txt
|
||||
|
||||
# Ignore GNU global tags
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
# Zig programming language
|
||||
zig-cache/
|
||||
zig-out/
|
||||
build/
|
||||
build-*/
|
||||
docgen_tmp/
|
||||
|
113
BINDINGS.md
@@ -1,97 +1,122 @@
|
||||
## raylib bindings
|
||||
# raylib bindings and wrappers
|
||||
|
||||
Some people ported raylib to other languages in form of bindings or wrappers to the library.
|
||||
Some people ported raylib to other languages in form of bindings or wrappers to the library. Here it is alist with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list.
|
||||
|
||||
Here it is a list with the ones I'm aware of:
|
||||
### Language Bindings
|
||||
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib | **3.1-dev** | [C](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
|
||||
| raylib-cpp | 3.1-dev | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
|
||||
| Raylib-cs | 3.0 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
|
||||
| raylib | **3.7** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
|
||||
| Raylib-cs | 3.7 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
|
||||
| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
|
||||
| dray | 3.5 | [D](https://dlang.org/) | https://github.com/xdrie/dray |
|
||||
| raylib-go | 4.0-dev | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
|
||||
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
|
||||
| raylib-lua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
|
||||
| raylua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
|
||||
| nelua-raylib | 3.7 | [nelua](https://nelua.io/) | https://github.com/AKDev21/nelua-raylib |
|
||||
| NimraylibNow! | 3.7 | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now |
|
||||
| raylib-Forever | auto | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
|
||||
| Ray4Laz | 3.7 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz |
|
||||
| pyraylib | 3.7 | [Python](https://www.python.org/) | https://github.com/Ho011/pyraylib |
|
||||
| raylib-python-cffi | 3.7 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
|
||||
| jaylib | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
|
||||
| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
|
||||
| raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 |
|
||||
| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php |
|
||||
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp |
|
||||
| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
|
||||
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
|
||||
| hxRaylib | 3.7 | [Haxe](https://haxe.org/) | https://github.com/ForeignSasquatch/hxRaylib |
|
||||
| raylib-wren | 3.7 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
|
||||
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | https://github.com/Deathbat2190/raylib_odin_bindings |
|
||||
| raylib-odin | 3.7| [Odin](https://odin-lang.org/) | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
|
||||
| raylib.v | 3.7 | [V](https://vlang.io/) | https://github.com/irishgreencitrus/raylib.v |
|
||||
| raylib-ocaml | 3.7 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
||||
| raylib-swift | 3.7 | [Swift](https://swift.org/) | https://github.com/STREGAsGate/Raylib |
|
||||
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
|
||||
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
|
||||
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | https://github.com/shiryel/rayex |
|
||||
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | https://github.com/electronstudio/kaylib |
|
||||
| dlang_raylib | 3.7 | [D](https://dlang.org) | https://github.com/rc-05/dlang_raylib |
|
||||
|
||||
### Utility Wrapers
|
||||
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib-cpp | 3.7 | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
|
||||
|
||||
### Older or Unmaintained Language Bindings
|
||||
These are older raylib bindings that are more than 2 versions old or have not been maintained.
|
||||
| name | raylib version | language | repo |
|
||||
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
|
||||
| raylib-cppsharp | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
|
||||
| raylib-boo | 3.0 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
|
||||
| RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
|
||||
| raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
|
||||
| raylib-d | 3.0 | [D](https://dlang.org/) | https://github.com/onroundit/raylib-d |
|
||||
| bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
|
||||
| dray | 3.0 | [D](https://dlang.org/) | https://github.com/xdrie/dray |
|
||||
| raylib-go | 3.0 | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
|
||||
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
||||
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
|
||||
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
|
||||
| go-raylib | 3.1-dev | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
|
||||
| raylib-rs | 3.0 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
|
||||
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
||||
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
||||
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
||||
| raylib-lua | 3.0 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
|
||||
| raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore |
|
||||
| raylua | 3.0 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
|
||||
| LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib |
|
||||
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
|
||||
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
|
||||
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
|
||||
| raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua |
|
||||
| raylib-Nim | ? | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
|
||||
| raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
|
||||
| raylib-Forever | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
|
||||
| raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
|
||||
| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
|
||||
| raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
|
||||
| raylib-cr | ? | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
|
||||
| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
|
||||
| raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
|
||||
| cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
|
||||
| raylib.cr | ? | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
|
||||
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
|
||||
| raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
|
||||
| Graphics-Raylib | ? | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
|
||||
| raylib-ruby-ffi | ? | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
|
||||
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
|
||||
| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
|
||||
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
|
||||
| raylib-mruby | ? | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
|
||||
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
|
||||
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
|
||||
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
|
||||
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
|
||||
| raylib-python-cffi | 3.1-dev | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
|
||||
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
|
||||
| jaylib | 3.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
|
||||
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
|
||||
| clj-raylib | ? | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
||||
| node-raylib | 3.0 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
|
||||
| raylib-j | 3.5 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/CreedVI/Raylib-J |
|
||||
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
|
||||
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
|
||||
| raylib-js | 2.6 | [JavaScript](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-js |
|
||||
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
|
||||
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
|
||||
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
|
||||
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
|
||||
| raylib-php | 3.0 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php |
|
||||
| raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
|
||||
| raylib-phpcpp | 3.0 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp |
|
||||
| raylib-factor | 2.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
|
||||
| gforth-raylib | 3.0 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
|
||||
| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
|
||||
| ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
|
||||
| cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
|
||||
| raylib-scm | 2.5 | [Chicken Scheme](https://www.call-cc.org/) | https://github.com/yashrk/raylib-scm |
|
||||
| raylib-chibi | ? | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi |
|
||||
| raylib-chibi | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi |
|
||||
| raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme |
|
||||
| Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib |
|
||||
| raylib-wren | 3.0 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
|
||||
| raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin |
|
||||
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
|
||||
| raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig |
|
||||
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai |
|
||||
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
|
||||
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
|
||||
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
|
||||
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
|
||||
| vraylib | 2.5 | [V](https://vlang.io/) | https://github.com/MajorHard/vraylib |
|
||||
| hb-raylib | 3.0 | [Harbour](https://harbour.github.io/) | https://github.com/rjopek/hb-raylib |
|
||||
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
|
||||
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
|
||||
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
|
||||
| raylib-xdpw | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) | https://github.com/vtereshkov/raylib-xdpw |
|
||||
| raylib-carp | 3.0 | [Carp](https://github.com/carp-lang/Carp) | https://github.com/pluckyporcupine/raylib-carp |
|
||||
| raylib-fb | 3.0 | [FreeBasic](https://www.freebasic.net/) | https://github.com/IchMagBier/raylib-fb |
|
||||
| raylib-purebasic | 3.0 | [PureBasic](https://www.purebasic.com/) | https://github.com/D-a-n-i-l-o/raylib-purebasic |
|
||||
| raylib-smallBasic | 3.1-dev | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib |
|
||||
| raylib-ats2 | ? | [ATS2](http://www.ats-lang.org/) | https://github.com/mephistopheles-8/raylib-ats2 |
|
||||
| raylib-ats2 | 3.0 | [ATS2](http://www.ats-lang.org/) | https://github.com/mephistopheles-8/raylib-ats2 |
|
||||
| raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef |
|
||||
| raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never |
|
||||
| raylib.cbl | ? | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
||||
| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
||||
|
||||
|
||||
Missing some language? Feel free to create a new binding! :)
|
||||
|
||||
|
||||
Missing some language or wrapper? Feel free to create a new one! :)
|
||||
|
||||
Usually, raylib bindings follow the convention: `raylib-{language}`
|
||||
|
||||
|
239
CHANGELOG
@@ -1,7 +1,244 @@
|
||||
changelog
|
||||
---------
|
||||
|
||||
Current Release: raylib 3.5.0 (25 December 2020)
|
||||
Current Release: raylib 4.0.0 (05 November 2021)
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Release: raylib 4.0 - 8th Anniversary Edition (05 November 2021)
|
||||
-------------------------------------------------------------------------
|
||||
KEY CHANGES:
|
||||
- Naming consistency and coherency: Complete review of the library: sintax, naming, comments, decriptions, logs...
|
||||
- Event Automation System: Support for input events recording and automatic re-playing, useful for automated testing and more!
|
||||
- Custom game-loop control: Intended for advance users that want to control the events polling and the timming mechanisms
|
||||
- rlgl 4.0: Completely decoupling from platform layer and raylib, intended for standalone usage as single-file header-only
|
||||
- raymath 1.5: Complete review following new conventions, to make it more portable and self-contained
|
||||
- raygui 3.0: Complete review and official new release, more portable and self-contained, intended for tools development
|
||||
- raylib_parser: New tool to parse raylib.h and extract all required info into custom output formats (TXT, XML, JSON...)
|
||||
- Zig and Odin official support
|
||||
|
||||
Detailed changes:
|
||||
[core] ADDED: Support canvas resizing on web (#1840) by @skylersaleh
|
||||
[core] ADDED: GetMouseDelta() (#1832) by @adricoin2010
|
||||
[core] ADDED: Support additional mouse buttons (#1753) by @lambertwang
|
||||
[core] ADDED: SetRandomSeed() (#1994) by @TommiSinivuo
|
||||
[core] ADDED: GetTouchPointId() #1972
|
||||
[core] ADDED: EncodeDataBase64() and DecodeDataBase64()
|
||||
[core] REMOVED: PLATFORM_UWP, difficult to maintain
|
||||
[core] REMOVED: IsGamepadName()
|
||||
[core] RENAMED: SwapBuffers() to SwapScreenBuffer()
|
||||
[core] RENAMED: Wait() to WaitTime()
|
||||
[core] RENAMED: RayHitInfo to RayCollision (#1781)
|
||||
[core] RENAMED: GetRayCollisionGround() to GetRayCollisionQuad() (#1781)
|
||||
[core] REVIEWED: Support mouse wheel on x-axis (#1948)
|
||||
[core] REVIEWED: DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900) by @grenappels
|
||||
[core] REVIEWED: LoadShader() and default locations and descriptions
|
||||
[core] REVIEWED: LoadShaderFromMemory() (#1851) by @Ruminant
|
||||
[core] REVIEWED: WaitTime(), avoid global variables dependency to make the function is self-contained (#1841)
|
||||
[core] REVIEWED: SetWindowSize() to work on web (#1847) by @nikki93
|
||||
[core] REVIEWED: Raspberry RPI/DRM keyboard blocking render loop (#1879) @luizpestana
|
||||
[core] REVIEWED: Android multi-touch (#1869) by @humbe
|
||||
[core] REVIEWED: Implemented GetGamepadName() for emscripten by @nbarkhina
|
||||
[core] REVIEWED: HighDPI support (#1987) by @ArnaudValensi
|
||||
[core] REVIEWED: KeyCallback(), register keys independently of the actions
|
||||
[rlgl] ADDED: GRAPHIC_API_OPENGL_43
|
||||
[rlgl] ADDED: rlUpdateVertexBufferElements() (#1915)
|
||||
[rlgl] ADDED: rlActiveDrawBuffers() (#1911)
|
||||
[rlgl] ADDED: rlEnableColorBlend()/rlDisableColorBlend()
|
||||
[rlgl] ADDED: rlGetPixelFormatName()
|
||||
[rlgl] REVIEWED: rlUpdateVertexBuffer (#1914) by @630Studios
|
||||
[rlgl] REVIEWED: rlDrawVertexArrayElements() (#1891)
|
||||
[rlgl] REVIEWED: Wrong normal matrix calculation (#1870)
|
||||
[raymath] ADDED: Vector3Angle()
|
||||
[raymath] REVIEWED: QuaternionFromAxisAngle() (#1892)
|
||||
[raymath] REVIEWED: QuaternionToMatrix() returning transposed result. (#1793) by @object71
|
||||
[shapes] ADDED: RenderPolyLinesEx() (#1758) by @lambertwang
|
||||
[shapes] ADDED: DrawLineBezierCubic() (#2021) by @SAOMDVN
|
||||
[textures] ADDED: GetImageColor() #2024
|
||||
[textures] REMOVED: GenImagePerlinNoise()
|
||||
[textures] RENAMED: GetTextureData() to LoadImageFromTexture()
|
||||
[textures] RENAMED: GetScreenData() to LoadImageFromScreen()
|
||||
[textures] REVIEWED: ExportImage() to use SaveFileData() (#1779)
|
||||
[textures] REVIEWED: LoadImageAnim() #2005
|
||||
[text] ADDED: Security check in case of not valid font
|
||||
[text] ADDED: `GetGlyphInfo()` to get glyph info for a specific codepoint
|
||||
[text] ADDED: `GetGlyphAtlasRec()` to get glyph rectangle within the generated font atlas
|
||||
[text] ADDED: DrawTextPro() with text rotation support, WARNING: DrawTextPro() requires including `rlgl.h`, before it was only dependant on `textures` module.
|
||||
[text] ADDED: UnloadCodepoints() to safely free loaded codepoints
|
||||
[text] REMOVED: DrawTextRec() and DrawTextRecEx(), moved to example, those functions could be very specific depending on user needs so it's better to give the user the full source in case of special requirements instead of allowing a function with +10 input parameters.
|
||||
[text] RENAMED: struct `CharInfo` to `GlyphInfo`, actually that's the correct naming for the data contained. It contains the character glyph metrics and the glyph image; in the past it also contained rectangle within the font atlas but that data has been moved to `Font` struct directly, so, `GlyphInfo` is a more correct name.
|
||||
[text] RENAMED: `CodepointToUtf8()` to `CodepointToUTF8()`, capitalization of UTF-8 is the correct form, it would also require de hyphen but it can be omitted in this case.
|
||||
[text] RENAMED: `TextToUtf8()` to `TextCodepointsToUTF8` for consistency and more detail on the functionality.
|
||||
[text] RENAMED: GetCodepoints() to LoadCodepoints(), now codepoint array data is loaded dynamically instead of reusing a limited static buffer.
|
||||
[text] RENAMED: GetNextCodepoint() to GetCodepoint()
|
||||
[models] ADDED: MagikaVoxel VOX models loading
|
||||
[models] ADDED: GenMeshCone() (#1903)
|
||||
[models] ADDED: GetModelBoundingBox()
|
||||
[models] ADDED: DrawBillboardPro() (#1759) by @nobytesgiven
|
||||
[models] ADDED: DrawCubeTextureRec() (#2001) by @tdgroot
|
||||
[models] ADDED: DrawCylinderEx() and DrawCylinderWiresEx() (#2049) by @Horrowind
|
||||
[models] REMOVED: DrawBillboardEx()
|
||||
[models] RENAMED: MeshBoundingBox() to GetMeshBoundingBox()
|
||||
[models] RENAMED: MeshTangents() to GenMeshTangents()
|
||||
[models] RENAMED: MeshBinormals() to GenMeshBinormals()
|
||||
[models] REVIEWED: GenMeshTangents() (#1877) by @630Studios
|
||||
[models] REVIEWED: CheckCollisionBoxSphere() by @Crydsch
|
||||
[models] REVIEWED: GetRayCollisionQuad() by @Crydsch
|
||||
[models] REVIEWED: LoadGLTF(), fixed missing transformations and nonroot skinning by @MrDiver
|
||||
[models] REVIEWED: LoadGLTF(), rewriten from scratch, removed animations support (broken)
|
||||
[models] REVIEWED: Decouple DrawMesh() and DrawMeshInstanced() (#1958)
|
||||
[models] REVIEWED: Support vertex color attribute for GLTF and IQM (#1790) by @object71
|
||||
[models] REVIEWED: DrawBillboardPro() (#1941) by @GithubPrankster
|
||||
[models] REDESIGNED: Major review of glTF loading functionality (#1849) by @object71
|
||||
[audio] ADDED: SeekMusicStream() (#2006) by @GithubPrankster
|
||||
[audio] REMOVED: GetAudioStreamBufferSizeDefault()
|
||||
[audio] RENAMED: InitAudioStream() to LoadAudioStream()
|
||||
[audio] RENAMED: CloseAudioStream() to UnloadAudioStream()
|
||||
[audio] RENAMED: IsMusicPlaying() to IsMusicStreamPlaying()
|
||||
[audio] REVIEWED: ExportWaveAsCode()
|
||||
[audio] REDESIGNED: Use frameCount on audio instead of sampleCount
|
||||
[utils] REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR (#1796)
|
||||
[examples] ADDED: core_custom_frame_control
|
||||
[examples] ADDED: core_basic_screen_manager
|
||||
[examples] ADDED: core_split_screen (#1806) by @JeffM2501
|
||||
[examples] ADDED: core_smooth_pixelperfect (#1771) by @NotManyIdeasDev
|
||||
[examples] ADDED: shaders_texture_outline (#1883) by @GoldenThumbs
|
||||
[examples] ADDED: models_loading_vox (#1940) by @procfxgen
|
||||
[examples] ADDED: rlgl_compute_shader by @TSnake41 (#2088)
|
||||
[examples] REMOVED: models_material_pbr
|
||||
[examples] REMOVED: models_gltf_animation
|
||||
[examples] REVIEWED: core_3d_picking
|
||||
[examples] REVIEWED: core_input_mouse
|
||||
[examples] REVIEWED: core_vr_simulator, RenderTexture usage
|
||||
[examples] REVIEWED: core_window_letterbox, RenderTexture usage
|
||||
[examples] REVIEWED: shapes_basic_shapes
|
||||
[examples] REVIEWED: shapes_logo_raylib_anim
|
||||
[examples] REVIEWED: textures_to_image
|
||||
[examples] REVIEWED: text_rectangle_bounds
|
||||
[examples] REVIEWED: text_unicode
|
||||
[examples] REVIEWED: text_draw_3d
|
||||
[examples] REVIEWED: models_loading
|
||||
[examples] REVIEWED: models_skybox (#1792) (#1778)
|
||||
[examples] REVIEWED: models_mesh_picking
|
||||
[examples] REVIEWED: models_yaw_pitch_roll
|
||||
[examples] REVIEWED: models_rlgl_solar_system
|
||||
[examples] REVIEWED: shaders_custom_uniform, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_eratosthenes, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_julia_set, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_postprocessing, RenderTexture usage
|
||||
[examples] REVIEWED: shaders_basic_lighting, simplified (#1865)
|
||||
[examples] REVIEWED: audio_raw_stream.c
|
||||
[examples] REVIEWED: raudio_standalone
|
||||
[examples] REVIEWED: raylib_opengl_interop
|
||||
[examples] REVIEWED: rlgl_standalone.c
|
||||
[examples] REVIEWED: Resources licenses
|
||||
[examples] REVIEWED: models resources reorganization
|
||||
[templates] REMOVED: Moved to a separate repo: https://github.com/raysan5/raylib-game-template
|
||||
[build] ADDED: Zig build file (#2014) by @TommiSinivuo
|
||||
[build] ADDED: Android VS2019 solution (#2013) by @Kronka
|
||||
[build] REMOVED: VS2017 project, outdated
|
||||
[build] RENAMED: All raylib modules prefixed with 'r' (core -> rcore)
|
||||
[build] RENAMED: SUPPORT_MOUSE_CURSOR_NATIVE to SUPPORT_MOUSE_CURSOR_POINT
|
||||
[build] REVIEWED: examples/examples_template.c
|
||||
[build] REVIEWED: Makefile to latest Emscripten SDK r23
|
||||
[build] REVIEWED: Makefile for latest Android NDK r32 LTS
|
||||
[build] REVIEWED: raylib resource files
|
||||
[build] Moved some extra raylib libraries to /extras/ directory
|
||||
[*] UPDATED: Multiple bindings to latest version
|
||||
[*] UPDATED: Most external libraries to latest versions (except GLFW)
|
||||
[*] Multiple code improvements and fixes by multiple contributors!
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Release: raylib 3.7 (26 April 2021)
|
||||
-------------------------------------------------------------------------
|
||||
KEY CHANGES:
|
||||
- [rlgl] REDESIGNED: Greater abstraction level, some functionality moved to core module
|
||||
- [rlgl] REVIEWED: Instancing and stereo rendering
|
||||
- [core] REDESIGNED: VR simulator, fbo/shader exposed to user
|
||||
- [utils] ADDED: File access callbacks system
|
||||
- [models] ADDED: glTF animations support (#1551) by @object71
|
||||
- [audio] ADDED: Music streaming support from memory (#1606) by @nezvers
|
||||
- [*] RENAMED: enum types and enum values for consistency
|
||||
|
||||
Detailed changes:
|
||||
[core] ADDED: LoadVrStereoConfig()
|
||||
[core] ADDED: UnloadVrStereoConfig()
|
||||
[core] ADDED: BeginVrStereoMode()
|
||||
[core] ADDED: EndVrStereoMode()
|
||||
[core] ADDED: GetCurrentMonitor() (#1485) by @object71
|
||||
[core] ADDED: SetGamepadMappings() (#1506)
|
||||
[core] RENAMED: struct Camera: camera.type to camera.projection
|
||||
[core] RENAMED: LoadShaderCode() to LoadShaderFromMemory() (#1690)
|
||||
[core] RENAMED: SetMatrixProjection() to rlSetMatrixProjection()
|
||||
[core] RENAMED: SetMatrixModelview() to rlSetMatrixModelview()
|
||||
[core] RENAMED: GetMatrixModelview() to rlGetMatrixModelview()
|
||||
[core] RENAMED: GetMatrixProjection() to rlGetMatrixProjection()
|
||||
[core] RENAMED: GetShaderDefault() to rlGetShaderDefault()
|
||||
[core] RENAMED: GetTextureDefault() to rlGetTextureDefault()
|
||||
[core] REMOVED: GetShapesTexture()
|
||||
[core] REMOVED: GetShapesTextureRec()
|
||||
[core] REMOVED: GetMouseCursor()
|
||||
[core] REMOVED: SetTraceLogExit()
|
||||
[core] REVIEWED: GetFileName() and GetDirectoryPath() (#1534) by @gilzoide
|
||||
[core] REVIEWED: Wait() to support FreeBSD (#1618)
|
||||
[core] REVIEWED: HighDPI support on macOS retina (#1510)
|
||||
[core] REDESIGNED: GetFileExtension(), includes the .dot
|
||||
[core] REDESIGNED: IsFileExtension(), includes the .dot
|
||||
[core] REDESIGNED: Compresion API to use sdefl/sinfl libs
|
||||
[rlgl] ADDED: SUPPORT_GL_DETAILS_INFO config flag
|
||||
[rlgl] REMOVED: GenTexture*() functions (#721)
|
||||
[rlgl] REVIEWED: rlLoadShaderDefault()
|
||||
[rlgl] REDESIGNED: rlLoadExtensions(), more details exposed
|
||||
[raymath] REVIEWED: QuaternionFromEuler() (#1651)
|
||||
[raymath] REVIEWED: MatrixRotateZYX() (#1642)
|
||||
[shapes] ADDED: DrawLineBezierQuad() (#1468) by @epsilon-phase
|
||||
[shapes] ADDED: CheckCollisionLines()
|
||||
[shapes] ADDED: CheckCollisionPointLine() by @mkupiec1
|
||||
[shapes] REVIEWED: CheckCollisionPointTriangle() by @mkupiec1
|
||||
[shapes] REDESIGNED: SetShapesTexture()
|
||||
[shapes] REDESIGNED: DrawCircleSector(), to use float params
|
||||
[shapes] REDESIGNED: DrawCircleSectorLines(), to use float params
|
||||
[shapes] REDESIGNED: DrawRing(), to use float params
|
||||
[shapes] REDESIGNED: DrawRingLines(), to use float params
|
||||
[textures] ADDED: DrawTexturePoly() and example (#1677) by @chriscamacho
|
||||
[textures] ADDED: UnloadImageColors() for allocs consistency
|
||||
[textures] RENAMED: GetImageData() to LoadImageColors()
|
||||
[textures] REVIEWED: ImageClearBackground() and ImageDrawRectangleRec() (#1487) by @JeffM2501
|
||||
[textures] REVIEWED: DrawTexturePro() and DrawRectanglePro() transformations (#1632) by @ChrisDill
|
||||
[text] REDESIGNED: DrawFPS()
|
||||
[models] ADDED: UploadMesh() (#1529)
|
||||
[models] ADDED: UpdateMeshBuffer()
|
||||
[models] ADDED: DrawMesh()
|
||||
[models] ADDED: DrawMeshInstanced()
|
||||
[models] ADDED: UnloadModelAnimations() (#1648) by @object71
|
||||
[models] REMOVED: DrawGizmo()
|
||||
[models] REMOVED: LoadMeshes()
|
||||
[models] REMOVED: MeshNormalsSmooth()
|
||||
[models] REVIEWED: DrawLine3D() (#1643)
|
||||
[audio] REVIEWED: Multichannel sound system (#1548)
|
||||
[audio] REVIEWED: jar_xm library (#1701) by @jmorel33
|
||||
[utils] ADDED: SetLoadFileDataCallback()
|
||||
[utils] ADDED: SetSaveFileDataCallback()
|
||||
[utils] ADDED: SetLoadFileTextCallback()
|
||||
[utils] ADDED: SetSaveFileTextCallback()
|
||||
[examples] ADDED: text_draw_3d (#1689) by @Demizdor
|
||||
[examples] ADDED: textures_poly (#1677) by @chriscamacho
|
||||
[examples] ADDED: models_gltf_model (#1551) by @object71
|
||||
[examples] RENAMED: shaders_rlgl_mesh_instanced to shaders_mesh_intancing
|
||||
[examples] REDESIGNED: shaders_rlgl_mesh_instanced by @moliad
|
||||
[examples] REDESIGNED: core_vr_simulator
|
||||
[examples] REDESIGNED: models_yaw_pitch_roll
|
||||
[build] ADDED: Config flag: SUPPORT_STANDARD_FILEIO
|
||||
[build] ADDED: Config flag: SUPPORT_WINMM_HIGHRES_TIMER (#1641)
|
||||
[build] ADDED: Config flag: SUPPORT_GL_DETAILS_INFO
|
||||
[build] ADDED: Examples projects to VS2019 solution
|
||||
[build] REVIEWED: Makefile to support PLATFORM_RPI (#1580)
|
||||
[build] REVIEWED: Multiple typecast warnings by @JeffM2501
|
||||
[build] REDESIGNED: VS2019 project build paths
|
||||
[build] REDESIGNED: CMake build system by @object71
|
||||
[*] RENAMED: Several functions parameters for consistency
|
||||
[*] UPDATED: Multiple bindings to latest version
|
||||
[*] UPDATED: All external libraries to latest versions
|
||||
[*] Multiple code improvements and fixes by multiple contributors!
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Release: raylib 3.5 - 7th Anniversary Edition (25 December 2020)
|
||||
|
@@ -1,57 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(raylib)
|
||||
|
||||
# Directory for easier includes
|
||||
# Anywhere you see include(...) you can check <root>/cmake for that file
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
# RAYLIB_IS_MAIN determines whether the project is being used from root
|
||||
# or if it is added as a dependency (through add_subdirectory for example).
|
||||
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(RAYLIB_IS_MAIN TRUE)
|
||||
else()
|
||||
set(RAYLIB_IS_MAIN FALSE)
|
||||
endif()
|
||||
|
||||
# Config options
|
||||
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
|
||||
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
||||
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
|
||||
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
|
||||
# Sets compiler flags and language standard
|
||||
include(CompilerFlags)
|
||||
|
||||
# This helps support the case where emsdk toolchain file is used
|
||||
# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
||||
# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
|
||||
if(EMSCRIPTEN)
|
||||
SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
|
||||
endif()
|
||||
# Registers build options that are exposed to cmake
|
||||
include(CMakeOptions.txt)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
set (CMAKE_C_STANDARD 99)
|
||||
endif()
|
||||
# Enforces a few environment and compiler configurations
|
||||
include(BuildOptions)
|
||||
|
||||
include(AddIfFlagCompiles)
|
||||
add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
|
||||
add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
||||
# src/external/jar_xm.h does shady stuff
|
||||
add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)
|
||||
|
||||
if (ENABLE_ASAN)
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
endif()
|
||||
if (ENABLE_UBSAN)
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
endif()
|
||||
if (ENABLE_MSAN)
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
if (ENABLE_MSAN AND ENABLE_ASAN)
|
||||
MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
# Main sources directory (the second parameter sets the output directory name to raylib)
|
||||
add_subdirectory(src raylib)
|
||||
|
||||
if (${BUILD_EXAMPLES})
|
||||
MESSAGE(STATUS "Building examples is enabled")
|
||||
|
87
CMakeOptions.txt
Normal file
@@ -0,0 +1,87 @@
|
||||
### Config options ###
|
||||
include(CMakeDependentOption)
|
||||
include(EnumOption)
|
||||
|
||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
|
||||
|
||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
|
||||
|
||||
# Configuration options
|
||||
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
|
||||
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
|
||||
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
||||
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
|
||||
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
|
||||
|
||||
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
||||
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
||||
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
|
||||
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(USE_WAYLAND "Use Wayland for window creation" OFF)
|
||||
endif()
|
||||
|
||||
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
|
||||
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||
|
||||
# rcore.c
|
||||
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_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_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_SCREEN_CAPTURE "Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_GIF_RECORDING "Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_BUSY_WAIT_LOOP "Use busy wait loop for timing sync instead of a high-resolution timer" OFF CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_EVENTS_WAITING "Wait for events passively (sleeping while no events) instead of polling them actively every frame" OFF CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution can improve the accuracy of time-out intervals in wait functions" OFF CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_DATA_STORAGE "Support for persistent data storage" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# 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)
|
||||
|
||||
# rtextures.c
|
||||
cmake_dependent_option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" 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_HDR "Support loading HDR as textures" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_KTX "Support loading KTX as textures" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_ASTC "Support loading ASTC as textures" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
|
||||
# rtext.c
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# 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_FILEFORMAT_OBJ "Support loading OBJ file format" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL 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_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
|
||||
|
||||
# raudio.c
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_OGG "Support loading OGG 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_MP3 "Support loading MP3 for sound" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_FILEFORMAT_FLAC "Support loading FLAC for sound" ${OFF} CUSTOMIZE_BUILD OFF)
|
||||
|
||||
# utils.c
|
||||
cmake_dependent_option(SUPPORT_STANDARD_FILEIO "Support standard file io library (stdio.h)" ON CUSTOMIZE_BUILD ON)
|
||||
cmake_dependent_option(SUPPORT_TRACELOG "Show TraceLog() output messages. NOTE: By default LOG_DEBUG traces not shown" ON CUSTOMIZE_BUILD ON)
|
@@ -4,22 +4,22 @@ Hello contributors! Welcome to raylib!
|
||||
|
||||
Do you enjoy raylib and want to contribute? Nice! You can help with the following points:
|
||||
|
||||
- C programming - Can you write/review/test/improve the code?
|
||||
- Documentation/Tutorials/Example - Can you write some tutorial/example?
|
||||
- Porting to other platforms - Can you port and compile raylib on other systems?
|
||||
- Web Development - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
||||
- Testing - Can you find some bugs in raylib?
|
||||
- `C programming` - Can you write/review/test/improve the code?
|
||||
- `Documentation/Tutorials/Example` - Can you write some tutorial/example?
|
||||
- `Porting to other platforms` - Can you port/adapt/compile raylib on other systems?
|
||||
- `Web Development` - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
||||
- `Testing` - Can you find some bugs in raylib?
|
||||
|
||||
This document contains a set of guidelines to contribute to the project. These are mostly guidelines, not rules.
|
||||
Use your best judgement, and feel free to propose changes to this document in a pull request.
|
||||
|
||||
### raylib philosophy
|
||||
|
||||
- raylib is a tool to enjoy videogames programming, every single function in raylib should be a tutorial on itself.
|
||||
- raylib is **SIMPLE** and **EASY-TO-USE**, I tried to keep it compact with a small set of functions, if a function is too complex or is not clearly useful, better not including it.
|
||||
- raylib is a tool to **ENJOY** videogames programming, every function in raylib is designed as a mini-tutorial on itself.
|
||||
- raylib is **SIMPLE** and **EASY-TO-USE**, I tried to keep it compact with a small set of functions, if a function is too complex, better not including it.
|
||||
- raylib is open source and free; educators and institutions can use this tool to **TEACH** videogames programming completely for free.
|
||||
- raylib is collaborative; contribution of tutorials / code examples / bug fixes / code comments are highly appreciated.
|
||||
- raylib's license (and its external libs respective licenses) allow using it on commercial projects.
|
||||
- raylib's license (and its external libs respective licenses) allow using raylib on commercial projects.
|
||||
|
||||
### Some interesting reads to start with
|
||||
|
||||
@@ -40,9 +40,9 @@ to make it easier for students/users to read, write and understand code.
|
||||
|
||||
Source code is extensively commented for that purpose, raylib primary learning method is:
|
||||
|
||||
> learn by reading code and examples
|
||||
> `Learn by reading code and examples`
|
||||
|
||||
For detailed information on building raylib and examples, please see [raylib Wiki](https://github.com/raysan5/raylib/wiki).
|
||||
For detailed information on building raylib and examples, please check [raylib Wiki](https://github.com/raysan5/raylib/wiki).
|
||||
|
||||
### Opening new Issues
|
||||
|
||||
@@ -68,69 +68,9 @@ To open new issue for raylib (bug, enhancement, discussion...), just try to foll
|
||||
If you have any doubt, don't hesitate to [contact me](mailto:ray@raylib.com)!.
|
||||
You can write me a direct mail but you can also contact me on the following networks:
|
||||
|
||||
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
|
||||
- [raylib Discord](https://discord.gg/VkzNHUE) - A direct communication channel for project discussions.
|
||||
- [raylib Discord](https://discord.gg/raylib) - A direct communication channel for project discussions.
|
||||
- [raylib twitter](https://twitter.com/raysan5) - My personal twitter account, I usually post about raylib, you can send me PMs.
|
||||
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
|
||||
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
|
||||
|
||||
Thank you very much for your time! :)
|
||||
|
||||
----
|
||||
|
||||
Here is a list of raylib contributors, these people have invested part of their time
|
||||
contributing (in some way or another) to make the raylib project better. Huge thanks to all of them!
|
||||
|
||||
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
||||
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
||||
- Victor Dual for implementing and testing 3D shapes functions.
|
||||
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
|
||||
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
||||
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
||||
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler).
|
||||
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing PBR materials and lighting systems... among multiple other improvements and multiple tools and games.
|
||||
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
|
||||
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
|
||||
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
|
||||
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
|
||||
- [Marcelo Paez](https://github.com/paezao) for helping on OSX High DPI display issue.
|
||||
- [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for an amazing contribution to raylib Lua module.
|
||||
- [Teodor Stoenescu](https://github.com/teodor-stoenescu) for improvements on OBJ object loading.
|
||||
- [RDR8](https://github.com/RDR8) for helping with Linux build improvements.
|
||||
- [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system.
|
||||
- [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building.
|
||||
- [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c)
|
||||
- [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support.
|
||||
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain.
|
||||
- [Michael Vetter](https://github.com/jubalh) for improvements on build system and his work on Suse Linux package... and multiple fixes!
|
||||
- [Wilhem Barbier](https://github.com/nounoursheureux) for adding Image generation functions, shaders work and some fixes.
|
||||
- [Benjamin Summerton](https://github.com/define-private-public) for improving OSX building and his amazing work on CMake build sytem.
|
||||
- [MartinFX](https://github.com/Martinfx) for adding compilation support for FreeBSD OS and derivatives.
|
||||
- [Ahmad Fatoum](https://github.com/a3f) for implementing CI support for raylib (Travis and AppVeyor) and great improvements on build system.
|
||||
- [SamNChiet](https://github.com/SamNChiet) for a greatly improved UWP input implementation.
|
||||
- [David Reid](https://github.com/mackron) for a complete review of audio module to support his amazing miniaudio library.
|
||||
- [Kai](https://github.com/questor) for multiple code reviews and improvements.
|
||||
- [Max Danielsson](https://github.com/autious) for adding support for orthographic 3d camera projection
|
||||
- [Lumaio](https://github.com/TheLumaio) for his great work on GBuffers and GetCollisionRayModel().
|
||||
- [Jonas Daeyaert](https://github.com/culacant) for an amazing work on IQM animated models support.
|
||||
- [Seth Archambault](https://github.com/SethArchambault) for the work on Android Gamepad support (SNES model).
|
||||
- [D3nX](https://github.com/D3nX) for adding Code::Blocks project template.
|
||||
- [Jak Barnes](https://github.com/Syphonx) for a great work on `rnet`, new raylib network module
|
||||
- [Vlad Adrian](https://github.com/Demizdor) for an amazing work on Unicode support, new shapes functions and raygui.
|
||||
- [Reece Mackie](https://github.com/Rover656) for a great work on improving UWP support
|
||||
- [flashback-fx](flashback-fx) for improving easings library and example
|
||||
- [Jorge A. Gomes](https://github.com/overdev) for adding nine-patch textures support and example
|
||||
- [Berni8k](https://github.com/Berni8k) for improving Raspberry Pi input system, using evdev
|
||||
- [Wilhem Barbier](https://github.com/wbrbr) for implementing glTF loading support and solving several issues
|
||||
- [Marco Lizza](https://github.com/MarcoLizza) for improving logging system and multiple issues
|
||||
- [Anata](https://github.com/anatagawa) for creating amazing examples and contributing with them
|
||||
- [Narice](https://github.com/narice) made easings.h includable as standalone header
|
||||
- [Eric J.](https://github.com/ProfJski) for shaders_eratosthenes example contribution
|
||||
- [PompPenguin](https://github.com/PompPenguin) for reviewing 3rd person camera
|
||||
- [Mohamed Shazan](https://github.com/msmshazan) for adding support for ANGLE graphics backend
|
||||
|
||||
Please, if I forget someone in this list, excuse me and send me a PR!
|
||||
|
63
CONTRIBUTORS.md
Normal file
@@ -0,0 +1,63 @@
|
||||
### WARNING: This file is unmaintained! This list of contributors is uncomplete!
|
||||
|
||||
### Check CHANGELOG for some of the contributors details or just the official contributors list of the repo
|
||||
|
||||
---
|
||||
|
||||
Here is a list of raylib contributors, these people have invested part of their time
|
||||
contributing (in some way or another) to make the raylib project better. Huge thanks to all of them!
|
||||
|
||||
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
||||
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
||||
- Victor Dual for implementing and testing 3D shapes functions.
|
||||
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
|
||||
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
||||
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
||||
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||
- [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler).
|
||||
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing PBR materials and lighting systems... among multiple other improvements and multiple tools and games.
|
||||
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
|
||||
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
|
||||
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
|
||||
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
|
||||
- [Marcelo Paez](https://github.com/paezao) for helping on OSX High DPI display issue.
|
||||
- [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for an amazing contribution to raylib Lua module.
|
||||
- [Teodor Stoenescu](https://github.com/teodor-stoenescu) for improvements on OBJ object loading.
|
||||
- [RDR8](https://github.com/RDR8) for helping with Linux build improvements.
|
||||
- [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system.
|
||||
- [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building.
|
||||
- [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c)
|
||||
- [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support.
|
||||
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain.
|
||||
- [Michael Vetter](https://github.com/jubalh) for improvements on build system and his work on Suse Linux package... and multiple fixes!
|
||||
- [Wilhem Barbier](https://github.com/nounoursheureux) for adding Image generation functions, shaders work and some fixes.
|
||||
- [Benjamin Summerton](https://github.com/define-private-public) for improving OSX building and his amazing work on CMake build sytem.
|
||||
- [MartinFX](https://github.com/Martinfx) for adding compilation support for FreeBSD OS and derivatives.
|
||||
- [Ahmad Fatoum](https://github.com/a3f) for implementing CI support for raylib (Travis and AppVeyor) and great improvements on build system.
|
||||
- [SamNChiet](https://github.com/SamNChiet) for a greatly improved UWP input implementation.
|
||||
- [David Reid](https://github.com/mackron) for a complete review of audio module to support his amazing miniaudio library.
|
||||
- [Kai](https://github.com/questor) for multiple code reviews and improvements.
|
||||
- [Max Danielsson](https://github.com/autious) for adding support for orthographic 3d camera projection
|
||||
- [Lumaio](https://github.com/TheLumaio) for his great work on GBuffers and GetCollisionRayModel().
|
||||
- [Jonas Daeyaert](https://github.com/culacant) for an amazing work on IQM animated models support.
|
||||
- [Seth Archambault](https://github.com/SethArchambault) for the work on Android Gamepad support (SNES model).
|
||||
- [D3nX](https://github.com/D3nX) for adding Code::Blocks project template.
|
||||
- [Jak Barnes](https://github.com/Syphonx) for a great work on `rnet`, new raylib network module
|
||||
- [Vlad Adrian](https://github.com/Demizdor) for an amazing work on Unicode support, new shapes functions and raygui.
|
||||
- [Reece Mackie](https://github.com/Rover656) for a great work on improving UWP support
|
||||
- [flashback-fx](flashback-fx) for improving easings library and example
|
||||
- [Jorge A. Gomes](https://github.com/overdev) for adding nine-patch textures support and example
|
||||
- [Berni8k](https://github.com/Berni8k) for improving Raspberry Pi input system, using evdev
|
||||
- [Wilhem Barbier](https://github.com/wbrbr) for implementing glTF loading support and solving several issues
|
||||
- [Marco Lizza](https://github.com/MarcoLizza) for improving logging system and multiple issues
|
||||
- [Anata](https://github.com/anatagawa) for creating amazing examples and contributing with them
|
||||
- [Narice](https://github.com/narice) made easings.h includable as standalone header
|
||||
- [Eric J.](https://github.com/ProfJski) for shaders_eratosthenes example contribution
|
||||
- [PompPenguin](https://github.com/PompPenguin) for reviewing 3rd person camera
|
||||
- [Mohamed Shazan](https://github.com/msmshazan) for adding support for ANGLE graphics backend
|
||||
|
||||
Please, if I forget someone in this list, excuse me and send me a PR!
|
95
CONVENTIONS.md
Normal file
@@ -0,0 +1,95 @@
|
||||
## C Coding Style Conventions
|
||||
|
||||
Here it is a list with some of the code conventions used by raylib:
|
||||
|
||||
Code element | Convention | Example
|
||||
--- | :---: | ---
|
||||
Defines | ALL_CAPS | `#define PLATFORM_DESKTOP`
|
||||
Macros | ALL_CAPS | `#define MIN(a,b) (((a)<(b))?(a):(b))`
|
||||
Variables | lowerCase | `int screenWidth = 0;`, `float targetFrameTime = 0.016f;`
|
||||
Local variables | lowerCase | `Vector2 playerPosition = { 0 };`
|
||||
Global variables | lowerCase | `bool windowReady = false;`
|
||||
Constants | lowerCase | `const int maxValue = 8;`
|
||||
Pointers | MyType *pointer | `Texture2D *array = NULL;`
|
||||
float values | always x.xf | `float gravity = 10.0f`
|
||||
Operators | value1*value2 | `int product = value*6;`
|
||||
Operators | value1/value2 | `int division = value/4;`
|
||||
Operators | value1 + value2 | `int sum = value + 10;`
|
||||
Operators | value1 - value2 | `int res = value - 5;`
|
||||
Enum | TitleCase | `enum TextureFormat`
|
||||
Enum members | ALL_CAPS | `PIXELFORMAT_UNCOMPRESSED_R8G8B8`
|
||||
Struct | TitleCase | `struct Texture2D`, `struct Material`
|
||||
Struct members |lowerCase | `texture.width`, `color.r`
|
||||
Functions | TitleCase | `InitWindow()`, `LoadImageFromMemory()`
|
||||
Functions params | lowerCase | `width`, `height`
|
||||
Ternary Operator | (condition)? result1 : result2 | `printf("Value is 0: %s", (value == 0)? "yes" : "no");`
|
||||
|
||||
Some other conventions to follow:
|
||||
- **ALWAYS** initialize all defined variables.
|
||||
- **Do not use TABS**, use 4 spaces instead.
|
||||
- Avoid trailing spaces, please, avoid them
|
||||
- Control flow statements always are followed **by a space**:
|
||||
```c
|
||||
if (condition) value = 0;
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
|
||||
|
||||
// Be careful with the switch formatting!
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
|
||||
} break;
|
||||
case 2: break;
|
||||
default: break;
|
||||
}
|
||||
```
|
||||
- All conditions checks are **always between parenthesis** but not boolean values:
|
||||
```c
|
||||
if ((value > 1) && (value < 50) && valueActive))
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
- When dealing with braces or curly brackets, open-close them in aligned mode:
|
||||
```c
|
||||
void SomeFunction()
|
||||
{
|
||||
// TODO: Do something here!
|
||||
}
|
||||
```
|
||||
|
||||
**If proposing new functions, please try to use a clear naming for function-name and functions-parameters, in case of doubt, open an issue for discussion.**
|
||||
|
||||
## Files and Directories Naming Conventions
|
||||
|
||||
- Directories will be named using `snake_case`: `resources/models`, `resources/fonts`
|
||||
|
||||
- Files will be named using `snake_case`: `main_title.png`, `cubicmap.png`, `sound.wav`
|
||||
|
||||
_NOTE: Avoid any space or special character in the files/dir naming!_
|
||||
|
||||
## Games/Examples Directories Organization Conventions
|
||||
|
||||
- Data files should be organized by context and usage in the game, think about the loading requirements for data and put all the resources that need to be loaded at the same time together.
|
||||
- Use descriptive names for the files, it would be perfect if just reading the name of the file, it was possible to know what is that file and where fits in the game.
|
||||
- Here it is an example, note that some resources require to be loaded all at once while other require to be loaded only at initialization (gui, font).
|
||||
|
||||
```
|
||||
resources/audio/fx/long_jump.wav
|
||||
resources/audio/music/main_theme.ogg
|
||||
resources/screens/logo/logo.png
|
||||
resources/screens/title/title.png
|
||||
resources/screens/gameplay/background.png
|
||||
resources/characters/player.png
|
||||
resources/characters/enemy_slime.png
|
||||
resources/common/font_arial.ttf
|
||||
resources/common/gui.png
|
||||
```
|
||||
|
89
HISTORY.md
@@ -33,7 +33,7 @@ Lots of code changes and lot of testing have concluded in this amazing new rayli
|
||||
notes on raylib 1.2
|
||||
-------------------
|
||||
|
||||
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/rcore.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||
|
||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
|
||||
|
||||
@@ -54,9 +54,9 @@ On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This
|
||||
|
||||
- Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
||||
|
||||
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
||||
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/rcamera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
||||
|
||||
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
|
||||
- [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional.
|
||||
|
||||
@@ -77,7 +77,7 @@ On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For
|
||||
|
||||
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
||||
|
||||
- [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||
- [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||
|
||||
- Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
||||
|
||||
@@ -106,7 +106,7 @@ On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new
|
||||
|
||||
- Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
|
||||
|
||||
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_rcamera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||
|
||||
This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes.
|
||||
|
||||
@@ -249,14 +249,14 @@ After **10 months of intense development**, new raylib version is ready. Despite
|
||||
|
||||
- New **GitHub Actions CI** system has been implemented for Windows, Linux and macOS code and examples compilation on every new commit or PR to make sure library keeps stable and usable with no breaking bugs.
|
||||
|
||||
Note that only key changes are listed here but there is way more! About **30 new functions**, multiple functions reviewed, bindings to [+40 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md) and great samples/demos/tutorials [created by the community](https://discord.gg/VkzNHUE), including raylib integration with [Spine](https://github.com/WEREMSOFT/spine-raylib-runtimes), [Unity](https://unitycoder.com/blog/2019/12/09/using-raylib-dll-in-unity/), [Tiled](https://github.com/OnACoffeeBreak/raylib_tiled_import_with_tmx), [Nuklear](http://bedroomcoders.co.uk/implementing-a-3d-gui-with-raylib/), [enet](https://github.com/nxrighthere/NetDynamics) and [more](https://github.com/raysan5/raylib/issues/1079)!
|
||||
Note that only key changes are listed here but there is way more! About **30 new functions**, multiple functions reviewed, bindings to [+40 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md) and great samples/demos/tutorials [created by the community](https://discord.gg/raylib), including raylib integration with [Spine](https://github.com/WEREMSOFT/spine-raylib-runtimes), [Unity](https://unitycoder.com/blog/2019/12/09/using-raylib-dll-in-unity/), [Tiled](https://github.com/OnACoffeeBreak/raylib_tiled_import_with_tmx), [Nuklear](http://bedroomcoders.co.uk/implementing-a-3d-gui-with-raylib/), [enet](https://github.com/nxrighthere/NetDynamics) and [more](https://github.com/raysan5/raylib/issues/1079)!
|
||||
|
||||
It has been **10 months of improvements** to create the best raylib ever.
|
||||
|
||||
Welcome to **raylib 3.0**.
|
||||
|
||||
notes on raylib 3.5
|
||||
-------------------
|
||||
notes on raylib 3.5 - 7th Anniversary Edition
|
||||
---------------------------------------------
|
||||
|
||||
It's December 25th... this crazy 2020 is about to finish and finally the holidays gave me some time to put a new version of raylib. It's been **9 months since last release** and last November raylib become 7 years old... I was not able to release this new version back then but here it is. Many changes and improvements have happened in those months and, even, last August, raylib was awarded with an [Epic Megagrant](https://www.unrealengine.com/en-US/blog/epic-megagrants-fall-2020-update)! Bindings list kept growing to [+50 programming languages](BINDINGS.md) and some new platforms have been supported. Let's see this new version details:
|
||||
|
||||
@@ -270,7 +270,7 @@ First, some general numbers of this new update:
|
||||
|
||||
Here the list with some highlights for `raylib 3.5`.
|
||||
|
||||
- NEW **Platform** supported: **Raspberry Pi 4 native mode** (no X11 windows) through [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) subsystem and GBM API. Actually this is a really interesting improvement because it opens the door to raylib to support other embedded platforms (Odroid, GameShell, NanoPi...). Also worth mentioning the un-official homebrew ports of raylib for [PS4](https://github.com/orbisdev/orbisdev-orbisGl2) and PSVita.
|
||||
- NEW **Platform** supported: **Raspberry Pi 4 native mode** (no X11 windows) through [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) subsystem and GBM API. Actually this is a really interesting improvement because it opens the door to raylib to support other embedded platforms (Odroid, GameShell, NanoPi...). Also worth mentioning the un-official homebrew ports of raylib for [PS4](https://github.com/orbisdev/orbisdev-orbisGl2) and [PSVita](https://github.com/psp2dev/raylib4Vita).
|
||||
|
||||
- NEW **configuration options** exposed: For custom raylib builds, `config.h` now exposes **more than 150 flags and defines** to build raylib with only the desired features, for example, it allows to build a minimal raylib library in just some KB removing all external data filetypes supported, very useful to generate **small executables or embedded devices**.
|
||||
|
||||
@@ -291,3 +291,74 @@ Here the list with some highlights for `raylib 3.5`.
|
||||
A part of those changes, many new functions have been added, some redundant functions removed and many functions have been reviewed for consistency with the full API (function name, parameters name and order, code formatting...). Again, this release represents is a **great improvement for raylib and marks the way forward** for the library. Make sure to check [CHANGELOG](CHANGELOG) for details! Hope you enjoy it!
|
||||
|
||||
Happy holidays! :)
|
||||
|
||||
notes on raylib 3.7
|
||||
-------------------
|
||||
|
||||
April 2021, it's been about 4 months since last raylib release and here it is already a new one, this time with a bunch of internal redesigns and improvements. Surprisingly, on April the 8th I was awarded for a second time with the [Google Open Source Peer Bonus Award](https://opensource.googleblog.com/2021/04/announcing-first-group-of-google-open-source-peer-bonus-winners.html) for my contribution to open source world with raylib and it seems the library is getting some traction, what a better moment for a new release? Let's see what can be found in this new version:
|
||||
|
||||
Let's start with some numbers:
|
||||
|
||||
- **+100** closed issues (for a TOTAL of **+900**!)
|
||||
- **+400** commits since previous RELEASE
|
||||
- **+50** functions ADDED (**+30** of them to rlgl API)
|
||||
- **+30** functions REVIEWED/REDESIGNED
|
||||
- **+40** new contributors (for a TOTAL of **+210**!)
|
||||
|
||||
Highlights for `raylib 3.7`:
|
||||
|
||||
- **REDESIGNED: `rlgl` module for greater abstraction level**. This suppose an **important change in raylib architecture**, now `rlgl` functionality is self-contained in the module and used by higher-level layers (specially by `core` module), those upper layers are the ones that expose functionality to the main API when required, for example the `Shaders`, `Mesh` and `Materials` functionality. Multiple `rlgl` functions have been renamed for consistency, in this case, following the `rl*()` prefix convention. Functions have also been reorganized internally by categories and `GenTexture*()` functions have been removed from the library and moved to [`models_material_pbr`](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) example.
|
||||
|
||||
- **REDESIGNED: VR simulator and stereo rendering mechanism**. A **brand new API** has been added, more comprehensive and better integrated with raylib, the **new stereo rendering** can be combined with `RenderTexture` and `Shader` API allowing the user to **manage fbo and distortion shader directly**. Also, the new rendering mechanism supports **instancing on stereo rendering**! Check the updated [`core_vr_simulator`](https://github.com/raysan5/raylib/blob/master/examples/core/core_vr_simulator.c) example for reference!
|
||||
|
||||
- **ADDED: New file access callbacks system**. Several new callback functions have been added to the API to allow custom file loaders. A [nice example](https://github.com/RobLoach/raylib-physfs) it's the **raylib integration with a virtual file system** [PhysFS](https://icculus.org/physfs/).
|
||||
|
||||
- **ADDED: glTF animations support**. glTF is the preferred models file format to be used with raylib and along the addition of a models animation API on latest raylib versions, now animations support for glTF format has come to raylib, thanks for this great contribution to [Hristo Stamenov](@object71)
|
||||
|
||||
- **ADDED: Music streaming support from memory**. raylib has been adding the `Load*FromMemory()` option to all its supported file formats but **music streaming** was not supported yet... until now. Thanks to this great contribution by [Agnis "NeZvērs" Aldiņš](@nezvers), now raylib supports music streamming from memory data for all supported file formats: WAV, OGG, MP3, FLAC, XM and MOD.
|
||||
|
||||
- **RENAMED: enums values for consistency**. Most raylib enums names and values names have been renamed for consistency, now all value names start with the type of data they represent. It increases clarity and readability when using those values and also **improves overall library consistency**.
|
||||
|
||||
Beside those key changes, many functions have been reviewed with improvements and bug fixes, many of them contributed by the community! Thanks! And again, this release sets a **new milestone for raylib library**. Make sure to check [CHANGELOG](CHANGELOG) for detailed list of changes! Hope you enjoy this new raylib installment!
|
||||
|
||||
Happy **gamedev/tools/graphics** programming! :)
|
||||
|
||||
notes on raylib 4.0 - 8th Anniversary Edition
|
||||
---------------------------------------------
|
||||
|
||||
It's been about 6 months since last raylib release and it's been **8 years since I started with this project**, what an adventure! It's time for a new release: `raylib 4.0`, **the biggest release ever** and an inflexion point for the library. Many hours have been put in this release to make it special, **many library details have been polished**: syntax, naming conventions, code comments, functions descriptions, log outputs... Almost all the issues have been closed (only 3 remain open at the moment of this writing) and some amazing new features have been added. I expect this **`raylib 4.0`** to be a long term version (LTS), stable and complete enough for any new graphic/game/tool application development.
|
||||
|
||||
Let's start with some numbers:
|
||||
|
||||
- **+130** closed issues (for a TOTAL of **+1030**!)
|
||||
- **+550** commits since previous RELEASE
|
||||
- **+20** functions ADDED to raylib API
|
||||
- **+60** functions ADDED to rlgl API
|
||||
- **+40** functions RENAMED/REVIEWED/REDESIGNED
|
||||
- **+60** new contributors (for a TOTAL of **+275**!)
|
||||
|
||||
Highlights for `raylib 4.0`:
|
||||
|
||||
- **Naming consistency and coherency**: `raylib` API has been completely reviewed to be consistent on naming conventions for data structures and functions, comments and descriptions have been reviewed, also the sintax of many symbols for consistency; some functions and structs have been renamed (i.e. `struct CharInfo` to `struct GlyphInfo`). Output log messages have been also improved to show more info to the users. Several articles have been writen in this process: [raylib_syntax analysis](https://github.com/raysan5/raylib/wiki/raylib-syntax-analysis) and [raylib API usage analysis](https://gist.github.com/raysan5/7c0c9fff1b6c19af24bb4a51b7383f1e). In general, a big polishment of the library to make it more consistent and coherent.
|
||||
|
||||
- **Event Automation System**: This new _experimental_ feature has been added for future usage, it allows to **record input events and re-play them automatically**. This feature could be very useful to automatize examples testing but also for tutorials with assited game playing, in-game cinematics, speedruns, AI playing and more! Note this feature is still experimental.
|
||||
|
||||
- **Custom game-loop control**: As requested by some advance users, **the game-loop control can be exposed** compiling raylib with the config flag: `SUPPORT_CUSTOM_FRAME_CONTROL`. It's intended for advance users that want to control the events polling and also the timming mechanisms of their games.
|
||||
|
||||
- [**`rlgl 4.0`**](https://github.com/raysan5/raylib/blob/master/src/rlgl.h): This module has been completely **decoupled from platform layer** and raylib, now `rlgl` single-file header-only library only depends on the multiple OpenGL backends supported, even the dependency on `raymath` has been removed. Additionally, **support for OpenGL 4.3** has been added, supporting compute shaders and Shader Storage Buffer Objects (SSBO). Now `rlgl` can be used as a complete standalone portable library to wrap several OpenGL version and providing **a simple and easy-to-use pseudo-OpenGL immediate-mode API**.
|
||||
|
||||
- [**`raymath 1.5`**](https://github.com/raysan5/raylib/blob/master/src/raymath.h): This module has been reviewed and some new conventions have been adopted to make it **more portable and self-contained**:
|
||||
- Functions are self-contained, no function use other raymath function inside, required code is directly re-implemented
|
||||
- Functions input parameters are always received by value
|
||||
- Functions use always a "result" variable for return
|
||||
- Angles are always in radians (`DEG2RAD`/`RAD2DEG` macros provided for convenience)
|
||||
|
||||
- [**`raygui 3.0`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** (included in `raylib/src/extras`) has been updated to a new version, embedding the icons collection and adding mulstiple improvements. It has been simplified and constrained for a better focus on its task: provide a simple and easy-to-use immediate-mode-gui library for small tools development.
|
||||
|
||||
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Added **new tool to parse `raylib.h`** and tokenize its enums, structs and functions, extracting all required info (name, params, descriptions...) into custom output formats (TXT, XML, JSON...) for further processing. This tool is specially useful to **automatize bindings generation**. Hopefully, this tool will make life easier to binding creators to update their bindings for raylib 4.0 or adding new ones!
|
||||
|
||||
- **Zig and Odin official support for raylib**: Those two new amazing programming languages are officially supporting raylib, `Zig` lists raylib as an [official example for C interoperatibility](https://ziglang.org/learn/samples/#c-interoperability) and Odin [officially supports raylib as a vendor library](https://github.com/odin-lang/Odin/tree/master/vendor/raylib). Both languages also have several bingings to raylib. Additionally, Zig build system supported has been added to compile raylib library and examples.
|
||||
|
||||
Those are some of the key features for this new release but actually there is way more! **Support for `VOX` ([MagikaVoxel](https://ephtracy.github.io/)) 3d model format** has been added, **new [raylib_game_template](https://github.com/raysan5/raylib-game-template)** repo shared, **new `EncodeDataBase64()` and `DecodeDataBase64()` functions** added, **improved HiDPI support**, new `DrawTextPro()` with support for text rotations, completely **reviewed `glTF` models loading**, added **`SeekMusicStream()` for music seeking**, many new examples and +20 examples reviewed... **hundreds of improvements and bug fixes**! Make sure to check [CHANGELOG](CHANGELOG) for a detailed list of changes!
|
||||
|
||||
Undoubtely, **this is the best raylib ever**. Enjoy gamedev/tools/graphics programming! :)
|
||||
|
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||
Copyright (c) 2013-2021 Ramon Santamaria (@raysan5)
|
||||
|
||||
This software is provided "as-is", without any express or implied warranty. In no event
|
||||
will the authors be held liable for any damages arising from the use of this software.
|
||||
|
107
README.md
@@ -1,21 +1,23 @@
|
||||
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_256x256.png" width=256>
|
||||
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||
|
||||
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||
|
||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||
|
||||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no auto-debugging... 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.*
|
||||
|
||||
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
[](https://github.com/raysan5/raylib/graphs/contributors)
|
||||
[](https://github.com/raysan5/raylib/releases)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](https://github.com/raysan5/raylib/commits/master)
|
||||
[](LICENSE)
|
||||
|
||||
[](https://discord.gg/VkzNHUE)
|
||||
[](https://discord.gg/raylib)
|
||||
[](https://github.com/raysan5/raylib/stargazers)
|
||||
[](https://twitter.com/raysan5)
|
||||
[](https://www.reddit.com/r/raylib/)
|
||||
@@ -26,60 +28,62 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AAndroid)
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
|
||||
|
||||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml)
|
||||
[](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml)
|
||||
|
||||
features
|
||||
--------
|
||||
- **NO external dependencies**, all required libraries are bundled into raylib
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||
- Written in plain C code (C99) in PascalCase/camelCase notation
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**)
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
|
||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
|
||||
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||
- **Animated 3D models** supported (skeletal bones animation)
|
||||
- **Animated 3D models** supported (skeletal bones animation) (IQM)
|
||||
- Shaders support, including model and **postprocessing** shaders.
|
||||
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
|
||||
- **VR stereo rendering** support with configurable HMD device parameters
|
||||
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
|
||||
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||
- Free and open source.
|
||||
- **Free and open source**.
|
||||
|
||||
raylib uses on its [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module the outstanding [GLFW3](http://www.glfw.org/) library, embedded in the form of [rglfw](https://github.com/raysan5/raylib/blob/master/src/rglfw.c) module, to avoid external dependencies.
|
||||
basic example
|
||||
--------------
|
||||
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||
```c
|
||||
#include "raylib.h"
|
||||
|
||||
raylib uses on its [raudio](https://github.com/raysan5/raylib/blob/master/src/raudio.c) module, the amazing [miniaudio](https://github.com/dr-soft/miniaudio) library to support multiple platforms and multiple audio backends.
|
||||
int main(void)
|
||||
{
|
||||
InitWindow(800, 450, "raylib [core] example - basic window");
|
||||
|
||||
raylib uses internally several single-file header-only libraries to support different fileformats loading and saving, all those libraries are embedded with raylib and available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib Wiki](https://github.com/raysan5/raylib/wiki/raylib-dependencies) for a detailed list.
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
*On Android platform, `native_app_glue` module (provided by Android NDK) and native Android libraries are used to manage window/context, inputs and activity life cycle.*
|
||||
CloseWindow();
|
||||
|
||||
*On Raspberry Pi 0,1,2,3 platform (native mode), `Videocore API` and `EGL` libraries are used for window/context management. Inputs are processed using `evdev` Linux libraries*
|
||||
|
||||
*On Raspberry Pi 4 platform (native mode), `DRM subsystem` and `GBM API` libraries are used for window/context management. Inputs are processed using `evdev` Linux libraries*
|
||||
|
||||
*On Web platform, raylib uses `emscripten` provided libraries for several input events management, specially noticeable the touch events support.*
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
build and installation
|
||||
----------------------
|
||||
|
||||
raylib binary releases for Windows, Linux and macOS are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||
raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||
|
||||
raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions.
|
||||
|
||||
#### Installing and building raylib via vcpkg
|
||||
|
||||
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install raylib
|
||||
|
||||
*The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.*
|
||||
|
||||
#### Building raylib on multiple platforms
|
||||
#### Installing and building raylib on multiple platforms
|
||||
|
||||
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
|
||||
|
||||
@@ -90,12 +94,11 @@ You can download and install raylib using the [vcpkg](https://github.com/Microso
|
||||
- [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi)
|
||||
- [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android)
|
||||
- [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5))
|
||||
- [Working for UWP (Universal Window Platform)](https://github.com/raysan5/raylib/wiki/Working-for-UWP)
|
||||
- [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake)
|
||||
|
||||
*Note that Wiki is open for edit, if you find some issue while building raylib for your target platform, feel free to edit the Wiki or open and issue related to it.*
|
||||
|
||||
#### Using raylib with multiple IDEs
|
||||
#### Setup raylib with multiple IDEs
|
||||
|
||||
raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](http://mingw-w64.org/doku.php) compiler but it can be used with other IDEs on multiple platforms.
|
||||
|
||||
@@ -103,20 +106,36 @@ raylib has been developed on Windows platform using [Notepad++](https://notepad-
|
||||
|
||||
*Note that there are lots of IDEs supported, some of the provided templates could require some review, please, if you find some issue with some template or you think they could be improved, feel free to send a PR or open a related issue.*
|
||||
|
||||
contact
|
||||
-------
|
||||
learning and docs
|
||||
------------------
|
||||
|
||||
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||
* Discord: [https://discord.gg/raylib](https://discord.gg/VkzNHUE)
|
||||
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
|
||||
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library and a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||
|
||||
If you are using raylib and enjoying it, please, join our [Discord server](https://discord.gg/VkzNHUE) and let us know! :)
|
||||
Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here the more relevant links:
|
||||
|
||||
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
|
||||
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
|
||||
- [raylib library design](https://github.com/raysan5/raylib/wiki)
|
||||
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples)
|
||||
- [raylib games collection](https://github.com/raysan5/raylib-games)
|
||||
|
||||
|
||||
contact and networks
|
||||
---------------------
|
||||
|
||||
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :)
|
||||
|
||||
- Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
||||
- Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||
- Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
|
||||
|
||||
license
|
||||
-------
|
||||
|
||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
|
||||
|
||||
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on raylib Wiki for details.
|
||||
|
30
ROADMAP.md
@@ -1,21 +1,33 @@
|
||||
roadmap
|
||||
-------
|
||||
# raylib roadmap
|
||||
|
||||
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are quite high-level and could be long term additions for the library. Current version of raylib is complete and functional but there is a lot of room for improvement.
|
||||
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements of ideas:
|
||||
|
||||
[raylib source code](https://github.com/raysan5/raylib/tree/master/src) has some *TODO* marks around code with pending things to review and improve. Check also [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
|
||||
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
|
||||
- [raylib wishlist](https://github.com/raysan5/raylib/discussions/1502) is open to everyone to ask for improvements, feel free to check and comment.
|
||||
|
||||
**raylib 3.x**
|
||||
- [ ] Network module (UDP): `rnet` ([info](https://github.com/raysan5/raylib/issues/753))
|
||||
- [ ] Custom raylib resource packer: `rres` ([info](https://github.com/raysan5/rres))
|
||||
- [ ] Basic CPU/GPU stats system (memory, draws, time...)
|
||||
_Current version of raylib is complete and functional but, as always, there is lot of room for improvement._
|
||||
|
||||
**raylib 4.x**
|
||||
- [ ] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143))
|
||||
- [ ] Redesign gestures system, improve touch inputs management
|
||||
- [ ] Better documentation and improved examples
|
||||
- [ ] Focus on HTML5 and embedded platforms
|
||||
- [ ] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)...
|
||||
|
||||
**raylib 4.0**
|
||||
- [x] Improved consistency and coherency in raylib API
|
||||
- [x] Continuous Deployment using GitHub Actions
|
||||
- [x] rlgl improvements for standalone usage (avoid raylib coupling)
|
||||
- Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295)) - _DISCARDED_
|
||||
- Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370)) - _DISCARDED_
|
||||
- Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - _DISCARDED_ - Use [nbnet](https://github.com/nathhB/nbnet).
|
||||
|
||||
**raylib 3.0**
|
||||
- [x] Custom memory allocators support
|
||||
- [x] Global variables moved to global context
|
||||
- [x] Optimize data structures for pass-by-value
|
||||
- [x] Trace log messages redesign ([info](https://github.com/raysan5/raylib/issues/1065))
|
||||
- [x] Trace log messages redesign ([#1065](https://github.com/raysan5/raylib/issues/1065))
|
||||
- [x] Continuous Integration using GitHub Actions
|
||||
|
||||
**raylib 2.5**
|
||||
|
75
SPONSORS.md
@@ -1,47 +1,68 @@
|
||||
The following people has contributed with a generous donation to the raylib project.
|
||||
## raylib GitHub Sponsors
|
||||
|
||||
## 🥇 Gold Contributors
|
||||
### Current raylib GitHub Sponsors (raylib 4.0 release)
|
||||
|
||||
...
|
||||
The following people are currently [**sponsoring raylib**](https://github.com/sponsors/raysan5) with a generous donation to allow improving and growing the project!
|
||||
|
||||
## 🥈 Silver Contributors
|
||||
|
||||
- Jonathan Johnson ([@ecton](https://github.com/ecton))
|
||||
- Eric J. ([@ProfJski](https://github.com/ProfJski))
|
||||
- Rudy Faile ([@rfaile313](https://github.com/rfaile313)) - https://rudyfaile.com/
|
||||
- devdad ([@devdad](https://github.com/devdad))
|
||||
- frithrah ([@frithrah](https://github.com/frithrah))
|
||||
- Zach Geis ([@zacgeis](https://github.com/zacgeis))
|
||||
|
||||
## 🥉 Bronze Contributors
|
||||
|
||||
- minirop ([@minirop](https://github.com/minirop))
|
||||
- Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies))
|
||||
- Sergio ([@anidealgift](https://github.com/anidealgift))
|
||||
- JFons ([@JFonS](https://github.com/JFonS))
|
||||
- Marc Agüera ([@maguera93](https://github.com/maguera93))
|
||||
- Pau Fernández ([@pauek](https://github.com/pauek))
|
||||
- Jens Pitkänen ([@neonmoe](https://github.com/neonmoe))
|
||||
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
|
||||
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
|
||||
- Robin Mattheussen ([@romatthe](https://github.com/romatthe))
|
||||
- Rahul Nair ([@rahulunair](https://github.com/rahulunair))
|
||||
- Grant Haywood ([@cinterloper](https://github.com/cinterloper))
|
||||
- Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte))
|
||||
- albatros-hmd ([@albatros-hmd](https://github.com/albatros-hmd))
|
||||
- Benjamin Stigsen ([@BenStigsen](https://github.com/BenStigsen))
|
||||
- Louis Johnson ([@louisgjohnson](https://github.com/louisgjohnson))
|
||||
- Dani Martin ([@danimartin82](https://github.com/danimartin82))
|
||||
- Tommi Sinivuo ([@TommiSinivuo](https://github.com/TommiSinivuo))
|
||||
- Joakim Wennergren ([@joakimwennergren](https://github.com/joakimwennergren))
|
||||
- Richard Urbanec ([@Poryg1](https://github.com/Poryg1))
|
||||
- pmgl ([@pmgl](https://github.com/pmgl))
|
||||
- cob ([@majorcob](https://github.com/majorcob))
|
||||
- Samuel Batista ([@gamedevsam](https://github.com/gamedevsam))
|
||||
- Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13))
|
||||
- linus ([@hochbaum](https://github.com/hochbaum))
|
||||
- Níckolas Daniel da Silva ([@nawarian](https://github.com/nawarian) - [thephp.website](https://thephp.website/))
|
||||
- kenzie ([@sme-ek](https://github.com/sme-ek))
|
||||
- Allan Regush ([@AllanRegush](https://github.com/AllanRegush))
|
||||
- Jeffery Myers ([@JeffM2501](https://github.com/ProfJski))
|
||||
- Ryan Roden-Corrent ([@rcorre](https://github.com/ProfJski))
|
||||
- michaelfiber ([@michaelfiber](https://github.com/ProfJski))
|
||||
- Nikhilesh S ([@nikki93](https://github.com/ProfJski))
|
||||
- kevinabraun ([@kevinabraun](https://github.com/ProfJski))
|
||||
- Matthew Owens ([@MatthewOwens](https://github.com/ProfJski))
|
||||
- Tim Eilers ([@eilerstim](https://github.com/ProfJski))
|
||||
|
||||
### Past raylib GitHub Sponsors
|
||||
|
||||
The following people has **sponsored raylib** in the past, allowing the project to reach current amazing state.
|
||||
|
||||
- Jonathan Johnson ([@ecton](https://github.com/ecton))
|
||||
- Rudy Faile ([@rfaile313](https://github.com/rfaile313)) - https://rudyfaile.com/
|
||||
- frithrah ([@frithrah](https://github.com/frithrah))
|
||||
- Jens Pitkänen ([@neonmoe](https://github.com/neonmoe))
|
||||
- Rahul Nair ([@rahulunair](https://github.com/rahulunair))
|
||||
- albatros-hmd ([@albatros-hmd](https://github.com/albatros-hmd))
|
||||
- Benjamin Stigsen ([@BenStigsen](https://github.com/BenStigsen))
|
||||
- Louis Johnson ([@louisgjohnson](https://github.com/louisgjohnson))
|
||||
- Dani Martin ([@danimartin82](https://github.com/danimartin82))
|
||||
- Joakim Wennergren ([@joakimwennergren](https://github.com/joakimwennergren))
|
||||
- Alexandre Chêne ([@kooparse](https://github.com/kooparse))
|
||||
- daddio69 ([@daddio69](https://github.com/daddio69))
|
||||
- James Ghawaly ([@jghawaly](https://github.com/jghawaly))
|
||||
- jack ([@Jack-Ji](https://github.com/Jack-Ji))
|
||||
- Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13))
|
||||
|
||||
|
||||
- Guido Offermans ([@jghawaly](https://github.com/GuidoOffermans))
|
||||
- devdad ([@devdad](https://github.com/devdad))
|
||||
- Pau Fernández ([@pauek](https://github.com/pauek))
|
||||
- Sergio ([@anidealgift](https://github.com/anidealgift))
|
||||
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
|
||||
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
|
||||
- Shylie ([@Shylie](https://github.com/Shylie))
|
||||
- Livio Dal Maso ([@Humeur](https://github.com/Humeur))
|
||||
- Diego Vaccher ([@denny0754](https://github.com/denny0754))
|
||||
- Ricardo Alcantara ([@ricardoalcantara](https://github.com/ricardoalcantara))
|
||||
- Toby4213 ([@Toby4213](https://github.com/Toby4213))
|
||||
|
||||
### Notes for Current/Past raylib Sponsor
|
||||
|
||||
- If you are not on the list, feel free to send a PR to be added (if desired).
|
||||
- If you want your personal webpage or project listed, feel free to send a PR to be added.
|
||||
- If you prefer not to be in this list, feel free to send a PR to be remove.
|
||||
|
||||
|
18
cmake/BuildOptions.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
if(${PLATFORM} MATCHES "Desktop" AND APPLE)
|
||||
if(MACOS_FATLIB)
|
||||
if (CMAKE_OSX_ARCHITECTURES)
|
||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# This helps support the case where emsdk toolchain file is used
|
||||
# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
||||
# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
|
||||
if(EMSCRIPTEN)
|
||||
SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
|
||||
endif()
|
||||
|
||||
# vim: ft=cmake
|
@@ -1,43 +0,0 @@
|
||||
# Set a default build type if none was specified
|
||||
set(default_build_type "Release")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
set(default_build_type "Debug")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||
STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||
"MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
# Taken from the https://github.com/OpenChemistry/tomviz project
|
||||
# Copyright (c) 2014-2017, Kitware, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
110
cmake/CompileDefinitions.cmake
Normal file
@@ -0,0 +1,110 @@
|
||||
# Adding compile definitions
|
||||
target_compile_definitions("raylib" PUBLIC "${PLATFORM_CPP}")
|
||||
target_compile_definitions("raylib" PUBLIC "${GRAPHICS}")
|
||||
|
||||
function(define_if target variable)
|
||||
if (${${variable}})
|
||||
target_compile_definitions(${target} PUBLIC "${variable}")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
if (${CUSTOMIZE_BUILD})
|
||||
target_compile_definitions("raylib" PUBLIC EXTERNAL_CONFIG_FLAGS)
|
||||
define_if("raylib" SUPPORT_CAMERA_SYSTEM)
|
||||
define_if("raylib" SUPPORT_GESTURES_SYSTEM)
|
||||
define_if("raylib" SUPPORT_MOUSE_GESTURES)
|
||||
define_if("raylib" SUPPORT_SSH_KEYBOARD_RPI)
|
||||
define_if("raylib" SUPPORT_BUSY_WAIT_LOOP)
|
||||
define_if("raylib" SUPPORT_EVENTS_WAITING)
|
||||
define_if("raylib" SUPPORT_SCREEN_CAPTURE)
|
||||
define_if("raylib" SUPPORT_GIF_RECORDING)
|
||||
define_if("raylib" SUPPORT_HIGH_DPI)
|
||||
define_if("raylib" SUPPORT_COMPRESSION_API)
|
||||
define_if("raylib" SUPPORT_DATA_STORAGE)
|
||||
define_if("raylib" SUPPORT_VR_SIMULATOR)
|
||||
define_if("raylib" SUPPORT_FONT_TEXTURE)
|
||||
define_if("raylib" SUPPORT_QUADS_DRAW_MODE)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_PNG)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_DDS)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_HDR)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_KTX)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_ASTC)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_BMP)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_TGA)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_JPG)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_GIF)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_PSD)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_PKM)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_PVR)
|
||||
define_if("raylib" ORT_IMAGE_EXPORT)
|
||||
define_if("raylib" SUPPORT_IMAGE_MANIPULATION)
|
||||
define_if("raylib" SUPPORT_IMAGE_GENERATION)
|
||||
define_if("raylib" SUPPORT_DEFAULT_FONT)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_FNT)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_TTF)
|
||||
define_if("raylib" SUPPORT_TEXT_MANIPULATION)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_OBJ)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_MTL)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_IQM)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_GLTF)
|
||||
define_if("raylib" SUPPORT_MESH_GENERATION)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_WAV)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_OGG)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_XM)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_MOD)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_FLAC)
|
||||
define_if("raylib" SUPPORT_FILEFORMAT_MP3)
|
||||
define_if("raylib" SUPPORT_STANDARD_FILEIO)
|
||||
define_if("raylib" SUPPORT_TRACELOG)
|
||||
define_if("raylib" SUPPORT_COMPRESSION_API)
|
||||
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=4096")
|
||||
else ()
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_FILEPATH_LENGTH=512")
|
||||
endif ()
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPADS=4")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_AXIS=8")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_GAMEPAD_BUTTONS=32")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_TOUCH_POINTS=10")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "STORAGE_DATA_FILE=\"storage.data\"")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_KEY_PRESSED_QUEUE=16")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_DECOMPRESSION_SIZE=64")
|
||||
|
||||
if (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_33" OR ${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_11")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=8192")
|
||||
elseif (${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES2")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_BUFFER_ELEMENTS=2048")
|
||||
endif ()
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_BATCH_DRAWCALLS=256")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_MATRIX_STACK_SIZE=32")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_SHADER_LOCATIONS=32")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_MATERIAL_MAPS=12")
|
||||
target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_NEAR=0.01")
|
||||
target_compile_definitions("raylib" PUBLIC "RL_CULL_DISTANCE_FAR=1000.0")
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_POSITION=\"vertexPosition\"")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD=\"vertexTexCoord\"")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_NORMAL=\"vertexNormal\"")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_COLOR=\"vertexColor\"")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TANGENT=\"vertexTangent\"")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2=\"vertexTexCoord2\"")
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_TEXT_BUFFER_LENGTH=1024")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_TEXT_UNICODE_CHARS=512")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_TEXTSPLIT_COUNT=128")
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_FORMAT=ma_format_f32")
|
||||
target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_CHANNELS=2")
|
||||
target_compile_definitions("raylib" PUBLIC "AUDIO_DEVICE_SAMPLE_RATE=44100")
|
||||
target_compile_definitions("raylib" PUBLIC "DEFAULT_AUDIO_BUFFER_SIZE=4096")
|
||||
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_TRACELOG_MSG_LENGTH=128")
|
||||
target_compile_definitions("raylib" PUBLIC "MAX_UWP_MESSAGES=512")
|
||||
endif ()
|
||||
|
79
cmake/CompilerFlags.cmake
Normal file
@@ -0,0 +1,79 @@
|
||||
include(AddIfFlagCompiles)
|
||||
|
||||
# Makes +/- operations on void pointers be considered an error
|
||||
# https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
|
||||
add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
|
||||
|
||||
# Generates error whenever a function is used before being declared
|
||||
# https://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Warning-Options.html
|
||||
add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
||||
|
||||
# Allows some casting of pointers without generating a warning
|
||||
add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)
|
||||
|
||||
if (ENABLE_MSAN AND ENABLE_ASAN)
|
||||
# MSAN and ASAN both work on memory - ASAN does more things
|
||||
MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
|
||||
endif()
|
||||
|
||||
if (ENABLE_ASAN)
|
||||
|
||||
# If enabled it would generate errors/warnings for all kinds of memory errors
|
||||
# (like returning a stack variable by reference)
|
||||
# https://clang.llvm.org/docs/AddressSanitizer.html
|
||||
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
|
||||
endif()
|
||||
|
||||
if (ENABLE_UBSAN)
|
||||
|
||||
# If enabled this will generate errors for undefined behavior points
|
||||
# (like adding +1 to the maximum int value)
|
||||
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
|
||||
endif()
|
||||
|
||||
if (ENABLE_MSAN)
|
||||
|
||||
# If enabled this will generate warnings for places where uninitialized memory is used
|
||||
# https://clang.llvm.org/docs/MemorySanitizer.html
|
||||
|
||||
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
add_if_flag_compiles(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
add_if_flag_compiles(-std=gnu99 CMAKE_C_FLAGS)
|
||||
endif()
|
||||
else()
|
||||
set (CMAKE_C_STANDARD 99)
|
||||
endif()
|
||||
|
||||
if(${PLATFORM} MATCHES "Android")
|
||||
|
||||
# If enabled will remove dead code during the linking process
|
||||
# https://gcc.gnu.org/onlinedocs/gnat_ugn/Compilation-options.html
|
||||
add_if_flag_compiles(-ffunction-sections CMAKE_C_FLAGS)
|
||||
|
||||
# If enabled will generate some exception data (usually disabled for C programs)
|
||||
# https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Code-Gen-Options.html
|
||||
add_if_flag_compiles(-funwind-tables CMAKE_C_FLAGS)
|
||||
|
||||
# If enabled adds stack protection guards around functions that allocate memory
|
||||
# https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_cjh1548250046139.htm
|
||||
add_if_flag_compiles(-fstack-protector-strong CMAKE_C_FLAGS)
|
||||
|
||||
# Marks that the library will not be compiled with an executable stack
|
||||
add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS)
|
||||
|
||||
# Do not expand symbolic links or resolve paths like "/./" or "/../", etc.
|
||||
# https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
|
||||
add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS)
|
||||
endif()
|
34
cmake/GlfwImport.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
||||
find_package(glfw3 3.3.3 REQUIRED)
|
||||
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
||||
find_package(glfw3 3.3.3 QUIET)
|
||||
endif()
|
||||
if (glfw3_FOUND)
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||
endif()
|
||||
|
||||
# Explicitly check against "ON", because USE_EXTERNAL_GLFW is a tristate option
|
||||
# Also adding only on desktop (web also uses glfw but it is more limited and is added using an emcc linker flag)
|
||||
if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
|
||||
MESSAGE(STATUS "Using raylib's GLFW")
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_USE_WAYLAND ${USE_WAYLAND} CACHE BOOL "" FORCE)
|
||||
|
||||
set(WAS_SHARED ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
|
||||
|
||||
add_subdirectory(external/glfw)
|
||||
|
||||
set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
|
||||
unset(WAS_SHARED)
|
||||
|
||||
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
|
||||
include_directories(BEFORE SYSTEM external/glfw/include)
|
||||
else()
|
||||
MESSAGE(STATUS "Using external GLFW")
|
||||
set(GLFW_PKG_DEPS glfw3)
|
||||
endif()
|
29
cmake/InstallConfigurations.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
install(
|
||||
TARGETS raylib EXPORT raylib-targets
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
# PKG_CONFIG_LIBS_PRIVATE is used in raylib.pc.in
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
include(LibraryPathToLinkerFlags)
|
||||
library_path_to_linker_flags(__PKG_CONFIG_LIBS_PRIVATE "${LIBS_PRIVATE}")
|
||||
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
|
||||
string(REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
||||
elseif (BUILD_SHARED_LIBS)
|
||||
set(PKG_CONFIG_LIBS_EXTRA "")
|
||||
endif ()
|
||||
|
||||
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
configure_file(../raylib.pc.in raylib.pc @ONLY)
|
||||
configure_file(../cmake/raylib-config-version.cmake raylib-config-version.cmake @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/raylib-config-version.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/../cmake/raylib-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/raylib")
|
||||
|
||||
# populates raylib_{FOUND, INCLUDE_DIRS, LIBRARIES, LDFLAGS, DEFINITIONS}
|
||||
include(PopulateConfigVariablesLocally)
|
||||
populate_config_variables_locally(raylib)
|
108
cmake/LibraryConfigurations.cmake
Normal file
@@ -0,0 +1,108 @@
|
||||
if (${PLATFORM} MATCHES "Desktop")
|
||||
set(PLATFORM_CPP "PLATFORM_DESKTOP")
|
||||
|
||||
if (APPLE)
|
||||
# Need to force OpenGL 3.3 on OS X
|
||||
# See: https://github.com/raysan5/raylib/issues/341
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||
link_libraries("${LIBS_PRIVATE}")
|
||||
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||
endif ()
|
||||
elseif (WIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
find_package(OpenGL QUIET)
|
||||
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
||||
else ()
|
||||
find_library(pthread NAMES pthread)
|
||||
find_package(OpenGL QUIET)
|
||||
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||
set(OPENGL_LIBRARIES "GL")
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||
find_library(OSS_LIBRARY ossaudio)
|
||||
endif ()
|
||||
|
||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||
endif ()
|
||||
|
||||
elseif (${PLATFORM} MATCHES "Web")
|
||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 --profiling")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
|
||||
elseif (${PLATFORM} MATCHES "Android")
|
||||
set(PLATFORM_CPP "PLATFORM_ANDROID")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
add_definitions(-DANDROID -D__ANDROID_API__=21)
|
||||
include_directories(external/android/native_app_glue)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate")
|
||||
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||
|
||||
elseif (${PLATFORM} MATCHES "Raspberry Pi")
|
||||
set(PLATFORM_CPP "PLATFORM_RPI")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
|
||||
add_definitions(-D_DEFAULT_SOURCE)
|
||||
|
||||
find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
|
||||
find_library(EGL brcmEGL HINTS /opt/vc/lib)
|
||||
find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
|
||||
include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
|
||||
link_directories(/opt/vc/lib)
|
||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
|
||||
|
||||
elseif (${PLATFORM} MATCHES "DRM")
|
||||
set(PLATFORM_CPP "PLATFORM_DRM")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
|
||||
add_definitions(-D_DEFAULT_SOURCE)
|
||||
add_definitions(-DEGL_NO_X11)
|
||||
add_definitions(-DPLATFORM_DRM)
|
||||
|
||||
find_library(GLESV2 GLESv2)
|
||||
find_library(EGL EGL)
|
||||
find_library(DRM drm)
|
||||
find_library(GBM gbm)
|
||||
|
||||
if (NOT CMAKE_CROSSCOMPILING)
|
||||
include_directories(/usr/include/libdrm)
|
||||
endif ()
|
||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} pthread m dl)
|
||||
|
||||
endif ()
|
||||
|
||||
if (${OPENGL_VERSION})
|
||||
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
|
||||
if (${OPENGL_VERSION} MATCHES "3.3")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
elseif (${OPENGL_VERSION} MATCHES "2.1")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_21")
|
||||
elseif (${OPENGL_VERSION} MATCHES "1.1")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_11")
|
||||
elseif (${OPENGL_VERSION} MATCHES "ES 2.0")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
endif ()
|
||||
if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
||||
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT GRAPHICS)
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||
endif ()
|
||||
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
|
||||
|
||||
if (${PLATFORM} MATCHES "Desktop")
|
||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||
endif ()
|
13
cmake/PackConfigurations.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
# Packaging
|
||||
SET(CPACK_PACKAGE_NAME "raylib")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple and easy-to-use library to enjoy videogames programming")
|
||||
SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README.md")
|
||||
SET(CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/../README.md")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "raylib-${PROJECT_VERSION}$ENV{RAYLIB_PACKAGE_SUFFIX}")
|
||||
SET(CPACK_GENERATOR "ZIP;TGZ") # Remove this, if you want the NSIS installer on Windows
|
||||
include(CPack)
|
@@ -1,23 +0,0 @@
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR x86)
|
||||
|
||||
if (CMAKE_HOST_WIN32)
|
||||
SET(EMSCRIPTEN_EXTENSION ".bat")
|
||||
else ()
|
||||
SET(EMSCRIPTEN_EXTENSION "")
|
||||
endif()
|
||||
|
||||
SET(CMAKE_C_COMPILER emcc${EMSCRIPTEN_EXTENSION})
|
||||
SET(CMAKE_CXX_COMPILER em++${EMSCRIPTEN_EXTENSION})
|
||||
|
||||
if(NOT DEFINED CMAKE_AR)
|
||||
find_program(CMAKE_AR NAMES emar${EMSCRIPTEN_EXTENSION})
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_RANLIB)
|
||||
find_program(CMAKE_RANLIB NAMES emranlib${EMSCRIPTEN_EXTENSION})
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Test if including/linking/running an installed raylib works
|
||||
|
||||
set -x
|
||||
export LD_RUN_PATH=/usr/local/lib
|
||||
|
||||
CFLAGS="-Wall -Wextra -Werror $CFLAGS"
|
||||
if [ "$ARCH" = "i386" ]; then
|
||||
CFLAGS="-m32 $CLFAGS"
|
||||
fi
|
||||
|
||||
cat << EOF | ${CC:-cc} -otest -xc - $(pkg-config --libs --cflags $@ raylib.pc) $CFLAGS && exec ./test
|
||||
#include <stdlib.h>
|
||||
#include <raylib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int num = GetRandomValue(42, 1337);
|
||||
return 42 <= num && num <= 1337 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
EOF
|
@@ -1,137 +1,139 @@
|
||||
# Setup the project and settings
|
||||
project(examples)
|
||||
|
||||
# Get the sources together
|
||||
set(example_dirs audio core models others shaders shapes text textures)
|
||||
# Directories that contain examples
|
||||
set(example_dirs
|
||||
audio
|
||||
core
|
||||
models
|
||||
others
|
||||
shaders
|
||||
shapes
|
||||
text
|
||||
textures
|
||||
)
|
||||
|
||||
# Next few lines will check for existence of symbols or header files
|
||||
# They are needed for the physac example and threads examples
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=199309L)
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
|
||||
check_symbol_exists(QueryPerformanceCounter windows.h HAVE_QPC)
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
|
||||
check_symbol_exists(QueryPerformanceCounter windows.h HAVE_QPC)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS)
|
||||
if(HAVE_QPC OR HAVE_CLOCK_MONOTONIC)
|
||||
set(example_dirs ${example_dirs} physac)
|
||||
endif()
|
||||
|
||||
set(example_sources)
|
||||
set(example_resources)
|
||||
foreach(example_dir ${example_dirs})
|
||||
# Get the .c files
|
||||
file(GLOB sources ${example_dir}/*.c)
|
||||
list(APPEND example_sources ${sources})
|
||||
|
||||
# Any any resources
|
||||
file(GLOB resources ${example_dir}/resources/*)
|
||||
list(APPEND example_resources ${resources})
|
||||
endforeach()
|
||||
|
||||
if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||
endif()
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
if (HAVE_QPC OR HAVE_CLOCK_MONOTONIC)
|
||||
set(example_dirs ${example_dirs} physac)
|
||||
endif ()
|
||||
|
||||
include(CheckIncludeFile)
|
||||
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package(Threads)
|
||||
if (CMAKE_USE_PTHREADS_INIT AND HAVE_STDATOMIC_H)
|
||||
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS)
|
||||
if(THREADS_HAVE_PTHREAD_ARG)
|
||||
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS)
|
||||
endif()
|
||||
if(CMAKE_THREAD_LIBS_INIT)
|
||||
link_libraries("${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif()
|
||||
else()
|
||||
# Items requiring pthreads
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_loading_thread.c)
|
||||
endif()
|
||||
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS)
|
||||
if (THREADS_HAVE_PTHREAD_ARG)
|
||||
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS)
|
||||
endif ()
|
||||
if (CMAKE_THREAD_LIBS_INIT)
|
||||
link_libraries("${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||
endif ()
|
||||
|
||||
if(${PLATFORM} MATCHES "Android")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_first_person.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
|
||||
# Collect all source files and resource files
|
||||
# into a CMake variable
|
||||
set(example_sources)
|
||||
set(example_resources)
|
||||
foreach (example_dir ${example_dirs})
|
||||
# Get the .c files
|
||||
file(GLOB sources ${example_dir}/*.c)
|
||||
list(APPEND example_sources ${sources})
|
||||
|
||||
# Any any resources
|
||||
file(GLOB resources ${example_dir}/resources/*)
|
||||
list(APPEND example_resources ${resources})
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_generation.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_heightmap.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_billboard.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_full_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT OR NOT HAVE_STDATOMIC_H)
|
||||
# Items requiring pthreads
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_loading_thread.c)
|
||||
endif ()
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_raymarching.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_palette_switch.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
||||
if (${PLATFORM} MATCHES "Android")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_first_person.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_generation.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_heightmap.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_billboard.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_full_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_solar_system.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
|
||||
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_raymarching.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_palette_switch.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
||||
|
||||
elseif(${PLATFORM} MATCHES "Web")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
|
||||
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
|
||||
# Remove the -rdynamic flag because otherwise emscripten
|
||||
# does not generate HTML+JS+WASM files, only a non-working
|
||||
# and fat HTML
|
||||
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
|
||||
endif()
|
||||
elseif (${PLATFORM} MATCHES "Web")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
|
||||
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
|
||||
# Remove the -rdynamic flag because otherwise emscripten
|
||||
# does not generate HTML+JS+WASM files, only a non-working
|
||||
# and fat HTML
|
||||
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
|
||||
endif ()
|
||||
|
||||
include_directories(BEFORE SYSTEM others/external/include)
|
||||
|
||||
if (NOT TARGET raylib)
|
||||
find_package(raylib 2.0 REQUIRED)
|
||||
endif()
|
||||
find_package(raylib 2.0 REQUIRED)
|
||||
endif ()
|
||||
|
||||
# Do each example
|
||||
foreach(example_source ${example_sources})
|
||||
# Create the basename for the example
|
||||
get_filename_component(example_name ${example_source} NAME)
|
||||
string(REPLACE ".c" "" example_name ${example_name})
|
||||
|
||||
# Setup the example
|
||||
add_executable(${example_name} ${example_source})
|
||||
|
||||
target_link_libraries(${example_name} raylib)
|
||||
|
||||
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
|
||||
string(APPEND resources_dir "resources")
|
||||
|
||||
if(${PLATFORM} MATCHES "Web" AND EXISTS ${resources_dir})
|
||||
# The local resources path needs to be mapped to /resources virtual path
|
||||
string(APPEND resources_dir "@resources")
|
||||
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (${PLATFORM} MATCHES "Desktop")
|
||||
# rlgl_standalone can't be linked with raylib because of duplicate rlgl symbols
|
||||
foreach (example_source "others/rlgl_standalone.c")
|
||||
foreach (example_source ${example_sources})
|
||||
# Create the basename for the example
|
||||
get_filename_component(example_name ${example_source} NAME)
|
||||
string(REPLACE ".c" "" example_name ${example_name})
|
||||
|
||||
# Setup the example
|
||||
add_executable(${example_name} ${example_source})
|
||||
add_dependencies(${example_name} raylib)
|
||||
target_link_libraries(${example_name} ${raylib_LDFLAGS})
|
||||
target_include_directories(${example_name} PRIVATE ${raylib_INCLUDE_DIRS})
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
target_link_libraries(${example_name} raylib)
|
||||
|
||||
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
|
||||
string(APPEND resources_dir "resources")
|
||||
|
||||
if (${PLATFORM} MATCHES "Web" AND EXISTS ${resources_dir})
|
||||
# The local resources path needs to be mapped to /resources virtual path
|
||||
string(APPEND resources_dir "@resources")
|
||||
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Copy all of the resource files to the destination
|
||||
file(COPY ${example_resources} DESTINATION "resources/")
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||
#
|
||||
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2013-2021 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
# Define required raylib variables
|
||||
PROJECT_NAME ?= raylib_examples
|
||||
RAYLIB_VERSION ?= 3.5.0
|
||||
RAYLIB_VERSION ?= 4.0.0
|
||||
RAYLIB_PATH ?= ..
|
||||
|
||||
# Define default options
|
||||
@@ -126,8 +126,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
EMSDK_PATH ?= C:/emsdk
|
||||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4-pywin32_64bit
|
||||
NODE_PATH = $(EMSDK_PATH)/node/12.18.1_64bit/bin
|
||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
|
||||
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
|
||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||
endif
|
||||
|
||||
@@ -177,17 +177,20 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
CC = emcc
|
||||
endif
|
||||
|
||||
# Define default make program: Mingw32-make
|
||||
MAKE = mingw32-make
|
||||
# Define default make program
|
||||
MAKE = make
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
MAKE = make
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),OSX)
|
||||
MAKE = make
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
|
||||
# Define compiler flags:
|
||||
# -O1 defines optimization level
|
||||
@@ -198,7 +201,7 @@ endif
|
||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
||||
|
||||
ifeq ($(BUILD_MODE),DEBUG)
|
||||
CFLAGS += -g
|
||||
@@ -232,36 +235,10 @@ endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
||||
# -s USE_PTHREADS=1 # multithreading support
|
||||
# -s WASM=0 # disable Web Assembly, emitted by default
|
||||
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
||||
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||
# --profiling # include information for code profiling
|
||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
CFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 $(dir $<)resources@resources
|
||||
|
||||
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
|
||||
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
||||
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
|
||||
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
||||
|
||||
# Define a custom shell .html and output extension
|
||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||
EXT = .html
|
||||
endif
|
||||
|
||||
# Define include paths for required headers
|
||||
# NOTE: Several external required libraries (stb and others)
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
||||
# NOTE: Some external/extras libraries could be required (stb, physac, easings...)
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
|
||||
|
||||
# Define additional directories containing required header files
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
@@ -280,7 +257,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
INCLUDE_PATHS += -I/usr/local/include
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
||||
INCLUDE_PATHS += -I$(RAYLIB_H_INSTALL_PATH)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -306,15 +283,36 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
|
||||
# -s USE_PTHREADS=1 # multithreading support
|
||||
# -s WASM=0 # disable Web Assembly, emitted by default
|
||||
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
||||
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||
# --profiling # include information for code profiling
|
||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources
|
||||
|
||||
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
|
||||
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
||||
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
|
||||
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
||||
|
||||
# Define a custom shell .html and output extension
|
||||
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||
EXT = .html
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDFLAGS += -L/opt/vc/lib
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
LDFLAGS += -lGLESv2 -lEGL -ldrm -lgbm
|
||||
endif
|
||||
|
||||
# Define any libraries required on linking
|
||||
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
@@ -380,6 +378,7 @@ endif
|
||||
# Define all object files required
|
||||
CORE = \
|
||||
core/core_basic_window \
|
||||
core/core_basic_screen_manager \
|
||||
core/core_input_keys \
|
||||
core/core_input_mouse \
|
||||
core/core_input_mouse_wheel \
|
||||
@@ -402,7 +401,10 @@ CORE = \
|
||||
core/core_vr_simulator \
|
||||
core/core_loading_thread \
|
||||
core/core_quat_conversion \
|
||||
core/core_window_flags
|
||||
core/core_window_flags \
|
||||
core/core_split_screen \
|
||||
core/core_smooth_pixelperfect \
|
||||
core/core_custom_frame_control
|
||||
|
||||
SHAPES = \
|
||||
shapes/shapes_basic_shapes \
|
||||
@@ -440,7 +442,8 @@ TEXTURES = \
|
||||
textures/textures_sprite_explosion \
|
||||
textures/textures_bunnymark \
|
||||
textures/textures_blend_modes \
|
||||
textures/textures_draw_tiled
|
||||
textures/textures_draw_tiled \
|
||||
textures/textures_polygon
|
||||
|
||||
TEXT = \
|
||||
text/text_raylib_fonts \
|
||||
@@ -452,7 +455,8 @@ TEXT = \
|
||||
text/text_input_box \
|
||||
text/text_writing_anim \
|
||||
text/text_rectangle_bounds \
|
||||
text/text_unicode
|
||||
text/text_unicode \
|
||||
text/text_draw_3d
|
||||
|
||||
MODELS = \
|
||||
models/models_animation \
|
||||
@@ -461,10 +465,11 @@ MODELS = \
|
||||
models/models_cubicmap \
|
||||
models/models_first_person_maze \
|
||||
models/models_geometric_shapes \
|
||||
models/models_material_pbr \
|
||||
models/models_mesh_generation \
|
||||
models/models_mesh_picking \
|
||||
models/models_loading \
|
||||
models/models_loading_vox \
|
||||
models/models_loading_gltf \
|
||||
models/models_orthographic_projection \
|
||||
models/models_rlgl_solar_system \
|
||||
models/models_skybox \
|
||||
@@ -481,6 +486,7 @@ SHADERS = \
|
||||
shaders/shaders_raymarching \
|
||||
shaders/shaders_texture_drawing \
|
||||
shaders/shaders_texture_waves \
|
||||
shaders/shaders_texture_outline \
|
||||
shaders/shaders_julia_set \
|
||||
shaders/shaders_eratosthenes \
|
||||
shaders/shaders_basic_lighting \
|
||||
@@ -488,7 +494,7 @@ SHADERS = \
|
||||
shaders/shaders_simple_mask \
|
||||
shaders/shaders_spotlight \
|
||||
shaders/shaders_hot_reloading \
|
||||
shaders/shaders_rlgl_mesh_instanced \
|
||||
shaders/shaders_mesh_instancing \
|
||||
shaders/shaders_multi_sample2d
|
||||
|
||||
AUDIO = \
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# raylib makefile for Android project (APK building)
|
||||
#
|
||||
# Copyright (c) 2017-2020 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2017-2021 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -42,56 +42,64 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(ANDROID_ARCH),ARM)
|
||||
ANDROID_ARCH_NAME = armeabi-v7a
|
||||
ANDROID_ARCH_NAME = armeabi-v7a
|
||||
endif
|
||||
ifeq ($(ANDROID_ARCH),ARM64)
|
||||
ANDROID_ARCH_NAME = arm64-v8a
|
||||
ANDROID_ARCH_NAME = arm64-v8a
|
||||
endif
|
||||
ifeq ($(ANDROID_ARCH),x86)
|
||||
ANDROID_ARCH_NAME = i686
|
||||
ANDROID_ARCH_NAME = i686
|
||||
endif
|
||||
ifeq ($(ANDROID_ARCH),x86_64)
|
||||
ANDROID_ARCH_NAME = x86_64
|
||||
ANDROID_ARCH_NAME = x86_64
|
||||
endif
|
||||
|
||||
# Required path variables
|
||||
# NOTE: JAVA_HOME must be set to JDK (using OpenJDK 13)
|
||||
JAVA_HOME ?= C:/open-jdk
|
||||
ANDROID_HOME = C:/android-sdk
|
||||
ANDROID_TOOLCHAIN = C:/android-ndk/toolchains/llvm/prebuilt/windows-x86_64
|
||||
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/29.0.3
|
||||
ANDROID_HOME ?= C:/android-sdk
|
||||
ANDROID_BUILD_TOOLS ?= $(ANDROID_HOME)/build-tools/29.0.3
|
||||
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
|
||||
|
||||
# Android project configuration variables
|
||||
PROJECT_NAME ?= raylib_game
|
||||
PROJECT_LIBRARY_NAME ?= main
|
||||
PROJECT_BUILD_PATH ?= android.$(PROJECT_NAME)
|
||||
PROJECT_BUILD_ID ?= android
|
||||
PROJECT_BUILD_PATH ?= $(PROJECT_BUILD_ID).$(PROJECT_NAME)
|
||||
PROJECT_RESOURCES_PATH ?= resources
|
||||
PROJECT_SOURCE_FILES ?= raylib_game.c
|
||||
NATIVE_APP_GLUE_PATH = $(ANDROID_NDK)/sources/android/native_app_glue
|
||||
|
||||
# Some source files are placed in directories, when compiling to some
|
||||
# output directory other than source, that directory must pre-exist.
|
||||
# Here we get a list of required folders that need to be created on
|
||||
# code output folder $(PROJECT_BUILD_PATH)\obj to avoid GCC errors.
|
||||
PROJECT_SOURCE_DIRS = $(sort $(dir $(PROJECT_SOURCE_FILES)))
|
||||
PROJECT_SOURCE_DIRS = $(sort $(dir $(PROJECT_SOURCE_FILES)))
|
||||
|
||||
# Android app configuration variables
|
||||
APP_LABEL_NAME ?= rGame
|
||||
APP_COMPANY_NAME ?= raylib
|
||||
APP_PRODUCT_NAME ?= rgame
|
||||
APP_VERSION_CODE ?= 1
|
||||
APP_VERSION_NAME ?= 1.0
|
||||
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
|
||||
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
|
||||
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
|
||||
APP_LABEL_NAME ?= rGame
|
||||
APP_COMPANY_NAME ?= raylib
|
||||
APP_PRODUCT_NAME ?= rgame
|
||||
APP_VERSION_CODE ?= 1
|
||||
APP_VERSION_NAME ?= 1.0
|
||||
APP_ICON_LDPI ?= $(RAYLIB_PATH)/logo/raylib_36x36.png
|
||||
APP_ICON_MDPI ?= $(RAYLIB_PATH)/logo/raylib_48x48.png
|
||||
APP_ICON_HDPI ?= $(RAYLIB_PATH)/logo/raylib_72x72.png
|
||||
APP_SCREEN_ORIENTATION ?= landscape
|
||||
APP_KEYSTORE_PASS ?= raylib
|
||||
APP_KEYSTORE_PASS ?= raylib
|
||||
|
||||
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
||||
RAYLIB_LIBTYPE ?= STATIC
|
||||
RAYLIB_LIBTYPE ?= STATIC
|
||||
|
||||
# Library path for libraylib.a/libraylib.so
|
||||
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\src
|
||||
RAYLIB_LIB_PATH = $(RAYLIB_PATH)/src
|
||||
|
||||
# Define copy command depending on OS
|
||||
ifeq ($(OS),Windows_NT)
|
||||
COPY_COMMAND ?= copy /Y
|
||||
else
|
||||
COPY_COMMAND ?= cp -f
|
||||
endif
|
||||
|
||||
# Shared libs must be added to APK if required
|
||||
# NOTE: Generated NativeLoader.java automatically load those libraries
|
||||
@@ -108,6 +116,14 @@ ifeq ($(ANDROID_ARCH),ARM64)
|
||||
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android$(ANDROID_API_VERSION)-clang
|
||||
AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar
|
||||
endif
|
||||
ifeq ($(ANDROID_ARCH),x86)
|
||||
CC = $(ANDROID_TOOLCHAIN)/bin/i686-linux-android$(ANDROID_API_VERSION)-clang
|
||||
AR = $(ANDROID_TOOLCHAIN)/bin/i686-linux-android-ar
|
||||
endif
|
||||
ifeq ($(ANDROID_ARCH),x86_64)
|
||||
CC = $(ANDROID_TOOLCHAIN)/bin/x86_64-linux-android$(ANDROID_API_VERSION)-clang
|
||||
AR = $(ANDROID_TOOLCHAIN)/bin/x86_64-linux-android-ar
|
||||
endif
|
||||
|
||||
# Compiler flags for arquitecture
|
||||
ifeq ($(ANDROID_ARCH),ARM)
|
||||
@@ -124,7 +140,7 @@ CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical
|
||||
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION)
|
||||
|
||||
# Paths containing required header files
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external/android/native_app_glue
|
||||
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(NATIVE_APP_GLUE_PATH)
|
||||
|
||||
# Linker options
|
||||
LDFLAGS = -Wl,-soname,lib$(PROJECT_LIBRARY_NAME).so -Wl,--exclude-libs,libatomic.a
|
||||
@@ -154,13 +170,15 @@ all: create_temp_project_dirs \
|
||||
compile_project_class \
|
||||
compile_project_class_dex \
|
||||
create_project_apk_package \
|
||||
sign_project_apk_package \
|
||||
zipalign_project_apk_package
|
||||
zipalign_project_apk_package \
|
||||
sign_project_apk_package
|
||||
|
||||
# Create required temp directories for APK building
|
||||
create_temp_project_dirs:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
if not exist $(PROJECT_BUILD_PATH) mkdir $(PROJECT_BUILD_PATH)
|
||||
if not exist $(PROJECT_BUILD_PATH)\obj mkdir $(PROJECT_BUILD_PATH)\obj
|
||||
if not exist $(PROJECT_BUILD_PATH)\obj mkdir $(PROJECT_BUILD_PATH)\obj\src
|
||||
if not exist $(PROJECT_BUILD_PATH)\src mkdir $(PROJECT_BUILD_PATH)\src
|
||||
if not exist $(PROJECT_BUILD_PATH)\src\com mkdir $(PROJECT_BUILD_PATH)\src\com
|
||||
if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)
|
||||
@@ -176,36 +194,62 @@ create_temp_project_dirs:
|
||||
if not exist $(PROJECT_BUILD_PATH)\assets mkdir $(PROJECT_BUILD_PATH)\assets
|
||||
if not exist $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) mkdir $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH)
|
||||
if not exist $(PROJECT_BUILD_PATH)\obj\screens mkdir $(PROJECT_BUILD_PATH)\obj\screens
|
||||
else
|
||||
mkdir -p $(PROJECT_BUILD_PATH)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/obj
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/obj/src
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/src
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/src/com
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/lib
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/bin
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/res
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/res/drawable-ldpi
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/res/drawable-mdpi
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/res/drawable-hdpi
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/res/values
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/assets
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/assets/$(PROJECT_RESOURCES_PATH)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/obj/screens
|
||||
endif
|
||||
$(foreach dir, $(PROJECT_SOURCE_DIRS), $(call create_dir, $(dir)))
|
||||
|
||||
define create_dir
|
||||
if not exist $(PROJECT_BUILD_PATH)\obj\$(1) mkdir $(PROJECT_BUILD_PATH)\obj\$(1)
|
||||
mkdir -p $(PROJECT_BUILD_PATH)/obj/$(1)
|
||||
endef
|
||||
|
||||
# Copy required shared libs for integration into APK
|
||||
# NOTE: If using shared libs they are loaded by generated NativeLoader.java
|
||||
copy_project_required_libs:
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.so
|
||||
$(COPY_COMMAND) $(RAYLIB_LIB_PATH)/libraylib.so $(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME)/libraylib.so
|
||||
endif
|
||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.a
|
||||
$(COPY_COMMAND) $(RAYLIB_LIB_PATH)/libraylib.a $(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME)/libraylib.a
|
||||
endif
|
||||
|
||||
# Copy project required resources: strings.xml, icon.png, assets
|
||||
# NOTE: Required strings.xml is generated and game resources are copied to assets folder
|
||||
# TODO: Review xcopy usage, it can not be found in some systems!
|
||||
copy_project_resources:
|
||||
copy $(APP_ICON_LDPI) $(PROJECT_BUILD_PATH)\res\drawable-ldpi\icon.png /Y
|
||||
copy $(APP_ICON_MDPI) $(PROJECT_BUILD_PATH)\res\drawable-mdpi\icon.png /Y
|
||||
copy $(APP_ICON_HDPI) $(PROJECT_BUILD_PATH)\res\drawable-hdpi\icon.png /Y
|
||||
$(COPY_COMMAND) $(APP_ICON_LDPI) $(PROJECT_BUILD_PATH)/res/drawable-ldpi/icon.png
|
||||
$(COPY_COMMAND) $(APP_ICON_MDPI) $(PROJECT_BUILD_PATH)/res/drawable-mdpi/icon.png
|
||||
$(COPY_COMMAND) $(APP_ICON_HDPI) $(PROJECT_BUILD_PATH)/res/drawable-hdpi/icon.png
|
||||
ifeq ($(OS),Windows_NT)
|
||||
@echo ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/res/values/strings.xml
|
||||
@echo ^<resources^>^<string name="app_name"^>$(APP_LABEL_NAME)^</string^>^</resources^> >> $(PROJECT_BUILD_PATH)/res/values/strings.xml
|
||||
if exist $(PROJECT_RESOURCES_PATH) C:\Windows\System32\xcopy $(PROJECT_RESOURCES_PATH) $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) /Y /E /F
|
||||
else
|
||||
@echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > $(PROJECT_BUILD_PATH)/res/values/strings.xml
|
||||
@echo "<resources><string name=\"app_name\">$(APP_LABEL_NAME)</string></resources>" >> $(PROJECT_BUILD_PATH)/res/values/strings.xml
|
||||
@[ -d "$(PROJECT_RESOURCES_PATH)" ] || cp -rf $(PROJECT_RESOURCES_PATH) $(PROJECT_BUILD_PATH)/assets/$(PROJECT_RESOURCES_PATH)
|
||||
endif
|
||||
|
||||
# Generate NativeLoader.java to load required shared libraries
|
||||
# NOTE: Probably not the bet way to generate this file... but it works.
|
||||
generate_loader_script:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
@echo package com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME); > $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@@ -216,10 +260,23 @@ endif
|
||||
@echo System.loadLibrary("$(PROJECT_LIBRARY_NAME)"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
|
||||
else
|
||||
@echo "package com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME);" > $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo "" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo "public class NativeLoader extends android.app.NativeActivity {" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo " static {" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
@echo " System.loadLibrary(\"raylib\");" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
endif
|
||||
@echo " System.loadLibrary(\"$(PROJECT_LIBRARY_NAME)\");" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo " }" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
@echo "}" >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
endif
|
||||
|
||||
# Generate AndroidManifest.xml with all the required options
|
||||
# NOTE: Probably not the bet way to generate this file... but it works.
|
||||
generate_android_manifest:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
@echo ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo ^<manifest xmlns:android="http://schemas.android.com/apk/res/android" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo package="com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME)" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@@ -240,11 +297,37 @@ generate_android_manifest:
|
||||
@echo ^</activity^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo ^</application^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo ^</manifest^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
else
|
||||
@echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " package=\"com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME)\" " >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " android:versionCode=\"$(APP_VERSION_CODE)\" android:versionName=\"$(APP_VERSION_NAME)\" >" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <uses-sdk android:minSdkVersion=\"$(ANDROID_API_VERSION)\" />" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <uses-feature android:glEsVersion=\"0x00020000\" android:required=\"true\" />" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <application android:allowBackup=\"false\" android:label=\"@string/app_name\" android:icon=\"@drawable/icon\" >" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <activity android:name=\"com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME).NativeLoader\"" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " android:configChanges=\"orientation|keyboardHidden|screenSize\"" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " android:screenOrientation=\"$(APP_SCREEN_ORIENTATION)\" android:launchMode=\"singleTask\"" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " android:clearTaskOnLaunch=\"true\">" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <meta-data android:name=\"android.app.lib_name\" android:value=\"$(PROJECT_LIBRARY_NAME)\" />" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <intent-filter>" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <action android:name=\"android.intent.action.MAIN\" />" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " <category android:name=\"android.intent.category.LAUNCHER\" />" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " </intent-filter>" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " </activity>" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo " </application>" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
@echo "</manifest>" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml
|
||||
endif
|
||||
|
||||
# Generate storekey for APK signing: $(PROJECT_NAME).keystore
|
||||
# NOTE: Configure here your Distinguished Names (-dname) if required!
|
||||
generate_apk_keystore:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
if not exist $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore $(JAVA_HOME)/bin/keytool -genkeypair -validity 10000 -dname "CN=$(APP_COMPANY_NAME),O=Android,C=ES" -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -alias $(PROJECT_NAME)Key -keyalg RSA
|
||||
else
|
||||
@[ -f "$(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore" ] || $(JAVA_HOME)/bin/keytool -genkeypair -validity 10000 -dname "CN=$(APP_COMPANY_NAME),O=Android,C=ES" -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -alias $(PROJECT_NAME)Key -keyalg RSA
|
||||
endif
|
||||
|
||||
# Config project package and resource using AndroidManifest.xml and res/values/strings.xml
|
||||
# NOTE: Generates resources file: src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java
|
||||
@@ -253,7 +336,7 @@ config_project_package:
|
||||
|
||||
# Compile native_app_glue code as static library: obj/libnative_app_glue.a
|
||||
compile_native_app_glue:
|
||||
$(CC) -c $(RAYLIB_PATH)/src/external/android/native_app_glue/android_native_app_glue.c -o $(PROJECT_BUILD_PATH)/obj/native_app_glue.o $(CFLAGS)
|
||||
$(CC) -c $(NATIVE_APP_GLUE_PATH)/android_native_app_glue.c -o $(PROJECT_BUILD_PATH)/obj/native_app_glue.o $(CFLAGS)
|
||||
$(AR) rcs $(PROJECT_BUILD_PATH)/obj/libnative_app_glue.a $(PROJECT_BUILD_PATH)/obj/native_app_glue.o
|
||||
|
||||
# Compile project code into a shared library: lib/lib$(PROJECT_LIBRARY_NAME).so
|
||||
@@ -267,7 +350,7 @@ $(PROJECT_BUILD_PATH)/obj/%.o:%.c
|
||||
|
||||
# Compile project .java code into .class (Java bytecode)
|
||||
compile_project_class:
|
||||
$(JAVA_HOME)/bin/javac -verbose -source 1.7 -target 1.7 -d $(PROJECT_BUILD_PATH)/obj -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar -classpath $(ANDROID_HOME)/platforms/android-$(ANDROID_API_VERSION)/android.jar;$(PROJECT_BUILD_PATH)/obj -sourcepath $(PROJECT_BUILD_PATH)/src $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
$(JAVA_HOME)/bin/javac -verbose -source 1.7 -target 1.7 -d $(PROJECT_BUILD_PATH)/obj -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar -classpath $(ANDROID_HOME)/platforms/android-$(ANDROID_API_VERSION)/android.jar -d $(PROJECT_BUILD_PATH)/obj $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||
|
||||
# Compile .class files into Dalvik executable bytecode (.dex)
|
||||
# NOTE: Since Android 5.0, Dalvik interpreter (JIT) has been replaced by ART (AOT)
|
||||
@@ -313,6 +396,10 @@ deploy:
|
||||
|
||||
# Clean everything
|
||||
clean:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
del $(PROJECT_BUILD_PATH)\* /f /s /q
|
||||
rmdir $(PROJECT_BUILD_PATH) /s /q
|
||||
else
|
||||
rm -r $(PROJECT_BUILD_PATH)
|
||||
endif
|
||||
@echo Cleaning done
|
||||
|
1053
examples/Makefile.Web
Normal file
@@ -1,3 +1,21 @@
|
||||
## Building the Examples
|
||||
|
||||
The examples assume you have already built the `raylib` library in `../src`.
|
||||
|
||||
### With GNU make
|
||||
|
||||
- `make` builds all examples
|
||||
- `make [module]` builds all examples for a particular module (e.g `make core`)
|
||||
|
||||
### With Zig
|
||||
|
||||
The [Zig](https://ziglang.org/) toolchain can compile `C` and `C++` in addition to `Zig`.
|
||||
You may find it easier to use than other toolchains, especially when it comes to cross-compiling.
|
||||
|
||||
- `zig build` to compile all examples
|
||||
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
||||
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
||||
|
||||
## EXAMPLES LIST
|
||||
|
||||
### category: core
|
||||
@@ -20,16 +38,16 @@ Examples using raylib core platform functionality like window creation, inputs,
|
||||
| 12 | [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="200"> | ray | |
|
||||
| 13 | [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="200"> | ray | |
|
||||
| 14 | [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="200"> | ray | |
|
||||
| 15 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="200"> | [Pablo Marcos](https://github.com/pamarcos) | |
|
||||
| 15 | [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="200"> | [Pablo Marcos](https://github.com/pamarcos) | |
|
||||
| 16 | [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="200"> | [Anata](https://github.com/anatagawa) | |
|
||||
| 17 | [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="200"> | ray | |
|
||||
| 18 | [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="200"> | ray | |
|
||||
| 19 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="200"> | [Chris Dill](https://github.com/MysteriousSpace) | ⭐️ |
|
||||
| 19 | [core_scissor_test](core/core_scissor_test.c) | <img src="core/core_scissor_test.png" alt="core_scissor_test" width="200"> | [Chris Dill](https://github.com/MysteriousSpace) | |
|
||||
| 20 | [core_storage_values](core/core_storage_values.c) | <img src="core/core_storage_values.png" alt="core_storage_values" width="200"> | ray | |
|
||||
| 21 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="200"> | ray | |
|
||||
| 22 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="200"> | ray | ⭐️ |
|
||||
| 23 | [core/core_quat_conversion](core/core_quat_conversion.c) | <img src="core/core_quat_conversion.png" alt="core_quat_conversion" width="200"> | [Chris Camacho](https://github.com/codifies) | ⭐️ |
|
||||
| 24 | [core/core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="200"> | ray | ⭐️ | | ⭐️ |
|
||||
| 21 | [core_vr_simulator](core/core_vr_simulator.c) | <img src="core/core_vr_simulator.png" alt="core_vr_simulator" width="200"> | ray | ⭐️ |
|
||||
| 22 | [core_loading_thread](core/core_loading_thread.c) | <img src="core/core_loading_thread.png" alt="core_loading_thread" width="200"> | ray | |
|
||||
| 23 | [core/core_quat_conversion](core/core_quat_conversion.c) | <img src="core/core_quat_conversion.png" alt="core_quat_conversion" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 24 | [core/core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="200"> | ray | |
|
||||
|
||||
### category: shapes
|
||||
|
||||
@@ -38,18 +56,18 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||
| ## | example | image | developer | new |
|
||||
|----|----------|--------|:----------:|:---:|
|
||||
| 25 | [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="200"> | ray | |
|
||||
| 26 | [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="200"> | ray | ⭐️ |
|
||||
| 26 | [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="200"> | ray | |
|
||||
| 27 | [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="200"> | ray | |
|
||||
| 28 | [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="200"> | ray | |
|
||||
| 29 | [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="200"> | ray | |
|
||||
| 30 | [shapes_rectangle_scaling](shapes/shapes_rectangle_scaling.c) | <img src="shapes/shapes_rectangle_scaling.png" alt="shapes_rectangle_scaling" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| 31 | [shapes_lines_bezier](shapes/shapes_lines_bezier.c) | <img src="shapes/shapes_lines_bezier.png" alt="shapes_lines_bezier" width="200"> | ray | |
|
||||
| 32 | [shapes_collision_area](shapes/shapes_collision_area.c) | <img src="shapes/shapes_collision_area.png" alt="shapes_collision_area" width="200"> | ray | ⭐️ |
|
||||
| 33 | [shapes_following_eyes](shapes/shapes_following_eyes.c) | <img src="shapes/shapes_following_eyes.png" alt="shapes_following_eyes" width="200"> | ray | ⭐️ |
|
||||
| 34 | [shapes_easings_ball_anim](shapes/shapes_easings_ball_anim.c) | <img src="shapes/shapes_easings_ball_anim.png" alt="shapes_easings_ball_anim" width="200"> | ray | ⭐️ |
|
||||
| 35 | [shapes_easings_box_anim](shapes/shapes_easings_box_anim.c) | <img src="shapes/shapes_easings_box_anim.png" alt="shapes_easings_box_anim" width="200"> | ray | ⭐️ |
|
||||
| 36 | [shapes_easings_rectangle_array](shapes/shapes_easings_rectangle_array.c) | <img src="shapes/shapes_easings_rectangle_array.png" alt="shapes_easings_rectangle_array" width="200"> | ray | ⭐️ |
|
||||
| 37 | [shapes_draw_ring](shapes/shapes_draw_ring.c) | <img src="shapes/shapes_draw_ring.png" alt="shapes_draw_ring" width="200"> | [Vlad Adrian](https://github.com/demizdor) | ⭐️ |
|
||||
| 32 | [shapes_collision_area](shapes/shapes_collision_area.c) | <img src="shapes/shapes_collision_area.png" alt="shapes_collision_area" width="200"> | ray | |
|
||||
| 33 | [shapes_following_eyes](shapes/shapes_following_eyes.c) | <img src="shapes/shapes_following_eyes.png" alt="shapes_following_eyes" width="200"> | ray | |
|
||||
| 34 | [shapes_easings_ball_anim](shapes/shapes_easings_ball_anim.c) | <img src="shapes/shapes_easings_ball_anim.png" alt="shapes_easings_ball_anim" width="200"> | ray | |
|
||||
| 35 | [shapes_easings_box_anim](shapes/shapes_easings_box_anim.c) | <img src="shapes/shapes_easings_box_anim.png" alt="shapes_easings_box_anim" width="200"> | ray | |
|
||||
| 36 | [shapes_easings_rectangle_array](shapes/shapes_easings_rectangle_array.c) | <img src="shapes/shapes_easings_rectangle_array.png" alt="shapes_easings_rectangle_array" width="200"> | ray | |
|
||||
| 37 | [shapes_draw_ring](shapes/shapes_draw_ring.c) | <img src="shapes/shapes_draw_ring.png" alt="shapes_draw_ring" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| 38 | [shapes_draw_circle_sector](shapes/shapes_draw_circle_sector.c) | <img src="shapes/shapes_draw_circle_sector.png" alt="shapes_draw_circle_sector" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| 39 | [shapes_draw_rectangle_rounded](shapes/shapes_draw_rectangle_rounded.c) | <img src="shapes/shapes_draw_rectangle_rounded.png" alt="shapes_draw_rectangle_rounded" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
|
||||
@@ -66,18 +84,19 @@ Examples using raylib textures functionality, including image/textures loading/g
|
||||
| 44 | [textures_image_generation](textures/textures_image_generation.c) | <img src="textures/textures_image_generation.png" alt="textures_image_generation" width="200"> | ray | |
|
||||
| 45 | [textures_image_loading](textures/textures_image_loading.c) | <img src="textures/textures_image_loading.png" alt="textures_image_loading" width="200"> | ray | |
|
||||
| 46 | [textures_image_processing](textures/textures_image_processing.c) | <img src="textures/textures_image_processing.png" alt="textures_image_processing" width="200"> | ray | |
|
||||
| 47 | [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="200"> | ray | |
|
||||
| 48 | [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="200"> | ray | ⭐️ |
|
||||
| 47 | [textures_image_text](textures/textures_image_text.c) | <img src="textures/textures_image_text.png" alt="textures_image_text" width="200"> | ray | |
|
||||
| 48 | [textures_to_image](textures/textures_to_image.c) | <img src="textures/textures_to_image.png" alt="textures_to_image" width="200"> | ray | |
|
||||
| 49 | [textures_raw_data](textures/textures_raw_data.c) | <img src="textures/textures_raw_data.png" alt="textures_raw_data" width="200"> | ray | |
|
||||
| 50 | [textures_particles_blending](textures/textures_particles_blending.c) | <img src="textures/textures_particles_blending.png" alt="textures_particles_blending" width="200"> | ray | |
|
||||
| 51 | [textures_npatch_drawing](textures/textures_npatch_drawing.c) | <img src="textures/textures_npatch_drawing.png" alt="textures_npatch_drawing" width="200"> | [Jorge A. Gomes](https://github.com/overdev) | |
|
||||
| 52 | [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="200"> | ray | ⭐️ |
|
||||
| 53 | [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="200"> | ray | ⭐️ |
|
||||
| 54 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="200"> | ray | ⭐️ |
|
||||
| 55 | [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="200"> | ray | |
|
||||
| 56 | [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="200"> | [Chris Dill](https://github.com/MysteriousSpace) | |
|
||||
| 57 | [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="200"> | [Karlo Licudine](https://github.com/accidentalrebel) | ⭐️ |
|
||||
| 58 | [textures/textures_draw_tiled](textures/textures_draw_tiled.c) | <img src="textures/textures_draw_tiled.png" alt="textures_draw_tiled" width="200"> | [Vlad Adrian](https://github.com/demizdor) | ⭐️ |
|
||||
| 52 | [textures_background_scrolling](textures/textures_background_scrolling.c) | <img src="textures/textures_background_scrolling.png" alt="textures_background_scrolling" width="200"> | ray | |
|
||||
| 53 | [textures_sprite_button](textures/textures_sprite_button.c) | <img src="textures/textures_sprite_button.png" alt="textures_sprite_button" width="200"> | ray | |
|
||||
| 54 | [textures_sprite_explosion](textures/textures_sprite_explosion.c) | <img src="textures/textures_sprite_explosion.png" alt="textures_sprite_explosion" width="200"> | ray | |
|
||||
| 55 | [textures_bunnymark](textures/textures_bunnymark.c) | <img src="textures/textures_bunnymark.png" alt="textures_bunnymark" width="200"> | ray | |
|
||||
| 56 | [textures_mouse_painting](textures/textures_mouse_painting.c) | <img src="textures/textures_mouse_painting.png" alt="textures_mouse_painting" width="200"> | [Chris Dill](https://github.com/MysteriousSpace) | |
|
||||
| 57 | [textures_blend_modes](textures/textures_blend_modes.c) | <img src="textures/textures_blend_modes.png" alt="textures_blend_modes" width="200"> | [Karlo Licudine](https://github.com/accidentalrebel) | |
|
||||
| 58 | [textures_draw_tiled](textures/textures_draw_tiled.c) | <img src="textures/textures_draw_tiled.png" alt="textures_draw_tiled" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| -- | [textures_poly](textures/textures_poly.c) | <img src="textures/textures_poly.png" alt="textures_poly" width="200"> | [Chris Camacho](https://github.com/codifies) | ⭐️ |
|
||||
|
||||
### category: text
|
||||
|
||||
@@ -89,12 +108,13 @@ Examples using raylib text functionality, including sprite fonts loading/generat
|
||||
| 60 | [text_font_spritefont](text/text_font_spritefont.c) | <img src="text/text_font_spritefont.png" alt="text_font_spritefont" width="200"> | ray | |
|
||||
| 61 | [text_font_filters](text/text_font_filters.c) | <img src="text/text_font_filters.png" alt="text_font_filters" width="200"> | ray | |
|
||||
| 62 | [text_font_loading](text/text_font_loading.c) | <img src="text/text_font_loading.png" alt="text_font_loading" width="200"> | ray | |
|
||||
| 63 | [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="200"> | ray | |
|
||||
| 63 | [text_font_sdf](text/text_font_sdf.c) | <img src="text/text_font_sdf.png" alt="text_font_sdf" width="200"> | ray | |
|
||||
| 64 | [text_format_text](text/text_format_text.c) | <img src="text/text_format_text.png" alt="text_format_text" width="200"> | ray | |
|
||||
| 65 | [text_input_box](text/text_input_box.c) | <img src="text/text_input_box.png" alt="text_input_box" width="200"> | ray | |
|
||||
| 66 | [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="200"> | ray | |
|
||||
| 67 | [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| 68 | [text_unicode](text/text_unicode.c) | <img src="text/text_unicode.png" alt="text_unicode" width="200"> | [Vlad Adrian](https://github.com/demizdor) | |
|
||||
| -- | [text_draw_3d](text/text_draw_3d.c) | <img src="text/text_draw_3d.png" alt="text_draw_3d" width="200"> | [Vlad Adrian](https://github.com/demizdor) | ⭐️ |
|
||||
|
||||
### category: models
|
||||
|
||||
@@ -102,22 +122,23 @@ Examples using raylib models functionality, including models loading/generation
|
||||
|
||||
| ## | example | image | developer | new |
|
||||
|----|----------|--------|:----------:|:---:|
|
||||
| 69 | [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="200"> | [culacant](https://github.com/culacant) | |
|
||||
| 69 | [models_animation](models/models_animation.c) | <img src="models/models_animation.png" alt="models_animation" width="200"> | [culacant](https://github.com/culacant) | |
|
||||
| 70 | [models_billboard](models/models_billboard.c) | <img src="models/models_billboard.png" alt="models_billboard" width="200"> | ray | |
|
||||
| 71 | [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="200"> | ray | |
|
||||
| 72 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="200"> | ray | |
|
||||
| 73 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="200"> | ray | |
|
||||
| 73 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="200"> | ray | |
|
||||
| 74 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="200"> | ray | |
|
||||
| 75 | [models_material_pbr](models/models_material_pbr.c) | <img src="models/models_material_pbr.png" alt="models_material_pbr" width="200"> | ray | |
|
||||
| 75 | [...]() | | ray | |
|
||||
| 76 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="200"> | ray | |
|
||||
| 77 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="200"> | [Joel Davis](https://github.com/joeld42) | |
|
||||
| 78 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="200"> | ray | |
|
||||
| 79 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="200"> | [Max Danielsson](https://github.com/autious) | |
|
||||
| 80 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="200"> | ray | |
|
||||
| 80 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="200"> | ray | |
|
||||
| 81 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="200"> | ray | |
|
||||
| 82 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="200"> | [Berni](https://github.com/Berni8k) | |
|
||||
| 82 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="200"> | [Berni](https://github.com/Berni8k) | ⭐️ |
|
||||
| 83 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="200"> | ray | |
|
||||
| 84 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="200"> | [codecat](https://github.com/codecat) | ⭐️ |
|
||||
| 84 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="200"> | [codecat](https://github.com/codecat) | |
|
||||
| -- | [models_gltf_model](models/models_gltf_model.c) | <img src="models/models_gltf_model.png" alt="models_gltf_model" width="200"> | [object71](https://github.com/object71) | ⭐️ |
|
||||
|
||||
### category: shaders
|
||||
|
||||
@@ -126,22 +147,22 @@ Examples using raylib shaders functionality, including shaders loading, paramete
|
||||
| ## | example | image | developer | new |
|
||||
|----|----------|--------|:----------:|:---:|
|
||||
| 85 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 86 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="200"> | ray | |
|
||||
| 87 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="200"> | ray | |
|
||||
| 88 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="200"> | ray | |
|
||||
| 89 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="200"> | ray | |
|
||||
| 90 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="200"> | [Marco Lizza](https://github.com/MarcoLizza) | |
|
||||
| 86 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="200"> | ray | |
|
||||
| 87 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="200"> | ray | |
|
||||
| 88 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="200"> | ray | |
|
||||
| 89 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="200"> | ray | |
|
||||
| 90 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="200"> | [Marco Lizza](https://github.com/MarcoLizza) | |
|
||||
| 91 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="200"> | Shader by Iñigo Quilez | |
|
||||
| 92 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="200"> | Michał Ciesielski | |
|
||||
| 92 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="200"> | Michał Ciesielski | |
|
||||
| 93 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="200"> | [Anata](https://github.com/anatagawa) | |
|
||||
| 94 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="200"> | [eggmund](https://github.com/eggmund) | |
|
||||
| 95 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="200"> | [ProfJski](https://github.com/ProfJski) | |
|
||||
| 95 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="200"> | [ProfJski](https://github.com/ProfJski) | |
|
||||
| 96 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 97 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 98 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="200"> | [Chris Camacho](https://github.com/codifies) | ⭐️ |
|
||||
| 99 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="200"> | ray | ⭐️ |
|
||||
| 100 | [shaders_rlgl_mesh_instanced](shaders/shaders_rlgl_mesh_instanced.c) | <img src="shaders/shaders_rlgl_mesh_instanced.png" alt="shaders_rlgl_mesh_instanced" width="200"> | [Chris Camacho](https://github.com/codifies) | ⭐️ |
|
||||
| 101 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="200"> | ray | ⭐️ |
|
||||
| 97 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 98 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="200"> | [Chris Camacho](https://github.com/codifies) | |
|
||||
| 99 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="200"> | ray | |
|
||||
| 100 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="200"> | [seanpringle](https://github.com/seanpringle), [moliad](https://github.com/moliad) | ⭐️ |
|
||||
| 101 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="200"> | ray | |
|
||||
|
||||
### category: audio
|
||||
|
||||
@@ -167,22 +188,6 @@ Examples showing physics functionality with raylib. This functionality is provid
|
||||
| 110 | [physics_restitution](physics/physics_restitution.c) | <img src="physics/physics_restitution.png" alt="physics_restitution" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
|
||||
| 111 | [physics_shatter](physics/physics_shatter.c) | <img src="physics/physics_shatter.png" alt="physics_shatter" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
|
||||
|
||||
### category: network
|
||||
|
||||
Examples showing raylib network functionality. This functionality is provided by [rnet](../src/rnet.h) module.
|
||||
|
||||
**Note that rnet module is under development and not ready yet.**
|
||||
|
||||
| ## | example | image | developer | new |
|
||||
|----|----------|--------|:----------:|:---:|
|
||||
| 112 | [network_ping_pong](network/network_ping_pong.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 113 | [network_resolve_host](network/network_resolve_host.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 114 | [network_tcp_client](network/network_tcp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 115 | [network_tcp_server](network/network_tcp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 116 | [network_test](network/network_test.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 117 | [network_udp_client](network/network_udp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
| 118 | [network_udp_server](network/network_udp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
|
||||
|
||||
### category: others
|
||||
|
||||
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
|
||||
@@ -192,7 +197,7 @@ Examples showing raylib misc functionality that does not fit in other categories
|
||||
| 119 | [raudio_standalone](others/raudio_standalone.c) | | ray | |
|
||||
| 120 | [rlgl_standalone](others/rlgl_standalone.c) | | ray | |
|
||||
| 121 | [easings_testbed](others/easings_testbed.c) | | [Juan Miguel López](https://github.com/flashback-fx) | |
|
||||
| 122 | [embedded_files_loading](others/embedded_files_loading.c)) | | [Kristian Holmgren](https://github.com/defutura) | |
|
||||
| 122 | [embedded_files_loading](others/embedded_files_loading.c) | | [Kristian Holmgren](https://github.com/defutura) | |
|
||||
|
||||
As always contributions are welcome, feel free to send new examples! Here it is an [examples template](examples_template.c) to start with!
|
||||
|
||||
|
@@ -43,9 +43,9 @@ int main(void)
|
||||
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||
{
|
||||
circles[i].alpha = 0.0f;
|
||||
circles[i].radius = GetRandomValue(10, 40);
|
||||
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
||||
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
||||
circles[i].radius = (float)GetRandomValue(10, 40);
|
||||
circles[i].position.x = (float)GetRandomValue((int)circles[i].radius, (int)(screenWidth - circles[i].radius));
|
||||
circles[i].position.y = (float)GetRandomValue((int)circles[i].radius, (int)(screenHeight - circles[i].radius));
|
||||
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
||||
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||
}
|
||||
@@ -87,7 +87,7 @@ int main(void)
|
||||
|
||||
if (IsKeyDown(KEY_DOWN)) pitch -= 0.01f;
|
||||
else if (IsKeyDown(KEY_UP)) pitch += 0.01f;
|
||||
|
||||
|
||||
SetMusicPitch(music, pitch);
|
||||
|
||||
// Get timePlayed scaled to bar dimensions
|
||||
@@ -104,9 +104,9 @@ int main(void)
|
||||
if (circles[i].alpha <= 0.0f)
|
||||
{
|
||||
circles[i].alpha = 0.0f;
|
||||
circles[i].radius = GetRandomValue(10, 40);
|
||||
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
||||
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
||||
circles[i].radius = (float)GetRandomValue(10, 40);
|
||||
circles[i].position.x = (float)GetRandomValue((int)circles[i].radius, (int)(screenWidth - circles[i].radius));
|
||||
circles[i].position.y = (float)GetRandomValue((int)circles[i].radius, (int)(screenHeight - circles[i].radius));
|
||||
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||
circles[i].speed = (float)GetRandomValue(1, 100)/2000.0f;
|
||||
}
|
||||
|
@@ -26,8 +26,8 @@ int main(void)
|
||||
|
||||
Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
|
||||
Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
|
||||
|
||||
SetSoundVolume(fxWav, 0.2);
|
||||
|
||||
SetSoundVolume(fxWav, 0.2f);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -46,7 +46,7 @@ int main(void)
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
DrawText("MULTICHANNEL SOUND PLAYING", 20, 20, 20, GRAY);
|
||||
DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
|
||||
DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
|
||||
|
@@ -31,8 +31,10 @@ int main(void)
|
||||
|
||||
InitAudioDevice(); // Initialize audio device
|
||||
|
||||
SetAudioStreamBufferSizeDefault(MAX_SAMPLES_PER_UPDATE);
|
||||
|
||||
// Init raw audio stream (sample rate: 22050, sample size: 16bit-short, channels: 1-mono)
|
||||
AudioStream stream = InitAudioStream(22050, 16, 1);
|
||||
AudioStream stream = LoadAudioStream(44100, 16, 1);
|
||||
|
||||
// Buffer for the single cycle waveform we are synthesizing
|
||||
short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES);
|
||||
@@ -71,7 +73,7 @@ int main(void)
|
||||
// Sample mouse input.
|
||||
mousePosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
float fp = (float)(mousePosition.y);
|
||||
frequency = 40.0f + (float)(fp);
|
||||
@@ -140,8 +142,8 @@ int main(void)
|
||||
// Draw the current buffer state proportionate to the screen
|
||||
for (int i = 0; i < screenWidth; i++)
|
||||
{
|
||||
position.x = i;
|
||||
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000;
|
||||
position.x = (float)i;
|
||||
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000.0f;
|
||||
|
||||
DrawPixelV(position, RED);
|
||||
}
|
||||
@@ -155,7 +157,7 @@ int main(void)
|
||||
free(data); // Unload sine wave data
|
||||
free(writeBuf); // Unload write buffer
|
||||
|
||||
CloseAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||
UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
|
@@ -3,8 +3,8 @@
|
||||
| country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
|
||||
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
|
||||
| mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - |
|
||||
|
86
examples/build.zig
Normal file
@@ -0,0 +1,86 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zig.CrossTarget) !*std.build.Step {
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
|
||||
const all = b.step(module, "All " ++ module ++ " examples");
|
||||
const dir = try std.fs.cwd().openDir(
|
||||
module,
|
||||
.{ .iterate = true },
|
||||
);
|
||||
var iter = dir.iterate();
|
||||
while (try iter.next()) |entry| {
|
||||
if (entry.kind != .File) continue;
|
||||
const extension_idx = std.mem.lastIndexOf(u8, entry.name, ".c") orelse continue;
|
||||
const name = entry.name[0..extension_idx];
|
||||
const path = try std.fs.path.join(b.allocator, &.{ module, entry.name });
|
||||
|
||||
// zig's mingw headers do not include pthread.h
|
||||
if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue;
|
||||
|
||||
const exe = b.addExecutable(name, path);
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
exe.linkLibC();
|
||||
exe.addObjectFile(switch (target.getOsTag()) {
|
||||
.windows => "../src/raylib.lib",
|
||||
.linux => "../src/libraylib.a",
|
||||
else => @panic("Unsupported OS"),
|
||||
});
|
||||
|
||||
exe.addIncludeDir("../src");
|
||||
exe.addIncludeDir("../src/external");
|
||||
exe.addIncludeDir("../src/external/glfw/include");
|
||||
|
||||
switch (exe.target.toTarget().os.tag) {
|
||||
.windows => {
|
||||
exe.linkSystemLibrary("winmm");
|
||||
exe.linkSystemLibrary("gdi32");
|
||||
exe.linkSystemLibrary("opengl32");
|
||||
exe.addIncludeDir("external/glfw/deps/mingw");
|
||||
},
|
||||
.linux => {
|
||||
exe.linkSystemLibrary("GL");
|
||||
exe.linkSystemLibrary("rt");
|
||||
exe.linkSystemLibrary("dl");
|
||||
exe.linkSystemLibrary("m");
|
||||
exe.linkSystemLibrary("X11");
|
||||
},
|
||||
else => {
|
||||
@panic("Unsupported OS");
|
||||
},
|
||||
}
|
||||
|
||||
exe.setOutputDir(module);
|
||||
|
||||
var run = exe.run();
|
||||
run.step.dependOn(&b.addInstallArtifact(exe).step);
|
||||
run.cwd = module;
|
||||
b.step(name, name).dependOn(&run.step);
|
||||
all.dependOn(&exe.step);
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
pub fn build(b: *std.build.Builder) !void {
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// what target to build for. Here we do not override the defaults, which
|
||||
// means any target is allowed, and the default is native. Other options
|
||||
// for restricting supported target set are available.
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const all = b.getInstallStep();
|
||||
|
||||
all.dependOn(try add_module("audio", b, target));
|
||||
all.dependOn(try add_module("core", b, target));
|
||||
all.dependOn(try add_module("models", b, target));
|
||||
all.dependOn(try add_module("others", b, target));
|
||||
all.dependOn(try add_module("physics", b, target));
|
||||
all.dependOn(try add_module("shaders", b, target));
|
||||
all.dependOn(try add_module("shapes", b, target));
|
||||
all.dependOn(try add_module("text", b, target));
|
||||
all.dependOn(try add_module("textures", b, target));
|
||||
}
|
@@ -30,19 +30,19 @@ int main(void)
|
||||
|
||||
for (int i = 0; i < MAX_BUILDINGS; i++)
|
||||
{
|
||||
buildings[i].width = GetRandomValue(50, 200);
|
||||
buildings[i].height = GetRandomValue(100, 800);
|
||||
buildings[i].y = screenHeight - 130 - buildings[i].height;
|
||||
buildings[i].x = -6000 + spacing;
|
||||
buildings[i].width = (float)GetRandomValue(50, 200);
|
||||
buildings[i].height = (float)GetRandomValue(100, 800);
|
||||
buildings[i].y = screenHeight - 130.0f - buildings[i].height;
|
||||
buildings[i].x = -6000.0f + spacing;
|
||||
|
||||
spacing += buildings[i].width;
|
||||
spacing += (int)buildings[i].width;
|
||||
|
||||
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
|
||||
}
|
||||
|
||||
Camera2D camera = { 0 };
|
||||
camera.target = (Vector2){ player.x + 20, player.y + 20 };
|
||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||
camera.target = (Vector2){ player.x + 20.0f, player.y + 20.0f };
|
||||
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||
camera.rotation = 0.0f;
|
||||
camera.zoom = 1.0f;
|
||||
|
||||
@@ -54,7 +54,7 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Player movement
|
||||
if (IsKeyDown(KEY_RIGHT)) player.x += 2;
|
||||
else if (IsKeyDown(KEY_LEFT)) player.x -= 2;
|
||||
@@ -98,8 +98,8 @@ int main(void)
|
||||
|
||||
DrawRectangleRec(player, RED);
|
||||
|
||||
DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, GREEN);
|
||||
DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, GREEN);
|
||||
DrawLine((int)camera.target.x, -screenHeight*10, (int)camera.target.x, screenHeight*10, GREEN);
|
||||
DrawLine(-screenWidth*10, (int)camera.target.y, screenWidth*10, (int)camera.target.y, GREEN);
|
||||
|
||||
EndMode2D();
|
||||
|
||||
|
@@ -46,7 +46,7 @@ int main(void)
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
|
||||
|
||||
Player player = { 0 };
|
||||
@@ -60,12 +60,12 @@ int main(void)
|
||||
{{ 250, 300, 100, 10 }, 1, GRAY },
|
||||
{{ 650, 300, 100, 10 }, 1, GRAY }
|
||||
};
|
||||
|
||||
|
||||
int envItemsLength = sizeof(envItems)/sizeof(envItems[0]);
|
||||
|
||||
Camera2D camera = { 0 };
|
||||
camera.target = player.position;
|
||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||
camera.rotation = 0.0f;
|
||||
camera.zoom = 1.0f;
|
||||
|
||||
@@ -77,10 +77,10 @@ int main(void)
|
||||
UpdateCameraEvenOutOnLanding,
|
||||
UpdateCameraPlayerBoundsPush
|
||||
};
|
||||
|
||||
|
||||
int cameraOption = 0;
|
||||
int cameraUpdatersLength = sizeof(cameraUpdaters)/sizeof(cameraUpdaters[0]);
|
||||
|
||||
|
||||
char *cameraDescriptions[] = {
|
||||
"Follow player center",
|
||||
"Follow player center, but clamp to map edges",
|
||||
@@ -88,25 +88,25 @@ int main(void)
|
||||
"Follow player center horizontally; updateplayer center vertically after landing",
|
||||
"Player push camera on getting too close to screen edge"
|
||||
};
|
||||
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
float deltaTime = GetFrameTime();
|
||||
|
||||
|
||||
UpdatePlayer(&player, envItems, envItemsLength, deltaTime);
|
||||
|
||||
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
|
||||
|
||||
|
||||
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
|
||||
else if (camera.zoom < 0.25f) camera.zoom = 0.25f;
|
||||
|
||||
if (IsKeyPressed(KEY_R))
|
||||
|
||||
if (IsKeyPressed(KEY_R))
|
||||
{
|
||||
camera.zoom = 1.0f;
|
||||
player.position = (Vector2){ 400, 280 };
|
||||
@@ -125,12 +125,12 @@ int main(void)
|
||||
ClearBackground(LIGHTGRAY);
|
||||
|
||||
BeginMode2D(camera);
|
||||
|
||||
|
||||
for (int i = 0; i < envItemsLength; i++) DrawRectangleRec(envItems[i].rect, envItems[i].color);
|
||||
|
||||
Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40, 40 };
|
||||
DrawRectangleRec(playerRect, RED);
|
||||
|
||||
|
||||
EndMode2D();
|
||||
|
||||
DrawText("Controls:", 20, 20, 10, BLACK);
|
||||
@@ -140,7 +140,7 @@ int main(void)
|
||||
DrawText("- C to change camera mode", 40, 100, 10, DARKGRAY);
|
||||
DrawText("Current camera mode:", 20, 120, 10, BLACK);
|
||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, DARKGRAY);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
@@ -157,50 +157,50 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
|
||||
{
|
||||
if (IsKeyDown(KEY_LEFT)) player->position.x -= PLAYER_HOR_SPD*delta;
|
||||
if (IsKeyDown(KEY_RIGHT)) player->position.x += PLAYER_HOR_SPD*delta;
|
||||
if (IsKeyDown(KEY_SPACE) && player->canJump)
|
||||
if (IsKeyDown(KEY_SPACE) && player->canJump)
|
||||
{
|
||||
player->speed = -PLAYER_JUMP_SPD;
|
||||
player->canJump = false;
|
||||
}
|
||||
|
||||
int hitObstacle = 0;
|
||||
for (int i = 0; i < envItemsLength; i++)
|
||||
for (int i = 0; i < envItemsLength; i++)
|
||||
{
|
||||
EnvItem *ei = envItems + i;
|
||||
Vector2 *p = &(player->position);
|
||||
if (ei->blocking &&
|
||||
ei->rect.x <= p->x &&
|
||||
ei->rect.x <= p->x &&
|
||||
ei->rect.x + ei->rect.width >= p->x &&
|
||||
ei->rect.y >= p->y &&
|
||||
ei->rect.y < p->y + player->speed*delta)
|
||||
ei->rect.y < p->y + player->speed*delta)
|
||||
{
|
||||
hitObstacle = 1;
|
||||
player->speed = 0.0f;
|
||||
p->y = ei->rect.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hitObstacle)
|
||||
|
||||
if (!hitObstacle)
|
||||
{
|
||||
player->position.y += player->speed*delta;
|
||||
player->speed += G*delta;
|
||||
player->canJump = false;
|
||||
}
|
||||
}
|
||||
else player->canJump = true;
|
||||
}
|
||||
|
||||
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
{
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
camera->target = player->position;
|
||||
}
|
||||
|
||||
void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
{
|
||||
camera->target = player->position;
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;
|
||||
|
||||
|
||||
for (int i = 0; i < envItemsLength; i++)
|
||||
{
|
||||
EnvItem *ei = envItems + i;
|
||||
@@ -209,10 +209,10 @@ void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envI
|
||||
minY = fminf(ei->rect.y, minY);
|
||||
maxY = fmaxf(ei->rect.y + ei->rect.height, maxY);
|
||||
}
|
||||
|
||||
|
||||
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, *camera);
|
||||
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, *camera);
|
||||
|
||||
|
||||
if (max.x < width) camera->offset.x = width - (max.x - width/2);
|
||||
if (max.y < height) camera->offset.y = height - (max.y - height/2);
|
||||
if (min.x > 0) camera->offset.x = width/2 - min.x;
|
||||
@@ -224,11 +224,11 @@ void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *e
|
||||
static float minSpeed = 30;
|
||||
static float minEffectLength = 10;
|
||||
static float fractionSpeed = 0.8f;
|
||||
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
Vector2 diff = Vector2Subtract(player->position, camera->target);
|
||||
float length = Vector2Length(diff);
|
||||
|
||||
|
||||
if (length > minEffectLength)
|
||||
{
|
||||
float speed = fmaxf(fractionSpeed*length, minSpeed);
|
||||
@@ -241,34 +241,34 @@ void UpdateCameraEvenOutOnLanding(Camera2D *camera, Player *player, EnvItem *env
|
||||
static float evenOutSpeed = 700;
|
||||
static int eveningOut = false;
|
||||
static float evenOutTarget;
|
||||
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
camera->target.x = player->position.x;
|
||||
|
||||
|
||||
if (eveningOut)
|
||||
{
|
||||
if (evenOutTarget > camera->target.y)
|
||||
if (evenOutTarget > camera->target.y)
|
||||
{
|
||||
camera->target.y += evenOutSpeed*delta;
|
||||
|
||||
if (camera->target.y > evenOutTarget)
|
||||
{
|
||||
camera->target.y = evenOutTarget;
|
||||
eveningOut = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
camera->target.y -= evenOutSpeed*delta;
|
||||
|
||||
if (camera->target.y < evenOutTarget)
|
||||
|
||||
if (camera->target.y > evenOutTarget)
|
||||
{
|
||||
camera->target.y = evenOutTarget;
|
||||
eveningOut = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
camera->target.y -= evenOutSpeed*delta;
|
||||
|
||||
if (camera->target.y < evenOutTarget)
|
||||
{
|
||||
camera->target.y = evenOutTarget;
|
||||
eveningOut = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->canJump && (player->speed == 0) && (player->position.y != camera->target.y))
|
||||
{
|
||||
@@ -278,7 +278,7 @@ void UpdateCameraEvenOutOnLanding(Camera2D *camera, Player *player, EnvItem *env
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateCameraPlayerBoundsPush(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
void UpdateCameraPlayerBoundsPush(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
{
|
||||
static Vector2 bbox = { 0.2f, 0.2f };
|
||||
|
||||
|
BIN
examples/core/core_2d_camera_smooth_pixelperfect.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -28,7 +28,7 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 1.8f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 60.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
// Generates some random columns
|
||||
float heights[MAX_COLUMNS] = { 0 };
|
||||
@@ -38,7 +38,7 @@ int main(void)
|
||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||
{
|
||||
heights[i] = (float)GetRandomValue(1, 12);
|
||||
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
|
||||
positions[i] = (Vector3){ (float)GetRandomValue(-15, 15), heights[i]/2.0f, (float)GetRandomValue(-15, 15) };
|
||||
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ int main(void)
|
||||
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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
|
@@ -26,7 +26,7 @@ int main(void)
|
||||
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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
|
@@ -26,14 +26,14 @@ int main(void)
|
||||
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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
|
||||
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
|
||||
|
||||
Ray ray = { 0 }; // Picking line ray
|
||||
|
||||
bool collision = false;
|
||||
RayCollision collision = { 0 };
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
@@ -47,18 +47,18 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
if (!collision)
|
||||
if (!collision.hit)
|
||||
{
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
|
||||
// Check collision between ray and box
|
||||
collision = CheckCollisionRayBox(ray,
|
||||
collision = GetRayCollisionBox(ray,
|
||||
(BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
|
||||
(Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }});
|
||||
}
|
||||
else collision = false;
|
||||
else collision.hit = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,7 @@ int main(void)
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
if (collision)
|
||||
if (collision.hit)
|
||||
{
|
||||
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
|
||||
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
|
||||
@@ -90,7 +90,7 @@ int main(void)
|
||||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||
|
||||
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
|
||||
if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@@ -1,35 +1,34 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib - Simple Game template
|
||||
* raylib [core] examples - basic screen manager
|
||||
*
|
||||
* <Game title>
|
||||
* <Game description>
|
||||
* This example illustrates a very simple screen manager based on a states machines
|
||||
*
|
||||
* This game has been created using raylib (www.raylib.com)
|
||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2020 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Main entry point
|
||||
//----------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------
|
||||
int main(void)
|
||||
{
|
||||
// Initialization (Note windowTitle is unused on Android)
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib template - simple game");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic screen manager");
|
||||
|
||||
GameScreen currentScreen = LOGO;
|
||||
|
||||
@@ -39,15 +38,15 @@ int main(void)
|
||||
|
||||
SetTargetFPS(60); // Set desired framerate (frames-per-second)
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
switch(currentScreen)
|
||||
switch(currentScreen)
|
||||
{
|
||||
case LOGO:
|
||||
case LOGO:
|
||||
{
|
||||
// TODO: Update LOGO screen variables here!
|
||||
|
||||
@@ -59,7 +58,7 @@ int main(void)
|
||||
currentScreen = TITLE;
|
||||
}
|
||||
} break;
|
||||
case TITLE:
|
||||
case TITLE:
|
||||
{
|
||||
// TODO: Update TITLE screen variables here!
|
||||
|
||||
@@ -70,16 +69,16 @@ int main(void)
|
||||
}
|
||||
} break;
|
||||
case GAMEPLAY:
|
||||
{
|
||||
{
|
||||
// TODO: Update GAMEPLAY screen variables here!
|
||||
|
||||
// Press enter to change to ENDING screen
|
||||
if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP))
|
||||
{
|
||||
currentScreen = ENDING;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case ENDING:
|
||||
case ENDING:
|
||||
{
|
||||
// TODO: Update ENDING screen variables here!
|
||||
|
||||
@@ -87,63 +86,63 @@ int main(void)
|
||||
if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP))
|
||||
{
|
||||
currentScreen = TITLE;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
switch(currentScreen)
|
||||
|
||||
switch(currentScreen)
|
||||
{
|
||||
case LOGO:
|
||||
case LOGO:
|
||||
{
|
||||
// TODO: Draw LOGO screen here!
|
||||
DrawText("LOGO SCREEN", 20, 20, 40, LIGHTGRAY);
|
||||
DrawText("WAIT for 2 SECONDS...", 290, 220, 20, GRAY);
|
||||
|
||||
|
||||
} break;
|
||||
case TITLE:
|
||||
case TITLE:
|
||||
{
|
||||
// TODO: Draw TITLE screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
|
||||
DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, DARKGREEN);
|
||||
|
||||
|
||||
} break;
|
||||
case GAMEPLAY:
|
||||
{
|
||||
{
|
||||
// TODO: Draw GAMEPLAY screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, PURPLE);
|
||||
DrawText("GAMEPLAY SCREEN", 20, 20, 40, MAROON);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, MAROON);
|
||||
|
||||
} break;
|
||||
case ENDING:
|
||||
case ENDING:
|
||||
{
|
||||
// TODO: Draw ENDING screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, BLUE);
|
||||
DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE);
|
||||
DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE);
|
||||
|
||||
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// TODO: Unload all loaded data (textures, fonts, audio) here!
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
BIN
examples/core/core_basic_screen_manager.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -45,9 +45,9 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@@ -46,7 +46,7 @@ int main()
|
||||
#else
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
|
125
examples/core/core_custom_frame_control.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - custom frame control
|
||||
*
|
||||
* WARNING: This is an example for advance users willing to have full control over
|
||||
* the frame processes. By default, EndDrawing() calls the following processes:
|
||||
* 1. Draw remaining batch data: rlDrawRenderBatchActive()
|
||||
* 2. SwapScreenBuffer()
|
||||
* 3. Frame time control: WaitTime()
|
||||
* 4. PollInputEvents()
|
||||
*
|
||||
* To avoid steps 2, 3 and 4, flag SUPPORT_CUSTOM_FRAME_CONTROL can be enabled in
|
||||
* config.h (it requires recompiling raylib). This way those steps are up to the user.
|
||||
*
|
||||
* Note that enabling this flag invalidates some functions:
|
||||
* - GetFrameTime()
|
||||
* - SetTargetFPS()
|
||||
* - GetFPS()
|
||||
*
|
||||
* This example has been created using raylib 3.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control");
|
||||
|
||||
// Custom timming variables
|
||||
double previousTime = GetTime(); // Previous time measure
|
||||
double currentTime = 0.0; // Current time measure
|
||||
double updateDrawTime = 0.0; // Update + Draw time
|
||||
double waitTime = 0.0; // Wait time (if target fps required)
|
||||
float deltaTime = 0.0f; // Frame time (Update + Draw + Wait time)
|
||||
|
||||
float timeCounter = 0.0f; // Accumulative time counter (seconds)
|
||||
float position = 0.0f; // Circle position
|
||||
bool pause = false; // Pause control flag
|
||||
|
||||
int targetFPS = 60; // Our initial target fps
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
||||
|
||||
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
|
||||
else if (IsKeyPressed(KEY_DOWN)) targetFPS -= 20;
|
||||
|
||||
if (targetFPS < 0) targetFPS = 0;
|
||||
|
||||
if (!pause)
|
||||
{
|
||||
position += 200*deltaTime; // We move at 200 pixels per second
|
||||
if (position >= GetScreenWidth()) position = 0;
|
||||
timeCounter += deltaTime; // We count time (seconds)
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
for (int i = 0; i < GetScreenWidth()/200; i++) DrawRectangle(200*i, 0, 1, GetScreenHeight(), SKYBLUE);
|
||||
|
||||
DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED);
|
||||
|
||||
DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
|
||||
DrawText(TextFormat("PosX: %03.0f", position), position - 50, GetScreenHeight()/2 + 40, 20, BLACK);
|
||||
|
||||
DrawText("Circle is moving at a constant 200 pixels/sec,\nindependently of the frame rate.", 10, 10, 20, DARKGRAY);
|
||||
DrawText("PRESS SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY);
|
||||
DrawText("PRESS UP | DOWN to CHANGE TARGET FPS", 10, GetScreenHeight() - 30, 20, GRAY);
|
||||
DrawText(TextFormat("TARGET FPS: %i", targetFPS), GetScreenWidth() - 220, 10, 20, LIME);
|
||||
DrawText(TextFormat("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
|
||||
|
||||
EndDrawing();
|
||||
|
||||
// NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL,
|
||||
// Events polling, screen buffer swap and frame time control must be managed by the user
|
||||
|
||||
SwapScreenBuffer(); // Flip the back buffer to screen (front buffer)
|
||||
|
||||
currentTime = GetTime();
|
||||
updateDrawTime = currentTime - previousTime;
|
||||
|
||||
if (targetFPS > 0) // We want a fixed frame rate
|
||||
{
|
||||
waitTime = (1.0f/(float)targetFPS) - updateDrawTime;
|
||||
if (waitTime > 0.0)
|
||||
{
|
||||
WaitTime((float)waitTime*1000.0f);
|
||||
currentTime = GetTime();
|
||||
deltaTime = (float)(currentTime - previousTime);
|
||||
}
|
||||
}
|
||||
else deltaTime = updateDrawTime; // Framerate could be variable
|
||||
|
||||
previousTime = currentTime;
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_custom_frame_control.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -18,6 +18,7 @@
|
||||
#include "raylib.h"
|
||||
|
||||
// NOTE: Gamepad name ID depends on drivers and OS
|
||||
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
||||
#if defined(PLATFORM_RPI)
|
||||
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||
@@ -57,102 +58,102 @@ int main(void)
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||
if (IsGamepadAvailable(0))
|
||||
{
|
||||
DrawText(TextFormat("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
||||
DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK);
|
||||
|
||||
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
||||
if (TextIsEqual(GetGamepadName(0), XBOX360_NAME_ID) || TextIsEqual(GetGamepadName(0), XBOX360_LEGACY_NAME_ID))
|
||||
{
|
||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||
|
||||
// Draw buttons: xbox home
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
|
||||
|
||||
// Draw buttons: basic
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
|
||||
|
||||
// Draw buttons: d-pad
|
||||
DrawRectangle(317, 202, 19, 71, BLACK);
|
||||
DrawRectangle(293, 228, 69, 19, BLACK);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||
|
||||
// Draw buttons: left-right back
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
||||
|
||||
// Draw axis: left joystick
|
||||
DrawCircle(259, 152, 39, BLACK);
|
||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_X)*20),
|
||||
152 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||
DrawCircle(259 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20),
|
||||
152 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||
|
||||
// Draw axis: right joystick
|
||||
DrawCircle(461, 237, 38, BLACK);
|
||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||
237 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||
DrawCircle(461 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||
237 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||
DrawRectangle(604, 30, 15, 70, GRAY);
|
||||
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
|
||||
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
|
||||
DrawRectangle(170, 30, 15, (((1 + (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
|
||||
DrawRectangle(604, 30, 15, (((1 + (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
|
||||
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
}
|
||||
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||
else if (TextIsEqual(GetGamepadName(0), PS3_NAME_ID))
|
||||
{
|
||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||
|
||||
// Draw buttons: ps
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
|
||||
|
||||
// Draw buttons: basic
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
|
||||
|
||||
// Draw buttons: d-pad
|
||||
DrawRectangle(225, 132, 24, 84, BLACK);
|
||||
DrawRectangle(195, 161, 84, 25, BLACK);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||
|
||||
// Draw buttons: left-right back buttons
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
|
||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
|
||||
if (IsGamepadButtonDown(0, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
|
||||
|
||||
// Draw axis: left joystick
|
||||
DrawCircle(319, 255, 35, BLACK);
|
||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_X)*20),
|
||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||
DrawCircle(319 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X) * 20),
|
||||
255 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y) * 20), 25, BLACK);
|
||||
|
||||
// Draw axis: right joystick
|
||||
DrawCircle(475, 255, 35, BLACK);
|
||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||
DrawCircle(475 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||
255 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||
DrawRectangle(611, 48, 15, 70, GRAY);
|
||||
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
|
||||
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
|
||||
DrawRectangle(169, 48, 15, (((1 - (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
|
||||
DrawRectangle(611, 48, 15, (((1 - (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -161,11 +162,11 @@ int main(void)
|
||||
// TODO: Draw generic gamepad
|
||||
}
|
||||
|
||||
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
||||
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(0)), 10, 50, 10, MAROON);
|
||||
|
||||
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
||||
for (int i = 0; i < GetGamepadAxisCount(0); i++)
|
||||
{
|
||||
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(0, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||
}
|
||||
|
||||
if (GetGamepadButtonPressed() != -1) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||
@@ -191,4 +192,4 @@ int main(void)
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ int main(void)
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures");
|
||||
|
||||
Vector2 touchPosition = { 0, 0 };
|
||||
Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 };
|
||||
Rectangle touchArea = { 220, 10, screenWidth - 230.0f, screenHeight - 20.0f };
|
||||
|
||||
int gesturesCount = 0;
|
||||
char gestureStrings[MAX_GESTURE_STRINGS][32];
|
||||
|
@@ -33,9 +33,13 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) ballColor = MAROON;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE)) ballColor = LIME;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) ballColor = DARKBLUE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_SIDE)) ballColor = PURPLE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_EXTRA)) ballColor = YELLOW;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_FORWARD)) ballColor = ORANGE;
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_BACK)) ballColor = BEIGE;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@@ -24,11 +24,7 @@ int main(void)
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - input multitouch");
|
||||
|
||||
Vector2 ballPosition = { -100.0f, -100.0f };
|
||||
Color ballColor = BEIGE;
|
||||
|
||||
int touchCounter = 0;
|
||||
Vector2 touchPosition = { 0 };
|
||||
Vector2 touchPositions[MAX_TOUCH_POINTS] = { 0 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -38,19 +34,8 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
ballColor = BEIGE;
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||
if (IsMouseButtonDown(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) touchCounter = 10;
|
||||
if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) touchCounter = 10;
|
||||
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) touchCounter = 10;
|
||||
|
||||
if (touchCounter > 0) touchCounter--;
|
||||
// Get multiple touchpoints
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) touchPositions[i] = GetTouchPosition(i);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@@ -58,25 +43,19 @@ int main(void)
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Multitouch
|
||||
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
|
||||
{
|
||||
touchPosition = GetTouchPosition(i); // Get the touch point
|
||||
|
||||
if ((touchPosition.x >= 0) && (touchPosition.y >= 0)) // Make sure point is not (-1,-1) as this means there is no touch for it
|
||||
// Make sure point is not (0, 0) as this means there is no touch for it
|
||||
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
|
||||
{
|
||||
// Draw circle and touch index number
|
||||
DrawCircleV(touchPosition, 34, ORANGE);
|
||||
DrawText(TextFormat("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK);
|
||||
DrawCircleV(touchPositions[i], 34, ORANGE);
|
||||
DrawText(TextFormat("%d", i), (int)touchPositions[i].x - 10, (int)touchPositions[i].y - 70, 40, BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the normal mouse location
|
||||
DrawCircleV(ballPosition, 30 + (touchCounter*3), ballColor);
|
||||
|
||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY);
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 10, 20, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2020 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2020-2021 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -26,30 +26,42 @@ int main(void)
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - quat conversions");
|
||||
|
||||
|
||||
Camera3D camera = { 0 };
|
||||
camera.position = (Vector3){ 0.0f, 10.0f, 10.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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32);
|
||||
Model model = LoadModelFromMesh(mesh);
|
||||
|
||||
// Some required variables
|
||||
// Load a cylinder model for testing
|
||||
Model model = LoadModelFromMesh(GenMeshCylinder(0.2f, 1.0f, 32));
|
||||
|
||||
// Generic quaternion for operations
|
||||
Quaternion q1 = { 0 };
|
||||
Matrix m1 = { 0 }, m2 = { 0 }, m3 = { 0 }, m4 = { 0 };
|
||||
Vector3 v1 = { 0 }, v2 = { 0 };
|
||||
|
||||
// Transform matrices required to draw 4 cylinders
|
||||
Matrix m1 = { 0 };
|
||||
Matrix m2 = { 0 };
|
||||
Matrix m3 = { 0 };
|
||||
Matrix m4 = { 0 };
|
||||
|
||||
// Generic vectors for rotations
|
||||
Vector3 v1 = { 0 };
|
||||
Vector3 v2 = { 0 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (v2.x < 0) v2.x += PI*2;
|
||||
if (v2.y < 0) v2.y += PI*2;
|
||||
if (v2.z < 0) v2.z += PI*2;
|
||||
|
||||
if (!IsKeyDown(KEY_SPACE))
|
||||
{
|
||||
v1.x += 0.01f;
|
||||
@@ -60,60 +72,50 @@ int main(void)
|
||||
if (v1.x > PI*2) v1.x -= PI*2;
|
||||
if (v1.y > PI*2) v1.y -= PI*2;
|
||||
if (v1.z > PI*2) v1.z -= PI*2;
|
||||
|
||||
|
||||
q1 = QuaternionFromEuler(v1.x, v1.y, v1.z);
|
||||
m1 = MatrixRotateZYX(v1);
|
||||
m2 = QuaternionToMatrix(q1);
|
||||
|
||||
q1 = QuaternionFromMatrix(m1);
|
||||
m3 = QuaternionToMatrix(q1);
|
||||
|
||||
v2 = QuaternionToEuler(q1);
|
||||
v2.x *= DEG2RAD;
|
||||
v2.y *= DEG2RAD;
|
||||
v2.z *= DEG2RAD;
|
||||
|
||||
|
||||
v2 = QuaternionToEuler(q1); // Angles returned in radians
|
||||
|
||||
m4 = MatrixRotateZYX(v2);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
model.transform = m1;
|
||||
DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m2;
|
||||
DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m3;
|
||||
DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED);
|
||||
|
||||
model.transform = m4;
|
||||
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (v2.x < 0) v2.x += PI*2;
|
||||
if (v2.y < 0) v2.y += PI*2;
|
||||
if (v2.z < 0) v2.z += PI*2;
|
||||
|
||||
Color cx,cy,cz;
|
||||
cx = cy = cz = BLACK;
|
||||
if (v1.x == v2.x) cx = GREEN;
|
||||
if (v1.y == v2.y) cy = GREEN;
|
||||
if (v1.z == v2.z) cz = GREEN;
|
||||
|
||||
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, cx);
|
||||
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, cy);
|
||||
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, cz);
|
||||
|
||||
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, cx);
|
||||
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, cy);
|
||||
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, cz);
|
||||
EndMode3D();
|
||||
|
||||
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
||||
|
||||
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
|
||||
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -122,7 +124,7 @@ int main(void)
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadModel(model); // Unload model data (mesh and materials)
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -20,10 +20,12 @@ int main(void)
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
|
||||
|
||||
int framesCounter = 0; // Variable used to count frames
|
||||
// SetRandomSeed(0xaabbccff); // Set a custom random seed if desired, by default: "time(NULL)"
|
||||
|
||||
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||
|
||||
|
||||
int framesCounter = 0; // Variable used to count frames
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -46,7 +46,7 @@ int main(void)
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
if (scissorMode) BeginScissorMode(scissorArea.x, scissorArea.y, scissorArea.width, scissorArea.height);
|
||||
if (scissorMode) BeginScissorMode((int)scissorArea.x, (int)scissorArea.y, (int)scissorArea.width, (int)scissorArea.height);
|
||||
|
||||
// Draw full screen rectangle and some text
|
||||
// NOTE: Only part defined by scissor area will be rendered
|
||||
|
117
examples/core/core_smooth_pixelperfect.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - smooth pixel-perfect camera
|
||||
*
|
||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) and
|
||||
* reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <math.h> // Required for: sinf(), cosf()
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
const int virtualScreenWidth = 160;
|
||||
const int virtualScreenHeight = 90;
|
||||
|
||||
const float virtualRatio = (float)screenWidth/(float)virtualScreenWidth;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - smooth pixel-perfect camera");
|
||||
|
||||
Camera2D worldSpaceCamera = { 0 }; // Game world camera
|
||||
worldSpaceCamera.zoom = 1.0f;
|
||||
|
||||
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
|
||||
screenSpaceCamera.zoom = 1.0f;
|
||||
|
||||
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
|
||||
|
||||
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
|
||||
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };
|
||||
Rectangle rec03 = { 80.0f, 65.0f, 15.0f, 25.0f };
|
||||
|
||||
// The target's height is flipped (in the source Rectangle), due to OpenGL reasons
|
||||
Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
|
||||
Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
|
||||
|
||||
Vector2 origin = { 0.0f, 0.0f };
|
||||
|
||||
float rotation = 0.0f;
|
||||
|
||||
float cameraX = 0.0f;
|
||||
float cameraY = 0.0f;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
rotation += 60.0f*GetFrameTime(); // Rotate the rectangles, 60 degrees per second
|
||||
|
||||
// Make the camera move to demonstrate the effect
|
||||
cameraX = (sinf(GetTime())*50.0f) - 10.0f;
|
||||
cameraY = cosf(GetTime())*30.0f;
|
||||
|
||||
// Set the camera's target to the values computed above
|
||||
screenSpaceCamera.target = (Vector2){ cameraX, cameraY };
|
||||
|
||||
// Round worldSpace coordinates, keep decimals into screenSpace coordinates
|
||||
worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x;
|
||||
screenSpaceCamera.target.x -= worldSpaceCamera.target.x;
|
||||
screenSpaceCamera.target.x *= virtualRatio;
|
||||
|
||||
worldSpaceCamera.target.y = (int)screenSpaceCamera.target.y;
|
||||
screenSpaceCamera.target.y -= worldSpaceCamera.target.y;
|
||||
screenSpaceCamera.target.y *= virtualRatio;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode2D(worldSpaceCamera);
|
||||
DrawRectanglePro(rec01, origin, rotation, BLACK);
|
||||
DrawRectanglePro(rec02, origin, -rotation, RED);
|
||||
DrawRectanglePro(rec03, origin, rotation + 45.0f, BLUE);
|
||||
EndMode2D();
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RED);
|
||||
|
||||
BeginMode2D(screenSpaceCamera);
|
||||
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||
EndMode2D();
|
||||
|
||||
DrawText(TextFormat("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE);
|
||||
DrawText(TextFormat("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN);
|
||||
DrawFPS(GetScreenWidth() - 95, 10);
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_smooth_pixelperfect.png
Normal file
After Width: | Height: | Size: 15 KiB |
155
examples/core/core_split_screen.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - split screen
|
||||
*
|
||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Jeffery Myers (@JeffM2501)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
Texture2D textureGrid = { 0 };
|
||||
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)
|
||||
{
|
||||
DrawCubeTexture(textureGrid, (Vector3) { x, 1.5f, z }, 1, 1, 1, GREEN);
|
||||
DrawCubeTexture(textureGrid, (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);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
|
||||
|
||||
// Generate a simple texture to use for trees
|
||||
Image img = GenImageChecked(256, 256, 32, 32, DARKGRAY, WHITE);
|
||||
textureGrid = LoadTextureFromImage(img);
|
||||
UnloadImage(img);
|
||||
SetTextureFilter(textureGrid, TEXTURE_FILTER_ANISOTROPIC_16X);
|
||||
SetTextureWrap(textureGrid, TEXTURE_WRAP_CLAMP);
|
||||
|
||||
// Setup player 1 camera and screen
|
||||
cameraPlayer1.fovy = 45.0f;
|
||||
cameraPlayer1.up.y = 1.0f;
|
||||
cameraPlayer1.target.y = 1.0f;
|
||||
cameraPlayer1.position.z = -3.0f;
|
||||
cameraPlayer1.position.y = 1.0f;
|
||||
|
||||
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
|
||||
|
||||
// Setup player two camera and screen
|
||||
cameraPlayer2.fovy = 45.0f;
|
||||
cameraPlayer2.up.y = 1.0f;
|
||||
cameraPlayer2.target.y = 3.0f;
|
||||
cameraPlayer2.position.x = -3.0f;
|
||||
cameraPlayer2.position.y = 3.0f;
|
||||
|
||||
RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth / 2, screenHeight);
|
||||
|
||||
// Build a flipped rectangle the size of the split view to use for drawing later
|
||||
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
|
||||
|
||||
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 anyone moves this frame, how far will they move based on the time since the last frame
|
||||
// this moves thigns at 10 world units per second, regardless of the actual FPS
|
||||
float offsetThisFrame = 10.0f*GetFrameTime();
|
||||
|
||||
// Move Player1 forward and backwards (no turning)
|
||||
if (IsKeyDown(KEY_W))
|
||||
{
|
||||
cameraPlayer1.position.z += offsetThisFrame;
|
||||
cameraPlayer1.target.z += offsetThisFrame;
|
||||
}
|
||||
else if (IsKeyDown(KEY_S))
|
||||
{
|
||||
cameraPlayer1.position.z -= offsetThisFrame;
|
||||
cameraPlayer1.target.z -= offsetThisFrame;
|
||||
}
|
||||
|
||||
// Move Player2 forward and backwards (no turning)
|
||||
if (IsKeyDown(KEY_UP))
|
||||
{
|
||||
cameraPlayer2.position.x += offsetThisFrame;
|
||||
cameraPlayer2.target.x += offsetThisFrame;
|
||||
}
|
||||
else if (IsKeyDown(KEY_DOWN))
|
||||
{
|
||||
cameraPlayer2.position.x -= offsetThisFrame;
|
||||
cameraPlayer2.target.x -= offsetThisFrame;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
// Draw Player1 view to the render texture
|
||||
BeginTextureMode(screenPlayer1);
|
||||
ClearBackground(SKYBLUE);
|
||||
BeginMode3D(cameraPlayer1);
|
||||
DrawScene();
|
||||
EndMode3D();
|
||||
DrawText("PLAYER1 W/S to move", 10, 10, 20, RED);
|
||||
EndTextureMode();
|
||||
|
||||
// Draw Player2 view to the render texture
|
||||
BeginTextureMode(screenPlayer2);
|
||||
ClearBackground(SKYBLUE);
|
||||
BeginMode3D(cameraPlayer2);
|
||||
DrawScene();
|
||||
EndMode3D();
|
||||
DrawText("PLAYER2 UP/DOWN to move", 10, 10, 20, BLUE);
|
||||
EndTextureMode();
|
||||
|
||||
// Draw both views render textures to the screen side by side
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
||||
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(screenPlayer1); // Unload render texture
|
||||
UnloadRenderTexture(screenPlayer2); // Unload render texture
|
||||
UnloadTexture(textureGrid); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/core/core_split_screen.png
Normal file
After Width: | Height: | Size: 21 KiB |
@@ -2,19 +2,19 @@
|
||||
*
|
||||
* raylib [core] example - VR Simulator (Oculus Rift CV1 parameters)
|
||||
*
|
||||
* This example has been created using raylib 1.7 (www.raylib.com)
|
||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2017-2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
@@ -25,48 +25,68 @@ int main(void)
|
||||
const int screenHeight = 450;
|
||||
|
||||
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
|
||||
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - vr simulator");
|
||||
|
||||
// Init VR simulator (Oculus Rift CV1 parameters)
|
||||
InitVrSimulator();
|
||||
// VR device parameters definition
|
||||
VrDeviceInfo device = {
|
||||
// Oculus Rift CV1 parameters for simulator
|
||||
.hResolution = 2160, // Horizontal resolution in pixels
|
||||
.vResolution = 1200, // Vertical resolution in pixels
|
||||
.hScreenSize = 0.133793f, // Horizontal size in meters
|
||||
.vScreenSize = 0.0669f, // Vertical size in meters
|
||||
.vScreenCenter = 0.04678f, // Screen center in meters
|
||||
.eyeToScreenDistance = 0.041f, // Distance between eye and display in meters
|
||||
.lensSeparationDistance = 0.07f, // Lens separation distance in meters
|
||||
.interpupillaryDistance = 0.07f, // IPD (distance between pupils) in meters
|
||||
|
||||
VrDeviceInfo hmd = { 0 }; // VR device parameters (head-mounted-device)
|
||||
// NOTE: CV1 uses fresnel-hybrid-asymmetric lenses with specific compute shaders
|
||||
// Following parameters are just an approximation to CV1 distortion stereo rendering
|
||||
.lensDistortionValues[0] = 1.0f, // Lens distortion constant parameter 0
|
||||
.lensDistortionValues[1] = 0.22f, // Lens distortion constant parameter 1
|
||||
.lensDistortionValues[2] = 0.24f, // Lens distortion constant parameter 2
|
||||
.lensDistortionValues[3] = 0.0f, // Lens distortion constant parameter 3
|
||||
.chromaAbCorrection[0] = 0.996f, // Chromatic aberration correction parameter 0
|
||||
.chromaAbCorrection[1] = -0.004f, // Chromatic aberration correction parameter 1
|
||||
.chromaAbCorrection[2] = 1.014f, // Chromatic aberration correction parameter 2
|
||||
.chromaAbCorrection[3] = 0.0f, // Chromatic aberration correction parameter 3
|
||||
};
|
||||
|
||||
// Oculus Rift CV1 parameters for simulator
|
||||
hmd.hResolution = 2160; // HMD horizontal resolution in pixels
|
||||
hmd.vResolution = 1200; // HMD vertical resolution in pixels
|
||||
hmd.hScreenSize = 0.133793f; // HMD horizontal size in meters
|
||||
hmd.vScreenSize = 0.0669f; // HMD vertical size in meters
|
||||
hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
|
||||
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
|
||||
hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
|
||||
hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
|
||||
|
||||
// NOTE: CV1 uses a Fresnel-hybrid-asymmetric lenses with specific distortion compute shaders.
|
||||
// Following parameters are an approximation to distortion stereo rendering but results differ from actual device.
|
||||
hmd.lensDistortionValues[0] = 1.0f; // HMD lens distortion constant parameter 0
|
||||
hmd.lensDistortionValues[1] = 0.22f; // HMD lens distortion constant parameter 1
|
||||
hmd.lensDistortionValues[2] = 0.24f; // HMD lens distortion constant parameter 2
|
||||
hmd.lensDistortionValues[3] = 0.0f; // HMD lens distortion constant parameter 3
|
||||
hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
|
||||
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
|
||||
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
|
||||
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
|
||||
// Load VR stereo config for VR device parameteres (Oculus Rift CV1 parameters)
|
||||
VrStereoConfig config = LoadVrStereoConfig(device);
|
||||
|
||||
// Distortion shader (uses device lens distortion and chroma)
|
||||
Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION));
|
||||
|
||||
SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering
|
||||
// Update distortion shader with lens and distortion-scale parameters
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"),
|
||||
config.leftLensCenter, SHADER_UNIFORM_VEC2);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "rightLensCenter"),
|
||||
config.rightLensCenter, SHADER_UNIFORM_VEC2);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "leftScreenCenter"),
|
||||
config.leftScreenCenter, SHADER_UNIFORM_VEC2);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "rightScreenCenter"),
|
||||
config.rightScreenCenter, SHADER_UNIFORM_VEC2);
|
||||
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "scale"),
|
||||
config.scale, SHADER_UNIFORM_VEC2);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "scaleIn"),
|
||||
config.scaleIn, SHADER_UNIFORM_VEC2);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "deviceWarpParam"),
|
||||
device.lensDistortionValues, SHADER_UNIFORM_VEC4);
|
||||
SetShaderValue(distortion, GetShaderLocation(distortion, "chromaAbParam"),
|
||||
device.chromaAbCorrection, SHADER_UNIFORM_VEC4);
|
||||
|
||||
// Initialize framebuffer for stereo rendering
|
||||
// NOTE: Screen size should match HMD aspect ratio
|
||||
RenderTexture2D target = LoadRenderTexture(GetScreenWidth(), GetScreenHeight());
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector
|
||||
camera.fovy = 60.0f; // Camera field-of-view Y
|
||||
camera.type = CAMERA_PERSPECTIVE; // Camera type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -81,42 +101,42 @@ int main(void)
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera (simulator mode)
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginVrDrawing();
|
||||
|
||||
BeginVrStereoMode(config);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(40, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
EndVrDrawing();
|
||||
|
||||
EndVrStereoMode();
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginShaderMode(distortion);
|
||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
|
||||
(float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
||||
EndShaderMode();
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadShader(distortion); // Unload distortion shader
|
||||
UnloadVrStereoConfig(config); // Unload stereo config
|
||||
|
||||
CloseVrSimulator(); // Close VR simulator
|
||||
UnloadRenderTexture(target); // Unload stereo render fbo
|
||||
UnloadShader(distortion); // Unload distortion shader
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
@@ -36,12 +36,12 @@ int main(void)
|
||||
*/
|
||||
|
||||
// Set configuration flags for window creation
|
||||
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
|
||||
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
|
||||
|
||||
Vector2 ballPosition = { GetScreenWidth() / 2, GetScreenHeight() / 2 };
|
||||
Vector2 ballPosition = { GetScreenWidth() / 2.0f, GetScreenHeight() / 2.0f };
|
||||
Vector2 ballSpeed = { 5.0f, 4.0f };
|
||||
int ballRadius = 20;
|
||||
float ballRadius = 20;
|
||||
|
||||
int framesCounter = 0;
|
||||
|
||||
@@ -139,13 +139,13 @@ int main(void)
|
||||
else ClearBackground(RAYWHITE);
|
||||
|
||||
DrawCircleV(ballPosition, ballRadius, MAROON);
|
||||
DrawRectangleLinesEx((Rectangle) { 0, 0, GetScreenWidth(), GetScreenHeight() }, 4, RAYWHITE);
|
||||
DrawRectangleLinesEx((Rectangle) { 0, 0, (float)GetScreenWidth(), (float)GetScreenHeight() }, 4, RAYWHITE);
|
||||
|
||||
DrawCircleV(GetMousePosition(), 10, DARKBLUE);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
DrawText(FormatText("Screen Size: [%i, %i]", GetScreenWidth(), GetScreenHeight()), 10, 40, 10, GREEN);
|
||||
DrawText(TextFormat("Screen Size: [%i, %i]", GetScreenWidth(), GetScreenHeight()), 10, 40, 10, GREEN);
|
||||
|
||||
// Draw window state info
|
||||
DrawText("Following flags can be set after window creation:", 10, 60, 10, GRAY);
|
||||
|
@@ -43,16 +43,16 @@ int main(void)
|
||||
|
||||
// Render texture initialization, used to hold the rendering result so we can easily resize it
|
||||
RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight);
|
||||
SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use
|
||||
SetTextureFilter(target.texture, TEXTURE_FILTER_BILINEAR); // Texture scale filter to use
|
||||
|
||||
Color colors[10] = { 0 };
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -64,48 +64,48 @@ int main(void)
|
||||
// Recalculate random colors for the bars
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||
}
|
||||
|
||||
|
||||
// Update virtual mouse (clamped mouse value behind game screen)
|
||||
Vector2 mouse = GetMousePosition();
|
||||
Vector2 virtualMouse = { 0 };
|
||||
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
|
||||
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
|
||||
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight });
|
||||
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ (float)gameScreenWidth, (float)gameScreenHeight });
|
||||
|
||||
// Apply the same transformation as the virtual mouse to the real mouse (i.e. to work with raygui)
|
||||
//SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth*scale))*0.5f, -(GetScreenHeight() - (gameScreenHeight*scale))*0.5f);
|
||||
//SetMouseScale(1/scale, 1/scale);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
// Draw everything in the render texture, note this will not be rendered on screen, yet
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(RAYWHITE); // Clear render texture background color
|
||||
|
||||
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
|
||||
|
||||
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
||||
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
||||
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
||||
EndTextureMode();
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
ClearBackground(BLACK); // Clear screen background
|
||||
|
||||
// Draw everything in the render texture, note this will not be rendered on screen, yet
|
||||
BeginTextureMode(target);
|
||||
|
||||
ClearBackground(RAYWHITE); // Clear render texture background color
|
||||
|
||||
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
|
||||
|
||||
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
||||
|
||||
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
||||
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
||||
|
||||
EndTextureMode();
|
||||
|
||||
// Draw RenderTexture2D to window, properly scaled
|
||||
// Draw render texture to screen, properly scaled
|
||||
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height },
|
||||
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5,
|
||||
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f,
|
||||
(float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||
|
||||
EndDrawing();
|
||||
//--------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
@@ -26,7 +26,7 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 45.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
Vector2 cubeScreenPosition = { 0.0f, 0.0f };
|
||||
@@ -62,7 +62,7 @@ int main(void)
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, cubeScreenPosition.y, 20, BLACK);
|
||||
DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK);
|
||||
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))/2, 25, 20, GRAY);
|
||||
|
||||
EndDrawing();
|
||||
|
@@ -17,7 +17,7 @@ uniform vec2 leftScreenCenter;
|
||||
uniform vec2 rightScreenCenter;
|
||||
uniform vec2 scale;
|
||||
uniform vec2 scaleIn;
|
||||
uniform vec4 hmdWarpParam;
|
||||
uniform vec4 deviceWarpParam;
|
||||
uniform vec4 chromaAbParam;
|
||||
|
||||
void main()
|
||||
@@ -27,7 +27,7 @@ void main()
|
||||
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
|
||||
vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
|
||||
float rSq = theta.x*theta.x + theta.y*theta.y;
|
||||
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
|
||||
vec2 tcBlue = lensCenter + scale*thetaBlue;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ uniform vec2 leftScreenCenter = vec2(0.25, 0.5);
|
||||
uniform vec2 rightScreenCenter = vec2(0.75, 0.5);
|
||||
uniform vec2 scale = vec2(0.25, 0.45);
|
||||
uniform vec2 scaleIn = vec2(4, 2.2222);
|
||||
uniform vec4 hmdWarpParam = vec4(1, 0.22, 0.24, 0);
|
||||
uniform vec4 deviceWarpParam = vec4(1, 0.22, 0.24, 0);
|
||||
uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0);
|
||||
|
||||
void main()
|
||||
@@ -28,7 +28,7 @@ void main()
|
||||
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
|
||||
vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
|
||||
float rSq = theta.x*theta.x + theta.y*theta.y;
|
||||
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq);
|
||||
vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
|
||||
vec2 tcBlue = lensCenter + scale*thetaBlue;
|
||||
|
||||
|
@@ -1,39 +1,39 @@
|
||||
/*
|
||||
WELCOME raylib EXAMPLES CONTRIBUTOR!
|
||||
|
||||
This is a bsasic template to anyone ready to contribute with some code example for the library,
|
||||
|
||||
This is a basic template to anyone ready to contribute with some code example for the library,
|
||||
here there are some guidelines on how to create an example to be included in raylib
|
||||
|
||||
1. File naming: <module>_<description> - Lower case filename, words separated by underscore,
|
||||
no more than 3-4 words in total to describe the example. <module> referes to the primary
|
||||
raylib module the example is more related with (code, shapes, textures, models, shaders, raudio).
|
||||
i.e: core_input_multitouch, shapes_lines_bezier, shaders_palette_switch
|
||||
|
||||
|
||||
2. Follow below template structure, example info should list the module, the short description
|
||||
and the author of the example, twitter or github info could be also provided for the author.
|
||||
Short description should also be used on the title of the window.
|
||||
|
||||
|
||||
3. Code should be organized by sections:[Initialization]- [Update] - [Draw] - [De-Initialization]
|
||||
Place your code between the dotted lines for every section, please don't mix update logic with drawing
|
||||
and remember to unload all loaded resources.
|
||||
|
||||
|
||||
4. Code should follow raylib conventions: https://github.com/raysan5/raylib/wiki/raylib-coding-conventions
|
||||
Try to be very organized, using line-breaks appropiately.
|
||||
|
||||
|
||||
5. Add comments to the specific parts of code the example is focus on.
|
||||
Don't abuse with comments, try to be clear and impersonal on the comments.
|
||||
|
||||
|
||||
6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies.
|
||||
Try to avoid defining functions outside the main(). Example should be as self-contained as possible.
|
||||
|
||||
|
||||
7. About external resources, they should be placed in a [resources] folder and those resources
|
||||
should be open and free for use and distribution. Avoid propietary content.
|
||||
|
||||
|
||||
8. Try to keep the example simple but with a creative touch.
|
||||
Simple but beautiful examples are more appealing to users!
|
||||
|
||||
|
||||
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
|
||||
|
||||
|
||||
10. Have fun!
|
||||
*/
|
||||
|
||||
@@ -41,16 +41,18 @@
|
||||
*
|
||||
* raylib [core] example - Basic window
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* This example has been created using raylib 3.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2019 Ramon Santamaria (@raysan5)
|
||||
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 <user_name> (@<user_github>)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -58,9 +60,9 @@ int main()
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
|
||||
// TODO: Load resources / Initialize variables at this point
|
||||
|
||||
|
||||
// TODO: Load resources / Initialize variables at this point
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
@@ -79,7 +81,7 @@ int main()
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// TODO: Draw everything that requires to be drawn at this point:
|
||||
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); // Example
|
||||
|
||||
EndDrawing();
|
||||
@@ -88,11 +90,11 @@ int main()
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// TODO: Unload all loaded resources at this point
|
||||
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
@@ -37,17 +37,17 @@ int main(void)
|
||||
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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
|
||||
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
|
||||
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
|
||||
Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data
|
||||
Texture2D texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
|
||||
SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
// Load animation data
|
||||
int animsCount = 0;
|
||||
ModelAnimation *anims = LoadModelAnimations("resources/guy/guyanim.iqm", &animsCount);
|
||||
unsigned int animsCount = 0;
|
||||
ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
|
||||
int animFrameCounter = 0;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
||||
@@ -100,9 +100,9 @@ int main(void)
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
|
||||
|
||||
// Unload model animations data
|
||||
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
for (unsigned int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
RL_FREE(anims);
|
||||
|
||||
UnloadModel(model); // Unload model
|
||||
|
@@ -26,7 +26,7 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 45.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
|
||||
Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard
|
||||
|
@@ -31,7 +31,7 @@ int main(void)
|
||||
|
||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||
|
||||
@@ -62,7 +62,7 @@ int main(void)
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4.0f - 20, 20.0f }, 0.0f, 4.0f, WHITE);
|
||||
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
||||
|
||||
DrawText("cubicmap image used to", 658, 90, 10, GRAY);
|
||||
|
@@ -32,14 +32,13 @@ int main(void)
|
||||
|
||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
// Get map image data to be used for collision detection
|
||||
Color *mapPixels = GetImageData(imMap);
|
||||
Color *mapPixels = LoadImageColors(imMap);
|
||||
UnloadImage(imMap); // Unload image from RAM
|
||||
|
||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||
Vector3 playerPosition = camera.position; // Set player position
|
||||
|
||||
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set camera mode
|
||||
|
||||
@@ -93,13 +92,10 @@ int main(void)
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, mapPosition, 1.0f, WHITE); // Draw maze map
|
||||
//DrawCubeV(playerPosition, (Vector3){ 0.2f, 0.4f, 0.2f }, RED); // Draw player
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||
DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4.0f - 20, 20.0f }, 0.0f, 4.0f, WHITE);
|
||||
DrawRectangleLines(GetScreenWidth() - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
||||
|
||||
// Draw player position radar
|
||||
@@ -113,13 +109,13 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
free(mapPixels); // Unload color array
|
||||
UnloadImageColors(mapPixels); // Unload color array
|
||||
|
||||
UnloadTexture(cubicmap); // Unload cubicmap texture
|
||||
UnloadTexture(texture); // Unload map texture
|
||||
UnloadModel(model); // Unload map model
|
||||
UnloadTexture(cubicmap); // Unload cubicmap texture
|
||||
UnloadTexture(texture); // Unload map texture
|
||||
UnloadModel(model); // Unload map model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
@@ -26,7 +26,7 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 45.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@@ -29,7 +29,7 @@ int main(void)
|
||||
Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM)
|
||||
Model model = LoadModelFromMesh(mesh); // Load model from generated mesh
|
||||
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Define model position
|
||||
|
||||
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||
|
@@ -4,17 +4,19 @@
|
||||
*
|
||||
* raylib supports multiple models file formats:
|
||||
*
|
||||
* - OBJ > Text file, must include vertex position-texcoords-normals information,
|
||||
* if files references some .mtl materials file, it will be loaded (or try to)
|
||||
* - GLTF > Modern text/binary file format, includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data
|
||||
* - IQM > Binary file format including mesh vertex data but also animation data,
|
||||
* raylib can load .iqm animations.
|
||||
* - OBJ > Text file format. Must include vertex position-texcoords-normals information,
|
||||
* if files references some .mtl materials file, it will be loaded (or try to).
|
||||
* - GLTF > Text/binary file format. Includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data.
|
||||
* - IQM > Binary file format. Includes mesh vertex data but also animation data,
|
||||
* raylib can load .iqm animations.
|
||||
* - VOX > Binary file format. MagikaVoxel mesh format:
|
||||
* https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt
|
||||
*
|
||||
* This example has been created using raylib 2.6 (www.raylib.com)
|
||||
* This example has been created using raylib 4.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -35,15 +37,15 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 10.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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/models/castle.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
Model model = LoadModel("resources/models/obj/castle.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/castle_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
BoundingBox bounds = MeshBoundingBox(model.meshes[0]); // Set model bounds
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
BoundingBox bounds = GetMeshBoundingBox(model.meshes[0]); // Set model bounds
|
||||
|
||||
// NOTE: bounds are calculated from the original size of the model,
|
||||
// if model is scaled on drawing, bounds must be also scaled
|
||||
@@ -61,7 +63,7 @@ int main(void)
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
|
||||
|
||||
// Load new models/textures on drag&drop
|
||||
if (IsFileDropped())
|
||||
{
|
||||
@@ -72,14 +74,16 @@ int main(void)
|
||||
{
|
||||
if (IsFileExtension(droppedFiles[0], ".obj") ||
|
||||
IsFileExtension(droppedFiles[0], ".gltf") ||
|
||||
IsFileExtension(droppedFiles[0], ".glb") ||
|
||||
IsFileExtension(droppedFiles[0], ".vox") ||
|
||||
IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported
|
||||
{
|
||||
UnloadModel(model); // Unload previous model
|
||||
model = LoadModel(droppedFiles[0]); // Load new model
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
|
||||
|
||||
bounds = GetMeshBoundingBox(model.meshes[0]);
|
||||
|
||||
bounds = MeshBoundingBox(model.meshes[0]);
|
||||
|
||||
// TODO: Move camera position from target enough distance to visualize model properly
|
||||
}
|
||||
else if (IsFileExtension(droppedFiles[0], ".png")) // Texture file formats supported
|
||||
@@ -87,7 +91,7 @@ int main(void)
|
||||
// Unload current model texture and load new one
|
||||
UnloadTexture(texture);
|
||||
texture = LoadTexture(droppedFiles[0]);
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,10 +99,10 @@ int main(void)
|
||||
}
|
||||
|
||||
// Select model on mouse click
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
// Check collision between ray and box
|
||||
if (CheckCollisionRayBox(GetMouseRay(GetMousePosition(), camera), bounds)) selected = !selected;
|
||||
if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
|
||||
else selected = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -118,7 +122,7 @@ int main(void)
|
||||
if (selected) DrawBoundingBox(bounds, GREEN); // Draw selection box
|
||||
|
||||
EndMode3D();
|
||||
|
||||
|
||||
DrawText("Drag & drop model to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
||||
if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN);
|
||||
|
||||
|
105
examples/models/models_loading_gltf.c
Normal file
@@ -0,0 +1,105 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - Load models gltf
|
||||
*
|
||||
* This example has been created using raylib 3.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* NOTE: To export a model from Blender, make sure it is not posed, the vertices need to be
|
||||
* in the same position as they would be in edit mode.
|
||||
* Also make sure the scale parameter of your models is set to 0.0,
|
||||
* scaling can be applied from the export menu.
|
||||
*
|
||||
* Example contributed by Hristo Stamenov (@object71) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Hristo Stamenov (@object71) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define MAX_GLTF_MODELS 8
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - model");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 10.0f, 10.0f, 10.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 mode type
|
||||
|
||||
// Load some models
|
||||
Model model[MAX_GLTF_MODELS] = { 0 };
|
||||
model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb");
|
||||
model[1] = LoadModel("resources/models/gltf/rigged_figure.glb");
|
||||
model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb");
|
||||
model[3] = LoadModel("resources/models/gltf/BoxAnimated.glb");
|
||||
model[4] = LoadModel("resources/models/gltf/AnimatedTriangle.gltf");
|
||||
model[5] = LoadModel("resources/models/gltf/AnimatedMorphCube.glb");
|
||||
model[6] = LoadModel("resources/models/gltf/vertex_colored_object.glb");
|
||||
model[7] = LoadModel("resources/models/gltf/girl.glb");
|
||||
|
||||
int currentModel = 0;
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
||||
|
||||
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); // Update our camera with inputs
|
||||
|
||||
if (IsKeyReleased(KEY_RIGHT))
|
||||
{
|
||||
currentModel++;
|
||||
if (currentModel == MAX_GLTF_MODELS) currentModel = 0;
|
||||
}
|
||||
|
||||
if (IsKeyReleased(KEY_LEFT))
|
||||
{
|
||||
currentModel--;
|
||||
if (currentModel < 0) currentModel = MAX_GLTF_MODELS - 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(SKYBLUE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model[currentModel], position, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
EndMode3D();
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < MAX_GLTF_MODELS; i++) UnloadModel(model[i]); // Unload models
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/models/models_loading_gltf.png
Normal file
After Width: | Height: | Size: 21 KiB |
130
examples/models/models_loading_vox.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - Load models vox (MagicaVoxel)
|
||||
*
|
||||
* This example has been created using raylib 4.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Johann Nadalutti (@procfxgen) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include "raymath.h" // Required for: MatrixTranslate()
|
||||
|
||||
#define MAX_VOX_FILES 3
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
const char *voxFileNames[] = {
|
||||
"resources/models/vox/chr_knight.vox",
|
||||
"resources/models/vox/chr_sword.vox",
|
||||
"resources/models/vox/monu9.vox"
|
||||
};
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - magicavoxel loading");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 10.0f, 10.0f, 10.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 mode type
|
||||
|
||||
// Load MagicaVoxel files
|
||||
Model models[MAX_VOX_FILES] = { 0 };
|
||||
|
||||
for (int i = 0; i < MAX_VOX_FILES; i++)
|
||||
{
|
||||
// Load VOX file and measure time
|
||||
double t0 = GetTime()*1000.0;
|
||||
models[i] = LoadModel(voxFileNames[i]);
|
||||
double t1 = GetTime()*1000.0;
|
||||
|
||||
TraceLog(LOG_WARNING, TextFormat("[%s] File loaded in %.3f ms", voxFileNames[i], t1 - t0));
|
||||
|
||||
// Compute model translation matrix to center model on draw position (0, 0 , 0)
|
||||
BoundingBox bb = GetModelBoundingBox(models[i]);
|
||||
Vector3 center = { 0 };
|
||||
center.x = bb.min.x + (((bb.max.x - bb.min.x)/2));
|
||||
center.z = bb.min.z + (((bb.max.z - bb.min.z)/2));
|
||||
|
||||
Matrix matTranslate = MatrixTranslate(-center.x, 0, -center.z);
|
||||
models[i].transform = matTranslate;
|
||||
}
|
||||
|
||||
int currentModel = 0;
|
||||
|
||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
|
||||
|
||||
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); // Update our camera to orbit
|
||||
|
||||
// Cycle between models on mouse click
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES;
|
||||
|
||||
// Cycle between models on key pressed
|
||||
if (IsKeyPressed(KEY_RIGHT))
|
||||
{
|
||||
currentModel++;
|
||||
if (currentModel >= MAX_VOX_FILES) currentModel = 0;
|
||||
}
|
||||
else if (IsKeyPressed(KEY_LEFT))
|
||||
{
|
||||
currentModel--;
|
||||
if (currentModel < 0) currentModel = MAX_VOX_FILES - 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Draw 3D model
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(models[currentModel], (Vector3){ 0, 0, 0 }, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
// Display info
|
||||
DrawRectangle(10, 400, 310, 30, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(10, 400, 310, 30, Fade(DARKBLUE, 0.5f));
|
||||
DrawText("MOUSE LEFT BUTTON to CYCLE VOX MODELS", 40, 410, 10, BLUE);
|
||||
DrawText(TextFormat("File: %s", GetFileName(voxFileNames[currentModel])), 10, 10, 20, GRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Unload models data (GPU VRAM)
|
||||
for (int i = 0; i < MAX_VOX_FILES; i++) UnloadModel(models[i]);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
BIN
examples/models/models_loading_vox.png
Normal file
After Width: | Height: | Size: 23 KiB |
@@ -1,232 +0,0 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [models] example - PBR material
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||
*
|
||||
* This example has been created using raylib 1.8 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define RLIGHTS_IMPLEMENTATION
|
||||
#include "rlights.h"
|
||||
|
||||
#define CUBEMAP_SIZE 1024 // Cubemap texture size
|
||||
#define IRRADIANCE_SIZE 32 // Irradiance texture size
|
||||
#define PREFILTERED_SIZE 256 // Prefiltered HDR environment texture size
|
||||
#define BRDF_SIZE 512 // BRDF LUT texture size
|
||||
|
||||
// PBR material loading
|
||||
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness);
|
||||
|
||||
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 [models] example - pbr material");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.5f, 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.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
// Load model and PBR material
|
||||
Model model = LoadModel("resources/pbr/trooper.obj");
|
||||
|
||||
// Mesh tangents are generated... and uploaded to GPU
|
||||
// NOTE: New VBO for tangents is generated at default location and also binded to mesh VAO
|
||||
//MeshTangents(&model.meshes[0]);
|
||||
|
||||
model.materials[0] = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
|
||||
|
||||
// Create lights
|
||||
// NOTE: Lights are added to an internal lights pool automatically
|
||||
CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.materials[0].shader);
|
||||
|
||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
||||
|
||||
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); // Update camera
|
||||
|
||||
// Send to material PBR shader camera view position
|
||||
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
||||
SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadMaterial(model.materials[0]); // Unload material: shader and textures
|
||||
|
||||
UnloadModel(model); // Unload model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Load PBR material (Supports: ALBEDO, NORMAL, METALNESS, ROUGHNESS, AO, EMMISIVE, HEIGHT maps)
|
||||
// NOTE: PBR shader is loaded inside this function
|
||||
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
||||
{
|
||||
Material mat = LoadMaterialDefault(); // Initialize material to default
|
||||
|
||||
// Load PBR shader (requires several maps)
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
mat.shader = LoadShader("resources/shaders/glsl330/pbr.vs", "resources/shaders/glsl330/pbr.fs");
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
mat.shader = LoadShader("resources/shaders/glsl100/pbr.vs", "resources/shaders/glsl100/pbr.fs");
|
||||
#endif
|
||||
|
||||
// Get required locations points for PBR material
|
||||
// NOTE: Those location names must be available and used in the shader code
|
||||
mat.shader.locs[LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
|
||||
mat.shader.locs[LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
|
||||
mat.shader.locs[LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
|
||||
mat.shader.locs[LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
|
||||
mat.shader.locs[LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
|
||||
//mat.shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
|
||||
//mat.shader.locs[LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
|
||||
mat.shader.locs[LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
|
||||
mat.shader.locs[LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
|
||||
mat.shader.locs[LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
|
||||
|
||||
// Set view matrix location
|
||||
mat.shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel");
|
||||
//mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
|
||||
mat.shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
|
||||
|
||||
// Set PBR standard maps
|
||||
mat.maps[MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
|
||||
mat.maps[MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
|
||||
mat.maps[MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
|
||||
mat.maps[MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
|
||||
mat.maps[MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
|
||||
|
||||
// Set textures filtering for better quality
|
||||
SetTextureFilter(mat.maps[MAP_ALBEDO].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MAP_NORMAL].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MAP_METALNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MAP_ROUGHNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MAP_OCCLUSION].texture, FILTER_BILINEAR);
|
||||
|
||||
// Enable sample usage in shader for assigned textures
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "metalness.useSampler"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "roughness.useSampler"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "occlusion.useSampler"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
|
||||
int renderModeLoc = GetShaderLocation(mat.shader, "renderMode");
|
||||
SetShaderValue(mat.shader, renderModeLoc, (int[1]){ 0 }, UNIFORM_INT);
|
||||
|
||||
// Set up material properties color
|
||||
mat.maps[MAP_ALBEDO].color = albedo;
|
||||
mat.maps[MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
|
||||
mat.maps[MAP_METALNESS].value = metalness;
|
||||
mat.maps[MAP_ROUGHNESS].value = roughness;
|
||||
mat.maps[MAP_OCCLUSION].value = 1.0f;
|
||||
mat.maps[MAP_EMISSION].value = 0.5f;
|
||||
mat.maps[MAP_HEIGHT].value = 0.5f;
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Texture2D panorama = LoadTexture("resources/dresden_square.hdr");
|
||||
// Load equirectangular to cubemap shader
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
Shader shdrCubemap = LoadShader("resources/shaders/glsl330/cubemap.vs", "resources/shaders/glsl330/cubemap.fs");
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs");
|
||||
#endif
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT);
|
||||
TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, UNCOMPRESSED_R32G32B32);
|
||||
UnloadTexture(panorama);
|
||||
UnloadShader(shdrCubemap);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate irradiance map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load irradiance (GI) calculation shader
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
Shader shdrIrradiance = LoadShader("resources/shaders/glsl330/skybox.vs", "resources/shaders/glsl330/irradiance.fs");
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
Shader shdrIrradiance = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/irradiance.fs");
|
||||
#endif
|
||||
SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, UNIFORM_INT);
|
||||
mat.maps[MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
|
||||
UnloadShader(shdrIrradiance);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate prefilter map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load reflection prefilter calculation shader
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
Shader shdrPrefilter = LoadShader("resources/shaders/glsl330/skybox.vs", "resources/shaders/glsl330/prefilter.fs");
|
||||
#else
|
||||
Shader shdrPrefilter = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/prefilter.fs");
|
||||
#endif
|
||||
SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, UNIFORM_INT);
|
||||
mat.maps[MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
|
||||
UnloadTexture(cubemap);
|
||||
UnloadShader(shdrPrefilter);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Generate BRDF (bidirectional reflectance distribution function) texture (using shader)
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
Shader shdrBRDF = LoadShader("resources/shaders/glsl330/brdf.vs", "resources/shaders/glsl330/brdf.fs");
|
||||
#else
|
||||
Shader shdrBRDF = LoadShader("resources/shaders/glsl100/brdf.vs", "resources/shaders/glsl100/brdf.fs");
|
||||
#endif
|
||||
mat.maps[MAP_BRDF].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE);
|
||||
UnloadShader(shdrBRDF);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
return mat;
|
||||
}
|
Before Width: | Height: | Size: 317 KiB |
@@ -11,7 +11,58 @@
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define NUM_MODELS 8 // Parametric 3d shapes to generate
|
||||
#define NUM_MODELS 9 // Parametric 3d shapes to generate
|
||||
|
||||
void AllocateMeshData(Mesh* mesh, int triangleCount)
|
||||
{
|
||||
mesh->vertexCount = triangleCount * 3;
|
||||
mesh->triangleCount = triangleCount;
|
||||
|
||||
mesh->vertices = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float));
|
||||
mesh->texcoords = (float*)MemAlloc(mesh->vertexCount * 2 * sizeof(float));
|
||||
mesh->normals = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float));
|
||||
}
|
||||
|
||||
// generate a simple triangle mesh from code
|
||||
Mesh MakeMesh()
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
AllocateMeshData(&mesh, 1);
|
||||
|
||||
// vertex at the origin
|
||||
mesh.vertices[0] = 0;
|
||||
mesh.vertices[1] = 0;
|
||||
mesh.vertices[2] = 0;
|
||||
mesh.normals[0] = 0;
|
||||
mesh.normals[1] = 1;
|
||||
mesh.normals[2] = 0;
|
||||
mesh.texcoords[0] = 0;
|
||||
mesh.texcoords[1] = 0;
|
||||
|
||||
// vertex at 1,0,2
|
||||
mesh.vertices[3] = 1;
|
||||
mesh.vertices[4] = 0;
|
||||
mesh.vertices[5] = 2;
|
||||
mesh.normals[3] = 0;
|
||||
mesh.normals[4] = 1;
|
||||
mesh.normals[5] = 0;
|
||||
mesh.texcoords[2] = 0.5f;
|
||||
mesh.texcoords[3] = 1.0f;
|
||||
|
||||
// vertex at 2,0,0
|
||||
mesh.vertices[6] = 2;
|
||||
mesh.vertices[7] = 0;
|
||||
mesh.vertices[8] = 0;
|
||||
mesh.normals[6] = 0;
|
||||
mesh.normals[7] = 1;
|
||||
mesh.normals[8] = 0;
|
||||
mesh.texcoords[4] = 1;
|
||||
mesh.texcoords[5] =0;
|
||||
|
||||
UploadMesh(&mesh, false);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@@ -37,9 +88,10 @@ int main(void)
|
||||
models[5] = LoadModelFromMesh(GenMeshTorus(0.25f, 4.0f, 16, 32));
|
||||
models[6] = LoadModelFromMesh(GenMeshKnot(1.0f, 2.0f, 16, 128));
|
||||
models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f));
|
||||
models[8] = LoadModelFromMesh(MakeMesh());
|
||||
|
||||
// Set checked texture as default diffuse component for all models material
|
||||
for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MAP_DIFFUSE].texture = texture;
|
||||
for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = { { 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
|
||||
@@ -61,7 +113,7 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update internal camera and our camera
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures
|
||||
}
|
||||
@@ -86,9 +138,8 @@ int main(void)
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(models[currentModel], position, 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0);
|
||||
DrawModel(models[currentModel], position, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
@@ -106,6 +157,7 @@ int main(void)
|
||||
case 5: DrawText("TORUS", 680, 10, 20, DARKBLUE); break;
|
||||
case 6: DrawText("KNOT", 680, 10, 20, DARKBLUE); break;
|
||||
case 7: DrawText("POLY", 680, 10, 20, DARKBLUE); break;
|
||||
case 8: DrawText("Parametric(custom)", 580, 10, 20, DARKBLUE); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@@ -31,26 +31,34 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Ray ray = { 0 }; // Picking ray
|
||||
|
||||
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
|
||||
tower.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
Model tower = LoadModel("resources/models/obj/turret.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
|
||||
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
|
||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
BoundingBox towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
|
||||
bool hitMeshBBox = false;
|
||||
bool hitTriangle = false;
|
||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
BoundingBox towerBBox = GetMeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
|
||||
|
||||
// Ground quad
|
||||
Vector3 g0 = (Vector3){ -50.0f, 0.0f, -50.0f };
|
||||
Vector3 g1 = (Vector3){ -50.0f, 0.0f, 50.0f };
|
||||
Vector3 g2 = (Vector3){ 50.0f, 0.0f, 50.0f };
|
||||
Vector3 g3 = (Vector3){ 50.0f, 0.0f, -50.0f };
|
||||
|
||||
// Test triangle
|
||||
Vector3 ta = (Vector3){ -25.0, 0.5, 0.0 };
|
||||
Vector3 tb = (Vector3){ -4.0, 2.5, 1.0 };
|
||||
Vector3 tc = (Vector3){ -8.0, 6.5, 0.0 };
|
||||
Vector3 ta = (Vector3){ -25.0f, 0.5f, 0.0f };
|
||||
Vector3 tb = (Vector3){ -4.0f, 2.5f, 1.0f };
|
||||
Vector3 tc = (Vector3){ -8.0f, 6.5f, 0.0f };
|
||||
|
||||
Vector3 bary = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// Test sphere
|
||||
Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f };
|
||||
float sr = 4.0f;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
@@ -63,59 +71,67 @@ int main(void)
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
// Display information about closest hit
|
||||
RayHitInfo nearestHit = { 0 };
|
||||
RayCollision collision = { 0 };
|
||||
char *hitObjectName = "None";
|
||||
nearestHit.distance = FLT_MAX;
|
||||
nearestHit.hit = false;
|
||||
collision.distance = FLT_MAX;
|
||||
collision.hit = false;
|
||||
Color cursorColor = WHITE;
|
||||
|
||||
// Get ray and test against ground, triangle, and mesh
|
||||
// Get ray and test against objects
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
|
||||
// Check ray collision aginst ground plane
|
||||
RayHitInfo groundHitInfo = GetCollisionRayGround(ray, 0.0f);
|
||||
// Check ray collision against ground quad
|
||||
RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
|
||||
|
||||
if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance))
|
||||
if ((groundHitInfo.hit) && (groundHitInfo.distance < collision.distance))
|
||||
{
|
||||
nearestHit = groundHitInfo;
|
||||
collision = groundHitInfo;
|
||||
cursorColor = GREEN;
|
||||
hitObjectName = "Ground";
|
||||
}
|
||||
|
||||
// Check ray collision against test triangle
|
||||
RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, ta, tb, tc);
|
||||
RayCollision triHitInfo = GetRayCollisionTriangle(ray, ta, tb, tc);
|
||||
|
||||
if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance))
|
||||
if ((triHitInfo.hit) && (triHitInfo.distance < collision.distance))
|
||||
{
|
||||
nearestHit = triHitInfo;
|
||||
collision = triHitInfo;
|
||||
cursorColor = PURPLE;
|
||||
hitObjectName = "Triangle";
|
||||
|
||||
bary = Vector3Barycenter(nearestHit.position, ta, tb, tc);
|
||||
hitTriangle = true;
|
||||
bary = Vector3Barycenter(collision.point, ta, tb, tc);
|
||||
}
|
||||
else hitTriangle = false;
|
||||
|
||||
RayHitInfo meshHitInfo = { 0 };
|
||||
// Check ray collision against test sphere
|
||||
RayCollision sphereHitInfo = GetRayCollisionSphere(ray, sp, sr);
|
||||
|
||||
if ((sphereHitInfo.hit) && (sphereHitInfo.distance < collision.distance))
|
||||
{
|
||||
collision = sphereHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Sphere";
|
||||
}
|
||||
|
||||
// Check ray collision against bounding box first, before trying the full ray-mesh test
|
||||
if (CheckCollisionRayBox(ray, towerBBox))
|
||||
RayCollision boxHitInfo = GetRayCollisionBox(ray, towerBBox);
|
||||
|
||||
if ((boxHitInfo.hit) && (boxHitInfo.distance < collision.distance))
|
||||
{
|
||||
hitMeshBBox = true;
|
||||
collision = boxHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Box";
|
||||
|
||||
// Check ray collision against model
|
||||
// NOTE: It considers model.transform matrix!
|
||||
meshHitInfo = GetCollisionRayModel(ray, tower);
|
||||
RayCollision meshHitInfo = GetRayCollisionModel(ray, tower);
|
||||
|
||||
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
||||
if (meshHitInfo.hit)
|
||||
{
|
||||
nearestHit = meshHitInfo;
|
||||
collision = meshHitInfo;
|
||||
cursorColor = ORANGE;
|
||||
hitObjectName = "Mesh";
|
||||
}
|
||||
}
|
||||
|
||||
hitMeshBBox = false;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@@ -128,7 +144,7 @@ int main(void)
|
||||
|
||||
// Draw the tower
|
||||
// WARNING: If scale is different than 1.0f,
|
||||
// not considered by GetCollisionRayModel()
|
||||
// not considered by GetRayCollisionModel()
|
||||
DrawModel(tower, towerPos, 1.0f, WHITE);
|
||||
|
||||
// Draw the test triangle
|
||||
@@ -136,21 +152,24 @@ int main(void)
|
||||
DrawLine3D(tb, tc, PURPLE);
|
||||
DrawLine3D(tc, ta, PURPLE);
|
||||
|
||||
// Draw the test sphere
|
||||
DrawSphereWires(sp, sr, 8, 8, PURPLE);
|
||||
|
||||
// Draw the mesh bbox if we hit it
|
||||
if (hitMeshBBox) DrawBoundingBox(towerBBox, LIME);
|
||||
if (boxHitInfo.hit) DrawBoundingBox(towerBBox, LIME);
|
||||
|
||||
// If we hit something, draw the cursor at the hit point
|
||||
if (nearestHit.hit)
|
||||
if (collision.hit)
|
||||
{
|
||||
DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor);
|
||||
DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RED);
|
||||
DrawCube(collision.point, 0.3f, 0.3f, 0.3f, cursorColor);
|
||||
DrawCubeWires(collision.point, 0.3f, 0.3f, 0.3f, RED);
|
||||
|
||||
Vector3 normalEnd;
|
||||
normalEnd.x = nearestHit.position.x + nearestHit.normal.x;
|
||||
normalEnd.y = nearestHit.position.y + nearestHit.normal.y;
|
||||
normalEnd.z = nearestHit.position.z + nearestHit.normal.z;
|
||||
normalEnd.x = collision.point.x + collision.normal.x;
|
||||
normalEnd.y = collision.point.y + collision.normal.y;
|
||||
normalEnd.z = collision.point.z + collision.normal.z;
|
||||
|
||||
DrawLine3D(nearestHit.position, normalEnd, RED);
|
||||
DrawLine3D(collision.point, normalEnd, RED);
|
||||
}
|
||||
|
||||
DrawRay(ray, MAROON);
|
||||
@@ -162,23 +181,24 @@ int main(void)
|
||||
// Draw some debug GUI text
|
||||
DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
||||
|
||||
if (nearestHit.hit)
|
||||
if (collision.hit)
|
||||
{
|
||||
int ypos = 70;
|
||||
|
||||
DrawText(TextFormat("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
||||
DrawText(TextFormat("Distance: %3.2f", collision.distance), 10, ypos, 10, BLACK);
|
||||
|
||||
DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f",
|
||||
nearestHit.position.x,
|
||||
nearestHit.position.y,
|
||||
nearestHit.position.z), 10, ypos + 15, 10, BLACK);
|
||||
collision.point.x,
|
||||
collision.point.y,
|
||||
collision.point.z), 10, ypos + 15, 10, BLACK);
|
||||
|
||||
DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f",
|
||||
nearestHit.normal.x,
|
||||
nearestHit.normal.y,
|
||||
nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
collision.normal.x,
|
||||
collision.normal.y,
|
||||
collision.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
|
||||
if (hitTriangle) DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
if (triHitInfo.hit && TextIsEqual(hitObjectName, "Triangle"))
|
||||
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
}
|
||||
|
||||
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
||||
|
@@ -40,15 +40,15 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_SPACE))
|
||||
{
|
||||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
if (camera.projection == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
camera.fovy = WIDTH_ORTHOGRAPHIC;
|
||||
camera.type = CAMERA_ORTHOGRAPHIC;
|
||||
camera.projection = CAMERA_ORTHOGRAPHIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
camera.fovy = FOVY_PERSPECTIVE;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -81,8 +81,8 @@ int main(void)
|
||||
|
||||
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY);
|
||||
|
||||
if (camera.type == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK);
|
||||
else if (camera.type == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK);
|
||||
if (camera.projection == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK);
|
||||
else if (camera.projection == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#include "raylib.h"
|
||||
#include "rlgl.h"
|
||||
|
||||
#include <math.h> // Required for: cosf(), sinf()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//------------------------------------------------------------------------------------
|
||||
@@ -43,7 +45,7 @@ int main(void)
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 45.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
SetCameraMode(camera, CAMERA_FREE);
|
||||
|
||||
@@ -86,7 +88,6 @@ int main(void)
|
||||
rlPushMatrix();
|
||||
rlRotatef(earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun
|
||||
rlTranslatef(earthOrbitRadius, 0.0f, 0.0f); // Translation for Earth orbit
|
||||
rlRotatef(-earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun inverted
|
||||
|
||||
rlPushMatrix();
|
||||
rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself
|
||||
@@ -97,7 +98,6 @@ int main(void)
|
||||
|
||||
rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth
|
||||
rlTranslatef(moonOrbitRadius, 0.0f, 0.0f); // Translation for Moon orbit
|
||||
rlRotatef(-moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth inverted
|
||||
rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself
|
||||
rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon
|
||||
|
||||
@@ -136,6 +136,10 @@ void DrawSphereBasic(Color color)
|
||||
int rings = 16;
|
||||
int slices = 16;
|
||||
|
||||
// Make sure there is enough space in the internal render batch
|
||||
// buffer to store all required vertex, batch is reseted if required
|
||||
rlCheckRenderBatchLimit((rings + 2)*slices*6);
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
|
@@ -11,6 +11,18 @@
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include "rlgl.h"
|
||||
#include "raymath.h" // Required for: MatrixPerspective(), MatrixLookAt()
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
// Generate cubemap (6 faces) from equirectangular (panorama) texture
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
@@ -27,36 +39,48 @@ int main(void)
|
||||
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
Model skybox = LoadModelFromMesh(cube);
|
||||
|
||||
bool useHDR = true;
|
||||
|
||||
// Load skybox shader and set required locations
|
||||
// NOTE: Some locations are automatically set at shader loading
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
skybox.materials[0].shader = LoadShader("resources/shaders/glsl330/skybox.vs", "resources/shaders/glsl330/skybox.fs");
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs");
|
||||
#endif
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MAP_CUBEMAP }, UNIFORM_INT);
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ 1 }, UNIFORM_INT);
|
||||
skybox.materials[0].shader = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/skybox.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MATERIAL_MAP_CUBEMAP }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "doGamma"), (int[1]) { useHDR ? 1 : 0 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ useHDR ? 1 : 0 }, SHADER_UNIFORM_INT);
|
||||
|
||||
// Load cubemap shader and setup required shader locations
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
Shader shdrCubemap = LoadShader("resources/shaders/glsl330/cubemap.vs", "resources/shaders/glsl330/cubemap.fs");
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs");
|
||||
#endif
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT);
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/cubemap.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/cubemap.fs", GLSL_VERSION));
|
||||
|
||||
// Load HDR panorama (sphere) texture
|
||||
char panoFileName[256] = { 0 };
|
||||
TextCopy(panoFileName, "resources/dresden_square_2k.hdr");
|
||||
Texture2D panorama = LoadTexture(panoFileName);
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
|
||||
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
||||
// NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment,
|
||||
// despite texture can be successfully created.. so using UNCOMPRESSED_R8G8B8A8 instead of UNCOMPRESSED_R32G32B32A32
|
||||
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
||||
char skyboxFileName[256] = { 0 };
|
||||
|
||||
Texture2D panorama;
|
||||
|
||||
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
||||
if (useHDR)
|
||||
{
|
||||
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
|
||||
|
||||
// Load HDR panorama (sphere) texture
|
||||
panorama = LoadTexture(skyboxFileName);
|
||||
|
||||
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
||||
// NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment,
|
||||
// despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
|
||||
//UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
|
||||
}
|
||||
else
|
||||
{
|
||||
Image img = LoadImage("resources/skybox.png");
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT); // CUBEMAP_LAYOUT_PANORAMA
|
||||
UnloadImage(img);
|
||||
}
|
||||
|
||||
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
|
||||
|
||||
@@ -69,7 +93,7 @@ int main(void)
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
|
||||
// Load new cubemap texture on drag&drop
|
||||
if (IsFileDropped())
|
||||
{
|
||||
@@ -81,13 +105,23 @@ int main(void)
|
||||
if (IsFileExtension(droppedFiles[0], ".png;.jpg;.hdr;.bmp;.tga"))
|
||||
{
|
||||
// Unload current cubemap texture and load new one
|
||||
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture);
|
||||
panorama = LoadTexture(droppedFiles[0]);
|
||||
TextCopy(panoFileName, droppedFiles[0]);
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8);
|
||||
UnloadTexture(panorama);
|
||||
UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
|
||||
if (useHDR)
|
||||
{
|
||||
Texture2D panorama = LoadTexture(droppedFiles[0]);
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
UnloadTexture(panorama);
|
||||
}
|
||||
else
|
||||
{
|
||||
Image img = LoadImage(droppedFiles[0]);
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT);
|
||||
UnloadImage(img);
|
||||
}
|
||||
|
||||
TextCopy(skyboxFileName, droppedFiles[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,11 +136,23 @@ int main(void)
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
||||
DrawGrid(10, 1.0f);
|
||||
EndMode3D();
|
||||
|
||||
DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(panoFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
// We are inside the cube, we need to disable backface culling!
|
||||
rlDisableBackfaceCulling();
|
||||
rlDisableDepthMask();
|
||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
||||
rlEnableBackfaceCulling();
|
||||
rlEnableDepthMask();
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
//DrawTextureEx(panorama, (Vector2){ 0, 0 }, 0.0f, 0.5f, WHITE);
|
||||
|
||||
if (useHDR) DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
else DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
@@ -116,8 +162,8 @@ int main(void)
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadShader(skybox.materials[0].shader);
|
||||
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture);
|
||||
|
||||
UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
|
||||
|
||||
UnloadModel(skybox); // Unload skybox model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
@@ -125,3 +171,92 @@ int main(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Generate cubemap texture from HDR texture
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
|
||||
{
|
||||
TextureCubemap cubemap = { 0 };
|
||||
|
||||
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
|
||||
|
||||
// STEP 1: Setup framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
cubemap.id = rlLoadTextureCubemap(0, size, format);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
|
||||
|
||||
// Check if framebuffer is complete with attachments (valid)
|
||||
if (rlFramebufferComplete(fbo)) TraceLog(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", fbo);
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 2: Draw to framebuffer
|
||||
//------------------------------------------------------------------------------------------
|
||||
// NOTE: Shader is used to convert HDR equirectangular environment map to cubemap equivalent (6 faces)
|
||||
rlEnableShader(shader.id);
|
||||
|
||||
// Define projection matrix and send it to shader
|
||||
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
|
||||
|
||||
// Define view matrix for every side of the cubemap
|
||||
Matrix fboViews[6] = {
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
|
||||
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
|
||||
};
|
||||
|
||||
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
|
||||
|
||||
// Activate and enable texture for drawing to cubemap faces
|
||||
rlActiveTextureSlot(0);
|
||||
rlEnableTexture(panorama.id);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
// Set the view matrix for the current cube face
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
|
||||
// Select the current cubemap face attachment for the fbo
|
||||
// WARNING: This function by default enables->attach->disables fbo!!!
|
||||
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
|
||||
rlEnableFramebuffer(fbo);
|
||||
|
||||
// Load and draw a cube, it uses the current enabled texture
|
||||
rlClearScreenBuffers();
|
||||
rlLoadDrawCube();
|
||||
|
||||
// ALTERNATIVE: Try to use internal batch system to draw the cube instead of rlLoadDrawCube
|
||||
// for some reason this method does not work, maybe due to cube triangles definition? normals pointing out?
|
||||
// TODO: Investigate this issue...
|
||||
//rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
|
||||
//rlClearScreenBuffers();
|
||||
//DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
|
||||
//rlDrawRenderBatchActive();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: Unload framebuffer and reset state
|
||||
//------------------------------------------------------------------------------------------
|
||||
rlDisableShader(); // Unbind shader
|
||||
rlDisableTexture(); // Unbind texture
|
||||
rlDisableFramebuffer(); // Unbind framebuffer
|
||||
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
|
||||
|
||||
// Reset viewport dimensions to default
|
||||
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
|
||||
rlEnableBackfaceCulling();
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
cubemap.width = size;
|
||||
cubemap.height = size;
|
||||
cubemap.mipmaps = 1;
|
||||
cubemap.format = format;
|
||||
|
||||
return cubemap;
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ int main()
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
camera.fovy = 70.0f;
|
||||
camera.type = CAMERA_PERSPECTIVE;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
// Specify the amount of blocks in each direction
|
||||
const int numBlocks = 15;
|
||||
@@ -53,7 +53,7 @@ int main()
|
||||
camera.position.x = (float)cos(cameraTime)*40.0f;
|
||||
camera.position.z = (float)sin(cameraTime)*40.0f;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
@@ -64,11 +64,11 @@ int main()
|
||||
|
||||
DrawGrid(10, 5.0f);
|
||||
|
||||
for (int x = 0; x < numBlocks; x++)
|
||||
for (int x = 0; x < numBlocks; x++)
|
||||
{
|
||||
for (int y = 0; y < numBlocks; y++)
|
||||
for (int y = 0; y < numBlocks; y++)
|
||||
{
|
||||
for (int z = 0; z < numBlocks; z++)
|
||||
for (int z = 0; z < numBlocks; z++)
|
||||
{
|
||||
// Scale of the blocks depends on x/y/z positions
|
||||
float blockScale = (x + y + z)/30.0f;
|
||||
@@ -94,9 +94,9 @@ int main()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EndMode3D();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
|
@@ -7,15 +7,13 @@
|
||||
*
|
||||
* Example contributed by Berni (@Berni8k) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2017 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2017-2021 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
// Draw angle gauge controls
|
||||
void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[], Color color);
|
||||
#include "raymath.h" // Required for: MatrixRotateXYZ()
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@@ -24,27 +22,19 @@ int main(void)
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
//SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)");
|
||||
|
||||
Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png");
|
||||
Texture2D texBackground = LoadTexture("resources/background.png");
|
||||
Texture2D texPitch = LoadTexture("resources/pitch.png");
|
||||
Texture2D texPlane = LoadTexture("resources/plane.png");
|
||||
|
||||
RenderTexture2D framebuffer = LoadRenderTexture(192, 192);
|
||||
|
||||
// Model loading
|
||||
Model model = LoadModel("resources/plane.obj"); // Load OBJ model
|
||||
model.materials[0].maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
|
||||
|
||||
GenTextureMipmaps(&model.materials[0].maps[MAP_DIFFUSE].texture);
|
||||
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective
|
||||
camera.target = (Vector3){ 0.0f, 12.0f, 0.0f }; // Camera looking at point
|
||||
camera.position = (Vector3){ 0.0f, 50.0f, -120.0f };// Camera position perspective
|
||||
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 = 30.0f; // Camera field-of-view Y
|
||||
camera.type = CAMERA_PERSPECTIVE; // Camera type
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
|
||||
Model model = LoadModel("resources/models/obj/plane.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
float pitch = 0.0f;
|
||||
float roll = 0.0f;
|
||||
@@ -58,14 +48,13 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Plane roll (x-axis) controls
|
||||
if (IsKeyDown(KEY_LEFT)) roll += 1.0f;
|
||||
else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f;
|
||||
// Plane pitch (x-axis) controls
|
||||
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
|
||||
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
|
||||
else
|
||||
{
|
||||
if (roll > 0.0f) roll -= 0.5f;
|
||||
else if (roll < 0.0f) roll += 0.5f;
|
||||
if (pitch > 0.3f) pitch -= 0.3f;
|
||||
else if (pitch < -0.3f) pitch += 0.3f;
|
||||
}
|
||||
|
||||
// Plane yaw (y-axis) controls
|
||||
@@ -77,89 +66,41 @@ int main(void)
|
||||
else if (yaw < 0.0f) yaw += 0.5f;
|
||||
}
|
||||
|
||||
// Plane pitch (z-axis) controls
|
||||
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
|
||||
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
|
||||
// Plane roll (z-axis) controls
|
||||
if (IsKeyDown(KEY_LEFT)) roll += 1.0f;
|
||||
else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f;
|
||||
else
|
||||
{
|
||||
if (pitch > 0.3f) pitch -= 0.3f;
|
||||
else if (pitch < -0.3f) pitch += 0.3f;
|
||||
if (roll > 0.0f) roll -= 0.5f;
|
||||
else if (roll < 0.0f) roll += 0.5f;
|
||||
}
|
||||
|
||||
// Wraps the phase of an angle to fit between -180 and +180 degrees
|
||||
int pitchOffset = pitch;
|
||||
while (pitchOffset > 180) pitchOffset -= 360;
|
||||
while (pitchOffset < -180) pitchOffset += 360;
|
||||
pitchOffset *= 10;
|
||||
|
||||
/* matrix transform done with multiplication to combine rotations
|
||||
Matrix transform = MatrixIdentity();
|
||||
|
||||
transform = MatrixMultiply(transform, MatrixRotateZ(DEG2RAD*roll));
|
||||
transform = MatrixMultiply(transform, MatrixRotateX(DEG2RAD*pitch));
|
||||
transform = MatrixMultiply(transform, MatrixRotateY(DEG2RAD*yaw));
|
||||
|
||||
model.transform = transform;
|
||||
*/
|
||||
// matrix created from multiple axes at once
|
||||
model.transform = MatrixRotateXYZ((Vector3){DEG2RAD*pitch,DEG2RAD*yaw,DEG2RAD*roll});
|
||||
|
||||
// Tranformation matrix for rotations
|
||||
model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll });
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Draw framebuffer texture (Ahrs Display)
|
||||
int centerX = framebuffer.texture.width/2;
|
||||
int centerY = framebuffer.texture.height/2;
|
||||
|
||||
BeginTextureMode(framebuffer);
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginBlendMode(BLEND_ALPHA);
|
||||
|
||||
DrawTexturePro(texBackground, (Rectangle){ 0, 0, texBackground.width, texBackground.height },
|
||||
(Rectangle){ centerX, centerY, texBackground.width, texBackground.height},
|
||||
(Vector2){ texBackground.width/2, texBackground.height/2 + pitchOffset }, roll, WHITE);
|
||||
|
||||
DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height },
|
||||
(Rectangle){ centerX, centerY, texPitch.width, texPitch.height },
|
||||
(Vector2){ texPitch.width/2, texPitch.height/2 + pitchOffset }, roll, WHITE);
|
||||
|
||||
DrawTexturePro(texPlane, (Rectangle){ 0, 0, texPlane.width, texPlane.height },
|
||||
(Rectangle){ centerX, centerY, texPlane.width, texPlane.height },
|
||||
(Vector2){ texPlane.width/2, texPlane.height/2 }, 0, WHITE);
|
||||
|
||||
EndBlendMode();
|
||||
|
||||
EndTextureMode();
|
||||
|
||||
// Draw 3D model (recomended to draw 3D always before 2D)
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, WHITE); // Draw 3d model with texture
|
||||
DrawModel(model, (Vector3){ 0.0f, -8.0f, 0.0f }, 1.0f, WHITE); // Draw 3d model with texture
|
||||
DrawGrid(10, 10.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
// Draw 2D GUI stuff
|
||||
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
|
||||
DrawAngleGauge(texAngleGauge, 190, 70, pitch, "pitch", GREEN);
|
||||
DrawAngleGauge(texAngleGauge, 300, 70, yaw, "yaw", SKYBLUE);
|
||||
// Draw controls info
|
||||
DrawRectangle(30, 370, 260, 70, Fade(GREEN, 0.5f));
|
||||
DrawRectangleLines(30, 370, 260, 70, Fade(DARKGREEN, 0.5f));
|
||||
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 380, 10, DARKGRAY);
|
||||
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 400, 10, DARKGRAY);
|
||||
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 420, 10, DARKGRAY);
|
||||
|
||||
DrawRectangle(30, 360, 260, 70, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(30, 360, 260, 70, Fade(DARKBLUE, 0.5f));
|
||||
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, DARKGRAY);
|
||||
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 390, 10, DARKGRAY);
|
||||
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, DARKGRAY);
|
||||
|
||||
// Draw framebuffer texture
|
||||
DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height },
|
||||
(Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(WHITE, 0.8f));
|
||||
|
||||
DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, DARKGRAY);
|
||||
DrawText("(c) WWI Plane Model created by GiaHanLam", screenWidth - 240, screenHeight - 20, 10, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -167,34 +108,10 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadModel(model); // Unload model data
|
||||
|
||||
// Unload all loaded data
|
||||
UnloadTexture(model.materials[0].maps[MAP_DIFFUSE].texture);
|
||||
UnloadModel(model);
|
||||
|
||||
UnloadRenderTexture(framebuffer);
|
||||
|
||||
UnloadTexture(texAngleGauge);
|
||||
UnloadTexture(texBackground);
|
||||
UnloadTexture(texPitch);
|
||||
UnloadTexture(texPlane);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Draw angle gauge controls
|
||||
void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[], Color color)
|
||||
{
|
||||
Rectangle srcRec = { 0, 0, angleGauge.width, angleGauge.height };
|
||||
Rectangle dstRec = { x, y, angleGauge.width, angleGauge.height };
|
||||
Vector2 origin = { angleGauge.width/2, angleGauge.height/2};
|
||||
int textSize = 20;
|
||||
|
||||
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
|
||||
|
||||
DrawText(TextFormat("%5.1f", angle), x - MeasureText(TextFormat("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
|
||||
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 143 KiB |
23
examples/models/resources/LICENSE.md
Normal file
@@ -0,0 +1,23 @@
|
||||
| resource | author | licence | notes |
|
||||
| :------------------- | :---------: | :------ | :---- |
|
||||
| models/obj/castle.obj,<br>models/castle_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/bridge.obj,<br>models/bridge_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/house.obj,<br>models/house_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/market.obj,<br>models/market_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/turret.obj,<br>models/turret_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/well.obj,<br>models/well_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
|
||||
| models/obj/cube.obj,<br>models/cube_diffuse.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/obj/plane.gltf,<br>models/gltf/plane/plane.bin,<br>models/gltf/plane/plane_diffuse.png | [GiaHanLam](https://sketchfab.com/GiaHanLam) | [CC-BY](https://creativecommons.org/licenses/by/4.0/) | Used by: [`models_yaw_pitch_roll.c`](https://github.com/raysan5/raylib/blob/master/examples/models/models_yaw_pitch_roll.c)
|
||||
| models/iqm/guy.iqm,<br>models/iqm/guyanim.iqm,<br>models/iqm/guytex.png,<br>models/iqm/guy.blend | [@culacant](https://github.com/culacant) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| models/iqm/vertex_colored_object.iqm | ❔ | ❔ | - |
|
||||
| models/gltf/... | _various_ | Check [LICENSE](https://github.com/raysan5/raylib/blob/master/examples/models/resources/models/gltf/LICENSE) | - |
|
||||
| models/vox/chr_knight.vox | ❔ | ❔ | - |
|
||||
| models/vox/chr_sword.vox | ❔ | ❔ | - |
|
||||
| models/vox/monu9.vox | ❔ | ❔ | - |
|
||||
| billboard.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| cubicmap_atlas.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| heightmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
|
||||
| dresden_square_1k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
|
||||
| dresden_square_2k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
|
||||
| skybox.png | ❔ | ❔ | - |
|
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.3 KiB |
@@ -1,4 +0,0 @@
|
||||
Medieval City models and textures have been created by Alberto Cano,
|
||||
and licensed as Creative Commons Attribution-NonCommercial 4.0.
|
||||
|
||||
Check for details: https://creativecommons.org/licenses/by-nc/4.0/legalcode
|