Compare commits
1090 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
17f09cb034 | ||
![]() |
a81dfabf86 | ||
![]() |
784aa1b6b5 | ||
![]() |
fda91436b5 | ||
![]() |
05f68c22d5 | ||
![]() |
0925f4ec4d | ||
![]() |
b8481369f7 | ||
![]() |
f1bcfc1352 | ||
![]() |
d1c9c34b2f | ||
![]() |
e8630c78d0 | ||
![]() |
d0fca7e02b | ||
![]() |
aa9353feb4 | ||
![]() |
0716125ee9 | ||
![]() |
918fc002d0 | ||
![]() |
bdbb1eb901 | ||
![]() |
481ce3d39d | ||
![]() |
85c400c006 | ||
![]() |
f0626324ab | ||
![]() |
6fa5dec16d | ||
![]() |
0603e59cae | ||
![]() |
6b072e696d | ||
![]() |
f7b706263a | ||
![]() |
c7f0350182 | ||
![]() |
b0d5a7a372 | ||
![]() |
bee283b12b | ||
![]() |
e23e73d9b2 | ||
![]() |
6f3186eacc | ||
![]() |
f18c8cea16 | ||
![]() |
41e49c5a6e | ||
![]() |
5d46c27cd5 | ||
![]() |
6d1b712a96 | ||
![]() |
9d3ad52160 | ||
![]() |
4123233f78 | ||
![]() |
a3d71dd58d | ||
![]() |
2b50440a77 | ||
![]() |
9fb6eda5f1 | ||
![]() |
38df2cad25 | ||
![]() |
4245237892 | ||
![]() |
773b0b6bc0 | ||
![]() |
66d22acfb3 | ||
![]() |
aa945055fa | ||
![]() |
ca96122a7b | ||
![]() |
ed4fdfdaf8 | ||
![]() |
3be81b01d7 | ||
![]() |
f2d61d4d43 | ||
![]() |
f16f39e8aa | ||
![]() |
80f6b2f963 | ||
![]() |
64f67f6e9f | ||
![]() |
6d3b11ef91 | ||
![]() |
3393fda384 | ||
![]() |
673dcf9436 | ||
![]() |
cc917fbac6 | ||
![]() |
16101ce3d8 | ||
![]() |
836d3341a5 | ||
![]() |
988d39029f | ||
![]() |
43fd9ffe08 | ||
![]() |
02842a3e2f | ||
![]() |
4ff98f34bb | ||
![]() |
5c80f65082 | ||
![]() |
137057f499 | ||
![]() |
6d34adbd60 | ||
![]() |
1142d4edae | ||
![]() |
b8ce680511 | ||
![]() |
0ce7f0c409 | ||
![]() |
d5e0f4e84e | ||
![]() |
8f60996b64 | ||
![]() |
a9315fc422 | ||
![]() |
1c05017548 | ||
![]() |
9e285d8dc3 | ||
![]() |
98d7a10c08 | ||
![]() |
4a3ed6d73c | ||
![]() |
b3bc4b21d1 | ||
![]() |
76a67a149e | ||
![]() |
97e3277d58 | ||
![]() |
648676f46b | ||
![]() |
5fecf5c088 | ||
![]() |
c384b375df | ||
![]() |
b1651baea5 | ||
![]() |
4c791100cc | ||
![]() |
5af1b4a7c9 | ||
![]() |
3396743aba | ||
![]() |
efa286a550 | ||
![]() |
b4a3f294bf | ||
![]() |
2a158c4795 | ||
![]() |
db6538859c | ||
![]() |
b082807b0b | ||
![]() |
637d3195ec | ||
![]() |
2ae9ce29eb | ||
![]() |
978c49472a | ||
![]() |
753b549aa5 | ||
![]() |
87fc7254e7 | ||
![]() |
65d4eb5e82 | ||
![]() |
4a65b19f0f | ||
![]() |
1ffe713d93 | ||
![]() |
478d3cbb79 | ||
![]() |
c5bf9623d1 | ||
![]() |
79c8eb543e | ||
![]() |
9923fe51a7 | ||
![]() |
7f0880a735 | ||
![]() |
173f199313 | ||
![]() |
94142ecce5 | ||
![]() |
0c58c1198f | ||
![]() |
1e55c30824 | ||
![]() |
8b35de3276 | ||
![]() |
10280c4b91 | ||
![]() |
36f20376e6 | ||
![]() |
9d66bc4a05 | ||
![]() |
a9ab516dae | ||
![]() |
d27709b1f2 | ||
![]() |
384602e5b5 | ||
![]() |
d0cf19e035 | ||
![]() |
be97583f00 | ||
![]() |
7dbb17792a | ||
![]() |
4770e2010d | ||
![]() |
5d88eb1d95 | ||
![]() |
f1c3f2870b | ||
![]() |
2a9b8d7a39 | ||
![]() |
1d71e1b754 | ||
![]() |
959a228815 | ||
![]() |
342b89c5b9 | ||
![]() |
852813bdf1 | ||
![]() |
1ffc4c7825 | ||
![]() |
bd26b66c27 | ||
![]() |
3377a4485b | ||
![]() |
c98b7eecd8 | ||
![]() |
6e20037f7d | ||
![]() |
29f14186c1 | ||
![]() |
289e04a62a | ||
![]() |
a1b6b217e4 | ||
![]() |
eb9072a2f1 | ||
![]() |
cc2b3228d1 | ||
![]() |
caecb1c1eb | ||
![]() |
7e36727328 | ||
![]() |
ed387d00aa | ||
![]() |
7fbd821727 | ||
![]() |
f69f930b51 | ||
![]() |
cae209816c | ||
![]() |
2c079d7c6e | ||
![]() |
46248b0922 | ||
![]() |
47b6e62744 | ||
![]() |
6f27941e28 | ||
![]() |
1950085893 | ||
![]() |
306945fe14 | ||
![]() |
16ac468bdb | ||
![]() |
58c762baa3 | ||
![]() |
865b216ebe | ||
![]() |
82a0fae678 | ||
![]() |
7f9513fbf4 | ||
![]() |
cfe47cc854 | ||
![]() |
4960e6b6d7 | ||
![]() |
3b80e2c1e0 | ||
![]() |
d5f5f0a930 | ||
![]() |
ae70540a96 | ||
![]() |
00c7e54d3c | ||
![]() |
5f1b4e9474 | ||
![]() |
5da66e7ec8 | ||
![]() |
3d519c7a39 | ||
![]() |
80789e6140 | ||
![]() |
055d501345 | ||
![]() |
70ec517fda | ||
![]() |
5c30e079f4 | ||
![]() |
735968e685 | ||
![]() |
d3d9aaceb1 | ||
![]() |
8c0bd30fcb | ||
![]() |
50ccc39d6b | ||
![]() |
68d647c1af | ||
![]() |
58d2f70b7e | ||
![]() |
36cf1f7dfd | ||
![]() |
2dc5f580a6 | ||
![]() |
02c456432d | ||
![]() |
a61b832c4a | ||
![]() |
13ebc745fe | ||
![]() |
8f7cb6fb19 | ||
![]() |
a008d49230 | ||
![]() |
a422e39492 | ||
![]() |
07a375e2d6 | ||
![]() |
6d68c78989 | ||
![]() |
9e8232d750 | ||
![]() |
c604b53f78 | ||
![]() |
020601092e | ||
![]() |
a94b553aff | ||
![]() |
4facc03a64 | ||
![]() |
53056f3e7e | ||
![]() |
fbf0362943 | ||
![]() |
7fa1f2ffde | ||
![]() |
ab5d1df7cb | ||
![]() |
7921d85dc8 | ||
![]() |
32a671b9da | ||
![]() |
ab0d19f356 | ||
![]() |
c482f37dfd | ||
![]() |
c12737ae38 | ||
![]() |
3140496a12 | ||
![]() |
61558ab83f | ||
![]() |
76c9e9883d | ||
![]() |
5139948ef9 | ||
![]() |
3e1321ac24 | ||
![]() |
13e18c23ed | ||
![]() |
af46222b12 | ||
![]() |
eaec086177 | ||
![]() |
bec58075ff | ||
![]() |
0e6b249260 | ||
![]() |
5ff9811ea8 | ||
![]() |
6c2dc5574f | ||
![]() |
ce1c4055f7 | ||
![]() |
de865a9b55 | ||
![]() |
697e1d4941 | ||
![]() |
7a09043cba | ||
![]() |
f5f3b4e095 | ||
![]() |
40fbe9da81 | ||
![]() |
ebfb1978b8 | ||
![]() |
8328353204 | ||
![]() |
13c56887f1 | ||
![]() |
2272a4722f | ||
![]() |
94a5fc5c2c | ||
![]() |
a36cc7075a | ||
![]() |
f1f51bd9b6 | ||
![]() |
1eafa7020d | ||
![]() |
55b9a2479a | ||
![]() |
52cb0d709a | ||
![]() |
d38fb9bda2 | ||
![]() |
6efaa78058 | ||
![]() |
e62c30c8b1 | ||
![]() |
0ba349bdf2 | ||
![]() |
35bda8980f | ||
![]() |
cac378bd95 | ||
![]() |
be551d7707 | ||
![]() |
bfb5ffedda | ||
![]() |
a05150392a | ||
![]() |
6f335d2c9e | ||
![]() |
f685acd69e | ||
![]() |
dbec22f2df | ||
![]() |
4ef3acfa41 | ||
![]() |
0fbd48a889 | ||
![]() |
b7b51569e2 | ||
![]() |
55491fdb36 | ||
![]() |
a2794379a0 | ||
![]() |
fc19e24eba | ||
![]() |
da71c3d801 | ||
![]() |
e815e205da | ||
![]() |
eb58a0596d | ||
![]() |
7959ccd84d | ||
![]() |
338bb3fd9c | ||
![]() |
11172118d1 | ||
![]() |
9d6d68f00a | ||
![]() |
31b64d4689 | ||
![]() |
3876f19d6a | ||
![]() |
22672bc738 | ||
![]() |
56ec22f5c9 | ||
![]() |
84d1b19f61 | ||
![]() |
24c267d324 | ||
![]() |
d587cc0e36 | ||
![]() |
1733125873 | ||
![]() |
884e13ac2f | ||
![]() |
bcc2b17701 | ||
![]() |
3922bc27cd | ||
![]() |
7cefbd8a94 | ||
![]() |
e2a3a52ad6 | ||
![]() |
8fd4507847 | ||
![]() |
9fea631bfb | ||
![]() |
09cc27ca7a | ||
![]() |
bc80174357 | ||
![]() |
1aecd5be07 | ||
![]() |
2ff2096b36 | ||
![]() |
3fb1c446ea | ||
![]() |
8bdd03eeac | ||
![]() |
2f9abe6e13 | ||
![]() |
ee72654b55 | ||
![]() |
164ead03c9 | ||
![]() |
f88c95ce2d | ||
![]() |
308fcbb96c | ||
![]() |
be61d2f8c1 | ||
![]() |
6fbf6a1c23 | ||
![]() |
5a4eb34c39 | ||
![]() |
c4922c9e88 | ||
![]() |
e977915577 | ||
![]() |
572936ec65 | ||
![]() |
a8bed54586 | ||
![]() |
4b444e7cc3 | ||
![]() |
9127b5a57d | ||
![]() |
8652e644dd | ||
![]() |
4ff85c2ac2 | ||
![]() |
6981e2bffa | ||
![]() |
8fb84d9e63 | ||
![]() |
71ab202295 | ||
![]() |
369b8532c0 | ||
![]() |
f9f33926f7 | ||
![]() |
9ee96bea95 | ||
![]() |
5f7ac64c44 | ||
![]() |
b358402cb3 | ||
![]() |
a522b6e23b | ||
![]() |
03d9583b94 | ||
![]() |
e913de58c7 | ||
![]() |
afe033412b | ||
![]() |
c28a5fbd62 | ||
![]() |
6062201e8f | ||
![]() |
b01f5ff6a7 | ||
![]() |
24c9b1f717 | ||
![]() |
9fdf4420d5 | ||
![]() |
4df7a0f2f8 | ||
![]() |
3468af213f | ||
![]() |
d5d1305bc0 | ||
![]() |
1b0996fb0b | ||
![]() |
1879a8129e | ||
![]() |
4e84ded7ef | ||
![]() |
1a8fbe5cf0 | ||
![]() |
5a1cbb2842 | ||
![]() |
54537e8f0b | ||
![]() |
c9c1263e6f | ||
![]() |
d1a5374ac4 | ||
![]() |
c914010606 | ||
![]() |
56bd9da07c | ||
![]() |
d60dc7c2eb | ||
![]() |
97fc266ad4 | ||
![]() |
3ce0228206 | ||
![]() |
0d0f306fc2 | ||
![]() |
c25b4cdc69 | ||
![]() |
3a5fc0c320 | ||
![]() |
3d6be7fd80 | ||
![]() |
47afda2549 | ||
![]() |
6a2bbae521 | ||
![]() |
5625c11e99 | ||
![]() |
16609d6702 | ||
![]() |
8d2de09f3d | ||
![]() |
4dae3385c3 | ||
![]() |
66ec0b5d82 | ||
![]() |
7999bbafa8 | ||
![]() |
4c43a40788 | ||
![]() |
c10c49e44f | ||
![]() |
1a60f376a4 | ||
![]() |
27ba7de1e4 | ||
![]() |
68a02e567d | ||
![]() |
c46c0fc652 | ||
![]() |
3884716948 | ||
![]() |
8de1427803 | ||
![]() |
bab08f1c89 | ||
![]() |
d63e32a377 | ||
![]() |
52b88e0991 | ||
![]() |
3e8427799c | ||
![]() |
2963782992 | ||
![]() |
77f599885d | ||
![]() |
7b07b68bfd | ||
![]() |
fb90477354 | ||
![]() |
cbda329bfd | ||
![]() |
5d186639c9 | ||
![]() |
e2cfc6b838 | ||
![]() |
3c1be60c66 | ||
![]() |
5f4449f0a1 | ||
![]() |
558ec3891b | ||
![]() |
dcbfb83031 | ||
![]() |
3524fc414b | ||
![]() |
420b85da98 | ||
![]() |
28c2759ae1 | ||
![]() |
374e3e7e11 | ||
![]() |
904ef0d4be | ||
![]() |
99ee26b001 | ||
![]() |
ee049641ba | ||
![]() |
4f47f90336 | ||
![]() |
2d90cc59b6 | ||
![]() |
5576dea00b | ||
![]() |
8323f81ab5 | ||
![]() |
f5f5ce0d33 | ||
![]() |
88f4747437 | ||
![]() |
b79ede4edb | ||
![]() |
70a96fff80 | ||
![]() |
7bf2854e94 | ||
![]() |
f0d8c009ae | ||
![]() |
0ae486f07c | ||
![]() |
79a6235811 | ||
![]() |
c99fc5108e | ||
![]() |
09fa002818 | ||
![]() |
ee795150fa | ||
![]() |
f97f39987c | ||
![]() |
5631f822bd | ||
![]() |
ca13c2ed0c | ||
![]() |
058af472ea | ||
![]() |
3d5a408177 | ||
![]() |
9281e477eb | ||
![]() |
76536fe24b | ||
![]() |
1bcf500eca | ||
![]() |
522af9f477 | ||
![]() |
1c98e6b698 | ||
![]() |
4dada32693 | ||
![]() |
34aea08ba2 | ||
![]() |
6b2823775e | ||
![]() |
d999b3ed53 | ||
![]() |
5f5d191d88 | ||
![]() |
dd468e9ef9 | ||
![]() |
302d84cedc | ||
![]() |
ad8a5a95b2 | ||
![]() |
29d505c98e | ||
![]() |
688045307a | ||
![]() |
72eb2632cc | ||
![]() |
e3b2485453 | ||
![]() |
60232810d8 | ||
![]() |
d1133ca8d3 | ||
![]() |
13bef7aa02 | ||
![]() |
b574e105dd | ||
![]() |
4dfffff19b | ||
![]() |
9417b9969d | ||
![]() |
46a7822eee | ||
![]() |
501ef80bed | ||
![]() |
7ca6397223 | ||
![]() |
e2173922f0 | ||
![]() |
96fa716525 | ||
![]() |
4bc339ea4e | ||
![]() |
0bc71d84f8 | ||
![]() |
2168d8aa1a | ||
![]() |
cafc66a3c1 | ||
![]() |
4c9d0f16a5 | ||
![]() |
80b3c4cd2b | ||
![]() |
5bcddca5e1 | ||
![]() |
c286bea8e1 | ||
![]() |
4fb3103dfa | ||
![]() |
cf6d2e3985 | ||
![]() |
7447b3e1da | ||
![]() |
cf2975d062 | ||
![]() |
af1eb5453a | ||
![]() |
05f8e83ba9 | ||
![]() |
21a01ec870 | ||
![]() |
ae6adb173b | ||
![]() |
90e1ed2b5e | ||
![]() |
17878550b1 | ||
![]() |
7afa0b09ab | ||
![]() |
0a27525a4b | ||
![]() |
3e88156817 | ||
![]() |
897179a06c | ||
![]() |
8f91ed81c5 | ||
![]() |
d17a0cee1a | ||
![]() |
302ec438dd | ||
![]() |
cac2a66deb | ||
![]() |
78b4494e2b | ||
![]() |
caa7bc366b | ||
![]() |
6ad8323860 | ||
![]() |
9f2fc81df2 | ||
![]() |
8a4e28f81d | ||
![]() |
4b93349db5 | ||
![]() |
11cf455fe0 | ||
![]() |
b0a0c5d431 | ||
![]() |
f2d61d4043 | ||
![]() |
0ff26f527f | ||
![]() |
5c32cf2095 | ||
![]() |
64f6c74c9a | ||
![]() |
2e26ce235d | ||
![]() |
ae2d0d4cd8 | ||
![]() |
26833f5aae | ||
![]() |
ea5b00528b | ||
![]() |
e4e315bbfc | ||
![]() |
27df983ee0 | ||
![]() |
5a041a6af5 | ||
![]() |
3d6696f6c9 | ||
![]() |
d53b6f4381 | ||
![]() |
48374c85dd | ||
![]() |
f74791ed7b | ||
![]() |
f232f34981 | ||
![]() |
9811a37690 | ||
![]() |
dcd6942ed1 | ||
![]() |
c320a21f2b | ||
![]() |
80eb4f3f50 | ||
![]() |
30941c0dd1 | ||
![]() |
cf71e1242e | ||
![]() |
0da7c499b6 | ||
![]() |
0b65b44a78 | ||
![]() |
46e7a26770 | ||
![]() |
c9ac176fa7 | ||
![]() |
c0983f3400 | ||
![]() |
30c8058fca | ||
![]() |
c60cc9ee18 | ||
![]() |
6dac1efefe | ||
![]() |
8b3603cd48 | ||
![]() |
3fa6fdacf2 | ||
![]() |
90c62c4cc0 | ||
![]() |
4f1bee3165 | ||
![]() |
dcf5f45f68 | ||
![]() |
af890cf210 | ||
![]() |
c9e30f7754 | ||
![]() |
03cc031d00 | ||
![]() |
7d1d9ff143 | ||
![]() |
bdb450fccb | ||
![]() |
179f2f9e4f | ||
![]() |
41c5f3a017 | ||
![]() |
847944e240 | ||
![]() |
b10425492a | ||
![]() |
8bbbe8cd76 | ||
![]() |
037edbaa13 | ||
![]() |
bc08271da3 | ||
![]() |
cd7f25830b | ||
![]() |
706755d146 | ||
![]() |
0e29aa2951 | ||
![]() |
d84f922372 | ||
![]() |
76ff4d220e | ||
![]() |
86fbf4fd8f | ||
![]() |
d38d7a1bed | ||
![]() |
8c5d403dda | ||
![]() |
f575935ace | ||
![]() |
ea4b5552c2 | ||
![]() |
b46a800597 | ||
![]() |
b62bbb78ed | ||
![]() |
5107a2dc40 | ||
![]() |
ded07690fd | ||
![]() |
83dbc07650 | ||
![]() |
e060944b34 | ||
![]() |
075f51e0a3 | ||
![]() |
f0ada8c40d | ||
![]() |
9737c58054 | ||
![]() |
529d20ee6a | ||
![]() |
ad3d270c42 | ||
![]() |
454b422fd6 | ||
![]() |
4d78d27bd9 | ||
![]() |
6db44500b7 | ||
![]() |
6acfda599e | ||
![]() |
5c112ff542 | ||
![]() |
aee5d9a390 | ||
![]() |
1ddf594d15 | ||
![]() |
9799856ad4 | ||
![]() |
b7f8e97b03 | ||
![]() |
ac44db26a2 | ||
![]() |
c85cd29049 | ||
![]() |
3d0208223a | ||
![]() |
dc4d5dabcd | ||
![]() |
f7d4951165 | ||
![]() |
0bcb873cbb | ||
![]() |
29761c2519 | ||
![]() |
eeb151586f | ||
![]() |
7ab008878a | ||
![]() |
ec72a8868e | ||
![]() |
ba60918eaa | ||
![]() |
e660700924 | ||
![]() |
fd67e31f63 | ||
![]() |
8301980ba8 | ||
![]() |
5f73850fa6 | ||
![]() |
e94acf86f8 | ||
![]() |
d6feeb14ff | ||
![]() |
9d09ada33b | ||
![]() |
c3208c5cd6 | ||
![]() |
4636e3367c | ||
![]() |
f2152aa391 | ||
![]() |
2646ed0393 | ||
![]() |
9ef0240e99 | ||
![]() |
790bc72806 | ||
![]() |
289a53221d | ||
![]() |
a2a3d3aeb6 | ||
![]() |
17732fa9c4 | ||
![]() |
fa98289ddb | ||
![]() |
0e6d1cb272 | ||
![]() |
cc39b4660a | ||
![]() |
fa3112b40e | ||
![]() |
6ca1fd59a9 | ||
![]() |
1fb874cdc5 | ||
![]() |
34e5fcf47e | ||
![]() |
a1038f61b6 | ||
![]() |
5f1e8b8278 | ||
![]() |
91f1f324c0 | ||
![]() |
eb36c351cf | ||
![]() |
f707c1ca46 | ||
![]() |
299ae7a4bd | ||
![]() |
3104d3d6cd | ||
![]() |
04d9deac92 | ||
![]() |
f12754b01f | ||
![]() |
f9bbce0da7 | ||
![]() |
62087d21cc | ||
![]() |
89a84a621b | ||
![]() |
1c370f5a17 | ||
![]() |
cb05c51911 | ||
![]() |
ec2cbaa5eb | ||
![]() |
173529e048 | ||
![]() |
9639b14e1b | ||
![]() |
17eefed08f | ||
![]() |
2e5d898443 | ||
![]() |
6b5e18e6bf | ||
![]() |
0da88ac5c5 | ||
![]() |
c8a30b262d | ||
![]() |
284eaf1576 | ||
![]() |
c1e49d2b13 | ||
![]() |
cde2c1aa6d | ||
![]() |
aa22d97983 | ||
![]() |
4b51248372 | ||
![]() |
1d545449bb | ||
![]() |
78b502b0bf | ||
![]() |
3b67a4cfba | ||
![]() |
1a2a44200a | ||
![]() |
9361615786 | ||
![]() |
0133917bf9 | ||
![]() |
b6cec214bd | ||
![]() |
a66c8531d6 | ||
![]() |
37cc45a0a8 | ||
![]() |
a04a7b6ea5 | ||
![]() |
f2f4079411 | ||
![]() |
565b1089bd | ||
![]() |
06a8d7eb06 | ||
![]() |
108055cd62 | ||
![]() |
66b096d978 | ||
![]() |
1136d4222f | ||
![]() |
136408d8b8 | ||
![]() |
ee9bf76ae9 | ||
![]() |
a3f16c8459 | ||
![]() |
956a6e6f77 | ||
![]() |
8b7ca8b670 | ||
![]() |
35ee4e52c8 | ||
![]() |
ea7afc8ec8 | ||
![]() |
db3dd9d200 | ||
![]() |
60223a358b | ||
![]() |
c453ac8265 | ||
![]() |
269b120104 | ||
![]() |
584e74c676 | ||
![]() |
fa78023aa4 | ||
![]() |
ebc2b9a286 | ||
![]() |
5e45c3c824 | ||
![]() |
e2ba22ec59 | ||
![]() |
49df957058 | ||
![]() |
95c1bf9544 | ||
![]() |
db4585b3e2 | ||
![]() |
d6bc7b8877 | ||
![]() |
ee52b13ae6 | ||
![]() |
d0e26247f4 | ||
![]() |
0caf925d5d | ||
![]() |
dc68205a18 | ||
![]() |
7128ef686d | ||
![]() |
d728494099 | ||
![]() |
5bcda7bf15 | ||
![]() |
9e7a3b7017 | ||
![]() |
530e520727 | ||
![]() |
2e3e62a413 | ||
![]() |
4d8f18e00b | ||
![]() |
ea8363a3b0 | ||
![]() |
c5931c75c6 | ||
![]() |
d07e4f44f1 | ||
![]() |
dcabb49244 | ||
![]() |
18a13679fd | ||
![]() |
6ee5718b2e | ||
![]() |
d0e7195a16 | ||
![]() |
7053724fd6 | ||
![]() |
c9d22c7a14 | ||
![]() |
893facdf6d | ||
![]() |
78e4772f21 | ||
![]() |
305efcf5ad | ||
![]() |
0d911127d7 | ||
![]() |
5ea18b9426 | ||
![]() |
d8bd8634ab | ||
![]() |
dcbf2a0e0c | ||
![]() |
fffbf48dec | ||
![]() |
a167067cbd | ||
![]() |
4476a9e241 | ||
![]() |
4011c13d4b | ||
![]() |
6106ab8a2e | ||
![]() |
1674465bdc | ||
![]() |
8ca6f8c6ec | ||
![]() |
04caf1c262 | ||
![]() |
68088bc5be | ||
![]() |
0dfc7fffff | ||
![]() |
75a73d9417 | ||
![]() |
d042ed52fa | ||
![]() |
2cc05e5e92 | ||
![]() |
2a058338f3 | ||
![]() |
4d2b8471fa | ||
![]() |
26252c4c1d | ||
![]() |
c70d8acb33 | ||
![]() |
16dd57747c | ||
![]() |
24ba22a43a | ||
![]() |
2da3c6d288 | ||
![]() |
c7486a0339 | ||
![]() |
c86b3d0c05 | ||
![]() |
2d1b2efb92 | ||
![]() |
9ec4776812 | ||
![]() |
2f08845d1e | ||
![]() |
9f5efeb309 | ||
![]() |
182054b662 | ||
![]() |
a8bb9b6b19 | ||
![]() |
84252f9b70 | ||
![]() |
89409817b5 | ||
![]() |
7b360d8579 | ||
![]() |
83459159f4 | ||
![]() |
4b6e6d4dd4 | ||
![]() |
954ced21a4 | ||
![]() |
98c60838fe | ||
![]() |
09f28d0f57 | ||
![]() |
8aab52aeda | ||
![]() |
afd2ffb74a | ||
![]() |
825e42dc00 | ||
![]() |
b99b21fa38 | ||
![]() |
0018522031 | ||
![]() |
30fafb77db | ||
![]() |
ed19064405 | ||
![]() |
94c92a58a1 | ||
![]() |
9c9aeaef47 | ||
![]() |
cbbe948529 | ||
![]() |
823abf666e | ||
![]() |
685273675b | ||
![]() |
15cd4dce4e | ||
![]() |
9cbfcbb820 | ||
![]() |
fca83c9ff8 | ||
![]() |
54c7fa491e | ||
![]() |
c69ce1d750 | ||
![]() |
84a6724b33 | ||
![]() |
a847df921f | ||
![]() |
687fe2c3c7 | ||
![]() |
e98ea900cf | ||
![]() |
2ef9552454 | ||
![]() |
6a392f0eb2 | ||
![]() |
c00062655f | ||
![]() |
4ad375a378 | ||
![]() |
4a3509f06d | ||
![]() |
4fae37bb88 | ||
![]() |
646f1c3f71 | ||
![]() |
df5c64d0be | ||
![]() |
65ecde1e75 | ||
![]() |
728e1715cc | ||
![]() |
e484d58d9c | ||
![]() |
708e8c558c | ||
![]() |
4ec0ac89cd | ||
![]() |
196bda0597 | ||
![]() |
bf32081fa9 | ||
![]() |
13925f7bd4 | ||
![]() |
e6ad166ae3 | ||
![]() |
db5493b783 | ||
![]() |
5d6475c93b | ||
![]() |
ac475f46b9 | ||
![]() |
c21ca3ca1a | ||
![]() |
99f99bea47 | ||
![]() |
d0ff78e7f4 | ||
![]() |
3113a20390 | ||
![]() |
41959eeae1 | ||
![]() |
08da91047e | ||
![]() |
6e9d3eb0f9 | ||
![]() |
ed674d865b | ||
![]() |
233f7611da | ||
![]() |
f874fdc1ad | ||
![]() |
4e57bd1f18 | ||
![]() |
455be7f6f6 | ||
![]() |
23d66e9b6f | ||
![]() |
882e2abee1 | ||
![]() |
68ba34c17b | ||
![]() |
a286d9166b | ||
![]() |
fcd30c5649 | ||
![]() |
8ae0da1fa1 | ||
![]() |
25f5995be0 | ||
![]() |
cf6c6fefd7 | ||
![]() |
c5663ca015 | ||
![]() |
51c0b61a43 | ||
![]() |
634f8f0d0f | ||
![]() |
efa1c96d19 | ||
![]() |
423a45ac85 | ||
![]() |
dc385ba4ec | ||
![]() |
c8e8c0a002 | ||
![]() |
c04752c0e4 | ||
![]() |
ae87a35f6e | ||
![]() |
29c618a35e | ||
![]() |
036e77939f | ||
![]() |
de7bddb8df | ||
![]() |
fd05d3e353 | ||
![]() |
a640503119 | ||
![]() |
f24fd14814 | ||
![]() |
f98c4dc82b | ||
![]() |
f1d16386b6 | ||
![]() |
144681fc0f | ||
![]() |
03c82605a0 | ||
![]() |
183795b8aa | ||
![]() |
91e00431d4 | ||
![]() |
3b4d8442e0 | ||
![]() |
4f0165f32d | ||
![]() |
fb6ef2c2f4 | ||
![]() |
bb49102a4b | ||
![]() |
4cc394c376 | ||
![]() |
8eb6fc5612 | ||
![]() |
5e7686695f | ||
![]() |
e5a56fa985 | ||
![]() |
f10835cf09 | ||
![]() |
a5e79b7663 | ||
![]() |
b7461846ab | ||
![]() |
40119949cb | ||
![]() |
21229aa3f6 | ||
![]() |
1793f2c3b8 | ||
![]() |
4a637191f2 | ||
![]() |
8991573984 | ||
![]() |
7f2e67e924 | ||
![]() |
1ce010c7d4 | ||
![]() |
fe0cf8f9a9 | ||
![]() |
32508f6db1 | ||
![]() |
1c23edd1e5 | ||
![]() |
ea50092356 | ||
![]() |
891c4a458a | ||
![]() |
0c539cbf32 | ||
![]() |
70d405b41b | ||
![]() |
95da97fa74 | ||
![]() |
546c727520 | ||
![]() |
1656d17b22 | ||
![]() |
8fa5c9dce2 | ||
![]() |
b8b34a1b26 | ||
![]() |
6608c5a8a7 | ||
![]() |
a299bc289b | ||
![]() |
e0d8cceb65 | ||
![]() |
3a739c38c5 | ||
![]() |
d32feaa668 | ||
![]() |
f269fb46ea | ||
![]() |
63ea3449d3 | ||
![]() |
e97438114f | ||
![]() |
a5492dd5fc | ||
![]() |
fa057f512f | ||
![]() |
55f0abbe99 | ||
![]() |
9f5c5dfff4 | ||
![]() |
802f29fb0e | ||
![]() |
8a29e5eb5e | ||
![]() |
b804f38150 | ||
![]() |
46ea556593 | ||
![]() |
5335f262be | ||
![]() |
b11cda959d | ||
![]() |
8c8e5bb7c8 | ||
![]() |
59cf0f6a42 | ||
![]() |
5659249dfa | ||
![]() |
b894a78385 | ||
![]() |
3b45336929 | ||
![]() |
da28cff0f6 | ||
![]() |
5dbb93dbb4 | ||
![]() |
6cb0603fbe | ||
![]() |
8e30bd1f69 | ||
![]() |
6e5ceaa30d | ||
![]() |
e8c79f53a6 | ||
![]() |
e683fe88b9 | ||
![]() |
1bcb5ddd50 | ||
![]() |
4db2da9185 | ||
![]() |
1b39b2e261 | ||
![]() |
f144b6bae4 | ||
![]() |
2bd7245508 | ||
![]() |
b62f7c3057 | ||
![]() |
f4e455398c | ||
![]() |
85908befea | ||
![]() |
a6f5a0339a | ||
![]() |
c17c1ccaea | ||
![]() |
88e1fd9530 | ||
![]() |
2fa7e00f16 | ||
![]() |
5208d57f1e | ||
![]() |
76024b5036 | ||
![]() |
002dacef40 | ||
![]() |
580c0a7296 | ||
![]() |
67423ff64b | ||
![]() |
b135bcd422 | ||
![]() |
fb4105cf8a | ||
![]() |
d1f099374c | ||
![]() |
932396922d | ||
![]() |
afdf357fbe | ||
![]() |
8c117cfb57 | ||
![]() |
f13b30d606 | ||
![]() |
165b3dd215 | ||
![]() |
d218534fff | ||
![]() |
333fdf6b90 | ||
![]() |
625e4e2fb3 | ||
![]() |
949e93f9fe | ||
![]() |
e9792ef771 | ||
![]() |
9bf411f580 | ||
![]() |
11a8dacb0f | ||
![]() |
3bd7109d8b | ||
![]() |
9af10686b2 | ||
![]() |
c5377f4e05 | ||
![]() |
34db515acb | ||
![]() |
6ffb3c72fb | ||
![]() |
f582ab06ad | ||
![]() |
7c36289768 | ||
![]() |
544df87a8e | ||
![]() |
77558eec0c | ||
![]() |
d05acb1b68 | ||
![]() |
ef1f9fe450 | ||
![]() |
4e0378ab7c | ||
![]() |
075f599abb | ||
![]() |
94d0e83207 | ||
![]() |
ab459bf418 | ||
![]() |
35f1ebf9f3 | ||
![]() |
b1a90a7f91 | ||
![]() |
da5221910f | ||
![]() |
50c5df0838 | ||
![]() |
a7a81ca749 | ||
![]() |
4879106096 | ||
![]() |
e28fef6ee0 | ||
![]() |
9a578c5962 | ||
![]() |
0a345a6128 | ||
![]() |
94a1fdc2ae | ||
![]() |
acc322b3e1 | ||
![]() |
e5fe2c216e | ||
![]() |
e93475d854 | ||
![]() |
858ccb350d | ||
![]() |
7e568c8903 | ||
![]() |
60194753d7 | ||
![]() |
808aeabf4c | ||
![]() |
32330801c9 | ||
![]() |
535b9e606f | ||
![]() |
92bcf09c53 | ||
![]() |
aa982f80f5 | ||
![]() |
d7e7ef6a7d | ||
![]() |
055d8927cc | ||
![]() |
8692c49511 | ||
![]() |
ecd6f77de7 | ||
![]() |
5cfd59258a | ||
![]() |
9dd20577cd | ||
![]() |
ea45223f1f | ||
![]() |
12581c1721 | ||
![]() |
324259ef8e | ||
![]() |
773360caa3 | ||
![]() |
ca402e9d36 | ||
![]() |
6ac5d3bc06 | ||
![]() |
c52ba520ce | ||
![]() |
322ca97c24 | ||
![]() |
ef36950b72 | ||
![]() |
4e5f5764ce | ||
![]() |
3a9ed0e846 | ||
![]() |
997170a317 | ||
![]() |
8745d733f9 | ||
![]() |
86f683dcbb | ||
![]() |
04d9c4c183 | ||
![]() |
9964935a12 | ||
![]() |
72e909f556 | ||
![]() |
0919d43dfb | ||
![]() |
27e44c43c5 | ||
![]() |
07858c3a1f | ||
![]() |
fd2b0c7c38 | ||
![]() |
b8b0247043 | ||
![]() |
6da175fccb | ||
![]() |
037898be56 | ||
![]() |
82f71880e9 | ||
![]() |
0b04807258 | ||
![]() |
5837249d76 | ||
![]() |
ba640598e5 | ||
![]() |
a42bfa7794 | ||
![]() |
5436d93a3d | ||
![]() |
36552ff995 | ||
![]() |
0af2f45815 | ||
![]() |
39e22e98ce | ||
![]() |
e8fa630c28 | ||
![]() |
6e4cfa5ecf | ||
![]() |
c0d8ae7f4d | ||
![]() |
7834a4e2fc | ||
![]() |
0b24330d86 | ||
![]() |
0b7c2ab183 | ||
![]() |
f7acee9221 | ||
![]() |
8b3a82688e | ||
![]() |
067b884f39 | ||
![]() |
a98578c91d | ||
![]() |
14d3b0a084 | ||
![]() |
552033da27 | ||
![]() |
66556b8b47 | ||
![]() |
3434255ce6 | ||
![]() |
d686cc6c4a | ||
![]() |
d50194940d | ||
![]() |
e30421e84c | ||
![]() |
c944d62374 | ||
![]() |
84befaea24 | ||
![]() |
2be8753788 | ||
![]() |
a59433e7a3 | ||
![]() |
cd08ae7b85 | ||
![]() |
1ec87f7990 | ||
![]() |
bae1bf7b0a | ||
![]() |
024e48850e | ||
![]() |
9572d6c063 | ||
![]() |
d9c5614342 | ||
![]() |
4c6c182023 | ||
![]() |
fca60cb597 | ||
![]() |
6a4afae5cc | ||
![]() |
fd851d1d8b | ||
![]() |
9e450df053 | ||
![]() |
c7ae28aaa2 | ||
![]() |
19721c70ff | ||
![]() |
e25f1227c0 | ||
![]() |
4e4b6bef21 | ||
![]() |
a7714c842f | ||
![]() |
eae98e1c34 | ||
![]() |
ba257b09f5 | ||
![]() |
05fe1c22ed | ||
![]() |
7db895ab5d | ||
![]() |
ceb7325727 | ||
![]() |
7d2318c167 | ||
![]() |
a632a04a30 | ||
![]() |
2b4a1f295a | ||
![]() |
3cad094edd | ||
![]() |
c062f8d4fe | ||
![]() |
ee4b553c2a | ||
![]() |
3cb4edcbc3 | ||
![]() |
e1353b9f7d | ||
![]() |
47827ddda1 | ||
![]() |
387795311c | ||
![]() |
77eda6494e | ||
![]() |
b25cdf7f7d | ||
![]() |
765870fe8f | ||
![]() |
cc6cf9a741 | ||
![]() |
ab12193f10 | ||
![]() |
b926765ce0 | ||
![]() |
9ab6718234 | ||
![]() |
42c92e4f2e | ||
![]() |
b9e53cd135 | ||
![]() |
dc52c8f769 | ||
![]() |
032c8333d9 | ||
![]() |
b92c1bbbf7 | ||
![]() |
f5048742aa | ||
![]() |
e9ea3f50bf | ||
![]() |
a9e045a1a8 | ||
![]() |
7d0407c6a2 | ||
![]() |
c00cd38b01 | ||
![]() |
e96c22d6f8 | ||
![]() |
874dc89fca | ||
![]() |
5104567a24 | ||
![]() |
2968ba9938 | ||
![]() |
cae6f3c613 | ||
![]() |
bb8c1826d3 | ||
![]() |
274921cd35 | ||
![]() |
39fda7af82 | ||
![]() |
31934ac374 | ||
![]() |
d739895e4a | ||
![]() |
e37ef10595 | ||
![]() |
4a7e522d4b | ||
![]() |
b2a5390adb | ||
![]() |
0bfd283526 | ||
![]() |
7ea8326b52 | ||
![]() |
8847602061 | ||
![]() |
e6bc655d6a | ||
![]() |
061ee04cb5 | ||
![]() |
3c4a91658e | ||
![]() |
fad81f36e4 | ||
![]() |
b482e26925 | ||
![]() |
7ec6ebb9fa | ||
![]() |
5a98d2da1f | ||
![]() |
21d8394170 | ||
![]() |
5e913c31a4 | ||
![]() |
d51d6a4650 | ||
![]() |
3c57c6afc5 | ||
![]() |
905b6ec53d | ||
![]() |
08a4ee34eb | ||
![]() |
1bd592fe67 | ||
![]() |
db1ad74ef2 | ||
![]() |
2e5f58255a | ||
![]() |
cfa60ab7e6 | ||
![]() |
d3cf316e40 | ||
![]() |
a2c8ddca13 | ||
![]() |
29d8b48503 | ||
![]() |
0c60609268 | ||
![]() |
63ed471ed2 | ||
![]() |
d16519f5de | ||
![]() |
fcff83e65c | ||
![]() |
7375d0460a | ||
![]() |
2706fa86cd | ||
![]() |
6bea9d0232 | ||
![]() |
ab05ace3ce | ||
![]() |
05ccc4fd42 | ||
![]() |
a471b6197a | ||
![]() |
db2ad9648d | ||
![]() |
45b214d83e | ||
![]() |
e6ef3f6e6a | ||
![]() |
9d27bba23f | ||
![]() |
063e26c521 | ||
![]() |
9b5e66f5ea | ||
![]() |
d025230707 | ||
![]() |
c790891e60 | ||
![]() |
78a660d409 | ||
![]() |
4040f9095d | ||
![]() |
d95f743b6f | ||
![]() |
5eff7d2642 | ||
![]() |
51688c004c | ||
![]() |
e2ff32eb84 | ||
![]() |
c79a46889f | ||
![]() |
735bf98945 | ||
![]() |
86446c6102 | ||
![]() |
0287319c38 | ||
![]() |
5ecb6801fa | ||
![]() |
3a0d164a76 | ||
![]() |
c389f62837 | ||
![]() |
b648a9ddee | ||
![]() |
597b143634 | ||
![]() |
1b2225a622 | ||
![]() |
0cdeb4e267 | ||
![]() |
d09b9fbbde | ||
![]() |
c40b3a287c | ||
![]() |
1195025c4c | ||
![]() |
a99ce2f306 | ||
![]() |
9d47934a02 | ||
![]() |
3b6e5119f3 | ||
![]() |
42b1cb1aaa | ||
![]() |
1989b9fcd9 | ||
![]() |
34d0851f79 | ||
![]() |
b6d0e3adb2 | ||
![]() |
07129b26c3 | ||
![]() |
d25b56f6d4 | ||
![]() |
42b7b11710 | ||
![]() |
e915812730 | ||
![]() |
ace185954c | ||
![]() |
1ef1f3d7ea | ||
![]() |
815f90974c | ||
![]() |
a08e0929bc | ||
![]() |
d86c5e3950 | ||
![]() |
278f82e536 | ||
![]() |
983cc8d291 | ||
![]() |
8e2680f41f | ||
![]() |
fc6081fe70 | ||
![]() |
01651af08a | ||
![]() |
c56ef738ed | ||
![]() |
d2b98fbb5c |
51
.gitignore
vendored
@@ -1,17 +1,15 @@
|
|||||||
# Ignore generated files
|
# Ignore generated files
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# Ignore compiled binaries
|
# Ignore VIM's backup generated files
|
||||||
src/core.o
|
*.swp
|
||||||
src/shapes.o
|
|
||||||
src/textures.o
|
# Ignore Android generated files and folders
|
||||||
src/text.o
|
src_android/obj/
|
||||||
src/models.o
|
templates/android_project/bin/
|
||||||
src/audio.o
|
templates/android_project/obj/
|
||||||
src/vector3.o
|
templates/android_project/libs/
|
||||||
src/stb_image.o
|
local.properties
|
||||||
src/*.exe
|
|
||||||
examples/*.o
|
|
||||||
|
|
||||||
# Ignore thumbnails created by windows
|
# Ignore thumbnails created by windows
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
@@ -48,6 +46,11 @@ _ReSharper*/
|
|||||||
ipch/
|
ipch/
|
||||||
*.opensdf
|
*.opensdf
|
||||||
|
|
||||||
|
# Ignore compiled binaries
|
||||||
|
*.o
|
||||||
|
*.exe
|
||||||
|
!tools/rREM/rrem.exe
|
||||||
|
|
||||||
# Ignore files build by xcode
|
# Ignore files build by xcode
|
||||||
*.mode*v*
|
*.mode*v*
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
@@ -60,4 +63,28 @@ xcschememanagement.plist
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
._.*
|
._.*
|
||||||
xcuserdata/
|
xcuserdata/
|
||||||
DerivedData/
|
DerivedData/
|
||||||
|
*.dll
|
||||||
|
src/libraylib.a
|
||||||
|
src/libraylib.bc
|
||||||
|
|
||||||
|
# oculus example
|
||||||
|
!examples/oculus_glfw_sample/
|
||||||
|
|
||||||
|
# external libraries DLLs
|
||||||
|
!src/external/glfw3/lib/win32/glfw3.dll
|
||||||
|
!src/external/openal_soft/lib/win32/OpenAL32.dll
|
||||||
|
!src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll
|
||||||
|
!src/external/pthread/lib/pthreadGC2.dll
|
||||||
|
|
||||||
|
# Visual Studio project
|
||||||
|
project/vs2015/*.db
|
||||||
|
project/vs2015/*.opendb
|
||||||
|
!project/vs2015/raylib.sln
|
||||||
|
!project/vs2015/raylib/*.vcxproj
|
||||||
|
!project/vs2015/examples/*.vcxproj
|
||||||
|
!project/vs2015/external/glfw3/lib/win32/glfw3.dll
|
||||||
|
!project/vs2015/external/openal_soft/lib/win32/OpenAL32.dll
|
||||||
|
!project/vs2015/external/openal_soft/lib/win64/OpenAL32.dll
|
||||||
|
!project/vs2015/external/lua/lib/win32/lua53.dll
|
||||||
|
|
||||||
|
299
CHANGELOG
@@ -1,10 +1,303 @@
|
|||||||
changelog
|
changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Current Release: raylib 1.1.1 (22 July 2014)
|
Current Release: raylib 1.6.0 (20 November 2016)
|
||||||
|
|
||||||
NOTE: Only versions marked as 'Release' are available on release folder, updates are only available as source.
|
-----------------------------------------------
|
||||||
NOTE: Current Release includes all previous updates.
|
Release: raylib 1.6.0 (20 November 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This new raylib version commemorates raylib 3rd anniversary and represents another complete review of the library.
|
||||||
|
It includes some interesting new features and is a stepping stone towards raylib future.
|
||||||
|
|
||||||
|
HUGE changes:
|
||||||
|
[rlua] LUA BINDING: Complete raylib LUA binding, ALL raylib functions ported to LUA plus the +60 code examples.
|
||||||
|
[audio] COMPLETE REDESIGN: Improved music support and also raw audio data processing and playing, +20 new functions added.
|
||||||
|
[physac] COMPLETE REWRITE: Improved performance, functionality and simplified usage, moved to own repository and added multiple examples!
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
[core] Corrected issue on OSX with HighDPI display
|
||||||
|
[core] Added flag to allow resizable window
|
||||||
|
[core] Allow no default font loading
|
||||||
|
[core] Corrected old issue with mouse buttons on web
|
||||||
|
[core] Improved gamepad support, unified across platforms
|
||||||
|
[core] Gamepad id functionality: GetGamepadName(), IsGamepadName()
|
||||||
|
[core] Gamepad buttons/axis checking functionality:
|
||||||
|
[core] Reviewed Android key inputs system, unified with desktop
|
||||||
|
[rlgl] Redesigned lighting shader system
|
||||||
|
[rlgl] Updated standard shader for better performance
|
||||||
|
[rlgl] Support alpha on framebuffer: rlglLoadRenderTexture()
|
||||||
|
[rlgl] Reviewed UpdateVrTracking() to update camera
|
||||||
|
[rlgl] Added IsVrSimulator() to check for VR simulator
|
||||||
|
[shapes] Corrected issue on DrawPolyEx()
|
||||||
|
[textures] Simplified supported image formats support
|
||||||
|
[textures] Improved text drawing within an image: ImageDrawText()
|
||||||
|
[textures] Support image alpha mixing: ImageAlphaMask()
|
||||||
|
[textures] Support textures filtering: SetTextureFilter()
|
||||||
|
[textures] Support textures wrap modes: SetTextureWrap()
|
||||||
|
[text] Improved TTF spritefont generation: LoadSpriteFontTTF()
|
||||||
|
[text] Improved AngelCode fonts support (unordered chars)
|
||||||
|
[text] Added TraceLog info on image spritefont loading
|
||||||
|
[text] Improved text measurement: MeasureTextEx()
|
||||||
|
[models] Improved OBJ loading flexibility
|
||||||
|
[models] Reviewed functions: DrawLine3D(), DrawCircle3D()
|
||||||
|
[models] Removed function: ResolveCollisionCubicmap()
|
||||||
|
[camera] Redesigned camera system and ported to header-only
|
||||||
|
[camera] Removed function: UpdateCameraPlayer()
|
||||||
|
[gestures] Redesigned gestures module to header-only
|
||||||
|
[audio] Simplified Music loading and playing system
|
||||||
|
[audio] Added trace on audio device closing
|
||||||
|
[audio] Reviewed Wave struct, improved flexibility
|
||||||
|
[audio] Support sound data update: UpdateSound()
|
||||||
|
[audio] Added support for FLAC audio loading/streaming
|
||||||
|
[raygui] Removed raygui from raylib repo (moved to own repo)
|
||||||
|
[build] Added OpenAL static library
|
||||||
|
[build] Added Visual Studio 2015 projects
|
||||||
|
[build] Support shared/dynamic raylib compilation
|
||||||
|
[*] Updated LibOVR to SDK version 1.8
|
||||||
|
[*] Updated games to latest raylib version
|
||||||
|
[*] Improved examples and added new ones
|
||||||
|
[*] Improved Android support
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.5.0 (18 July 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned,
|
||||||
|
lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||||
|
|
||||||
|
HUGE changes:
|
||||||
|
[rlgl] OCULUS RIFT CV1: Added support for VR, not oly Oculus Rift CV1 but also stereo rendering simulator (multiplatform).
|
||||||
|
[rlgl] MATERIALS SYSTEM: Added support for Materials (.mtl) and multiple material properties: diffuse, specular, normal.
|
||||||
|
[rlgl] LIGHTING SYSTEM: Added support for up to 8 lights of 3 different types: Omni, Directional and Spot.
|
||||||
|
[physac] REDESIGNED: Improved performance and simplified usage, physic objects now are managed internally in a second thread!
|
||||||
|
[audio] CHIPTUNES: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels supported.
|
||||||
|
|
||||||
|
other changes:
|
||||||
|
|
||||||
|
[core] Review Android button inputs
|
||||||
|
[core] Support Android internal data storage
|
||||||
|
[core] Renamed WorldToScreen() to GetWorldToScreen()
|
||||||
|
[core] Removed function SetCustomCursor()
|
||||||
|
[core] Removed functions BeginDrawingEx(), BeginDrawingPro()
|
||||||
|
[core] Replaced functions InitDisplay() + InitGraphics() with: InitGraphicsDevice()
|
||||||
|
[core] Added support for field-of-view Y (fovy) on 3d Camera
|
||||||
|
[core] Added 2D camera mode functions: Begin2dMode() - End2dMode()
|
||||||
|
[core] Translate mouse inputs to Android touch/gestures internally
|
||||||
|
[core] Translate mouse inputs as touch inputs in HTML5
|
||||||
|
[core] Improved function GetKeyPressed() to support multiple keys (including function keys)
|
||||||
|
[core] Improved gamepad support, specially for RaspberryPi (including multiple gamepads support)
|
||||||
|
[rlgl] Support stereo rendering simulation (duplicate draw calls by viewport, optimized)
|
||||||
|
[rlgl] Added distortion shader (embeded) to support custom VR simulator: shader_distortion.h
|
||||||
|
[rlgl] Added support for OpenGL 2.1 on desktop
|
||||||
|
[rlgl] Improved 2D vs 3D drawing system (lines, triangles, quads)
|
||||||
|
[rlgl] Improved DXT-ETC1 support on HTML5
|
||||||
|
[rlgl] Review function: rlglUnproject()
|
||||||
|
[rlgl] Removed function: rlglInitGraphics(), integrated into rlglInit()
|
||||||
|
[rlgl] Updated Mesh and Shader structs
|
||||||
|
[rlgl] Simplified internal (default) dynamic buffers
|
||||||
|
[rlgl] Added support for indexed and dynamic mesh data
|
||||||
|
[rlgl] Set fixed vertex attribs location points
|
||||||
|
[rlgl] Improved mesh data loading support
|
||||||
|
[rlgl] Added standard shader (embeded) to support materials and lighting: shader_standard.h
|
||||||
|
[rlgl] Added light functions: CreateLight(), DestroyLight()
|
||||||
|
[rlgl] Added wire mode functions: rlDisableWireMode(), rlEnableWireMode()
|
||||||
|
[rlgl] Review function consistency, added: rlglLoadMesh(), rlglUpdateMesh(), rlglDrawMesh(), rlglUnloadMesh()
|
||||||
|
[rlgl] Replaced SetCustomShader() by: BeginShaderMode() - EndShaderMode()
|
||||||
|
[rlgl] Replaced SetBlendMode() by: BeginBlendMode() - EndBlendMode()
|
||||||
|
[rlgl] Added functions to customize internal matrices: SetMatrixProjection(), SetMatrixModelview()
|
||||||
|
[rlgl] Unified internal shaders to only one default shader
|
||||||
|
[rlgl] Added support for render to texture (RenderTexture2D):
|
||||||
|
LoadRenderTexture() - UnloadRenderTexture()
|
||||||
|
BeginTextureMode() - EndTextureMode()
|
||||||
|
[rlgl] Removed SetShaderMap*() functions
|
||||||
|
[rlgl] Redesigned default buffers usage functions:
|
||||||
|
LoadDefaultBuffers() - UnloadDefaultBuffers()
|
||||||
|
UpdateDefaultBuffers() - DrawDefaultBuffers()
|
||||||
|
[shapes] Corrected bug on GetCollisionRec()
|
||||||
|
[textures] Added support for Nearest-Neighbor image scaling
|
||||||
|
[textures] Added functions to draw text on image: ImageDrawText(), ImageDrawTextEx()
|
||||||
|
[text] Reorganized internal functions: Added LoadImageFont()
|
||||||
|
[text] Security check for unsupported BMFonts
|
||||||
|
[models] Split mesh creation from model loading on heightmap and cubicmap
|
||||||
|
[models] Updated BoundingBox collision detections
|
||||||
|
[models] Added color parameter to DrawBoundigBox()
|
||||||
|
[models] Removed function: DrawQuad()
|
||||||
|
[models] Removed function: SetModelTexture()
|
||||||
|
[models] Redesigned DrawPlane() to use RL_TRIANGLES
|
||||||
|
[models] Redesigned DrawRectangleV() to use RL_TRIANGLES
|
||||||
|
[models] Redesign to accomodate new materials system: LoadMaterial()
|
||||||
|
[models] Added material functions: LoadDefaultMaterial(), LoadStandardMaterial()
|
||||||
|
[models] Added MTL material loading support: LoadMTL()
|
||||||
|
[models] Added function: DrawLight()
|
||||||
|
[audio] Renamed SoundIsPlaying() to IsSoundPlaying()
|
||||||
|
[audio] Renamed MusicIsPlaying() to IsMusicPlaying()
|
||||||
|
[audio] Support multiple Music streams (indexed)
|
||||||
|
[audio] Support multiple mixing channels
|
||||||
|
[gestures] Improved and reviewed gestures system
|
||||||
|
[raymath] Added QuaternionInvert()
|
||||||
|
[raymath] Removed function: PrintMatrix()
|
||||||
|
[raygui] Ported to header-only library (https://github.com/raysan5/raygui)
|
||||||
|
[shaders] Added depth drawing shader (requires a depth texture)
|
||||||
|
[shaders] Reviewed included shaders and added comments
|
||||||
|
[OpenAL Soft] Updated to latest version (1.17.2)
|
||||||
|
[GLFW3] Updated to latest version (3.2)
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[GLAD] Converted to header only library and simplified to only used extensions
|
||||||
|
[*] Reorganize library folders: external libs moved to src/external folder
|
||||||
|
[*] Reorganize src folder for Android library
|
||||||
|
[*] Review external dependencies usage
|
||||||
|
[*] Improved Linux and OSX build systems
|
||||||
|
[*] Lots of tweaks and bugs corrected all around
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.4.0 (22 February 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This version supposed another big improvement for raylib, including new modules and new features.
|
||||||
|
More than 30 new functions have been added to previous raylib version.
|
||||||
|
Around 8 new examples and +10 new game samples have been added.
|
||||||
|
|
||||||
|
BIG changes:
|
||||||
|
[textures] IMAGE MANIPULATION: Functions to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
|
||||||
|
[text] SPRITEFONT SUPPORT: Added support for AngelCode fonts (.fnt) and TrueType fonts (.ttf).
|
||||||
|
[gestures] REDESIGN: Gestures system simplified and prepared to process generic touch events, including mouse events (multiplatform).
|
||||||
|
[physac] NEW MODULE: Basic 2D physics support, use colliders and rigidbodies; apply forces to physic objects.
|
||||||
|
|
||||||
|
other changes:
|
||||||
|
[rlgl] Removed GLEW library dependency, now using GLAD
|
||||||
|
[rlgl] Implemented alternative to glGetTexImage() on OpenGL ES
|
||||||
|
[rlgl] Using depth data on batch drawing
|
||||||
|
[rlgl] Reviewed glReadPixels() function
|
||||||
|
[core][rlgl] Reviewed raycast system, now 3D picking works
|
||||||
|
[core] Android: Reviewed Android App cycle, paused if inactive
|
||||||
|
[shaders] Implemented Blinn-Phong lighting shading model
|
||||||
|
[textures] Implemented Floyd-Steinberg dithering - ImageDither()
|
||||||
|
[text] Added line-break support to DrawText()
|
||||||
|
[text] Added TrueType Fonts support (using stb_truetype)
|
||||||
|
[models] Implement function: CalculateBoundingBox(Mesh mesh)
|
||||||
|
[models] Added functions to check Ray collisions
|
||||||
|
[models] Improve map resolution control on LoadHeightmap()
|
||||||
|
[camera] Corrected small-glitch on zoom-in with mouse-wheel
|
||||||
|
[gestures] Implemented SetGesturesEnabled() to enable only some gestures
|
||||||
|
[gestures] Implemented GetElapsedTime() on Windows system
|
||||||
|
[gestures] Support mouse gestures for desktop platforms
|
||||||
|
[raymath] Complete review of the module and converted to header-only
|
||||||
|
[easings] Added new module for easing animations
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[*] Lots of tweaks around
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.3.0 (01 September 2015)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This version supposed a big boost for raylib, new modules have been added with lots of features.
|
||||||
|
Most of the modules have been completely reviewed to accomodate to the new features.
|
||||||
|
Over 50 new functions have been added to previous raylib version.
|
||||||
|
Most of the examples have been redone and +10 new advanced examples have been added.
|
||||||
|
|
||||||
|
BIG changes:
|
||||||
|
[rlgl] SHADERS: Support for model shaders and postprocessing shaders (multiple functions)
|
||||||
|
[textures] FORMATS: Support for multiple internal formats, including compressed formats
|
||||||
|
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
|
||||||
|
[gestures] NEW MODULE: Gestures system for Android and HTML5 platforms
|
||||||
|
[raygui] NEW MODULE: Set of IMGUI elements for tools development (experimental)
|
||||||
|
|
||||||
|
smaller changes:
|
||||||
|
[rlgl] Added check for OpenGL supported extensions
|
||||||
|
[rlgl] Added function SetBlenMode() to select some predefined blending modes
|
||||||
|
[core] Added support for drop&drag of external files into running program
|
||||||
|
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
|
||||||
|
[core] Renamed function SetFlags() to SetConfigFlags()
|
||||||
|
[shapes] Simplified some functions to improve performance
|
||||||
|
[textures] Review of Image struct to support multiple data formats
|
||||||
|
[textures] Added function LoadImageEx()
|
||||||
|
[textures] Added function LoadImageRaw()
|
||||||
|
[textures] Added function LoadTextureEx()
|
||||||
|
[textures] Simplified function parameters LoadTextureFromImage()
|
||||||
|
[textures] Added function GetImageData()
|
||||||
|
[textures] Added function GetTextureData()
|
||||||
|
[textures] Renamed function ConvertToPOT() to ImageConvertToPOT()
|
||||||
|
[textures] Added function ImageConvertFormat()
|
||||||
|
[textures] Added function GenTextureMipmaps()
|
||||||
|
[text] Added support for Latin-1 Extended characters for default font
|
||||||
|
[text] Redesigned SpriteFont struct, replaced Character struct by Rectangle
|
||||||
|
[text] Removed function GetFontBaseSize(), use directly spriteFont.size
|
||||||
|
[models] Review of struct: Model (added shaders support)
|
||||||
|
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
|
||||||
|
[models] Added function DrawCubeTexture()
|
||||||
|
[models] Added function DrawQuad()
|
||||||
|
[models] Added function DrawRay()
|
||||||
|
[models] Simplified funtion DrawPlane()
|
||||||
|
[models] Removed function DrawPlaneEx()
|
||||||
|
[models] Simplified funtion DrawGizmo()
|
||||||
|
[models] Removed function DrawGizmoEx()
|
||||||
|
[models] Added function LoadModelEx()
|
||||||
|
[models] Review of function LoadCubicMap()
|
||||||
|
[models] Added function ResolveCollisionCubicmap()
|
||||||
|
[audio] Decopupled from raylib, now this module can be used as standalone
|
||||||
|
[audio] Added function UpdateMusicStream()
|
||||||
|
[raymath] Complete review of the module
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[*] Lots of tweaks around
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.2.2 (31 December 2014)
|
||||||
|
-----------------------------------------------
|
||||||
|
[*] Added support for HTML5 compiling (emscripten, asm.js)
|
||||||
|
[core] Corrected bug on input handling (keyboard and mouse)
|
||||||
|
[textures] Renamed function CreateTexture() to LoadTextureFromImage()
|
||||||
|
[textures] Added function ConvertToPOT()
|
||||||
|
[rlgl] Added support for color tint on models on GL 3.3+ and ES2
|
||||||
|
[rlgl] Added support for normals on models
|
||||||
|
[models] Corrected bug on DrawBillboard()
|
||||||
|
[models] Corrected bug on DrawHeightmap()
|
||||||
|
[models] Renamed LoadCubesmap() to LoadCubicmap()
|
||||||
|
[audio] Added function LoadSoundFromWave()
|
||||||
|
[makefile] Added support for Linux and OSX compiling
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[*] Lots of tweaks around
|
||||||
|
|
||||||
|
---------------------------------------------------------------
|
||||||
|
Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update)
|
||||||
|
---------------------------------------------------------------
|
||||||
|
[core] Added function SetupFlags() to preconfigure raylib Window
|
||||||
|
[core] Corrected bug on fullscreen mode
|
||||||
|
[rlgl] rlglDrawmodel() - Added rotation on Y axis
|
||||||
|
[text] MeasureTextEx() - Corrected bug on measures for default font
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.2 (16 September 2014)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This version supposed a complete redesign of the [core] module to support Android and Raspberry Pi.
|
||||||
|
Multiples modules have also been tweaked to accomodate to the new platforms, specially [rlgl]
|
||||||
|
|
||||||
|
[core] Added multiple platforms support: Android and Raspberry Pi
|
||||||
|
[core] InitWindow() - Complete rewrite and split for Android
|
||||||
|
[core] InitDisplay() - Internal function added to calculate proper display size
|
||||||
|
[core] InitGraphics() - Internal function where OpenGL graphics are initialized
|
||||||
|
[core] Complete refactoring of input functions to accomodate to new platforms
|
||||||
|
[core] Mouse and Keyboard raw data reading functions added for Raspberry Pi
|
||||||
|
[core] GetTouchX(), GetTouchY() - Added for Android
|
||||||
|
[core] Added Android callbacks to process inputs and Android activity commands
|
||||||
|
[rlgl] Adjusted buffers depending on platform
|
||||||
|
[rlgl] Added security check in case deployed vertex excess buffer size
|
||||||
|
[rlgl] Adjusted indices type depending on GL version (int or short)
|
||||||
|
[rlgl] Fallback to VBOs only usage if VAOs not supported on ES2
|
||||||
|
[rlgl] rlglLoadModel() stores vbo ids on new Model struct
|
||||||
|
[textures] Added support for PKM files (ETC1, ETC2 compression support)
|
||||||
|
[shapes] DrawRectangleV() - Modified, depending on OGL version uses TRIANGLES or QUADS
|
||||||
|
[text] LoadSpriteFont() - Modified to use LoadImage()
|
||||||
|
[models] Minor changes on models loading to accomodate to new Model struct
|
||||||
|
[audio] PauseMusicStream(), ResumeMusicStream() - Added
|
||||||
|
[audio] Reduced music buffer size to avoid stalls on Raspberry Pi
|
||||||
|
[src] Added makefile for Windows and RPI
|
||||||
|
[src] Added resources file (raylib icon and executable info)
|
||||||
|
[examples] Added makefile for Windows and RPI
|
||||||
|
[examples] Renamed and merged with test examples for coherence with module names
|
||||||
|
[templates] Added multiple templates to be use as a base-code for games
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 1.1.1 (22 July 2014)
|
Release: raylib 1.1.1 (22 July 2014)
|
||||||
|
16
HELPME.md
@@ -7,23 +7,21 @@ please, [let me know][raysan5].
|
|||||||
The following help is highly appreciated:
|
The following help is highly appreciated:
|
||||||
|
|
||||||
- C programming - Can you write / review / test / improve the code?
|
- C programming - Can you write / review / test / improve the code?
|
||||||
- Translators / Localizators - Can you translate raylib to another language?
|
|
||||||
- Documentation / Tutorials / Example writters - Can you write some tutorial / example?
|
- Documentation / Tutorials / Example writters - Can you write some tutorial / example?
|
||||||
- Web Development - Can you help with the web? Can you setup a forum?
|
- Web Development - Can you help with the web? Can you setup a forum?
|
||||||
- Porting to Linux, OSX... - Can you compile and test raylib on another OS?
|
- Porting to Linux, OSX, RaspberryPi, consoles... - Can you compile and test raylib on another systems?
|
||||||
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
||||||
|
|
||||||
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
||||||
with a small [donation](http://www.raylib.com/helpme.htm) (just some euros...). It will really motivate to continue improving this project (and pay some bills… or some coffee).
|
with a small [donation](http://www.raylib.com/helpme.htm) or contributing with [raylib patreon](https://www.patreon.com/raysan5). It will really motivate to continue improving this project (and pay some bills… or some coffee).
|
||||||
|
|
||||||
raylib philosophy
|
raylib philosophy
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself.
|
* raylib is a tool to LEARN 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
|
* 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 has not a clear usefulness, better not to include it.
|
||||||
has not a clear usefulness, better not to include it.
|
|
||||||
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
||||||
* raylib is, hopefully, collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
|
* raylib is collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
|
||||||
* raylib's license (and its external libs respective licenses) allow using it for commercial products.
|
* raylib's license (and its external libs respective licenses) allow using it for commercial products.
|
||||||
|
|
||||||
contact
|
contact
|
||||||
@@ -32,6 +30,8 @@ contact
|
|||||||
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||||
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
|
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
344
LICENSE.md
@@ -7,7 +7,7 @@ source code
|
|||||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
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:
|
BSD-like license that allows static linking with closed source software:
|
||||||
|
|
||||||
Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
This software is provided "as-is", without any express or implied warranty. In no event
|
This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
will the authors be held liable for any damages arising from the use of this software.
|
will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -37,3 +37,345 @@ All rBMF fonts provided with raylib are free to use (freeware) and have been des
|
|||||||
* Mecha - Captain Falcon
|
* Mecha - Captain Falcon
|
||||||
* PixelPlay - Aleksander Shevchuk
|
* PixelPlay - Aleksander Shevchuk
|
||||||
* PixAntiqua - Gerhard Großmann
|
* PixAntiqua - Gerhard Großmann
|
||||||
|
|
||||||
|
3d models
|
||||||
|
---------
|
||||||
|
|
||||||
|
dwarf 3d model used in examples is created by David Moreno and licensed as Creative Commons Attribution-NonCommercial 3.0
|
||||||
|
|
||||||
|
Full license provided below:
|
||||||
|
|
||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
Attribution-NonCommercial 3.0 Unported
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
|
||||||
|
DAMAGES RESULTING FROM ITS USE.
|
||||||
|
|
||||||
|
License
|
||||||
|
|
||||||
|
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
|
||||||
|
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
|
||||||
|
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
|
||||||
|
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||||
|
|
||||||
|
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
|
||||||
|
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
|
||||||
|
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
|
||||||
|
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
|
||||||
|
CONDITIONS.
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
|
||||||
|
a. "Adaptation" means a work based upon the Work, or upon the Work and
|
||||||
|
other pre-existing works, such as a translation, adaptation,
|
||||||
|
derivative work, arrangement of music or other alterations of a
|
||||||
|
literary or artistic work, or phonogram or performance and includes
|
||||||
|
cinematographic adaptations or any other form in which the Work may be
|
||||||
|
recast, transformed, or adapted including in any form recognizably
|
||||||
|
derived from the original, except that a work that constitutes a
|
||||||
|
Collection will not be considered an Adaptation for the purpose of
|
||||||
|
this License. For the avoidance of doubt, where the Work is a musical
|
||||||
|
work, performance or phonogram, the synchronization of the Work in
|
||||||
|
timed-relation with a moving image ("synching") will be considered an
|
||||||
|
Adaptation for the purpose of this License.
|
||||||
|
b. "Collection" means a collection of literary or artistic works, such as
|
||||||
|
encyclopedias and anthologies, or performances, phonograms or
|
||||||
|
broadcasts, or other works or subject matter other than works listed
|
||||||
|
in Section 1(f) below, which, by reason of the selection and
|
||||||
|
arrangement of their contents, constitute intellectual creations, in
|
||||||
|
which the Work is included in its entirety in unmodified form along
|
||||||
|
with one or more other contributions, each constituting separate and
|
||||||
|
independent works in themselves, which together are assembled into a
|
||||||
|
collective whole. A work that constitutes a Collection will not be
|
||||||
|
considered an Adaptation (as defined above) for the purposes of this
|
||||||
|
License.
|
||||||
|
c. "Distribute" means to make available to the public the original and
|
||||||
|
copies of the Work or Adaptation, as appropriate, through sale or
|
||||||
|
other transfer of ownership.
|
||||||
|
d. "Licensor" means the individual, individuals, entity or entities that
|
||||||
|
offer(s) the Work under the terms of this License.
|
||||||
|
e. "Original Author" means, in the case of a literary or artistic work,
|
||||||
|
the individual, individuals, entity or entities who created the Work
|
||||||
|
or if no individual or entity can be identified, the publisher; and in
|
||||||
|
addition (i) in the case of a performance the actors, singers,
|
||||||
|
musicians, dancers, and other persons who act, sing, deliver, declaim,
|
||||||
|
play in, interpret or otherwise perform literary or artistic works or
|
||||||
|
expressions of folklore; (ii) in the case of a phonogram the producer
|
||||||
|
being the person or legal entity who first fixes the sounds of a
|
||||||
|
performance or other sounds; and, (iii) in the case of broadcasts, the
|
||||||
|
organization that transmits the broadcast.
|
||||||
|
f. "Work" means the literary and/or artistic work offered under the terms
|
||||||
|
of this License including without limitation any production in the
|
||||||
|
literary, scientific and artistic domain, whatever may be the mode or
|
||||||
|
form of its expression including digital form, such as a book,
|
||||||
|
pamphlet and other writing; a lecture, address, sermon or other work
|
||||||
|
of the same nature; a dramatic or dramatico-musical work; a
|
||||||
|
choreographic work or entertainment in dumb show; a musical
|
||||||
|
composition with or without words; a cinematographic work to which are
|
||||||
|
assimilated works expressed by a process analogous to cinematography;
|
||||||
|
a work of drawing, painting, architecture, sculpture, engraving or
|
||||||
|
lithography; a photographic work to which are assimilated works
|
||||||
|
expressed by a process analogous to photography; a work of applied
|
||||||
|
art; an illustration, map, plan, sketch or three-dimensional work
|
||||||
|
relative to geography, topography, architecture or science; a
|
||||||
|
performance; a broadcast; a phonogram; a compilation of data to the
|
||||||
|
extent it is protected as a copyrightable work; or a work performed by
|
||||||
|
a variety or circus performer to the extent it is not otherwise
|
||||||
|
considered a literary or artistic work.
|
||||||
|
g. "You" means an individual or entity exercising rights under this
|
||||||
|
License who has not previously violated the terms of this License with
|
||||||
|
respect to the Work, or who has received express permission from the
|
||||||
|
Licensor to exercise rights under this License despite a previous
|
||||||
|
violation.
|
||||||
|
h. "Publicly Perform" means to perform public recitations of the Work and
|
||||||
|
to communicate to the public those public recitations, by any means or
|
||||||
|
process, including by wire or wireless means or public digital
|
||||||
|
performances; to make available to the public Works in such a way that
|
||||||
|
members of the public may access these Works from a place and at a
|
||||||
|
place individually chosen by them; to perform the Work to the public
|
||||||
|
by any means or process and the communication to the public of the
|
||||||
|
performances of the Work, including by public digital performance; to
|
||||||
|
broadcast and rebroadcast the Work by any means including signs,
|
||||||
|
sounds or images.
|
||||||
|
i. "Reproduce" means to make copies of the Work by any means including
|
||||||
|
without limitation by sound or visual recordings and the right of
|
||||||
|
fixation and reproducing fixations of the Work, including storage of a
|
||||||
|
protected performance or phonogram in digital form or other electronic
|
||||||
|
medium.
|
||||||
|
|
||||||
|
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
|
||||||
|
limit, or restrict any uses free from copyright or rights arising from
|
||||||
|
limitations or exceptions that are provided for in connection with the
|
||||||
|
copyright protection under copyright law or other applicable laws.
|
||||||
|
|
||||||
|
3. License Grant. Subject to the terms and conditions of this License,
|
||||||
|
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||||
|
perpetual (for the duration of the applicable copyright) license to
|
||||||
|
exercise the rights in the Work as stated below:
|
||||||
|
|
||||||
|
a. to Reproduce the Work, to incorporate the Work into one or more
|
||||||
|
Collections, and to Reproduce the Work as incorporated in the
|
||||||
|
Collections;
|
||||||
|
b. to create and Reproduce Adaptations provided that any such Adaptation,
|
||||||
|
including any translation in any medium, takes reasonable steps to
|
||||||
|
clearly label, demarcate or otherwise identify that changes were made
|
||||||
|
to the original Work. For example, a translation could be marked "The
|
||||||
|
original work was translated from English to Spanish," or a
|
||||||
|
modification could indicate "The original work has been modified.";
|
||||||
|
c. to Distribute and Publicly Perform the Work including as incorporated
|
||||||
|
in Collections; and,
|
||||||
|
d. to Distribute and Publicly Perform Adaptations.
|
||||||
|
|
||||||
|
The above rights may be exercised in all media and formats whether now
|
||||||
|
known or hereafter devised. The above rights include the right to make
|
||||||
|
such modifications as are technically necessary to exercise the rights in
|
||||||
|
other media and formats. Subject to Section 8(f), all rights not expressly
|
||||||
|
granted by Licensor are hereby reserved, including but not limited to the
|
||||||
|
rights set forth in Section 4(d).
|
||||||
|
|
||||||
|
4. Restrictions. The license granted in Section 3 above is expressly made
|
||||||
|
subject to and limited by the following restrictions:
|
||||||
|
|
||||||
|
a. You may Distribute or Publicly Perform the Work only under the terms
|
||||||
|
of this License. You must include a copy of, or the Uniform Resource
|
||||||
|
Identifier (URI) for, this License with every copy of the Work You
|
||||||
|
Distribute or Publicly Perform. You may not offer or impose any terms
|
||||||
|
on the Work that restrict the terms of this License or the ability of
|
||||||
|
the recipient of the Work to exercise the rights granted to that
|
||||||
|
recipient under the terms of the License. You may not sublicense the
|
||||||
|
Work. You must keep intact all notices that refer to this License and
|
||||||
|
to the disclaimer of warranties with every copy of the Work You
|
||||||
|
Distribute or Publicly Perform. When You Distribute or Publicly
|
||||||
|
Perform the Work, You may not impose any effective technological
|
||||||
|
measures on the Work that restrict the ability of a recipient of the
|
||||||
|
Work from You to exercise the rights granted to that recipient under
|
||||||
|
the terms of the License. This Section 4(a) applies to the Work as
|
||||||
|
incorporated in a Collection, but this does not require the Collection
|
||||||
|
apart from the Work itself to be made subject to the terms of this
|
||||||
|
License. If You create a Collection, upon notice from any Licensor You
|
||||||
|
must, to the extent practicable, remove from the Collection any credit
|
||||||
|
as required by Section 4(c), as requested. If You create an
|
||||||
|
Adaptation, upon notice from any Licensor You must, to the extent
|
||||||
|
practicable, remove from the Adaptation any credit as required by
|
||||||
|
Section 4(c), as requested.
|
||||||
|
b. You may not exercise any of the rights granted to You in Section 3
|
||||||
|
above in any manner that is primarily intended for or directed toward
|
||||||
|
commercial advantage or private monetary compensation. The exchange of
|
||||||
|
the Work for other copyrighted works by means of digital file-sharing
|
||||||
|
or otherwise shall not be considered to be intended for or directed
|
||||||
|
toward commercial advantage or private monetary compensation, provided
|
||||||
|
there is no payment of any monetary compensation in connection with
|
||||||
|
the exchange of copyrighted works.
|
||||||
|
c. If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||||
|
Collections, You must, unless a request has been made pursuant to
|
||||||
|
Section 4(a), keep intact all copyright notices for the Work and
|
||||||
|
provide, reasonable to the medium or means You are utilizing: (i) the
|
||||||
|
name of the Original Author (or pseudonym, if applicable) if supplied,
|
||||||
|
and/or if the Original Author and/or Licensor designate another party
|
||||||
|
or parties (e.g., a sponsor institute, publishing entity, journal) for
|
||||||
|
attribution ("Attribution Parties") in Licensor's copyright notice,
|
||||||
|
terms of service or by other reasonable means, the name of such party
|
||||||
|
or parties; (ii) the title of the Work if supplied; (iii) to the
|
||||||
|
extent reasonably practicable, the URI, if any, that Licensor
|
||||||
|
specifies to be associated with the Work, unless such URI does not
|
||||||
|
refer to the copyright notice or licensing information for the Work;
|
||||||
|
and, (iv) consistent with Section 3(b), in the case of an Adaptation,
|
||||||
|
a credit identifying the use of the Work in the Adaptation (e.g.,
|
||||||
|
"French translation of the Work by Original Author," or "Screenplay
|
||||||
|
based on original Work by Original Author"). The credit required by
|
||||||
|
this Section 4(c) may be implemented in any reasonable manner;
|
||||||
|
provided, however, that in the case of a Adaptation or Collection, at
|
||||||
|
a minimum such credit will appear, if a credit for all contributing
|
||||||
|
authors of the Adaptation or Collection appears, then as part of these
|
||||||
|
credits and in a manner at least as prominent as the credits for the
|
||||||
|
other contributing authors. For the avoidance of doubt, You may only
|
||||||
|
use the credit required by this Section for the purpose of attribution
|
||||||
|
in the manner set out above and, by exercising Your rights under this
|
||||||
|
License, You may not implicitly or explicitly assert or imply any
|
||||||
|
connection with, sponsorship or endorsement by the Original Author,
|
||||||
|
Licensor and/or Attribution Parties, as appropriate, of You or Your
|
||||||
|
use of the Work, without the separate, express prior written
|
||||||
|
permission of the Original Author, Licensor and/or Attribution
|
||||||
|
Parties.
|
||||||
|
d. For the avoidance of doubt:
|
||||||
|
|
||||||
|
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
|
||||||
|
which the right to collect royalties through any statutory or
|
||||||
|
compulsory licensing scheme cannot be waived, the Licensor
|
||||||
|
reserves the exclusive right to collect such royalties for any
|
||||||
|
exercise by You of the rights granted under this License;
|
||||||
|
ii. Waivable Compulsory License Schemes. In those jurisdictions in
|
||||||
|
which the right to collect royalties through any statutory or
|
||||||
|
compulsory licensing scheme can be waived, the Licensor reserves
|
||||||
|
the exclusive right to collect such royalties for any exercise by
|
||||||
|
You of the rights granted under this License if Your exercise of
|
||||||
|
such rights is for a purpose or use which is otherwise than
|
||||||
|
noncommercial as permitted under Section 4(b) and otherwise waives
|
||||||
|
the right to collect royalties through any statutory or compulsory
|
||||||
|
licensing scheme; and,
|
||||||
|
iii. Voluntary License Schemes. The Licensor reserves the right to
|
||||||
|
collect royalties, whether individually or, in the event that the
|
||||||
|
Licensor is a member of a collecting society that administers
|
||||||
|
voluntary licensing schemes, via that society, from any exercise
|
||||||
|
by You of the rights granted under this License that is for a
|
||||||
|
purpose or use which is otherwise than noncommercial as permitted
|
||||||
|
under Section 4(c).
|
||||||
|
e. Except as otherwise agreed in writing by the Licensor or as may be
|
||||||
|
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||||
|
Publicly Perform the Work either by itself or as part of any
|
||||||
|
Adaptations or Collections, You must not distort, mutilate, modify or
|
||||||
|
take other derogatory action in relation to the Work which would be
|
||||||
|
prejudicial to the Original Author's honor or reputation. Licensor
|
||||||
|
agrees that in those jurisdictions (e.g. Japan), in which any exercise
|
||||||
|
of the right granted in Section 3(b) of this License (the right to
|
||||||
|
make Adaptations) would be deemed to be a distortion, mutilation,
|
||||||
|
modification or other derogatory action prejudicial to the Original
|
||||||
|
Author's honor and reputation, the Licensor will waive or not assert,
|
||||||
|
as appropriate, this Section, to the fullest extent permitted by the
|
||||||
|
applicable national law, to enable You to reasonably exercise Your
|
||||||
|
right under Section 3(b) of this License (right to make Adaptations)
|
||||||
|
but not otherwise.
|
||||||
|
|
||||||
|
5. Representations, Warranties and Disclaimer
|
||||||
|
|
||||||
|
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||||
|
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||||
|
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||||
|
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||||
|
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||||
|
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
|
||||||
|
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
|
||||||
|
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
|
||||||
|
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
||||||
|
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
7. Termination
|
||||||
|
|
||||||
|
a. This License and the rights granted hereunder will terminate
|
||||||
|
automatically upon any breach by You of the terms of this License.
|
||||||
|
Individuals or entities who have received Adaptations or Collections
|
||||||
|
from You under this License, however, will not have their licenses
|
||||||
|
terminated provided such individuals or entities remain in full
|
||||||
|
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
|
||||||
|
survive any termination of this License.
|
||||||
|
b. Subject to the above terms and conditions, the license granted here is
|
||||||
|
perpetual (for the duration of the applicable copyright in the Work).
|
||||||
|
Notwithstanding the above, Licensor reserves the right to release the
|
||||||
|
Work under different license terms or to stop distributing the Work at
|
||||||
|
any time; provided, however that any such election will not serve to
|
||||||
|
withdraw this License (or any other license that has been, or is
|
||||||
|
required to be, granted under the terms of this License), and this
|
||||||
|
License will continue in full force and effect unless terminated as
|
||||||
|
stated above.
|
||||||
|
|
||||||
|
8. Miscellaneous
|
||||||
|
|
||||||
|
a. Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||||
|
the Licensor offers to the recipient a license to the Work on the same
|
||||||
|
terms and conditions as the license granted to You under this License.
|
||||||
|
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||||
|
offers to the recipient a license to the original Work on the same
|
||||||
|
terms and conditions as the license granted to You under this License.
|
||||||
|
c. If any provision of this License is invalid or unenforceable under
|
||||||
|
applicable law, it shall not affect the validity or enforceability of
|
||||||
|
the remainder of the terms of this License, and without further action
|
||||||
|
by the parties to this agreement, such provision shall be reformed to
|
||||||
|
the minimum extent necessary to make such provision valid and
|
||||||
|
enforceable.
|
||||||
|
d. No term or provision of this License shall be deemed waived and no
|
||||||
|
breach consented to unless such waiver or consent shall be in writing
|
||||||
|
and signed by the party to be charged with such waiver or consent.
|
||||||
|
e. This License constitutes the entire agreement between the parties with
|
||||||
|
respect to the Work licensed here. There are no understandings,
|
||||||
|
agreements or representations with respect to the Work not specified
|
||||||
|
here. Licensor shall not be bound by any additional provisions that
|
||||||
|
may appear in any communication from You. This License may not be
|
||||||
|
modified without the mutual written agreement of the Licensor and You.
|
||||||
|
f. The rights granted under, and the subject matter referenced, in this
|
||||||
|
License were drafted utilizing the terminology of the Berne Convention
|
||||||
|
for the Protection of Literary and Artistic Works (as amended on
|
||||||
|
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||||
|
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
|
||||||
|
and the Universal Copyright Convention (as revised on July 24, 1971).
|
||||||
|
These rights and subject matter take effect in the relevant
|
||||||
|
jurisdiction in which the License terms are sought to be enforced
|
||||||
|
according to the corresponding provisions of the implementation of
|
||||||
|
those treaty provisions in the applicable national law. If the
|
||||||
|
standard suite of rights granted under applicable copyright law
|
||||||
|
includes additional rights not granted under this License, such
|
||||||
|
additional rights are deemed to be included in the License; this
|
||||||
|
License is not intended to restrict the license of any rights under
|
||||||
|
applicable law.
|
||||||
|
|
||||||
|
|
||||||
|
Creative Commons Notice
|
||||||
|
|
||||||
|
Creative Commons is not a party to this License, and makes no warranty
|
||||||
|
whatsoever in connection with the Work. Creative Commons will not be
|
||||||
|
liable to You or any party on any legal theory for any damages
|
||||||
|
whatsoever, including without limitation any general, special,
|
||||||
|
incidental or consequential damages arising in connection to this
|
||||||
|
license. Notwithstanding the foregoing two (2) sentences, if Creative
|
||||||
|
Commons has expressly identified itself as the Licensor hereunder, it
|
||||||
|
shall have all rights and obligations of Licensor.
|
||||||
|
|
||||||
|
Except for the limited purpose of indicating to the public that the
|
||||||
|
Work is licensed under the CCPL, Creative Commons does not authorize
|
||||||
|
the use by either party of the trademark "Creative Commons" or any
|
||||||
|
related trademark or logo of Creative Commons without the prior
|
||||||
|
written consent of Creative Commons. Any permitted use will be in
|
||||||
|
compliance with Creative Commons' then-current trademark usage
|
||||||
|
guidelines, as may be published on its website or otherwise made
|
||||||
|
available upon request from time to time. For the avoidance of doubt,
|
||||||
|
this trademark restriction does not form part of the License.
|
||||||
|
|
||||||
|
Creative Commons may be contacted at https://creativecommons.org/.
|
||||||
|
250
README.md
@@ -1,19 +1,20 @@
|
|||||||
<img src="http://www.raylib.com/img/fb_raylib_logo.png" width=256>
|
<img src="https://github.com/raysan5/raylib/blob/master/logo/logo256x256.png" width=256>
|
||||||
|
|
||||||
about
|
about
|
||||||
-----
|
-----
|
||||||
|
|
||||||
raylib is a simple and easy-to-use library to learn videogames programming.
|
raylib is a simple and easy-to-use library to learn videogames programming.
|
||||||
|
|
||||||
raylib is highly inspired by Borland BGI graphics lib (more specifically WinBGI) and by XNA framework.
|
raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
|
||||||
Allegro and SDL have also been analyzed for reference.
|
|
||||||
|
|
||||||
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm)
|
NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming;
|
||||||
|
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
|
||||||
|
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.htm)
|
||||||
|
|
||||||
history
|
history
|
||||||
-------
|
-------
|
||||||
|
|
||||||
I've developed videogames for some years and last year I had to taught videogames development
|
I've developed videogames for some years and 4 years ago I started teaching videogames development
|
||||||
to young people with artistic profile, most of them had never written a single line of code.
|
to young people with artistic profile, most of them had never written a single line of code.
|
||||||
|
|
||||||
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
||||||
@@ -32,7 +33,7 @@ I've coded quite a lot in C# and XNA and I really love it (in fact, my students
|
|||||||
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
||||||
raylib to XNA, MonoGame or similar libs extremely easily.
|
raylib to XNA, MonoGame or similar libs extremely easily.
|
||||||
|
|
||||||
raylib started as a weekend project and after three months of hard work, first version was published.
|
raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
|
||||||
|
|
||||||
Enjoy it.
|
Enjoy it.
|
||||||
|
|
||||||
@@ -42,10 +43,10 @@ notes on raylib 1.1
|
|||||||
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
||||||
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||||
|
|
||||||
A new module named [rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translate raylib-OpenGL-style
|
A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style
|
||||||
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||||
|
|
||||||
[rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath] (https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
||||||
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||||
|
|
||||||
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
||||||
@@ -53,28 +54,162 @@ support of DDS texture files (compressed and uncompressed) along with mipmaps su
|
|||||||
|
|
||||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
|
||||||
|
|
||||||
Enjoy it.
|
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/).
|
||||||
|
|
||||||
|
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
|
||||||
|
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.
|
||||||
|
|
||||||
|
A new display initialization system has been created to support multiple resolutions, adding black bars if required;
|
||||||
|
user only defines desired screen size and it gets properly displayed.
|
||||||
|
|
||||||
|
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
||||||
|
|
||||||
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
||||||
|
|
||||||
|
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
|
||||||
|
|
||||||
|
notes on raylib 1.3
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
|
||||||
|
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
|
||||||
|
|
||||||
|
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
|
||||||
|
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
|
||||||
|
in this release, check raylib/shaders folder.
|
||||||
|
|
||||||
|
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/develop/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/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
|
||||||
|
|
||||||
|
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||||
|
|
||||||
|
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (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.
|
||||||
|
|
||||||
|
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||||
|
|
||||||
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
|
||||||
|
|
||||||
|
notes on raylib 1.4
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
|
||||||
|
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||||
|
|
||||||
|
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
|
||||||
|
Now a basic image processing can be done before converting the image to texture for usage.
|
||||||
|
|
||||||
|
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
|
||||||
|
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||||
|
|
||||||
|
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
|
||||||
|
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||||
|
|
||||||
|
[raymath](https://github.com/raysan5/raylib/blob/develop/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/develop/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.
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
||||||
|
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
|
||||||
|
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
|
||||||
|
|
||||||
|
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
|
||||||
|
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
|
||||||
|
|
||||||
|
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
|
||||||
|
|
||||||
|
notes on raylib 1.5
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||||
|
|
||||||
|
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
|
||||||
|
|
||||||
|
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
||||||
|
|
||||||
|
New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
|
||||||
|
|
||||||
|
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
||||||
|
|
||||||
|
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
|
||||||
|
|
||||||
|
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/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/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/develop/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/develop/CHANGELOG) file for a more detailed list of changes.
|
||||||
|
|
||||||
|
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
|
||||||
|
|
||||||
|
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||||
|
|
||||||
|
notes on raylib 1.6
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
||||||
|
|
||||||
|
Complete raylib LUA binding. All raylib functions plus the +60 code examples have been ported to LUA, now LUA users can enjoy coding videogames in LUA while using all the internal power of raylib. This addition also open the doors to LUA scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to LUA scripts while keep using raylib functionality.
|
||||||
|
|
||||||
|
Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
|
||||||
|
|
||||||
|
Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
||||||
|
|
||||||
|
Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
||||||
|
|
||||||
|
Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
||||||
|
|
||||||
|
Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
||||||
|
|
||||||
|
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||||
|
|
||||||
|
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
|
||||||
|
|
||||||
|
|
||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Written in plain C code (C99)
|
* Written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
|
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
|
||||||
* Unique OpenGL abstraction layer [rlgl]
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
||||||
* Powerful fonts module with SpriteFonts support
|
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
* Multiple textures support, including DDS and mipmaps generation
|
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
|
||||||
* Basic 3d support for Shapes, Models, Heightmaps and Billboards
|
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||||
* Powerful math module for Vector and Matrix operations [raymath]
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
* Audio loading and playing with streaming support
|
* Shaders support, including Model shaders and Postprocessing shaders
|
||||||
|
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||||
|
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD)
|
||||||
|
* VR stereo rendering support with configurable HMD device parameters
|
||||||
|
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
|
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
||||||
|
* Complete binding to LUA
|
||||||
|
|
||||||
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for
|
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
|
||||||
window/context and input management (clean, focused, great license, well documented, modern, ...).
|
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
|
||||||
|
|
||||||
raylib is licensed under a zlib/libpng license like GLFW3. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
|
||||||
|
to accomodate to Android, Raspberry Pi and HTML5.
|
||||||
|
|
||||||
tool requirements
|
On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
|
||||||
|
|
||||||
|
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
||||||
|
|
||||||
|
On Oculus Rift CV1, raylib uses Oculus PC SDK libraries but only the core C library ([LibOVR](https://github.com/raysan5/raylib/tree/develop/src/external/OculusSDK/LibOVR)); runtime library (LibOVRRT32_1.dll) must be linked at compilation time.
|
||||||
|
|
||||||
|
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
||||||
|
|
||||||
|
tools requirements
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
raylib has been developed using exclusively two tools:
|
raylib has been developed using exclusively two tools:
|
||||||
@@ -88,41 +223,17 @@ I believe those are the best tools to train spartan-programmers.
|
|||||||
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
|
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
|
||||||
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
|
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
|
||||||
|
|
||||||
Since raylib v1.1, you can download a windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
|
Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
|
||||||
|
|
||||||
building
|
building source (generate libraylib.a)
|
||||||
--------
|
--------------------------------------
|
||||||
|
|
||||||
raylib could be build with the following command lines (Using GCC compiler):
|
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||||
|
|
||||||
cd raylib/src
|
building examples
|
||||||
gcc -c core.c -std=c99 -Wall
|
-----------------
|
||||||
gcc -c shapes.c -std=c99 -Wall
|
|
||||||
gcc -c textures.c -std=c99 -Wall
|
|
||||||
gcc -c text.c -std=c99 -Wall
|
|
||||||
gcc -c models.c -std=c99 -Wall
|
|
||||||
gcc -c raymath.c -std=c99 -Wall
|
|
||||||
gcc -c rlgl.c -std=c99 -Wall
|
|
||||||
gcc -c audio.c -std=c99 -Wall
|
|
||||||
gcc -c utils.c -std=c99 -Wall
|
|
||||||
gcc -c stb_image.c -std=c99 -Wall
|
|
||||||
gcc -c stb_vorbis.c -std=c99 -Wall
|
|
||||||
|
|
||||||
ar rcs libraylib.a core.o shapes.o textures.o stb_image.o text.o models.o raymath.o rlgl.o utils.o stb_vorbis.o audio.o
|
|
||||||
|
|
||||||
To compile examples, make sure raylib.h is placed in the include path and the following libraries are placed in the libraries path:
|
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||||
|
|
||||||
libraylib.a - raylib
|
|
||||||
libglfw3.a - GLFW3 (static version)
|
|
||||||
libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2
|
|
||||||
libopenal32.a - OpenAL, audio device management
|
|
||||||
|
|
||||||
It's also recommended to link with file icon.o for fancy raylib icon usage. Linking command:
|
|
||||||
|
|
||||||
cd raylib/examples
|
|
||||||
gcc -o test_code.exe test_code.c icon.o -lraylib -lglfw3 -lglew32 -lopenal32 -lopengl32 -lgdi32 -std=c99 -Wl,--subsystem,windows
|
|
||||||
|
|
||||||
If you have any doubt, [let me know][raysan5].
|
|
||||||
|
|
||||||
contact
|
contact
|
||||||
-------
|
-------
|
||||||
@@ -130,19 +241,38 @@ contact
|
|||||||
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||||
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
|
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
||||||
|
|
||||||
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
||||||
|
|
||||||
If you feel you can help, then, [helpme!] (http://www.raylib.com/helpme.htm)
|
If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
|
||||||
|
|
||||||
acknowledgments
|
acknowledgements
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
I believe that time is the most valuable resource and the following people have invested part of their time
|
||||||
|
contributing (in some way or another) to make raylib project better. Huge thanks!
|
||||||
|
|
||||||
- [Zopokx](https://github.com/Zopokx)
|
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
||||||
- [Elendow](http://www.elendow.com)
|
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
||||||
- Victor Dual
|
- Victor Dual for implementing and testing 3D shapes functions.
|
||||||
- Marc Palau
|
- 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 for helping on raygui development and tools development (raygui_styler).
|
||||||
|
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing 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 (paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
|
||||||
|
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
54
ROADMAP.md
@@ -1,22 +1,48 @@
|
|||||||
roadmap
|
roadmap
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Current version of raylib is quite complete and functional but there is still a lot of things I would like to improve.
|
Current version of raylib is quite complete and functional but there is still a lot of things to add and improve.
|
||||||
Here it is a list of features I would like to add and functions to improve.
|
Here it is a wish list of features I would like to add and functions to improve.
|
||||||
|
|
||||||
Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add.
|
Note raylib source code has multiple TODO points with pending things to review and improve. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||||
|
|
||||||
raylib v1.x
|
raylib 1.x
|
||||||
|
|
||||||
|
Basic GPU stats sytem (memory, draws, time...)
|
||||||
|
Improved custom file-format (.rres) and packaging tool
|
||||||
|
Procedural image generation functions (spot, gradient, noise...)
|
||||||
|
Procedural mesh generation functions (cube, cone, sphere...)
|
||||||
|
Touch-based camera controls for Android
|
||||||
|
Gamepad support on HTML5
|
||||||
|
|
||||||
|
raylib 1.6
|
||||||
|
|
||||||
|
[DONE] LUA scripting support (raylib lua wrapper)
|
||||||
|
[DONE] Redesigned audio module
|
||||||
|
|
||||||
|
raylib 1.5
|
||||||
|
|
||||||
|
[DONE] Support Oculus Rift CV1 and VR stereo rendering (simulator)
|
||||||
|
[DONE] Redesign Shaders/Textures system -> New Materials system
|
||||||
|
[DONE] Support lighting: Omni, Directional and Spot lights
|
||||||
|
[DONE] Redesign physics module (physac)
|
||||||
|
[DONE] Chiptunes audio modules support
|
||||||
|
|
||||||
|
raylib 1.4
|
||||||
|
|
||||||
|
[DONE] TTF fonts support (using stb_truetype)
|
||||||
|
[DONE] Raycast system for 3D picking (including collisions detection)
|
||||||
|
[DONE] Floyd-Steinberg dithering on 16bit image format conversion
|
||||||
|
[DONE] Basic image manipulation functions (crop, resize, draw...)
|
||||||
|
[DONE] Storage load/save data functionality
|
||||||
|
[DONE] Add Physics module (physac)
|
||||||
|
[DONE] Remove GLEW dependency -> Replaced by GLAD
|
||||||
|
[DONE] Redesign Raspberry PI inputs system
|
||||||
|
[DONE] Redesign gestures module to be multiplatform
|
||||||
|
[DONE] Module raymath as header-only and functions inline
|
||||||
|
[DONE] Add Easings module (easings.h)
|
||||||
|
|
||||||
- [DONE] Review Billboard Drawing functions
|
|
||||||
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
|
|
||||||
- Lighting support (only 3d mode)
|
|
||||||
- [DONE] Simple Collision Detection functions
|
|
||||||
- Default scene Camera controls (zoom, pan, rotate)
|
|
||||||
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
|
|
||||||
- [DONE] Software mipmapping generation and POT conversion (custom implementation)
|
|
||||||
- TTF fonts support
|
|
||||||
|
|
||||||
Any feature missing? Do you have a request? [Let me know!][raysan5]
|
Any feature missing? Do you have a request? [Let me know!][raysan5]
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
[isssues]: https://github.com/raysan5/raylib/issues
|
||||||
|
Before Width: | Height: | Size: 371 KiB After Width: | Height: | Size: 371 KiB |
BIN
docs/raylib_cheatsheet_v1.5.png
Normal file
After Width: | Height: | Size: 2.2 MiB |
547
examples/Makefile
Normal file
@@ -0,0 +1,547 @@
|
|||||||
|
#**************************************************************************************************
|
||||||
|
#
|
||||||
|
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
||||||
|
#
|
||||||
|
# NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2016 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.
|
||||||
|
#
|
||||||
|
# Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
#
|
||||||
|
# 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
# wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
# in the product documentation would be appreciated but is not required.
|
||||||
|
#
|
||||||
|
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
# as being the original software.
|
||||||
|
#
|
||||||
|
# 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
#
|
||||||
|
#**************************************************************************************************
|
||||||
|
|
||||||
|
# define raylib platform to compile for
|
||||||
|
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
||||||
|
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
||||||
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
|
# define NO to use OpenAL Soft as static library (shared by default)
|
||||||
|
SHARED_OPENAL ?= YES
|
||||||
|
|
||||||
|
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
PLATFORM_OS=WINDOWS
|
||||||
|
LIBPATH=win32
|
||||||
|
else
|
||||||
|
UNAMEOS:=$(shell uname)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
PLATFORM_OS=LINUX
|
||||||
|
LIBPATH=linux
|
||||||
|
else
|
||||||
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
|
PLATFORM_OS=OSX
|
||||||
|
LIBPATH=osx
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define compiler: gcc for C program, define as g++ for C++
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# define emscripten compiler
|
||||||
|
CC = emcc
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# define llvm compiler for mac
|
||||||
|
CC = clang
|
||||||
|
else
|
||||||
|
# define default gcc compiler
|
||||||
|
CC = gcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define compiler flags:
|
||||||
|
# -O2 defines optimization level
|
||||||
|
# -s strip unnecessary data from build
|
||||||
|
# -Wall turns on most, but not all, compiler warnings
|
||||||
|
# -std=c99 use standard C from 1999 revision
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
|
||||||
|
else
|
||||||
|
CFLAGS = -O2 -s -Wall -std=c99
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
|
||||||
|
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
|
||||||
|
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
|
|
||||||
|
# define raylib release directory for compiled library
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
RAYLIB_PATH = ../release/win32/mingw32
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
RAYLIB_PATH = ../release/linux
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
RAYLIB_PATH = ../release/osx
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
RAYLIB_PATH = ../release/html5
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
RAYLIB_PATH = ../release/rpi
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define any directories containing required header files
|
||||||
|
INCLUDES = -I. -I../src -I../src/external -I$(RAYLIB_PATH)
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# add standard directories for GNU/Linux
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
INCLUDES += -I/usr/local/include/raylib/
|
||||||
|
else ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# external libraries headers
|
||||||
|
# GLFW3
|
||||||
|
INCLUDES += -I../src/external/glfw3/include
|
||||||
|
# OpenAL Soft
|
||||||
|
INCLUDES += -I../src/external/openal_soft/include
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define library paths containing required libs
|
||||||
|
LFLAGS = -L. -L../src -L$(RAYLIB_PATH)
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
LFLAGS += -L/opt/vc/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# add standard directories for GNU/Linux
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# external libraries to link with
|
||||||
|
# GLFW3
|
||||||
|
LFLAGS += -L../src/external/glfw3/lib/$(LIBPATH)
|
||||||
|
# OpenAL Soft
|
||||||
|
LFLAGS += -L../src/external/openal_soft/lib/$(LIBPATH)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define any libraries to link into executable
|
||||||
|
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# libraries for Debian GNU/Linux desktop compiling
|
||||||
|
# requires the following packages:
|
||||||
|
# libglfw3-dev libopenal-dev libegl1-mesa-dev
|
||||||
|
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
|
||||||
|
# on XWindow could require also below libraries, just uncomment
|
||||||
|
#LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# libraries for OS X 10.9 desktop compiling
|
||||||
|
# requires the following packages:
|
||||||
|
# libglfw3-dev libopenal-dev libegl1-mesa-dev
|
||||||
|
LIBS = -lraylib -lglfw3 -framework OpenGL -framework OpenAl -framework Cocoa
|
||||||
|
else
|
||||||
|
# libraries for Windows desktop compiling
|
||||||
|
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
||||||
|
LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
|
||||||
|
# if static OpenAL Soft required, define the corresponding libs
|
||||||
|
ifeq ($(SHARED_OPENAL),NO)
|
||||||
|
LIBS += -lopenal32 -lwinmm
|
||||||
|
CFLAGS += -Wl,-allow-multiple-definition
|
||||||
|
else
|
||||||
|
LIBS += -lopenal32dll
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
# libraries for Raspberry Pi compiling
|
||||||
|
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
|
||||||
|
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# just adjust the correct path to libraylib.bc
|
||||||
|
LIBS = ../release/html5/libraylib.bc
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define additional parameters and flags for windows
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resources file contains windows exe icon
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
WINFLAGS = ../src/resources -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
EXT = .html
|
||||||
|
endif
|
||||||
|
|
||||||
|
# define all object files required
|
||||||
|
EXAMPLES = \
|
||||||
|
core_basic_window \
|
||||||
|
core_input_keys \
|
||||||
|
core_input_mouse \
|
||||||
|
core_mouse_wheel \
|
||||||
|
core_input_gamepad \
|
||||||
|
core_random_values \
|
||||||
|
core_color_select \
|
||||||
|
core_drop_files \
|
||||||
|
core_storage_values \
|
||||||
|
core_gestures_detection \
|
||||||
|
core_3d_mode \
|
||||||
|
core_3d_picking \
|
||||||
|
core_3d_camera_free \
|
||||||
|
core_3d_camera_first_person \
|
||||||
|
core_2d_camera \
|
||||||
|
core_world_screen \
|
||||||
|
core_oculus_rift \
|
||||||
|
shapes_logo_raylib \
|
||||||
|
shapes_basic_shapes \
|
||||||
|
shapes_colors_palette \
|
||||||
|
shapes_logo_raylib_anim \
|
||||||
|
textures_logo_raylib \
|
||||||
|
textures_image_loading \
|
||||||
|
textures_rectangle \
|
||||||
|
textures_srcrec_dstrec \
|
||||||
|
textures_to_image \
|
||||||
|
textures_raw_data \
|
||||||
|
textures_formats_loading \
|
||||||
|
textures_particles_trail_blending \
|
||||||
|
textures_image_processing \
|
||||||
|
textures_image_drawing \
|
||||||
|
text_sprite_fonts \
|
||||||
|
text_bmfont_ttf \
|
||||||
|
text_rbmf_fonts \
|
||||||
|
text_format_text \
|
||||||
|
text_font_select \
|
||||||
|
text_writing_anim \
|
||||||
|
text_ttf_loading \
|
||||||
|
text_bmfont_unordered \
|
||||||
|
models_geometric_shapes \
|
||||||
|
models_box_collisions \
|
||||||
|
models_billboard \
|
||||||
|
models_obj_loading \
|
||||||
|
models_heightmap \
|
||||||
|
models_cubicmap \
|
||||||
|
shaders_model_shader \
|
||||||
|
shaders_shapes_textures \
|
||||||
|
shaders_custom_uniform \
|
||||||
|
shaders_postprocessing \
|
||||||
|
shaders_standard_lighting \
|
||||||
|
audio_sound_loading \
|
||||||
|
audio_music_stream \
|
||||||
|
audio_module_playing \
|
||||||
|
audio_raw_stream \
|
||||||
|
physics_demo \
|
||||||
|
physics_friction \
|
||||||
|
physics_movement \
|
||||||
|
physics_restitution \
|
||||||
|
physics_shatter \
|
||||||
|
fix_dylib \
|
||||||
|
|
||||||
|
|
||||||
|
# typing 'make' will invoke the default target entry called 'all',
|
||||||
|
# in this case, the 'default' target entry is raylib
|
||||||
|
all: examples
|
||||||
|
|
||||||
|
# compile all examples
|
||||||
|
examples: $(EXAMPLES)
|
||||||
|
|
||||||
|
# compile [core] example - basic window
|
||||||
|
core_basic_window: core_basic_window.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - keyboard input
|
||||||
|
core_input_keys: core_input_keys.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - mouse input
|
||||||
|
core_input_mouse: core_input_mouse.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - mouse wheel
|
||||||
|
core_mouse_wheel: core_mouse_wheel.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - gamepad input
|
||||||
|
core_input_gamepad: core_input_gamepad.c
|
||||||
|
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_input_gamepad: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
|
||||||
|
endif
|
||||||
|
|
||||||
|
# compile [core] example - generate random values
|
||||||
|
core_random_values: core_random_values.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - color selection (collision detection)
|
||||||
|
core_color_select: core_color_select.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - drop files
|
||||||
|
core_drop_files: core_drop_files.c
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
|
||||||
|
endif
|
||||||
|
|
||||||
|
# compile [core] example - storage values
|
||||||
|
core_storage_values: core_storage_values.c
|
||||||
|
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
|
||||||
|
endif
|
||||||
|
|
||||||
|
# compile [core] example - gestures detection
|
||||||
|
core_gestures_detection: core_gestures_detection.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d mode
|
||||||
|
core_3d_mode: core_3d_mode.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d picking
|
||||||
|
core_3d_picking: core_3d_picking.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d camera free
|
||||||
|
core_3d_camera_free: core_3d_camera_free.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d camera first person
|
||||||
|
core_3d_camera_first_person: core_3d_camera_first_person.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 2d camera
|
||||||
|
core_2d_camera: core_2d_camera.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - world screen
|
||||||
|
core_world_screen: core_world_screen.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - oculus rift
|
||||||
|
core_oculus_rift: core_oculus_rift.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shapes] example - raylib logo (with basic shapes)
|
||||||
|
shapes_logo_raylib: shapes_logo_raylib.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shapes] example - basic shapes usage (rectangle, circle, ...)
|
||||||
|
shapes_basic_shapes: shapes_basic_shapes.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shapes] example - raylib color palette
|
||||||
|
shapes_colors_palette: shapes_colors_palette.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shapes] example - raylib logo animation
|
||||||
|
shapes_logo_raylib_anim: shapes_logo_raylib_anim.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - raylib logo texture loading
|
||||||
|
textures_logo_raylib: textures_logo_raylib.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - image loading and conversion to texture
|
||||||
|
textures_image_loading: textures_image_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture rectangle drawing
|
||||||
|
textures_rectangle: textures_rectangle.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture source and destination rectangles
|
||||||
|
textures_srcrec_dstrec: textures_srcrec_dstrec.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture to image
|
||||||
|
textures_to_image: textures_to_image.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture raw data
|
||||||
|
textures_raw_data: textures_raw_data.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture formats loading
|
||||||
|
textures_formats_loading: textures_formats_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture particles trail blending
|
||||||
|
textures_particles_trail_blending: textures_particles_trail_blending.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture image processing
|
||||||
|
textures_image_processing: textures_image_processing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture image drawing
|
||||||
|
textures_image_drawing: textures_image_drawing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - sprite fonts loading
|
||||||
|
text_sprite_fonts: text_sprite_fonts.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - bmfonts and ttf loading
|
||||||
|
text_bmfont_ttf: text_bmfont_ttf.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - raylib bitmap fonts (rBMF)
|
||||||
|
text_rbmf_fonts: text_rbmf_fonts.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text formatting
|
||||||
|
text_format_text: text_format_text.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - font selection program
|
||||||
|
text_font_select: text_font_select.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text writing animation
|
||||||
|
text_writing_anim: text_writing_anim.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text ttf loading
|
||||||
|
text_ttf_loading: text_ttf_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text bmfont unordered
|
||||||
|
text_bmfont_unordered: text_bmfont_unordered.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - basic geometric 3d shapes
|
||||||
|
models_geometric_shapes: models_geometric_shapes.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - box collisions
|
||||||
|
models_box_collisions: models_box_collisions.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - basic window
|
||||||
|
models_planes: models_planes.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - billboard usage
|
||||||
|
models_billboard: models_billboard.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - OBJ model loading
|
||||||
|
models_obj_loading: models_obj_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - heightmap loading
|
||||||
|
models_heightmap: models_heightmap.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - cubesmap loading
|
||||||
|
models_cubicmap: models_cubicmap.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - model shader
|
||||||
|
shaders_model_shader: shaders_model_shader.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - shapes texture shader
|
||||||
|
shaders_shapes_textures: shaders_shapes_textures.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - custom uniform in shader
|
||||||
|
shaders_custom_uniform: shaders_custom_uniform.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - postprocessing shader
|
||||||
|
shaders_postprocessing: shaders_postprocessing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - standard lighting
|
||||||
|
shaders_standard_lighting: shaders_standard_lighting.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [audio] example - sound loading and playing (WAV and OGG)
|
||||||
|
audio_sound_loading: audio_sound_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [audio] example - music stream playing (OGG)
|
||||||
|
audio_music_stream: audio_music_stream.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [audio] example - module playing (XM)
|
||||||
|
audio_module_playing: audio_module_playing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [audio] example - raw audio streaming
|
||||||
|
audio_raw_stream: audio_raw_stream.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [physac] example - physics demo
|
||||||
|
physics_demo: physics_demo.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [physac] example - physics friction
|
||||||
|
physics_friction: physics_friction.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [physac] example - physics movement
|
||||||
|
physics_movement: physics_movement.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [physac] example - physics restitution
|
||||||
|
physics_restitution: physics_restitution.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [physac] example - physics shatter
|
||||||
|
physics_shatter: physics_shatter.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# fix dylib install path name for each executable (MAC)
|
||||||
|
fix_dylib:
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
|
||||||
|
endif
|
||||||
|
|
||||||
|
# clean everything
|
||||||
|
clean:
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
find . -type f -perm +ugo+x -delete
|
||||||
|
rm -f *.o
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
|
||||||
|
else
|
||||||
|
del *.o *.exe
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
find . -type f -executable -delete
|
||||||
|
rm -f *.o
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
del *.o *.html *.js
|
||||||
|
endif
|
||||||
|
@echo Cleaning done
|
||||||
|
|
||||||
|
# instead of defining every module one by one, we can define a pattern
|
||||||
|
# this pattern below will automatically compile every module defined on $(OBJS)
|
||||||
|
#%.exe : %.c
|
||||||
|
# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)
|
141
examples/audio_module_playing.c
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Module playing (streaming)
|
||||||
|
*
|
||||||
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.5 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_CIRCLES 64
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Vector2 position;
|
||||||
|
float radius;
|
||||||
|
float alpha;
|
||||||
|
float speed;
|
||||||
|
Color color;
|
||||||
|
} CircleWave;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // NOTE: Try to enable MSAA 4X
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
|
||||||
|
|
||||||
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
Color colors[14] = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
|
||||||
|
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE };
|
||||||
|
|
||||||
|
// Creates ome circles for visual effect
|
||||||
|
CircleWave circles[MAX_CIRCLES];
|
||||||
|
|
||||||
|
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].speed = (float)GetRandomValue(1, 100)/20000.0f;
|
||||||
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
|
}
|
||||||
|
|
||||||
|
Music xm = LoadMusicStream("resources/audio/mini1111.xm");
|
||||||
|
|
||||||
|
PlayMusicStream(xm);
|
||||||
|
|
||||||
|
float timePlayed = 0.0f;
|
||||||
|
bool pause = false;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateMusicStream(xm); // Update music buffer with new stream data
|
||||||
|
|
||||||
|
// Restart music playing (stop and play)
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
StopMusicStream(xm);
|
||||||
|
PlayMusicStream(xm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause/Resume music playing
|
||||||
|
if (IsKeyPressed(KEY_P))
|
||||||
|
{
|
||||||
|
pause = !pause;
|
||||||
|
|
||||||
|
if (pause) PauseMusicStream(xm);
|
||||||
|
else ResumeMusicStream(xm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get timePlayed scaled to bar dimensions
|
||||||
|
timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2;
|
||||||
|
|
||||||
|
// Color circles animation
|
||||||
|
for (int i = MAX_CIRCLES - 1; (i >= 0) && !pause; i--)
|
||||||
|
{
|
||||||
|
circles[i].alpha += circles[i].speed;
|
||||||
|
circles[i].radius += circles[i].speed*10.0f;
|
||||||
|
|
||||||
|
if (circles[i].alpha > 1.0f) circles[i].speed *= -1;
|
||||||
|
|
||||||
|
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].color = colors[GetRandomValue(0, 13)];
|
||||||
|
circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
|
||||||
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw time bar
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
||||||
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadMusicStream(xm); // Unload music stream buffers from RAM
|
||||||
|
|
||||||
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
101
examples/audio_module_playing.lua
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [audio] example - Module playing (streaming)
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_CIRCLES = 64
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)")
|
||||||
|
|
||||||
|
InitAudioDevice() -- Initialize audio device
|
||||||
|
|
||||||
|
local colors = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
|
||||||
|
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE }
|
||||||
|
|
||||||
|
-- Creates ome circles for visual effect
|
||||||
|
local circles = {}
|
||||||
|
|
||||||
|
for i = MAX_CIRCLES, 1, -1 do
|
||||||
|
circles[i] = {}
|
||||||
|
circles[i].alpha = 0.0
|
||||||
|
circles[i].radius = GetRandomValue(10, 40)
|
||||||
|
circles[i].position = Vector2(0, 0)
|
||||||
|
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].speed = GetRandomValue(1, 100)/20000.0
|
||||||
|
circles[i].color = colors[GetRandomValue(1, 14)]
|
||||||
|
end
|
||||||
|
|
||||||
|
local xm = LoadMusicStream("resources/audio/mini1111.xm")
|
||||||
|
|
||||||
|
PlayMusicStream(xm)
|
||||||
|
|
||||||
|
local timePlayed = 0.0
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
for i = MAX_CIRCLES, 1, -1 do
|
||||||
|
circles[i].alpha = circles[i].alpha + circles[i].speed
|
||||||
|
circles[i].radius = circles[i].radius + circles[i].speed*10.0
|
||||||
|
|
||||||
|
if (circles[i].alpha > 1.0) then circles[i].speed = circles[i].speed*-1 end
|
||||||
|
|
||||||
|
if (circles[i].alpha <= 0.0) then
|
||||||
|
circles[i].alpha = 0.0
|
||||||
|
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].color = colors[GetRandomValue(1, 14)]
|
||||||
|
circles[i].speed = GetRandomValue(1, 100)/20000.0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get timePlayed scaled to bar dimensions
|
||||||
|
timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2
|
||||||
|
|
||||||
|
UpdateMusicStream(xm) -- Update music buffer with new stream data
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
for i = MAX_CIRCLES, 1, -1 do
|
||||||
|
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Draw time bar
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY)
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, timePlayed//1, 12, MAROON)
|
||||||
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, WHITE)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
UnloadMusicStream(xm) -- Unload music stream buffers from RAM
|
||||||
|
|
||||||
|
CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/audio_module_playing.png
Normal file
After Width: | Height: | Size: 47 KiB |
93
examples/audio_music_stream.c
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Music playing (streaming)
|
||||||
|
*
|
||||||
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
|
||||||
|
|
||||||
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
|
||||||
|
|
||||||
|
PlayMusicStream(music);
|
||||||
|
|
||||||
|
float timePlayed = 0.0f;
|
||||||
|
bool pause = false;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateMusicStream(music); // Update music buffer with new stream data
|
||||||
|
|
||||||
|
// Restart music playing (stop and play)
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
StopMusicStream(music);
|
||||||
|
PlayMusicStream(music);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause/Resume music playing
|
||||||
|
if (IsKeyPressed(KEY_P))
|
||||||
|
{
|
||||||
|
pause = !pause;
|
||||||
|
|
||||||
|
if (pause) PauseMusicStream(music);
|
||||||
|
else ResumeMusicStream(music);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get timePlayed scaled to bar dimensions (400 pixels)
|
||||||
|
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
|
||||||
|
DrawRectangle(200, 200, (int)timePlayed, 12, MAROON);
|
||||||
|
DrawRectangleLines(200, 200, 400, 12, GRAY);
|
||||||
|
|
||||||
|
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY);
|
||||||
|
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadMusicStream(music); // Unload music stream buffers from RAM
|
||||||
|
|
||||||
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
66
examples/audio_music_stream.lua
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [audio] example - Music playing (streaming)
|
||||||
|
--
|
||||||
|
-- NOTE: This example requires OpenAL Soft library installed
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)")
|
||||||
|
|
||||||
|
InitAudioDevice() -- Initialize audio device
|
||||||
|
|
||||||
|
local music = LoadMusicStream("resources/audio/guitar_noodling.ogg")
|
||||||
|
|
||||||
|
PlayMusicStream(music)
|
||||||
|
|
||||||
|
local framesCounter = 0
|
||||||
|
local timePlayed = 0.0
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
framesCounter = framesCounter + 1
|
||||||
|
|
||||||
|
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4 -- We scale by 4 to fit 400 pixels
|
||||||
|
|
||||||
|
UpdateMusicStream(music) -- Update music buffer with new stream data
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
DrawRectangle(200, 250, 400, 12, LIGHTGRAY)
|
||||||
|
DrawRectangle(200, 250, timePlayed//1, 12, MAROON)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
UnloadMusicStream(music) -- Unload music stream buffers from RAM
|
||||||
|
|
||||||
|
CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/audio_music_stream.png
Normal file
After Width: | Height: | Size: 15 KiB |
111
examples/audio_raw_stream.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Raw audio streaming
|
||||||
|
*
|
||||||
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> // Required for: malloc(), free()
|
||||||
|
#include <math.h> // Required for: sinf()
|
||||||
|
|
||||||
|
#define MAX_SAMPLES 20000
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming");
|
||||||
|
|
||||||
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
// Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
|
||||||
|
AudioStream stream = InitAudioStream(22050, 32, 1);
|
||||||
|
|
||||||
|
// Fill audio stream with some samples (sine wave)
|
||||||
|
float *data = (float *)malloc(sizeof(float)*MAX_SAMPLES);
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SAMPLES; i++)
|
||||||
|
{
|
||||||
|
data[i] = sinf(((2*PI*(float)i)/2)*DEG2RAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
|
||||||
|
// for that reason, there is a clip everytime audio stream is looped
|
||||||
|
|
||||||
|
PlayAudioStream(stream);
|
||||||
|
|
||||||
|
int totalSamples = MAX_SAMPLES;
|
||||||
|
int samplesLeft = totalSamples;
|
||||||
|
|
||||||
|
Vector2 position = { 0, 0 };
|
||||||
|
|
||||||
|
SetTargetFPS(30); // Set our game to run at 30 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Refill audio stream if required
|
||||||
|
if (IsAudioBufferProcessed(stream))
|
||||||
|
{
|
||||||
|
int numSamples = 0;
|
||||||
|
if (samplesLeft >= 4096) numSamples = 4096;
|
||||||
|
else numSamples = samplesLeft;
|
||||||
|
|
||||||
|
UpdateAudioStream(stream, data + (totalSamples - samplesLeft), numSamples);
|
||||||
|
|
||||||
|
samplesLeft -= numSamples;
|
||||||
|
|
||||||
|
// Reset samples feeding (loop audio)
|
||||||
|
if (samplesLeft <= 0) samplesLeft = totalSamples;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
// NOTE: Draw a part of the sine wave (only screen width)
|
||||||
|
for (int i = 0; i < GetScreenWidth(); i++)
|
||||||
|
{
|
||||||
|
position.x = i;
|
||||||
|
position.y = 250 + 50*data[i];
|
||||||
|
|
||||||
|
DrawPixelV(position, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
free(data); // Unload sine wave data
|
||||||
|
|
||||||
|
CloseAudioStream(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
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
97
examples/audio_raw_stream.lua
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [audio] example - Raw audio streaming
|
||||||
|
--
|
||||||
|
-- NOTE: This example requires OpenAL Soft library installed
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_SAMPLES = 20000
|
||||||
|
DEG2RAD = math.pi/180.0
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming")
|
||||||
|
|
||||||
|
InitAudioDevice() -- Initialize audio device
|
||||||
|
|
||||||
|
-- Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
|
||||||
|
local stream = InitAudioStream(22050, 32, 1)
|
||||||
|
|
||||||
|
-- Fill audio stream with some samples (sine wave)
|
||||||
|
local data = {}
|
||||||
|
|
||||||
|
for i = 1, MAX_SAMPLES do
|
||||||
|
data[i] = math.sin(((2*math.pi*i)/2)*DEG2RAD)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
|
||||||
|
-- for that reason, there is a clip everytime audio stream is looped
|
||||||
|
|
||||||
|
PlayAudioStream(stream)
|
||||||
|
|
||||||
|
local totalSamples = MAX_SAMPLES
|
||||||
|
local samplesLeft = totalSamples
|
||||||
|
|
||||||
|
local position = Vector2(0, 0)
|
||||||
|
|
||||||
|
SetTargetFPS(30) -- Set our game to run at 30 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Refill audio stream if required
|
||||||
|
if (IsAudioBufferProcessed(stream)) then
|
||||||
|
local numSamples = 0
|
||||||
|
|
||||||
|
if (samplesLeft >= 4096) then numSamples = 4096
|
||||||
|
else numSamples = samplesLeft end
|
||||||
|
|
||||||
|
UpdateAudioStream(stream, data + (totalSamples - samplesLeft), numSamples)
|
||||||
|
|
||||||
|
samplesLeft = samplesLeft - numSamples
|
||||||
|
|
||||||
|
-- Reset samples feeding (loop audio)
|
||||||
|
if (samplesLeft <= 0) then samplesLeft = totalSamples end
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
-- NOTE: Draw a part of the sine wave (only screen width)
|
||||||
|
for i = 1, GetScreenWidth() do
|
||||||
|
position.x = (i - 1)
|
||||||
|
position.y = 250 + 50*data[i]
|
||||||
|
|
||||||
|
DrawPixelV(position, RED)
|
||||||
|
end
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseAudioStream(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
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/audio_raw_stream.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -1,13 +1,13 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 08 - Audio loading and playing
|
* raylib [audio] example - Sound loading and playing
|
||||||
*
|
*
|
||||||
* NOTE: This example requires OpenAL32 dll installed (or in the same folder)
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -19,42 +19,49 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing");
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
||||||
|
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
|
||||||
|
|
||||||
Sound fx = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound!
|
if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav); // Play WAV sound
|
||||||
|
if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY);
|
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadSound(fx); // Unload sound data
|
UnloadSound(fxWav); // Unload sound data
|
||||||
|
UnloadSound(fxOgg); // Unload sound data
|
||||||
|
|
||||||
CloseAudioDevice(); // Close audio device
|
CloseAudioDevice(); // Close audio device
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
59
examples/audio_sound_loading.lua
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [audio] example - Sound loading and playing
|
||||||
|
--
|
||||||
|
-- NOTE: This example requires OpenAL Soft library installed
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing")
|
||||||
|
|
||||||
|
InitAudioDevice() -- Initialize audio device
|
||||||
|
|
||||||
|
local fxWav = LoadSound("resources/audio/weird.wav") -- Load WAV audio file
|
||||||
|
local fxOgg = LoadSound("resources/audio/tanatana.ogg") -- Load OGG audio file
|
||||||
|
|
||||||
|
SetTargetFPS(60)
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY.SPACE)) then PlaySound(fxWav) end -- Play WAV sound
|
||||||
|
if (IsKeyPressed(KEY.ENTER)) then PlaySound(fxOgg) end -- Play OGG sound
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
UnloadSound(fxWav) -- Unload sound data
|
||||||
|
UnloadSound(fxOgg) -- Unload sound data
|
||||||
|
|
||||||
|
CloseAudioDevice() -- Close audio device
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/audio_sound_loading.png
Normal file
After Width: | Height: | Size: 15 KiB |
81
examples/audio_standalone.c
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Using audio module as standalone module
|
||||||
|
*
|
||||||
|
* NOTE: This example does not require any graphic device, it can run directly on console.
|
||||||
|
*
|
||||||
|
* [audio] module requires some external libs:
|
||||||
|
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
|
||||||
|
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
|
||||||
|
* jar_xm - XM module file loading
|
||||||
|
* jar_mod - MOD audio file loading
|
||||||
|
*
|
||||||
|
* Compile audio module using:
|
||||||
|
* gcc -c audio.c stb_vorbis.c -Wall -std=c99 -DAUDIO_STANDALONE
|
||||||
|
*
|
||||||
|
* Compile example using:
|
||||||
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) audio.o stb_vorbis.o -lopenal32 -std=c99
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.5 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <conio.h> // Windows only, no stardard library
|
||||||
|
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
|
#define KEY_ESCAPE 27
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
unsigned char key;
|
||||||
|
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
|
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
||||||
|
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
|
||||||
|
|
||||||
|
Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
|
||||||
|
PlayMusicStream(music);
|
||||||
|
|
||||||
|
printf("\nPress s or d to play sounds...\n");
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main loop
|
||||||
|
while (key != KEY_ESCAPE)
|
||||||
|
{
|
||||||
|
if (kbhit()) key = getch();
|
||||||
|
|
||||||
|
if (key == 's')
|
||||||
|
{
|
||||||
|
PlaySound(fxWav);
|
||||||
|
key = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == 'd')
|
||||||
|
{
|
||||||
|
PlaySound(fxOgg);
|
||||||
|
key = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateMusicStream(music);
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadSound(fxWav); // Unload sound data
|
||||||
|
UnloadSound(fxOgg); // Unload sound data
|
||||||
|
|
||||||
|
UnloadMusicStream(music); // Unload music stream data
|
||||||
|
|
||||||
|
CloseAudioDevice();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
139
examples/core_2d_camera.c
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - 2d camera
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.5 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_BUILDINGS 100
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
|
||||||
|
|
||||||
|
Rectangle player = { 400, 280, 40, 40 };
|
||||||
|
Rectangle buildings[MAX_BUILDINGS];
|
||||||
|
Color buildColors[MAX_BUILDINGS];
|
||||||
|
|
||||||
|
int spacing = 0;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
spacing += buildings[i].width;
|
||||||
|
|
||||||
|
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera2D camera;
|
||||||
|
|
||||||
|
camera.target = (Vector2){ player.x + 20, player.y + 20 };
|
||||||
|
camera.offset = (Vector2){ 0, 0 };
|
||||||
|
camera.rotation = 0.0f;
|
||||||
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyDown(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
player.x += 2; // Player movement
|
||||||
|
camera.offset.x -= 2; // Camera displacement with player movement
|
||||||
|
}
|
||||||
|
else if (IsKeyDown(KEY_LEFT))
|
||||||
|
{
|
||||||
|
player.x -= 2; // Player movement
|
||||||
|
camera.offset.x += 2; // Camera displacement with player movement
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camera target follows player
|
||||||
|
camera.target = (Vector2){ player.x + 20, player.y + 20 };
|
||||||
|
|
||||||
|
// Camera rotation controls
|
||||||
|
if (IsKeyDown(KEY_A)) camera.rotation--;
|
||||||
|
else if (IsKeyDown(KEY_S)) camera.rotation++;
|
||||||
|
|
||||||
|
// Limit camera rotation to 80 degrees (-40 to 40)
|
||||||
|
if (camera.rotation > 40) camera.rotation = 40;
|
||||||
|
else if (camera.rotation < -40) camera.rotation = -40;
|
||||||
|
|
||||||
|
// Camera zoom controls
|
||||||
|
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
|
||||||
|
|
||||||
|
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
|
||||||
|
else if (camera.zoom < 0.1f) camera.zoom = 0.1f;
|
||||||
|
|
||||||
|
// Camera reset (zoom and rotation)
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
camera.zoom = 1.0f;
|
||||||
|
camera.rotation = 0.0f;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin2dMode(camera);
|
||||||
|
|
||||||
|
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_BUILDINGS; i++) DrawRectangleRec(buildings[i], buildColors[i]);
|
||||||
|
|
||||||
|
DrawRectangleRec(player, RED);
|
||||||
|
|
||||||
|
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
|
||||||
|
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
|
||||||
|
|
||||||
|
End2dMode();
|
||||||
|
|
||||||
|
DrawText("SCREEN AREA", 640, 10, 20, RED);
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, screenWidth, 5, RED);
|
||||||
|
DrawRectangle(0, 5, 5, screenHeight - 10, RED);
|
||||||
|
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED);
|
||||||
|
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED);
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
|
||||||
|
DrawRectangleLines( 10, 10, 250, 113, BLUE);
|
||||||
|
|
||||||
|
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK);
|
||||||
|
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
|
||||||
|
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
|
||||||
|
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
130
examples/core_2d_camera.lua
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - 2d camera
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_BUILDINGS = 100
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera")
|
||||||
|
|
||||||
|
local player = Rectangle(400, 280, 40, 40)
|
||||||
|
local buildings = {}
|
||||||
|
local buildColors = {}
|
||||||
|
|
||||||
|
local spacing = 0;
|
||||||
|
|
||||||
|
for i = 1, MAX_BUILDINGS do
|
||||||
|
buildings[i] = Rectangle(0, 0, 0, 0)
|
||||||
|
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
|
||||||
|
|
||||||
|
spacing = spacing + buildings[i].width
|
||||||
|
|
||||||
|
buildColors[i] = Color(GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255)
|
||||||
|
end
|
||||||
|
|
||||||
|
local camera = Camera2D(Vector2(0, 0), Vector2(0, 0), 0.0, 1.0)
|
||||||
|
|
||||||
|
camera.target = Vector2(player.x + 20, player.y + 20)
|
||||||
|
camera.offset = Vector2(0, 0)
|
||||||
|
camera.rotation = 0.0
|
||||||
|
camera.zoom = 1.0
|
||||||
|
|
||||||
|
SetTargetFPS(60)
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
if (IsKeyDown(KEY.RIGHT)) then
|
||||||
|
player.x = player.x + 2 -- Player movement
|
||||||
|
camera.offset.x = camera.offset.x - 2 -- Camera displacement with player movement
|
||||||
|
elseif (IsKeyDown(KEY.LEFT)) then
|
||||||
|
player.x = player.x - 2 -- Player movement
|
||||||
|
camera.offset.x = camera.offset.x + 2 -- Camera displacement with player movement
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Camera target follows player
|
||||||
|
camera.target = Vector2(player.x + 20, player.y + 20)
|
||||||
|
|
||||||
|
-- Camera rotation controls
|
||||||
|
if (IsKeyDown(KEY.A)) then camera.rotation = camera.rotation - 1
|
||||||
|
elseif (IsKeyDown(KEY.S)) then camera.rotation = camera.rotation + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Limit camera rotation to 80 degrees (-40 to 40)
|
||||||
|
if (camera.rotation > 40) then camera.rotation = 40
|
||||||
|
elseif (camera.rotation < -40) then camera.rotation = -40
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Camera zoom controls
|
||||||
|
camera.zoom = camera.zoom + (GetMouseWheelMove()*0.05)
|
||||||
|
|
||||||
|
if (camera.zoom > 3.0) then camera.zoom = 3.0
|
||||||
|
elseif (camera.zoom < 0.1) then camera.zoom = 0.1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Camera reset (zoom and rotation)
|
||||||
|
if (IsKeyPressed(KEY.R)) then
|
||||||
|
camera.zoom = 1.0
|
||||||
|
camera.rotation = 0.0
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin2dMode(camera)
|
||||||
|
|
||||||
|
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY)
|
||||||
|
|
||||||
|
for i = 1, MAX_BUILDINGS, 1 do DrawRectangleRec(buildings[i], buildColors[i]) end
|
||||||
|
|
||||||
|
DrawRectangleRec(player, RED)
|
||||||
|
|
||||||
|
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN)
|
||||||
|
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN)
|
||||||
|
|
||||||
|
End2dMode()
|
||||||
|
|
||||||
|
DrawText("SCREEN AREA", 640, 10, 20, RED)
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, screenWidth, 5, RED)
|
||||||
|
DrawRectangle(0, 5, 5, screenHeight - 10, RED)
|
||||||
|
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED)
|
||||||
|
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED)
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5))
|
||||||
|
DrawRectangleLines( 10, 10, 250, 113, BLUE)
|
||||||
|
|
||||||
|
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK)
|
||||||
|
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY)
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY)
|
||||||
|
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY)
|
||||||
|
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY)
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_2d_camera.png
Normal file
After Width: | Height: | Size: 21 KiB |
92
examples/core_3d_camera_first_person.c
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - 3d camera first person
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_COLUMNS 20
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world (position, target, up vector)
|
||||||
|
Camera camera = {{ 4.0f, 2.0f, 4.0f }, { 0.0f, 1.8f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
|
||||||
|
|
||||||
|
// Generates some random columns
|
||||||
|
float heights[MAX_COLUMNS];
|
||||||
|
Vector3 positions[MAX_COLUMNS];
|
||||||
|
Color colors[MAX_COLUMNS];
|
||||||
|
|
||||||
|
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) };
|
||||||
|
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person 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
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
||||||
|
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
||||||
|
DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME); // Draw a green wall
|
||||||
|
DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD); // Draw a yellow wall
|
||||||
|
|
||||||
|
// Draw some cubes around
|
||||||
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
{
|
||||||
|
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
|
||||||
|
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
|
||||||
|
DrawRectangleLines( 10, 10, 220, 70, BLUE);
|
||||||
|
|
||||||
|
DrawText("First person camera default controls:", 20, 20, 10, BLACK);
|
||||||
|
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
84
examples/core_3d_camera_first_person.lua
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - 3d camera first person
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_COLUMNS = 20
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person")
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world (position, target, up vector)
|
||||||
|
local camera = Camera(Vector3(4.0, 2.0, 4.0), Vector3(0.0, 1.8, 0.0), Vector3(0.0, 1.0, 0.0), 60.0)
|
||||||
|
|
||||||
|
-- Generates some random columns
|
||||||
|
local heights = {}
|
||||||
|
local positions = {}
|
||||||
|
local colors = {}
|
||||||
|
|
||||||
|
for i = 1, MAX_COLUMNS do
|
||||||
|
heights[i] = GetRandomValue(1, 12)
|
||||||
|
positions[i] = Vector3(GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15))
|
||||||
|
colors[i] = Color(GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255)
|
||||||
|
end
|
||||||
|
|
||||||
|
local playerPosition = Vector3(4.0, 2.0, 4.0) -- Define player position
|
||||||
|
|
||||||
|
SetCameraMode(camera, CameraMode.FIRST_PERSON) -- Set a first person camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
camera = UpdateCamera(camera) -- Update camera
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera)
|
||||||
|
|
||||||
|
DrawPlane(Vector3(0.0, 0.0, 0.0), Vector2(32.0, 32.0), LIGHTGRAY) -- Draw ground
|
||||||
|
DrawCube(Vector3(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, BLUE) -- Draw a blue wall
|
||||||
|
DrawCube(Vector3(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, LIME) -- Draw a green wall
|
||||||
|
DrawCube(Vector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, GOLD) -- Draw a yellow wall
|
||||||
|
|
||||||
|
-- Draw some cubes around
|
||||||
|
for i = 1, MAX_COLUMNS do
|
||||||
|
DrawCube(positions[i], 2.0, heights[i], 2.0, colors[i])
|
||||||
|
DrawCubeWires(positions[i], 2.0, heights[i], 2.0, MAROON)
|
||||||
|
end
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5))
|
||||||
|
DrawRectangleLines( 10, 10, 220, 70, BLUE)
|
||||||
|
|
||||||
|
DrawText("First person camera default controls:", 20, 20, 10, BLACK)
|
||||||
|
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY)
|
||||||
|
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_3d_camera_first_person.png
Normal file
After Width: | Height: | Size: 17 KiB |
82
examples/core_3d_camera_free.c
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Initialize 3d camera free
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
|
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
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
SetCameraMode(camera, CAMERA_FREE); // Set a 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 camera
|
||||||
|
|
||||||
|
if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
|
||||||
|
DrawRectangleLines( 10, 10, 320, 133, BLUE);
|
||||||
|
|
||||||
|
DrawText("Free camera default controls:", 20, 20, 10, BLACK);
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
|
||||||
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
72
examples/core_3d_camera_free.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Initialize 3d camera free
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world
|
||||||
|
local camera = {}
|
||||||
|
camera.position = Vector3(10.0, 10.0, 10.0) -- Camera position
|
||||||
|
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
|
||||||
|
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0 -- Camera field-of-view Y
|
||||||
|
|
||||||
|
local cubePosition = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
camera = UpdateCamera(camera) -- Update camera
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera)
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
|
||||||
|
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5))
|
||||||
|
DrawRectangleLines( 10, 10, 320, 133, BLUE)
|
||||||
|
|
||||||
|
DrawText("Free camera default controls:", 20, 20, 10, BLACK)
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
|
||||||
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY)
|
||||||
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY)
|
||||||
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY)
|
||||||
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_3d_camera_free.png
Normal file
After Width: | Height: | Size: 25 KiB |
@@ -1,11 +1,11 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 07a - Initialize 3d mode
|
* raylib [core] example - Initialize 3d mode
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -18,13 +18,20 @@ int main()
|
|||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
Vector3 position = { 0.0, 0.0, 0.0 };
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
|
||||||
|
|
||||||
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode");
|
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
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
@@ -32,25 +39,26 @@ int main()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// TODO: Update your variables here
|
// TODO: Update your variables here
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(WHITE);
|
|
||||||
|
|
||||||
Begin3dMode(camera);
|
|
||||||
|
|
||||||
DrawCube(position, 2, 2, 2, RED);
|
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -59,6 +67,6 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
64
examples/core_3d_mode.lua
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Initialize 3d mode
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode")
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world
|
||||||
|
local camera = {}
|
||||||
|
camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
|
||||||
|
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
|
||||||
|
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0 -- Camera field-of-view Y
|
||||||
|
|
||||||
|
local cubePosition = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
-- TODO: Update your variables here
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera) -- ERROR: Lua Error: attempt to index a number value (?)
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
|
||||||
|
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY)
|
||||||
|
|
||||||
|
DrawFPS(10, 10)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
104
examples/core_3d_picking.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Picking in 3d mode
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
|
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
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
|
||||||
|
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
|
||||||
|
|
||||||
|
Ray ray; // Picking line ray
|
||||||
|
|
||||||
|
bool collision = false;
|
||||||
|
|
||||||
|
SetCameraMode(camera, CAMERA_FREE); // Set a 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 camera
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
// NOTE: This function is NOT WORKING properly!
|
||||||
|
ray = GetMouseRay(GetMousePosition(), camera);
|
||||||
|
|
||||||
|
// Check collision between ray and box
|
||||||
|
collision = CheckCollisionRayBox(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 }});
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
if (collision)
|
||||||
|
{
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
|
||||||
|
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawRay(ray, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
96
examples/core_3d_picking.lua
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Picking in 3d mode
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking")
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world
|
||||||
|
local camera = {}
|
||||||
|
camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
|
||||||
|
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
|
||||||
|
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0 -- Camera field-of-view Y
|
||||||
|
|
||||||
|
local cubePosition = Vector3(0.0, 1.0, 0.0)
|
||||||
|
local cubeSize = Vector3(2.0, 2.0, 2.0)
|
||||||
|
|
||||||
|
local ray = Ray(Vector3(0, 0, 0), Vector3(0, 0, 0)) -- Picking line ray
|
||||||
|
|
||||||
|
local collision = false
|
||||||
|
|
||||||
|
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
camera = UpdateCamera(camera) -- Update camera
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then
|
||||||
|
-- NOTE: This function is NOT WORKING properly!
|
||||||
|
ray = GetMouseRay(GetMousePosition(), camera)
|
||||||
|
|
||||||
|
-- Check collision between ray and box
|
||||||
|
collision = CheckCollisionRayBox(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)))
|
||||||
|
|
||||||
|
--print("collision check:", collision)
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera)
|
||||||
|
|
||||||
|
if (collision) then
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED)
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON)
|
||||||
|
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x + 0.2, cubeSize.y + 0.2, cubeSize.z + 0.2, GREEN)
|
||||||
|
else
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY)
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY)
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawRay(ray, MAROON)
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY)
|
||||||
|
|
||||||
|
if (collision) then
|
||||||
|
DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30))/2, screenHeight*0.1, 30, GREEN)
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawFPS(10, 10)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_3d_picking.png
Normal file
After Width: | Height: | Size: 24 KiB |
@@ -1,11 +1,21 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 01 - Basic Window
|
* raylib [core] example - Basic window
|
||||||
|
*
|
||||||
|
* Welcome to raylib!
|
||||||
|
*
|
||||||
|
* To test examples, just press F6 and execute raylib_compile_execute script
|
||||||
|
* Note that compiled executable is placed in the same folder as .c file
|
||||||
|
*
|
||||||
|
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
||||||
|
* raylib official webpage: www.raylib.com
|
||||||
|
*
|
||||||
|
* Enjoy using raylib. :)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -17,10 +27,12 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window");
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
@@ -28,23 +40,23 @@ int main()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// TODO: Update your variables here
|
// TODO: Update your variables here
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
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();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
62
examples/core_basic_window.cpp
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Basic window
|
||||||
|
*
|
||||||
|
* Welcome to raylib!
|
||||||
|
*
|
||||||
|
* To test examples, just press F6 and execute raylib_compile_execute script
|
||||||
|
* Note that compiled executable is placed in the same folder as .c file
|
||||||
|
*
|
||||||
|
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
||||||
|
* raylib official webpage: www.raylib.com
|
||||||
|
*
|
||||||
|
* Enjoy using raylib. :)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
44
examples/core_basic_window.lua
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Basic window
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set target frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
-- TODO: Update your variables here
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
85
examples/core_basic_window_web.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||||
|
*
|
||||||
|
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
||||||
|
* As you will notice, code structure is slightly diferent to the other examples...
|
||||||
|
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//#define PLATFORM_WEB
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
#include <emscripten/emscripten.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void UpdateDrawFrame(void); // Update and Draw one frame
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Main Enry Point
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||||
|
#else
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
UpdateDrawFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void UpdateDrawFrame(void)
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
@@ -1,11 +1,11 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 06a - Color selection by mouse (collision detection)
|
* raylib [core] example - Color selection by mouse (collision detection)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -16,79 +16,79 @@ int main()
|
|||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 400;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
||||||
|
|
||||||
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
|
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
|
||||||
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
|
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
|
||||||
GREEN, SKYBLUE, PURPLE, BEIGE };
|
GREEN, SKYBLUE, PURPLE, BEIGE };
|
||||||
|
|
||||||
Rectangle recs[21]; // Rectangles array
|
Rectangle colorsRecs[21]; // Rectangles array
|
||||||
|
|
||||||
// Fills recs data (for every rectangle)
|
// Fills colorsRecs data (for every rectangle)
|
||||||
for (int i = 0; i < 21; i++)
|
for (int i = 0; i < 21; i++)
|
||||||
{
|
{
|
||||||
recs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
||||||
recs[i].y = 40 + 100*(i/7) + 10*(i/7);
|
colorsRecs[i].y = 60 + 100*(i/7) + 10*(i/7);
|
||||||
recs[i].width = 100;
|
colorsRecs[i].width = 100;
|
||||||
recs[i].height = 100;
|
colorsRecs[i].height = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool selected[21] = { false }; // Selected rectangles indicator
|
bool selected[21] = { false }; // Selected rectangles indicator
|
||||||
|
|
||||||
Vector2 mousePoint;
|
Vector2 mousePoint;
|
||||||
|
|
||||||
InitWindowEx(screenWidth, screenHeight, "raylib example 06a - color selection", false, "resources/mouse.png");
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
SetTargetFPS(60);
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
mousePoint = GetMousePosition();
|
mousePoint = GetMousePosition();
|
||||||
|
|
||||||
for (int i = 0; i < 21; i++) // Iterate along all the rectangles
|
for (int i = 0; i < 21; i++) // Iterate along all the rectangles
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, recs[i]))
|
if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
|
||||||
{
|
{
|
||||||
colors[i].a = 120;
|
colors[i].a = 120;
|
||||||
|
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
|
||||||
}
|
}
|
||||||
else colors[i].a = 255;
|
else colors[i].a = 255;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
for (int i = 0; i < 21; i++) // Draw all rectangles
|
for (int i = 0; i < 21; i++) // Draw all rectangles
|
||||||
{
|
{
|
||||||
DrawRectangleRec(recs[i], colors[i]);
|
DrawRectangleRec(colorsRecs[i], colors[i]);
|
||||||
|
|
||||||
// Draw four rectangles around selected rectangle
|
// Draw four rectangles around selected rectangle
|
||||||
if (selected[i])
|
if (selected[i])
|
||||||
{
|
{
|
||||||
DrawRectangle(recs[i].x, recs[i].y, 100, 10, RAYWHITE); // Square top rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE); // Square top rectangle
|
||||||
DrawRectangle(recs[i].x, recs[i].y, 10, 100, RAYWHITE); // Square left rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE); // Square left rectangle
|
||||||
DrawRectangle(recs[i].x + 90, recs[i].y, 10, 100, RAYWHITE); // Square right rectangle
|
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE); // Square right rectangle
|
||||||
DrawRectangle(recs[i].x, recs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
82
examples/core_color_select.lua
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Color selection by mouse (collision detection)
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NUM_RECTANGLES = 21
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)")
|
||||||
|
|
||||||
|
local colors = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
|
||||||
|
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
|
||||||
|
GREEN, SKYBLUE, PURPLE, BEIGE }
|
||||||
|
|
||||||
|
local colorsRecs = {} -- Rectangles array
|
||||||
|
local selected = {}
|
||||||
|
|
||||||
|
-- Fills colorsRecs data (for every rectangle)
|
||||||
|
for i = 1, NUM_RECTANGLES do
|
||||||
|
colorsRecs[i] = Rectangle(0, 0, 0, 0)
|
||||||
|
colorsRecs[i].x = 20 + 100*((i-1)%7) + 10*((i-1)%7)
|
||||||
|
colorsRecs[i].y = 60 + 100*((i-1)//7) + 10*((i-1)//7) -- Using floor division: //
|
||||||
|
colorsRecs[i].width = 100
|
||||||
|
colorsRecs[i].height = 100
|
||||||
|
selected[i] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local mousePoint = Vector2(0, 0)
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
mousePoint = GetMousePosition()
|
||||||
|
|
||||||
|
for i = 1, NUM_RECTANGLES do -- Iterate along all the rectangles
|
||||||
|
if (CheckCollisionPointRec(mousePoint, colorsRecs[i])) then
|
||||||
|
colors[i].a = 120
|
||||||
|
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then selected[i] = not selected[i] end
|
||||||
|
else colors[i].a = 255 end
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
for i = 1, NUM_RECTANGLES do -- Draw all rectangles
|
||||||
|
DrawRectangleRec(colorsRecs[i], colors[i])
|
||||||
|
|
||||||
|
-- Draw four rectangles around selected rectangle
|
||||||
|
if (selected[i]) then
|
||||||
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE) -- Square top rectangle
|
||||||
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square left rectangle
|
||||||
|
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square right rectangle
|
||||||
|
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE) -- Square bottom rectangle
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,13 +1,13 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib test - OGG audio loading and playing
|
* raylib [core] example - Windows drop files
|
||||||
*
|
*
|
||||||
* NOTE: This test requires OpenAL32 dll installed (or in the same folder)
|
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
|
||||||
*
|
*
|
||||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -19,42 +19,58 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib test - ogg audio loading and playing");
|
int count = 0;
|
||||||
|
char **droppedFiles = { 0 };
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
SetTargetFPS(60);
|
||||||
|
|
||||||
Sound fx = LoadSound("resources/audio/0564.ogg"); // Load audio file
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound!
|
if (IsFileDropped())
|
||||||
|
{
|
||||||
|
droppedFiles = GetDroppedFiles(&count);
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY);
|
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
|
||||||
|
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
|
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadSound(fx); // Unload sound data
|
ClearDroppedFiles(); // Clear internal buffers
|
||||||
|
|
||||||
CloseAudioDevice(); // Close audio device
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
66
examples/core_drop_files.lua
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Windows drop files
|
||||||
|
--
|
||||||
|
-- This example only works on platforms that support drag & drop (Windows, Linux, OSX)
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files")
|
||||||
|
|
||||||
|
local count = 0
|
||||||
|
local droppedFiles = {}
|
||||||
|
|
||||||
|
SetTargetFPS(60)
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
if (IsFileDropped()) then
|
||||||
|
droppedFiles = GetDroppedFiles()
|
||||||
|
count = #droppedFiles
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
if (count == 0) then DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY)
|
||||||
|
else
|
||||||
|
DrawText("Dropped files:", 100, 40, 20, DARKGRAY)
|
||||||
|
|
||||||
|
for i = 0, count-1 do
|
||||||
|
if (i%2 == 0) then DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5))
|
||||||
|
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3)) end
|
||||||
|
|
||||||
|
DrawText(droppedFiles[i+1], 120, 100 + 40*i, 10, GRAY)
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY)
|
||||||
|
end
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
ClearDroppedFiles() -- Clear internal buffers
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_drop_files.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
115
examples/core_gestures_detection.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Gestures Detection
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define MAX_GESTURE_STRINGS 20
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection");
|
||||||
|
|
||||||
|
Vector2 touchPosition = { 0, 0 };
|
||||||
|
Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 };
|
||||||
|
|
||||||
|
int gesturesCount = 0;
|
||||||
|
char gestureStrings[MAX_GESTURE_STRINGS][32];
|
||||||
|
|
||||||
|
int currentGesture = GESTURE_NONE;
|
||||||
|
int lastGesture = GESTURE_NONE;
|
||||||
|
|
||||||
|
//SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
lastGesture = currentGesture;
|
||||||
|
currentGesture = GetGestureDetected();
|
||||||
|
touchPosition = GetTouchPosition(0);
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(touchPosition, touchArea) && (currentGesture != GESTURE_NONE))
|
||||||
|
{
|
||||||
|
if (currentGesture != lastGesture)
|
||||||
|
{
|
||||||
|
// Store gesture string
|
||||||
|
switch (currentGesture)
|
||||||
|
{
|
||||||
|
case GESTURE_TAP: strcpy(gestureStrings[gesturesCount], "GESTURE TAP"); break;
|
||||||
|
case GESTURE_DOUBLETAP: strcpy(gestureStrings[gesturesCount], "GESTURE DOUBLETAP"); break;
|
||||||
|
case GESTURE_HOLD: strcpy(gestureStrings[gesturesCount], "GESTURE HOLD"); break;
|
||||||
|
case GESTURE_DRAG: strcpy(gestureStrings[gesturesCount], "GESTURE DRAG"); break;
|
||||||
|
case GESTURE_SWIPE_RIGHT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE RIGHT"); break;
|
||||||
|
case GESTURE_SWIPE_LEFT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE LEFT"); break;
|
||||||
|
case GESTURE_SWIPE_UP: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE UP"); break;
|
||||||
|
case GESTURE_SWIPE_DOWN: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE DOWN"); break;
|
||||||
|
case GESTURE_PINCH_IN: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH IN"); break;
|
||||||
|
case GESTURE_PINCH_OUT: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH OUT"); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gesturesCount++;
|
||||||
|
|
||||||
|
// Reset gestures strings
|
||||||
|
if (gesturesCount >= MAX_GESTURE_STRINGS)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_GESTURE_STRINGS; i++) strcpy(gestureStrings[i], "\0");
|
||||||
|
|
||||||
|
gesturesCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawRectangleRec(touchArea, GRAY);
|
||||||
|
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f));
|
||||||
|
|
||||||
|
for (int i = 0; i < gesturesCount; i++)
|
||||||
|
{
|
||||||
|
if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f));
|
||||||
|
else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
|
if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY);
|
||||||
|
else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY);
|
||||||
|
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY);
|
||||||
|
|
||||||
|
if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
}
|
102
examples/core_gestures_detection.lua
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Gestures Detection
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAX_GESTURE_STRINGS = 20
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection")
|
||||||
|
|
||||||
|
local touchPosition = Vector2(0, 0)
|
||||||
|
local touchArea = Rectangle(220, 10, screenWidth - 230, screenHeight - 20)
|
||||||
|
|
||||||
|
local gesturesCount = 0
|
||||||
|
local gestureStrings = {}
|
||||||
|
|
||||||
|
for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "" end
|
||||||
|
|
||||||
|
local currentGesture = Gestures.NONE
|
||||||
|
local lastGesture = Gestures.NONE
|
||||||
|
|
||||||
|
--SetGesturesEnabled(0b0000000000001001) -- Enable only some gestures to be detected
|
||||||
|
|
||||||
|
SetTargetFPS(60)
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
lastGesture = currentGesture
|
||||||
|
currentGesture = GetGestureDetected()
|
||||||
|
touchPosition = GetTouchPosition(0)
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(touchPosition, touchArea) and (currentGesture ~= Gestures.NONE)) then
|
||||||
|
if (currentGesture ~= lastGesture) then
|
||||||
|
-- Store gesture string
|
||||||
|
if (currentGesture == Gestures.TAP) then gestureStrings[gesturesCount] = "GESTURE TAP"
|
||||||
|
elseif (currentGesture == Gestures.DOUBLETAP) then gestureStrings[gesturesCount] = "GESTURE DOUBLETAP"
|
||||||
|
elseif (currentGesture == Gestures.HOLD) then gestureStrings[gesturesCount] = "GESTURE HOLD"
|
||||||
|
elseif (currentGesture == Gestures.DRAG) then gestureStrings[gesturesCount] = "GESTURE DRAG"
|
||||||
|
elseif (currentGesture == Gestures.SWIPE_RIGHT) then gestureStrings[gesturesCount] = "GESTURE SWIPE RIGHT"
|
||||||
|
elseif (currentGesture == Gestures.SWIPE_LEFT) then gestureStrings[gesturesCount] = "GESTURE SWIPE LEFT"
|
||||||
|
elseif (currentGesture == Gestures.SWIPE_UP) then gestureStrings[gesturesCount] = "GESTURE SWIPE UP"
|
||||||
|
elseif (currentGesture == Gestures.SWIPE_DOWN) then gestureStrings[gesturesCount] = "GESTURE SWIPE DOWN"
|
||||||
|
elseif (currentGesture == Gestures.PINCH_IN) then gestureStrings[gesturesCount] = "GESTURE PINCH IN"
|
||||||
|
elseif (currentGesture == Gestures.PINCH_OUT) then gestureStrings[gesturesCount] = "GESTURE PINCH OUT"
|
||||||
|
end
|
||||||
|
|
||||||
|
gesturesCount = gesturesCount + 1
|
||||||
|
|
||||||
|
-- Reset gestures strings
|
||||||
|
if (gesturesCount >= MAX_GESTURE_STRINGS) then
|
||||||
|
for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "\0" end
|
||||||
|
gesturesCount = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawRectangleRec(touchArea, GRAY)
|
||||||
|
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5))
|
||||||
|
|
||||||
|
for i = 1, gesturesCount do
|
||||||
|
if ((i - 1)%2 == 0) then DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.5))
|
||||||
|
else DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.3)) end
|
||||||
|
|
||||||
|
if (i < gesturesCount) then DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, DARKGRAY)
|
||||||
|
else DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, MAROON) end
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY)
|
||||||
|
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY)
|
||||||
|
|
||||||
|
if (currentGesture ~= GESTURE_NONE) then DrawCircleV(touchPosition, 30, MAROON) end
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_gestures_detection.png
Normal file
After Width: | Height: | Size: 19 KiB |
194
examples/core_input_gamepad.c
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Gamepad input
|
||||||
|
*
|
||||||
|
* NOTE: This example requires a Gamepad connected to the system
|
||||||
|
* raylib is configured to work with the following gamepads:
|
||||||
|
* Xbox 360 Controller (Xbox 360, Xbox One)
|
||||||
|
* PLAYSTATION(R)3 Controller
|
||||||
|
* Check raylib.h for buttons configuration
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
|
#if defined(PLATFORM_RPI)
|
||||||
|
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
||||||
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
|
#else
|
||||||
|
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||||
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||||
|
|
||||||
|
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
|
||||||
|
Texture2D texXboxPad = LoadTexture("resources/xbox.png");
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// ...
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||||
|
{
|
||||||
|
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
||||||
|
|
||||||
|
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
||||||
|
{
|
||||||
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw buttons: xbox home
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) 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_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||||
|
|
||||||
|
// Draw buttons: left-right back
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) 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_XBOX_AXIS_LEFT_X)*20),
|
||||||
|
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_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_XBOX_AXIS_RIGHT_X)*20),
|
||||||
|
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_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_XBOX_AXIS_LT))/2.0f)*70), RED);
|
||||||
|
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
|
||||||
|
|
||||||
|
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
|
||||||
|
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
|
||||||
|
}
|
||||||
|
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||||
|
{
|
||||||
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw buttons: ps
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) 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_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||||
|
|
||||||
|
// Draw buttons: left-right back buttons
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) 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_PS3_AXIS_LEFT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_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_PS3_AXIS_RIGHT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_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_PS3_AXIS_L2))/2.0f)*70), RED);
|
||||||
|
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
|
||||||
|
|
||||||
|
// TODO: Draw generic gamepad
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
||||||
|
|
||||||
|
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
||||||
|
{
|
||||||
|
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||||
|
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
|
||||||
|
|
||||||
|
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texPs3Pad);
|
||||||
|
UnloadTexture(texXboxPad);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
163
examples/core_input_gamepad.lua
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Gamepad input
|
||||||
|
--
|
||||||
|
-- NOTE: This example requires a Gamepad connected to the system
|
||||||
|
-- raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input")
|
||||||
|
|
||||||
|
local texPs3Pad = LoadTexture("resources/ps3.png")
|
||||||
|
local texXboxPad = LoadTexture("resources/xbox.png")
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set target frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
-- ...
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
if (IsGamepadAvailable(GAMEPAD.PLAYER1)) then
|
||||||
|
DrawText(string.format("GP1: %s", GetGamepadName(GAMEPAD.PLAYER1)), 10, 10, 10, BLACK)
|
||||||
|
|
||||||
|
if (IsGamepadName(GAMEPAD.PLAYER1, "Xbox 360 Controller")) then
|
||||||
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY)
|
||||||
|
|
||||||
|
-- Draw buttons: xbox home
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_HOME)) then DrawCircle(394, 89, 19, RED) end
|
||||||
|
|
||||||
|
-- Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_START)) then DrawCircle(436, 150, 9, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_SELECT)) then DrawCircle(352, 150, 9, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_X)) then DrawCircle(501, 151, 15, BLUE) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_A)) then DrawCircle(536, 187, 15, LIME) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_B)) then DrawCircle(572, 151, 15, MAROON) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_Y)) then DrawCircle(536, 115, 15, GOLD) end
|
||||||
|
|
||||||
|
-- Draw buttons: d-pad
|
||||||
|
DrawRectangle(317, 202, 19, 71, BLACK)
|
||||||
|
DrawRectangle(293, 228, 69, 19, BLACK)
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_UP)) then DrawRectangle(317, 202, 19, 26, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_DOWN)) then DrawRectangle(317, 202 + 45, 19, 26, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LEFT)) then DrawRectangle(292, 228, 25, 19, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RIGHT)) then DrawRectangle(292 + 44, 228, 26, 19, RED) end
|
||||||
|
|
||||||
|
-- Draw buttons: left-right back
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LB)) then DrawCircle(259, 61, 20, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RB)) then DrawCircle(536, 61, 20, RED) end
|
||||||
|
|
||||||
|
-- Draw axis: left joystick
|
||||||
|
DrawCircle(259, 152, 39, BLACK)
|
||||||
|
DrawCircle(259, 152, 34, LIGHTGRAY)
|
||||||
|
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_X)*20),
|
||||||
|
152 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_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.XBOX_AXIS_RIGHT_X)*20),
|
||||||
|
237 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_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.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT))/2.0)*70), RED)
|
||||||
|
DrawRectangle(604, 30, 15, (((1.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT))/2.0)*70), RED)
|
||||||
|
|
||||||
|
--DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT)), 10, 40, 10, BLACK)
|
||||||
|
--DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT)), 10, 60, 10, BLACK)
|
||||||
|
elseif (IsGamepadName(GAMEPAD.PLAYER1, "PLAYSTATION(R)3 Controller")) then
|
||||||
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY)
|
||||||
|
|
||||||
|
-- Draw buttons: ps
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_PS)) then DrawCircle(396, 222, 13, RED) end
|
||||||
|
|
||||||
|
-- Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SELECT)) then DrawRectangle(328, 170, 32, 13, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_START)) then DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_TRIANGLE)) then DrawCircle(557, 144, 13, LIME) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CIRCLE)) then DrawCircle(586, 173, 13, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CROSS)) then DrawCircle(557, 203, 13, VIOLET) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SQUARE)) then DrawCircle(527, 173, 13, PINK) end
|
||||||
|
|
||||||
|
-- Draw buttons: d-pad
|
||||||
|
DrawRectangle(225, 132, 24, 84, BLACK)
|
||||||
|
DrawRectangle(195, 161, 84, 25, BLACK)
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_UP)) then DrawRectangle(225, 132, 24, 29, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_DOWN)) then DrawRectangle(225, 132 + 54, 24, 30, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_LEFT)) then DrawRectangle(195, 161, 30, 25, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_RIGHT)) then DrawRectangle(195 + 54, 161, 30, 25, RED) end
|
||||||
|
|
||||||
|
-- Draw buttons: left-right back buttons
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_L1)) then DrawCircle(239, 82, 20, RED) end
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_R1)) then DrawCircle(557, 82, 20, RED) end
|
||||||
|
|
||||||
|
-- Draw axis: left joystick
|
||||||
|
DrawCircle(319, 255, 35, BLACK)
|
||||||
|
DrawCircle(319, 255, 31, LIGHTGRAY)
|
||||||
|
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_LEFT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_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.PS3_AXIS_RIGHT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_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.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_L2))/2.0)*70), RED)
|
||||||
|
DrawRectangle(611, 48, 15, (((1.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_R2))/2.0)*70), RED)
|
||||||
|
else
|
||||||
|
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY)
|
||||||
|
|
||||||
|
-- TODO: Draw generic gamepad
|
||||||
|
end
|
||||||
|
|
||||||
|
DrawText(string.format("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD.PLAYER1)), 10, 50, 10, MAROON)
|
||||||
|
|
||||||
|
for i = 1, GetGamepadAxisCount(GAMEPAD.PLAYER1) do -- Iterate along all the rectangles
|
||||||
|
DrawText(string.format("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD.PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (GetGamepadButtonPressed() ~= -1) then DrawText(string.format("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED)
|
||||||
|
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY) end
|
||||||
|
else
|
||||||
|
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY)
|
||||||
|
|
||||||
|
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY)
|
||||||
|
end
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texPs3Pad) -- Unload gamepad texture
|
||||||
|
UnloadTexture(texXboxPad) -- Unload gamepad texture
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_input_gamepad.png
Normal file
After Width: | Height: | Size: 37 KiB |
@@ -1,51 +1,51 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 03a - Keyboard input
|
* raylib [core] example - Keyboard input
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input");
|
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set target frames-per-second
|
SetTargetFPS(60); // Set target frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8;
|
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f;
|
||||||
if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8;
|
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f;
|
||||||
if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8;
|
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f;
|
||||||
if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8;
|
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
|
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 50, MAROON);
|
DrawCircleV(ballPosition, 50, MAROON);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -54,6 +54,6 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
51
examples/core_input_keys.lua
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Keyboard input
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
|
||||||
|
|
||||||
|
local ballPosition = Vector2(screenWidth/2, screenHeight/2)
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set target frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
if (IsKeyDown(KEY.RIGHT)) then ballPosition.x = ballPosition.x + 0.8 end
|
||||||
|
if (IsKeyDown(KEY.LEFT)) then ballPosition.x = ballPosition.x - 0.8 end
|
||||||
|
if (IsKeyDown(KEY.UP)) then ballPosition.y = ballPosition.y - 0.8 end
|
||||||
|
if (IsKeyDown(KEY.DOWN)) then ballPosition.y = ballPosition.y + 0.8 end
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY)
|
||||||
|
|
||||||
|
DrawCircleV(ballPosition, 50, MAROON)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -1,11 +1,11 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib example 03b - Mouse input
|
* raylib [core] example - Mouse input
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -17,39 +17,37 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
||||||
|
|
||||||
|
Vector2 ballPosition = { -100.0f, -100.0f };
|
||||||
|
Color ballColor = DARKBLUE;
|
||||||
|
|
||||||
Vector2 ballPosition = { -100.0, -100.0 };
|
SetTargetFPS(60);
|
||||||
int counter = 0;
|
|
||||||
int mouseX, mouseY;
|
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input");
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
ballPosition = GetMousePosition();
|
||||||
{
|
|
||||||
mouseX = GetMouseX();
|
|
||||||
mouseY = GetMouseY();
|
|
||||||
|
|
||||||
ballPosition.x = (float)mouseX;
|
|
||||||
ballPosition.y = (float)mouseY;
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||||
|
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||||
|
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 40, GOLD);
|
DrawCircleV(ballPosition, 40, ballColor);
|
||||||
|
|
||||||
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -58,6 +56,6 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
54
examples/core_input_mouse.lua
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Mouse input
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input")
|
||||||
|
|
||||||
|
local ballPosition = Vector2(-100.0, -100.0)
|
||||||
|
local ballColor = DARKBLUE
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set target frames-per-second
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
ballPosition = GetMousePosition()
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then ballColor = MAROON
|
||||||
|
elseif (IsMouseButtonPressed(MOUSE.MIDDLE_BUTTON)) then ballColor = LIME
|
||||||
|
elseif (IsMouseButtonPressed(MOUSE.RIGHT_BUTTON)) then ballColor = DARKBLUE
|
||||||
|
end
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawCircleV(ballPosition, 40, ballColor)
|
||||||
|
|
||||||
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
----------------------------------------------------------------------------------------
|
BIN
examples/core_input_mouse.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -1,11 +1,11 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib test - Testing GetMouseWheelMove()
|
* raylib [core] examples - Mouse wheel
|
||||||
*
|
*
|
||||||
* This test has been created using raylib 1.0 (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)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -17,33 +17,34 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib test - Mouse wheel");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
|
||||||
|
|
||||||
int positionY = 0;
|
int boxPositionY = screenHeight/2 - 40;
|
||||||
int scrollSpeed = 4; // Scrolling speed in pixels
|
int scrollSpeed = 4; // Scrolling speed in pixels
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
positionY -= (GetMouseWheelMove()*scrollSpeed);
|
boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawRectangle(200, positionY, 80, 80, MAROON);
|
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
|
||||||
|
|
||||||
DrawText(FormatText("%i", positionY), 10, 10, 20, GRAY);
|
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
|
||||||
|
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
@@ -52,6 +53,6 @@ int main()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
50
examples/core_mouse_wheel.lua
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] examples - Mouse wheel
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel")
|
||||||
|
|
||||||
|
local boxPositionY = screenHeight/2 - 40
|
||||||
|
local scrollSpeed = 4 -- Scrolling speed in pixels
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set target frames-per-second
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
boxPositionY = boxPositionY - (GetMouseWheelMove()*scrollSpeed)
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON)
|
||||||
|
|
||||||
|
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY)
|
||||||
|
DrawText(string.format("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
----------------------------------------------------------------------------------------
|
BIN
examples/core_mouse_wheel.png
Normal file
After Width: | Height: | Size: 15 KiB |
85
examples/core_oculus_rift.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Oculus Rift CV1
|
||||||
|
*
|
||||||
|
* Compile example using:
|
||||||
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.5 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 1080;
|
||||||
|
int screenHeight = 600;
|
||||||
|
|
||||||
|
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
|
||||||
|
|
||||||
|
// NOTE: If device is not available, it fallbacks to default device (simulator)
|
||||||
|
InitVrDevice(HMD_OCULUS_RIFT_CV1); // Init VR device (Oculus Rift CV1)
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
|
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.fovy = 60.0f; // Camera field-of-view Y
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsVrSimulator()) UpdateCamera(&camera); // Update camera (simulator mode)
|
||||||
|
else if (IsVrDeviceReady()) UpdateVrTracking(&camera); // Update camera with device tracking data
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(40, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseVrDevice(); // Close VR device
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
73
examples/core_oculus_rift.lua
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Oculus Rift CV1
|
||||||
|
--
|
||||||
|
-- NOTE: Example requires linkage with LibOVR
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 1080
|
||||||
|
local screenHeight = 600
|
||||||
|
|
||||||
|
-- NOTE: screenWidth/screenHeight should match VR device aspect ratio
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift")
|
||||||
|
|
||||||
|
-- NOTE: If device is not available, it fallbacks to default device (simulator)
|
||||||
|
InitVrDevice(VrDevice.OCULUS_RIFT_CV1) -- Init VR device (Oculus Rift CV1)
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world
|
||||||
|
local camera = {}
|
||||||
|
camera.position = Vector3(5.0, 5.0, 5.0) -- Camera position
|
||||||
|
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
|
||||||
|
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 60.0 -- Camera field-of-view Y
|
||||||
|
|
||||||
|
local cubePosition = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
SetTargetFPS(90) -- Set our game to run at 90 frames-per-second
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
UpdateVrTracking()
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY.SPACE)) then ToggleVrMode() end
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera)
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
|
||||||
|
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawFPS(10, 10)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
CloseVrDevice() -- Close VR device
|
||||||
|
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
----------------------------------------------------------------------------------------
|
BIN
examples/core_oculus_rift.png
Normal file
After Width: | Height: | Size: 173 KiB |
65
examples/core_random_values.c
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Generate random values
|
||||||
|
*
|
||||||
|
* This example 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 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
|
||||||
|
|
||||||
|
int framesCounter = 0; // Variable used to count frames
|
||||||
|
|
||||||
|
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||||
|
|
||||||
|
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
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
// Every two seconds (120 frames) a new random value is generated
|
||||||
|
if (((framesCounter/120)%2) == 1)
|
||||||
|
{
|
||||||
|
randValue = GetRandomValue(-8, 5);
|
||||||
|
framesCounter = 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
|
||||||
|
|
||||||
|
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
56
examples/core_random_values.lua
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Generate random values
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values")
|
||||||
|
|
||||||
|
local framesCounter = 0 -- Variable used to count frames
|
||||||
|
|
||||||
|
local randValue = GetRandomValue(-8, 5) -- Get a random integer number between -8 and 5 (both included)
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
framesCounter = framesCounter + 1
|
||||||
|
|
||||||
|
-- Every two seconds (120 frames) a new random value is generated
|
||||||
|
if (((framesCounter/120)%2) == 1) then
|
||||||
|
randValue = GetRandomValue(-8, 5)
|
||||||
|
framesCounter = 0
|
||||||
|
end
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON)
|
||||||
|
|
||||||
|
DrawText(string.format("%i", randValue), 360, 180, 80, LIGHTGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
----------------------------------------------------------------------------------------
|
BIN
examples/core_random_values.png
Normal file
After Width: | Height: | Size: 15 KiB |
85
examples/core_storage_values.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Storage save/load values
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// NOTE: Storage positions must start with 0, directly related to file memory layout
|
||||||
|
typedef enum { STORAGE_SCORE = 0, STORAGE_HISCORE } StorageData;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values");
|
||||||
|
|
||||||
|
int score = 0;
|
||||||
|
int hiscore = 0;
|
||||||
|
|
||||||
|
int framesCounter = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
score = GetRandomValue(1000, 2000);
|
||||||
|
hiscore = GetRandomValue(2000, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER))
|
||||||
|
{
|
||||||
|
StorageSaveValue(STORAGE_SCORE, score);
|
||||||
|
StorageSaveValue(STORAGE_HISCORE, hiscore);
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
// NOTE: If requested position could not be found, value 0 is returned
|
||||||
|
score = StorageLoadValue(STORAGE_SCORE);
|
||||||
|
hiscore = StorageLoadValue(STORAGE_HISCORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
framesCounter++;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
|
||||||
|
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
|
||||||
|
|
||||||
|
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
|
||||||
|
|
||||||
|
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
|
||||||
|
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
|
||||||
|
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
74
examples/core_storage_values.lua
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - Storage save/load values
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- NOTE: Storage positions must start with 0, directly related to file memory layout
|
||||||
|
STORAGE_SCORE = 0
|
||||||
|
STORAGE_HISCORE = 1
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values")
|
||||||
|
|
||||||
|
local score = 0
|
||||||
|
local hiscore = 0
|
||||||
|
|
||||||
|
local framesCounter = 0
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY.R)) then
|
||||||
|
score = GetRandomValue(1000, 2000)
|
||||||
|
hiscore = GetRandomValue(2000, 4000)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY.ENTER)) then
|
||||||
|
StorageSaveValue(STORAGE_SCORE, score)
|
||||||
|
StorageSaveValue(STORAGE_HISCORE, hiscore)
|
||||||
|
elseif (IsKeyPressed(KEY.SPACE)) then
|
||||||
|
-- NOTE: If requested position could not be found, value 0 is returned
|
||||||
|
score = StorageLoadValue(STORAGE_SCORE)
|
||||||
|
hiscore = StorageLoadValue(STORAGE_HISCORE)
|
||||||
|
end
|
||||||
|
|
||||||
|
framesCounter = framesCounter + 1
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
DrawText(string.format("SCORE: %i", score), 280, 130, 40, MAROON)
|
||||||
|
DrawText(string.format("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK)
|
||||||
|
|
||||||
|
DrawText(string.format("frames: %i", framesCounter), 10, 10, 20, LIME)
|
||||||
|
|
||||||
|
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY)
|
||||||
|
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY)
|
||||||
|
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY)
|
||||||
|
|
||||||
|
EndDrawing()
|
||||||
|
---------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
-------------------------------------------------------------------------------------------
|
BIN
examples/core_storage_values.png
Normal file
After Width: | Height: | Size: 16 KiB |
@@ -1,11 +1,11 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib test - Load and draw a 3d model (OBJ)
|
* raylib [core] example - World to screen
|
||||||
*
|
*
|
||||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -18,62 +18,57 @@ int main()
|
|||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
Vector3 position = { 0.0, 0.0, 0.0 };
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib test - 3d models in OpenGL 3.3+");
|
Vector2 cubeScreenPosition;
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/catwhite.png");
|
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
|
||||||
Model cat = LoadModel("resources/cat.obj");
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
SetModelTexture(&cat, texture);
|
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_LEFT)) position.x -= 0.2;
|
UpdateCamera(&camera); // Update camera
|
||||||
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
// Calculate cube screen space position (with a little offset to be in top)
|
||||||
|
cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
Begin3dMode(camera);
|
|
||||||
|
|
||||||
DrawModel(cat, position, 0.1f, BEIGE); // OK_GL11, OK_GL33
|
|
||||||
//DrawModelWires(cat, position, 0.1f, RED); // OK_GL11, OK_GL33
|
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawGizmo(position);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, 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();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Unload texture
|
CloseWindow(); // Close window and OpenGL context
|
||||||
UnloadModel(cat); // Unload model
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
66
examples/core_world_screen.lua
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- raylib [core] example - World to screen
|
||||||
|
--
|
||||||
|
-- This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
|
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
--
|
||||||
|
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
|
--
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Initialization
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
local screenWidth = 800
|
||||||
|
local screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
|
||||||
|
|
||||||
|
-- Define the camera to look into our 3d world
|
||||||
|
local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
|
||||||
|
|
||||||
|
local cubePosition = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
local cubeScreenPosition = Vector2(0, 0)
|
||||||
|
|
||||||
|
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Main game loop
|
||||||
|
while not WindowShouldClose() do -- Detect window close button or ESC key
|
||||||
|
-- Update
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
camera = UpdateCamera(camera) -- Update camera
|
||||||
|
|
||||||
|
-- Calculate cube screen space position (with a little offset to be in top)
|
||||||
|
cubeScreenPosition = GetWorldToScreen(Vector3(cubePosition.x, cubePosition.y + 2.5, cubePosition.z), camera)
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Draw
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing()
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
|
Begin3dMode(camera)
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
|
||||||
|
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
End3dMode()
|
||||||
|
|
||||||
|
DrawText("Enemy: 100 / 100", cubeScreenPosition.x//1 - MeasureText("Enemy: 100 / 100", 20)//2, cubeScreenPosition.y//1, 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()
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
end
|
||||||
|
|
||||||
|
-- De-Initialization
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
CloseWindow() -- Close window and OpenGL context
|
||||||
|
----------------------------------------------------------------------------------------
|
BIN
examples/core_world_screen.png
Normal file
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 10 KiB |
@@ -1,69 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* raylib example 03c - Gamepad input
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
int screenWidth = 800;
|
|
||||||
int screenHeight = 450;
|
|
||||||
|
|
||||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
|
||||||
Vector2 gamepadMove = { 0, 0 };
|
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input");
|
|
||||||
|
|
||||||
SetTargetFPS(60); // Set target frames-per-second
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Main game loop
|
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
||||||
{
|
|
||||||
// Update
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
|
||||||
{
|
|
||||||
gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1);
|
|
||||||
|
|
||||||
ballPosition.x += gamepadMove.x;
|
|
||||||
ballPosition.y -= gamepadMove.y;
|
|
||||||
|
|
||||||
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
|
|
||||||
{
|
|
||||||
ballPosition.x = screenWidth/2;
|
|
||||||
ballPosition.y = screenHeight/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
|
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 50, MAROON);
|
|
||||||
|
|
||||||
EndDrawing();
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
// De-Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 85 KiB |
@@ -1,76 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* raylib example 05b - raylib bitmap font (rbmf) loading and using
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
int screenWidth = 560;
|
|
||||||
int screenHeight = 800;
|
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib example 05b - rBMF fonts");
|
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
|
||||||
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
|
|
||||||
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Main game loop
|
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
||||||
{
|
|
||||||
// Update
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// TODO: Update your variables here
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
DrawTextEx(font1, "TESTING ALAGARD FONT", (Vector2){ 100, 100 }, GetFontBaseSize(font1)*2, 2, MAROON);
|
|
||||||
DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
|
|
||||||
DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
|
|
||||||
DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
|
|
||||||
DrawTextEx(font5, "TESTING ROMULUS FONT", (Vector2){ 100, 430 }, GetFontBaseSize(font5)*2, 3, DARKPURPLE);
|
|
||||||
DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
|
|
||||||
DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
|
|
||||||
DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
|
|
||||||
|
|
||||||
EndDrawing();
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
// De-Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
UnloadSpriteFont(font1); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font2); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font3); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font4); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font5); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font6); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font7); // SpriteFont unloading
|
|
||||||
UnloadSpriteFont(font8); // SpriteFont unloading
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 24 KiB |