Compare commits
963 Commits
b8420d4821
...
6.0
| Author | SHA1 | Date | |
|---|---|---|---|
| dbc56a87da | |||
| 932558ca7a | |||
| 7495a77a79 | |||
| a4680fc677 | |||
| d6445b55d6 | |||
| d87bf55607 | |||
| a32b53f4d6 | |||
| cc752037b9 | |||
| 90e9145978 | |||
| 9060ac7c95 | |||
| 4ced756474 | |||
| 88f8ca42f5 | |||
| 9a3283f698 | |||
| f0a043bb75 | |||
| dde8c8e07e | |||
| 1cbe438f93 | |||
| 7c96c24cf9 | |||
| d116c92f13 | |||
| 14fe0cbfd8 | |||
| 94f3c094e7 | |||
| be768e27f9 | |||
| 6ef36c0a17 | |||
| 49f88dc6ed | |||
| 86aa0950bd | |||
| 96e30549f5 | |||
| 1e43c1d372 | |||
| 21897f4bb9 | |||
| d8ebeb8939 | |||
| 82e980bd42 | |||
| 0decdcd497 | |||
| 4628915787 | |||
| dfbaafa337 | |||
| 019cc889fc | |||
| 034ffda887 | |||
| 970531d112 | |||
| 99eaf72362 | |||
| 1339ec637e | |||
| 44e5126d08 | |||
| 51d693607e | |||
| a5427bc38f | |||
| 605303f62b | |||
| b3592631b0 | |||
| ddfbe973d4 | |||
| fe5271c568 | |||
| de95b3aa70 | |||
| fbcc8cdb55 | |||
| ca6f188233 | |||
| 8e54b19d9f | |||
| e24b01bb28 | |||
| 68d519910a | |||
| 53915d77e6 | |||
| b202421e08 | |||
| 05a14456ae | |||
| c5fc771622 | |||
| d3c6f426b4 | |||
| c4bd4faab5 | |||
| 4a6ceb9c76 | |||
| 6ef0044381 | |||
| 1122add3ee | |||
| 92f82b4add | |||
| cdff3d7bea | |||
| 138ef838d9 | |||
| 6ff51d3a2a | |||
| ea6292e27a | |||
| bb7b8d70e9 | |||
| f36533cbd8 | |||
| 5c2dee0862 | |||
| 12140cd444 | |||
| 3f7f040c7e | |||
| 4799cab772 | |||
| eb4f1a6da0 | |||
| 449182bb51 | |||
| 4ca9170f5b | |||
| 78797757f0 | |||
| a6dc9f9e92 | |||
| c7df641aa2 | |||
| 63beefd0de | |||
| b3bf537fab | |||
| 8743e11285 | |||
| 04f81538b7 | |||
| 8d70f1007b | |||
| 6c0134bb5c | |||
| e9231bc4f1 | |||
| 4c79c6837b | |||
| e5f0c9f8b1 | |||
| d5326fe880 | |||
| adc4c9b875 | |||
| b09da8fce8 | |||
| 0b87a35e5a | |||
| a1bf8d9c75 | |||
| d3cc78d9d7 | |||
| e3dcb144bc | |||
| da93ec4a21 | |||
| fb0f83bc91 | |||
| 29ded51ea4 | |||
| bb78e98a71 | |||
| 5915584cd6 | |||
| 8c44ea5032 | |||
| 5fad835ff1 | |||
| 4142c89baa | |||
| 990a5e0cb4 | |||
| 8a7aff509d | |||
| ba83bd33f3 | |||
| 98d6e24c44 | |||
| 51f4741912 | |||
| d7bd56ef1b | |||
| a693365bf2 | |||
| bd3a35ca21 | |||
| 0f0983c065 | |||
| 5dd4036ed0 | |||
| cb05ef7f03 | |||
| 52d2158f49 | |||
| 0f1e14a600 | |||
| 6cf71f565c | |||
| e71633a0be | |||
| ca1baca7c2 | |||
| 7e8aca00b6 | |||
| c1dbfc87f3 | |||
| 644e4adbe2 | |||
| 1e74aba7c3 | |||
| 83e35ba170 | |||
| 22cc2554b1 | |||
| 1b084ff9f2 | |||
| 8a685877eb | |||
| 8783e66e21 | |||
| 7ae46fb2e6 | |||
| 04c5dc4493 | |||
| bca4f83a02 | |||
| 7fef65a3fe | |||
| da9e881092 | |||
| 2a3b28b67a | |||
| 2fd058c1e4 | |||
| 528caf8b9d | |||
| 85df4e7de5 | |||
| f23319db3c | |||
| 29e4b77580 | |||
| 2c39703d13 | |||
| d657e86043 | |||
| 0de2e8092b | |||
| 48a34d63ed | |||
| fbce5e7541 | |||
| 18756bb79d | |||
| 6ddf9a1885 | |||
| e7d999e3c7 | |||
| 93be463322 | |||
| 5cd7202777 | |||
| 22e1e86c52 | |||
| 1eea511070 | |||
| e0d3037e15 | |||
| 483d687900 | |||
| 7401214e92 | |||
| d2be4ac2c9 | |||
| 19ec2588be | |||
| e2aed43410 | |||
| 4a16dc9b09 | |||
| ceeaf57a8b | |||
| dfc3f58a06 | |||
| 26f329a5e7 | |||
| 1d9e24eb58 | |||
| 29280971be | |||
| fd017c0b2d | |||
| fbec6b0593 | |||
| 8395374e3d | |||
| 116191fd80 | |||
| a6d5a7ffbc | |||
| f89d38b086 | |||
| 38ed50c07b | |||
| 4b9d802d4e | |||
| 70cb8d15e0 | |||
| 7763da41d7 | |||
| 6ba6df3af3 | |||
| 7b9a2a4145 | |||
| f83590aa37 | |||
| c5712db1e0 | |||
| f9ea607385 | |||
| 8a93587eaa | |||
| 64e8bfcfb6 | |||
| 4e360c97f4 | |||
| ee4f4a29c2 | |||
| 6cebf63cba | |||
| 7b1096dc53 | |||
| e40ddfabbb | |||
| 2b207be11e | |||
| d604cd7f65 | |||
| 78023ffca5 | |||
| 32005b9edf | |||
| 99cab6d3a7 | |||
| 1839b3edb0 | |||
| eed30b6f90 | |||
| a0ffefcb9d | |||
| 12039ba7d0 | |||
| c8d1f3e750 | |||
| 54f630774d | |||
| 3e926d65a0 | |||
| f9ee714c76 | |||
| ea00b97c59 | |||
| 02b592cd7b | |||
| 84dc56ba89 | |||
| d6926eb46a | |||
| eb1e85e400 | |||
| 2eaac95df0 | |||
| de720a8d4c | |||
| 28288fafb1 | |||
| 71677765c5 | |||
| e1959a4e5c | |||
| faf42366ec | |||
| 23c06bc6f1 | |||
| 5ada84cc6d | |||
| d0f899721b | |||
| 23f86689dc | |||
| 1cf278b8b4 | |||
| 1d85071372 | |||
| b4746469d4 | |||
| 70a1a57a12 | |||
| 37a852a7ae | |||
| b68dbaa8af | |||
| 9ae34d2c4b | |||
| 8e705b19e4 | |||
| bf830c3f7b | |||
| 23c8ee855d | |||
| 416da9aca6 | |||
| 936e8ae0db | |||
| ea92677902 | |||
| 3bea7f518d | |||
| e1113c8833 | |||
| 2c5e7f8db6 | |||
| 8596c940ae | |||
| 0b9239eca2 | |||
| 70a58a6ec6 | |||
| 950c064448 | |||
| f583674327 | |||
| 28e40d502a | |||
| 178aca0fd0 | |||
| f3958cae5d | |||
| 2b3218c3db | |||
| 05a34b09ea | |||
| d8861cc35f | |||
| c686e087b3 | |||
| 92a1b80465 | |||
| d869db1572 | |||
| f23a900e91 | |||
| 72b206624f | |||
| 7a3cecc010 | |||
| 5361265a7d | |||
| 304e489edd | |||
| b57526d71e | |||
| 006216bfcb | |||
| ecaa1d3d18 | |||
| ad82393bb8 | |||
| 4ebe7d6215 | |||
| 29b5844119 | |||
| aec6e85ec3 | |||
| 25e521553d | |||
| d504e400ea | |||
| 406861a4a1 | |||
| ace4d77bfa | |||
| 7f0cedba63 | |||
| 592cac56f8 | |||
| ade81248c3 | |||
| 149062f715 | |||
| d4dc038e2e | |||
| bee3dc6673 | |||
| 770677da1f | |||
| 3f36c2d3f5 | |||
| 73cb1d5b64 | |||
| e4cbf6b79c | |||
| 43d8933404 | |||
| ae6d34a731 | |||
| 542333b6d3 | |||
| cd17ed1d09 | |||
| 7ba604eb69 | |||
| fbd83cafc7 | |||
| 8b181b1574 | |||
| d2c4aa11e5 | |||
| 7a42778e7b | |||
| 11e3e6e0b9 | |||
| 0c91f230fd | |||
| 005ff74eb0 | |||
| c519e9f566 | |||
| 09f22f3c86 | |||
| 29b9c050c7 | |||
| 0343cb6a37 | |||
| d148d9515b | |||
| 19e6352d37 | |||
| d03a59ca3e | |||
| 2454b3ed4b | |||
| d996bf2bbd | |||
| f33823cefe | |||
| 0aacd330d4 | |||
| ce617cd814 | |||
| 4a3c49cdcb | |||
| 90dd9aef72 | |||
| 4a89da3300 | |||
| 1a5e22808c | |||
| 1f4e1bc477 | |||
| dea67fa18a | |||
| b9f16a28d3 | |||
| 0a7c7569aa | |||
| 781c37972a | |||
| d40ad48326 | |||
| 98c7734911 | |||
| 71607db667 | |||
| 0e6cb0993d | |||
| 97023def48 | |||
| e8ce00dc0b | |||
| 872cfae7ca | |||
| 1955516f54 | |||
| 95edeeccd2 | |||
| 4311df1e6d | |||
| 5bbb2fc1df | |||
| 4678a544b6 | |||
| b871a556d7 | |||
| 7c48fa9ac9 | |||
| 6564cea6a3 | |||
| 059ebaa6ad | |||
| d01f158bd5 | |||
| 180c3c13ba | |||
| dbca900255 | |||
| 1061daf197 | |||
| fb5bc42190 | |||
| b04d2a2268 | |||
| b210d16597 | |||
| 4d6ef19fcc | |||
| fd40d2b374 | |||
| a78d575f75 | |||
| 8f1421ee5d | |||
| debbb90479 | |||
| 8e81ca0e60 | |||
| dcd813068b | |||
| 070082f8c9 | |||
| 4e7c38ac43 | |||
| 85de580527 | |||
| 64848bbd4c | |||
| 919ad68ca7 | |||
| 3aced1fd7c | |||
| 48ec41f0ec | |||
| 4b01c23ba6 | |||
| efda35b309 | |||
| 3b647c85e1 | |||
| b39cc6bce7 | |||
| 7e59e1d93d | |||
| 84f75785ee | |||
| f190c6a4d4 | |||
| 9861baf4b7 | |||
| e67dc15a52 | |||
| f6910bc1e0 | |||
| a654beb565 | |||
| eba1fca933 | |||
| 49cd2ddaa1 | |||
| c4baa5b81d | |||
| c0829bc69e | |||
| 5a36ce5e7c | |||
| b29d6ee462 | |||
| a6fa8b9ff4 | |||
| 4f76b896d5 | |||
| 3881d2aac2 | |||
| f43e049444 | |||
| d4f636151b | |||
| a96cbe0183 | |||
| 4c1efc2bd3 | |||
| ccfa3f762a | |||
| 54b12ed56d | |||
| 33dcd62663 | |||
| 403c2cbccf | |||
| 1aafd3c4a4 | |||
| 242dfee5ef | |||
| e56cdc2684 | |||
| d5ae12f3eb | |||
| 08e79a16b0 | |||
| de7fc12be0 | |||
| 8a2da96eed | |||
| af37fa2a96 | |||
| d0a6892989 | |||
| 63e4fd838d | |||
| 4c71625730 | |||
| 3568b6e293 | |||
| 6986183858 | |||
| 65cddc852e | |||
| afe74c1c70 | |||
| 70a63f7c62 | |||
| a33ae4a8ef | |||
| b21d7f234b | |||
| eda915232d | |||
| e16467e8b6 | |||
| 594f5429b2 | |||
| c610d228a2 | |||
| 29896a2403 | |||
| a8c75f2bc5 | |||
| fbed591a6f | |||
| 9621c3d395 | |||
| 10b94b02ad | |||
| 439448ad7c | |||
| 0df2fe981b | |||
| a938a7c97a | |||
| 026b7e808a | |||
| 4b74312860 | |||
| 4be6815b3b | |||
| 533a17e283 | |||
| 132151cf28 | |||
| cfb81e4a00 | |||
| 644ff28f87 | |||
| 28b9411e9d | |||
| 0c33c603f4 | |||
| 32e7732061 | |||
| d7c38cfbe4 | |||
| 4badbe2b17 | |||
| 51bdaa34fa | |||
| 483b26ef84 | |||
| 972d6f0775 | |||
| d94ea00a97 | |||
| f2c8a9c085 | |||
| 1606dca0cb | |||
| 21f026a484 | |||
| dd7a1948f1 | |||
| 2f6feb74d4 | |||
| c7de5c9d4b | |||
| 6833305826 | |||
| 8de88c71da | |||
| 5b0a799769 | |||
| 1284d68721 | |||
| a6dd2af9e9 | |||
| 11f7db2dd8 | |||
| 7218b674e5 | |||
| cfd5c3f2ab | |||
| b365d23f49 | |||
| 4cf844b74e | |||
| 5cc42c1b80 | |||
| 16e6d325b9 | |||
| 0bcf79ce28 | |||
| 5398b8c9b0 | |||
| c814625c00 | |||
| 5e1f5d5b74 | |||
| 229f82699b | |||
| c256f146b4 | |||
| 23bc037c37 | |||
| c78ac65786 | |||
| 3678c2d157 | |||
| 35fc8ece44 | |||
| af544c24b9 | |||
| c4b11a30cd | |||
| a44157c2a8 | |||
| b00cbdaf49 | |||
| f67e70bb47 | |||
| 9fe51a6144 | |||
| c92de5f108 | |||
| 942f93db55 | |||
| ca89934ed5 | |||
| 416af51a93 | |||
| 980e4d0ad3 | |||
| c9a456e273 | |||
| c07d075a63 | |||
| 5a3391fdce | |||
| 909f040dc5 | |||
| eb4ad50d99 | |||
| 95f72b162b | |||
| cac02ab063 | |||
| ab1d9b3830 | |||
| f805e6cae8 | |||
| 83377a3488 | |||
| 2377506843 | |||
| 0133a4e6c6 | |||
| c124f2552b | |||
| 66755da4c8 | |||
| 02cca28b5f | |||
| 25ce6465d5 | |||
| 4af95a3a84 | |||
| e534f14419 | |||
| 9b183e0c5e | |||
| 8c83dc7d70 | |||
| 0c3e10b262 | |||
| 4054fc42f3 | |||
| 695f353533 | |||
| f260f5fdd0 | |||
| fa1d4eb7fa | |||
| 6e70dece56 | |||
| ebf2f61425 | |||
| 6dfaf9fe7e | |||
| 7523738677 | |||
| 2b48cf6793 | |||
| 1c6f683161 | |||
| 00f42e4199 | |||
| 58d414bcf8 | |||
| 8f8346048c | |||
| eb3cc183cc | |||
| a334a54eac | |||
| 890ca8d687 | |||
| 6450a48c75 | |||
| 8a75439c25 | |||
| 8871d7648d | |||
| 4176c518c7 | |||
| c0c8ee9dc8 | |||
| 11c248aa82 | |||
| 2cf8983e18 | |||
| 297dcc07b8 | |||
| 8cfb99f275 | |||
| 1d8e011eee | |||
| 37bc3f5012 | |||
| da1a76604f | |||
| 05f5143603 | |||
| e4491b40b5 | |||
| 538bf82037 | |||
| 84dfe6a4cf | |||
| 25a54d87e6 | |||
| 64bd27bd08 | |||
| aee6734cff | |||
| 5e14ac5a2e | |||
| 101502103a | |||
| 20dd4641c8 | |||
| fc843dc557 | |||
| 9103f6e055 | |||
| ced84333a9 | |||
| 05f42aa119 | |||
| a1e84caa8c | |||
| ddb827fb6f | |||
| 0a4583ca54 | |||
| 6a701b2679 | |||
| aa2884bd78 | |||
| f27f2d097f | |||
| e4baf682ab | |||
| 8516750975 | |||
| 3212becc91 | |||
| b9446863d7 | |||
| 13f9112d8c | |||
| f16fb065ea | |||
| 66392fe0ae | |||
| 720dd22491 | |||
| ca578b8b08 | |||
| 4b760091da | |||
| 6d562e5e87 | |||
| 7553e9d586 | |||
| 80ad96acc2 | |||
| 7a5e8aa3a5 | |||
| 1c94e94873 | |||
| 33adda1983 | |||
| f031b2f4f4 | |||
| 1c7240a01d | |||
| cf0d6fc664 | |||
| 615fc36eeb | |||
| cbe31759ab | |||
| d74556d35c | |||
| 8d246fdaff | |||
| a0fd5ab1d9 | |||
| 9a337f3b3b | |||
| 5025009860 | |||
| 6f5cabf60c | |||
| c96669e123 | |||
| 9c04b1de82 | |||
| b465b4e2ea | |||
| 2853b28d6d | |||
| 8fa5f1fe2c | |||
| 6f7cd3a9ab | |||
| ae438e804e | |||
| 2a566544d4 | |||
| 71a35f661e | |||
| 2d8e346945 | |||
| f3f02b3e17 | |||
| dad93abcf8 | |||
| 5e8118daf2 | |||
| bc2057345b | |||
| f2a900a60d | |||
| 3adfde42f7 | |||
| 91ac3cc707 | |||
| 19a1683641 | |||
| be6007be93 | |||
| efeccfef61 | |||
| 366300aafe | |||
| 215ad78d5b | |||
| 8115b7e922 | |||
| fd8830948e | |||
| f9899a7182 | |||
| 561cc27403 | |||
| 983efae3e4 | |||
| 95c4efd7a3 | |||
| 68befcc64f | |||
| b1f8cde329 | |||
| 78a81bf407 | |||
| 944567651c | |||
| 1bbc8682f4 | |||
| ed5da45203 | |||
| d3addad9a7 | |||
| d13314fe1c | |||
| 3ba186f2c1 | |||
| 4d9df337a7 | |||
| 4724f7cf1b | |||
| a568506265 | |||
| 6a048b7afe | |||
| ebce9fa97a | |||
| 78661a4ee0 | |||
| 18e1ec504f | |||
| 9f567e6ee4 | |||
| e273aaea1e | |||
| 1ac1309b24 | |||
| c991f9e89f | |||
| 8f3cabcf76 | |||
| 2b051afb29 | |||
| 3d9129e3b4 | |||
| 80ed6eadb8 | |||
| a7ce14ee95 | |||
| 47a8b554bc | |||
| fc8049a039 | |||
| bd36610f91 | |||
| 7e3d6cbfa8 | |||
| 17dc2bb474 | |||
| aaa893f668 | |||
| e1b9857b14 | |||
| cf5e84c3c4 | |||
| f1719480e0 | |||
| 84737a9fc1 | |||
| 727a90c5d1 | |||
| 6c3ef8d9b4 | |||
| 97707d7a6b | |||
| 12cce1766f | |||
| dddc94dc7a | |||
| c22b1d84d5 | |||
| 6820ff61f1 | |||
| 4ad9e09bb2 | |||
| 90af210712 | |||
| 0747e9b5c1 | |||
| c6f4c8e3e0 | |||
| c0179288ba | |||
| 8161475c28 | |||
| 30cd36a8a9 | |||
| ba65bd7f99 | |||
| 67f24b3b41 | |||
| 29173a4978 | |||
| 49868b356f | |||
| 8fcd99c8dd | |||
| 646e814baf | |||
| 5aee9f9d50 | |||
| 282c4b0eab | |||
| 1f7f9ab22b | |||
| ee3d65cbc9 | |||
| 82ad486e6b | |||
| d26435703f | |||
| 0b9f463e64 | |||
| bd21d74914 | |||
| 4cef89cf04 | |||
| 63fb407dc5 | |||
| 80e164fa04 | |||
| e1d5adb326 | |||
| 43bd2b1e18 | |||
| 313659d37d | |||
| a6976b1930 | |||
| 39e39216f6 | |||
| 5fdf178969 | |||
| e3738c1b17 | |||
| d56371ce85 | |||
| 265fa7833c | |||
| f21c1cc6ae | |||
| ec828071ef | |||
| 33cee1146c | |||
| 8081d2bd07 | |||
| 2453977d59 | |||
| e2233acdb0 | |||
| 3f92c396a0 | |||
| d5e8ee77b1 | |||
| f51204821a | |||
| a24e65d8e1 | |||
| f75682f5c9 | |||
| 57e22d5fa0 | |||
| 1b6303b900 | |||
| 83a167ca3f | |||
| 48496e2307 | |||
| e6ef99275a | |||
| c7c6aaf156 | |||
| 06958c91d0 | |||
| 46ca641ec5 | |||
| f3393b8fd8 | |||
| 8455f9d088 | |||
| 95d58ed988 | |||
| 5da90172ac | |||
| 6f4f4cc508 | |||
| e062e3835e | |||
| dcc9e96148 | |||
| 6993bc7337 | |||
| a4a6812d68 | |||
| 9efe127f5d | |||
| 4caba49658 | |||
| 86e00bde65 | |||
| 95a8977e33 | |||
| f531ee2d8f | |||
| b18f547d8f | |||
| be9a24e68c | |||
| bbba3d0802 | |||
| cde917c63c | |||
| a590126351 | |||
| 063986fdae | |||
| a235cd6a18 | |||
| ab463ac89b | |||
| 9fe3f7ca14 | |||
| d26b17f320 | |||
| 6756e9d3d7 | |||
| 06589d3350 | |||
| 596d3bcb7e | |||
| 5c2747e3a8 | |||
| 470a326588 | |||
| 74f7112614 | |||
| d29112fb1f | |||
| 75ae4d347a | |||
| d06c820a44 | |||
| 3e3453d54e | |||
| 4dca02daa5 | |||
| c059ece2a4 | |||
| b5caef1ffb | |||
| 6dcd4cd564 | |||
| 80b6b7fc2a | |||
| d172a24bb0 | |||
| 9c73b0eb37 | |||
| 4dbe04b250 | |||
| 8ae2c9cf5f | |||
| 7f82da0031 | |||
| fcaea5b1a1 | |||
| 4e8b087ffe | |||
| 78faf6a120 | |||
| d8601121da | |||
| ee2999b3e0 | |||
| f76e371436 | |||
| 0b4815b8fe | |||
| d7a7eda959 | |||
| 2a324ace27 | |||
| 8b3ea995f9 | |||
| d8da443604 | |||
| 4ff296bf0b | |||
| ad17af57e9 | |||
| af57c8854f | |||
| eacbc8bd61 | |||
| a66b6c998a | |||
| 4883813bbb | |||
| c24f5ac412 | |||
| 6adb1c2704 | |||
| 9ff87b38b8 | |||
| 3843f771fb | |||
| 12ce106661 | |||
| 48c1619d20 | |||
| e92832fc6d | |||
| cfb43fa999 | |||
| ed68a4fcce | |||
| 91addeb889 | |||
| ee3be5799a | |||
| 87d49262f8 | |||
| 81004135a4 | |||
| cc83b2bd8e | |||
| 46e8343a30 | |||
| 3cf3b309c6 | |||
| 5fbf67a630 | |||
| 0246621210 | |||
| dfc94f64d1 | |||
| bca54047f9 | |||
| b2d455400c | |||
| 127cc1c79e | |||
| 3389c80f49 | |||
| f16d5ce1dd | |||
| cbff0fa22c | |||
| bf5c00f7e0 | |||
| a844a943b5 | |||
| f106301d46 | |||
| 78870335e6 | |||
| 93a21c7e13 | |||
| f4ed8fc50e | |||
| 3b6a68ba69 | |||
| f163209cf2 | |||
| 5db5c9b4a1 | |||
| 9aaf120bbe | |||
| aae2c4b355 | |||
| 5338e39124 | |||
| a0f3f07bdc | |||
| fdc500756d | |||
| cf9a0619ca | |||
| a6dd08fb71 | |||
| 0bbe302e72 | |||
| 6a5b7fb3f8 | |||
| 40594f3ec0 | |||
| 70f4911698 | |||
| 0fbc4272d0 | |||
| cb58ca63d4 | |||
| e244cf297a | |||
| a818508158 | |||
| 1c20b5588d | |||
| e501dfad60 | |||
| a25d11ad1a | |||
| 6f101f4011 | |||
| efe62f0e0d | |||
| 79fd6be008 | |||
| dbcc508196 | |||
| 4bb8c89084 | |||
| 39242dba23 | |||
| 12dc0d6675 | |||
| 93c5dc3b5f | |||
| 04930c5132 | |||
| 780a7df760 | |||
| 428421f21a | |||
| 1b5a14e516 | |||
| 99ed814615 | |||
| 77b9214575 | |||
| ec06f9be37 | |||
| 3c5b3f1c17 | |||
| 79b7cd6b9b | |||
| 1664204291 | |||
| ec3cb7045f | |||
| 74f2a899d9 | |||
| 8604085b6e | |||
| 5aeedb4899 | |||
| 7ae3eb5d3a | |||
| de8575b16e | |||
| aeafce5db4 | |||
| 9ef3448193 | |||
| 085f933b17 | |||
| ab4831911a | |||
| cd0d693a56 | |||
| 7995f8d1b3 | |||
| ed8c4c1b9b | |||
| 4099218f1a | |||
| ffc405325f | |||
| 9c1216699d | |||
| 0c97c95f6c | |||
| bb910bb0b8 | |||
| 153401810a | |||
| 9ed785c2e1 | |||
| 311f6243e3 | |||
| 601ff4f02e | |||
| 4256be5608 | |||
| 087aa1bc3f | |||
| 484cc0e255 | |||
| c6f9f76afb | |||
| af068ec020 | |||
| 8e052b81b4 | |||
| 4ba92f8962 | |||
| 2a04317cff | |||
| 1c45776bb7 | |||
| b020bed2b3 | |||
| fd28db53ad | |||
| 1c39d47b5b | |||
| 047c9d2052 | |||
| 7383de3dea | |||
| 21404d958e | |||
| d2acf06779 | |||
| af11859906 | |||
| 1f65a17274 | |||
| 18e4d1d44f | |||
| adfe2c1704 | |||
| 17bc628fd9 | |||
| 7191749d66 | |||
| e3a562ab57 | |||
| aaf4c1d3ae | |||
| 2d7b66dd37 | |||
| 9f831428e6 | |||
| c80726511c | |||
| 767df4cf52 | |||
| 04a1a0293e | |||
| f62565dc72 | |||
| 6f584464b6 | |||
| 9bf7699624 | |||
| 4cfae99a74 | |||
| 5dd97ecf2f | |||
| ca664cb023 | |||
| b99a6cc6bd | |||
| b067b0b878 | |||
| 59c3fcc23a | |||
| a683dd9615 | |||
| de50402dd5 | |||
| b9e7cb64c5 | |||
| d4ca9f9213 | |||
| 1937fedf08 | |||
| 07aafdd585 | |||
| d7a83a1111 | |||
| f0ffdb33f4 | |||
| e7d27e5b80 | |||
| 7b5c597da5 | |||
| 02b3e44f88 | |||
| 718a841cfb | |||
| 8670e6e1b9 | |||
| 29a7996402 | |||
| 301df440bd | |||
| 7e6f38ad29 | |||
| 78a79a8523 | |||
| 2ea18f7c88 | |||
| 7e3b7cd349 | |||
| 36d3c8acfb | |||
| 377853bb32 | |||
| a0a0d4d5ad | |||
| 8494d76c93 | |||
| 5d9c11e165 | |||
| de20076d36 | |||
| a5a5d3f347 | |||
| 1cdf1dcbbe | |||
| 452cac33b8 | |||
| 14a0a4d0c4 | |||
| 6f1077737e | |||
| f680776941 | |||
| e5f809f534 | |||
| 6ed61e107b | |||
| 8932ba0b0a | |||
| 6966ad5717 | |||
| 3f30533f1c | |||
| a553fbd0c7 | |||
| 0e2e8ce225 | |||
| 5d9352a0a1 | |||
| 56e32f2c3e | |||
| 37149082e8 | |||
| 0e57a572b4 | |||
| beabb1300d | |||
| 218a806ec2 | |||
| 317c1eaeeb | |||
| 3da2fc1bf8 | |||
| 43c81d216c | |||
| 584bc14929 | |||
| 6d9e17594b | |||
| f76666af3f | |||
| e5e684a5ca | |||
| c551fb7118 | |||
| 7d780d18b5 | |||
| a2a22e5e48 | |||
| 4767841b71 | |||
| f36c8ddc56 | |||
| 4cd131cf29 | |||
| 070c7894c6 | |||
| e79603d501 | |||
| 06cfda6ff9 | |||
| 87f758f9b4 | |||
| f6c07099af | |||
| 2724f07c9a | |||
| fe8c83b57d | |||
| 15d234b79d | |||
| 3f6d67c61c | |||
| 07033cff90 | |||
| 2554dcba9b | |||
| 4f9b933b34 | |||
| ca33d495b3 | |||
| 085391e788 | |||
| fbae395e85 | |||
| 78a607b778 | |||
| bb28d7fd0e | |||
| 363855ec3e | |||
| 8ada37d967 | |||
| e7cfd3d4a3 | |||
| 95cb0cbf67 | |||
| 47576e4e10 | |||
| 1161286d51 | |||
| f0674676b6 | |||
| ff8333435a | |||
| 1c3f9fa135 | |||
| 9268b0d029 | |||
| e81fc8d21a | |||
| 23e0898c65 | |||
| 97e214fc68 | |||
| c264c86ee0 | |||
| bd6065a4fd | |||
| dc1632c17a | |||
| 7729727752 | |||
| a15651f4fe | |||
| fbdf5e4fd2 | |||
| ed8f1a22d1 | |||
| 96fb4851ce | |||
| 068978d5b3 | |||
| c1615aaac4 | |||
| b281101001 | |||
| c9b1f2ce54 | |||
| 9931ddd27a | |||
| 36ad7127c2 | |||
| 36824b6c0a | |||
| 865b3310f8 | |||
| 161cab24da | |||
| 6f01f3c06d |
4
.github/workflows/analyze_codeql.yml
vendored
@ -71,7 +71,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@ -90,7 +90,7 @@ jobs:
|
|||||||
cmake --build . --config $BUILD_TYPE
|
cmake --build . --config $BUILD_TYPE
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
with:
|
with:
|
||||||
category: "/language:${{matrix.language}}"
|
category: "/language:${{matrix.language}}"
|
||||||
upload: false
|
upload: false
|
||||||
|
|||||||
6
.github/workflows/build_android.yml
vendored
@ -84,8 +84,10 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
name: ${{ env.RELEASE_NAME }}
|
||||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
path: |
|
||||||
|
./build/${{ env.RELEASE_NAME }}
|
||||||
|
!./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||||
|
|
||||||
- name: Upload Artifact to Release
|
- name: Upload Artifact to Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
6
.github/workflows/build_linux.yml
vendored
@ -114,8 +114,10 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
name: ${{ env.RELEASE_NAME }}
|
||||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
path: |
|
||||||
|
./build/${{ env.RELEASE_NAME }}
|
||||||
|
!./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||||
|
|
||||||
- name: Upload Artifact to Release
|
- name: Upload Artifact to Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
6
.github/workflows/build_macos.yml
vendored
@ -101,8 +101,10 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_NAME }}.tar.gz
|
name: ${{ env.RELEASE_NAME }}
|
||||||
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
path: |
|
||||||
|
./build/${{ env.RELEASE_NAME }}
|
||||||
|
!./build/${{ env.RELEASE_NAME }}.tar.gz
|
||||||
|
|
||||||
- name: Upload Artifact to Release
|
- name: Upload Artifact to Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
8
.github/workflows/build_webassembly.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Setup emsdk
|
- name: Setup emsdk
|
||||||
uses: mymindstorm/setup-emsdk@v14
|
uses: mymindstorm/setup-emsdk@v14
|
||||||
with:
|
with:
|
||||||
version: 3.1.71
|
version: 5.0.3
|
||||||
actions-cache-folder: 'emsdk-cache'
|
actions-cache-folder: 'emsdk-cache'
|
||||||
|
|
||||||
- name: Setup Release Version
|
- name: Setup Release Version
|
||||||
@ -71,8 +71,10 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_NAME }}.zip
|
name: ${{ env.RELEASE_NAME }}
|
||||||
path: ./build/${{ env.RELEASE_NAME }}.zip
|
path: |
|
||||||
|
./build/${{ env.RELEASE_NAME }}
|
||||||
|
!./build/${{ env.RELEASE_NAME }}.zip
|
||||||
|
|
||||||
- name: Upload Artifact to Release
|
- name: Upload Artifact to Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
6
.github/workflows/build_windows.yml
vendored
@ -142,8 +142,10 @@ jobs:
|
|||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_NAME }}.zip
|
name: ${{ env.RELEASE_NAME }}
|
||||||
path: ./build/${{ env.RELEASE_NAME }}.zip
|
path: |
|
||||||
|
./build/${{ env.RELEASE_NAME }}
|
||||||
|
!./build/${{ env.RELEASE_NAME }}.zip
|
||||||
|
|
||||||
- name: Upload Artifact to Release
|
- name: Upload Artifact to Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
8
.github/workflows/parse_api.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update parse files
|
- name: Update parse files
|
||||||
working-directory: tools/parser
|
working-directory: tools/rlparser
|
||||||
run: |
|
run: |
|
||||||
make raylib_api
|
make raylib_api
|
||||||
mv raylib_api.* output
|
mv raylib_api.* output
|
||||||
@ -22,7 +22,7 @@ jobs:
|
|||||||
- name: Diff parse files
|
- name: Diff parse files
|
||||||
id: diff
|
id: diff
|
||||||
run: |
|
run: |
|
||||||
git add -N parser
|
git add -N tools/rlparser/output
|
||||||
git diff --name-only --exit-code
|
git diff --name-only --exit-code
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
@ -32,6 +32,6 @@ jobs:
|
|||||||
set -x
|
set -x
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
git add tools/parser
|
git add tools/rlparser/output
|
||||||
git commit -m "Update raylib_api.* by CI"
|
git commit -m "rlparser: update raylib_api.* by CI"
|
||||||
git push
|
git push
|
||||||
|
|||||||
7
.github/workflows/update_examples.yml
vendored
@ -29,8 +29,9 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Build and run rexm tool (requires GNU Makefile)
|
- name: Build and run rexm tool (requires GNU Makefile)
|
||||||
# "rexm update" validates and updates all required examples in raylib and even raylib.com repos,
|
# "rexm validate" validates examples collection, looking for inconsistencies, it does not rebuild examples
|
||||||
# note that it calls examples/Makefile.Web internally, so it requires [make] tool available
|
# "rexm update" validates and updates all examples with inconsistencies, pushing fixes to raylib and raylib.com repos
|
||||||
|
# note that rexm calls examples/Makefile.Web internally, so it requires [make] tool available
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install -y libopengl0 libglu1-mesa libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
|
sudo apt-get update && sudo apt-get install -y libopengl0 libglu1-mesa libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
|
||||||
cd "${{ github.workspace }}/src"
|
cd "${{ github.workspace }}/src"
|
||||||
@ -47,7 +48,7 @@ jobs:
|
|||||||
export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt"
|
export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt"
|
||||||
export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln"
|
export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln"
|
||||||
export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main"
|
export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main"
|
||||||
./rexm update
|
./rexm validate
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Commit changes to raylib repo (DISABLED)
|
- name: Commit changes to raylib repo (DISABLED)
|
||||||
|
|||||||
21
.gitignore
vendored
@ -55,15 +55,26 @@ packages/
|
|||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
*.dll
|
*.dll
|
||||||
|
*.h.pch
|
||||||
|
./*.obj
|
||||||
|
|
||||||
|
# Ignore SDL libs for testing
|
||||||
|
src/external/SDL2
|
||||||
|
src/external/SDL3
|
||||||
|
|
||||||
# Emscripten
|
# Emscripten
|
||||||
emsdk
|
emsdk
|
||||||
|
|
||||||
# Ignore wasm data in examples/
|
# Ignore wasm data in examples/
|
||||||
|
examples/**/*
|
||||||
|
!examples/**/*.*
|
||||||
|
!examples/**/*/
|
||||||
|
examples/**/*.exe
|
||||||
examples/**/*.wasm
|
examples/**/*.wasm
|
||||||
examples/**/*.data
|
examples/**/*.data
|
||||||
examples/**/*.js
|
examples/**/*.js
|
||||||
examples/**/*.html
|
examples/**/*.html
|
||||||
|
examples/**/logs/*
|
||||||
|
|
||||||
# Ignore files build by xcode
|
# Ignore files build by xcode
|
||||||
*.mode*v*
|
*.mode*v*
|
||||||
@ -81,6 +92,7 @@ DerivedData/
|
|||||||
|
|
||||||
# VSCode project
|
# VSCode project
|
||||||
.vscode
|
.vscode
|
||||||
|
.clangd
|
||||||
|
|
||||||
# Jetbrains project
|
# Jetbrains project
|
||||||
.idea/
|
.idea/
|
||||||
@ -106,16 +118,23 @@ GTAGS
|
|||||||
# Zig programming language
|
# Zig programming language
|
||||||
.zig-cache/
|
.zig-cache/
|
||||||
zig-cache/
|
zig-cache/
|
||||||
|
zig-pkg/
|
||||||
zig-out/
|
zig-out/
|
||||||
build/
|
build/
|
||||||
build-*/
|
build-*/
|
||||||
docgen_tmp/
|
docgen_tmp/
|
||||||
|
|
||||||
# Tools stuff
|
# Tools stuff
|
||||||
tools/parser/raylib_parser
|
tools/parser/rlparser.exe
|
||||||
|
tools/parser/rlparser
|
||||||
tools/rexm/rexm.exe
|
tools/rexm/rexm.exe
|
||||||
tools/rexm/rexm
|
tools/rexm/rexm
|
||||||
|
|
||||||
# CI
|
# CI
|
||||||
emsdk-cache/
|
emsdk-cache/
|
||||||
raylib.com/
|
raylib.com/
|
||||||
|
|
||||||
|
# Wayland files
|
||||||
|
src/*protocol.h
|
||||||
|
src/*protocol-code.h
|
||||||
|
src/*protocol-code.c
|
||||||
|
|||||||
17
BINDINGS.md
@ -6,7 +6,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
|
|
||||||
| Name | raylib Version | Language | License |
|
| Name | raylib Version | Language | License |
|
||||||
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
|
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
|
||||||
| [raylib](https://github.com/raysan5/raylib) | **5.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
| [raylib](https://github.com/raysan5/raylib) | **6.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
||||||
| [raylib-ada](https://github.com/Fabien-Chouteau/raylib-ada) | **5.5** | [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)) | MIT |
|
| [raylib-ada](https://github.com/Fabien-Chouteau/raylib-ada) | **5.5** | [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)) | MIT |
|
||||||
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
||||||
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||||
@ -21,6 +21,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |
|
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |
|
||||||
| [raylib](https://github.com/fosskers/raylib) | 5.5 | [Common Lisp](https://common-lisp.net) | MPL-2.0 |
|
| [raylib](https://github.com/fosskers/raylib) | 5.5 | [Common Lisp](https://common-lisp.net) | MPL-2.0 |
|
||||||
| [chez-raylib](https://github.com/Yunoinsky/chez-raylib) | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme) | GPLv3 |
|
| [chez-raylib](https://github.com/Yunoinsky/chez-raylib) | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme) | GPLv3 |
|
||||||
|
| [chicken-raylib](https://github.com/meowstr/chicken-raylib) | 5.5 | [CHICKEN Scheme](https://wiki.call-cc.org) | MIT |
|
||||||
| [CLIPSraylib](https://github.com/mrryanjohnston/CLIPSraylib) | **auto** | [CLIPS](https://www.clipsrules.net/) | MIT |
|
| [CLIPSraylib](https://github.com/mrryanjohnston/CLIPSraylib) | **auto** | [CLIPS](https://www.clipsrules.net/) | MIT |
|
||||||
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
||||||
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
||||||
@ -28,9 +29,13 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
||||||
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
||||||
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
|
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
|
||||||
|
| [DenoRaylib550](https://github.com/JJLDonley/DenoRaylib550) | **5.5** | [Deno](https://deno.land) | MIT |
|
||||||
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
|
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
|
||||||
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 4.5 | [Factor](https://factorcode.org) | BSD |
|
| [raylib-elle](https://github.com/acquitelol/elle/blob/rewrite/std/raylib.le) | **5.5** | [Elle](https://github.com/acquitelol/elle) | GPL-3.0 |
|
||||||
|
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 5.5 | [Factor](https://factorcode.org) | BSD |
|
||||||
|
| [raylib4fb](https://github.com/mudhairless/raylib4fb) | **5.5** | [FreeBASIC](https://www.freebasic.net) | Zlib |
|
||||||
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
|
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
|
||||||
|
| [raylib.f](https://github.com/cthulhuology/raylib.f) | **5.5** | [Forth](https://forth.com) | Zlib |
|
||||||
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
|
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
|
||||||
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
|
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
|
||||||
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
|
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
|
||||||
@ -55,11 +60,11 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
||||||
| [naylib](https://github.com/planetis-m/naylib) | **5.6-dev** | [Nim](https://nim-lang.org) | MIT |
|
| [naylib](https://github.com/planetis-m/naylib) | **5.6-dev** | [Nim](https://nim-lang.org) | MIT |
|
||||||
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
||||||
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | BSD-3Clause |
|
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | Zlib |
|
||||||
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
||||||
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
|
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
|
||||||
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
||||||
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
|
||||||
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
||||||
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
|
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
|
||||||
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
|
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
|
||||||
@ -82,6 +87,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [raylib-v](https://github.com/vlang/raylib) | 5.5 | [V](https://vlang.io) | MIT/Unlicense |
|
| [raylib-v](https://github.com/vlang/raylib) | 5.5 | [V](https://vlang.io) | MIT/Unlicense |
|
||||||
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
|
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
|
||||||
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
|
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
|
||||||
|
| [raylib-wave](https://github.com/wavefnd/raylib-wave) | **auto** |[Wave](http://wave-lang.dev) | Zlib |
|
||||||
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
||||||
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
|
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
|
||||||
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
||||||
@ -90,6 +96,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [raylib-sunder](https://github.com/ashn-dot-dev/raylib-sunder) | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD |
|
| [raylib-sunder](https://github.com/ashn-dot-dev/raylib-sunder) | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD |
|
||||||
| [raylib-bqn](https://github.com/Brian-ED/raylib-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
| [raylib-bqn](https://github.com/Brian-ED/raylib-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||||
| [rayjs](https://github.com/mode777/rayjs) | 4.6-dev | [QuickJS](https://bellard.org/quickjs) | MIT |
|
| [rayjs](https://github.com/mode777/rayjs) | 4.6-dev | [QuickJS](https://bellard.org/quickjs) | MIT |
|
||||||
|
| [rayjule](https://github.com/SabeDoesThings/rayjule) | **5.5** | [Jule](https://jule.dev/) | MIT |
|
||||||
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
|
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
|
||||||
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
||||||
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
||||||
@ -97,6 +104,8 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||||||
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
||||||
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
|
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
|
||||||
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
|
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
|
||||||
|
| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license |
|
||||||
|
|
||||||
|
|
||||||
### Utility Wrapers
|
### Utility Wrapers
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ include(CMakeOptions.txt)
|
|||||||
|
|
||||||
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web")
|
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web")
|
||||||
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
||||||
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
|
message(FATAL_ERROR "Cannot disable both Wayland and X11")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${BUILD_EXAMPLES})
|
if (${BUILD_EXAMPLES})
|
||||||
MESSAGE(STATUS "Building examples is enabled")
|
message(STATUS "Building examples is enabled")
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,9 @@ if(EMSCRIPTEN)
|
|||||||
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
|
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
|
||||||
SET(PLATFORM Web CACHE STRING "Platform to build for.")
|
SET(PLATFORM Web CACHE STRING "Platform to build for.")
|
||||||
endif()
|
endif()
|
||||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
|
enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.")
|
||||||
|
|
||||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
|
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")
|
||||||
|
|
||||||
# Configuration options
|
# Configuration options
|
||||||
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
|
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
|
||||||
|
|||||||
@ -69,8 +69,8 @@ If you have any doubt, don't hesitate to [contact me](mailto:ray@raylib.com)!.
|
|||||||
You can write me a direct mail but you can also contact me on the following networks:
|
You can write me a direct mail but you can also contact me on the following networks:
|
||||||
|
|
||||||
- [raylib Discord](https://discord.gg/raylib) - A direct communication channel for project discussions.
|
- [raylib Discord](https://discord.gg/raylib) - A direct communication channel for project discussions.
|
||||||
- [raylib twitter](https://twitter.com/raysan5) - My personal twitter account, I usually post about raylib, you can send me PMs.
|
|
||||||
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
|
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
|
||||||
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
|
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
|
||||||
|
- [raylib X](https://x.com/raysan5) - My personal X account, I usually post about raylib, you can send me PMs.
|
||||||
|
|
||||||
Thank you very much for your time! :)
|
Thank you very much for your time! :)
|
||||||
|
|||||||
@ -41,6 +41,7 @@ while (!WindowShouldClose())
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always use accumulators as `x++` instead of `++x`
|
||||||
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
|
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
|
||||||
|
|
||||||
// Be careful with the switch formatting!
|
// Be careful with the switch formatting!
|
||||||
|
|||||||
82
HISTORY.md
@ -419,7 +419,7 @@ Highlights for `raylib 4.5`:
|
|||||||
|
|
||||||
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
|
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
|
||||||
|
|
||||||
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rl_gputex.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
|
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rltexgpu.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
|
||||||
|
|
||||||
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
|
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
|
||||||
|
|
||||||
@ -522,3 +522,83 @@ Last but not least, I want to thank **raylib sponsors and all the raylib communi
|
|||||||
**After 11 years of development, `raylib 5.5` is the best raylib ever.**
|
**After 11 years of development, `raylib 5.5` is the best raylib ever.**
|
||||||
|
|
||||||
**Enjoy programming with raylib!** :)
|
**Enjoy programming with raylib!** :)
|
||||||
|
|
||||||
|
notes on raylib 6.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
A new `raylib` release is finally ready and, again, this is the **biggest `raylib` release ever**! Thanks to the support of many amazing contributors this release comes packed with many new features and improvements, also thanks to the financial support of [NLnet](https://nlnet.nl/) and the [NGI Zero Commond Fund](https://nlnet.nl/NGI0/) that allow me to work on this project mostly fulltime for the past few months.
|
||||||
|
|
||||||
|
Some astonishing numbers for this release:
|
||||||
|
|
||||||
|
- **+330** closed issues (for a TOTAL of **+2150**!)
|
||||||
|
- **+2000** commits since previous RELEASE (for a TOTAL of **+9760**!)
|
||||||
|
- **+20** new functions ADDED to raylib API (for a TOTAL of **600**!)
|
||||||
|
- **+70** new examples to learn from (for a TOTAL of **+215**!)
|
||||||
|
- **+210** new contributors (for a TOTAL of **+850**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 6.0`:
|
||||||
|
|
||||||
|
- **`NEW` Software Renderer - [`rlsw`](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)**: The biggest addition of this new release. A new software renderer backend, that allows raylib to run purely on CPU, with no neeed for a GPU. It finally closes the circle of my search for a portable self-contained, with **no-external-dependencies**, graphics library, able to run on any device providing some CPU-power and some RAM memory. It has been possible thanks to the amazing work of **Le Juez Victor** ([@Bigfoot71](https://github.com/Bigfoot71)), who created [`rlsw`](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h), a single-file header-only library implementing OpenGL 1.1+ specification, tailored to fit into raylib [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) OpenGL wrapper, and allowing to run raylib seamlessly over CPU with **no code changes required on user side**. As expected, software rendering is slower than hardware-accelerated rendering but it is still fast enough to run basic application at 30-60 fps. Actually, it already proved it usefulness on a new [raylib port for ESP32](https://components.espressif.com/components/georgik/raylib/versions/6.0.0/readme) microcontroller by Espressif, useful for industrial applications, and opens the door to the upcoming RISC-V powered devices that start arriving to the marked, and many times come with no GPU. Along the new software renderer, some of the existing platform backends have been adapted to support it (SDL, RGFW, DRM) and also **new platforms backends have been created** to accomodate it (Win32, Emscripten), incluing a new `PLATFORM_MEMORY`, that allows direct rendering to a memory framebuffer.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend: Memory - [`rcore_memory`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_memory.c)**: This new platform has been added along the **software renderer** backend, allowing 2d and 3d rendering over a **platform-agnostic memory framebuffer**, it can run headless and output frames can be directly exported to images. This new backend could also be useful for graphics rendering on servers or process images directly using the memory buffer.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend: Win32 - [`rcore_desktop_win32`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_win32.c)**: A new **Windows platform backend** and the first step towards a potential replacement/alternative to the platform libraries currently used by raylib (GLFW/SDL/RGFW). This backend follows same API template structure than the other raylib backends, but directly implementing Win32 API calls. It allows initializing OpenGL GPU-accelerated windows and also GDI based windows, useful for the software renderer backend. This new backend approach, following a common template-structure and separating the platform logic by specific OS/Windowing system, will simplify code, improve maintenance, readability and portability for raylib, setting some bases for the future. *NOTE: This backend is new and it could require further testing, use it as an experimental backend for now.*
|
||||||
|
|
||||||
|
- **`NEW` Platform backend: Emscripten - [`rcore_web_emscripten`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_web_emscripten.c)**: In the same line as Win32 backend, this new web backend moves away from `libglfw.js` and **directly implements Emscripten/JS functionality**, with **no other dependencies**, adding support for the new software renderer to draw directly on a **non-accelerated 2d canvas** but also supporting a WebGL-hardware-accelerated canvas when required. *NOTE: This backend is new and it could require further testing, use it as an experimental backend for now.*
|
||||||
|
|
||||||
|
- **`REDESIGNED` Fullscreen modes and High-DPI content scaling**: After many years and many related issues, the full-screen and high-dpi content scaling support has been **completely redesigned** from scratch. New design prioritizes **borderless fullscreen modes** and automatically detects current monitor content scaling configuration to scale window and framebuffer accordingly when required. Still, High-DPI support must be requested by user if desired enabling `FLAG_WINDOW_HIGHDPI` on window creation. This new system has been carefully tested on Windows, Linux (X11, Wayland), macOS with multiple monitors and multiple resolutions, including 4K monitors.
|
||||||
|
|
||||||
|
- **`REDESIGNED` Skeletal Animation System**: A new animation system for 3d models has been created to support animation blending, between single frames but also between differents frames on different animations, to allow easy **timed transitions** between animations. This redesign implied reviewing several raylib structures to better accomodate animation data: `Model`, `ModelSkeleton`, `ModelAnimation`, but the API was simplified and support for GPU-skinning was improved with multiple optimizations.
|
||||||
|
|
||||||
|
- **`REDESIGNED` Build Config System - [`config.h`](https://github.com/raysan5/raylib/blob/master/src/config.h)**: raylib allows lot of customization for specific needs (i.e. disabling modules not needed for specific applications like rmodels or raudio) but previous implementation did not allow easely disabling some features from **custom build systems**. New design not only allows disabling features with simple `-DSUPPORT_FILEFORMAT_OBJ=0` on building command-line but also the full system has been reviewed, removing useless flags and exposing new ones.
|
||||||
|
|
||||||
|
- **`NEW` File System API**: Along the years, multiple filesystem functions have been added to raylib API as required but it felt somewhat inconsistent with some pieces missing. In this new release, the full filesystem API has beeen reviewed and reorganized, compiling all the functionality single module: [rcore](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1126), consequently `utils` module has been removed and build system has been simplified even more; **only 6-7 modules (.c) need to be compiled containing the full raylib library**. This new filesystem API will allow raylib to be used on the creation of custom build systems, as already demostrated with the new `rexm` tool for examples management. At the moment raylib includes **+40 file system management functions**, here a list with the new functions added:
|
||||||
|
```c
|
||||||
|
int FileRename(const char *fileName, const char *fileRename); // Rename file (if exists)
|
||||||
|
int FileRemove(const char *fileName); // Remove file (if exists)
|
||||||
|
int FileCopy(const char *srcPath, const char *dstPath); // Copy file from one path to another, dstPath created if it doesn't exist
|
||||||
|
int FileMove(const char *srcPath, const char *dstPath); // Move file from one directory to another, dstPath created if it doesn't exist
|
||||||
|
int FileTextReplace(const char *fileName, const char *search, const char *replacement); // Replace text in an existing file
|
||||||
|
int FileTextFindIndex(const char *fileName, const char *search); // Find text in existing file
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`NEW` Text Management API**: Along with the new file system functionality, a new set of text management functions has been added, also very useful for text procesing and also used in custom build systems creation using raylib. At the moment raylib includes **+30 text management functions**, here a list with the new functions added:
|
||||||
|
```c
|
||||||
|
char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n')
|
||||||
|
void UnloadTextLines(char **text, int lineCount); // Unload text lines
|
||||||
|
const char *TextRemoveSpaces(const char *text); // Remove text spaces, concat words
|
||||||
|
char *GetTextBetween(const char *text, const char *begin, const char *end); // Get text between two strings
|
||||||
|
char *TextReplace(const char *text, const char *search, const char *replacement); // Replace text string with new string
|
||||||
|
char *TextReplaceAlloc(const char *text, const char *search, const char *replacement); // Replace text string with new string, memory must be MemFree()
|
||||||
|
char *TextReplaceBetween(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings
|
||||||
|
char *TextReplaceBetweenAlloc(const char *text, const char *begin, const char *end, const char *replacement); // Replace text between two specific strings, memory must be MemFree()
|
||||||
|
char *TextInsertAlloc(const char *text, const char *insert, int position); // Insert text in a defined byte position, memory must be MemFree()
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`NEW` tool: raylib examples manager - [rexm](https://github.com/raysan5/raylib/tree/master/tools/rexm)**: raylib examples collection is huge, with **more than 200 examples** it was quite difficult to manage: adding, removing, renaming examples was a very costly process involving many files to be modified (including build systems), also the examples did not follow a common header convention neither a structure conventions. For that reason, a new support tool has been created: **rexm**, a raylib examples manager that allows to easely add/remove/rename examples, automatically fix inconsistencies and even **building and automated testing** on multiple platforms.
|
||||||
|
```
|
||||||
|
USAGE:
|
||||||
|
> rexm <command> <example_name> [<example_rename>]
|
||||||
|
|
||||||
|
COMMANDS:
|
||||||
|
create <new_example_name> : Creates an empty example, from internal template
|
||||||
|
add <example_name> : Add existing example to collection
|
||||||
|
rename <old_examples_name> <new_example_name> : Rename an existing example
|
||||||
|
remove <example_name> : Remove an existing example from collection
|
||||||
|
build <example_name> : Build example for Desktop and Web platforms
|
||||||
|
test <example_name> : Build and Test example for Desktop and Web platforms
|
||||||
|
validate : Validate examples collection, generates report
|
||||||
|
update : Validate and update examples collection, generates report
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`NEW` +70 new examples**: Thanks to `rexm` and the simplification on examples management, this new raylib release includes +70 new examples to learn from, most of them contributed by community. Multiple examples have also been renamed for consistency and all examples header and structure have been reviewed and unified.
|
||||||
|
|
||||||
|
Make sure to check raylib [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) for a detailed list of changes!
|
||||||
|
|
||||||
|
I want to **thank all the contributors (+850!**) that along the years have **greatly improved raylib** and pushed it further and better day after day. And **many thanks to raylib community and all raylib users** for supporting the library along those many years.
|
||||||
|
|
||||||
|
Finally, I want to thank [puffer.ai](https://puffer.ai/) and [comma.ai](https://comma.ai/) for **using raylib and supporting the project** as platinum sponsors, along many others individuals that have been sponsoring raylib along the years. Thanks to all of you for allowing me to keep working on this library!
|
||||||
|
|
||||||
|
**After +12 years of development, `raylib 6.0` is today one of the bests libraries to enjoy games/tools/graphics programming!**
|
||||||
|
|
||||||
|
**Enjoy graphics programming with raylib!** :)
|
||||||
|
|||||||
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
Copyright (c) 2013-2026 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.
|
||||||
|
|||||||
@ -40,6 +40,7 @@ features
|
|||||||
- Written in plain C code (C99) using PascalCase/camelCase notation
|
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||||
- Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**
|
- Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**
|
||||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||||
|
- **Software Renderer** backend (no OpenGL required!): [rlsw](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)
|
||||||
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
||||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||||
@ -61,7 +62,7 @@ This is a basic raylib example, it creates a window and draws the text `"Congrat
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
InitWindow(800, 450, "raylib [core] example - basic window");
|
InitWindow(800, 450, "raylib example - basic window");
|
||||||
|
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose())
|
||||||
{
|
{
|
||||||
@ -129,7 +130,7 @@ raylib is present in several networks and raylib community is growing everyday.
|
|||||||
|
|
||||||
- Webpage: [https://www.raylib.com](https://www.raylib.com)
|
- Webpage: [https://www.raylib.com](https://www.raylib.com)
|
||||||
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
||||||
- Twitter: [https://www.twitter.com/raysan5](https://www.twitter.com/raysan5)
|
- X: [https://x.com/raysan5](https://x.com/raysan5)
|
||||||
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
|
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
|
||||||
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
|
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
|
||||||
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
@ -140,7 +141,7 @@ contributors
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
<a href="https://github.com/raysan5/raylib/graphs/contributors">
|
<a href="https://github.com/raysan5/raylib/graphs/contributors">
|
||||||
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=500&columns=20&anon=1" />
|
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=800&columns=24&anon=0" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
license
|
license
|
||||||
|
|||||||
34
ROADMAP.md
@ -6,6 +6,7 @@ Here is a wishlist with features and ideas to improve the library. Note that fea
|
|||||||
- [GitHub PRs](https://github.com/raysan5/raylib/pulls) open with improvements to be reviewed.
|
- [GitHub PRs](https://github.com/raysan5/raylib/pulls) open with improvements to be reviewed.
|
||||||
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
|
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
|
||||||
- raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
|
- raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
|
||||||
|
- [raylib 7.0 wishlist](https://github.com/raysan5/raylib/discussions/5710)
|
||||||
- [raylib 6.0 wishlist](https://github.com/raysan5/raylib/discussions/4660)
|
- [raylib 6.0 wishlist](https://github.com/raysan5/raylib/discussions/4660)
|
||||||
- [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
|
- [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
|
||||||
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
|
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
|
||||||
@ -13,17 +14,29 @@ Here is a wishlist with features and ideas to improve the library. Note that fea
|
|||||||
|
|
||||||
_Current version of raylib is complete and functional but there is always room for improvements._
|
_Current version of raylib is complete and functional but there is always room for improvements._
|
||||||
|
|
||||||
**raylib 5.x**
|
**raylib 7.0**
|
||||||
- [ ] `rcore`: Support additional platforms: iOS, consoles?
|
- [ ] `rcore_desktop_win32`: Improve new Windows platform backend - inputs, highdpi
|
||||||
- [ ] `rcore_web`: Avoid GLFW dependency, functionality can be directly implemented using emscripten SDK
|
- [ ] `rcore_desktop_emscripten`: Improve new Web platform backend - inputs, highdpi
|
||||||
- [ ] `rlgl`: Review GLSL shaders naming conventions for consistency
|
- [ ] `rcore_desktop_cocoa`: Create additional platform backend: macOS
|
||||||
- [ ] `textures`: Improve compressed textures support, loading and saving
|
- [ ] `rcore_desktop_x11`: Create additional platform backend: Linux/X11
|
||||||
- [ ] `rmodels`: Improve 3d objects loading, specially animations (obj, gltf)
|
- [ ] `rcore_desktop_wayland`: Create additional platform backend: Linux/Wayland
|
||||||
- [ ] `raudio`: Implement miniaudio high-level provided features
|
- [ ] `rcore`: Investigate alternative embedded platforms and realtime OSs
|
||||||
- [ ] `examples`: Review all examples, add more and better code explanations
|
- [ ] `rlsw`: Software renderer optimizations: mipmaps, platform-specific SIMD
|
||||||
- [ ] Software renderer backend? Maybe using `Image` provided API
|
- [ ] `rtextures`: Consider removing N-patch system, provide as separate example
|
||||||
|
- [ ] `rtextures`: Review blending modes system, provide more options or better samples
|
||||||
|
- [ ] `rtext`: Investigate the recently opened [`Slug`](https://sluglibrary.com/) font rendering algorithm
|
||||||
|
- [ ] `raudio`: Support microphone input, basic API to read microphone
|
||||||
|
- [ ] `rltexgpu`: Improve compressed textures support, loading and saving, improve KTX 2.0
|
||||||
|
- [ ] `rlobj`: Create OBJ loader, supporting material file separately (low priority)
|
||||||
|
|
||||||
**raylib 4.x**
|
**raylib 6.0**
|
||||||
|
- [x] `rlsw`: New Software Renderer backend, pseudo-OpenGL 1.1 implementation
|
||||||
|
- [x] `rcore_emscripten`: New emscripten-only backend, avoiding GLFW dependency
|
||||||
|
- [x] `rlgl`: Review GLSL shaders naming conventions for consistency, redesigned shader API
|
||||||
|
- [x] `rmodels`: Improve 3d objects loading, specially animations (obj, gltf)
|
||||||
|
- [x] `examples`: Review all examples, add more and better code explanations
|
||||||
|
|
||||||
|
**raylib 5.0**
|
||||||
- [x] Split core module into separate platforms?
|
- [x] Split core module into separate platforms?
|
||||||
- [x] Redesign gestures system, improve touch inputs management
|
- [x] Redesign gestures system, improve touch inputs management
|
||||||
- [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
|
- [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
|
||||||
@ -31,7 +44,6 @@ _Current version of raylib is complete and functional but there is always room f
|
|||||||
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
|
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
|
||||||
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
|
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
|
||||||
|
|
||||||
|
|
||||||
**raylib 4.0**
|
**raylib 4.0**
|
||||||
- [x] Improved consistency and coherency in raylib API
|
- [x] Improved consistency and coherency in raylib API
|
||||||
- [x] Continuous Deployment using GitHub Actions
|
- [x] Continuous Deployment using GitHub Actions
|
||||||
|
|||||||
18
SECURITY.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Most considerations of errors and defects can be handled using the project Issues and/or Discussions.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 6.0.x | :white_check_mark: |
|
||||||
|
| < 5.5 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Discovered vulnerability can be directly reported using the project Issues and/or Discussions.
|
||||||
|
|
||||||
|
_TODO: Tell them where to go, how often they can expect to get an update on a
|
||||||
|
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||||
|
declined, etc._
|
||||||
@ -1,14 +1,19 @@
|
|||||||
.{
|
.{
|
||||||
.name = .raylib,
|
.name = .raylib,
|
||||||
.version = "5.6.0-dev",
|
.version = "6.0.0",
|
||||||
.minimum_zig_version = "0.15.1",
|
.minimum_zig_version = "0.16.0",
|
||||||
|
|
||||||
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
|
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.xcode_frameworks = .{
|
.xcode_frameworks = .{
|
||||||
.url = "git+https://github.com/hexops/xcode-frameworks#9a45f3ac977fd25dff77e58c6de1870b6808c4a7",
|
.url = "https://pkg.machengine.org/xcode-frameworks/8a1cfb373587ea4c9bb1468b7c986462d8d4e10e.tar.gz",
|
||||||
.hash = "N-V-__8AABHMqAWYuRdIlflwi8gksPnlUMQBiSxAqQAAZFms",
|
.hash = "N-V-__8AALShqgXkvqYU6f__FrA22SMWmi2TXCJjNTO1m8XJ",
|
||||||
|
.lazy = true,
|
||||||
|
},
|
||||||
|
.raygui = .{
|
||||||
|
.url = "git+https://github.com/raysan5/raygui#3b2855842ab578a034f827c38cf8f62c042fc983",
|
||||||
|
.hash = "N-V-__8AAHvybwBw1kyBGn0BW_s1RqIpycNjLf_XbE-fpLUF",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
.emsdk = .{
|
.emsdk = .{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ endif()
|
|||||||
|
|
||||||
set(RAYLIB_DEPENDENCIES "include(CMakeFindDependencyMacro)")
|
set(RAYLIB_DEPENDENCIES "include(CMakeFindDependencyMacro)")
|
||||||
|
|
||||||
if (${PLATFORM} MATCHES "Desktop")
|
if (${PLATFORM} STREQUAL "Desktop")
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP")
|
set(PLATFORM_CPP "PLATFORM_DESKTOP")
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
@ -27,6 +27,12 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
|
||||||
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "QNX")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
find_library(GLESV2 GLESv2)
|
||||||
|
find_library(EGL EGL)
|
||||||
|
set(LIBS_PUBLIC m)
|
||||||
|
set(LIBS_PRIVATE ${GLESV2} ${EGL} atomic pthread dl)
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
@ -38,7 +44,8 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
find_library(OSS_LIBRARY ossaudio)
|
find_library(OSS_LIBRARY ossaudio)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
set(LIBS_PRIVATE pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
set(LIBS_PUBLIC m)
|
||||||
else ()
|
else ()
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
@ -46,11 +53,13 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
set(OPENGL_LIBRARIES "GL")
|
set(OPENGL_LIBRARIES "GL")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
set(LIBS_PRIVATE pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
set(LIBS_PUBLIC m)
|
||||||
|
|
||||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||||
find_library(OSS_LIBRARY ossaudio)
|
find_library(OSS_LIBRARY ossaudio)
|
||||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
else ()
|
||||||
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} atomic)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
|
if (NOT "${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD" AND USE_AUDIO)
|
||||||
@ -58,14 +67,14 @@ if (${PLATFORM} MATCHES "Desktop")
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Web")
|
elseif (${PLATFORM} STREQUAL "Web")
|
||||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
set(PLATFORM_CPP "PLATFORM_WEB")
|
||||||
if(NOT GRAPHICS)
|
if(NOT GRAPHICS)
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Android")
|
elseif (${PLATFORM} STREQUAL "Android")
|
||||||
set(PLATFORM_CPP "PLATFORM_ANDROID")
|
set(PLATFORM_CPP "PLATFORM_ANDROID")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
@ -82,27 +91,38 @@ elseif (${PLATFORM} MATCHES "Android")
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")
|
||||||
|
|
||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
set(LIBS_PRIVATE log android EGL GLESv2 OpenSLES atomic c)
|
||||||
|
set(LIBS_PUBLIC m)
|
||||||
|
|
||||||
elseif ("${PLATFORM}" MATCHES "DRM")
|
elseif ("${PLATFORM}" STREQUAL "DRM")
|
||||||
set(PLATFORM_CPP "PLATFORM_DRM")
|
set(PLATFORM_CPP "PLATFORM_DRM")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
|
||||||
|
|
||||||
add_definitions(-D_DEFAULT_SOURCE)
|
add_definitions(-D_DEFAULT_SOURCE)
|
||||||
add_definitions(-DEGL_NO_X11)
|
|
||||||
add_definitions(-DPLATFORM_DRM)
|
add_definitions(-DPLATFORM_DRM)
|
||||||
|
|
||||||
find_library(GLESV2 GLESv2)
|
|
||||||
find_library(EGL EGL)
|
|
||||||
find_library(DRM drm)
|
find_library(DRM drm)
|
||||||
find_library(GBM gbm)
|
|
||||||
|
|
||||||
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
if (NOT CMAKE_CROSSCOMPILING OR NOT CMAKE_SYSROOT)
|
||||||
include_directories(/usr/include/libdrm)
|
include_directories(/usr/include/libdrm)
|
||||||
endif ()
|
endif ()
|
||||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread m dl)
|
|
||||||
|
|
||||||
elseif ("${PLATFORM}" MATCHES "SDL")
|
if ("${OPENGL_VERSION}" STREQUAL "Software")
|
||||||
|
# software rendering does not require EGL/GBM.
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
|
||||||
|
set(LIBS_PRIVATE ${DRM} atomic pthread dl)
|
||||||
|
else ()
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
add_definitions(-DEGL_NO_X11)
|
||||||
|
|
||||||
|
find_library(GLESV2 GLESv2)
|
||||||
|
find_library(EGL EGL)
|
||||||
|
find_library(GBM gbm)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${DRM} ${GBM} atomic pthread dl)
|
||||||
|
endif ()
|
||||||
|
set(LIBS_PUBLIC m)
|
||||||
|
|
||||||
|
elseif ("${PLATFORM}" STREQUAL "SDL")
|
||||||
# First, check if SDL is included as a subdirectory
|
# First, check if SDL is included as a subdirectory
|
||||||
if(TARGET SDL3::SDL3)
|
if(TARGET SDL3::SDL3)
|
||||||
message(STATUS "Using SDL3 from subdirectory")
|
message(STATUS "Using SDL3 from subdirectory")
|
||||||
@ -132,10 +152,45 @@ elseif ("${PLATFORM}" MATCHES "SDL")
|
|||||||
message(STATUS "Found SDL2 via find_package()")
|
message(STATUS "Found SDL2 via find_package()")
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
||||||
set(LIBS_PUBLIC SDL2::SDL2)
|
set(LIBS_PUBLIC SDL2::SDL2)
|
||||||
set(RAYLIB_DEPENDENCIES "${RAYLIB_DEPENDENCIES}\nfind_dependency(SDL3 REQUIRED)")
|
set(RAYLIB_DEPENDENCIES "${RAYLIB_DEPENDENCIES}\nfind_dependency(SDL2 REQUIRED)")
|
||||||
add_compile_definitions(USING_SDL2_PACKAGE)
|
add_compile_definitions(USING_SDL2_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
elseif ("${PLATFORM}" STREQUAL "RGFW")
|
||||||
|
set(PLATFORM_CPP "PLATFORM_DESKTOP_RGFW")
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
find_library(COCOA Cocoa)
|
||||||
|
find_library(OPENGL OpenGL)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE ${COCOA} ${OPENGL})
|
||||||
|
elseif (WIN32)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} gdi32)
|
||||||
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "QNX")
|
||||||
|
message(FATAL_ERROR "RGFW platform does not support QNX. Use PLATFORM=Desktop or PLATFORM=SDL instead.")
|
||||||
|
elseif (UNIX)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE ${X11_LIBRARIES} ${OPENGL_LIBRARIES})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
elseif ("${PLATFORM}" STREQUAL "WebRGFW")
|
||||||
|
set(PLATFORM_CPP "PLATFORM_WEB_RGFW")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
|
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||||
|
|
||||||
|
elseif ("${PLATFORM}" STREQUAL "Memory")
|
||||||
|
set(PLATFORM_CPP "PLATFORM_MEMORY")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
|
||||||
|
set(OPENGL_VERSION "Software")
|
||||||
|
|
||||||
|
if(WIN32 OR CMAKE_C_COMPILER MATCHES "mingw|mingw32|mingw64")
|
||||||
|
set(LIBS_PRIVATE winmm)
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
@ -153,6 +208,8 @@ if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
|||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
||||||
|
elseif (${OPENGL_VERSION} MATCHES "Software")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_SOFTWARE")
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT "${SUGGESTED_GRAPHICS}" STREQUAL "" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
if (NOT "${SUGGESTED_GRAPHICS}" STREQUAL "" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
||||||
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail.")
|
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail.")
|
||||||
|
|||||||
@ -97,22 +97,21 @@ if (${PLATFORM} MATCHES "Android")
|
|||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c)
|
||||||
|
|
||||||
elseif (${PLATFORM} MATCHES "Web")
|
elseif (${PLATFORM} MATCHES "Web")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os")
|
set(example_sources) # clear example_sources
|
||||||
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
|
list(APPEND example_sources others/web_basic_window.c)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1 --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html")
|
list(APPEND example_sources core/core_input_gestures_testbed.c)
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
||||||
|
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
|
||||||
|
|
||||||
# Remove the -rdynamic flag because otherwise emscripten
|
|
||||||
# does not generate HTML+JS+WASM files, only a non-working
|
|
||||||
# and fat HTML
|
|
||||||
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
|
|
||||||
|
|
||||||
elseif ("${PLATFORM}" STREQUAL "DRM")
|
elseif ("${PLATFORM}" STREQUAL "DRM")
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
||||||
|
elseif ("${PLATFORM}" MATCHES "Memory")
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
||||||
|
elseif ("${OPENGL_VERSION}" STREQUAL "Software")
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
||||||
elseif (NOT SUPPORT_GESTURES_SYSTEM)
|
elseif (NOT SUPPORT_GESTURES_SYSTEM)
|
||||||
# Items requiring gestures system
|
# Items requiring gestures system
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_mouse_painting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_mouse_painting.c)
|
||||||
@ -165,10 +164,46 @@ foreach (example_source ${example_sources})
|
|||||||
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
|
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
|
||||||
string(APPEND resources_dir "resources")
|
string(APPEND resources_dir "resources")
|
||||||
|
|
||||||
if (${PLATFORM} MATCHES "Web" AND EXISTS ${resources_dir})
|
if (${PLATFORM} MATCHES "Web")
|
||||||
# The local resources path needs to be mapped to /resources virtual path
|
target_compile_options(${example_name} PRIVATE -Os)
|
||||||
string(APPEND resources_dir "@resources")
|
target_link_options(${example_name} PRIVATE
|
||||||
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
|
-sALLOW_MEMORY_GROWTH=1
|
||||||
|
-sEXPORTED_RUNTIME_METHODS=[requestFullscreen]
|
||||||
|
-sUSE_GLFW=3
|
||||||
|
--shell-file "${CMAKE_SOURCE_DIR}/src/shell.html"
|
||||||
|
)
|
||||||
|
set_target_properties(${example_name} PROPERTIES SUFFIX ".html")
|
||||||
|
|
||||||
|
if (EXISTS ${resources_dir})
|
||||||
|
# The local resources path needs to be mapped to /resources virtual path
|
||||||
|
string(APPEND resources_dir "@resources")
|
||||||
|
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES3")
|
||||||
|
target_link_options(${example_name} PUBLIC "-sMIN_WEBGL_VERSION=2")
|
||||||
|
target_link_options(${example_name} PUBLIC "-sMAX_WEBGL_VERSION=2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(${example_name} "-framework IOKit")
|
||||||
|
target_link_libraries(${example_name} "-framework Cocoa")
|
||||||
|
target_link_libraries(${example_name} "-framework OpenGL")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif (${PLATFORM} MATCHES "RGFW")
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(${example_name} "-framework IOKit")
|
||||||
|
target_link_libraries(${example_name} "-framework Cocoa")
|
||||||
|
target_link_libraries(${example_name} "-framework OpenGL")
|
||||||
|
elseif (WIN32)
|
||||||
|
target_link_libraries(${example_name} "-lgdi32")
|
||||||
|
target_link_libraries(${example_name} "-lwinmm")
|
||||||
|
elseif (UNIX)
|
||||||
|
target_link_libraries(${example_name} "-lX11")
|
||||||
|
target_link_libraries(${example_name} "-lXrandr")
|
||||||
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
# > PLATFORM_ANDROID:
|
# > PLATFORM_ANDROID:
|
||||||
# - Android (ARM, ARM64)
|
# - Android (ARM, ARM64)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2026 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.
|
||||||
@ -69,7 +69,7 @@ endif
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= raylib_examples
|
PROJECT_NAME ?= raylib_examples
|
||||||
RAYLIB_VERSION ?= 5.5.0
|
RAYLIB_VERSION ?= 6.0.0
|
||||||
RAYLIB_PATH ?= ..
|
RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
# Define raylib source code path
|
# Define raylib source code path
|
||||||
@ -77,7 +77,7 @@ RAYLIB_SRC_PATH ?= ../src
|
|||||||
|
|
||||||
# Locations of raylib.h and libraylib.a/libraylib.so
|
# Locations of raylib.h and libraylib.a/libraylib.so
|
||||||
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
# NOTE: Those variables are only used for PLATFORM_OS: LINUX, BSD
|
||||||
DESTDIR ?= /usr/local
|
DESTDIR ?= /usr/local
|
||||||
RAYLIB_INCLUDE_PATH ?= $(DESTDIR)/include
|
RAYLIB_INCLUDE_PATH ?= $(DESTDIR)/include
|
||||||
RAYLIB_LIB_PATH ?= $(DESTDIR)/lib
|
RAYLIB_LIB_PATH ?= $(DESTDIR)/lib
|
||||||
|
|
||||||
@ -90,6 +90,16 @@ BUILD_MODE ?= RELEASE
|
|||||||
# Use external GLFW library instead of rglfw module
|
# Use external GLFW library instead of rglfw module
|
||||||
USE_EXTERNAL_GLFW ?= FALSE
|
USE_EXTERNAL_GLFW ?= FALSE
|
||||||
|
|
||||||
|
# Enable support for X11 by default on Linux when using GLFW
|
||||||
|
# NOTE: Wayland is disabled by default, only enable if you are sure
|
||||||
|
GLFW_LINUX_ENABLE_WAYLAND ?= FALSE
|
||||||
|
GLFW_LINUX_ENABLE_X11 ?= TRUE
|
||||||
|
|
||||||
|
# Enable support for X11 by default on Linux when using RGFW
|
||||||
|
# NOTE: Wayland is disabled by default, only enable if you are sure
|
||||||
|
RGFW_LINUX_ENABLE_WAYLAND ?= FALSE
|
||||||
|
RGFW_LINUX_ENABLE_X11 ?= TRUE
|
||||||
|
|
||||||
# PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally
|
# PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally
|
||||||
# WARNING: Library is not included in raylib, it MUST be configured by users
|
# WARNING: Library is not included in raylib, it MUST be configured by users
|
||||||
SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
|
SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
|
||||||
@ -145,15 +155,6 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# RAYLIB_PATH adjustment for LINUX platform
|
|
||||||
# TODO: Do we really need this?
|
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
|
||||||
RAYLIB_PREFIX ?= ..
|
|
||||||
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Default path for raylib on Raspberry Pi
|
# Default path for raylib on Raspberry Pi
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
RAYLIB_PATH ?= /home/pi/raylib
|
RAYLIB_PATH ?= /home/pi/raylib
|
||||||
@ -168,8 +169,8 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R
|
|||||||
EMSDK_PATH ?= C:/raylib/emsdk
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||||
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-nuget_64bit
|
PYTHON_PATH = $(EMSDK_PATH)/python/3.13.3_64bit
|
||||||
NODE_PATH = $(EMSDK_PATH)/node/20.18.0_64bit/bin
|
NODE_PATH = $(EMSDK_PATH)/node/22.16.0_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -205,15 +206,17 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
MAKE = mingw32-make
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
MAKE = mingw32-make
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
else
|
else
|
||||||
EMMAKE != type emmake
|
EMMAKE := $(shell command -v emmake)
|
||||||
ifneq (, $(EMMAKE))
|
ifneq (, $(EMMAKE))
|
||||||
MAKE = emmake make
|
MAKE = $(EMMAKE) make
|
||||||
else
|
else
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
endif
|
endif
|
||||||
@ -231,7 +234,7 @@ endif
|
|||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -Wno-unused-value ignore unused return values of some functions (i.e. fread())
|
# -Wno-unused-value ignore unused return values of some functions (i.e. fread())
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wno-unused-result
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g -D_DEBUG
|
CFLAGS += -g -D_DEBUG
|
||||||
@ -292,7 +295,7 @@ endif
|
|||||||
|
|
||||||
# Define library paths containing required libs: LDFLAGS
|
# Define library paths containing required libs: LDFLAGS
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH)
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
@ -391,15 +394,17 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
|||||||
# NOTE: Required packages: libegl1-mesa-dev
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
|
LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
|
||||||
|
|
||||||
# On X11 requires also below libraries
|
# On Wayland, additional libraries requires
|
||||||
LDLIBS += -lX11
|
ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
|
|
||||||
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
|
||||||
|
|
||||||
# On Wayland windowing system, additional libraries requires
|
|
||||||
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
|
|
||||||
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
# On X11, additional libraries required
|
||||||
|
LDLIBS += -lX11
|
||||||
|
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
|
||||||
|
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
|
endif
|
||||||
# Explicit link to libc
|
# Explicit link to libc
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
LDLIBS += -lc
|
LDLIBS += -lc
|
||||||
@ -437,15 +442,16 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
|||||||
# NOTE: Required packages: libegl1-mesa-dev
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib $(SDL_LIBRARIES) -lGL -lm -lpthread -ldl -lrt
|
LDLIBS = -lraylib $(SDL_LIBRARIES) -lGL -lm -lpthread -ldl -lrt
|
||||||
|
|
||||||
# On X11 requires also below libraries
|
# On X11, addition libraries required
|
||||||
LDLIBS += -lX11
|
LDLIBS += -lX11
|
||||||
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
|
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
|
||||||
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
|
|
||||||
# On Wayland windowing system, additional libraries requires
|
# On Wayland, additional libraries requires
|
||||||
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
|
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
|
||||||
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Explicit link to libc
|
# Explicit link to libc
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
LDLIBS += -lc
|
LDLIBS += -lc
|
||||||
@ -465,7 +471,15 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
|||||||
# Libraries for Debian GNU/Linux desktop compipling
|
# Libraries for Debian GNU/Linux desktop compipling
|
||||||
# NOTE: Required packages: libegl1-mesa-dev
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
LDFLAGS += -L../src
|
LDFLAGS += -L../src
|
||||||
LDLIBS = -lraylib -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
|
LDLIBS = -lraylib -lm
|
||||||
|
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
LDLIBS += -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lpthread -ldl -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
||||||
|
endif
|
||||||
|
|
||||||
# Explicit link to libc
|
# Explicit link to libc
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
@ -486,7 +500,19 @@ endif
|
|||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
# Libraries for DRM compiling
|
# Libraries for DRM compiling
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
LDLIBS = -lraylib -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl -latomic
|
||||||
|
# TODO: Examples compilation does not define GRAPHICS, is it required?
|
||||||
|
#ifeq ($(GRAPHICS),GRAPHICS_API_OPENGL_ES2)
|
||||||
|
# LDLIBS += -lGLESv2 -lEGL
|
||||||
|
#endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
|
||||||
|
# Libraries for Windows desktop compilation
|
||||||
|
LDFLAGS += -L..\src
|
||||||
|
LDLIBS = -lraylib -lgdi32 -lwinmm -lshcore
|
||||||
|
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_SOFTWARE)
|
||||||
|
LDLIBS += -lopengl32
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# Libraries for web (HTML5) compiling
|
# Libraries for web (HTML5) compiling
|
||||||
@ -512,10 +538,16 @@ CORE = \
|
|||||||
core/core_automation_events \
|
core/core_automation_events \
|
||||||
core/core_basic_screen_manager \
|
core/core_basic_screen_manager \
|
||||||
core/core_basic_window \
|
core/core_basic_window \
|
||||||
|
core/core_clipboard_text \
|
||||||
|
core/core_compute_hash \
|
||||||
core/core_custom_frame_control \
|
core/core_custom_frame_control \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
|
core/core_delta_time \
|
||||||
|
core/core_directory_files \
|
||||||
core/core_drop_files \
|
core/core_drop_files \
|
||||||
core/core_high_dpi \
|
core/core_highdpi_demo \
|
||||||
|
core/core_highdpi_testbed \
|
||||||
|
core/core_input_actions \
|
||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
core/core_input_gestures_testbed \
|
core/core_input_gestures_testbed \
|
||||||
@ -524,45 +556,75 @@ CORE = \
|
|||||||
core/core_input_mouse_wheel \
|
core/core_input_mouse_wheel \
|
||||||
core/core_input_multitouch \
|
core/core_input_multitouch \
|
||||||
core/core_input_virtual_controls \
|
core/core_input_virtual_controls \
|
||||||
|
core/core_keyboard_testbed \
|
||||||
|
core/core_monitor_detector \
|
||||||
core/core_random_sequence \
|
core/core_random_sequence \
|
||||||
core/core_random_values \
|
core/core_random_values \
|
||||||
core/core_render_texture \
|
core/core_render_texture \
|
||||||
core/core_scissor_test \
|
core/core_scissor_test \
|
||||||
|
core/core_screen_recording \
|
||||||
core/core_smooth_pixelperfect \
|
core/core_smooth_pixelperfect \
|
||||||
core/core_storage_values \
|
core/core_storage_values \
|
||||||
|
core/core_text_file_loading \
|
||||||
|
core/core_undo_redo \
|
||||||
|
core/core_viewport_scaling \
|
||||||
core/core_vr_simulator \
|
core/core_vr_simulator \
|
||||||
core/core_window_flags \
|
core/core_window_flags \
|
||||||
core/core_window_letterbox \
|
core/core_window_letterbox \
|
||||||
core/core_window_should_close \
|
core/core_window_should_close \
|
||||||
|
core/core_window_web \
|
||||||
core/core_world_screen
|
core/core_world_screen
|
||||||
|
|
||||||
SHAPES = \
|
SHAPES = \
|
||||||
|
shapes/shapes_ball_physics \
|
||||||
shapes/shapes_basic_shapes \
|
shapes/shapes_basic_shapes \
|
||||||
shapes/shapes_bouncing_ball \
|
shapes/shapes_bouncing_ball \
|
||||||
|
shapes/shapes_bullet_hell \
|
||||||
shapes/shapes_circle_sector_drawing \
|
shapes/shapes_circle_sector_drawing \
|
||||||
|
shapes/shapes_clock_of_clocks \
|
||||||
shapes/shapes_collision_area \
|
shapes/shapes_collision_area \
|
||||||
shapes/shapes_colors_palette \
|
shapes/shapes_colors_palette \
|
||||||
|
shapes/shapes_dashed_line \
|
||||||
shapes/shapes_digital_clock \
|
shapes/shapes_digital_clock \
|
||||||
shapes/shapes_double_pendulum \
|
shapes/shapes_double_pendulum \
|
||||||
shapes/shapes_easings_ball \
|
shapes/shapes_easings_ball \
|
||||||
shapes/shapes_easings_box \
|
shapes/shapes_easings_box \
|
||||||
shapes/shapes_easings_rectangles \
|
shapes/shapes_easings_rectangles \
|
||||||
|
shapes/shapes_easings_testbed \
|
||||||
shapes/shapes_following_eyes \
|
shapes/shapes_following_eyes \
|
||||||
|
shapes/shapes_hilbert_curve \
|
||||||
|
shapes/shapes_kaleidoscope \
|
||||||
shapes/shapes_lines_bezier \
|
shapes/shapes_lines_bezier \
|
||||||
|
shapes/shapes_lines_drawing \
|
||||||
shapes/shapes_logo_raylib \
|
shapes/shapes_logo_raylib \
|
||||||
shapes/shapes_logo_raylib_anim \
|
shapes/shapes_logo_raylib_anim \
|
||||||
|
shapes/shapes_math_angle_rotation \
|
||||||
|
shapes/shapes_math_sine_cosine \
|
||||||
|
shapes/shapes_mouse_trail \
|
||||||
|
shapes/shapes_penrose_tile \
|
||||||
|
shapes/shapes_pie_chart \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
|
shapes/shapes_recursive_tree \
|
||||||
shapes/shapes_ring_drawing \
|
shapes/shapes_ring_drawing \
|
||||||
|
shapes/shapes_rlgl_color_wheel \
|
||||||
|
shapes/shapes_rlgl_triangle \
|
||||||
shapes/shapes_rounded_rectangle_drawing \
|
shapes/shapes_rounded_rectangle_drawing \
|
||||||
|
shapes/shapes_simple_particles \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_starfield_effect \
|
||||||
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_triangle_strip \
|
||||||
|
shapes/shapes_vector_angle
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
textures/textures_blend_modes \
|
textures/textures_blend_modes \
|
||||||
textures/textures_bunnymark \
|
textures/textures_bunnymark \
|
||||||
|
textures/textures_cellular_automata \
|
||||||
|
textures/textures_clipboard_image \
|
||||||
textures/textures_fog_of_war \
|
textures/textures_fog_of_war \
|
||||||
|
textures/textures_framebuffer_rendering \
|
||||||
textures/textures_gif_player \
|
textures/textures_gif_player \
|
||||||
textures/textures_image_channel \
|
textures/textures_image_channel \
|
||||||
textures/textures_image_drawing \
|
textures/textures_image_drawing \
|
||||||
@ -573,14 +635,17 @@ TEXTURES = \
|
|||||||
textures/textures_image_rotate \
|
textures/textures_image_rotate \
|
||||||
textures/textures_image_text \
|
textures/textures_image_text \
|
||||||
textures/textures_logo_raylib \
|
textures/textures_logo_raylib \
|
||||||
|
textures/textures_magnifying_glass \
|
||||||
textures/textures_mouse_painting \
|
textures/textures_mouse_painting \
|
||||||
textures/textures_npatch_drawing \
|
textures/textures_npatch_drawing \
|
||||||
textures/textures_particles_blending \
|
textures/textures_particles_blending \
|
||||||
textures/textures_polygon_drawing \
|
textures/textures_polygon_drawing \
|
||||||
textures/textures_raw_data \
|
textures/textures_raw_data \
|
||||||
|
textures/textures_screen_buffer \
|
||||||
textures/textures_sprite_animation \
|
textures/textures_sprite_animation \
|
||||||
textures/textures_sprite_button \
|
textures/textures_sprite_button \
|
||||||
textures/textures_sprite_explosion \
|
textures/textures_sprite_explosion \
|
||||||
|
textures/textures_sprite_stacking \
|
||||||
textures/textures_srcrec_dstrec \
|
textures/textures_srcrec_dstrec \
|
||||||
textures/textures_textured_curve \
|
textures/textures_textured_curve \
|
||||||
textures/textures_tiled_drawing \
|
textures/textures_tiled_drawing \
|
||||||
@ -598,22 +663,30 @@ TEXT = \
|
|||||||
text/text_input_box \
|
text/text_input_box \
|
||||||
text/text_rectangle_bounds \
|
text/text_rectangle_bounds \
|
||||||
text/text_sprite_fonts \
|
text/text_sprite_fonts \
|
||||||
|
text/text_strings_management \
|
||||||
text/text_unicode_emojis \
|
text/text_unicode_emojis \
|
||||||
text/text_unicode_ranges \
|
text/text_unicode_ranges \
|
||||||
|
text/text_words_alignment \
|
||||||
text/text_writing_anim
|
text/text_writing_anim
|
||||||
|
|
||||||
MODELS = \
|
MODELS = \
|
||||||
models/models_animation_playing \
|
models/models_animation_blend_custom \
|
||||||
|
models/models_animation_blending \
|
||||||
|
models/models_animation_gpu_skinning \
|
||||||
|
models/models_animation_timing \
|
||||||
|
models/models_basic_voxel \
|
||||||
models/models_billboard_rendering \
|
models/models_billboard_rendering \
|
||||||
models/models_bone_socket \
|
models/models_bone_socket \
|
||||||
models/models_box_collisions \
|
models/models_box_collisions \
|
||||||
models/models_cubicmap_rendering \
|
models/models_cubicmap_rendering \
|
||||||
|
models/models_decals \
|
||||||
|
models/models_directional_billboard \
|
||||||
models/models_first_person_maze \
|
models/models_first_person_maze \
|
||||||
models/models_geometric_shapes \
|
models/models_geometric_shapes \
|
||||||
models/models_gpu_skinning \
|
|
||||||
models/models_heightmap_rendering \
|
models/models_heightmap_rendering \
|
||||||
models/models_loading \
|
models/models_loading \
|
||||||
models/models_loading_gltf \
|
models/models_loading_gltf \
|
||||||
|
models/models_loading_iqm \
|
||||||
models/models_loading_m3d \
|
models/models_loading_m3d \
|
||||||
models/models_loading_vox \
|
models/models_loading_vox \
|
||||||
models/models_mesh_generation \
|
models/models_mesh_generation \
|
||||||
@ -621,6 +694,7 @@ MODELS = \
|
|||||||
models/models_orthographic_projection \
|
models/models_orthographic_projection \
|
||||||
models/models_point_rendering \
|
models/models_point_rendering \
|
||||||
models/models_rlgl_solar_system \
|
models/models_rlgl_solar_system \
|
||||||
|
models/models_rotating_cube \
|
||||||
models/models_skybox_rendering \
|
models/models_skybox_rendering \
|
||||||
models/models_tesseract_view \
|
models/models_tesseract_view \
|
||||||
models/models_textured_cube \
|
models/models_textured_cube \
|
||||||
@ -628,18 +702,23 @@ MODELS = \
|
|||||||
models/models_yaw_pitch_roll
|
models/models_yaw_pitch_roll
|
||||||
|
|
||||||
SHADERS = \
|
SHADERS = \
|
||||||
|
shaders/shaders_ascii_rendering \
|
||||||
shaders/shaders_basic_lighting \
|
shaders/shaders_basic_lighting \
|
||||||
shaders/shaders_basic_pbr \
|
shaders/shaders_basic_pbr \
|
||||||
|
shaders/shaders_cel_shading \
|
||||||
|
shaders/shaders_color_correction \
|
||||||
shaders/shaders_custom_uniform \
|
shaders/shaders_custom_uniform \
|
||||||
shaders/shaders_deferred_rendering \
|
shaders/shaders_deferred_rendering \
|
||||||
shaders/shaders_depth_rendering \
|
shaders/shaders_depth_rendering \
|
||||||
shaders/shaders_depth_writing \
|
shaders/shaders_depth_writing \
|
||||||
shaders/shaders_eratosthenes_sieve \
|
shaders/shaders_eratosthenes_sieve \
|
||||||
shaders/shaders_fog_rendering \
|
shaders/shaders_fog_rendering \
|
||||||
|
shaders/shaders_game_of_life \
|
||||||
shaders/shaders_hot_reloading \
|
shaders/shaders_hot_reloading \
|
||||||
shaders/shaders_hybrid_rendering \
|
shaders/shaders_hybrid_rendering \
|
||||||
shaders/shaders_julia_set \
|
shaders/shaders_julia_set \
|
||||||
shaders/shaders_lightmap_rendering \
|
shaders/shaders_lightmap_rendering \
|
||||||
|
shaders/shaders_mandelbrot_set \
|
||||||
shaders/shaders_mesh_instancing \
|
shaders/shaders_mesh_instancing \
|
||||||
shaders/shaders_model_shader \
|
shaders/shaders_model_shader \
|
||||||
shaders/shaders_multi_sample2d \
|
shaders/shaders_multi_sample2d \
|
||||||
@ -647,6 +726,7 @@ SHADERS = \
|
|||||||
shaders/shaders_palette_switch \
|
shaders/shaders_palette_switch \
|
||||||
shaders/shaders_postprocessing \
|
shaders/shaders_postprocessing \
|
||||||
shaders/shaders_raymarching_rendering \
|
shaders/shaders_raymarching_rendering \
|
||||||
|
shaders/shaders_rlgl_compute \
|
||||||
shaders/shaders_rounded_rectangle \
|
shaders/shaders_rounded_rectangle \
|
||||||
shaders/shaders_shadowmap_rendering \
|
shaders/shaders_shadowmap_rendering \
|
||||||
shaders/shaders_shapes_textures \
|
shaders/shaders_shapes_textures \
|
||||||
@ -666,15 +746,9 @@ AUDIO = \
|
|||||||
audio/audio_sound_loading \
|
audio/audio_sound_loading \
|
||||||
audio/audio_sound_multi \
|
audio/audio_sound_multi \
|
||||||
audio/audio_sound_positioning \
|
audio/audio_sound_positioning \
|
||||||
|
audio/audio_spectrum_visualizer \
|
||||||
|
audio/audio_stream_callback \
|
||||||
audio/audio_stream_effects
|
audio/audio_stream_effects
|
||||||
|
|
||||||
OTHERS = \
|
|
||||||
others/easings_testbed \
|
|
||||||
others/embedded_files_loading \
|
|
||||||
others/raylib_opengl_interop \
|
|
||||||
others/raymath_vector_angle \
|
|
||||||
others/rlgl_compute_shader \
|
|
||||||
others/rlgl_standalone
|
|
||||||
#EXAMPLES_LIST_END
|
#EXAMPLES_LIST_END
|
||||||
|
|
||||||
# Define processes to execute
|
# Define processes to execute
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Android project (APK building)
|
# raylib makefile for Android project (APK building)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2017-2026 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.
|
||||||
@ -130,7 +130,7 @@ ifeq ($(ANDROID_ARCH),ARM)
|
|||||||
CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
||||||
endif
|
endif
|
||||||
ifeq ($(ANDROID_ARCH),ARM64)
|
ifeq ($(ANDROID_ARCH),ARM64)
|
||||||
CFLAGS = -std=c99 -target aarch64 -mfix-cortex-a53-835769
|
CFLAGS = -std=c99 -mfix-cortex-a53-835769
|
||||||
endif
|
endif
|
||||||
# Compilation functions attributes options
|
# Compilation functions attributes options
|
||||||
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
|
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
# > PLATFORM_ANDROID:
|
# > PLATFORM_ANDROID:
|
||||||
# - Android (ARM, ARM64)
|
# - Android (ARM, ARM64)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2026 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.
|
||||||
@ -69,7 +69,7 @@ endif
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= raylib_examples
|
PROJECT_NAME ?= raylib_examples
|
||||||
RAYLIB_VERSION ?= 5.5.0
|
RAYLIB_VERSION ?= 6.0.0
|
||||||
RAYLIB_PATH ?= ..
|
RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
# Define raylib source code path
|
# Define raylib source code path
|
||||||
@ -168,8 +168,8 @@ ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_R
|
|||||||
EMSDK_PATH ?= C:/raylib/emsdk
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||||
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||||
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-nuget_64bit
|
PYTHON_PATH = $(EMSDK_PATH)/python/3.13.3_64bit
|
||||||
NODE_PATH = $(EMSDK_PATH)/node/20.18.0_64bit/bin
|
NODE_PATH = $(EMSDK_PATH)/node/22.16.0_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -208,12 +208,12 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
|||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
else
|
else
|
||||||
EMMAKE != type emmake
|
EMMAKE := $(shell command -v emmake)
|
||||||
ifneq (, $(EMMAKE))
|
ifneq (, $(EMMAKE))
|
||||||
MAKE = emmake make
|
MAKE = $(EMMAKE) make
|
||||||
else
|
else
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
endif
|
endif
|
||||||
@ -512,10 +512,16 @@ CORE = \
|
|||||||
core/core_automation_events \
|
core/core_automation_events \
|
||||||
core/core_basic_screen_manager \
|
core/core_basic_screen_manager \
|
||||||
core/core_basic_window \
|
core/core_basic_window \
|
||||||
|
core/core_clipboard_text \
|
||||||
|
core/core_compute_hash \
|
||||||
core/core_custom_frame_control \
|
core/core_custom_frame_control \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
|
core/core_delta_time \
|
||||||
|
core/core_directory_files \
|
||||||
core/core_drop_files \
|
core/core_drop_files \
|
||||||
core/core_high_dpi \
|
core/core_highdpi_demo \
|
||||||
|
core/core_highdpi_testbed \
|
||||||
|
core/core_input_actions \
|
||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
core/core_input_gestures_testbed \
|
core/core_input_gestures_testbed \
|
||||||
@ -524,45 +530,75 @@ CORE = \
|
|||||||
core/core_input_mouse_wheel \
|
core/core_input_mouse_wheel \
|
||||||
core/core_input_multitouch \
|
core/core_input_multitouch \
|
||||||
core/core_input_virtual_controls \
|
core/core_input_virtual_controls \
|
||||||
|
core/core_keyboard_testbed \
|
||||||
|
core/core_monitor_detector \
|
||||||
core/core_random_sequence \
|
core/core_random_sequence \
|
||||||
core/core_random_values \
|
core/core_random_values \
|
||||||
core/core_render_texture \
|
core/core_render_texture \
|
||||||
core/core_scissor_test \
|
core/core_scissor_test \
|
||||||
|
core/core_screen_recording \
|
||||||
core/core_smooth_pixelperfect \
|
core/core_smooth_pixelperfect \
|
||||||
core/core_storage_values \
|
core/core_storage_values \
|
||||||
|
core/core_text_file_loading \
|
||||||
|
core/core_undo_redo \
|
||||||
|
core/core_viewport_scaling \
|
||||||
core/core_vr_simulator \
|
core/core_vr_simulator \
|
||||||
core/core_window_flags \
|
core/core_window_flags \
|
||||||
core/core_window_letterbox \
|
core/core_window_letterbox \
|
||||||
core/core_window_should_close \
|
core/core_window_should_close \
|
||||||
|
core/core_window_web \
|
||||||
core/core_world_screen
|
core/core_world_screen
|
||||||
|
|
||||||
SHAPES = \
|
SHAPES = \
|
||||||
|
shapes/shapes_ball_physics \
|
||||||
shapes/shapes_basic_shapes \
|
shapes/shapes_basic_shapes \
|
||||||
shapes/shapes_bouncing_ball \
|
shapes/shapes_bouncing_ball \
|
||||||
|
shapes/shapes_bullet_hell \
|
||||||
shapes/shapes_circle_sector_drawing \
|
shapes/shapes_circle_sector_drawing \
|
||||||
|
shapes/shapes_clock_of_clocks \
|
||||||
shapes/shapes_collision_area \
|
shapes/shapes_collision_area \
|
||||||
shapes/shapes_colors_palette \
|
shapes/shapes_colors_palette \
|
||||||
|
shapes/shapes_dashed_line \
|
||||||
shapes/shapes_digital_clock \
|
shapes/shapes_digital_clock \
|
||||||
shapes/shapes_double_pendulum \
|
shapes/shapes_double_pendulum \
|
||||||
shapes/shapes_easings_ball \
|
shapes/shapes_easings_ball \
|
||||||
shapes/shapes_easings_box \
|
shapes/shapes_easings_box \
|
||||||
shapes/shapes_easings_rectangles \
|
shapes/shapes_easings_rectangles \
|
||||||
|
shapes/shapes_easings_testbed \
|
||||||
shapes/shapes_following_eyes \
|
shapes/shapes_following_eyes \
|
||||||
|
shapes/shapes_hilbert_curve \
|
||||||
|
shapes/shapes_kaleidoscope \
|
||||||
shapes/shapes_lines_bezier \
|
shapes/shapes_lines_bezier \
|
||||||
|
shapes/shapes_lines_drawing \
|
||||||
shapes/shapes_logo_raylib \
|
shapes/shapes_logo_raylib \
|
||||||
shapes/shapes_logo_raylib_anim \
|
shapes/shapes_logo_raylib_anim \
|
||||||
|
shapes/shapes_math_angle_rotation \
|
||||||
|
shapes/shapes_math_sine_cosine \
|
||||||
|
shapes/shapes_mouse_trail \
|
||||||
|
shapes/shapes_penrose_tile \
|
||||||
|
shapes/shapes_pie_chart \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
|
shapes/shapes_recursive_tree \
|
||||||
shapes/shapes_ring_drawing \
|
shapes/shapes_ring_drawing \
|
||||||
|
shapes/shapes_rlgl_color_wheel \
|
||||||
|
shapes/shapes_rlgl_triangle \
|
||||||
shapes/shapes_rounded_rectangle_drawing \
|
shapes/shapes_rounded_rectangle_drawing \
|
||||||
|
shapes/shapes_simple_particles \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_starfield_effect \
|
||||||
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_triangle_strip \
|
||||||
|
shapes/shapes_vector_angle
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
textures/textures_blend_modes \
|
textures/textures_blend_modes \
|
||||||
textures/textures_bunnymark \
|
textures/textures_bunnymark \
|
||||||
|
textures/textures_cellular_automata \
|
||||||
|
textures/textures_clipboard_image \
|
||||||
textures/textures_fog_of_war \
|
textures/textures_fog_of_war \
|
||||||
|
textures/textures_framebuffer_rendering \
|
||||||
textures/textures_gif_player \
|
textures/textures_gif_player \
|
||||||
textures/textures_image_channel \
|
textures/textures_image_channel \
|
||||||
textures/textures_image_drawing \
|
textures/textures_image_drawing \
|
||||||
@ -573,14 +609,17 @@ TEXTURES = \
|
|||||||
textures/textures_image_rotate \
|
textures/textures_image_rotate \
|
||||||
textures/textures_image_text \
|
textures/textures_image_text \
|
||||||
textures/textures_logo_raylib \
|
textures/textures_logo_raylib \
|
||||||
|
textures/textures_magnifying_glass \
|
||||||
textures/textures_mouse_painting \
|
textures/textures_mouse_painting \
|
||||||
textures/textures_npatch_drawing \
|
textures/textures_npatch_drawing \
|
||||||
textures/textures_particles_blending \
|
textures/textures_particles_blending \
|
||||||
textures/textures_polygon_drawing \
|
textures/textures_polygon_drawing \
|
||||||
textures/textures_raw_data \
|
textures/textures_raw_data \
|
||||||
|
textures/textures_screen_buffer \
|
||||||
textures/textures_sprite_animation \
|
textures/textures_sprite_animation \
|
||||||
textures/textures_sprite_button \
|
textures/textures_sprite_button \
|
||||||
textures/textures_sprite_explosion \
|
textures/textures_sprite_explosion \
|
||||||
|
textures/textures_sprite_stacking \
|
||||||
textures/textures_srcrec_dstrec \
|
textures/textures_srcrec_dstrec \
|
||||||
textures/textures_textured_curve \
|
textures/textures_textured_curve \
|
||||||
textures/textures_tiled_drawing \
|
textures/textures_tiled_drawing \
|
||||||
@ -598,22 +637,30 @@ TEXT = \
|
|||||||
text/text_input_box \
|
text/text_input_box \
|
||||||
text/text_rectangle_bounds \
|
text/text_rectangle_bounds \
|
||||||
text/text_sprite_fonts \
|
text/text_sprite_fonts \
|
||||||
|
text/text_strings_management \
|
||||||
text/text_unicode_emojis \
|
text/text_unicode_emojis \
|
||||||
text/text_unicode_ranges \
|
text/text_unicode_ranges \
|
||||||
|
text/text_words_alignment \
|
||||||
text/text_writing_anim
|
text/text_writing_anim
|
||||||
|
|
||||||
MODELS = \
|
MODELS = \
|
||||||
models/models_animation_playing \
|
models/models_animation_blend_custom \
|
||||||
|
models/models_animation_blending \
|
||||||
|
models/models_animation_gpu_skinning \
|
||||||
|
models/models_animation_timing \
|
||||||
|
models/models_basic_voxel \
|
||||||
models/models_billboard_rendering \
|
models/models_billboard_rendering \
|
||||||
models/models_bone_socket \
|
models/models_bone_socket \
|
||||||
models/models_box_collisions \
|
models/models_box_collisions \
|
||||||
models/models_cubicmap_rendering \
|
models/models_cubicmap_rendering \
|
||||||
|
models/models_decals \
|
||||||
|
models/models_directional_billboard \
|
||||||
models/models_first_person_maze \
|
models/models_first_person_maze \
|
||||||
models/models_geometric_shapes \
|
models/models_geometric_shapes \
|
||||||
models/models_gpu_skinning \
|
|
||||||
models/models_heightmap_rendering \
|
models/models_heightmap_rendering \
|
||||||
models/models_loading \
|
models/models_loading \
|
||||||
models/models_loading_gltf \
|
models/models_loading_gltf \
|
||||||
|
models/models_loading_iqm \
|
||||||
models/models_loading_m3d \
|
models/models_loading_m3d \
|
||||||
models/models_loading_vox \
|
models/models_loading_vox \
|
||||||
models/models_mesh_generation \
|
models/models_mesh_generation \
|
||||||
@ -621,6 +668,7 @@ MODELS = \
|
|||||||
models/models_orthographic_projection \
|
models/models_orthographic_projection \
|
||||||
models/models_point_rendering \
|
models/models_point_rendering \
|
||||||
models/models_rlgl_solar_system \
|
models/models_rlgl_solar_system \
|
||||||
|
models/models_rotating_cube \
|
||||||
models/models_skybox_rendering \
|
models/models_skybox_rendering \
|
||||||
models/models_tesseract_view \
|
models/models_tesseract_view \
|
||||||
models/models_textured_cube \
|
models/models_textured_cube \
|
||||||
@ -628,18 +676,23 @@ MODELS = \
|
|||||||
models/models_yaw_pitch_roll
|
models/models_yaw_pitch_roll
|
||||||
|
|
||||||
SHADERS = \
|
SHADERS = \
|
||||||
|
shaders/shaders_ascii_rendering \
|
||||||
shaders/shaders_basic_lighting \
|
shaders/shaders_basic_lighting \
|
||||||
shaders/shaders_basic_pbr \
|
shaders/shaders_basic_pbr \
|
||||||
|
shaders/shaders_cel_shading \
|
||||||
|
shaders/shaders_color_correction \
|
||||||
shaders/shaders_custom_uniform \
|
shaders/shaders_custom_uniform \
|
||||||
shaders/shaders_deferred_rendering \
|
shaders/shaders_deferred_rendering \
|
||||||
shaders/shaders_depth_rendering \
|
shaders/shaders_depth_rendering \
|
||||||
shaders/shaders_depth_writing \
|
shaders/shaders_depth_writing \
|
||||||
shaders/shaders_eratosthenes_sieve \
|
shaders/shaders_eratosthenes_sieve \
|
||||||
shaders/shaders_fog_rendering \
|
shaders/shaders_fog_rendering \
|
||||||
|
shaders/shaders_game_of_life \
|
||||||
shaders/shaders_hot_reloading \
|
shaders/shaders_hot_reloading \
|
||||||
shaders/shaders_hybrid_rendering \
|
shaders/shaders_hybrid_rendering \
|
||||||
shaders/shaders_julia_set \
|
shaders/shaders_julia_set \
|
||||||
shaders/shaders_lightmap_rendering \
|
shaders/shaders_lightmap_rendering \
|
||||||
|
shaders/shaders_mandelbrot_set \
|
||||||
shaders/shaders_mesh_instancing \
|
shaders/shaders_mesh_instancing \
|
||||||
shaders/shaders_model_shader \
|
shaders/shaders_model_shader \
|
||||||
shaders/shaders_multi_sample2d \
|
shaders/shaders_multi_sample2d \
|
||||||
@ -647,6 +700,7 @@ SHADERS = \
|
|||||||
shaders/shaders_palette_switch \
|
shaders/shaders_palette_switch \
|
||||||
shaders/shaders_postprocessing \
|
shaders/shaders_postprocessing \
|
||||||
shaders/shaders_raymarching_rendering \
|
shaders/shaders_raymarching_rendering \
|
||||||
|
shaders/shaders_rlgl_compute \
|
||||||
shaders/shaders_rounded_rectangle \
|
shaders/shaders_rounded_rectangle \
|
||||||
shaders/shaders_shadowmap_rendering \
|
shaders/shaders_shadowmap_rendering \
|
||||||
shaders/shaders_shapes_textures \
|
shaders/shaders_shapes_textures \
|
||||||
@ -666,6 +720,8 @@ AUDIO = \
|
|||||||
audio/audio_sound_loading \
|
audio/audio_sound_loading \
|
||||||
audio/audio_sound_multi \
|
audio/audio_sound_multi \
|
||||||
audio/audio_sound_positioning \
|
audio/audio_sound_positioning \
|
||||||
|
audio/audio_spectrum_visualizer \
|
||||||
|
audio/audio_stream_callback \
|
||||||
audio/audio_stream_effects
|
audio/audio_stream_effects
|
||||||
|
|
||||||
# Default target entry
|
# Default target entry
|
||||||
@ -719,16 +775,34 @@ core/core_basic_screen_manager: core/core_basic_screen_manager.c
|
|||||||
core/core_basic_window: core/core_basic_window.c
|
core/core_basic_window: core/core_basic_window.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_clipboard_text: core/core_clipboard_text.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_compute_hash: core/core_compute_hash.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_custom_frame_control: core/core_custom_frame_control.c
|
core/core_custom_frame_control: core/core_custom_frame_control.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_custom_logging: core/core_custom_logging.c
|
core/core_custom_logging: core/core_custom_logging.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_delta_time: core/core_delta_time.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_directory_files: core/core_directory_files.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_drop_files: core/core_drop_files.c
|
core/core_drop_files: core/core_drop_files.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_high_dpi: core/core_high_dpi.c
|
core/core_highdpi_demo: core/core_highdpi_demo.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_highdpi_testbed: core/core_highdpi_testbed.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_input_actions: core/core_input_actions.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_input_gamepad: core/core_input_gamepad.c
|
core/core_input_gamepad: core/core_input_gamepad.c
|
||||||
@ -757,6 +831,12 @@ core/core_input_multitouch: core/core_input_multitouch.c
|
|||||||
core/core_input_virtual_controls: core/core_input_virtual_controls.c
|
core/core_input_virtual_controls: core/core_input_virtual_controls.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_keyboard_testbed: core/core_keyboard_testbed.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_monitor_detector: core/core_monitor_detector.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_random_sequence: core/core_random_sequence.c
|
core/core_random_sequence: core/core_random_sequence.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
@ -769,12 +849,25 @@ core/core_render_texture: core/core_render_texture.c
|
|||||||
core/core_scissor_test: core/core_scissor_test.c
|
core/core_scissor_test: core/core_scissor_test.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_screen_recording: core/core_screen_recording.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_smooth_pixelperfect: core/core_smooth_pixelperfect.c
|
core/core_smooth_pixelperfect: core/core_smooth_pixelperfect.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_storage_values: core/core_storage_values.c
|
core/core_storage_values: core/core_storage_values.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_text_file_loading: core/core_text_file_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file core/resources/text_file.txt@resources/text_file.txt
|
||||||
|
|
||||||
|
core/core_undo_redo: core/core_undo_redo.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_viewport_scaling: core/core_viewport_scaling.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_vr_simulator: core/core_vr_simulator.c
|
core/core_vr_simulator: core/core_vr_simulator.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file core/resources/shaders/glsl100/distortion.fs@resources/shaders/glsl100/distortion.fs
|
--preload-file core/resources/shaders/glsl100/distortion.fs@resources/shaders/glsl100/distortion.fs
|
||||||
@ -788,25 +881,40 @@ core/core_window_letterbox: core/core_window_letterbox.c
|
|||||||
core/core_window_should_close: core/core_window_should_close.c
|
core/core_window_should_close: core/core_window_should_close.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_window_web: core/core_window_web.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_world_screen: core/core_world_screen.c
|
core/core_world_screen: core/core_world_screen.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
# Compile SHAPES examples
|
# Compile SHAPES examples
|
||||||
|
shapes/shapes_ball_physics: shapes/shapes_ball_physics.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
|
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_bouncing_ball: shapes/shapes_bouncing_ball.c
|
shapes/shapes_bouncing_ball: shapes/shapes_bouncing_ball.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_bullet_hell: shapes/shapes_bullet_hell.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_circle_sector_drawing: shapes/shapes_circle_sector_drawing.c
|
shapes/shapes_circle_sector_drawing: shapes/shapes_circle_sector_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_clock_of_clocks: shapes/shapes_clock_of_clocks.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_collision_area: shapes/shapes_collision_area.c
|
shapes/shapes_collision_area: shapes/shapes_collision_area.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
|
shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_dashed_line: shapes/shapes_dashed_line.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_digital_clock: shapes/shapes_digital_clock.c
|
shapes/shapes_digital_clock: shapes/shapes_digital_clock.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
@ -822,36 +930,84 @@ shapes/shapes_easings_box: shapes/shapes_easings_box.c
|
|||||||
shapes/shapes_easings_rectangles: shapes/shapes_easings_rectangles.c
|
shapes/shapes_easings_rectangles: shapes/shapes_easings_rectangles.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_easings_testbed: shapes/shapes_easings_testbed.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_following_eyes: shapes/shapes_following_eyes.c
|
shapes/shapes_following_eyes: shapes/shapes_following_eyes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_hilbert_curve: shapes/shapes_hilbert_curve.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_kaleidoscope: shapes/shapes_kaleidoscope.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
|
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_lines_drawing: shapes/shapes_lines_drawing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
|
shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c
|
shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_math_angle_rotation: shapes/shapes_math_angle_rotation.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_math_sine_cosine: shapes/shapes_math_sine_cosine.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_mouse_trail: shapes/shapes_mouse_trail.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_penrose_tile: shapes/shapes_penrose_tile.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_pie_chart: shapes/shapes_pie_chart.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_rectangle_advanced: shapes/shapes_rectangle_advanced.c
|
shapes/shapes_rectangle_advanced: shapes/shapes_rectangle_advanced.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_rectangle_scaling: shapes/shapes_rectangle_scaling.c
|
shapes/shapes_rectangle_scaling: shapes/shapes_rectangle_scaling.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_recursive_tree: shapes/shapes_recursive_tree.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_ring_drawing: shapes/shapes_ring_drawing.c
|
shapes/shapes_ring_drawing: shapes/shapes_ring_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_rlgl_color_wheel: shapes/shapes_rlgl_color_wheel.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_rlgl_triangle: shapes/shapes_rlgl_triangle.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_rounded_rectangle_drawing: shapes/shapes_rounded_rectangle_drawing.c
|
shapes/shapes_rounded_rectangle_drawing: shapes/shapes_rounded_rectangle_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_simple_particles: shapes/shapes_simple_particles.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_splines_drawing: shapes/shapes_splines_drawing.c
|
shapes/shapes_splines_drawing: shapes/shapes_splines_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_starfield_effect: shapes/shapes_starfield_effect.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_top_down_lights: shapes/shapes_top_down_lights.c
|
shapes/shapes_top_down_lights: shapes/shapes_top_down_lights.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_triangle_strip: shapes/shapes_triangle_strip.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_vector_angle: shapes/shapes_vector_angle.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
# Compile TEXTURES examples
|
# Compile TEXTURES examples
|
||||||
textures/textures_background_scrolling: textures/textures_background_scrolling.c
|
textures/textures_background_scrolling: textures/textures_background_scrolling.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
@ -866,11 +1022,20 @@ textures/textures_blend_modes: textures/textures_blend_modes.c
|
|||||||
|
|
||||||
textures/textures_bunnymark: textures/textures_bunnymark.c
|
textures/textures_bunnymark: textures/textures_bunnymark.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/wabbit_alpha.png@resources/wabbit_alpha.png
|
--preload-file textures/resources/raybunny.png@resources/raybunny.png
|
||||||
|
|
||||||
|
textures/textures_cellular_automata: textures/textures_cellular_automata.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
textures/textures_clipboard_image: textures/textures_clipboard_image.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
textures/textures_fog_of_war: textures/textures_fog_of_war.c
|
textures/textures_fog_of_war: textures/textures_fog_of_war.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
textures/textures_framebuffer_rendering: textures/textures_framebuffer_rendering.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
textures/textures_gif_player: textures/textures_gif_player.c
|
textures/textures_gif_player: textures/textures_gif_player.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/scarfy_run.gif@resources/scarfy_run.gif
|
--preload-file textures/resources/scarfy_run.gif@resources/scarfy_run.gif
|
||||||
@ -913,6 +1078,11 @@ textures/textures_logo_raylib: textures/textures_logo_raylib.c
|
|||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
|
--preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
|
||||||
|
|
||||||
|
textures/textures_magnifying_glass: textures/textures_magnifying_glass.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file textures/resources/raybunny.png@resources/raybunny.png \
|
||||||
|
--preload-file textures/resources/parrots.png@resources/parrots.png
|
||||||
|
|
||||||
textures/textures_mouse_painting: textures/textures_mouse_painting.c
|
textures/textures_mouse_painting: textures/textures_mouse_painting.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
@ -932,6 +1102,9 @@ textures/textures_raw_data: textures/textures_raw_data.c
|
|||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/fudesumi.raw@resources/fudesumi.raw
|
--preload-file textures/resources/fudesumi.raw@resources/fudesumi.raw
|
||||||
|
|
||||||
|
textures/textures_screen_buffer: textures/textures_screen_buffer.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
textures/textures_sprite_animation: textures/textures_sprite_animation.c
|
textures/textures_sprite_animation: textures/textures_sprite_animation.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/scarfy.png@resources/scarfy.png
|
--preload-file textures/resources/scarfy.png@resources/scarfy.png
|
||||||
@ -946,6 +1119,10 @@ textures/textures_sprite_explosion: textures/textures_sprite_explosion.c
|
|||||||
--preload-file textures/resources/boom.wav@resources/boom.wav \
|
--preload-file textures/resources/boom.wav@resources/boom.wav \
|
||||||
--preload-file textures/resources/explosion.png@resources/explosion.png
|
--preload-file textures/resources/explosion.png@resources/explosion.png
|
||||||
|
|
||||||
|
textures/textures_sprite_stacking: textures/textures_sprite_stacking.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file textures/resources/booth.png@resources/booth.png
|
||||||
|
|
||||||
textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
|
textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file textures/resources/scarfy.png@resources/scarfy.png
|
--preload-file textures/resources/scarfy.png@resources/scarfy.png
|
||||||
@ -976,7 +1153,10 @@ text/text_font_filters: text/text_font_filters.c
|
|||||||
--preload-file text/resources/KAISG.ttf@resources/KAISG.ttf
|
--preload-file text/resources/KAISG.ttf@resources/KAISG.ttf
|
||||||
|
|
||||||
text/text_font_loading: text/text_font_loading.c
|
text/text_font_loading: text/text_font_loading.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file text/resources/pixantiqua.fnt@resources/pixantiqua.fnt \
|
||||||
|
--preload-file text/resources/pixantiqua.png@resources/pixantiqua.png \
|
||||||
|
--preload-file text/resources/pixantiqua.ttf@resources/pixantiqua.ttf
|
||||||
|
|
||||||
text/text_font_sdf: text/text_font_sdf.c
|
text/text_font_sdf: text/text_font_sdf.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
@ -1012,25 +1192,53 @@ text/text_sprite_fonts: text/text_sprite_fonts.c
|
|||||||
--preload-file text/resources/sprite_fonts/alpha_beta.png@resources/sprite_fonts/alpha_beta.png \
|
--preload-file text/resources/sprite_fonts/alpha_beta.png@resources/sprite_fonts/alpha_beta.png \
|
||||||
--preload-file text/resources/sprite_fonts/jupiter_crash.png@resources/sprite_fonts/jupiter_crash.png
|
--preload-file text/resources/sprite_fonts/jupiter_crash.png@resources/sprite_fonts/jupiter_crash.png
|
||||||
|
|
||||||
|
text/text_strings_management: text/text_strings_management.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
text/text_unicode_emojis: text/text_unicode_emojis.c
|
text/text_unicode_emojis: text/text_unicode_emojis.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file text/resources/dejavu.fnt@resources/dejavu.fnt \
|
--preload-file text/resources/dejavu.fnt@resources/dejavu.fnt \
|
||||||
|
--preload-file text/resources/dejavu.png@resources/dejavu.png \
|
||||||
--preload-file text/resources/noto_cjk.fnt@resources/noto_cjk.fnt \
|
--preload-file text/resources/noto_cjk.fnt@resources/noto_cjk.fnt \
|
||||||
--preload-file text/resources/symbola.fnt@resources/symbola.fnt
|
--preload-file text/resources/noto_cjk.png@resources/noto_cjk.png \
|
||||||
|
--preload-file text/resources/symbola.fnt@resources/symbola.fnt \
|
||||||
|
--preload-file text/resources/symbola.png@resources/symbola.png
|
||||||
|
|
||||||
text/text_unicode_ranges: text/text_unicode_ranges.c
|
text/text_unicode_ranges: text/text_unicode_ranges.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file text/resources/NotoSansTC-Regular.ttf@resources/NotoSansTC-Regular.ttf
|
--preload-file text/resources/NotoSansTC-Regular.ttf@resources/NotoSansTC-Regular.ttf
|
||||||
|
|
||||||
|
text/text_words_alignment: text/text_words_alignment.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
text/text_writing_anim: text/text_writing_anim.c
|
text/text_writing_anim: text/text_writing_anim.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
# Compile MODELS examples
|
# Compile MODELS examples
|
||||||
models/models_animation_playing: models/models_animation_playing.c
|
models/models_animation_blend_custom: models/models_animation_blend_custom.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/models/iqm/guy.iqm@resources/models/iqm/guy.iqm \
|
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
|
||||||
--preload-file models/resources/models/iqm/guytex.png@resources/models/iqm/guytex.png \
|
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
||||||
--preload-file models/resources/models/iqm/guyanim.iqm@resources/models/iqm/guyanim.iqm
|
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
||||||
|
|
||||||
|
models/models_animation_blending: models/models_animation_blending.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb \
|
||||||
|
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
||||||
|
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
||||||
|
|
||||||
|
models/models_animation_gpu_skinning: models/models_animation_gpu_skinning.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
|
||||||
|
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
||||||
|
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
||||||
|
|
||||||
|
models/models_animation_timing: models/models_animation_timing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb
|
||||||
|
|
||||||
|
models/models_basic_voxel: models/models_basic_voxel.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
models/models_billboard_rendering: models/models_billboard_rendering.c
|
models/models_billboard_rendering: models/models_billboard_rendering.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
@ -1051,6 +1259,16 @@ models/models_cubicmap_rendering: models/models_cubicmap_rendering.c
|
|||||||
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
|
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
|
||||||
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
|
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
|
||||||
|
|
||||||
|
models/models_decals: models/models_decals.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/models/obj/character.obj@resources/models/obj/character.obj \
|
||||||
|
--preload-file models/resources/models/obj/character_diffuse.png@resources/models/obj/character_diffuse.png \
|
||||||
|
--preload-file models/resources/raylib_logo.png@resources/raylib_logo.png
|
||||||
|
|
||||||
|
models/models_directional_billboard: models/models_directional_billboard.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/skillbot.png@resources/skillbot.png
|
||||||
|
|
||||||
models/models_first_person_maze: models/models_first_person_maze.c
|
models/models_first_person_maze: models/models_first_person_maze.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
|
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
|
||||||
@ -1059,12 +1277,6 @@ models/models_first_person_maze: models/models_first_person_maze.c
|
|||||||
models/models_geometric_shapes: models/models_geometric_shapes.c
|
models/models_geometric_shapes: models/models_geometric_shapes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
models/models_gpu_skinning: models/models_gpu_skinning.c
|
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
|
||||||
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
|
|
||||||
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
|
||||||
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
|
||||||
|
|
||||||
models/models_heightmap_rendering: models/models_heightmap_rendering.c
|
models/models_heightmap_rendering: models/models_heightmap_rendering.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/heightmap.png@resources/heightmap.png
|
--preload-file models/resources/heightmap.png@resources/heightmap.png
|
||||||
@ -1078,6 +1290,12 @@ models/models_loading_gltf: models/models_loading_gltf.c
|
|||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb
|
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb
|
||||||
|
|
||||||
|
models/models_loading_iqm: models/models_loading_iqm.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/models/iqm/guy.iqm@resources/models/iqm/guy.iqm \
|
||||||
|
--preload-file models/resources/models/iqm/guytex.png@resources/models/iqm/guytex.png \
|
||||||
|
--preload-file models/resources/models/iqm/guyanim.iqm@resources/models/iqm/guyanim.iqm
|
||||||
|
|
||||||
models/models_loading_m3d: models/models_loading_m3d.c
|
models/models_loading_m3d: models/models_loading_m3d.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/models/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
|
--preload-file models/resources/models/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
|
||||||
@ -1108,6 +1326,10 @@ models/models_point_rendering: models/models_point_rendering.c
|
|||||||
models/models_rlgl_solar_system: models/models_rlgl_solar_system.c
|
models/models_rlgl_solar_system: models/models_rlgl_solar_system.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
models/models_rotating_cube: models/models_rotating_cube.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
|
||||||
|
|
||||||
models/models_skybox_rendering: models/models_skybox_rendering.c
|
models/models_skybox_rendering: models/models_skybox_rendering.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/shaders/glsl100/skybox.vs@resources/shaders/glsl100/skybox.vs \
|
--preload-file models/resources/shaders/glsl100/skybox.vs@resources/shaders/glsl100/skybox.vs \
|
||||||
@ -1133,6 +1355,12 @@ models/models_yaw_pitch_roll: models/models_yaw_pitch_roll.c
|
|||||||
--preload-file models/resources/models/obj/plane_diffuse.png@resources/models/obj/plane_diffuse.png
|
--preload-file models/resources/models/obj/plane_diffuse.png@resources/models/obj/plane_diffuse.png
|
||||||
|
|
||||||
# Compile SHADERS examples
|
# Compile SHADERS examples
|
||||||
|
shaders/shaders_ascii_rendering: shaders/shaders_ascii_rendering.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file shaders/resources/fudesumi.png@resources/fudesumi.png \
|
||||||
|
--preload-file shaders/resources/raysan.png@resources/raysan.png \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/ascii.fs@resources/shaders/glsl100/ascii.fs
|
||||||
|
|
||||||
shaders/shaders_basic_lighting: shaders/shaders_basic_lighting.c
|
shaders/shaders_basic_lighting: shaders/shaders_basic_lighting.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs \
|
--preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs \
|
||||||
@ -1152,6 +1380,22 @@ shaders/shaders_basic_pbr: shaders/shaders_basic_pbr.c
|
|||||||
--preload-file shaders/resources/road_mra.png@resources/road_mra.png \
|
--preload-file shaders/resources/road_mra.png@resources/road_mra.png \
|
||||||
--preload-file shaders/resources/road_n.png@resources/road_n.png
|
--preload-file shaders/resources/road_n.png@resources/road_n.png
|
||||||
|
|
||||||
|
shaders/shaders_cel_shading: shaders/shaders_cel_shading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file shaders/resources/models/old_car_new.glb@resources/models/old_car_new.glb \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/cel.vs@resources/shaders/glsl100/cel.vs \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/cel.fs@resources/shaders/glsl100/cel.fs \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/outline_hull.vs@resources/shaders/glsl100/outline_hull.vs \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/outline_hull.fs@resources/shaders/glsl100/outline_hull.fs
|
||||||
|
|
||||||
|
shaders/shaders_color_correction: shaders/shaders_color_correction.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file shaders/resources/parrots.png@resources/parrots.png \
|
||||||
|
--preload-file shaders/resources/cat.png@resources/cat.png \
|
||||||
|
--preload-file shaders/resources/mandrill.png@resources/mandrill.png \
|
||||||
|
--preload-file shaders/resources/fudesumi.png@resources/fudesumi.png \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/color_correction.fs@resources/shaders/glsl100/color_correction.fs
|
||||||
|
|
||||||
shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
|
shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/models/barracks.obj@resources/models/barracks.obj \
|
--preload-file shaders/resources/models/barracks.obj@resources/models/barracks.obj \
|
||||||
@ -1183,6 +1427,19 @@ shaders/shaders_fog_rendering: shaders/shaders_fog_rendering.c
|
|||||||
--preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs \
|
--preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs \
|
||||||
--preload-file shaders/resources/shaders/glsl100/fog.fs@resources/shaders/glsl100/fog.fs
|
--preload-file shaders/resources/shaders/glsl100/fog.fs@resources/shaders/glsl100/fog.fs
|
||||||
|
|
||||||
|
shaders/shaders_game_of_life: shaders/shaders_game_of_life.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/game_of_life.fs@resources/shaders/glsl100/game_of_life.fs \
|
||||||
|
--preload-file shaders/resources/game_of_life/r_pentomino.png@resources/game_of_life/r_pentomino.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/glider.png@resources/game_of_life/glider.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/acorn.png@resources/game_of_life/acorn.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/spaceships.png@resources/game_of_life/spaceships.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/still_lifes.png@resources/game_of_life/still_lifes.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/oscillators.png@resources/game_of_life/oscillators.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/puffer_train.png@resources/game_of_life/puffer_train.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/glider_gun.png@resources/game_of_life/glider_gun.png \
|
||||||
|
--preload-file shaders/resources/game_of_life/breeder.png@resources/game_of_life/breeder.png
|
||||||
|
|
||||||
shaders/shaders_hot_reloading: shaders/shaders_hot_reloading.c
|
shaders/shaders_hot_reloading: shaders/shaders_hot_reloading.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/shaders/glsl100/reload.fs@resources/shaders/glsl100/reload.fs
|
--preload-file shaders/resources/shaders/glsl100/reload.fs@resources/shaders/glsl100/reload.fs
|
||||||
@ -1203,6 +1460,10 @@ shaders/shaders_lightmap_rendering: shaders/shaders_lightmap_rendering.c
|
|||||||
--preload-file shaders/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png \
|
--preload-file shaders/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png \
|
||||||
--preload-file shaders/resources/spark_flame.png@resources/spark_flame.png
|
--preload-file shaders/resources/spark_flame.png@resources/spark_flame.png
|
||||||
|
|
||||||
|
shaders/shaders_mandelbrot_set: shaders/shaders_mandelbrot_set.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file shaders/resources/shaders/glsl100/mandelbrot_set.fs@resources/shaders/glsl100/mandelbrot_set.fs
|
||||||
|
|
||||||
shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c
|
shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/shaders/glsl100/lighting_instancing.vs@resources/shaders/glsl100/lighting_instancing.vs \
|
--preload-file shaders/resources/shaders/glsl100/lighting_instancing.vs@resources/shaders/glsl100/lighting_instancing.vs \
|
||||||
@ -1251,6 +1512,9 @@ shaders/shaders_raymarching_rendering: shaders/shaders_raymarching_rendering.c
|
|||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/shaders/glsl100/raymarching.fs@resources/shaders/glsl100/raymarching.fs
|
--preload-file shaders/resources/shaders/glsl100/raymarching.fs@resources/shaders/glsl100/raymarching.fs
|
||||||
|
|
||||||
|
shaders/shaders_rlgl_compute: shaders/shaders_rlgl_compute.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shaders/shaders_rounded_rectangle: shaders/shaders_rounded_rectangle.c
|
shaders/shaders_rounded_rectangle: shaders/shaders_rounded_rectangle.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
|
--preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
|
||||||
@ -1309,7 +1573,8 @@ audio/audio_mixed_processor: audio/audio_mixed_processor.c
|
|||||||
--preload-file audio/resources/coin.wav@resources/coin.wav
|
--preload-file audio/resources/coin.wav@resources/coin.wav
|
||||||
|
|
||||||
audio/audio_module_playing: audio/audio_module_playing.c
|
audio/audio_module_playing: audio/audio_module_playing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file audio/resources/mini1111.xm@resources/mini1111.xm
|
||||||
|
|
||||||
audio/audio_music_stream: audio/audio_music_stream.c
|
audio/audio_music_stream: audio/audio_music_stream.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
@ -1331,6 +1596,14 @@ audio/audio_sound_positioning: audio/audio_sound_positioning.c
|
|||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file audio/resources/coin.wav@resources/coin.wav
|
--preload-file audio/resources/coin.wav@resources/coin.wav
|
||||||
|
|
||||||
|
audio/audio_spectrum_visualizer: audio/audio_spectrum_visualizer.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file audio/resources/shaders/glsl100/fft.fs@resources/shaders/glsl100/fft.fs \
|
||||||
|
--preload-file audio/resources/country.mp3@resources/country.mp3
|
||||||
|
|
||||||
|
audio/audio_stream_callback: audio/audio_stream_callback.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
audio/audio_stream_effects: audio/audio_stream_effects.c
|
audio/audio_stream_effects: audio/audio_stream_effects.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file audio/resources/country.mp3@resources/country.mp3
|
--preload-file audio/resources/country.mp3@resources/country.mp3
|
||||||
|
|||||||
@ -17,22 +17,23 @@ You may find it easier to use than other toolchains, especially when it comes to
|
|||||||
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
||||||
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
||||||
|
|
||||||
## EXAMPLES COLLECTION [TOTAL: 162]
|
## EXAMPLES COLLECTION [TOTAL: 212]
|
||||||
|
|
||||||
### category: core [36]
|
### category: core [49]
|
||||||
|
|
||||||
Examples using raylib[core](../src/rcore.c) platform functionality like window creation, inputs, drawing modes and system functionality.
|
Examples using raylib [core](../src/rcore.c) module platform functionality: window creation, inputs, drawing modes and system functionality.
|
||||||
|
|
||||||
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| [core_basic_window](core/core_basic_window.c) | <img src="core/core_basic_window.png" alt="core_basic_window" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_basic_window](core/core_basic_window.c) | <img src="core/core_basic_window.png" alt="core_basic_window" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_delta_time](core/core_delta_time.c) | <img src="core/core_delta_time.png" alt="core_delta_time" width="80"> | ⭐☆☆☆ | 5.5 | 6.0 | [Robin](https://github.com/RobinsAviary) |
|
||||||
| [core_input_keys](core/core_input_keys.c) | <img src="core/core_input_keys.png" alt="core_input_keys" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_input_keys](core/core_input_keys.c) | <img src="core/core_input_keys.png" alt="core_input_keys" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_input_mouse](core/core_input_mouse.c) | <img src="core/core_input_mouse.png" alt="core_input_mouse" width="80"> | ⭐☆☆☆ | 1.0 | 5.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_input_mouse](core/core_input_mouse.c) | <img src="core/core_input_mouse.png" alt="core_input_mouse" width="80"> | ⭐☆☆☆ | 1.0 | 5.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_input_mouse_wheel](core/core_input_mouse_wheel.c) | <img src="core/core_input_mouse_wheel.png" alt="core_input_mouse_wheel" width="80"> | ⭐☆☆☆ | 1.1 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_input_mouse_wheel](core/core_input_mouse_wheel.c) | <img src="core/core_input_mouse_wheel.png" alt="core_input_mouse_wheel" width="80"> | ⭐☆☆☆ | 1.1 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_input_gamepad](core/core_input_gamepad.c) | <img src="core/core_input_gamepad.png" alt="core_input_gamepad" width="80"> | ⭐☆☆☆ | 1.1 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_input_gamepad](core/core_input_gamepad.c) | <img src="core/core_input_gamepad.png" alt="core_input_gamepad" width="80"> | ⭐☆☆☆ | 1.1 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_input_multitouch](core/core_input_multitouch.c) | <img src="core/core_input_multitouch.png" alt="core_input_multitouch" width="80"> | ⭐☆☆☆ | 2.1 | 2.5 | [Berni](https://github.com/Berni8k) |
|
| [core_input_multitouch](core/core_input_multitouch.c) | <img src="core/core_input_multitouch.png" alt="core_input_multitouch" width="80"> | ⭐☆☆☆ | 2.1 | 2.5 | [Berni](https://github.com/Berni8k) |
|
||||||
| [core_input_gestures](core/core_input_gestures.c) | <img src="core/core_input_gestures.png" alt="core_input_gestures" width="80"> | ⭐⭐☆☆ | 1.4 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_input_gestures](core/core_input_gestures.c) | <img src="core/core_input_gestures.png" alt="core_input_gestures" width="80"> | ⭐⭐☆☆ | 1.4 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_input_gestures_testbed](core/core_input_gestures_testbed.c) | <img src="core/core_input_gestures_testbed.png" alt="core_input_gestures_testbed" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.6-dev | [ubkp](https://github.com/ubkp) |
|
| [core_input_gestures_testbed](core/core_input_gestures_testbed.c) | <img src="core/core_input_gestures_testbed.png" alt="core_input_gestures_testbed" width="80"> | ⭐⭐⭐☆ | 5.0 | 6.0 | [ubkp](https://github.com/ubkp) |
|
||||||
| [core_input_virtual_controls](core/core_input_virtual_controls.c) | <img src="core/core_input_virtual_controls.png" alt="core_input_virtual_controls" width="80"> | ⭐⭐☆☆ | 5.0 | 5.0 | [GreenSnakeLinux](https://github.com/GreenSnakeLinux) |
|
| [core_input_virtual_controls](core/core_input_virtual_controls.c) | <img src="core/core_input_virtual_controls.png" alt="core_input_virtual_controls" width="80"> | ⭐⭐☆☆ | 5.0 | 5.0 | [GreenSnakeLinux](https://github.com/GreenSnakeLinux) |
|
||||||
| [core_2d_camera](core/core_2d_camera.c) | <img src="core/core_2d_camera.png" alt="core_2d_camera" width="80"> | ⭐⭐☆☆ | 1.5 | 3.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_2d_camera](core/core_2d_camera.c) | <img src="core/core_2d_camera.png" alt="core_2d_camera" width="80"> | ⭐⭐☆☆ | 1.5 | 3.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | <img src="core/core_2d_camera_mouse_zoom.png" alt="core_2d_camera_mouse_zoom" width="80"> | ⭐⭐☆☆ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| [core_2d_camera_mouse_zoom](core/core_2d_camera_mouse_zoom.c) | <img src="core/core_2d_camera_mouse_zoom.png" alt="core_2d_camera_mouse_zoom" width="80"> | ⭐⭐☆☆ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
@ -42,12 +43,13 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c
|
|||||||
| [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐☆☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_3d_camera_free](core/core_3d_camera_free.c) | <img src="core/core_3d_camera_free.png" alt="core_3d_camera_free" width="80"> | ⭐☆☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐⭐☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_3d_camera_first_person](core/core_3d_camera_first_person.c) | <img src="core/core_3d_camera_first_person.png" alt="core_3d_camera_first_person" width="80"> | ⭐⭐☆☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_3d_camera_split_screen](core/core_3d_camera_split_screen.c) | <img src="core/core_3d_camera_split_screen.png" alt="core_3d_camera_split_screen" width="80"> | ⭐⭐⭐☆ | 3.7 | 4.0 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| [core_3d_camera_split_screen](core/core_3d_camera_split_screen.c) | <img src="core/core_3d_camera_split_screen.png" alt="core_3d_camera_split_screen" width="80"> | ⭐⭐⭐☆ | 3.7 | 4.0 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| [core_3d_camera_fps](core/core_3d_camera_fps.c) | <img src="core/core_3d_camera_fps.png" alt="core_3d_camera_fps" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Agnis Aldins](https://github.com/nezvers) |
|
| [core_3d_camera_fps](core/core_3d_camera_fps.c) | <img src="core/core_3d_camera_fps.png" alt="core_3d_camera_fps" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Agnis Aldiņš](https://github.com/nezvers) |
|
||||||
| [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐⭐☆☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_3d_picking](core/core_3d_picking.c) | <img src="core/core_3d_picking.png" alt="core_3d_picking" width="80"> | ⭐⭐☆☆ | 1.3 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐⭐☆☆ | 1.3 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_world_screen](core/core_world_screen.c) | <img src="core/core_world_screen.png" alt="core_world_screen" width="80"> | ⭐⭐☆☆ | 1.3 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐⭐⭐☆ | 3.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_window_flags](core/core_window_flags.c) | <img src="core/core_window_flags.png" alt="core_window_flags" width="80"> | ⭐⭐⭐☆ | 3.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Anata](https://github.com/anatagawa) |
|
| [core_window_letterbox](core/core_window_letterbox.c) | <img src="core/core_window_letterbox.png" alt="core_window_letterbox" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Anata](https://github.com/anatagawa) |
|
||||||
| [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐☆☆☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_window_should_close](core/core_window_should_close.c) | <img src="core/core_window_should_close.png" alt="core_window_should_close" width="80"> | ⭐☆☆☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_monitor_detector](core/core_monitor_detector.c) | <img src="core/core_monitor_detector.png" alt="core_monitor_detector" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Maicon Santana](https://github.com/maiconpintoabreu) |
|
||||||
| [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
|
| [core_custom_logging](core/core_custom_logging.c) | <img src="core/core_custom_logging.png" alt="core_custom_logging" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Pablo Marcos Oltra](https://github.com/pamarcos) |
|
||||||
| [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐⭐☆☆ | 1.3 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_drop_files](core/core_drop_files.c) | <img src="core/core_drop_files.png" alt="core_drop_files" width="80"> | ⭐⭐☆☆ | 1.3 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐☆☆☆ | 1.1 | 1.1 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_random_values](core/core_random_values.c) | <img src="core/core_random_values.png" alt="core_random_values" width="80"> | ⭐☆☆☆ | 1.1 | 1.1 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
@ -59,10 +61,21 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c
|
|||||||
| [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐⭐⭐☆ | 3.7 | 4.0 | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
|
| [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | <img src="core/core_smooth_pixelperfect.png" alt="core_smooth_pixelperfect" width="80"> | ⭐⭐⭐☆ | 3.7 | 4.0 | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) |
|
||||||
| [core_random_sequence](core/core_random_sequence.c) | <img src="core/core_random_sequence.png" alt="core_random_sequence" width="80"> | ⭐☆☆☆ | 5.0 | 5.0 | [Dalton Overmyer](https://github.com/REDl3east) |
|
| [core_random_sequence](core/core_random_sequence.c) | <img src="core/core_random_sequence.png" alt="core_random_sequence" width="80"> | ⭐☆☆☆ | 5.0 | 5.0 | [Dalton Overmyer](https://github.com/REDl3east) |
|
||||||
| [core_automation_events](core/core_automation_events.c) | <img src="core/core_automation_events.png" alt="core_automation_events" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_automation_events](core/core_automation_events.c) | <img src="core/core_automation_events.png" alt="core_automation_events" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
| [core_highdpi_demo](core/core_highdpi_demo.c) | <img src="core/core_highdpi_demo.png" alt="core_highdpi_demo" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
||||||
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 6.0 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_undo_redo](core/core_undo_redo.c) | <img src="core/core_undo_redo.png" alt="core_undo_redo" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_viewport_scaling](core/core_viewport_scaling.c) | <img src="core/core_viewport_scaling.png" alt="core_viewport_scaling" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Agnis Aldiņš](https://github.com/nezvers) |
|
||||||
|
| [core_input_actions](core/core_input_actions.c) | <img src="core/core_input_actions.png" alt="core_input_actions" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Jett](https://github.com/JettMonstersGoBoom) |
|
||||||
|
| [core_directory_files](core/core_directory_files.c) | <img src="core/core_directory_files.png" alt="core_directory_files" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Hugo ARNAL](https://github.com/hugoarnal) |
|
||||||
|
| [core_highdpi_testbed](core/core_highdpi_testbed.c) | <img src="core/core_highdpi_testbed.png" alt="core_highdpi_testbed" width="80"> | ⭐☆☆☆ | 6.0 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_screen_recording](core/core_screen_recording.c) | <img src="core/core_screen_recording.png" alt="core_screen_recording" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_clipboard_text](core/core_clipboard_text.c) | <img src="core/core_clipboard_text.png" alt="core_clipboard_text" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Ananth S](https://github.com/Ananth1839) |
|
||||||
|
| [core_text_file_loading](core/core_text_file_loading.c) | <img src="core/core_text_file_loading.png" alt="core_text_file_loading" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Aanjishnu Bhattacharyya](https://github.com/NimComPoo-04) |
|
||||||
|
| [core_compute_hash](core/core_compute_hash.c) | <img src="core/core_compute_hash.png" alt="core_compute_hash" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_keyboard_testbed](core/core_keyboard_testbed.c) | <img src="core/core_keyboard_testbed.png" alt="core_keyboard_testbed" width="80"> | ⭐⭐☆☆ | 5.6 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_window_web](core/core_window_web.c) | <img src="core/core_window_web.png" alt="core_window_web" width="80"> | ⭐☆☆☆ | 1.3 | 5.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
|
||||||
### category: shapes [20]
|
### category: shapes [40]
|
||||||
|
|
||||||
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
|
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
|
||||||
|
|
||||||
@ -70,6 +83,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
|||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [shapes_bullet_hell](shapes/shapes_bullet_hell.c) | <img src="shapes/shapes_bullet_hell.png" alt="shapes_bullet_hell" width="80"> | ⭐☆☆☆ | 5.6 | 5.6 | [Zero](https://github.com/zerohorsepower) |
|
||||||
| [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐⭐☆☆ | 1.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐⭐☆☆ | 1.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
@ -80,6 +94,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
|||||||
| [shapes_easings_ball](shapes/shapes_easings_ball.c) | <img src="shapes/shapes_easings_ball.png" alt="shapes_easings_ball" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_ball](shapes/shapes_easings_ball.c) | <img src="shapes/shapes_easings_ball.png" alt="shapes_easings_ball" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_easings_box](shapes/shapes_easings_box.c) | <img src="shapes/shapes_easings_box.png" alt="shapes_easings_box" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_box](shapes/shapes_easings_box.c) | <img src="shapes/shapes_easings_box.png" alt="shapes_easings_box" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_easings_rectangles](shapes/shapes_easings_rectangles.c) | <img src="shapes/shapes_easings_rectangles.png" alt="shapes_easings_rectangles" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_rectangles](shapes/shapes_easings_rectangles.c) | <img src="shapes/shapes_easings_rectangles.png" alt="shapes_easings_rectangles" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [shapes_recursive_tree](shapes/shapes_recursive_tree.c) | <img src="shapes/shapes_recursive_tree.png" alt="shapes_recursive_tree" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Jopestpe](https://github.com/jopestpe) |
|
||||||
| [shapes_ring_drawing](shapes/shapes_ring_drawing.c) | <img src="shapes/shapes_ring_drawing.png" alt="shapes_ring_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_ring_drawing](shapes/shapes_ring_drawing.c) | <img src="shapes/shapes_ring_drawing.png" alt="shapes_ring_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [shapes_circle_sector_drawing](shapes/shapes_circle_sector_drawing.c) | <img src="shapes/shapes_circle_sector_drawing.png" alt="shapes_circle_sector_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_circle_sector_drawing](shapes/shapes_circle_sector_drawing.c) | <img src="shapes/shapes_circle_sector_drawing.png" alt="shapes_circle_sector_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [shapes_rounded_rectangle_drawing](shapes/shapes_rounded_rectangle_drawing.c) | <img src="shapes/shapes_rounded_rectangle_drawing.png" alt="shapes_rounded_rectangle_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_rounded_rectangle_drawing](shapes/shapes_rounded_rectangle_drawing.c) | <img src="shapes/shapes_rounded_rectangle_drawing.png" alt="shapes_rounded_rectangle_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
@ -88,13 +103,33 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
|||||||
| [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
|
| [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
|
||||||
| [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
|
| [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
|
||||||
|
| [shapes_dashed_line](shapes/shapes_dashed_line.c) | <img src="shapes/shapes_dashed_line.png" alt="shapes_dashed_line" width="80"> | ⭐☆☆☆ | 5.5 | 5.5 | [Luís Almeida](https://github.com/luis605) |
|
||||||
|
| [shapes_triangle_strip](shapes/shapes_triangle_strip.c) | <img src="shapes/shapes_triangle_strip.png" alt="shapes_triangle_strip" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Jopestpe](https://github.com/jopestpe) |
|
||||||
|
| [shapes_vector_angle](shapes/shapes_vector_angle.c) | <img src="shapes/shapes_vector_angle.png" alt="shapes_vector_angle" width="80"> | ⭐⭐☆☆ | 1.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [shapes_pie_chart](shapes/shapes_pie_chart.c) | <img src="shapes/shapes_pie_chart.png" alt="shapes_pie_chart" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Gideon Serfontein](https://github.com/GideonSerf) |
|
||||||
|
| [shapes_kaleidoscope](shapes/shapes_kaleidoscope.c) | <img src="shapes/shapes_kaleidoscope.png" alt="shapes_kaleidoscope" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Hugo ARNAL](https://github.com/hugoarnal) |
|
||||||
|
| [shapes_clock_of_clocks](shapes/shapes_clock_of_clocks.c) | <img src="shapes/shapes_clock_of_clocks.png" alt="shapes_clock_of_clocks" width="80"> | ⭐⭐☆☆ | 5.5 | 6.0 | [JP Mortiboys](https://github.com/themushroompirates) |
|
||||||
|
| [shapes_math_sine_cosine](shapes/shapes_math_sine_cosine.c) | <img src="shapes/shapes_math_sine_cosine.png" alt="shapes_math_sine_cosine" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Jopestpe](https://github.com/jopestpe) |
|
||||||
|
| [shapes_mouse_trail](shapes/shapes_mouse_trail.c) | <img src="shapes/shapes_mouse_trail.png" alt="shapes_mouse_trail" width="80"> | ⭐☆☆☆ | 5.6 | 6.0 | [Balamurugan R](https://github.com/Bala050814) |
|
||||||
|
| [shapes_simple_particles](shapes/shapes_simple_particles.c) | <img src="shapes/shapes_simple_particles.png" alt="shapes_simple_particles" width="80"> | ⭐⭐☆☆ | 5.6 | 5.6 | [Jordi Santonja](https://github.com/JordSant) |
|
||||||
|
| [shapes_starfield_effect](shapes/shapes_starfield_effect.c) | <img src="shapes/shapes_starfield_effect.png" alt="shapes_starfield_effect" width="80"> | ⭐⭐☆☆ | 5.5 | 6.0 | [JP Mortiboys](https://github.com/themushroompirates) |
|
||||||
|
| [shapes_lines_drawing](shapes/shapes_lines_drawing.c) | <img src="shapes/shapes_lines_drawing.png" alt="shapes_lines_drawing" width="80"> | ⭐☆☆☆ | 6.0 | 5.6 | [Robin](https://github.com/RobinsAviary) |
|
||||||
|
| [shapes_math_angle_rotation](shapes/shapes_math_angle_rotation.c) | <img src="shapes/shapes_math_angle_rotation.png" alt="shapes_math_angle_rotation" width="80"> | ⭐☆☆☆ | 6.0 | 5.6 | [Kris](https://github.com/krispy-snacc) |
|
||||||
|
| [shapes_rlgl_color_wheel](shapes/shapes_rlgl_color_wheel.c) | <img src="shapes/shapes_rlgl_color_wheel.png" alt="shapes_rlgl_color_wheel" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Robin](https://github.com/RobinsAviary) |
|
||||||
|
| [shapes_rlgl_triangle](shapes/shapes_rlgl_triangle.c) | <img src="shapes/shapes_rlgl_triangle.png" alt="shapes_rlgl_triangle" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Robin](https://github.com/RobinsAviary) |
|
||||||
|
| [shapes_ball_physics](shapes/shapes_ball_physics.c) | <img src="shapes/shapes_ball_physics.png" alt="shapes_ball_physics" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [David Buzatto](https://github.com/davidbuzatto) |
|
||||||
|
| [shapes_penrose_tile](shapes/shapes_penrose_tile.c) | <img src="shapes/shapes_penrose_tile.png" alt="shapes_penrose_tile" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 6.0 | [David Buzatto](https://github.com/davidbuzatto) |
|
||||||
|
| [shapes_hilbert_curve](shapes/shapes_hilbert_curve.c) | <img src="shapes/shapes_hilbert_curve.png" alt="shapes_hilbert_curve" width="80"> | ⭐⭐⭐☆ | 5.6 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
|
||||||
|
| [shapes_easings_testbed](shapes/shapes_easings_testbed.c) | <img src="shapes/shapes_easings_testbed.png" alt="shapes_easings_testbed" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Juan Miguel López](https://github.com/flashback-fx) |
|
||||||
|
|
||||||
### category: textures [26]
|
### category: textures [32]
|
||||||
|
|
||||||
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/rtextures.c) module.
|
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib [textures](../src/rtextures.c) module.
|
||||||
|
|
||||||
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
|
| [textures_clipboard_image](textures/textures_clipboard_image.c) | <img src="textures/textures_clipboard_image.png" alt="textures_clipboard_image" width="80"> | ⭐☆☆☆ | 6.0 | 6.0 | [Maicon Santana](https://github.com/maiconpintoabreu) |
|
||||||
|
| [textures_magnifying_glass](textures/textures_magnifying_glass.c) | <img src="textures/textures_magnifying_glass.png" alt="textures_magnifying_glass" width="80"> | ⭐⭐⭐☆ | 5.6 | 5.6 | [Luke Vaughan](https://github.com/badram) |
|
||||||
| [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [textures_logo_raylib](textures/textures_logo_raylib.c) | <img src="textures/textures_logo_raylib.png" alt="textures_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐⭐⭐☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [textures_srcrec_dstrec](textures/textures_srcrec_dstrec.c) | <img src="textures/textures_srcrec_dstrec.png" alt="textures_srcrec_dstrec" width="80"> | ⭐⭐⭐☆ | 1.3 | 1.3 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [textures_image_drawing](textures/textures_image_drawing.c) | <img src="textures/textures_image_drawing.png" alt="textures_image_drawing" width="80"> | ⭐⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
@ -120,9 +155,13 @@ Examples using raylib textures functionality, including image/textures loading/g
|
|||||||
| [textures_image_kernel](textures/textures_image_kernel.c) | <img src="textures/textures_image_kernel.png" alt="textures_image_kernel" width="80"> | ⭐⭐⭐⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) |
|
| [textures_image_kernel](textures/textures_image_kernel.c) | <img src="textures/textures_image_kernel.png" alt="textures_image_kernel" width="80"> | ⭐⭐⭐⭐️ | 1.3 | 1.3 | [Karim Salem](https://github.com/kimo-s) |
|
||||||
| [textures_image_channel](textures/textures_image_channel.c) | <img src="textures/textures_image_channel.png" alt="textures_image_channel" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Bruno Cabral](https://github.com/brccabral) |
|
| [textures_image_channel](textures/textures_image_channel.c) | <img src="textures/textures_image_channel.png" alt="textures_image_channel" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Bruno Cabral](https://github.com/brccabral) |
|
||||||
| [textures_image_rotate](textures/textures_image_rotate.c) | <img src="textures/textures_image_rotate.png" alt="textures_image_rotate" width="80"> | ⭐⭐☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [textures_image_rotate](textures/textures_image_rotate.c) | <img src="textures/textures_image_rotate.png" alt="textures_image_rotate" width="80"> | ⭐⭐☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [textures_screen_buffer](textures/textures_screen_buffer.c) | <img src="textures/textures_screen_buffer.png" alt="textures_screen_buffer" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Agnis Aldiņš](https://github.com/nezvers) |
|
||||||
| [textures_textured_curve](textures/textures_textured_curve.c) | <img src="textures/textures_textured_curve.png" alt="textures_textured_curve" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| [textures_textured_curve](textures/textures_textured_curve.c) | <img src="textures/textures_textured_curve.png" alt="textures_textured_curve" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
|
| [textures_sprite_stacking](textures/textures_sprite_stacking.c) | <img src="textures/textures_sprite_stacking.png" alt="textures_sprite_stacking" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Robin](https://github.com/RobinsAviary) |
|
||||||
|
| [textures_cellular_automata](textures/textures_cellular_automata.c) | <img src="textures/textures_cellular_automata.png" alt="textures_cellular_automata" width="80"> | ⭐⭐☆☆ | 5.6 | 5.6 | [Jordi Santonja](https://github.com/JordSant) |
|
||||||
|
| [textures_framebuffer_rendering](textures/textures_framebuffer_rendering.c) | <img src="textures/textures_framebuffer_rendering.png" alt="textures_framebuffer_rendering" width="80"> | ⭐⭐☆☆ | 5.6 | 5.6 | [Jack Boakes](https://github.com/jackboakes) |
|
||||||
|
|
||||||
### category: text [14]
|
### category: text [16]
|
||||||
|
|
||||||
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/rtext.c) module.
|
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib [text](../src/rtext.c) module.
|
||||||
|
|
||||||
@ -138,18 +177,20 @@ Examples using raylib text functionality, including sprite fonts loading/generat
|
|||||||
| [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [text_writing_anim](text/text_writing_anim.c) | <img src="text/text_writing_anim.png" alt="text_writing_anim" width="80"> | ⭐⭐☆☆ | 1.4 | 1.4 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| [text_rectangle_bounds](text/text_rectangle_bounds.c) | <img src="text/text_rectangle_bounds.png" alt="text_rectangle_bounds" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [text_unicode_emojis](text/text_unicode_emojis.c) | <img src="text/text_unicode_emojis.png" alt="text_unicode_emojis" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| [text_unicode_emojis](text/text_unicode_emojis.c) | <img src="text/text_unicode_emojis.png" alt="text_unicode_emojis" width="80"> | ⭐⭐⭐⭐️ | 2.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [text_unicode_ranges](text/text_unicode_ranges.c) | <img src="text/text_unicode_ranges.png" alt="text_unicode_ranges" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Vlad Adrian](https://github.com/demizdor) |
|
| [text_unicode_ranges](text/text_unicode_ranges.c) | <img src="text/text_unicode_ranges.png" alt="text_unicode_ranges" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Vadim Gunko](https://github.com/GuvaCode) |
|
||||||
| [text_3d_drawing](text/text_3d_drawing.c) | <img src="text/text_3d_drawing.png" alt="text_3d_drawing" width="80"> | ⭐⭐⭐⭐️ | 3.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
| [text_3d_drawing](text/text_3d_drawing.c) | <img src="text/text_3d_drawing.png" alt="text_3d_drawing" width="80"> | ⭐⭐⭐⭐️ | 3.5 | 4.0 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [text_inline_styling](text/text_inline_styling.c) | <img src="text/text_inline_styling.png" alt="text_inline_styling" width="80"> | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Wagner Barongello](https://github.com/SultansOfCode) |
|
| [text_inline_styling](text/text_inline_styling.c) | <img src="text/text_inline_styling.png" alt="text_inline_styling" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Wagner Barongello](https://github.com/SultansOfCode) |
|
||||||
|
| [text_words_alignment](text/text_words_alignment.c) | <img src="text/text_words_alignment.png" alt="text_words_alignment" width="80"> | ⭐☆☆☆ | 6.0 | 6.0 | [JP Mortiboys](https://github.com/themushroompirates) |
|
||||||
|
| [text_strings_management](text/text_strings_management.c) | <img src="text/text_strings_management.png" alt="text_strings_management" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [David Buzatto](https://github.com/davidbuzatto) |
|
||||||
|
|
||||||
### category: models [23]
|
### category: models [30]
|
||||||
|
|
||||||
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
|
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
|
||||||
|
|
||||||
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| [models_animation_playing](models/models_animation_playing.c) | <img src="models/models_animation_playing.png" alt="models_animation_playing" width="80"> | ⭐⭐☆☆ | 2.5 | 3.5 | [Culacant](https://github.com/culacant) |
|
| [models_loading_iqm](models/models_loading_iqm.c) | <img src="models/models_loading_iqm.png" alt="models_loading_iqm" width="80"> | ⭐⭐☆☆ | 2.5 | 3.5 | [Culacant](https://github.com/culacant) |
|
||||||
| [models_billboard_rendering](models/models_billboard_rendering.c) | <img src="models/models_billboard_rendering.png" alt="models_billboard_rendering" width="80"> | ⭐⭐⭐☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_billboard_rendering](models/models_billboard_rendering.c) | <img src="models/models_billboard_rendering.png" alt="models_billboard_rendering" width="80"> | ⭐⭐⭐☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐☆☆☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_box_collisions](models/models_box_collisions.c) | <img src="models/models_box_collisions.png" alt="models_box_collisions" width="80"> | ⭐☆☆☆ | 1.3 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [models_cubicmap_rendering](models/models_cubicmap_rendering.c) | <img src="models/models_cubicmap_rendering.png" alt="models_cubicmap_rendering" width="80"> | ⭐⭐☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_cubicmap_rendering](models/models_cubicmap_rendering.c) | <img src="models/models_cubicmap_rendering.png" alt="models_cubicmap_rendering" width="80"> | ⭐⭐☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
@ -169,16 +210,24 @@ Examples using raylib models functionality, including models loading/generation
|
|||||||
| [models_heightmap_rendering](models/models_heightmap_rendering.c) | <img src="models/models_heightmap_rendering.png" alt="models_heightmap_rendering" width="80"> | ⭐☆☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_heightmap_rendering](models/models_heightmap_rendering.c) | <img src="models/models_heightmap_rendering.png" alt="models_heightmap_rendering" width="80"> | ⭐☆☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [models_skybox_rendering](models/models_skybox_rendering.c) | <img src="models/models_skybox_rendering.png" alt="models_skybox_rendering" width="80"> | ⭐⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_skybox_rendering](models/models_skybox_rendering.c) | <img src="models/models_skybox_rendering.png" alt="models_skybox_rendering" width="80"> | ⭐⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [models_textured_cube](models/models_textured_cube.c) | <img src="models/models_textured_cube.png" alt="models_textured_cube" width="80"> | ⭐⭐☆☆ | 4.5 | 4.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [models_textured_cube](models/models_textured_cube.c) | <img src="models/models_textured_cube.png" alt="models_textured_cube" width="80"> | ⭐⭐☆☆ | 4.5 | 4.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [models_gpu_skinning](models/models_gpu_skinning.c) | <img src="models/models_gpu_skinning.png" alt="models_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
| [models_animation_gpu_skinning](models/models_animation_gpu_skinning.c) | <img src="models/models_animation_gpu_skinning.png" alt="models_animation_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
||||||
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
||||||
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
|
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Timothy van der Valk](https://github.com/arceryz) |
|
||||||
|
| [models_basic_voxel](models/models_basic_voxel.c) | <img src="models/models_basic_voxel.png" alt="models_basic_voxel" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Tim Little](https://github.com/timlittle) |
|
||||||
|
| [models_rotating_cube](models/models_rotating_cube.c) | <img src="models/models_rotating_cube.png" alt="models_rotating_cube" width="80"> | ⭐☆☆☆ | 6.0 | 6.0 | [Jopestpe](https://github.com/jopestpe) |
|
||||||
|
| [models_decals](models/models_decals.c) | <img src="models/models_decals.png" alt="models_decals" width="80"> | ⭐⭐⭐⭐️ | 6.0 | 6.0 | [JP Mortiboys](https://github.com/themushroompirates) |
|
||||||
|
| [models_directional_billboard](models/models_directional_billboard.c) | <img src="models/models_directional_billboard.png" alt="models_directional_billboard" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Robin](https://github.com/RobinsAviary) |
|
||||||
|
| [models_animation_blend_custom](models/models_animation_blend_custom.c) | <img src="models/models_animation_blend_custom.png" alt="models_animation_blend_custom" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 6.0 | [dmitrii-brand](https://github.com/dmitrii-brand) |
|
||||||
|
| [models_animation_blending](models/models_animation_blending.c) | <img src="models/models_animation_blending.png" alt="models_animation_blending" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 6.0 | [Kirandeep](https://github.com/Kirandeep-Singh-Khehra) |
|
||||||
|
| [models_animation_timing](models/models_animation_timing.c) | <img src="models/models_animation_timing.png" alt="models_animation_timing" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
|
||||||
### category: shaders [29]
|
### category: shaders [35]
|
||||||
|
|
||||||
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module.
|
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.h) module.
|
||||||
|
|
||||||
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
|
| [shaders_ascii_rendering](shaders/shaders_ascii_rendering.c) | <img src="shaders/shaders_ascii_rendering.png" alt="shaders_ascii_rendering" width="80"> | ⭐⭐☆☆ | 5.5 | 6.0 | [Maicon Santana](https://github.com/maiconpintoabreu) |
|
||||||
| [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐⭐⭐⭐️ | 3.0 | 4.2 | [Chris Camacho](https://github.com/chriscamacho) |
|
| [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐⭐⭐⭐️ | 3.0 | 4.2 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐⭐☆☆ | 1.3 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐⭐☆☆ | 1.3 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐⭐☆☆ | 1.7 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐⭐☆☆ | 1.7 | 3.7 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
@ -190,13 +239,15 @@ Examples using raylib shaders functionality, including shaders loading, paramete
|
|||||||
| [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐⭐⭐☆ | 4.0 | 4.0 | [Serenity Skiff](https://github.com/GoldenThumbs) |
|
| [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐⭐⭐☆ | 4.0 | 4.0 | [Serenity Skiff](https://github.com/GoldenThumbs) |
|
||||||
| [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
| [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
||||||
| [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [Josh Colclough](https://github.com/joshcol9232) |
|
| [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [Josh Colclough](https://github.com/joshcol9232) |
|
||||||
|
| [shaders_mandelbrot_set](shaders/shaders_mandelbrot_set.c) | <img src="shaders/shaders_mandelbrot_set.png" alt="shaders_mandelbrot_set" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Jordi Santonja](https://github.com/JordSant) |
|
||||||
|
| [shaders_color_correction](shaders/shaders_color_correction.c) | <img src="shaders/shaders_color_correction.png" alt="shaders_color_correction" width="80"> | ⭐⭐☆☆ | 6.0 | 6.0 | [Jordi Santonja](https://github.com/JordSant) |
|
||||||
| [shaders_eratosthenes_sieve](shaders/shaders_eratosthenes_sieve.c) | <img src="shaders/shaders_eratosthenes_sieve.png" alt="shaders_eratosthenes_sieve" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [ProfJski](https://github.com/ProfJski) |
|
| [shaders_eratosthenes_sieve](shaders/shaders_eratosthenes_sieve.c) | <img src="shaders/shaders_eratosthenes_sieve.png" alt="shaders_eratosthenes_sieve" width="80"> | ⭐⭐⭐☆ | 2.5 | 4.0 | [ProfJski](https://github.com/ProfJski) |
|
||||||
| [shaders_fog_rendering](shaders/shaders_fog_rendering.c) | <img src="shaders/shaders_fog_rendering.png" alt="shaders_fog_rendering" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| [shaders_fog_rendering](shaders/shaders_fog_rendering.c) | <img src="shaders/shaders_fog_rendering.png" alt="shaders_fog_rendering" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐⭐⭐☆ | 3.0 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐⭐⭐☆ | 3.0 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐⭐⭐⭐️ | 3.7 | 4.2 | [seanpringle](https://github.com/seanpringle) |
|
| [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐⭐⭐⭐️ | 3.7 | 4.2 | [seanpringle](https://github.com/seanpringle) |
|
||||||
| [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐⭐☆☆ | 3.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐⭐☆☆ | 3.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shaders_normalmap_rendering](shaders/shaders_normalmap_rendering.c) | <img src="shaders/shaders_normalmap_rendering.png" alt="shaders_normalmap_rendering" width="80"> | ⭐⭐⭐⭐️ | 5.6 | 5.6 | [Jeremy Montgomery](https://github.com/Sir_Irk) |
|
| [shaders_normalmap_rendering](shaders/shaders_normalmap_rendering.c) | <img src="shaders/shaders_normalmap_rendering.png" alt="shaders_normalmap_rendering" width="80"> | ⭐⭐⭐⭐️ | 6.0 | 6.0 | [Jeremy Montgomery](https://github.com/Sir_Irk) |
|
||||||
| [shaders_spotlight_rendering](shaders/shaders_spotlight_rendering.c) | <img src="shaders/shaders_spotlight_rendering.png" alt="shaders_spotlight_rendering" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
| [shaders_spotlight_rendering](shaders/shaders_spotlight_rendering.c) | <img src="shaders/shaders_spotlight_rendering.png" alt="shaders_spotlight_rendering" width="80"> | ⭐⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) |
|
||||||
| [shaders_deferred_rendering](shaders/shaders_deferred_rendering.c) | <img src="shaders/shaders_deferred_rendering.png" alt="shaders_deferred_rendering" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
| [shaders_deferred_rendering](shaders/shaders_deferred_rendering.c) | <img src="shaders/shaders_deferred_rendering.png" alt="shaders_deferred_rendering" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
||||||
| [shaders_hybrid_rendering](shaders/shaders_hybrid_rendering.c) | <img src="shaders/shaders_hybrid_rendering.png" alt="shaders_hybrid_rendering" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
| [shaders_hybrid_rendering](shaders/shaders_hybrid_rendering.c) | <img src="shaders/shaders_hybrid_rendering.png" alt="shaders_hybrid_rendering" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) |
|
||||||
@ -207,9 +258,12 @@ Examples using raylib shaders functionality, including shaders loading, paramete
|
|||||||
| [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | <img src="shaders/shaders_basic_pbr.png" alt="shaders_basic_pbr" width="80"> | ⭐⭐⭐⭐️ | 5.0 | 5.5 | [Afan OLOVCIC](https://github.com/_DevDad) |
|
| [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | <img src="shaders/shaders_basic_pbr.png" alt="shaders_basic_pbr" width="80"> | ⭐⭐⭐⭐️ | 5.0 | 5.5 | [Afan OLOVCIC](https://github.com/_DevDad) |
|
||||||
| [shaders_lightmap_rendering](shaders/shaders_lightmap_rendering.c) | <img src="shaders/shaders_lightmap_rendering.png" alt="shaders_lightmap_rendering" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) |
|
| [shaders_lightmap_rendering](shaders/shaders_lightmap_rendering.c) | <img src="shaders/shaders_lightmap_rendering.png" alt="shaders_lightmap_rendering" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) |
|
||||||
| [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | <img src="shaders/shaders_rounded_rectangle.png" alt="shaders_rounded_rectangle" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) |
|
| [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | <img src="shaders/shaders_rounded_rectangle.png" alt="shaders_rounded_rectangle" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) |
|
||||||
| [shaders_depth_rendering](shaders/shaders_depth_rendering.c) | <img src="shaders/shaders_depth_rendering.png" alt="shaders_depth_rendering" width="80"> | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Luís Almeida](https://github.com/luis605) |
|
| [shaders_depth_rendering](shaders/shaders_depth_rendering.c) | <img src="shaders/shaders_depth_rendering.png" alt="shaders_depth_rendering" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Luís Almeida](https://github.com/luis605) |
|
||||||
|
| [shaders_game_of_life](shaders/shaders_game_of_life.c) | <img src="shaders/shaders_game_of_life.png" alt="shaders_game_of_life" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Jordi Santonja](https://github.com/JordSant) |
|
||||||
|
| [shaders_rlgl_compute](shaders/shaders_rlgl_compute.c) | <img src="shaders/shaders_rlgl_compute.png" alt="shaders_rlgl_compute" width="80"> | ⭐⭐⭐⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) |
|
||||||
|
| [shaders_cel_shading](shaders/shaders_cel_shading.c) | <img src="shaders/shaders_cel_shading.png" alt="shaders_cel_shading" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Gleb A](https://github.com/ggrizzly) |
|
||||||
|
|
||||||
### category: audio [8]
|
### category: audio [10]
|
||||||
|
|
||||||
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib.
|
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib.
|
||||||
|
|
||||||
@ -217,25 +271,14 @@ Examples using raylib audio functionality, including sound/music loading and pla
|
|||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐☆☆☆ | 1.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐☆☆☆ | 1.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐☆☆☆ | 1.3 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐☆☆☆ | 1.3 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐⭐⭐☆ | 1.6 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐⭐⭐☆ | 1.6 | 6.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐☆☆☆ | 1.1 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐☆☆☆ | 1.1 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [audio_mixed_processor](audio/audio_mixed_processor.c) | <img src="audio/audio_mixed_processor.png" alt="audio_mixed_processor" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) |
|
| [audio_mixed_processor](audio/audio_mixed_processor.c) | <img src="audio/audio_mixed_processor.png" alt="audio_mixed_processor" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) |
|
||||||
| [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.0 | [Jeffery Myers](https://github.com/JeffM2501) |
|
| [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.0 | [Jeffery Myers](https://github.com/JeffM2501) |
|
||||||
| [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
|
| [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
|
||||||
|
| [audio_spectrum_visualizer](audio/audio_spectrum_visualizer.c) | <img src="audio/audio_spectrum_visualizer.png" alt="audio_spectrum_visualizer" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [IANN](https://github.com/meisei4) |
|
||||||
### category: others [6]
|
| [audio_stream_callback](audio/audio_stream_callback.c) | <img src="audio/audio_stream_callback.png" alt="audio_stream_callback" width="80"> | ⭐⭐⭐☆ | 6.0 | 6.0 | [Dan Hoang](https://github.com/dan-hoang) |
|
||||||
|
|
||||||
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
|
|
||||||
|
|
||||||
| example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|
||||||
| [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐⭐⭐⭐️ | 1.6 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
|
||||||
| [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐⭐⭐⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) |
|
|
||||||
| [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐⭐⭐☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
|
|
||||||
| [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐⭐⭐⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) |
|
|
||||||
| [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐⭐☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
|
|
||||||
| [raymath_vector_angle](others/raymath_vector_angle.c) | <img src="others/raymath_vector_angle.png" alt="raymath_vector_angle" width="80"> | ⭐⭐☆☆ | 1.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
|
||||||
|
|
||||||
Some example missing? As always, contributions are welcome, feel free to send new examples!
|
Some example missing? As always, contributions are welcome, feel free to send new examples!
|
||||||
Here is an[examples template](examples_template.c) with instructions to start with!
|
Here is an [examples template](examples_template.c) with instructions to start with!
|
||||||
|
|||||||
238
examples/audio/audio_amp_envelope.c
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - amp envelope
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by Arbinda Rizki Muhammad (@arbipink) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2026 Arbinda Rizki Muhammad (@arbipink)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h"
|
||||||
|
|
||||||
|
#include <math.h> // Required for: sinf()
|
||||||
|
|
||||||
|
#define BUFFER_SIZE 4096
|
||||||
|
#define SAMPLE_RATE 44100
|
||||||
|
|
||||||
|
// Wave state
|
||||||
|
typedef enum {
|
||||||
|
IDLE,
|
||||||
|
ATTACK,
|
||||||
|
DECAY,
|
||||||
|
SUSTAIN,
|
||||||
|
RELEASE
|
||||||
|
} ADSRState;
|
||||||
|
|
||||||
|
// Grouping all ADSR parameters and state into a struct
|
||||||
|
typedef struct {
|
||||||
|
float attackTime;
|
||||||
|
float decayTime;
|
||||||
|
float sustainLevel;
|
||||||
|
float releaseTime;
|
||||||
|
float currentValue;
|
||||||
|
ADSRState state;
|
||||||
|
} Envelope;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static void FillAudioBuffer(int i, float *buffer, float envelopeValue, float *audioTime);
|
||||||
|
static void UpdateEnvelope(Envelope *env);
|
||||||
|
static void DrawADSRGraph(Envelope *env, Rectangle bounds);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - amp envelope");
|
||||||
|
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
|
// Set the number of samples the stream will keep in memory at a time to BUFFER_SIZE
|
||||||
|
SetAudioStreamBufferSizeDefault(BUFFER_SIZE);
|
||||||
|
float buffer[BUFFER_SIZE] = { 0 };
|
||||||
|
|
||||||
|
// Init raw audio stream (sample rate: 44100, sample size: 32bit-float, channels: 1-mono)
|
||||||
|
AudioStream stream = LoadAudioStream(SAMPLE_RATE, 32, 1);
|
||||||
|
|
||||||
|
// Init Phase
|
||||||
|
float audioTime = 0.0f;
|
||||||
|
|
||||||
|
// Initialize the struct
|
||||||
|
Envelope env = {
|
||||||
|
.attackTime = 1.0f,
|
||||||
|
.decayTime = 1.0f,
|
||||||
|
.sustainLevel = 0.5f,
|
||||||
|
.releaseTime = 1.0f,
|
||||||
|
.currentValue = 0.0f,
|
||||||
|
.state = IDLE
|
||||||
|
};
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) env.state = ATTACK;
|
||||||
|
|
||||||
|
if (IsKeyReleased(KEY_SPACE) && (env.state != IDLE)) env.state = RELEASE;
|
||||||
|
|
||||||
|
if (IsAudioStreamProcessed(stream))
|
||||||
|
{
|
||||||
|
if ((env.state != IDLE) || (env.currentValue > 0.0f))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BUFFER_SIZE; i++)
|
||||||
|
{
|
||||||
|
UpdateEnvelope(&env);
|
||||||
|
FillAudioBuffer(i, buffer, env.currentValue, &audioTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Clear buffer if silent to avoid looping noise
|
||||||
|
for (int i = 0; i < BUFFER_SIZE; i++) buffer[i] = 0;
|
||||||
|
audioTime = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAudioStream(stream, buffer, BUFFER_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsAudioStreamPlaying(stream)) PlayAudioStream(stream);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
GuiSliderBar((Rectangle){ 100, 60, 400, 30 }, "Attack (s)", TextFormat("%2.2fs", env.attackTime), &env.attackTime, 0.1f, 3.0f);
|
||||||
|
GuiSliderBar((Rectangle){ 100, 100, 400, 30 }, "Decay (s)", TextFormat("%2.2fs", env.decayTime), &env.decayTime, 0.1f, 3.0f);
|
||||||
|
GuiSliderBar((Rectangle){ 100, 140, 400, 30 }, "Sustain", TextFormat("%2.2f", env.sustainLevel), &env.sustainLevel, 0.0f, 1.0f);
|
||||||
|
GuiSliderBar((Rectangle){ 100, 180, 400, 30 }, "Release (s)", TextFormat("%2.2fs", env.releaseTime), &env.releaseTime, 0.1f, 3.0f);
|
||||||
|
|
||||||
|
DrawADSRGraph(&env, (Rectangle){ 100, 250, 400, 100 });
|
||||||
|
|
||||||
|
DrawCircleV((Vector2){ 520, 350 - (env.currentValue * 100) }, 5, MAROON);
|
||||||
|
DrawText(TextFormat("Current Gain: %2.2f", env.currentValue), 535, 345 - (env.currentValue * 100), 10, MAROON);
|
||||||
|
|
||||||
|
DrawText("Press SPACE to PLAY the sound!", 200, 400, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadAudioStream(stream);
|
||||||
|
CloseAudioDevice();
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static void FillAudioBuffer(int i, float *buffer, float envelopeValue, float *audioTime)
|
||||||
|
{
|
||||||
|
int frequency = 440;
|
||||||
|
buffer[i] = envelopeValue*sinf(2.0f*PI*frequency*(*audioTime));
|
||||||
|
*audioTime += (1.0f/SAMPLE_RATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UpdateEnvelope(Envelope *env)
|
||||||
|
{
|
||||||
|
// Calculate the time delta for ONE sample (1/44100)
|
||||||
|
float sampleTime = 1.0f/SAMPLE_RATE;
|
||||||
|
|
||||||
|
switch(env->state)
|
||||||
|
{
|
||||||
|
case ATTACK:
|
||||||
|
{
|
||||||
|
env->currentValue += (1.0f/env->attackTime)*sampleTime;
|
||||||
|
if (env->currentValue >= 1.0f)
|
||||||
|
{
|
||||||
|
env->currentValue = 1.0f;
|
||||||
|
env->state = DECAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case DECAY:
|
||||||
|
{
|
||||||
|
env->currentValue -= ((1.0f - env->sustainLevel)/env->decayTime)*sampleTime;
|
||||||
|
if (env->currentValue <= env->sustainLevel)
|
||||||
|
{
|
||||||
|
env->currentValue = env->sustainLevel;
|
||||||
|
env->state = SUSTAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case SUSTAIN:
|
||||||
|
{
|
||||||
|
env->currentValue = env->sustainLevel;
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case RELEASE:
|
||||||
|
{
|
||||||
|
env->currentValue -= (env->sustainLevel/env->releaseTime)*sampleTime;
|
||||||
|
if (env->currentValue <= 0.001f) // Use a small threshold to avoid infinite tail
|
||||||
|
{
|
||||||
|
env->currentValue = 0.0f;
|
||||||
|
env->state = IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawADSRGraph(Envelope *env, Rectangle bounds)
|
||||||
|
{
|
||||||
|
DrawRectangleRec(bounds, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
DrawRectangleLinesEx(bounds, 1, GRAY);
|
||||||
|
|
||||||
|
// Fixed visual width for sustain stage since it's an amplitude not a time value
|
||||||
|
float sustainWidth = 1.0f;
|
||||||
|
|
||||||
|
// Total time to visualize (sum of A, D, R + a padding for Sustain)
|
||||||
|
float totalTime = env->attackTime + env->decayTime + sustainWidth + env->releaseTime;
|
||||||
|
|
||||||
|
float scaleX = bounds.width/totalTime;
|
||||||
|
float scaleY = bounds.height;
|
||||||
|
|
||||||
|
Vector2 start = { bounds.x, bounds.y + bounds.height };
|
||||||
|
Vector2 peak = { start.x + (env->attackTime*scaleX), bounds.y };
|
||||||
|
Vector2 sustain = { peak.x + (env->decayTime*scaleX), bounds.y + (1.0f - env->sustainLevel)*scaleY };
|
||||||
|
Vector2 rel = { sustain.x + (sustainWidth*scaleX), sustain.y };
|
||||||
|
Vector2 end = { rel.x + (env->releaseTime*scaleX), bounds.y + bounds.height };
|
||||||
|
|
||||||
|
DrawLineV(start, peak, SKYBLUE);
|
||||||
|
DrawLineV(peak, sustain, BLUE);
|
||||||
|
DrawLineV(sustain, rel, DARKBLUE);
|
||||||
|
DrawLineV(rel, end, ORANGE);
|
||||||
|
|
||||||
|
DrawText("ADSR Visualizer", bounds.x, bounds.y - 20, 10, DARKGRAY);
|
||||||
|
}
|
||||||
BIN
examples/audio/audio_amp_envelope.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@ -36,6 +36,12 @@ int main(void)
|
|||||||
float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f]
|
float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f]
|
||||||
bool pause = false; // Music playing paused
|
bool pause = false; // Music playing paused
|
||||||
|
|
||||||
|
float pan = 0.0f; // Default audio pan center [-1.0f..1.0f]
|
||||||
|
SetMusicPan(music, pan);
|
||||||
|
|
||||||
|
float volume = 0.8f; // Default audio volume [0.0f..1.0f]
|
||||||
|
SetMusicVolume(music, volume);
|
||||||
|
|
||||||
SetTargetFPS(30); // Set our game to run at 30 frames-per-second
|
SetTargetFPS(30); // Set our game to run at 30 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -62,6 +68,34 @@ int main(void)
|
|||||||
else ResumeMusicStream(music);
|
else ResumeMusicStream(music);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set audio pan
|
||||||
|
if (IsKeyDown(KEY_LEFT))
|
||||||
|
{
|
||||||
|
pan -= 0.05f;
|
||||||
|
if (pan < -1.0f) pan = -1.0f;
|
||||||
|
SetMusicPan(music, pan);
|
||||||
|
}
|
||||||
|
else if (IsKeyDown(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
pan += 0.05f;
|
||||||
|
if (pan > 1.0f) pan = 1.0f;
|
||||||
|
SetMusicPan(music, pan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set audio volume
|
||||||
|
if (IsKeyDown(KEY_DOWN))
|
||||||
|
{
|
||||||
|
volume -= 0.05f;
|
||||||
|
if (volume < 0.0f) volume = 0.0f;
|
||||||
|
SetMusicVolume(music, volume);
|
||||||
|
}
|
||||||
|
else if (IsKeyDown(KEY_UP))
|
||||||
|
{
|
||||||
|
volume += 0.05f;
|
||||||
|
if (volume > 1.0f) volume = 1.0f;
|
||||||
|
SetMusicVolume(music, volume);
|
||||||
|
}
|
||||||
|
|
||||||
// Get normalized time played for current music stream
|
// Get normalized time played for current music stream
|
||||||
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music);
|
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music);
|
||||||
|
|
||||||
@ -76,6 +110,11 @@ int main(void)
|
|||||||
|
|
||||||
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
|
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawText("LEFT-RIGHT for PAN CONTROL", 320, 74, 10, DARKBLUE);
|
||||||
|
DrawRectangle(300, 100, 200, 12, LIGHTGRAY);
|
||||||
|
DrawRectangleLines(300, 100, 200, 12, GRAY);
|
||||||
|
DrawRectangle((int)(300 + (pan + 1.0f)/2.0f*200 - 5), 92, 10, 28, DARKGRAY);
|
||||||
|
|
||||||
DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
|
DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
|
||||||
DrawRectangle(200, 200, (int)(timePlayed*400.0f), 12, MAROON);
|
DrawRectangle(200, 200, (int)(timePlayed*400.0f), 12, MAROON);
|
||||||
DrawRectangleLines(200, 200, 400, 12, GRAY);
|
DrawRectangleLines(200, 200, 400, 12, GRAY);
|
||||||
@ -83,6 +122,11 @@ int main(void)
|
|||||||
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY);
|
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY);
|
||||||
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY);
|
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawText("UP-DOWN for VOLUME CONTROL", 320, 334, 10, DARKGREEN);
|
||||||
|
DrawRectangle(300, 360, 200, 12, LIGHTGRAY);
|
||||||
|
DrawRectangleLines(300, 360, 200, 12, GRAY);
|
||||||
|
DrawRectangle((int)(300 + volume*200 - 5), 352, 10, 28, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,53 +4,22 @@
|
|||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 1.6, last time updated with raylib 4.2
|
* Example originally created with raylib 1.6, last time updated with raylib 6.0
|
||||||
*
|
*
|
||||||
* Example created by Ramon Santamaria (@raysan5) and reviewed by James Hofmann (@triplefox)
|
* Example created by Ramon Santamaria (@raysan5) and reviewed by James Hofmann (@triplefox)
|
||||||
*
|
*
|
||||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software
|
* BSD-like license that allows static linking with closed source software
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox)
|
* Copyright (c) 2015-2026 Ramon Santamaria (@raysan5) and James Hofmann (@triplefox)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: malloc(), free()
|
#define BUFFER_SIZE 4096
|
||||||
#include <math.h> // Required for: sinf()
|
#define SAMPLE_RATE 44100
|
||||||
#include <string.h> // Required for: memcpy()
|
|
||||||
|
|
||||||
#define MAX_SAMPLES 512
|
|
||||||
#define MAX_SAMPLES_PER_UPDATE 4096
|
|
||||||
|
|
||||||
// Cycles per second (hz)
|
|
||||||
float frequency = 440.0f;
|
|
||||||
|
|
||||||
// Audio frequency, for smoothing
|
|
||||||
float audioFrequency = 440.0f;
|
|
||||||
|
|
||||||
// Previous value, used to test if sine needs to be rewritten, and to smoothly modulate frequency
|
|
||||||
float oldFrequency = 1.0f;
|
|
||||||
|
|
||||||
// Index for audio rendering
|
|
||||||
float sineIdx = 0.0f;
|
|
||||||
|
|
||||||
// Audio input processing callback
|
|
||||||
void AudioInputCallback(void *buffer, unsigned int frames)
|
|
||||||
{
|
|
||||||
audioFrequency = frequency + (audioFrequency - frequency)*0.95f;
|
|
||||||
|
|
||||||
float incr = audioFrequency/44100.0f;
|
|
||||||
short *d = (short *)buffer;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < frames; i++)
|
|
||||||
{
|
|
||||||
d[i] = (short)(32000.0f*sinf(2*PI*sineIdx));
|
|
||||||
sineIdx += incr;
|
|
||||||
if (sineIdx > 1.0f) sineIdx -= 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@ -64,43 +33,24 @@ int main(void)
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw stream");
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw stream");
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice();
|
||||||
|
|
||||||
SetAudioStreamBufferSizeDefault(MAX_SAMPLES_PER_UPDATE);
|
// Set the number of samples the stream will keep in memory at a time to BUFFER_SIZE
|
||||||
|
SetAudioStreamBufferSizeDefault(BUFFER_SIZE);
|
||||||
|
float buffer[BUFFER_SIZE] = {};
|
||||||
|
|
||||||
// Init raw audio stream (sample rate: 44100, sample size: 16bit-short, channels: 1-mono)
|
// Init raw audio stream (sample rate: 44100, sample size: 32bit-float, channels: 1-mono)
|
||||||
AudioStream stream = LoadAudioStream(44100, 16, 1);
|
AudioStream stream = LoadAudioStream(SAMPLE_RATE, 32, 1);
|
||||||
|
float pan = 0.0f;
|
||||||
|
SetAudioStreamPan(stream, pan);
|
||||||
|
PlayAudioStream(stream);
|
||||||
|
|
||||||
SetAudioStreamCallback(stream, AudioInputCallback);
|
int sineFrequency = 440;
|
||||||
|
int newSineFrequency = 440;
|
||||||
|
int sineIndex = 0;
|
||||||
|
double sineStartTime = 0.0;
|
||||||
|
|
||||||
// Buffer for the single cycle waveform we are synthesizing
|
SetTargetFPS(30);
|
||||||
short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES);
|
|
||||||
|
|
||||||
// Frame buffer, describing the waveform when repeated over the course of a frame
|
|
||||||
short *writeBuf = (short *)malloc(sizeof(short)*MAX_SAMPLES_PER_UPDATE);
|
|
||||||
|
|
||||||
PlayAudioStream(stream); // Start processing stream buffer (no data loaded currently)
|
|
||||||
|
|
||||||
// Position read in to determine next frequency
|
|
||||||
Vector2 mousePosition = { -100.0f, -100.0f };
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Cycles per second (hz)
|
|
||||||
float frequency = 440.0f;
|
|
||||||
|
|
||||||
// Previous value, used to test if sine needs to be rewritten, and to smoothly modulate frequency
|
|
||||||
float oldFrequency = 1.0f;
|
|
||||||
|
|
||||||
// Cursor to read and copy the samples of the sine wave buffer
|
|
||||||
int readCursor = 0;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Computed size in samples of the sine wave
|
|
||||||
int waveLength = 1;
|
|
||||||
|
|
||||||
Vector2 position = { 0, 0 };
|
|
||||||
|
|
||||||
SetTargetFPS(30); // Set our game to run at 30 frames-per-second
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@ -108,91 +58,76 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
mousePosition = GetMousePosition();
|
|
||||||
|
|
||||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
if (IsKeyDown(KEY_UP))
|
||||||
{
|
{
|
||||||
float fp = (float)(mousePosition.y);
|
newSineFrequency += 10;
|
||||||
frequency = 40.0f + (float)(fp);
|
if (newSineFrequency > 12500) newSineFrequency = 12500;
|
||||||
|
}
|
||||||
|
|
||||||
float pan = (float)(mousePosition.x)/(float)screenWidth;
|
if (IsKeyDown(KEY_DOWN))
|
||||||
|
{
|
||||||
|
newSineFrequency -= 10;
|
||||||
|
if (newSineFrequency < 20) newSineFrequency = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyDown(KEY_LEFT))
|
||||||
|
{
|
||||||
|
pan -= 0.01f;
|
||||||
|
if (pan < -1.0f) pan = -1.0f;
|
||||||
SetAudioStreamPan(stream, pan);
|
SetAudioStreamPan(stream, pan);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite the sine wave
|
if (IsKeyDown(KEY_RIGHT))
|
||||||
// Compute two cycles to allow the buffer padding, simplifying any modulation, resampling, etc.
|
|
||||||
if (frequency != oldFrequency)
|
|
||||||
{
|
{
|
||||||
// Compute wavelength. Limit size in both directions
|
pan += 0.01f;
|
||||||
//int oldWavelength = waveLength;
|
if (pan > 1.0f) pan = 1.0f;
|
||||||
waveLength = (int)(22050/frequency);
|
SetAudioStreamPan(stream, pan);
|
||||||
if (waveLength > MAX_SAMPLES/2) waveLength = MAX_SAMPLES/2;
|
|
||||||
if (waveLength < 1) waveLength = 1;
|
|
||||||
|
|
||||||
// Write sine wave
|
|
||||||
for (int i = 0; i < waveLength*2; i++)
|
|
||||||
{
|
|
||||||
data[i] = (short)(sinf(((2*PI*(float)i/waveLength)))*32000);
|
|
||||||
}
|
|
||||||
// Make sure the rest of the line is flat
|
|
||||||
for (int j = waveLength*2; j < MAX_SAMPLES; j++)
|
|
||||||
{
|
|
||||||
data[j] = (short)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale read cursor's position to minimize transition artifacts
|
|
||||||
//readCursor = (int)(readCursor*((float)waveLength/(float)oldWavelength));
|
|
||||||
oldFrequency = frequency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Refill audio stream if required
|
|
||||||
if (IsAudioStreamProcessed(stream))
|
if (IsAudioStreamProcessed(stream))
|
||||||
{
|
{
|
||||||
// Synthesize a buffer that is exactly the requested size
|
for (int i = 0; i < BUFFER_SIZE; i++)
|
||||||
int writeCursor = 0;
|
|
||||||
|
|
||||||
while (writeCursor < MAX_SAMPLES_PER_UPDATE)
|
|
||||||
{
|
{
|
||||||
// Start by trying to write the whole chunk at once
|
int wavelength = SAMPLE_RATE/sineFrequency;
|
||||||
int writeLength = MAX_SAMPLES_PER_UPDATE-writeCursor;
|
buffer[i] = sin(2*PI*sineIndex/wavelength);
|
||||||
|
sineIndex++;
|
||||||
|
|
||||||
// Limit to the maximum readable size
|
if (sineIndex >= wavelength)
|
||||||
int readLength = waveLength-readCursor;
|
{
|
||||||
|
sineFrequency = newSineFrequency;
|
||||||
if (writeLength > readLength) writeLength = readLength;
|
sineIndex = 0;
|
||||||
|
sineStartTime = GetTime();
|
||||||
// Write the slice
|
}
|
||||||
memcpy(writeBuf + writeCursor, data + readCursor, writeLength*sizeof(short));
|
|
||||||
|
|
||||||
// Update cursors and loop audio
|
|
||||||
readCursor = (readCursor + writeLength) % waveLength;
|
|
||||||
|
|
||||||
writeCursor += writeLength;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy finished frame to audio stream
|
UpdateAudioStream(stream, buffer, BUFFER_SIZE);
|
||||||
UpdateAudioStream(stream, writeBuf, MAX_SAMPLES_PER_UPDATE);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText(TextFormat("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
|
DrawText(TextFormat("sine frequency: %i", sineFrequency), screenWidth - 220, 10, 20, RED);
|
||||||
DrawText("click mouse button to change frequency or pan", 10, 10, 20, DARKGRAY);
|
DrawText(TextFormat("pan: %.2f", pan), screenWidth - 220, 30, 20, RED);
|
||||||
|
DrawText("Up/down to change frequency", 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText("Left/right to pan", 10, 30, 20, DARKGRAY);
|
||||||
|
|
||||||
// Draw the current buffer state proportionate to the screen
|
int windowStart = (GetTime() - sineStartTime)*SAMPLE_RATE;
|
||||||
|
int windowSize = 0.1f*SAMPLE_RATE;
|
||||||
|
int wavelength = SAMPLE_RATE/sineFrequency;
|
||||||
|
|
||||||
|
// Draw a sine wave with the same frequency as the one being sent to the audio stream
|
||||||
for (int i = 0; i < screenWidth; i++)
|
for (int i = 0; i < screenWidth; i++)
|
||||||
{
|
{
|
||||||
position.x = (float)i;
|
int t0 = windowStart + i*windowSize/screenWidth;
|
||||||
position.y = 250 + 50*data[i*MAX_SAMPLES/screenWidth]/32000.0f;
|
int t1 = windowStart + (i + 1)*windowSize/screenWidth;
|
||||||
|
Vector2 startPos = { i, 250 + 50*sin(2*PI*t0/wavelength) };
|
||||||
DrawPixelV(position, RED);
|
Vector2 endPos = { i + 1, 250 + 50*sin(2*PI*t1/wavelength) };
|
||||||
|
DrawLineV(startPos, endPos, RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
@ -201,9 +136,6 @@ int main(void)
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
free(data); // Unload sine wave data
|
|
||||||
free(writeBuf); // Unload write buffer
|
|
||||||
|
|
||||||
UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -60,7 +60,7 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera, CAMERA_FREE);
|
UpdateCamera(&camera, CAMERA_FREE);
|
||||||
|
|
||||||
float th = GetTime();
|
float th = (float)GetTime();
|
||||||
|
|
||||||
Vector3 spherePos = {
|
Vector3 spherePos = {
|
||||||
.x = 5.0f*cosf(th),
|
.x = 5.0f*cosf(th),
|
||||||
@ -68,7 +68,8 @@ int main(void)
|
|||||||
.z = 5.0f*sinf(th)
|
.z = 5.0f*sinf(th)
|
||||||
};
|
};
|
||||||
|
|
||||||
SetSoundPosition(camera, sound, spherePos, 20.0f);
|
SetSoundPosition(camera, sound, spherePos, 1.0f);
|
||||||
|
|
||||||
if (!IsSoundPlaying(sound)) PlaySound(sound);
|
if (!IsSoundPlaying(sound)) PlaySound(sound);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -94,6 +95,8 @@ int main(void)
|
|||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|||||||
285
examples/audio/audio_spectrum_visualizer.c
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - spectrum visualizer
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Inspired by Inigo Quilez's https://www.shadertoy.com/
|
||||||
|
* Resources/specification: https://gist.github.com/soulthreads/2efe50da4be1fb5f7ab60ff14ca434b8
|
||||||
|
*
|
||||||
|
* Example created by created by IANN (@meisei4) reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 IANN (@meisei4)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MONO 1
|
||||||
|
#define SAMPLE_RATE 44100
|
||||||
|
#define SAMPLE_RATE_F 44100.0f
|
||||||
|
#define FFT_WINDOW_SIZE 1024
|
||||||
|
#define BUFFER_SIZE 512
|
||||||
|
#define PER_SAMPLE_BIT_DEPTH 16
|
||||||
|
#define AUDIO_STREAM_RING_BUFFER_SIZE (FFT_WINDOW_SIZE*2)
|
||||||
|
#define EFFECTIVE_SAMPLE_RATE (SAMPLE_RATE_F*0.5f)
|
||||||
|
#define WINDOW_TIME ((double)FFT_WINDOW_SIZE/(double)EFFECTIVE_SAMPLE_RATE)
|
||||||
|
#define FFT_HISTORICAL_SMOOTHING_DUR 2.0f
|
||||||
|
#define MIN_DECIBELS (-100.0f) // https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/minDecibels
|
||||||
|
#define MAX_DECIBELS (-30.0f) // https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/maxDecibels
|
||||||
|
#define INVERSE_DECIBEL_RANGE (1.0f/(MAX_DECIBELS - MIN_DECIBELS))
|
||||||
|
#define DB_TO_LINEAR_SCALE (20.0f/2.302585092994046f)
|
||||||
|
#define SMOOTHING_TIME_CONSTANT 0.8f // https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/smoothingTimeConstant
|
||||||
|
#define TEXTURE_HEIGHT 1
|
||||||
|
#define FFT_ROW 0
|
||||||
|
#define UNUSED_CHANNEL 0.0f
|
||||||
|
|
||||||
|
typedef struct FFTComplex { float real, imaginary; } FFTComplex;
|
||||||
|
|
||||||
|
typedef struct FFTData {
|
||||||
|
FFTComplex *spectrum;
|
||||||
|
FFTComplex *workBuffer;
|
||||||
|
float *prevMagnitudes;
|
||||||
|
float (*fftHistory)[BUFFER_SIZE];
|
||||||
|
int fftHistoryLen;
|
||||||
|
int historyPos;
|
||||||
|
double lastFftTime;
|
||||||
|
float tapbackPos;
|
||||||
|
} FFTData;
|
||||||
|
|
||||||
|
static void CaptureFrame(FFTData *fftData, const float *audioSamples);
|
||||||
|
static void RenderFrame(const FFTData *fftData, Image *fftImage);
|
||||||
|
static void CooleyTukeyFFTSlow(FFTComplex *spectrum, int n);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//----------------------------------------------------------------------------------- ---
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - spectrum visualizer");
|
||||||
|
|
||||||
|
Image fftImage = GenImageColor(BUFFER_SIZE, TEXTURE_HEIGHT, WHITE);
|
||||||
|
Texture2D fftTexture = LoadTextureFromImage(fftImage);
|
||||||
|
RenderTexture2D bufferA = LoadRenderTexture(screenWidth, screenHeight);
|
||||||
|
Vector2 iResolution = { (float)screenWidth, (float)screenHeight };
|
||||||
|
|
||||||
|
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/fft.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
int iResolutionLocation = GetShaderLocation(shader, "iResolution");
|
||||||
|
int iChannel0Location = GetShaderLocation(shader, "iChannel0");
|
||||||
|
SetShaderValue(shader, iResolutionLocation, &iResolution, SHADER_UNIFORM_VEC2);
|
||||||
|
SetShaderValueTexture(shader, iChannel0Location, fftTexture);
|
||||||
|
|
||||||
|
InitAudioDevice();
|
||||||
|
SetAudioStreamBufferSizeDefault(AUDIO_STREAM_RING_BUFFER_SIZE);
|
||||||
|
|
||||||
|
// WARNING: Memory out-of-bounds on PLATFORM_WEB
|
||||||
|
Wave wav = LoadWave("resources/country.mp3");
|
||||||
|
WaveFormat(&wav, SAMPLE_RATE, PER_SAMPLE_BIT_DEPTH, MONO);
|
||||||
|
|
||||||
|
AudioStream audioStream = LoadAudioStream(SAMPLE_RATE, PER_SAMPLE_BIT_DEPTH, MONO);
|
||||||
|
PlayAudioStream(audioStream);
|
||||||
|
|
||||||
|
int fftHistoryLen = (int)ceilf(FFT_HISTORICAL_SMOOTHING_DUR/WINDOW_TIME) + 1;
|
||||||
|
|
||||||
|
FFTData fft = {
|
||||||
|
.spectrum = RL_CALLOC(sizeof(FFTComplex), FFT_WINDOW_SIZE),
|
||||||
|
.workBuffer = RL_CALLOC(sizeof(FFTComplex), FFT_WINDOW_SIZE),
|
||||||
|
.prevMagnitudes = RL_CALLOC(BUFFER_SIZE, sizeof(float)),
|
||||||
|
.fftHistory = RL_CALLOC(fftHistoryLen, sizeof(float[BUFFER_SIZE])),
|
||||||
|
.fftHistoryLen = fftHistoryLen,
|
||||||
|
.historyPos = 0,
|
||||||
|
.lastFftTime = 0.0,
|
||||||
|
.tapbackPos = 0.01f
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int wavCursor = 0;
|
||||||
|
const short *wavPCM16 = wav.data;
|
||||||
|
|
||||||
|
short chunkSamples[AUDIO_STREAM_RING_BUFFER_SIZE] = { 0 };
|
||||||
|
float audioSamples[FFT_WINDOW_SIZE] = { 0 };
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
while (IsAudioStreamProcessed(audioStream))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < AUDIO_STREAM_RING_BUFFER_SIZE; i++)
|
||||||
|
{
|
||||||
|
int left = (wav.channels == 2)? wavPCM16[wavCursor*2 + 0] : wavPCM16[wavCursor];
|
||||||
|
int right = (wav.channels == 2)? wavPCM16[wavCursor*2 + 1] : left;
|
||||||
|
chunkSamples[i] = (short)((left + right)/2);
|
||||||
|
|
||||||
|
if (++wavCursor >= wav.frameCount) wavCursor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAudioStream(audioStream, chunkSamples, AUDIO_STREAM_RING_BUFFER_SIZE);
|
||||||
|
|
||||||
|
for (int i = 0; i < FFT_WINDOW_SIZE; i++) audioSamples[i] = (chunkSamples[i*2] + chunkSamples[i*2 + 1])*0.5f/32767.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
CaptureFrame(&fft, audioSamples);
|
||||||
|
RenderFrame(&fft, &fftImage);
|
||||||
|
UpdateTexture(fftTexture, fftImage.data);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginShaderMode(shader);
|
||||||
|
SetShaderValueTexture(shader, iChannel0Location, fftTexture);
|
||||||
|
DrawTextureRec(bufferA.texture,
|
||||||
|
(Rectangle){ 0, 0, (float)screenWidth, (float)-screenHeight },
|
||||||
|
(Vector2){ 0, 0 }, WHITE);
|
||||||
|
EndShaderMode();
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadShader(shader);
|
||||||
|
UnloadRenderTexture(bufferA);
|
||||||
|
UnloadTexture(fftTexture);
|
||||||
|
UnloadImage(fftImage);
|
||||||
|
UnloadAudioStream(audioStream);
|
||||||
|
UnloadWave(wav);
|
||||||
|
CloseAudioDevice();
|
||||||
|
|
||||||
|
RL_FREE(fft.spectrum);
|
||||||
|
RL_FREE(fft.workBuffer);
|
||||||
|
RL_FREE(fft.prevMagnitudes);
|
||||||
|
RL_FREE(fft.fftHistory);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cooley–Tukey FFT https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#Data_reordering,_bit_reversal,_and_in-place_algorithms
|
||||||
|
static void CooleyTukeyFFTSlow(FFTComplex *spectrum, int n)
|
||||||
|
{
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 1; i < n - 1; i++)
|
||||||
|
{
|
||||||
|
int bit = n >> 1;
|
||||||
|
while (j >= bit)
|
||||||
|
{
|
||||||
|
j -= bit;
|
||||||
|
bit >>= 1;
|
||||||
|
}
|
||||||
|
j += bit;
|
||||||
|
if (i < j)
|
||||||
|
{
|
||||||
|
FFTComplex temp = spectrum[i];
|
||||||
|
spectrum[i] = spectrum[j];
|
||||||
|
spectrum[j] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int len = 2; len <= n; len <<= 1)
|
||||||
|
{
|
||||||
|
float angle = -2.0f*PI/len;
|
||||||
|
FFTComplex twiddleUnit = { cosf(angle), sinf(angle) };
|
||||||
|
for (int i = 0; i < n; i += len)
|
||||||
|
{
|
||||||
|
FFTComplex twiddleCurrent = { 1.0f, 0.0f };
|
||||||
|
for (int j = 0; j < len/2; j++)
|
||||||
|
{
|
||||||
|
FFTComplex even = spectrum[i + j];
|
||||||
|
FFTComplex odd = spectrum[i + j + len/2];
|
||||||
|
FFTComplex twiddledOdd = {
|
||||||
|
odd.real*twiddleCurrent.real - odd.imaginary*twiddleCurrent.imaginary,
|
||||||
|
odd.real*twiddleCurrent.imaginary + odd.imaginary*twiddleCurrent.real
|
||||||
|
};
|
||||||
|
|
||||||
|
spectrum[i + j].real = even.real + twiddledOdd.real;
|
||||||
|
spectrum[i + j].imaginary = even.imaginary + twiddledOdd.imaginary;
|
||||||
|
spectrum[i + j + len/2].real = even.real - twiddledOdd.real;
|
||||||
|
spectrum[i + j + len/2].imaginary = even.imaginary - twiddledOdd.imaginary;
|
||||||
|
|
||||||
|
float twiddleRealNext = twiddleCurrent.real*twiddleUnit.real - twiddleCurrent.imaginary*twiddleUnit.imaginary;
|
||||||
|
twiddleCurrent.imaginary = twiddleCurrent.real*twiddleUnit.imaginary + twiddleCurrent.imaginary*twiddleUnit.real;
|
||||||
|
twiddleCurrent.real = twiddleRealNext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CaptureFrame(FFTData *fftData, const float *audioSamples)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < FFT_WINDOW_SIZE; i++)
|
||||||
|
{
|
||||||
|
float x = (2.0f*PI*i)/(FFT_WINDOW_SIZE - 1.0f);
|
||||||
|
float blackmanWeight = 0.42f - 0.5f*cosf(x) + 0.08f*cosf(2.0f*x); // https://en.wikipedia.org/wiki/Window_function#Blackman_window
|
||||||
|
fftData->workBuffer[i].real = audioSamples[i]*blackmanWeight;
|
||||||
|
fftData->workBuffer[i].imaginary = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
CooleyTukeyFFTSlow(fftData->workBuffer, FFT_WINDOW_SIZE);
|
||||||
|
memcpy(fftData->spectrum, fftData->workBuffer, sizeof(FFTComplex)*FFT_WINDOW_SIZE);
|
||||||
|
|
||||||
|
float smoothedSpectrum[BUFFER_SIZE];
|
||||||
|
|
||||||
|
for (int bin = 0; bin < BUFFER_SIZE; bin++)
|
||||||
|
{
|
||||||
|
float re = fftData->workBuffer[bin].real;
|
||||||
|
float im = fftData->workBuffer[bin].imaginary;
|
||||||
|
float linearMagnitude = sqrtf(re*re + im*im)/FFT_WINDOW_SIZE;
|
||||||
|
|
||||||
|
float smoothedMagnitude = SMOOTHING_TIME_CONSTANT*fftData->prevMagnitudes[bin] + (1.0f - SMOOTHING_TIME_CONSTANT)*linearMagnitude;
|
||||||
|
fftData->prevMagnitudes[bin] = smoothedMagnitude;
|
||||||
|
|
||||||
|
float db = logf(fmaxf(smoothedMagnitude, 1e-40f))*DB_TO_LINEAR_SCALE;
|
||||||
|
float normalized = (db - MIN_DECIBELS)*INVERSE_DECIBEL_RANGE;
|
||||||
|
smoothedSpectrum[bin] = Clamp(normalized, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
fftData->lastFftTime = GetTime();
|
||||||
|
memcpy(fftData->fftHistory[fftData->historyPos], smoothedSpectrum, sizeof(smoothedSpectrum));
|
||||||
|
fftData->historyPos = (fftData->historyPos + 1)%fftData->fftHistoryLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void RenderFrame(const FFTData *fftData, Image *fftImage)
|
||||||
|
{
|
||||||
|
float framesSinceTapback = floorf((float)(fftData->tapbackPos/WINDOW_TIME));
|
||||||
|
framesSinceTapback = Clamp(framesSinceTapback, 0.0f, (float)(fftData->fftHistoryLen - 1));
|
||||||
|
|
||||||
|
int historyPosition = (fftData->historyPos - 1 - (int)framesSinceTapback)%fftData->fftHistoryLen;
|
||||||
|
if (historyPosition < 0) historyPosition += fftData->fftHistoryLen;
|
||||||
|
|
||||||
|
const float *amplitude = fftData->fftHistory[historyPosition];
|
||||||
|
for (int bin = 0; bin < BUFFER_SIZE; bin++) ImageDrawPixel(fftImage, bin, FFT_ROW, ColorFromNormalized((Vector4){ amplitude[bin], UNUSED_CHANNEL, UNUSED_CHANNEL, UNUSED_CHANNEL }));
|
||||||
|
}
|
||||||
BIN
examples/audio/audio_spectrum_visualizer.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
246
examples/audio/audio_stream_callback.c
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - stream callback
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example created by Dan Hoang (@dan-hoang) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* NOTE: Example sends a wave to the audio device,
|
||||||
|
* user gets the choice of four waves: sine, square, triangle, and sawtooth
|
||||||
|
* A stream is set up to play to the audio device; stream is hooked to a callback that
|
||||||
|
* generates a wave, that is determined by user choice
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2026 Dan Hoang (@dan-hoang)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define BUFFER_SIZE 4096
|
||||||
|
#define SAMPLE_RATE 44100
|
||||||
|
|
||||||
|
// Wave type
|
||||||
|
typedef enum {
|
||||||
|
SINE,
|
||||||
|
SQUARE,
|
||||||
|
TRIANGLE,
|
||||||
|
SAWTOOTH
|
||||||
|
} WaveType;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static void SineCallback(void *framesOut, unsigned int frameCount);
|
||||||
|
static void SquareCallback(void *framesOut, unsigned int frameCount);
|
||||||
|
static void TriangleCallback(void *framesOut, unsigned int frameCount);
|
||||||
|
static void SawtoothCallback(void *framesOut, unsigned int frameCount);
|
||||||
|
|
||||||
|
static int waveFrequency = 440;
|
||||||
|
static int newWaveFrequency = 440;
|
||||||
|
static int waveIndex = 0;
|
||||||
|
|
||||||
|
// Buffer to keep the last second of uploaded audio,
|
||||||
|
// part of which will be drawn on the screen
|
||||||
|
static float buffer[SAMPLE_RATE] = { 0 };
|
||||||
|
static AudioCallback waveCallbacks[] = { SineCallback, SquareCallback, TriangleCallback, SawtoothCallback };
|
||||||
|
static char *waveTypesAsString[] = { "sine", "square", "triangle", "sawtooth" };
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - stream callback");
|
||||||
|
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
|
// Set the number of samples the stream will keep in memory at a time to BUFFER_SIZE
|
||||||
|
SetAudioStreamBufferSizeDefault(BUFFER_SIZE);
|
||||||
|
|
||||||
|
// Init raw audio stream (sample rate: 44100, sample size: 32bit-float, channels: 1-mono)
|
||||||
|
AudioStream stream = LoadAudioStream(SAMPLE_RATE, 32, 1);
|
||||||
|
PlayAudioStream(stream);
|
||||||
|
|
||||||
|
// Configure it so that waveCallbacks[waveType] is called whenever stream is out of samples
|
||||||
|
WaveType waveType = SINE;
|
||||||
|
SetAudioStreamCallback(stream, waveCallbacks[waveType]);
|
||||||
|
|
||||||
|
SetTargetFPS(30);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyDown(KEY_UP))
|
||||||
|
{
|
||||||
|
newWaveFrequency += 10;
|
||||||
|
if (newWaveFrequency > 12500) newWaveFrequency = 12500;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyDown(KEY_DOWN))
|
||||||
|
{
|
||||||
|
newWaveFrequency -= 10;
|
||||||
|
if (newWaveFrequency < 20) newWaveFrequency = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_LEFT))
|
||||||
|
{
|
||||||
|
if (waveType == SINE) waveType = SAWTOOTH;
|
||||||
|
else if (waveType == SQUARE) waveType = SINE;
|
||||||
|
else if (waveType == TRIANGLE) waveType = SQUARE;
|
||||||
|
else waveType = TRIANGLE;
|
||||||
|
|
||||||
|
SetAudioStreamCallback(stream, waveCallbacks[waveType]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
if (waveType == SINE) waveType = SQUARE;
|
||||||
|
else if (waveType == SQUARE) waveType = TRIANGLE;
|
||||||
|
else if (waveType == TRIANGLE) waveType = SAWTOOTH;
|
||||||
|
else waveType = SINE;
|
||||||
|
|
||||||
|
SetAudioStreamCallback(stream, waveCallbacks[waveType]);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
DrawText(TextFormat("frequency: %i", newWaveFrequency), screenWidth - 220, 10, 20, RED);
|
||||||
|
DrawText(TextFormat("wave type: %s", waveTypesAsString[waveType]), screenWidth - 220, 30, 20, RED);
|
||||||
|
DrawText("Up/down to change frequency", 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText("Left/right to change wave type", 10, 30, 20, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw the last 10 ms of uploaded audio
|
||||||
|
for (int i = 0; i < screenWidth; i++)
|
||||||
|
{
|
||||||
|
Vector2 startPos = { i, 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + i*SAMPLE_RATE/100/screenWidth] };
|
||||||
|
Vector2 endPos = { i + 1, 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + (i + 1)*SAMPLE_RATE/100/screenWidth] };
|
||||||
|
DrawLineV(startPos, endPos, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
|
||||||
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static void SineCallback(void *framesOut, unsigned int frameCount)
|
||||||
|
{
|
||||||
|
int wavelength = SAMPLE_RATE/waveFrequency;
|
||||||
|
|
||||||
|
// Synthesize the sine wave
|
||||||
|
for (int i = 0; i < frameCount; i++)
|
||||||
|
{
|
||||||
|
((float *)framesOut)[i] = sin(2*PI*waveIndex/wavelength);
|
||||||
|
|
||||||
|
waveIndex++;
|
||||||
|
|
||||||
|
if (waveIndex >= wavelength)
|
||||||
|
{
|
||||||
|
waveFrequency = newWaveFrequency;
|
||||||
|
waveIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the synthesized samples for later drawing
|
||||||
|
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
|
||||||
|
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SquareCallback(void *framesOut, unsigned int frameCount)
|
||||||
|
{
|
||||||
|
int wavelength = SAMPLE_RATE/waveFrequency;
|
||||||
|
|
||||||
|
// Synthesize the square wave
|
||||||
|
for (int i = 0; i < frameCount; i++)
|
||||||
|
{
|
||||||
|
((float *)framesOut)[i] = (waveIndex < wavelength/2)? 1 : -1;
|
||||||
|
waveIndex++;
|
||||||
|
|
||||||
|
if (waveIndex >= wavelength)
|
||||||
|
{
|
||||||
|
waveFrequency = newWaveFrequency;
|
||||||
|
waveIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the synthesized samples for later drawing
|
||||||
|
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
|
||||||
|
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TriangleCallback(void *framesOut, unsigned int frameCount)
|
||||||
|
{
|
||||||
|
int wavelength = SAMPLE_RATE/waveFrequency;
|
||||||
|
|
||||||
|
// Synthesize the triangle wave
|
||||||
|
for (int i = 0; i < frameCount; i++)
|
||||||
|
{
|
||||||
|
((float *)framesOut)[i] = (waveIndex < wavelength/2)? (-1 + 2.0f*waveIndex/(wavelength/2)) : (1 - 2.0f*(waveIndex - wavelength/2)/(wavelength/2));
|
||||||
|
waveIndex++;
|
||||||
|
|
||||||
|
if (waveIndex >= wavelength)
|
||||||
|
{
|
||||||
|
waveFrequency = newWaveFrequency;
|
||||||
|
waveIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the synthesized samples for later drawing
|
||||||
|
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
|
||||||
|
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SawtoothCallback(void *framesOut, unsigned int frameCount)
|
||||||
|
{
|
||||||
|
int wavelength = SAMPLE_RATE/waveFrequency;
|
||||||
|
|
||||||
|
// Synthesize the sawtooth wave
|
||||||
|
for (int i = 0; i < frameCount; i++)
|
||||||
|
{
|
||||||
|
((float *)framesOut)[i] = -1 + 2.0f*waveIndex/wavelength;
|
||||||
|
waveIndex++;
|
||||||
|
|
||||||
|
if (waveIndex >= wavelength)
|
||||||
|
{
|
||||||
|
waveFrequency = newWaveFrequency;
|
||||||
|
waveIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the synthesized samples for later drawing
|
||||||
|
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
|
||||||
|
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
|
||||||
|
}
|
||||||
BIN
examples/audio/audio_stream_callback.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
6051
examples/audio/raygui.h
Normal file
37
examples/audio/resources/shaders/glsl100/fft.fs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform vec2 iResolution;
|
||||||
|
uniform sampler2D iChannel0;
|
||||||
|
|
||||||
|
const vec4 BLACK = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
const vec4 WHITE = vec4(1.0, 1.0, 1.0, 1.0);
|
||||||
|
const float FFT_ROW = 0.0;
|
||||||
|
const float NUM_OF_BINS = 512.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 fragCoord = fragTexCoord*iResolution;
|
||||||
|
float cellWidth = iResolution.x/NUM_OF_BINS;
|
||||||
|
float binIndex = floor(fragCoord.x/cellWidth);
|
||||||
|
float localX = mod(fragCoord.x, cellWidth);
|
||||||
|
float barWidth = cellWidth - 1.0;
|
||||||
|
vec4 color = WHITE;
|
||||||
|
|
||||||
|
if (localX <= barWidth)
|
||||||
|
{
|
||||||
|
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
|
||||||
|
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
|
||||||
|
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
|
||||||
|
|
||||||
|
if (fragTexCoord.y < amplitude) color = BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
35
examples/audio/resources/shaders/glsl120/fft.fs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#version 120
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform vec2 iResolution;
|
||||||
|
uniform sampler2D iChannel0;
|
||||||
|
|
||||||
|
const vec4 BLACK = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
const vec4 WHITE = vec4(1.0, 1.0, 1.0, 1.0);
|
||||||
|
const float FFT_ROW = 0.0;
|
||||||
|
const float NUM_OF_BINS = 512.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 fragCoord = fragTexCoord*iResolution;
|
||||||
|
float cellWidth = iResolution.x/NUM_OF_BINS;
|
||||||
|
float binIndex = floor(fragCoord.x/cellWidth);
|
||||||
|
float localX = mod(fragCoord.x, cellWidth);
|
||||||
|
float barWidth = cellWidth - 1.0;
|
||||||
|
vec4 color = WHITE;
|
||||||
|
|
||||||
|
if (localX <= barWidth)
|
||||||
|
{
|
||||||
|
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
|
||||||
|
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
|
||||||
|
float amplitude = texture2D(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
|
||||||
|
|
||||||
|
if (fragTexCoord.y < amplitude) color = BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
35
examples/audio/resources/shaders/glsl330/fft.fs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
uniform vec2 iResolution;
|
||||||
|
uniform sampler2D iChannel0;
|
||||||
|
|
||||||
|
const vec4 BLACK = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
const vec4 WHITE = vec4(1.0, 1.0, 1.0, 1.0);
|
||||||
|
const float FFT_ROW = 0.0;
|
||||||
|
const float NUM_OF_BINS = 512.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 fragCoord = fragTexCoord*iResolution;
|
||||||
|
float cellWidth = iResolution.x/NUM_OF_BINS;
|
||||||
|
float binIndex = floor(fragCoord.x/cellWidth);
|
||||||
|
float localX = mod(fragCoord.x, cellWidth);
|
||||||
|
float barWidth = cellWidth - 1.0;
|
||||||
|
vec4 color = WHITE;
|
||||||
|
|
||||||
|
if (localX <= barWidth)
|
||||||
|
{
|
||||||
|
float sampleX = (binIndex + 0.5)/NUM_OF_BINS;
|
||||||
|
vec2 sampleCoord = vec2(sampleX, FFT_ROW);
|
||||||
|
float amplitude = texture(iChannel0, sampleCoord).r; // Only filled the red channel, all channels left open for alternative use
|
||||||
|
|
||||||
|
if (fragTexCoord.y < amplitude) color = BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
finalColor = color;
|
||||||
|
}
|
||||||
@ -125,8 +125,8 @@ int main(void)
|
|||||||
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 250, 113, BLUE);
|
DrawRectangleLines( 10, 10, 250, 113, BLUE);
|
||||||
|
|
||||||
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK);
|
DrawText("Free 2D camera controls:", 20, 20, 10, BLACK);
|
||||||
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY);
|
DrawText("- Right/Left to move player", 40, 40, 10, DARKGRAY);
|
||||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
|
||||||
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
|
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
|
||||||
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
|
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 8.3 KiB |
@ -23,7 +23,7 @@
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
int main ()
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@ -35,9 +35,9 @@ int main ()
|
|||||||
Camera2D camera = { 0 };
|
Camera2D camera = { 0 };
|
||||||
camera.zoom = 1.0f;
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
int zoomMode = 0; // 0-Mouse Wheel, 1-Mouse Move
|
int zoomMode = 0; // 0-Mouse Wheel, 1-Mouse Move
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@ -93,6 +93,7 @@ int main ()
|
|||||||
// under the cursor to the screen space point under the cursor at any zoom
|
// under the cursor to the screen space point under the cursor at any zoom
|
||||||
camera.target = mouseWorldPos;
|
camera.target = mouseWorldPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
||||||
{
|
{
|
||||||
// Zoom increment
|
// Zoom increment
|
||||||
@ -110,7 +111,6 @@ int main ()
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginMode2D(camera);
|
BeginMode2D(camera);
|
||||||
|
|
||||||
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
|
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
|
||||||
// just so we have something in the XY plane
|
// just so we have something in the XY plane
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
@ -121,7 +121,6 @@ int main ()
|
|||||||
|
|
||||||
// Draw a reference circle
|
// Draw a reference circle
|
||||||
DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON);
|
DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON);
|
||||||
|
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
// Draw mouse reference
|
// Draw mouse reference
|
||||||
@ -142,5 +141,6 @@ int main ()
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,10 +148,11 @@ int main(void)
|
|||||||
DrawText("Controls:", 20, 20, 10, BLACK);
|
DrawText("Controls:", 20, 20, 10, BLACK);
|
||||||
DrawText("- Right/Left to move", 40, 40, 10, DARKGRAY);
|
DrawText("- Right/Left to move", 40, 40, 10, DARKGRAY);
|
||||||
DrawText("- Space to jump", 40, 60, 10, DARKGRAY);
|
DrawText("- Space to jump", 40, 60, 10, DARKGRAY);
|
||||||
DrawText("- Mouse Wheel to Zoom in-out, R to reset zoom", 40, 80, 10, DARKGRAY);
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 80, 10, DARKGRAY);
|
||||||
DrawText("- C to change camera mode", 40, 100, 10, DARKGRAY);
|
DrawText("- R to reset position + zoom", 40, 100, 10, DARKGRAY);
|
||||||
DrawText("Current camera mode:", 20, 120, 10, BLACK);
|
DrawText("- C to change camera mode", 40, 120, 10, DARKGRAY);
|
||||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, DARKGRAY);
|
DrawText("Current camera mode:", 20, 140, 10, BLACK);
|
||||||
|
DrawText(cameraDescriptions[cameraOption], 40, 160, 10, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -226,10 +227,10 @@ void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envI
|
|||||||
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, *camera);
|
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, *camera);
|
||||||
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, *camera);
|
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, *camera);
|
||||||
|
|
||||||
if (max.x < width) camera->offset.x = width - (max.x - width/2);
|
if (max.x < width) camera->offset.x = width - (max.x - (float)width/2);
|
||||||
if (max.y < height) camera->offset.y = height - (max.y - height/2);
|
if (max.y < height) camera->offset.y = height - (max.y - (float)height/2);
|
||||||
if (min.x > 0) camera->offset.x = width/2 - min.x;
|
if (min.x > 0) camera->offset.x = (float)width/2 - min.x;
|
||||||
if (min.y > 0) camera->offset.y = height/2 - min.y;
|
if (min.y > 0) camera->offset.y = (float)height/2 - min.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||||
|
|||||||
@ -119,7 +119,6 @@ int main(void)
|
|||||||
// Some default standard keyboard/mouse inputs are hardcoded to simplify use
|
// Some default standard keyboard/mouse inputs are hardcoded to simplify use
|
||||||
// For advanced camera controls, it's recommended to compute camera movement manually
|
// For advanced camera controls, it's recommended to compute camera movement manually
|
||||||
UpdateCamera(&camera, cameraMode); // Update camera
|
UpdateCamera(&camera, cameraMode); // Update camera
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Camera PRO usage example (EXPERIMENTAL)
|
// Camera PRO usage example (EXPERIMENTAL)
|
||||||
// This new camera function allows custom movement/rotation values to be directly provided
|
// This new camera function allows custom movement/rotation values to be directly provided
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
*
|
*
|
||||||
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
*
|
*
|
||||||
* Example contributed by Agnis Aldins (@nezvers) and reviewed by Ramon Santamaria (@raysan5)
|
* Example contributed by Agnis Aldiņš (@nezvers) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software
|
* BSD-like license that allows static linking with closed source software
|
||||||
*
|
*
|
||||||
* Copyright (c) 2025 Agnis Aldins (@nezvers)
|
* Copyright (c) 2025 Agnis Aldiņš (@nezvers)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@ -198,8 +198,8 @@ void UpdateBody(Body *body, float rot, char side, char forward, bool jumpPressed
|
|||||||
//PlaySound(fxJump);
|
//PlaySound(fxJump);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 front = (Vector3){ sin(rot), 0.f, cos(rot) };
|
Vector3 front = (Vector3){ sinf(rot), 0.f, cosf(rot) };
|
||||||
Vector3 right = (Vector3){ cos(-rot), 0.f, sin(-rot) };
|
Vector3 right = (Vector3){ cosf(-rot), 0.f, sinf(-rot) };
|
||||||
|
|
||||||
Vector3 desiredDir = (Vector3){ input.x*right.x + input.y*front.x, 0.0f, input.x*right.z + input.y*front.z, };
|
Vector3 desiredDir = (Vector3){ input.x*right.x + input.y*front.x, 0.0f, input.x*right.z + input.y*front.z, };
|
||||||
body->dir = Vector3Lerp(body->dir, desiredDir, CONTROL*delta);
|
body->dir = Vector3Lerp(body->dir, desiredDir, CONTROL*delta);
|
||||||
@ -267,8 +267,8 @@ static void UpdateCameraFPS(Camera *camera)
|
|||||||
|
|
||||||
// Head animation
|
// Head animation
|
||||||
// Rotate up direction around forward axis
|
// Rotate up direction around forward axis
|
||||||
float headSin = sin(headTimer*PI);
|
float headSin = sinf(headTimer*PI);
|
||||||
float headCos = cos(headTimer*PI);
|
float headCos = cosf(headTimer*PI);
|
||||||
const float stepRotation = 0.01f;
|
const float stepRotation = 0.01f;
|
||||||
camera->up = Vector3RotateByAxisAngle(up, pitch, headSin*stepRotation + lean.x);
|
camera->up = Vector3RotateByAxisAngle(up, pitch, headSin*stepRotation + lean.x);
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera, CAMERA_FREE);
|
UpdateCamera(&camera, CAMERA_FREE);
|
||||||
|
|
||||||
if (IsKeyPressed('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
if (IsKeyPressed(KEY_Z)) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|||||||
@ -225,10 +225,10 @@ int main(void)
|
|||||||
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, camera);
|
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, camera);
|
||||||
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, camera);
|
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, camera);
|
||||||
|
|
||||||
if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - screenWidth/2);
|
if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - (float)screenWidth/2);
|
||||||
if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - screenHeight/2);
|
if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - (float)screenHeight/2);
|
||||||
if (min.x > 0) camera.offset.x = screenWidth/2 - min.x;
|
if (min.x > 0) camera.offset.x = (float)screenWidth/2 - min.x;
|
||||||
if (min.y > 0) camera.offset.y = screenHeight/2 - min.y;
|
if (min.y > 0) camera.offset.y = (float)screenHeight/2 - min.y;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Events management
|
// Events management
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software
|
* BSD-like license that allows static linking with closed source software
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|||||||
164
examples/core/core_clipboard_text.c
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - clipboard text
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by Ananth S (@Ananth1839) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Ananth S (@Ananth1839)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h"
|
||||||
|
|
||||||
|
#define MAX_TEXT_SAMPLES 5
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - clipboard text");
|
||||||
|
|
||||||
|
// Define some sample texts
|
||||||
|
const char *sampleTexts[MAX_TEXT_SAMPLES] = {
|
||||||
|
"Hello from raylib!",
|
||||||
|
"The quick brown fox jumps over the lazy dog",
|
||||||
|
"Clipboard operations are useful!",
|
||||||
|
"raylib is a simple and easy-to-use library",
|
||||||
|
"Copy and paste me!"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *clipboardText = NULL;
|
||||||
|
char inputBuffer[256] = "Hello from raylib!"; // Random initial string
|
||||||
|
|
||||||
|
// UI required variables
|
||||||
|
bool textBoxEditMode = false;
|
||||||
|
|
||||||
|
bool btnCutPressed = false;
|
||||||
|
bool btnCopyPressed = false;
|
||||||
|
bool btnPastePressed = false;
|
||||||
|
bool btnClearPressed = false;
|
||||||
|
bool btnRandomPressed = false;
|
||||||
|
|
||||||
|
// Set UI style
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 20);
|
||||||
|
GuiSetIconScale(2);
|
||||||
|
|
||||||
|
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
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Handle button interactions
|
||||||
|
if (btnCutPressed)
|
||||||
|
{
|
||||||
|
SetClipboardText(inputBuffer);
|
||||||
|
clipboardText = GetClipboardText();
|
||||||
|
inputBuffer[0] = '\0'; // Quick solution to clear text
|
||||||
|
//memset(inputBuffer, 0, 256); // Clear full buffer properly
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btnCopyPressed)
|
||||||
|
{
|
||||||
|
SetClipboardText(inputBuffer); // Copy text to clipboard
|
||||||
|
clipboardText = GetClipboardText(); // Get text from clipboard
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btnPastePressed)
|
||||||
|
{
|
||||||
|
// Paste text from clipboard
|
||||||
|
clipboardText = GetClipboardText();
|
||||||
|
if (clipboardText != NULL) TextCopy(inputBuffer, clipboardText);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btnClearPressed)
|
||||||
|
{
|
||||||
|
inputBuffer[0] = '\0'; // Quick solution to clear text
|
||||||
|
//memset(inputBuffer, 0, 256); // Clear full buffer properly
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btnRandomPressed)
|
||||||
|
{
|
||||||
|
// Get random text from sample list
|
||||||
|
TextCopy(inputBuffer, sampleTexts[GetRandomValue(0, MAX_TEXT_SAMPLES - 1)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quick cut/copy/paste with keyboard shortcuts
|
||||||
|
if (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))
|
||||||
|
{
|
||||||
|
if (IsKeyPressed(KEY_X))
|
||||||
|
{
|
||||||
|
SetClipboardText(inputBuffer);
|
||||||
|
inputBuffer[0] = '\0'; // Quick solution to clear text
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_C)) SetClipboardText(inputBuffer);
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_V))
|
||||||
|
{
|
||||||
|
clipboardText = GetClipboardText();
|
||||||
|
if (clipboardText != NULL) TextCopy(inputBuffer, clipboardText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw instructions
|
||||||
|
GuiLabel((Rectangle){ 50, 20, 700, 36 }, "Use the BUTTONS or KEY SHORTCUTS:");
|
||||||
|
DrawText("[CTRL+X] - CUT | [CTRL+C] COPY | [CTRL+V] | PASTE", 50, 60, 20, MAROON);
|
||||||
|
|
||||||
|
// Draw text box
|
||||||
|
if (GuiTextBox((Rectangle){ 50, 120, 652, 40 }, inputBuffer, 256, textBoxEditMode)) textBoxEditMode = !textBoxEditMode;
|
||||||
|
|
||||||
|
// Random text button
|
||||||
|
btnRandomPressed = GuiButton((Rectangle){ 50 + 652 + 8, 120, 40, 40 }, "#77#");
|
||||||
|
|
||||||
|
// Draw buttons
|
||||||
|
btnCutPressed = GuiButton((Rectangle){ 50, 180, 158, 40 }, "#17#CUT");
|
||||||
|
btnCopyPressed = GuiButton((Rectangle){ 50 + 165, 180, 158, 40 }, "#16#COPY");
|
||||||
|
btnPastePressed = GuiButton((Rectangle){ 50 + 165*2, 180, 158, 40 }, "#18#PASTE");
|
||||||
|
btnClearPressed = GuiButton((Rectangle){ 50 + 165*3, 180, 158, 40 }, "#143#CLEAR");
|
||||||
|
|
||||||
|
// Draw clipboard status
|
||||||
|
GuiSetState(STATE_DISABLED);
|
||||||
|
GuiLabel((Rectangle){ 50, 260, 700, 40 }, "Clipboard current text data:");
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_READONLY, 1);
|
||||||
|
GuiTextBox((Rectangle){ 50, 300, 700, 40 }, (char *)clipboardText, 256, false);
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_READONLY, 0);
|
||||||
|
GuiLabel((Rectangle){ 50, 360, 700, 40 }, "Try copying text from other applications and pasting here!");
|
||||||
|
GuiSetState(STATE_NORMAL);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_clipboard_text.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
143
examples/core/core_compute_hash.c
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - compute hash
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static char *GetDataAsHexText(const unsigned int *data, int dataSize);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - compute hash");
|
||||||
|
|
||||||
|
// UI controls variables
|
||||||
|
char textInput[96] = "The quick brown fox jumps over the lazy dog.";
|
||||||
|
bool textBoxEditMode = false;
|
||||||
|
bool btnComputeHashes = false;
|
||||||
|
|
||||||
|
// Data hash values
|
||||||
|
unsigned int hashCRC32 = 0;
|
||||||
|
unsigned int *hashMD5 = NULL;
|
||||||
|
unsigned int *hashSHA1 = NULL;
|
||||||
|
unsigned int *hashSHA256 = NULL;
|
||||||
|
|
||||||
|
// Base64 encoded data
|
||||||
|
char *base64Text = NULL;
|
||||||
|
int base64TextSize = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (btnComputeHashes)
|
||||||
|
{
|
||||||
|
int textInputLen = (int)strlen(textInput);
|
||||||
|
|
||||||
|
// Encode data to Base64 string (includes NULL terminator), memory must be MemFree()
|
||||||
|
base64Text = EncodeDataBase64((unsigned char *)textInput, textInputLen, &base64TextSize);
|
||||||
|
|
||||||
|
hashCRC32 = ComputeCRC32((unsigned char *)textInput, textInputLen); // Compute CRC32 hash code (4 bytes)
|
||||||
|
hashMD5 = ComputeMD5((unsigned char *)textInput, textInputLen); // Compute MD5 hash code, returns static int[4] (16 bytes)
|
||||||
|
hashSHA1 = ComputeSHA1((unsigned char *)textInput, textInputLen); // Compute SHA1 hash code, returns static int[5] (20 bytes)
|
||||||
|
hashSHA256 = ComputeSHA256((unsigned char *)textInput, textInputLen); // Compute SHA256 hash code, returns static int[8] (32 bytes)
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 20);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SPACING, 2);
|
||||||
|
GuiLabel((Rectangle){ 40, 26, 720, 32 }, "INPUT DATA (TEXT):");
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SPACING, 1);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 10);
|
||||||
|
|
||||||
|
if (GuiTextBox((Rectangle){ 40, 64, 720, 32 }, textInput, 95, textBoxEditMode)) textBoxEditMode = !textBoxEditMode;
|
||||||
|
|
||||||
|
btnComputeHashes = GuiButton((Rectangle){ 40, 64 + 40, 720, 32 }, "COMPUTE INPUT DATA HASHES");
|
||||||
|
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 20);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SPACING, 2);
|
||||||
|
GuiLabel((Rectangle){ 40, 160, 720, 32 }, "INPUT DATA HASH VALUES:");
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SPACING, 1);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 10);
|
||||||
|
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_READONLY, 1);
|
||||||
|
GuiLabel((Rectangle){ 40, 200, 120, 32 }, "CRC32 [32 bit]:");
|
||||||
|
GuiTextBox((Rectangle){ 40 + 120, 200, 720 - 120, 32 }, GetDataAsHexText(&hashCRC32, 1), 120, false);
|
||||||
|
GuiLabel((Rectangle){ 40, 200 + 36, 120, 32 }, "MD5 [128 bit]:");
|
||||||
|
GuiTextBox((Rectangle){ 40 + 120, 200 + 36, 720 - 120, 32 }, GetDataAsHexText(hashMD5, 4), 120, false);
|
||||||
|
GuiLabel((Rectangle){ 40, 200 + 36*2, 120, 32 }, "SHA1 [160 bit]:");
|
||||||
|
GuiTextBox((Rectangle){ 40 + 120, 200 + 36*2, 720 - 120, 32 }, GetDataAsHexText(hashSHA1, 5), 120, false);
|
||||||
|
GuiLabel((Rectangle){ 40, 200 + 36*3, 120, 32 }, "SHA256 [256 bit]:");
|
||||||
|
GuiTextBox((Rectangle){ 40 + 120, 200 + 36*3, 720 - 120, 32 }, GetDataAsHexText(hashSHA256, 8), 120, false);
|
||||||
|
|
||||||
|
GuiSetState(STATE_FOCUSED);
|
||||||
|
GuiLabel((Rectangle){ 40, 200 + 36*5 - 30, 320, 32 }, "BONUS - BAS64 ENCODED STRING:");
|
||||||
|
GuiSetState(STATE_NORMAL);
|
||||||
|
GuiLabel((Rectangle){ 40, 200 + 36*5, 120, 32 }, "BASE64 ENCODING:");
|
||||||
|
GuiTextBox((Rectangle){ 40 + 120, 200 + 36*5, 720 - 120, 32 }, base64Text, 120, false);
|
||||||
|
GuiSetStyle(TEXTBOX, TEXT_READONLY, 0);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
MemFree(base64Text); // Free Base64 text data
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static char *GetDataAsHexText(const unsigned int *data, int dataSize)
|
||||||
|
{
|
||||||
|
static char text[128] = { 0 };
|
||||||
|
memset(text, 0, 128);
|
||||||
|
|
||||||
|
if ((data != NULL) && (dataSize > 0) && (dataSize < ((128/8) - 1)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < dataSize; i++) TextCopy(text + i*8, TextFormat("%08X", data[i]));
|
||||||
|
}
|
||||||
|
else TextCopy(text, "00000000");
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
BIN
examples/core/core_compute_hash.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include <stdio.h> // Required for: fopen(), fclose(), fputc(), fwrite(), printf(), fprintf(), funopen()
|
#include <stdio.h> // Required for: printf(), vprintf(), fprintf()
|
||||||
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
|
#include <time.h> // Required for: time_t, tm, time(), localtime(), strftime()
|
||||||
|
|
||||||
// Custom logging function
|
// Custom logging function
|
||||||
void CustomLog(int msgType, const char *text, va_list args)
|
void CustomTraceLog(int msgType, const char *text, va_list args)
|
||||||
{
|
{
|
||||||
char timeStr[64] = { 0 };
|
char timeStr[64] = { 0 };
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
@ -54,7 +54,7 @@ int main(void)
|
|||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
// Set custom logger
|
// Set custom logger
|
||||||
SetTraceLogCallback(CustomLog);
|
SetTraceLogCallback(CustomTraceLog);
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom logging");
|
||||||
|
|
||||||
|
|||||||
112
examples/core/core_delta_time.c
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - delta time
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by Robin (@RobinsAviary) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Robin (@RobinsAviary)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - delta time");
|
||||||
|
|
||||||
|
int currentFps = 60;
|
||||||
|
|
||||||
|
// Store the position for the both of the circles
|
||||||
|
Vector2 deltaCircle = { 0, (float)screenHeight/3.0f };
|
||||||
|
Vector2 frameCircle = { 0, (float)screenHeight*(2.0f/3.0f) };
|
||||||
|
|
||||||
|
// The speed applied to both circles
|
||||||
|
const float speed = 10.0f;
|
||||||
|
const float circleRadius = 32.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(currentFps);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Adjust the FPS target based on the mouse wheel
|
||||||
|
float mouseWheel = GetMouseWheelMove();
|
||||||
|
if (mouseWheel != 0)
|
||||||
|
{
|
||||||
|
currentFps += (int)mouseWheel;
|
||||||
|
if (currentFps < 0) currentFps = 0;
|
||||||
|
SetTargetFPS(currentFps);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameTime() returns the time it took to draw the last frame, in seconds (usually called delta time)
|
||||||
|
// Uses the delta time to make the circle look like it's moving at a "consistent" speed regardless of FPS
|
||||||
|
|
||||||
|
// Multiply by 6.0 (an arbitrary value) in order to make the speed
|
||||||
|
// visually closer to the other circle (at 60 fps), for comparison
|
||||||
|
deltaCircle.x += GetFrameTime()*6.0f*speed;
|
||||||
|
// This circle can move faster or slower visually depending on the FPS
|
||||||
|
frameCircle.x += 0.1f*speed;
|
||||||
|
|
||||||
|
// If either circle is off the screen, reset it back to the start
|
||||||
|
if (deltaCircle.x > screenWidth) deltaCircle.x = 0;
|
||||||
|
if (frameCircle.x > screenWidth) frameCircle.x = 0;
|
||||||
|
|
||||||
|
// Reset both circles positions
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
deltaCircle.x = 0;
|
||||||
|
frameCircle.x = 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw both circles to the screen
|
||||||
|
DrawCircleV(deltaCircle, circleRadius, RED);
|
||||||
|
DrawCircleV(frameCircle, circleRadius, BLUE);
|
||||||
|
|
||||||
|
// Draw the help text
|
||||||
|
// Determine what help text to show depending on the current FPS target
|
||||||
|
const char *fpsText = 0;
|
||||||
|
if (currentFps <= 0) fpsText = TextFormat("FPS: unlimited (%i)", GetFPS());
|
||||||
|
else fpsText = TextFormat("FPS: %i (target: %i)", GetFPS(), currentFps);
|
||||||
|
DrawText(fpsText, 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("Frame time: %02.02f ms", GetFrameTime()), 10, 30, 20, DARKGRAY);
|
||||||
|
DrawText("Use the scroll wheel to change the fps limit, r to reset", 10, 50, 20, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw the text above the circles
|
||||||
|
DrawText("FUNC: x += GetFrameTime()*speed", 10, 90, 20, RED);
|
||||||
|
DrawText("FUNC: x += speed", 10, 240, 20, BLUE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_delta_time.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
96
examples/core/core_directory_files.c
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - directory files
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Hugo ARNAL (@hugoarnal) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Hugo ARNAL (@hugoarnal)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h" // Required for GUI controls
|
||||||
|
|
||||||
|
#define MAX_FILEPATH_SIZE 1024
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - directory files");
|
||||||
|
|
||||||
|
char directory[MAX_FILEPATH_SIZE] = { 0 };
|
||||||
|
strcpy(directory, GetWorkingDirectory());
|
||||||
|
|
||||||
|
// Load file-paths on current working directory
|
||||||
|
// NOTE: LoadDirectoryFiles() loads files and directories by default,
|
||||||
|
// use LoadDirectoryFilesEx() for custom filters and recursive directories loading
|
||||||
|
//FilePathList files = LoadDirectoryFiles(directory);
|
||||||
|
FilePathList files = LoadDirectoryFilesEx(directory, ".png;.c", false);
|
||||||
|
|
||||||
|
int btnBackPressed = false;
|
||||||
|
|
||||||
|
int listScrollIndex = 0;
|
||||||
|
int listItemActive = -1;
|
||||||
|
int listItemFocused = -1;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (btnBackPressed)
|
||||||
|
{
|
||||||
|
TextCopy(directory, GetPrevDirectoryPath(directory));
|
||||||
|
UnloadDirectoryFiles(files);
|
||||||
|
files = LoadDirectoryFiles(directory);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
btnBackPressed = GuiButton((Rectangle){ 40.0f, 10.0f, 48, 28 }, "<");
|
||||||
|
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize*2);
|
||||||
|
GuiLabel((Rectangle){ 40 + 48 + 10, 10, 700, 28 }, directory);
|
||||||
|
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize);
|
||||||
|
|
||||||
|
GuiSetStyle(LISTVIEW, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||||
|
GuiSetStyle(LISTVIEW, TEXT_PADDING, 40);
|
||||||
|
GuiListViewEx((Rectangle){ 0, 50, (float)GetScreenWidth(), (float)GetScreenHeight() - 50 },
|
||||||
|
files.paths, files.count, &listScrollIndex, &listItemActive, &listItemFocused);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadDirectoryFiles(files);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_directory_files.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - high dpi
|
* raylib [core] example - highdpi demo
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★★☆☆] 2/4
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
*
|
*
|
||||||
@ -33,7 +33,7 @@ int main(void)
|
|||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE);
|
SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - high dpi");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - highdpi demo");
|
||||||
SetWindowMinSize(450, 450);
|
SetWindowMinSize(450, 450);
|
||||||
|
|
||||||
int logicalGridDescY = 120;
|
int logicalGridDescY = 120;
|
||||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
107
examples/core/core_highdpi_testbed.c
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - highdpi testbed
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by Ramon Santamaria (@raysan5) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_HIGHDPI);
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - highdpi testbed");
|
||||||
|
|
||||||
|
Vector2 scaleDpi = GetWindowScaleDPI();
|
||||||
|
Vector2 mousePos = GetMousePosition();
|
||||||
|
int currentMonitor = GetCurrentMonitor();
|
||||||
|
Vector2 windowPos = GetWindowPosition();
|
||||||
|
|
||||||
|
int gridSpacing = 40; // Grid spacing in pixels
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
mousePos = GetMousePosition();
|
||||||
|
currentMonitor = GetCurrentMonitor();
|
||||||
|
scaleDpi = GetWindowScaleDPI();
|
||||||
|
windowPos = GetWindowPosition();
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) ToggleBorderlessWindowed();
|
||||||
|
if (IsKeyPressed(KEY_F)) ToggleFullscreen();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw grid
|
||||||
|
for (int h = 0; h < GetScreenHeight()/gridSpacing + 1; h++)
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("%02i", h*gridSpacing), 4, h*gridSpacing - 4, 10, GRAY);
|
||||||
|
DrawLine(24, h*gridSpacing, GetScreenWidth(), h*gridSpacing, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
for (int v = 0; v < GetScreenWidth()/gridSpacing + 1; v++)
|
||||||
|
{
|
||||||
|
DrawText(TextFormat("%02i", v*gridSpacing), v*gridSpacing - 10, 4, 10, GRAY);
|
||||||
|
DrawLine(v*gridSpacing, 20, v*gridSpacing, GetScreenHeight(), LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw UI info
|
||||||
|
DrawText(TextFormat("CURRENT MONITOR: %i/%i (%ix%i)", currentMonitor + 1, GetMonitorCount(),
|
||||||
|
GetMonitorWidth(currentMonitor), GetMonitorHeight(currentMonitor)), 50, 50, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("WINDOW POSITION: %ix%i", (int)windowPos.x, (int)windowPos.y), 50, 90, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("SCREEN SIZE: %ix%i", GetScreenWidth(), GetScreenHeight()), 50, 130, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("RENDER SIZE: %ix%i", GetRenderWidth(), GetRenderHeight()), 50, 170, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("SCALE FACTOR: %.2fx%.2f", scaleDpi.x, scaleDpi.y), 50, 210, 20, GRAY);
|
||||||
|
|
||||||
|
// Draw reference rectangles, top-left and bottom-right corners
|
||||||
|
DrawRectangle(0, 0, 30, 60, RED);
|
||||||
|
DrawRectangle(GetScreenWidth() - 30, GetScreenHeight() - 60, 30, 60, BLUE);
|
||||||
|
|
||||||
|
// Draw mouse position
|
||||||
|
DrawCircleV(GetMousePosition(), 20, MAROON);
|
||||||
|
DrawRectangleRec((Rectangle) { mousePos.x - 25, mousePos.y, 50, 2 }, BLACK);
|
||||||
|
DrawRectangleRec((Rectangle) { mousePos.x, mousePos.y - 25, 2, 50 }, BLACK);
|
||||||
|
DrawText(TextFormat("[%i,%i]", GetMouseX(), GetMouseY()), mousePos.x - 44,
|
||||||
|
(mousePos.y > GetScreenHeight() - 60)? (int)mousePos.y - 46 : (int)mousePos.y + 30, 20, BLACK);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// TODO: Unload all loaded resources at this point
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_highdpi_testbed.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
203
examples/core/core_input_actions.c
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - input actions
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Jett (@JettMonstersGoBoom) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Jett (@JettMonstersGoBoom)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
// Simple example for decoding input as actions, allowing remapping of input to different keys or gamepad buttons
|
||||||
|
// For example instead of using `IsKeyDown(KEY_LEFT)`, you can use `IsActionDown(ACTION_LEFT)`
|
||||||
|
// which can be reassigned to e.g. KEY_A and also assigned to a gamepad button. the action will trigger with either gamepad or keys
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef enum ActionType {
|
||||||
|
NO_ACTION = 0,
|
||||||
|
ACTION_UP,
|
||||||
|
ACTION_DOWN,
|
||||||
|
ACTION_LEFT,
|
||||||
|
ACTION_RIGHT,
|
||||||
|
ACTION_FIRE,
|
||||||
|
MAX_ACTION
|
||||||
|
} ActionType;
|
||||||
|
|
||||||
|
// Key and button inputs
|
||||||
|
typedef struct ActionInput {
|
||||||
|
int key;
|
||||||
|
int button;
|
||||||
|
} ActionInput;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static int gamepadIndex = 0; // Gamepad default index
|
||||||
|
static ActionInput actionInputs[MAX_ACTION] = { 0 };
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static bool IsActionPressed(int action); // Check action key/button pressed
|
||||||
|
static bool IsActionReleased(int action); // Check action key/button released
|
||||||
|
static bool IsActionDown(int action); // Check action key/button down
|
||||||
|
|
||||||
|
static void SetActionsDefault(void); // Set the "default" keyset
|
||||||
|
static void SetActionsCursor(void); // Set the "alternate" keyset
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - input actions");
|
||||||
|
|
||||||
|
// Set default actions
|
||||||
|
char actionSet = 0;
|
||||||
|
SetActionsDefault();
|
||||||
|
bool releaseAction = false;
|
||||||
|
|
||||||
|
Vector2 position = (Vector2){ 400.0f, 200.0f };
|
||||||
|
Vector2 size = (Vector2){ 40.0f, 40.0f };
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
gamepadIndex = 0; // Set gamepad being checked
|
||||||
|
|
||||||
|
if (IsActionDown(ACTION_UP)) position.y -= 2;
|
||||||
|
if (IsActionDown(ACTION_DOWN)) position.y += 2;
|
||||||
|
if (IsActionDown(ACTION_LEFT)) position.x -= 2;
|
||||||
|
if (IsActionDown(ACTION_RIGHT)) position.x += 2;
|
||||||
|
if (IsActionPressed(ACTION_FIRE))
|
||||||
|
{
|
||||||
|
position.x = (screenWidth-size.x)/2;
|
||||||
|
position.y = (screenHeight-size.y)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register release action for one frame
|
||||||
|
releaseAction = false;
|
||||||
|
if (IsActionReleased(ACTION_FIRE)) releaseAction = true;
|
||||||
|
|
||||||
|
// Switch control scheme by pressing TAB
|
||||||
|
if (IsKeyPressed(KEY_TAB))
|
||||||
|
{
|
||||||
|
actionSet = !actionSet;
|
||||||
|
if (actionSet == 0) SetActionsDefault();
|
||||||
|
else SetActionsCursor();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(GRAY);
|
||||||
|
|
||||||
|
DrawRectangleV(position, size, releaseAction? BLUE : RED);
|
||||||
|
|
||||||
|
DrawText((actionSet == 0)? "Current input set: WASD (default)" : "Current input set: Arrow keys", 10, 10, 20, WHITE);
|
||||||
|
DrawText("Use TAB key to toggles Actions keyset", 10, 50, 20, GREEN);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Check action key/button pressed
|
||||||
|
// NOTE: Combines key pressed and gamepad button pressed in one action
|
||||||
|
static bool IsActionPressed(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyPressed(actionInputs[action].key) || IsGamepadButtonPressed(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check action key/button released
|
||||||
|
// NOTE: Combines key released and gamepad button released in one action
|
||||||
|
static bool IsActionReleased(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyReleased(actionInputs[action].key) || IsGamepadButtonReleased(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check action key/button down
|
||||||
|
// NOTE: Combines key down and gamepad button down in one action
|
||||||
|
static bool IsActionDown(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyDown(actionInputs[action].key) || IsGamepadButtonDown(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the "default" keyset
|
||||||
|
// NOTE: Here WASD and gamepad buttons on the left side for movement
|
||||||
|
static void SetActionsDefault(void)
|
||||||
|
{
|
||||||
|
actionInputs[ACTION_UP].key = KEY_W;
|
||||||
|
actionInputs[ACTION_DOWN].key = KEY_S;
|
||||||
|
actionInputs[ACTION_LEFT].key = KEY_A;
|
||||||
|
actionInputs[ACTION_RIGHT].key = KEY_D;
|
||||||
|
actionInputs[ACTION_FIRE].key = KEY_SPACE;
|
||||||
|
|
||||||
|
actionInputs[ACTION_UP].button = GAMEPAD_BUTTON_LEFT_FACE_UP;
|
||||||
|
actionInputs[ACTION_DOWN].button = GAMEPAD_BUTTON_LEFT_FACE_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].button = GAMEPAD_BUTTON_LEFT_FACE_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].button = GAMEPAD_BUTTON_LEFT_FACE_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the "alternate" keyset
|
||||||
|
// NOTE: Here cursor keys and gamepad buttons on the right side for movement
|
||||||
|
static void SetActionsCursor(void)
|
||||||
|
{
|
||||||
|
actionInputs[ACTION_UP].key = KEY_UP;
|
||||||
|
actionInputs[ACTION_DOWN].key = KEY_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].key = KEY_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].key = KEY_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].key = KEY_SPACE;
|
||||||
|
|
||||||
|
actionInputs[ACTION_UP].button = GAMEPAD_BUTTON_RIGHT_FACE_UP;
|
||||||
|
actionInputs[ACTION_DOWN].button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].button = GAMEPAD_BUTTON_RIGHT_FACE_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].button = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].button = GAMEPAD_BUTTON_LEFT_FACE_DOWN;
|
||||||
|
}
|
||||||
BIN
examples/core/core_input_actions.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
@ -24,7 +24,8 @@
|
|||||||
// NOTE: Gamepad name ID depends on drivers and OS
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
#define XBOX_ALIAS_1 "xbox"
|
#define XBOX_ALIAS_1 "xbox"
|
||||||
#define XBOX_ALIAS_2 "x-box"
|
#define XBOX_ALIAS_2 "x-box"
|
||||||
#define PS_ALIAS "playstation"
|
#define PS_ALIAS_1 "playstation"
|
||||||
|
#define PS_ALIAS_2 "sony"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@ -51,6 +52,8 @@ int main(void)
|
|||||||
const float leftTriggerDeadzone = -0.9f;
|
const float leftTriggerDeadzone = -0.9f;
|
||||||
const float rightTriggerDeadzone = -0.9f;
|
const float rightTriggerDeadzone = -0.9f;
|
||||||
|
|
||||||
|
Rectangle vibrateButton = { 0 };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -61,7 +64,12 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// ...
|
if (IsKeyPressed(KEY_LEFT) && gamepad > 0) gamepad--;
|
||||||
|
if (IsKeyPressed(KEY_RIGHT)) gamepad++;
|
||||||
|
Vector2 mousePosition = GetMousePosition();
|
||||||
|
|
||||||
|
vibrateButton = (Rectangle){ 10, 70.0f + 20*GetGamepadAxisCount(gamepad) + 20, 75, 24 };
|
||||||
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mousePosition, vibrateButton)) SetGamepadVibration(gamepad, 1.0, 1.0, 1.0);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@ -70,9 +78,6 @@ int main(void)
|
|||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_LEFT) && gamepad > 0) gamepad--;
|
|
||||||
if (IsKeyPressed(KEY_RIGHT)) gamepad++;
|
|
||||||
|
|
||||||
if (IsGamepadAvailable(gamepad))
|
if (IsGamepadAvailable(gamepad))
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
|
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
|
||||||
@ -93,7 +98,8 @@ int main(void)
|
|||||||
if (leftTrigger < leftTriggerDeadzone) leftTrigger = -1.0f;
|
if (leftTrigger < leftTriggerDeadzone) leftTrigger = -1.0f;
|
||||||
if (rightTrigger < rightTriggerDeadzone) rightTrigger = -1.0f;
|
if (rightTrigger < rightTriggerDeadzone) rightTrigger = -1.0f;
|
||||||
|
|
||||||
if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_1) > -1 || TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_2) > -1)
|
if ((TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_1) > -1) ||
|
||||||
|
(TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_2) > -1))
|
||||||
{
|
{
|
||||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
@ -125,16 +131,14 @@ int main(void)
|
|||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||||
DrawCircle(259, 152, 39, BLACK);
|
DrawCircle(259, 152, 39, BLACK);
|
||||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||||
DrawCircle(259 + (int)(leftStickX*20),
|
DrawCircle(259 + (int)(leftStickX*20), 152 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||||
152 + (int)(leftStickY*20), 25, leftGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
Color rightGamepadColor = BLACK;
|
Color rightGamepadColor = BLACK;
|
||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||||
DrawCircle(461, 237, 38, BLACK);
|
DrawCircle(461, 237, 38, BLACK);
|
||||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||||
DrawCircle(461 + (int)(rightStickX*20),
|
DrawCircle(461 + (int)(rightStickX*20), 237 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||||
237 + (int)(rightStickY*20), 25, rightGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||||
@ -145,7 +149,8 @@ int main(void)
|
|||||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||||
}
|
}
|
||||||
else if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS) > -1)
|
else if ((TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS_1) > -1) ||
|
||||||
|
(TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS_2) > -1))
|
||||||
{
|
{
|
||||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
@ -177,16 +182,14 @@ int main(void)
|
|||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||||
DrawCircle(319, 255, 35, BLACK);
|
DrawCircle(319, 255, 35, BLACK);
|
||||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(319 + (int)(leftStickX*20),
|
DrawCircle(319 + (int)(leftStickX*20), 255 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||||
255 + (int)(leftStickY*20), 25, leftGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
Color rightGamepadColor = BLACK;
|
Color rightGamepadColor = BLACK;
|
||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||||
DrawCircle(475, 255, 35, BLACK);
|
DrawCircle(475, 255, 35, BLACK);
|
||||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(475 + (int)(rightStickX*20),
|
DrawCircle(475 + (int)(rightStickX*20), 255 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||||
255 + (int)(rightStickY*20), 25, rightGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||||
@ -196,7 +199,6 @@ int main(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// Draw background: generic
|
// Draw background: generic
|
||||||
DrawRectangleRounded((Rectangle){ 175, 110, 460, 220}, 0.3f, 16, DARKGRAY);
|
DrawRectangleRounded((Rectangle){ 175, 110, 460, 220}, 0.3f, 16, DARKGRAY);
|
||||||
|
|
||||||
@ -237,23 +239,20 @@ int main(void)
|
|||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||||
DrawCircle(345, 260, 40, BLACK);
|
DrawCircle(345, 260, 40, BLACK);
|
||||||
DrawCircle(345, 260, 35, LIGHTGRAY);
|
DrawCircle(345, 260, 35, LIGHTGRAY);
|
||||||
DrawCircle(345 + (int)(leftStickX*20),
|
DrawCircle(345 + (int)(leftStickX*20), 260 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||||
260 + (int)(leftStickY*20), 25, leftGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
Color rightGamepadColor = BLACK;
|
Color rightGamepadColor = BLACK;
|
||||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||||
DrawCircle(465, 260, 40, BLACK);
|
DrawCircle(465, 260, 40, BLACK);
|
||||||
DrawCircle(465, 260, 35, LIGHTGRAY);
|
DrawCircle(465, 260, 35, LIGHTGRAY);
|
||||||
DrawCircle(465 + (int)(rightStickX*20),
|
DrawCircle(465 + (int)(rightStickX*20), 260 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||||
260 + (int)(rightStickY*20), 25, rightGamepadColor);
|
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(151, 110, 15, 70, GRAY);
|
DrawRectangle(151, 110, 15, 70, GRAY);
|
||||||
DrawRectangle(644, 110, 15, 70, GRAY);
|
DrawRectangle(644, 110, 15, 70, GRAY);
|
||||||
DrawRectangle(151, 110, 15, (int)(((1 + leftTrigger)/2)*70), RED);
|
DrawRectangle(151, 110, 15, (int)(((1 + leftTrigger)/2)*70), RED);
|
||||||
DrawRectangle(644, 110, 15, (int)(((1 + rightTrigger)/2)*70), RED);
|
DrawRectangle(644, 110, 15, (int)(((1 + rightTrigger)/2)*70), RED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(gamepad)), 10, 50, 10, MAROON);
|
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(gamepad)), 10, 50, 10, MAROON);
|
||||||
@ -263,13 +262,16 @@ int main(void)
|
|||||||
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(gamepad, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(gamepad, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw vibrate button
|
||||||
|
DrawRectangleRec(vibrateButton, SKYBLUE);
|
||||||
|
DrawText("VIBRATE", (int)(vibrateButton.x + 14), (int)(vibrateButton.y + 1), 10, DARKGRAY);
|
||||||
|
|
||||||
if (GetGamepadButtonPressed() != GAMEPAD_BUTTON_UNKNOWN) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
if (GetGamepadButtonPressed() != GAMEPAD_BUTTON_UNKNOWN) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||||
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("GP%d: NOT DETECTED", gamepad), 10, 10, 10, GRAY);
|
DrawText(TextFormat("GP%d: NOT DETECTED", gamepad), 10, 10, 10, GRAY);
|
||||||
|
|
||||||
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -118,4 +118,6 @@ int main(void)
|
|||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Example complexity rating: [★★★☆] 3/4
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 5.0, last time updated with raylib 5.6-dev
|
* Example originally created with raylib 5.0, last time updated with raylib 6.0
|
||||||
*
|
*
|
||||||
* Example contributed by ubkp (@ubkp) and reviewed by Ramon Santamaria (@raysan5)
|
* Example contributed by ubkp (@ubkp) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
@ -19,56 +19,14 @@
|
|||||||
|
|
||||||
#include <math.h> // Required for the protractor angle graphic drawing
|
#include <math.h> // Required for the protractor angle graphic drawing
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
|
||||||
#include <emscripten/emscripten.h> // Required for the Web/HTML5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GESTURE_LOG_SIZE 20
|
#define GESTURE_LOG_SIZE 20
|
||||||
#define MAX_TOUCH_COUNT 32
|
#define MAX_TOUCH_COUNT 32
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
static int screenWidth = 800; // Update depending on web canvas
|
|
||||||
static const int screenHeight = 450;
|
|
||||||
static Vector2 messagePosition = { 160, 7 };
|
|
||||||
|
|
||||||
// Last gesture variables definitions
|
|
||||||
static int lastGesture = 0;
|
|
||||||
static Vector2 lastGesturePosition = { 165, 130 };
|
|
||||||
|
|
||||||
// Gesture log variables definitions
|
|
||||||
// NOTE: The gesture log uses an array (as an inverted circular queue) to store the performed gestures
|
|
||||||
static char gestureLog[GESTURE_LOG_SIZE][12] = { "" };
|
|
||||||
// NOTE: The index for the inverted circular queue (moving from last to first direction, then looping around)
|
|
||||||
static int gestureLogIndex = GESTURE_LOG_SIZE;
|
|
||||||
static int previousGesture = 0;
|
|
||||||
|
|
||||||
// Log mode values:
|
|
||||||
// - 0 shows repeated events
|
|
||||||
// - 1 hides repeated events
|
|
||||||
// - 2 shows repeated events but hide hold events
|
|
||||||
// - 3 hides repeated events and hide hold events
|
|
||||||
static int logMode = 1;
|
|
||||||
|
|
||||||
static Color gestureColor = { 0, 0, 0, 255 };
|
|
||||||
static Rectangle logButton1 = { 53, 7, 48, 26 };
|
|
||||||
static Rectangle logButton2 = { 108, 7, 36, 26 };
|
|
||||||
static Vector2 gestureLogPosition = { 10, 10 };
|
|
||||||
|
|
||||||
// Protractor variables definitions
|
|
||||||
static float angleLength = 90.0f;
|
|
||||||
static float currentAngleDegrees = 0.0f;
|
|
||||||
static Vector2 finalVector = { 0.0f, 0.0f };
|
|
||||||
static char currentAngleStr[7] = "";
|
|
||||||
static Vector2 protractorPosition = { 266.0f, 315.0f };
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
static void UpdateDrawFrame(void); // Update and Draw one frame
|
static char const *GetGestureName(int gesture); // Get text string for gesture value
|
||||||
static char const *GetGestureName(int i);
|
static Color GetGestureColor(int gesture); // Get color for gesture value
|
||||||
static Color GetGestureColor(int i);
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
@ -77,20 +35,233 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures testbed");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures testbed");
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
Vector2 messagePosition = { 160, 7 };
|
||||||
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
|
||||||
#else
|
// Last gesture variables definitions
|
||||||
|
int lastGesture = 0;
|
||||||
|
Vector2 lastGesturePosition = { 165, 130 };
|
||||||
|
|
||||||
|
// Gesture log variables definitions
|
||||||
|
// NOTE: The gesture log uses an array (as an inverted circular queue) to store the performed gestures
|
||||||
|
char gestureLog[GESTURE_LOG_SIZE][12] = { "" };
|
||||||
|
// NOTE: The index for the inverted circular queue (moving from last to first direction, then looping around)
|
||||||
|
int gestureLogIndex = GESTURE_LOG_SIZE;
|
||||||
|
int previousGesture = 0;
|
||||||
|
|
||||||
|
// Log mode values:
|
||||||
|
// - 0 shows repeated events
|
||||||
|
// - 1 hides repeated events
|
||||||
|
// - 2 shows repeated events but hide hold events
|
||||||
|
// - 3 hides repeated events and hide hold events
|
||||||
|
int logMode = 1;
|
||||||
|
|
||||||
|
Color gestureColor = { 0, 0, 0, 255 };
|
||||||
|
Rectangle logButton1 = { 53, 7, 48, 26 };
|
||||||
|
Rectangle logButton2 = { 108, 7, 36, 26 };
|
||||||
|
Vector2 gestureLogPosition = { 10, 10 };
|
||||||
|
|
||||||
|
// Protractor variables definitions
|
||||||
|
float angleLength = 90.0f;
|
||||||
|
float currentAngleDegrees = 0.0f;
|
||||||
|
Vector2 finalVector = { 0.0f, 0.0f };
|
||||||
|
Vector2 protractorPosition = { 266.0f, 315.0f };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
UpdateDrawFrame();
|
// Update
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Handle common gestures data
|
||||||
|
int i, ii; // Iterators that will be reused by all for loops
|
||||||
|
const int currentGesture = GetGestureDetected();
|
||||||
|
const float currentDragDegrees = GetGestureDragAngle();
|
||||||
|
const float currentPitchDegrees = GetGesturePinchAngle();
|
||||||
|
const int touchCount = GetTouchPointCount();
|
||||||
|
|
||||||
|
// Handle last gesture
|
||||||
|
if ((currentGesture != 0) && (currentGesture != 4) && (currentGesture != previousGesture))
|
||||||
|
lastGesture = currentGesture; // Filter the meaningful gestures (1, 2, 8 to 512) for the display
|
||||||
|
|
||||||
|
// Handle gesture log
|
||||||
|
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||||
|
{
|
||||||
|
if (CheckCollisionPointRec(GetMousePosition(), logButton1))
|
||||||
|
{
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logMode = 2; break;
|
||||||
|
case 2: logMode = 3; break;
|
||||||
|
case 1: logMode = 0; break;
|
||||||
|
default: logMode = 1; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CheckCollisionPointRec(GetMousePosition(), logButton2))
|
||||||
|
{
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logMode = 1; break;
|
||||||
|
case 2: logMode = 0; break;
|
||||||
|
case 1: logMode = 3; break;
|
||||||
|
default: logMode = 2; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int fillLog = 0; // Gate variable to be used to allow or not the gesture log to be filled
|
||||||
|
if (currentGesture !=0)
|
||||||
|
{
|
||||||
|
if (logMode == 3) // 3 hides repeated events and hide hold events
|
||||||
|
{
|
||||||
|
if (((currentGesture != 4) && (currentGesture != previousGesture)) || (currentGesture < 3)) fillLog = 1;
|
||||||
|
}
|
||||||
|
else if (logMode == 2) // 2 shows repeated events but hide hold events
|
||||||
|
{
|
||||||
|
if (currentGesture != 4) fillLog = 1;
|
||||||
|
}
|
||||||
|
else if (logMode == 1) // 1 hides repeated events
|
||||||
|
{
|
||||||
|
if (currentGesture != previousGesture) fillLog = 1;
|
||||||
|
}
|
||||||
|
else // 0 shows repeated events
|
||||||
|
{
|
||||||
|
fillLog = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fillLog) // If one of the conditions from logMode was met, fill the gesture log
|
||||||
|
{
|
||||||
|
previousGesture = currentGesture;
|
||||||
|
gestureColor = GetGestureColor(currentGesture);
|
||||||
|
if (gestureLogIndex <= 0) gestureLogIndex = GESTURE_LOG_SIZE;
|
||||||
|
gestureLogIndex--;
|
||||||
|
|
||||||
|
// Copy the gesture respective name to the gesture log array
|
||||||
|
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle protractor
|
||||||
|
if (currentGesture > 255) currentAngleDegrees = currentPitchDegrees; // Pinch In and Pinch Out
|
||||||
|
else if (currentGesture > 15) currentAngleDegrees = currentDragDegrees; // Swipe Right, Swipe Left, Swipe Up and Swipe Down
|
||||||
|
else if (currentGesture > 0) currentAngleDegrees = 0.0f; // Tap, Doubletap, Hold and Grab
|
||||||
|
|
||||||
|
float currentAngleRadians = ((currentAngleDegrees + 90.0f)*PI/180); // Convert the current angle to Radians
|
||||||
|
// Calculate the final vector for display
|
||||||
|
finalVector = (Vector2){ (angleLength*sinf(currentAngleRadians)) + protractorPosition.x,
|
||||||
|
(angleLength*cosf(currentAngleRadians)) + protractorPosition.y };
|
||||||
|
|
||||||
|
// Handle touch and mouse pointer points
|
||||||
|
Vector2 touchPosition[MAX_TOUCH_COUNT] = { 0 };
|
||||||
|
Vector2 mousePosition = { 0 };
|
||||||
|
if (currentGesture != GESTURE_NONE)
|
||||||
|
{
|
||||||
|
if (touchCount != 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < touchCount; i++) touchPosition[i] = GetTouchPosition(i); // Fill the touch positions
|
||||||
|
}
|
||||||
|
else mousePosition = GetMousePosition();
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw common elements
|
||||||
|
DrawText("*", (int)messagePosition.x + 5, (int)messagePosition.y + 5, 10, BLACK);
|
||||||
|
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", (int)messagePosition.x + 15, (int)messagePosition.y + 5, 10, BLACK);
|
||||||
|
DrawText("*", (int)messagePosition.x + 5, (int)messagePosition.y + 35, 10, BLACK);
|
||||||
|
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", (int)messagePosition.x + 15, (int)messagePosition.y + 35, 10, BLACK);
|
||||||
|
|
||||||
|
// Draw last gesture
|
||||||
|
DrawText("Last gesture", (int)lastGesturePosition.x + 33, (int)lastGesturePosition.y - 47, 20, BLACK);
|
||||||
|
DrawText("Swipe Tap Pinch Touch", (int)lastGesturePosition.x + 17, (int)lastGesturePosition.y - 18, 10, BLACK);
|
||||||
|
DrawRectangle((int)lastGesturePosition.x + 20, (int)lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle((int)lastGesturePosition.x, (int)lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle((int)lastGesturePosition.x + 40, (int)lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
|
||||||
|
DrawRectangle((int)lastGesturePosition.x + 20, (int)lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
|
||||||
|
DrawCircle((int)lastGesturePosition.x + 80, (int)lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
|
||||||
|
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
|
||||||
|
DrawCircle((int)lastGesturePosition.x + 80, (int)lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
|
DrawCircle((int)lastGesturePosition.x + 103, (int)lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
|
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
|
for (i = 0; i < 4; i++) DrawCircle((int)lastGesturePosition.x + 180, (int)lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
|
||||||
|
|
||||||
|
// Draw gesture log
|
||||||
|
DrawText("Log", (int)gestureLogPosition.x, (int)gestureLogPosition.y, 20, BLACK);
|
||||||
|
|
||||||
|
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
|
||||||
|
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1)%GESTURE_LOG_SIZE) DrawText(gestureLog[ii], (int)gestureLogPosition.x, (int)gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
|
||||||
|
Color logButton1Color, logButton2Color;
|
||||||
|
switch (logMode)
|
||||||
|
{
|
||||||
|
case 3: logButton1Color=MAROON; logButton2Color=MAROON; break;
|
||||||
|
case 2: logButton1Color=GRAY; logButton2Color=MAROON; break;
|
||||||
|
case 1: logButton1Color=MAROON; logButton2Color=GRAY; break;
|
||||||
|
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
|
||||||
|
}
|
||||||
|
DrawRectangleRec(logButton1, logButton1Color);
|
||||||
|
DrawText("Hide", (int)logButton1.x + 7, (int)logButton1.y + 3, 10, WHITE);
|
||||||
|
DrawText("Repeat", (int)logButton1.x + 7, (int)logButton1.y + 13, 10, WHITE);
|
||||||
|
DrawRectangleRec(logButton2, logButton2Color);
|
||||||
|
DrawText("Hide", (int)logButton1.x + 62, (int)logButton1.y + 3, 10, WHITE);
|
||||||
|
DrawText("Hold", (int)logButton1.x + 62, (int)logButton1.y + 13, 10, WHITE);
|
||||||
|
|
||||||
|
// Draw protractor
|
||||||
|
DrawText("Angle", (int)protractorPosition.x + 55, (int)protractorPosition.y + 76, 10, BLACK);
|
||||||
|
const char *angleString = TextFormat("%f", currentAngleDegrees);
|
||||||
|
const int angleStringDot = TextFindIndex(angleString, ".");
|
||||||
|
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
|
||||||
|
DrawText( angleStringTrim, (int)protractorPosition.x + 55, (int)protractorPosition.y + 92, 20, gestureColor);
|
||||||
|
DrawCircleV(protractorPosition, 80.0f, WHITE);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
|
||||||
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
|
||||||
|
DrawText("0", (int)protractorPosition.x + 96, (int)protractorPosition.y - 9, 20, BLACK);
|
||||||
|
DrawText("30", (int)protractorPosition.x + 74, (int)protractorPosition.y - 68, 20, BLACK);
|
||||||
|
DrawText("90", (int)protractorPosition.x - 11, (int)protractorPosition.y - 110, 20, BLACK);
|
||||||
|
DrawText("150", (int)protractorPosition.x - 100, (int)protractorPosition.y - 68, 20, BLACK);
|
||||||
|
DrawText("180", (int)protractorPosition.x - 124, (int)protractorPosition.y - 9, 20, BLACK);
|
||||||
|
DrawText("210", (int)protractorPosition.x - 100, (int)protractorPosition.y + 50, 20, BLACK);
|
||||||
|
DrawText("270", (int)protractorPosition.x - 18, (int)protractorPosition.y + 92, 20, BLACK);
|
||||||
|
DrawText("330", (int)protractorPosition.x + 72, (int)protractorPosition.y + 50, 20, BLACK);
|
||||||
|
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
|
||||||
|
|
||||||
|
// Draw touch and mouse pointer points
|
||||||
|
if (currentGesture != GESTURE_NONE)
|
||||||
|
{
|
||||||
|
if ( touchCount != 0 )
|
||||||
|
{
|
||||||
|
for (i = 0; i < touchCount; i++)
|
||||||
|
{
|
||||||
|
DrawCircleV(touchPosition[i], 50.0f, Fade(gestureColor, 0.5f));
|
||||||
|
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8.0f : 12.0f), gestureColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawCircleV(mousePosition, 35.0f, Fade(gestureColor, 0.5f));
|
||||||
|
DrawCircleV(mousePosition, 5.0f, gestureColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@ -103,235 +274,42 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition
|
// Module Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static void UpdateDrawFrame(void)
|
// Get text string for gesture value
|
||||||
|
static char const *GetGestureName(int gesture)
|
||||||
{
|
{
|
||||||
// Update
|
switch (gesture)
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Handle common gestures data
|
|
||||||
int i, ii; // Iterators that will be reused by all for loops
|
|
||||||
const int currentGesture = GetGestureDetected();
|
|
||||||
const float currentDragDegrees = GetGestureDragAngle();
|
|
||||||
const float currentPitchDegrees = GetGesturePinchAngle();
|
|
||||||
const int touchCount = GetTouchPointCount();
|
|
||||||
|
|
||||||
// Handle last gesture
|
|
||||||
if ((currentGesture != 0) && (currentGesture != 4) && (currentGesture != previousGesture))
|
|
||||||
lastGesture = currentGesture; // Filter the meaningful gestures (1, 2, 8 to 512) for the display
|
|
||||||
|
|
||||||
// Handle gesture log
|
|
||||||
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(GetMousePosition(), logButton1))
|
case 0: return "None"; break;
|
||||||
{
|
case 1: return "Tap"; break;
|
||||||
switch (logMode)
|
case 2: return "Double Tap"; break;
|
||||||
{
|
case 4: return "Hold"; break;
|
||||||
case 3: logMode=2; break;
|
case 8: return "Drag"; break;
|
||||||
case 2: logMode=3; break;
|
case 16: return "Swipe Right"; break;
|
||||||
case 1: logMode=0; break;
|
case 32: return "Swipe Left"; break;
|
||||||
default: logMode=1; break;
|
case 64: return "Swipe Up"; break;
|
||||||
}
|
case 128: return "Swipe Down"; break;
|
||||||
}
|
case 256: return "Pinch In"; break;
|
||||||
else if (CheckCollisionPointRec(GetMousePosition(), logButton2))
|
case 512: return "Pinch Out"; break;
|
||||||
{
|
default: return "Unknown"; break;
|
||||||
switch (logMode)
|
|
||||||
{
|
|
||||||
case 3: logMode=1; break;
|
|
||||||
case 2: logMode=0; break;
|
|
||||||
case 1: logMode=3; break;
|
|
||||||
default: logMode=2; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int fillLog = 0; // Gate variable to be used to allow or not the gesture log to be filled
|
|
||||||
if (currentGesture !=0)
|
|
||||||
{
|
|
||||||
if (logMode == 3) // 3 hides repeated events and hide hold events
|
|
||||||
{
|
|
||||||
if (((currentGesture != 4) && (currentGesture != previousGesture)) || (currentGesture < 3)) fillLog = 1;
|
|
||||||
}
|
|
||||||
else if (logMode == 2) // 2 shows repeated events but hide hold events
|
|
||||||
{
|
|
||||||
if (currentGesture != 4) fillLog = 1;
|
|
||||||
}
|
|
||||||
else if (logMode == 1) // 1 hides repeated events
|
|
||||||
{
|
|
||||||
if (currentGesture != previousGesture) fillLog = 1;
|
|
||||||
}
|
|
||||||
else // 0 shows repeated events
|
|
||||||
{
|
|
||||||
fillLog = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fillLog) // If one of the conditions from logMode was met, fill the gesture log
|
|
||||||
{
|
|
||||||
previousGesture = currentGesture;
|
|
||||||
gestureColor = GetGestureColor(currentGesture);
|
|
||||||
if (gestureLogIndex <= 0) gestureLogIndex = GESTURE_LOG_SIZE;
|
|
||||||
gestureLogIndex--;
|
|
||||||
|
|
||||||
// Copy the gesture respective name to the gesture log array
|
|
||||||
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle protractor
|
|
||||||
if (currentGesture > 255) // aka Pinch In and Pinch Out
|
|
||||||
{
|
|
||||||
currentAngleDegrees = currentPitchDegrees;
|
|
||||||
}
|
|
||||||
else if (currentGesture > 15) // aka Swipe Right, Swipe Left, Swipe Up and Swipe Down
|
|
||||||
{
|
|
||||||
currentAngleDegrees = currentDragDegrees;
|
|
||||||
}
|
|
||||||
else if (currentGesture > 0) // aka Tap, Doubletap, Hold and Grab
|
|
||||||
{
|
|
||||||
currentAngleDegrees = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float currentAngleRadians = ((currentAngleDegrees +90.0f)*PI/180); // Convert the current angle to Radians
|
|
||||||
finalVector = (Vector2){ (angleLength*sinf(currentAngleRadians)) + protractorPosition.x, (angleLength*cosf(currentAngleRadians)) + protractorPosition.y }; // Calculate the final vector for display
|
|
||||||
|
|
||||||
// Handle touch and mouse pointer points
|
|
||||||
Vector2 touchPosition[MAX_TOUCH_COUNT] = { 0 };
|
|
||||||
Vector2 mousePosition = {0, 0};
|
|
||||||
if (currentGesture != GESTURE_NONE)
|
|
||||||
{
|
|
||||||
if (touchCount != 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < touchCount; i++) touchPosition[i] = GetTouchPosition(i); // Fill the touch positions
|
|
||||||
}
|
|
||||||
else mousePosition = GetMousePosition();
|
|
||||||
}
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
BeginDrawing();
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
// Draw common elements
|
|
||||||
DrawText("*", messagePosition.x + 5, messagePosition.y + 5, 10, BLACK);
|
|
||||||
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", messagePosition.x + 15, messagePosition.y + 5, 10, BLACK);
|
|
||||||
DrawText("*", messagePosition.x + 5, messagePosition.y + 35, 10, BLACK);
|
|
||||||
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", messagePosition.x + 15, messagePosition.y + 35, 10, BLACK);
|
|
||||||
|
|
||||||
// Draw last gesture
|
|
||||||
DrawText("Last gesture", lastGesturePosition.x + 33, lastGesturePosition.y - 47, 20, BLACK);
|
|
||||||
DrawText("Swipe Tap Pinch Touch", lastGesturePosition.x + 17, lastGesturePosition.y - 18, 10, BLACK);
|
|
||||||
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
|
|
||||||
DrawRectangle(lastGesturePosition.x, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
|
|
||||||
DrawRectangle(lastGesturePosition.x + 40, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
|
|
||||||
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
|
|
||||||
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
|
|
||||||
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
|
|
||||||
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
|
||||||
DrawCircle(lastGesturePosition.x + 103, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
|
||||||
for (i = 0; i < 4; i++) DrawCircle(lastGesturePosition.x + 180, lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
|
|
||||||
|
|
||||||
// Draw gesture log
|
|
||||||
DrawText("Log", gestureLogPosition.x, gestureLogPosition.y, 20, BLACK);
|
|
||||||
|
|
||||||
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
|
|
||||||
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], gestureLogPosition.x, gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
|
|
||||||
Color logButton1Color, logButton2Color;
|
|
||||||
switch (logMode)
|
|
||||||
{
|
|
||||||
case 3: logButton1Color=MAROON; logButton2Color=MAROON; break;
|
|
||||||
case 2: logButton1Color=GRAY; logButton2Color=MAROON; break;
|
|
||||||
case 1: logButton1Color=MAROON; logButton2Color=GRAY; break;
|
|
||||||
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
|
|
||||||
}
|
|
||||||
DrawRectangleRec(logButton1, logButton1Color);
|
|
||||||
DrawText("Hide", logButton1.x + 7, logButton1.y + 3, 10, WHITE);
|
|
||||||
DrawText("Repeat", logButton1.x + 7, logButton1.y + 13, 10, WHITE);
|
|
||||||
DrawRectangleRec(logButton2, logButton2Color);
|
|
||||||
DrawText("Hide", logButton1.x + 62, logButton1.y + 3, 10, WHITE);
|
|
||||||
DrawText("Hold", logButton1.x + 62, logButton1.y + 13, 10, WHITE);
|
|
||||||
|
|
||||||
// Draw protractor
|
|
||||||
DrawText("Angle", protractorPosition.x + 55, protractorPosition.y + 76, 10, BLACK);
|
|
||||||
const char *angleString = TextFormat("%f", currentAngleDegrees);
|
|
||||||
const int angleStringDot = TextFindIndex(angleString, ".");
|
|
||||||
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
|
|
||||||
DrawText( angleStringTrim, protractorPosition.x + 55, protractorPosition.y + 92, 20, gestureColor);
|
|
||||||
DrawCircle(protractorPosition.x, protractorPosition.y, 80.0f, WHITE);
|
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
|
|
||||||
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
|
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
|
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
|
|
||||||
DrawText("0", protractorPosition.x + 96, protractorPosition.y - 9, 20, BLACK);
|
|
||||||
DrawText("30", protractorPosition.x + 74, protractorPosition.y - 68, 20, BLACK);
|
|
||||||
DrawText("90", protractorPosition.x - 11, protractorPosition.y - 110, 20, BLACK);
|
|
||||||
DrawText("150", protractorPosition.x - 100, protractorPosition.y - 68, 20, BLACK);
|
|
||||||
DrawText("180", protractorPosition.x - 124, protractorPosition.y - 9, 20, BLACK);
|
|
||||||
DrawText("210", protractorPosition.x - 100, protractorPosition.y + 50, 20, BLACK);
|
|
||||||
DrawText("270", protractorPosition.x - 18, protractorPosition.y + 92, 20, BLACK);
|
|
||||||
DrawText("330", protractorPosition.x + 72, protractorPosition.y + 50, 20, BLACK);
|
|
||||||
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
|
|
||||||
|
|
||||||
// Draw touch and mouse pointer points
|
|
||||||
if (currentGesture != GESTURE_NONE)
|
|
||||||
{
|
|
||||||
if ( touchCount != 0 )
|
|
||||||
{
|
|
||||||
for (i = 0; i < touchCount; i++)
|
|
||||||
{
|
|
||||||
DrawCircleV(touchPosition[i], 50.0f, Fade(gestureColor, 0.5f));
|
|
||||||
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8 : 12), gestureColor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawCircleV(mousePosition, 35.0f, Fade(gestureColor, 0.5f));
|
|
||||||
DrawCircleV(mousePosition, 5.0f, gestureColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EndDrawing();
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
static char const *GetGestureName(int i)
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case 0: return "None"; break;
|
|
||||||
case 1: return "Tap"; break;
|
|
||||||
case 2: return "Double Tap"; break;
|
|
||||||
case 4: return "Hold"; break;
|
|
||||||
case 8: return "Drag"; break;
|
|
||||||
case 16: return "Swipe Right"; break;
|
|
||||||
case 32: return "Swipe Left"; break;
|
|
||||||
case 64: return "Swipe Up"; break;
|
|
||||||
case 128: return "Swipe Down"; break;
|
|
||||||
case 256: return "Pinch In"; break;
|
|
||||||
case 512: return "Pinch Out"; break;
|
|
||||||
default: return "Unknown"; break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Color GetGestureColor(int i)
|
// Get color for gesture value
|
||||||
|
static Color GetGestureColor(int gesture)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (gesture)
|
||||||
{
|
{
|
||||||
case 0: return BLACK; break;
|
case 0: return BLACK; break;
|
||||||
case 1: return BLUE; break;
|
case 1: return BLUE; break;
|
||||||
case 2: return SKYBLUE; break;
|
case 2: return SKYBLUE; break;
|
||||||
case 4: return BLACK; break;
|
case 4: return BLACK; break;
|
||||||
case 8: return LIME; break;
|
case 8: return LIME; break;
|
||||||
case 16: return RED; break;
|
case 16: return RED; break;
|
||||||
case 32: return RED; break;
|
case 32: return RED; break;
|
||||||
case 64: return RED; break;
|
case 64: return RED; break;
|
||||||
case 128: return RED; break;
|
case 128: return RED; break;
|
||||||
case 256: return VIOLET; break;
|
case 256: return VIOLET; break;
|
||||||
case 512: return ORANGE; break;
|
case 512: return ORANGE; break;
|
||||||
default: return BLACK; break;
|
default: return BLACK; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,14 +40,8 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyPressed(KEY_H))
|
if (IsKeyPressed(KEY_H))
|
||||||
{
|
{
|
||||||
if (IsCursorHidden())
|
if (IsCursorHidden()) ShowCursor();
|
||||||
{
|
else HideCursor();
|
||||||
ShowCursor();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HideCursor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ballPosition = GetMousePosition();
|
ballPosition = GetMousePosition();
|
||||||
@ -72,7 +66,7 @@ int main(void)
|
|||||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||||
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
|
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
|
||||||
|
|
||||||
if (!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
|
if (IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
|
||||||
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
|
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|||||||
@ -46,7 +46,7 @@ int main(void)
|
|||||||
// Clamp touch points available ( set the maximum touch points allowed )
|
// Clamp touch points available ( set the maximum touch points allowed )
|
||||||
if (tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
|
if (tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS;
|
||||||
// Get touch points positions
|
// Get touch points positions
|
||||||
for (int i = 0; i < tCount; ++i) touchPositions[i] = GetTouchPosition(i);
|
for (int i = 0; i < tCount; i++) touchPositions[i] = GetTouchPosition(i);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@ -55,7 +55,7 @@ int main(void)
|
|||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
for (int i = 0; i < tCount; ++i)
|
for (int i = 0; i < tCount; i++)
|
||||||
{
|
{
|
||||||
// Make sure point is not (0, 0) as this means there is no touch for it
|
// Make sure point is not (0, 0) as this means there is no touch for it
|
||||||
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
|
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
|
||||||
|
|||||||
@ -51,11 +51,31 @@ int main(void)
|
|||||||
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *buttonLabels[BUTTON_MAX] = {
|
Vector2 arrowTris[4][3] = {
|
||||||
"Y", // Up
|
// Up
|
||||||
"X", // Left
|
{
|
||||||
"B", // Right
|
{ buttonPositions[0].x, buttonPositions[0].y - 12 },
|
||||||
"A" // Down
|
{ buttonPositions[0].x - 9, buttonPositions[0].y + 9 },
|
||||||
|
{ buttonPositions[0].x + 9, buttonPositions[0].y + 9 }
|
||||||
|
},
|
||||||
|
// Left
|
||||||
|
{
|
||||||
|
{ buttonPositions[1].x + 9, buttonPositions[1].y - 9 },
|
||||||
|
{ buttonPositions[1].x - 12, buttonPositions[1].y },
|
||||||
|
{ buttonPositions[1].x + 9, buttonPositions[1].y + 9 }
|
||||||
|
},
|
||||||
|
// Right
|
||||||
|
{
|
||||||
|
{ buttonPositions[2].x + 12, buttonPositions[2].y },
|
||||||
|
{ buttonPositions[2].x - 9, buttonPositions[2].y - 9 },
|
||||||
|
{ buttonPositions[2].x - 9, buttonPositions[2].y + 9 }
|
||||||
|
},
|
||||||
|
// Down
|
||||||
|
{
|
||||||
|
{ buttonPositions[3].x - 9, buttonPositions[3].y - 9 },
|
||||||
|
{ buttonPositions[3].x, buttonPositions[3].y + 12 },
|
||||||
|
{ buttonPositions[3].x + 9, buttonPositions[3].y - 9 }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Color buttonLabelColors[BUTTON_MAX] = {
|
Color buttonLabelColors[BUTTON_MAX] = {
|
||||||
@ -128,9 +148,12 @@ int main(void)
|
|||||||
{
|
{
|
||||||
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
||||||
|
|
||||||
DrawText(buttonLabels[i],
|
DrawTriangle(
|
||||||
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
|
arrowTris[i][0],
|
||||||
20, buttonLabelColors[i]);
|
arrowTris[i][1],
|
||||||
|
arrowTris[i][2],
|
||||||
|
buttonLabelColors[i]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
||||||
|
|||||||
333
examples/core/core_keyboard_testbed.c
Normal file
@ -0,0 +1,333 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - keyboard testbed
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* NOTE: raylib defined keys refer to ENG-US Keyboard layout,
|
||||||
|
* mapping to other layouts is up to the user
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.6, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2026 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define KEY_REC_SPACING 4 // Space in pixels between key rectangles
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static const char *GetKeyText(int key);
|
||||||
|
static void GuiKeyboardKey(Rectangle bounds, int key);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard testbed");
|
||||||
|
SetExitKey(KEY_NULL); // Avoid exit on KEY_ESCAPE
|
||||||
|
|
||||||
|
// Keyboard line 01
|
||||||
|
int line01KeyWidths[15] = { 0 };
|
||||||
|
for (int i = 0; i < 15; i++) line01KeyWidths[i] = 45;
|
||||||
|
line01KeyWidths[13] = 62; // PRINTSCREEN
|
||||||
|
int line01Keys[15] = {
|
||||||
|
KEY_ESCAPE, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
|
||||||
|
KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
|
||||||
|
KEY_F12, KEY_PRINT_SCREEN, KEY_PAUSE
|
||||||
|
};
|
||||||
|
|
||||||
|
// Keyboard line 02
|
||||||
|
int line02KeyWidths[15] = { 0 };
|
||||||
|
for (int i = 0; i < 15; i++) line02KeyWidths[i] = 45;
|
||||||
|
line02KeyWidths[0] = 25; // GRAVE
|
||||||
|
line02KeyWidths[13] = 82; // BACKSPACE
|
||||||
|
int line02Keys[15] = {
|
||||||
|
KEY_GRAVE, KEY_ONE, KEY_TWO, KEY_THREE, KEY_FOUR,
|
||||||
|
KEY_FIVE, KEY_SIX, KEY_SEVEN, KEY_EIGHT, KEY_NINE,
|
||||||
|
KEY_ZERO, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_DELETE };
|
||||||
|
|
||||||
|
// Keyboard line 03
|
||||||
|
int line03KeyWidths[15] = { 0 };
|
||||||
|
for (int i = 0; i < 15; i++) line03KeyWidths[i] = 45;
|
||||||
|
line03KeyWidths[0] = 50; // TAB
|
||||||
|
line03KeyWidths[13] = 57; // BACKSLASH
|
||||||
|
int line03Keys[15] = {
|
||||||
|
KEY_TAB, KEY_Q, KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y,
|
||||||
|
KEY_U, KEY_I, KEY_O, KEY_P, KEY_LEFT_BRACKET,
|
||||||
|
KEY_RIGHT_BRACKET, KEY_BACKSLASH, KEY_INSERT
|
||||||
|
};
|
||||||
|
|
||||||
|
// Keyboard line 04
|
||||||
|
int line04KeyWidths[14] = { 0 };
|
||||||
|
for (int i = 0; i < 14; i++) line04KeyWidths[i] = 45;
|
||||||
|
line04KeyWidths[0] = 68; // CAPS
|
||||||
|
line04KeyWidths[12] = 88; // ENTER
|
||||||
|
int line04Keys[14] = {
|
||||||
|
KEY_CAPS_LOCK, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G,
|
||||||
|
KEY_H, KEY_J, KEY_K, KEY_L, KEY_SEMICOLON,
|
||||||
|
KEY_APOSTROPHE, KEY_ENTER, KEY_PAGE_UP
|
||||||
|
};
|
||||||
|
|
||||||
|
// Keyboard line 05
|
||||||
|
int line05KeyWidths[14] = { 0 };
|
||||||
|
for (int i = 0; i < 14; i++) line05KeyWidths[i] = 45;
|
||||||
|
line05KeyWidths[0] = 80; // LSHIFT
|
||||||
|
line05KeyWidths[11] = 76; // RSHIFT
|
||||||
|
int line05Keys[14] = {
|
||||||
|
KEY_LEFT_SHIFT, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B,
|
||||||
|
KEY_N, KEY_M, KEY_COMMA, KEY_PERIOD, /*KEY_MINUS*/
|
||||||
|
KEY_SLASH, KEY_RIGHT_SHIFT, KEY_UP, KEY_PAGE_DOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
// Keyboard line 06
|
||||||
|
int line06KeyWidths[11] = { 0 };
|
||||||
|
for (int i = 0; i < 11; i++) line06KeyWidths[i] = 45;
|
||||||
|
line06KeyWidths[0] = 80; // LCTRL
|
||||||
|
line06KeyWidths[3] = 208; // SPACE
|
||||||
|
line06KeyWidths[7] = 60; // RCTRL
|
||||||
|
int line06Keys[11] = {
|
||||||
|
KEY_LEFT_CONTROL, KEY_LEFT_SUPER, KEY_LEFT_ALT,
|
||||||
|
KEY_SPACE, KEY_RIGHT_ALT, 162, KEY_NULL,
|
||||||
|
KEY_RIGHT_CONTROL, KEY_LEFT, KEY_DOWN, KEY_RIGHT
|
||||||
|
};
|
||||||
|
|
||||||
|
Vector2 keyboardOffset = { 26, 80 };
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int key = GetKeyPressed(); // Get pressed keycode
|
||||||
|
if (key > 0) TraceLog(LOG_INFO, "KEYBOARD TESTBED: KEY PRESSED: %d", key);
|
||||||
|
|
||||||
|
int ch = GetCharPressed(); // Get pressed char for text input, using OS mapping
|
||||||
|
if (ch > 0) TraceLog(LOG_INFO, "KEYBOARD TESTBED: CHAR PRESSED: %c (%d)", ch, ch);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("KEYBOARD LAYOUT: ENG-US", 26, 38, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
// Keyboard line 01 - 15 keys
|
||||||
|
// ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, IMP, CLOSE
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y, (float)line01KeyWidths[i], 30.0f }, line01Keys[i]);
|
||||||
|
recOffsetX += line01KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard line 02 - 15 keys
|
||||||
|
// `, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, BACKSPACE, DEL
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + KEY_REC_SPACING, (float)line02KeyWidths[i], 38.0f }, line02Keys[i]);
|
||||||
|
recOffsetX += line02KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard line 03 - 15 keys
|
||||||
|
// TAB, Q, W, E, R, T, Y, U, I, O, P, [, ], \, INS
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + 38 + KEY_REC_SPACING*2, (float)line03KeyWidths[i], 38.0f }, line03Keys[i]);
|
||||||
|
recOffsetX += line03KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard line 04 - 14 keys
|
||||||
|
// MAYUS, A, S, D, F, G, H, J, K, L, ;, ', ENTER, REPAG
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 14; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + 38*2 + KEY_REC_SPACING*3, (float)line04KeyWidths[i], 38.0f }, line04Keys[i]);
|
||||||
|
recOffsetX += line04KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard line 05 - 14 keys
|
||||||
|
// LSHIFT, Z, X, C, V, B, N, M, ,, ., /, RSHIFT, UP, AVPAG
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 14; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + 38*3 + KEY_REC_SPACING*4, (float)line05KeyWidths[i], 38.0f }, line05Keys[i]);
|
||||||
|
recOffsetX += line05KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard line 06 - 11 keys
|
||||||
|
// LCTRL, WIN, LALT, SPACE, ALTGR, \, FN, RCTRL, LEFT, DOWN, RIGHT
|
||||||
|
for (int i = 0, recOffsetX = 0; i < 11; i++)
|
||||||
|
{
|
||||||
|
GuiKeyboardKey((Rectangle){ keyboardOffset.x + recOffsetX, keyboardOffset.y + 30 + 38*4 + KEY_REC_SPACING*5, (float)line06KeyWidths[i], 38.0f }, line06Keys[i]);
|
||||||
|
recOffsetX += line06KeyWidths[i] + KEY_REC_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Get keyboard keycode as text (US keyboard)
|
||||||
|
// NOTE: Mapping for other keyboard layouts can be done here
|
||||||
|
static const char *GetKeyText(int key)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case KEY_APOSTROPHE : return "'"; // Key: '
|
||||||
|
case KEY_COMMA : return ","; // Key: ,
|
||||||
|
case KEY_MINUS : return "-"; // Key: -
|
||||||
|
case KEY_PERIOD : return "."; // Key: .
|
||||||
|
case KEY_SLASH : return "/"; // Key: /
|
||||||
|
case KEY_ZERO : return "0"; // Key: 0
|
||||||
|
case KEY_ONE : return "1"; // Key: 1
|
||||||
|
case KEY_TWO : return "2"; // Key: 2
|
||||||
|
case KEY_THREE : return "3"; // Key: 3
|
||||||
|
case KEY_FOUR : return "4"; // Key: 4
|
||||||
|
case KEY_FIVE : return "5"; // Key: 5
|
||||||
|
case KEY_SIX : return "6"; // Key: 6
|
||||||
|
case KEY_SEVEN : return "7"; // Key: 7
|
||||||
|
case KEY_EIGHT : return "8"; // Key: 8
|
||||||
|
case KEY_NINE : return "9"; // Key: 9
|
||||||
|
case KEY_SEMICOLON : return ";"; // Key: ;
|
||||||
|
case KEY_EQUAL : return "="; // Key: =
|
||||||
|
case KEY_A : return "A"; // Key: A | a
|
||||||
|
case KEY_B : return "B"; // Key: B | b
|
||||||
|
case KEY_C : return "C"; // Key: C | c
|
||||||
|
case KEY_D : return "D"; // Key: D | d
|
||||||
|
case KEY_E : return "E"; // Key: E | e
|
||||||
|
case KEY_F : return "F"; // Key: F | f
|
||||||
|
case KEY_G : return "G"; // Key: G | g
|
||||||
|
case KEY_H : return "H"; // Key: H | h
|
||||||
|
case KEY_I : return "I"; // Key: I | i
|
||||||
|
case KEY_J : return "J"; // Key: J | j
|
||||||
|
case KEY_K : return "K"; // Key: K | k
|
||||||
|
case KEY_L : return "L"; // Key: L | l
|
||||||
|
case KEY_M : return "M"; // Key: M | m
|
||||||
|
case KEY_N : return "N"; // Key: N | n
|
||||||
|
case KEY_O : return "O"; // Key: O | o
|
||||||
|
case KEY_P : return "P"; // Key: P | p
|
||||||
|
case KEY_Q : return "Q"; // Key: Q | q
|
||||||
|
case KEY_R : return "R"; // Key: R | r
|
||||||
|
case KEY_S : return "S"; // Key: S | s
|
||||||
|
case KEY_T : return "T"; // Key: T | t
|
||||||
|
case KEY_U : return "U"; // Key: U | u
|
||||||
|
case KEY_V : return "V"; // Key: V | v
|
||||||
|
case KEY_W : return "W"; // Key: W | w
|
||||||
|
case KEY_X : return "X"; // Key: X | x
|
||||||
|
case KEY_Y : return "Y"; // Key: Y | y
|
||||||
|
case KEY_Z : return "Z"; // Key: Z | z
|
||||||
|
case KEY_LEFT_BRACKET : return "["; // Key: [
|
||||||
|
case KEY_BACKSLASH : return "\\"; // Key: '\'
|
||||||
|
case KEY_RIGHT_BRACKET : return "]"; // Key: ]
|
||||||
|
case KEY_GRAVE : return "`"; // Key: `
|
||||||
|
case KEY_SPACE : return "SPACE"; // Key: Space
|
||||||
|
case KEY_ESCAPE : return "ESC"; // Key: Esc
|
||||||
|
case KEY_ENTER : return "ENTER"; // Key: Enter
|
||||||
|
case KEY_TAB : return "TAB"; // Key: Tab
|
||||||
|
case KEY_BACKSPACE : return "BACK"; // Key: Backspace
|
||||||
|
case KEY_INSERT : return "INS"; // Key: Ins
|
||||||
|
case KEY_DELETE : return "DEL"; // Key: Del
|
||||||
|
case KEY_RIGHT : return "RIGHT"; // Key: Cursor right
|
||||||
|
case KEY_LEFT : return "LEFT"; // Key: Cursor left
|
||||||
|
case KEY_DOWN : return "DOWN"; // Key: Cursor down
|
||||||
|
case KEY_UP : return "UP"; // Key: Cursor up
|
||||||
|
case KEY_PAGE_UP : return "PGUP"; // Key: Page up
|
||||||
|
case KEY_PAGE_DOWN : return "PGDOWN"; // Key: Page down
|
||||||
|
case KEY_HOME : return "HOME"; // Key: Home
|
||||||
|
case KEY_END : return "END"; // Key: End
|
||||||
|
case KEY_CAPS_LOCK : return "CAPS"; // Key: Caps lock
|
||||||
|
case KEY_SCROLL_LOCK : return "LOCK"; // Key: Scroll down
|
||||||
|
case KEY_NUM_LOCK : return "NUMLOCK"; // Key: Num lock
|
||||||
|
case KEY_PRINT_SCREEN : return "PRINTSCR"; // Key: Print screen
|
||||||
|
case KEY_PAUSE : return "PAUSE"; // Key: Pause
|
||||||
|
case KEY_F1 : return "F1"; // Key: F1
|
||||||
|
case KEY_F2 : return "F2"; // Key: F2
|
||||||
|
case KEY_F3 : return "F3"; // Key: F3
|
||||||
|
case KEY_F4 : return "F4"; // Key: F4
|
||||||
|
case KEY_F5 : return "F5"; // Key: F5
|
||||||
|
case KEY_F6 : return "F6"; // Key: F6
|
||||||
|
case KEY_F7 : return "F7"; // Key: F7
|
||||||
|
case KEY_F8 : return "F8"; // Key: F8
|
||||||
|
case KEY_F9 : return "F9"; // Key: F9
|
||||||
|
case KEY_F10 : return "F10"; // Key: F10
|
||||||
|
case KEY_F11 : return "F11"; // Key: F11
|
||||||
|
case KEY_F12 : return "F12"; // Key: F12
|
||||||
|
case KEY_LEFT_SHIFT : return "LSHIFT"; // Key: Shift left
|
||||||
|
case KEY_LEFT_CONTROL : return "LCTRL"; // Key: Control left
|
||||||
|
case KEY_LEFT_ALT : return "LALT"; // Key: Alt left
|
||||||
|
case KEY_LEFT_SUPER : return "WIN"; // Key: Super left
|
||||||
|
case KEY_RIGHT_SHIFT : return "RSHIFT"; // Key: Shift right
|
||||||
|
case KEY_RIGHT_CONTROL : return "RCTRL"; // Key: Control right
|
||||||
|
case KEY_RIGHT_ALT : return "ALTGR"; // Key: Alt right
|
||||||
|
case KEY_RIGHT_SUPER : return "RSUPER"; // Key: Super right
|
||||||
|
case KEY_KB_MENU : return "KBMENU"; // Key: KB menu
|
||||||
|
case KEY_KP_0 : return "KP0"; // Key: Keypad 0
|
||||||
|
case KEY_KP_1 : return "KP1"; // Key: Keypad 1
|
||||||
|
case KEY_KP_2 : return "KP2"; // Key: Keypad 2
|
||||||
|
case KEY_KP_3 : return "KP3"; // Key: Keypad 3
|
||||||
|
case KEY_KP_4 : return "KP4"; // Key: Keypad 4
|
||||||
|
case KEY_KP_5 : return "KP5"; // Key: Keypad 5
|
||||||
|
case KEY_KP_6 : return "KP6"; // Key: Keypad 6
|
||||||
|
case KEY_KP_7 : return "KP7"; // Key: Keypad 7
|
||||||
|
case KEY_KP_8 : return "KP8"; // Key: Keypad 8
|
||||||
|
case KEY_KP_9 : return "KP9"; // Key: Keypad 9
|
||||||
|
case KEY_KP_DECIMAL : return "KPDEC"; // Key: Keypad .
|
||||||
|
case KEY_KP_DIVIDE : return "KPDIV"; // Key: Keypad /
|
||||||
|
case KEY_KP_MULTIPLY : return "KPMUL"; // Key: Keypad *
|
||||||
|
case KEY_KP_SUBTRACT : return "KPSUB"; // Key: Keypad -
|
||||||
|
case KEY_KP_ADD : return "KPADD"; // Key: Keypad +
|
||||||
|
case KEY_KP_ENTER : return "KPENTER"; // Key: Keypad Enter
|
||||||
|
case KEY_KP_EQUAL : return "KPEQU"; // Key: Keypad =
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw keyboard key
|
||||||
|
static void GuiKeyboardKey(Rectangle bounds, int key)
|
||||||
|
{
|
||||||
|
if (key == KEY_NULL) DrawRectangleLinesEx(bounds, 2.0f, LIGHTGRAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsKeyDown(key))
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(bounds, 2.0f, MAROON);
|
||||||
|
DrawText(GetKeyText(key), (int)(bounds.x + 4), (int)(bounds.y + 4), 10, MAROON);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(bounds, 2.0f, DARKGRAY);
|
||||||
|
DrawText(GetKeyText(key), (int)(bounds.x + 4), (int)(bounds.y + 4), 10, DARKGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(GetMousePosition(), bounds))
|
||||||
|
{
|
||||||
|
DrawRectangleRec(bounds, Fade(RED, 0.2f));
|
||||||
|
DrawRectangleLinesEx(bounds, 3.0f, RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
examples/core/core_keyboard_testbed.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
160
examples/core/core_monitor_detector.c
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - monitor detector
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Maicon Santana (@maiconpintoabreu) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Maicon Santana (@maiconpintoabreu)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_MONITORS 10
|
||||||
|
|
||||||
|
// Monitor info
|
||||||
|
typedef struct MonitorInfo {
|
||||||
|
Vector2 position;
|
||||||
|
const char *name;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int physicalWidth;
|
||||||
|
int physicalHeight;
|
||||||
|
int refreshRate;
|
||||||
|
} MonitorInfo;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - monitor detector");
|
||||||
|
|
||||||
|
MonitorInfo monitors[MAX_MONITORS] = { 0 };
|
||||||
|
int currentMonitorIndex = GetCurrentMonitor();
|
||||||
|
int monitorCount = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Variables to find the max x and Y to calculate the scale
|
||||||
|
int maxWidth = 1;
|
||||||
|
int maxHeight = 1;
|
||||||
|
|
||||||
|
// Monitor offset is to fix when monitor position x is negative
|
||||||
|
int monitorOffsetX = 0;
|
||||||
|
|
||||||
|
// Rebuild monitors array every frame
|
||||||
|
monitorCount = GetMonitorCount();
|
||||||
|
for (int i = 0; i < monitorCount; i++)
|
||||||
|
{
|
||||||
|
monitors[i] = (MonitorInfo){
|
||||||
|
GetMonitorPosition(i),
|
||||||
|
GetMonitorName(i),
|
||||||
|
GetMonitorWidth(i),
|
||||||
|
GetMonitorHeight(i),
|
||||||
|
GetMonitorPhysicalWidth(i),
|
||||||
|
GetMonitorPhysicalHeight(i),
|
||||||
|
GetMonitorRefreshRate(i)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (monitors[i].position.x < monitorOffsetX) monitorOffsetX = -(int)monitors[i].position.x;
|
||||||
|
|
||||||
|
const int width = (int)monitors[i].position.x + monitors[i].width;
|
||||||
|
const int height = (int)monitors[i].position.y + monitors[i].height;
|
||||||
|
|
||||||
|
if (maxWidth < width) maxWidth = width;
|
||||||
|
if (maxHeight < height) maxHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER) && (monitorCount > 1))
|
||||||
|
{
|
||||||
|
currentMonitorIndex += 1;
|
||||||
|
|
||||||
|
// Set index to 0 if the last one
|
||||||
|
if (currentMonitorIndex == monitorCount) currentMonitorIndex = 0;
|
||||||
|
|
||||||
|
SetWindowMonitor(currentMonitorIndex); // Move window to currentMonitorIndex
|
||||||
|
}
|
||||||
|
else currentMonitorIndex = GetCurrentMonitor(); // Get currentMonitorIndex if manually moved
|
||||||
|
|
||||||
|
float monitorScale = 0.6f;
|
||||||
|
|
||||||
|
if (maxHeight > (maxWidth + monitorOffsetX)) monitorScale *= ((float)screenHeight/(float)maxHeight);
|
||||||
|
else monitorScale *= ((float)screenWidth/(float)(maxWidth + monitorOffsetX));
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Press [Enter] to move window to next monitor available", 20, 20, 20, DARKGRAY);
|
||||||
|
|
||||||
|
DrawRectangleLines(20, 60, screenWidth - 40, screenHeight - 100, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw Monitor Rectangles with information inside
|
||||||
|
for (int i = 0; i < monitorCount; i++)
|
||||||
|
{
|
||||||
|
// Calculate retangle position and size using monitorScale
|
||||||
|
const Rectangle rec = (Rectangle){
|
||||||
|
(monitors[i].position.x + monitorOffsetX)*monitorScale + 140,
|
||||||
|
monitors[i].position.y*monitorScale + 80,
|
||||||
|
monitors[i].width*monitorScale,
|
||||||
|
monitors[i].height*monitorScale
|
||||||
|
};
|
||||||
|
|
||||||
|
// Draw monitor name and information inside the rectangle
|
||||||
|
DrawText(TextFormat("[%i] %s", i, monitors[i].name), (int)rec.x + 10, (int)rec.y + (int)(100*monitorScale), (int)(120*monitorScale), BLUE);
|
||||||
|
DrawText(
|
||||||
|
TextFormat("Resolution: [%ipx x %ipx]\nRefreshRate: [%ihz]\nPhysical Size: [%imm x %imm]\nPosition: %3.0f x %3.0f",
|
||||||
|
monitors[i].width,
|
||||||
|
monitors[i].height,
|
||||||
|
monitors[i].refreshRate,
|
||||||
|
monitors[i].physicalWidth,
|
||||||
|
monitors[i].physicalHeight,
|
||||||
|
monitors[i].position.x,
|
||||||
|
monitors[i].position.y
|
||||||
|
), (int)rec.x + 10, (int)rec.y + (int)(200*monitorScale), (int)(120*monitorScale), DARKGRAY);
|
||||||
|
|
||||||
|
// Highlight current monitor
|
||||||
|
if (i == currentMonitorIndex)
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(rec, 5, RED);
|
||||||
|
Vector2 windowPosition = (Vector2){ (GetWindowPosition().x + monitorOffsetX)*monitorScale + 140, GetWindowPosition().y*monitorScale + 80 };
|
||||||
|
|
||||||
|
// Draw window position based on monitors
|
||||||
|
DrawRectangleV(windowPosition, (Vector2){screenWidth*monitorScale, screenHeight*monitorScale}, Fade(GREEN, 0.5));
|
||||||
|
}
|
||||||
|
else DrawRectangleLinesEx(rec, 5, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_monitor_detector.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
@ -16,6 +16,7 @@
|
|||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: malloc(), free()
|
#include <stdlib.h> // Required for: malloc(), free()
|
||||||
@ -95,8 +96,6 @@ int main(void)
|
|||||||
{
|
{
|
||||||
DrawRectangleRec(rectangles[i].rect, rectangles[i].color);
|
DrawRectangleRec(rectangles[i].rect, rectangles[i].color);
|
||||||
|
|
||||||
DrawText("Press SPACE to shuffle the sequence", 10, screenHeight - 96, 20, BLACK);
|
|
||||||
|
|
||||||
DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK);
|
DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK);
|
||||||
DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK);
|
DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK);
|
||||||
DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK);
|
DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK);
|
||||||
@ -112,7 +111,7 @@ int main(void)
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
free(rectangles);
|
RL_FREE(rectangles);
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 5.6-dev, last time updated with raylib 5.6-dev
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
*
|
*
|
||||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software
|
* BSD-like license that allows static linking with closed source software
|
||||||
@ -65,6 +65,7 @@ int main(void)
|
|||||||
|
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, 20, 20, RED);
|
||||||
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
@ -75,11 +76,12 @@ int main(void)
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw our render texture with rotation applied
|
// Draw our render texture with rotation applied
|
||||||
// NOTE: We set the origin of the texture to the center of the render texture
|
// NOTE 1: We set the origin of the texture to the center of the render texture
|
||||||
|
// NOTE 2: We flip vertically the texture setting negative source rectangle height
|
||||||
DrawTexturePro(target.texture,
|
DrawTexturePro(target.texture,
|
||||||
(Rectangle){ 0, 0, target.texture.width, -target.texture.height },
|
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||||
(Rectangle){ screenWidth/2, screenHeight/2, target.texture.width, -target.texture.height },
|
(Rectangle){ screenWidth/2.0f, screenHeight/2.0f, (float)target.texture.width, (float)target.texture.height },
|
||||||
(Vector2){ target.texture.width/2, target.texture.height/2 }, rotation, WHITE);
|
(Vector2){ target.texture.width/2.0f, target.texture.height/2.0f }, rotation, WHITE);
|
||||||
|
|
||||||
DrawText("DRAWING BOUNCING BALL INSIDE RENDER TEXTURE!", 10, screenHeight - 40, 20, BLACK);
|
DrawText("DRAWING BOUNCING BALL INSIDE RENDER TEXTURE!", 10, screenHeight - 40, 20, BLACK);
|
||||||
|
|
||||||
|
|||||||
166
examples/core/core_screen_recording.c
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - screen recording
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 6.0, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// Using msf_gif library to record frames into GIF
|
||||||
|
#define MSF_GIF_IMPL
|
||||||
|
#include "msf_gif.h" // GIF recording functionality
|
||||||
|
|
||||||
|
#include <math.h> // Required for: sinf()
|
||||||
|
|
||||||
|
#define GIF_RECORD_FRAMERATE 5 // Record framerate, we get a frame every N frames
|
||||||
|
|
||||||
|
#define MAX_SINEWAVE_POINTS 256
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - screen recording");
|
||||||
|
|
||||||
|
bool gifRecording = false; // GIF recording state
|
||||||
|
unsigned int gifFrameCounter = 0; // GIF frames counter
|
||||||
|
MsfGifState gifState = { 0 }; // MSGIF context state
|
||||||
|
|
||||||
|
Vector2 circlePosition = { 0.0f, screenHeight/2.0f };
|
||||||
|
float timeCounter = 0.0f;
|
||||||
|
|
||||||
|
// Get sine wave points for line drawing
|
||||||
|
Vector2 sinePoints[MAX_SINEWAVE_POINTS] = { 0 };
|
||||||
|
for (int i = 0; i < MAX_SINEWAVE_POINTS; i++)
|
||||||
|
{
|
||||||
|
sinePoints[i].x = i*GetScreenWidth()/180.0f;
|
||||||
|
sinePoints[i].y = screenHeight/2.0f + 150*sinf((2*PI/1.5f)*(1.0f/60.0f)*(float)i); // Calculate for 60 fps
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Update circle sinusoidal movement
|
||||||
|
timeCounter += GetFrameTime();
|
||||||
|
circlePosition.x += GetScreenWidth()/180.0f;
|
||||||
|
circlePosition.y = screenHeight/2.0f + 150*sinf((2*PI/1.5f)*timeCounter);
|
||||||
|
if (circlePosition.x > screenWidth)
|
||||||
|
{
|
||||||
|
circlePosition.x = 0.0f;
|
||||||
|
circlePosition.y = screenHeight/2.0f;
|
||||||
|
timeCounter = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start-Stop GIF recording on CTRL+R
|
||||||
|
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
if (gifRecording)
|
||||||
|
{
|
||||||
|
// Stop current recording and save file
|
||||||
|
gifRecording = false;
|
||||||
|
MsfGifResult result = msf_gif_end(&gifState);
|
||||||
|
SaveFileData(TextFormat("%s/screenrecording.gif", GetApplicationDirectory()), result.data, (unsigned int)result.dataSize);
|
||||||
|
msf_gif_free(result);
|
||||||
|
|
||||||
|
TraceLog(LOG_INFO, "Finish animated GIF recording");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start a new recording
|
||||||
|
gifRecording = true;
|
||||||
|
gifFrameCounter = 0;
|
||||||
|
msf_gif_begin(&gifState, GetRenderWidth(), GetRenderHeight());
|
||||||
|
|
||||||
|
TraceLog(LOG_INFO, "Start animated GIF recording");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gifRecording)
|
||||||
|
{
|
||||||
|
gifFrameCounter++;
|
||||||
|
|
||||||
|
// NOTE: We record one gif frame depending on the desired gif framerate
|
||||||
|
if (gifFrameCounter > GIF_RECORD_FRAMERATE)
|
||||||
|
{
|
||||||
|
// Get image data for the current frame (from backbuffer)
|
||||||
|
// WARNING: This process is quite slow, it can generate stuttering
|
||||||
|
Image imScreen = LoadImageFromScreen();
|
||||||
|
|
||||||
|
// Add the frame to the gif recording, providing and "estimated" time for display in centiseconds
|
||||||
|
msf_gif_frame(&gifState, imScreen.data, (int)((1.0f/60.0f)*GIF_RECORD_FRAMERATE)/10, 16, imScreen.width*4);
|
||||||
|
gifFrameCounter = 0;
|
||||||
|
|
||||||
|
UnloadImage(imScreen); // Free image data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
for (int i = 0; i < (MAX_SINEWAVE_POINTS - 1); i++)
|
||||||
|
{
|
||||||
|
DrawLineV(sinePoints[i], sinePoints[i + 1], MAROON);
|
||||||
|
DrawCircleV(sinePoints[i], 3, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawCircleV(circlePosition, 30, RED);
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Draw record indicator
|
||||||
|
// WARNING: If drawn here, it will appear in the recorded image,
|
||||||
|
// use a render texture instead for the recording and LoadImageFromTexture(rt.texture)
|
||||||
|
if (gifRecording)
|
||||||
|
{
|
||||||
|
// Display the recording indicator every half-second
|
||||||
|
if ((int)(GetTime()/0.5)%2 == 1)
|
||||||
|
{
|
||||||
|
DrawCircle(30, GetScreenHeight() - 20, 10, MAROON);
|
||||||
|
DrawText("GIF RECORDING", 50, GetScreenHeight() - 25, 10, RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// If still recording a GIF on close window, just finish
|
||||||
|
if (gifRecording)
|
||||||
|
{
|
||||||
|
MsfGifResult result = msf_gif_end(&gifState);
|
||||||
|
msf_gif_free(result);
|
||||||
|
gifRecording = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_screen_recording.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
173
examples/core/core_text_file_loading.c
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - text file loading
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Aanjishnu Bhattacharyya (@NimComPoo-04) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 0 Aanjishnu Bhattacharyya (@NimComPoo-04)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "raymath.h" // Required for: Lerp()
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - text file loading");
|
||||||
|
|
||||||
|
// Setting up the camera
|
||||||
|
Camera2D cam = {
|
||||||
|
.offset = {0, 0},
|
||||||
|
.target = {0, 0},
|
||||||
|
.rotation = 0,
|
||||||
|
.zoom = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// Loading text file from resources/text_file.txt
|
||||||
|
const char *fileName = "resources/text_file.txt";
|
||||||
|
char *text = LoadFileText(fileName);
|
||||||
|
|
||||||
|
// Loading all the text lines
|
||||||
|
int lineCount = 0;
|
||||||
|
char **lines = LoadTextLines(text, &lineCount);
|
||||||
|
|
||||||
|
// Stylistic choises
|
||||||
|
int fontSize = 20;
|
||||||
|
int textTop = 25 + fontSize; // Top of the screen from where the text is rendered
|
||||||
|
int wrapWidth = screenWidth - 20;
|
||||||
|
|
||||||
|
// Wrap the lines as needed
|
||||||
|
for (int i = 0; i < lineCount; i++)
|
||||||
|
{
|
||||||
|
int j = 0;
|
||||||
|
int lastSpace = 0; // Keeping track of last valid space to insert '\n'
|
||||||
|
int lastWrapStart = 0; // Keeping track of the start of this wrapped line.
|
||||||
|
|
||||||
|
while (j <= strlen(lines[i]))
|
||||||
|
{
|
||||||
|
if (lines[i][j] == ' ' || lines[i][j] == '\0')
|
||||||
|
{
|
||||||
|
char before = lines[i][j];
|
||||||
|
// Making a C Style string by adding a '\0' at the required location so that we can use the MeasureText function
|
||||||
|
lines[i][j] = '\0';
|
||||||
|
|
||||||
|
// Checking if the text has crossed the wrapWidth, then going back and inserting a newline
|
||||||
|
if (MeasureText(lines[i] + lastWrapStart, fontSize) > wrapWidth)
|
||||||
|
{
|
||||||
|
lines[i][lastSpace] = '\n';
|
||||||
|
|
||||||
|
// Since we added a newline the place of wrap changed so we update our lastWrapStart
|
||||||
|
lastWrapStart = lastSpace + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(before != '\0') lines[i][j] = ' '; // Resetting the space back
|
||||||
|
lastSpace = j; // Since we encountered a new space we update our last encountered space location
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculating the total height so that we can show a scrollbar
|
||||||
|
int textHeight = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < lineCount; i++)
|
||||||
|
{
|
||||||
|
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], (float)fontSize, 2);
|
||||||
|
textHeight += (int)size.y + 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A simple scrollbar on the side to show how far we have read into the file
|
||||||
|
Rectangle scrollBar = {
|
||||||
|
.x = (float)screenWidth - 5,
|
||||||
|
.y = 0,
|
||||||
|
.width = 5,
|
||||||
|
.height = screenHeight*100.0f/(textHeight - screenHeight) // Scrollbar height is just a percentage
|
||||||
|
};
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
float scroll = GetMouseWheelMove();
|
||||||
|
cam.target.y -= scroll*fontSize*1.5f; // Choosing an arbitrary speed for scroll
|
||||||
|
|
||||||
|
if (cam.target.y < 0) cam.target.y = 0; // Snapping to 0 if we go too far back
|
||||||
|
|
||||||
|
// Ensuring that the camera does not scroll past all text
|
||||||
|
if (cam.target.y > textHeight - screenHeight + textTop)
|
||||||
|
cam.target.y = (float)textHeight - screenHeight + textTop;
|
||||||
|
|
||||||
|
// Computing the position of the scrollBar depending on the percentage of text covered
|
||||||
|
scrollBar.y = Lerp((float)textTop, (float)screenHeight - scrollBar.height, (float)(cam.target.y - textTop)/(textHeight - screenHeight));
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode2D(cam);
|
||||||
|
// Going through all the read lines
|
||||||
|
for (int i = 0, t = textTop; i < lineCount; i++)
|
||||||
|
{
|
||||||
|
// Each time we go through and calculate the height of the text to move the cursor appropriately
|
||||||
|
Vector2 size;
|
||||||
|
if(strcmp(lines[i], "")){
|
||||||
|
// Fix for empty line in the text file
|
||||||
|
size = MeasureTextEx( GetFontDefault(), lines[i], (float)fontSize, 2);
|
||||||
|
}else{
|
||||||
|
size = MeasureTextEx( GetFontDefault(), " ", (float)fontSize, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText(lines[i], 10, t, fontSize, RED);
|
||||||
|
|
||||||
|
// Inserting extra space for real newlines,
|
||||||
|
// wrapped lines are rendered closer together
|
||||||
|
t += (int)size.y + 10;
|
||||||
|
}
|
||||||
|
EndMode2D();
|
||||||
|
|
||||||
|
// Header displaying which file is being read currently
|
||||||
|
DrawRectangle(0, 0, screenWidth, textTop - 10, BEIGE);
|
||||||
|
DrawText(TextFormat("File: %s", fileName), 10, 10, fontSize, MAROON);
|
||||||
|
|
||||||
|
DrawRectangleRec(scrollBar, MAROON);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTextLines(lines, lineCount);
|
||||||
|
UnloadFileText(text);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_text_file_loading.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
312
examples/core/core_undo_redo.c
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - undo redo
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★★☆] 3/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> // Required for: calloc(), free()
|
||||||
|
#include <string.h> // Required for: memcpy(), strcmp()
|
||||||
|
|
||||||
|
#define MAX_UNDO_STATES 26 // Maximum undo states supported for the ring buffer
|
||||||
|
|
||||||
|
#define GRID_CELL_SIZE 24
|
||||||
|
#define MAX_GRID_CELLS_X 30
|
||||||
|
#define MAX_GRID_CELLS_Y 13
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Point struct, like Vector2 but using int
|
||||||
|
typedef struct {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
} Point;
|
||||||
|
|
||||||
|
// Player state struct
|
||||||
|
// NOTE: Contains all player data that needs to be affected by undo/redo
|
||||||
|
typedef struct {
|
||||||
|
Point cell;
|
||||||
|
Color color;
|
||||||
|
} PlayerState;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Draw undo system visualization logic
|
||||||
|
static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoIndex, int currentUndoIndex, int slotSize);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
// We have multiple options to implement an Undo/Redo system
|
||||||
|
// Probably the most professional one is using the Command pattern to
|
||||||
|
// define Actions and store those actions into an array as the events happen,
|
||||||
|
// raylib internal Automation System actually uses a similar approach,
|
||||||
|
// but in this example we are using another more simple solution,
|
||||||
|
// just record PlayerState changes when detected, checking for changes every certain frames
|
||||||
|
// This approach requires more memory and is more performance costly but it is quite simple to implement
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - undo redo");
|
||||||
|
|
||||||
|
// Undo/redo system variables
|
||||||
|
int currentUndoIndex = 0;
|
||||||
|
int firstUndoIndex = 0;
|
||||||
|
int lastUndoIndex = 0;
|
||||||
|
int undoFrameCounter = 0;
|
||||||
|
Vector2 undoInfoPos = { 110, 400 };
|
||||||
|
|
||||||
|
// Init current player state and undo/redo recorded states array
|
||||||
|
PlayerState player = { 0 };
|
||||||
|
player.cell = (Point){ 10, 10 };
|
||||||
|
player.color = RED;
|
||||||
|
|
||||||
|
// Init undo buffer to store MAX_UNDO_STATES states
|
||||||
|
PlayerState *states = (PlayerState *)RL_CALLOC(MAX_UNDO_STATES, sizeof(PlayerState));
|
||||||
|
// Init all undo states to current state
|
||||||
|
for (int i = 0; i < MAX_UNDO_STATES; i++) memcpy(&states[i], &player, sizeof(PlayerState));
|
||||||
|
|
||||||
|
// Grid variables
|
||||||
|
Vector2 gridPosition = { 40, 60 };
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Player movement logic
|
||||||
|
if (IsKeyPressed(KEY_RIGHT)) player.cell.x++;
|
||||||
|
else if (IsKeyPressed(KEY_LEFT)) player.cell.x--;
|
||||||
|
else if (IsKeyPressed(KEY_UP)) player.cell.y--;
|
||||||
|
else if (IsKeyPressed(KEY_DOWN)) player.cell.y++;
|
||||||
|
|
||||||
|
// Make sure player does not go out of bounds
|
||||||
|
if (player.cell.x < 0) player.cell.x = 0;
|
||||||
|
else if (player.cell.x >= MAX_GRID_CELLS_X) player.cell.x = MAX_GRID_CELLS_X - 1;
|
||||||
|
if (player.cell.y < 0) player.cell.y = 0;
|
||||||
|
else if (player.cell.y >= MAX_GRID_CELLS_Y) player.cell.y = MAX_GRID_CELLS_Y - 1;
|
||||||
|
|
||||||
|
// Player color change logic
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
player.color.r = (unsigned char)GetRandomValue(20, 255);
|
||||||
|
player.color.g = (unsigned char)GetRandomValue(20, 220);
|
||||||
|
player.color.b = (unsigned char)GetRandomValue(20, 240);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Undo state change logic
|
||||||
|
undoFrameCounter++;
|
||||||
|
|
||||||
|
// Waiting a number of frames before checking if we should store a new state snapshot
|
||||||
|
if (undoFrameCounter >= 2) // Checking every 2 frames
|
||||||
|
{
|
||||||
|
if (memcmp(&states[currentUndoIndex], &player, sizeof(PlayerState)) != 0)
|
||||||
|
{
|
||||||
|
// Move cursor to next available position of the undo ring buffer to record state
|
||||||
|
currentUndoIndex++;
|
||||||
|
if (currentUndoIndex >= MAX_UNDO_STATES) currentUndoIndex = 0;
|
||||||
|
if (currentUndoIndex == firstUndoIndex) firstUndoIndex++;
|
||||||
|
if (firstUndoIndex >= MAX_UNDO_STATES) firstUndoIndex = 0;
|
||||||
|
|
||||||
|
memcpy(&states[currentUndoIndex], &player, sizeof(PlayerState));
|
||||||
|
lastUndoIndex = currentUndoIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
undoFrameCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover previous state from buffer: CTRL+Z
|
||||||
|
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_Z))
|
||||||
|
{
|
||||||
|
if (currentUndoIndex != firstUndoIndex)
|
||||||
|
{
|
||||||
|
currentUndoIndex--;
|
||||||
|
if (currentUndoIndex < 0) currentUndoIndex = MAX_UNDO_STATES - 1;
|
||||||
|
|
||||||
|
if (memcmp(&states[currentUndoIndex], &player, sizeof(PlayerState)) != 0)
|
||||||
|
{
|
||||||
|
memcpy(&player, &states[currentUndoIndex], sizeof(PlayerState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover next state from buffer: CTRL+Y
|
||||||
|
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_Y))
|
||||||
|
{
|
||||||
|
if (currentUndoIndex != lastUndoIndex)
|
||||||
|
{
|
||||||
|
int nextUndoIndex = currentUndoIndex + 1;
|
||||||
|
if (nextUndoIndex >= MAX_UNDO_STATES) nextUndoIndex = 0;
|
||||||
|
|
||||||
|
if (nextUndoIndex != firstUndoIndex)
|
||||||
|
{
|
||||||
|
currentUndoIndex = nextUndoIndex;
|
||||||
|
|
||||||
|
if (memcmp(&states[currentUndoIndex], &player, sizeof(PlayerState)) != 0)
|
||||||
|
{
|
||||||
|
memcpy(&player, &states[currentUndoIndex], sizeof(PlayerState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw controls info
|
||||||
|
DrawText("[ARROWS] MOVE PLAYER - [SPACE] CHANGE PLAYER COLOR", 40, 20, 20, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw player visited cells recorded by undo
|
||||||
|
// NOTE: Remember we are using a ring buffer approach so,
|
||||||
|
// some cells info could start at the end of the array and end at the beginning
|
||||||
|
if (lastUndoIndex > firstUndoIndex)
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
|
DrawRectangleRec((Rectangle){gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
|
GRID_CELL_SIZE, GRID_CELL_SIZE }, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
else if (firstUndoIndex > lastUndoIndex)
|
||||||
|
{
|
||||||
|
if ((currentUndoIndex < MAX_UNDO_STATES) && (currentUndoIndex > lastUndoIndex))
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
|
DrawRectangleRec((Rectangle) { gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
|
GRID_CELL_SIZE, GRID_CELL_SIZE }, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
|
DrawRectangle((int)gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, (int)gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
|
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
||||||
|
for (int i = 0; i < currentUndoIndex; i++)
|
||||||
|
DrawRectangle((int)gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, (int)gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
|
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw game grid
|
||||||
|
for (int y = 0; y <= MAX_GRID_CELLS_Y; y++)
|
||||||
|
DrawLine((int)gridPosition.x, (int)gridPosition.y + y*GRID_CELL_SIZE,
|
||||||
|
(int)gridPosition.x + MAX_GRID_CELLS_X*GRID_CELL_SIZE, (int)gridPosition.y + y*GRID_CELL_SIZE, GRAY);
|
||||||
|
for (int x = 0; x <= MAX_GRID_CELLS_X; x++)
|
||||||
|
DrawLine((int)gridPosition.x + x*GRID_CELL_SIZE, (int)gridPosition.y,
|
||||||
|
(int)gridPosition.x + x*GRID_CELL_SIZE, (int)gridPosition.y + MAX_GRID_CELLS_Y*GRID_CELL_SIZE, GRAY);
|
||||||
|
|
||||||
|
// Draw player
|
||||||
|
DrawRectangle((int)gridPosition.x + player.cell.x*GRID_CELL_SIZE, (int)gridPosition.y + player.cell.y*GRID_CELL_SIZE,
|
||||||
|
GRID_CELL_SIZE + 1, GRID_CELL_SIZE + 1, player.color);
|
||||||
|
|
||||||
|
// Draw undo system buffer info
|
||||||
|
DrawText("UNDO STATES:", (int)undoInfoPos.x - 85, (int)undoInfoPos.y + 9, 10, DARKGRAY);
|
||||||
|
DrawUndoBuffer(undoInfoPos, firstUndoIndex, lastUndoIndex, currentUndoIndex, 24);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
RL_FREE(states); // Free undo states array
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Draw undo system visualization logic
|
||||||
|
// NOTE: Visualizing the ring buffer array, every square can store a player state
|
||||||
|
static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoIndex, int currentUndoIndex, int slotSize)
|
||||||
|
{
|
||||||
|
// Draw index marks
|
||||||
|
DrawRectangle((int)position.x + 8 + slotSize*currentUndoIndex, (int)position.y - 10, 8, 8, RED);
|
||||||
|
DrawRectangleLines((int)position.x + 2 + slotSize*firstUndoIndex, (int)position.y + 27, 8, 8, BLACK);
|
||||||
|
DrawRectangle((int)position.x + 14 + slotSize*lastUndoIndex, (int)position.y + 27, 8, 8, BLACK);
|
||||||
|
|
||||||
|
// Draw background gray slots
|
||||||
|
for (int i = 0; i < MAX_UNDO_STATES; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIGHTGRAY);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw occupied slots: firstUndoIndex --> lastUndoIndex
|
||||||
|
if (firstUndoIndex <= lastUndoIndex)
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < lastUndoIndex + 1; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (lastUndoIndex < firstUndoIndex)
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < lastUndoIndex + 1; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw occupied slots: firstUndoIndex --> currentUndoIndex
|
||||||
|
if (firstUndoIndex < currentUndoIndex)
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentUndoIndex < firstUndoIndex)
|
||||||
|
{
|
||||||
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < currentUndoIndex; i++)
|
||||||
|
{
|
||||||
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw current selected UNDO slot
|
||||||
|
DrawRectangle((int)position.x + slotSize*currentUndoIndex, (int)position.y, slotSize, slotSize, GOLD);
|
||||||
|
DrawRectangleLines((int)position.x + slotSize*currentUndoIndex, (int)position.y, slotSize, slotSize, ORANGE);
|
||||||
|
}
|
||||||
BIN
examples/core/core_undo_redo.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
321
examples/core/core_viewport_scaling.c
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - viewport scaling
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Agnis Aldiņš (@nezvers) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Agnis Aldiņš (@nezvers)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RESOLUTION_COUNT 4 // For iteration purposes and teaching example
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
// Only upscale, useful for pixel art
|
||||||
|
KEEP_ASPECT_INTEGER,
|
||||||
|
KEEP_HEIGHT_INTEGER,
|
||||||
|
KEEP_WIDTH_INTEGER,
|
||||||
|
// Can also downscale
|
||||||
|
KEEP_ASPECT,
|
||||||
|
KEEP_HEIGHT,
|
||||||
|
KEEP_WIDTH,
|
||||||
|
// For itteration purposes and as a teaching example
|
||||||
|
VIEWPORT_TYPE_COUNT,
|
||||||
|
} ViewportType;
|
||||||
|
|
||||||
|
// For displaying on GUI
|
||||||
|
const char *ViewportTypeNames[VIEWPORT_TYPE_COUNT] = {
|
||||||
|
"KEEP_ASPECT_INTEGER",
|
||||||
|
"KEEP_HEIGHT_INTEGER",
|
||||||
|
"KEEP_WIDTH_INTEGER",
|
||||||
|
"KEEP_ASPECT",
|
||||||
|
"KEEP_HEIGHT",
|
||||||
|
"KEEP_WIDTH",
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void KeepAspectCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void KeepHeightCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void KeepWidthCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect);
|
||||||
|
static void ResizeRenderSize(ViewportType viewportType, int *screenWidth, int *screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect, RenderTexture2D *target);
|
||||||
|
|
||||||
|
// Example how to calculate position on RenderTexture
|
||||||
|
static Vector2 Screen2RenderTexturePosition(Vector2 point, Rectangle *textureRect, Rectangle *scaledRect);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//---------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - viewport scaling");
|
||||||
|
|
||||||
|
// Preset resolutions that could be created by subdividing screen resolution
|
||||||
|
Vector2 resolutionList[RESOLUTION_COUNT] = {
|
||||||
|
(Vector2){ 64, 64 },
|
||||||
|
(Vector2){ 256, 240 },
|
||||||
|
(Vector2){ 320, 180 },
|
||||||
|
// 4K doesn't work with integer scaling but included for example purposes with non-integer scaling
|
||||||
|
(Vector2){ 3840, 2160 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int resolutionIndex = 0;
|
||||||
|
int gameWidth = 64;
|
||||||
|
int gameHeight = 64;
|
||||||
|
|
||||||
|
RenderTexture2D target = (RenderTexture2D){ 0 };
|
||||||
|
Rectangle sourceRect = (Rectangle){ 0 };
|
||||||
|
Rectangle destRect = (Rectangle){ 0 };
|
||||||
|
|
||||||
|
ViewportType viewportType = KEEP_ASPECT_INTEGER;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
|
||||||
|
// Button rectangles
|
||||||
|
Rectangle decreaseResolutionButton = (Rectangle){ 200, 30, 10, 10 };
|
||||||
|
Rectangle increaseResolutionButton = (Rectangle){ 215, 30, 10, 10 };
|
||||||
|
Rectangle decreaseTypeButton = (Rectangle){ 200, 45, 10, 10 };
|
||||||
|
Rectangle increaseTypeButton = (Rectangle){ 215, 45, 10, 10 };
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsWindowResized()) ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
|
||||||
|
Vector2 mousePosition = GetMousePosition();
|
||||||
|
bool mousePressed = IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
|
// Check buttons and rescale
|
||||||
|
if (CheckCollisionPointRec(mousePosition, decreaseResolutionButton) && mousePressed)
|
||||||
|
{
|
||||||
|
resolutionIndex = (resolutionIndex + RESOLUTION_COUNT - 1)%RESOLUTION_COUNT;
|
||||||
|
gameWidth = (int)resolutionList[resolutionIndex].x;
|
||||||
|
gameHeight = (int)resolutionList[resolutionIndex].y;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(mousePosition, increaseResolutionButton) && mousePressed)
|
||||||
|
{
|
||||||
|
resolutionIndex = (resolutionIndex + 1)%RESOLUTION_COUNT;
|
||||||
|
gameWidth = (int)resolutionList[resolutionIndex].x;
|
||||||
|
gameHeight = (int)resolutionList[resolutionIndex].y;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(mousePosition, decreaseTypeButton) && mousePressed)
|
||||||
|
{
|
||||||
|
viewportType = (viewportType + VIEWPORT_TYPE_COUNT - 1)%VIEWPORT_TYPE_COUNT;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(mousePosition, increaseTypeButton) && mousePressed)
|
||||||
|
{
|
||||||
|
viewportType = (viewportType + 1)%VIEWPORT_TYPE_COUNT;
|
||||||
|
ResizeRenderSize(viewportType, &screenWidth, &screenHeight, gameWidth, gameHeight, &sourceRect, &destRect, &target);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 textureMousePosition = Screen2RenderTexturePosition(mousePosition, &sourceRect, &destRect);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Draw our scene to the render texture
|
||||||
|
BeginTextureMode(target);
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
DrawCircleV(textureMousePosition, 20.0f, LIME);
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
// Draw render texture to main framebuffer
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
// Draw our render texture with rotation applied
|
||||||
|
DrawTexturePro(target.texture, sourceRect, destRect, (Vector2){ 0.0f, 0.0f }, 0.0f, WHITE);
|
||||||
|
|
||||||
|
// Draw Native resolution (GUI or anything)
|
||||||
|
// Draw info box
|
||||||
|
Rectangle infoRect = (Rectangle){5, 5, 330, 105};
|
||||||
|
DrawRectangleRec(infoRect, Fade(LIGHTGRAY, 0.7f));
|
||||||
|
DrawRectangleLinesEx(infoRect, 1, BLUE);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Window Resolution: %d x %d", screenWidth, screenHeight), 15, 15, 10, BLACK);
|
||||||
|
DrawText(TextFormat("Game Resolution: %d x %d", gameWidth, gameHeight), 15, 30, 10, BLACK);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Type: %s", ViewportTypeNames[viewportType]), 15, 45, 10, BLACK);
|
||||||
|
Vector2 scaleRatio = (Vector2){destRect.width/sourceRect.width, -destRect.height/sourceRect.height};
|
||||||
|
if (scaleRatio.x < 0.001f || scaleRatio.y < 0.001f) DrawText(TextFormat("Scale ratio: INVALID"), 15, 60, 10, BLACK);
|
||||||
|
else DrawText(TextFormat("Scale ratio: %.2f x %.2f", scaleRatio.x, scaleRatio.y), 15, 60, 10, BLACK);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Source size: %.2f x %.2f", sourceRect.width, -sourceRect.height), 15, 75, 10, BLACK);
|
||||||
|
DrawText(TextFormat("Destination size: %.2f x %.2f", destRect.width, destRect.height), 15, 90, 10, BLACK);
|
||||||
|
|
||||||
|
// Draw buttons
|
||||||
|
DrawRectangleRec(decreaseTypeButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(increaseTypeButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(decreaseResolutionButton, SKYBLUE);
|
||||||
|
DrawRectangleRec(increaseResolutionButton, SKYBLUE);
|
||||||
|
DrawText("<", (int)decreaseTypeButton.x + 3, (int)decreaseTypeButton.y + 1, 10, BLACK);
|
||||||
|
DrawText(">", (int)increaseTypeButton.x + 3, (int)increaseTypeButton.y + 1, 10, BLACK);
|
||||||
|
DrawText("<", (int)decreaseResolutionButton.x + 3, (int)decreaseResolutionButton.y + 1, 10, BLACK);
|
||||||
|
DrawText(">", (int)increaseResolutionButton.x + 3, (int)increaseResolutionButton.y + 1, 10, BLACK);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = (float)gameHeight;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
const int ratio_x = (screenWidth/gameWidth);
|
||||||
|
const int ratio_y = (screenHeight/gameHeight);
|
||||||
|
const float resizeRatio = (float)((ratio_x < ratio_y)? ratio_x : ratio_y);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(gameWidth*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight*resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = (float)screenHeight/gameHeight;
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = 0.0f;
|
||||||
|
sourceRect->width = (float)(int)(screenWidth/resizeRatio);
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (sourceRect->width*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(sourceRect->width*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight*resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = (float)screenWidth/gameWidth;
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = 0.0f;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)(int)(screenHeight/resizeRatio);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (sourceRect->height*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(gameWidth*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(sourceRect->height*resizeRatio);
|
||||||
|
|
||||||
|
sourceRect->height *= -1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepAspectCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = (float)gameHeight;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
const float ratio_x = ((float)screenWidth/(float)gameWidth);
|
||||||
|
const float ratio_y = ((float)screenHeight/(float)gameHeight);
|
||||||
|
const float resizeRatio = (ratio_x < ratio_y ? ratio_x : ratio_y);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(gameWidth*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight*resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepHeightCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = ((float)screenHeight/(float)gameHeight);
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = 0.0f;
|
||||||
|
sourceRect->width = (float)(int)((float)screenWidth/resizeRatio);
|
||||||
|
sourceRect->height = (float)-gameHeight;
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (sourceRect->width*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (gameHeight*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(sourceRect->width*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(gameHeight*resizeRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KeepWidthCentered(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
|
||||||
|
{
|
||||||
|
const float resizeRatio = ((float)screenWidth/(float)gameWidth);
|
||||||
|
sourceRect->x = 0.0f;
|
||||||
|
sourceRect->y = 0.0f;
|
||||||
|
sourceRect->width = (float)gameWidth;
|
||||||
|
sourceRect->height = (float)(int)((float)screenHeight/resizeRatio);
|
||||||
|
|
||||||
|
destRect->x = (float)(int)((screenWidth - (gameWidth*resizeRatio))*0.5f);
|
||||||
|
destRect->y = (float)(int)((screenHeight - (sourceRect->height*resizeRatio))*0.5f);
|
||||||
|
destRect->width = (float)(int)(gameWidth*resizeRatio);
|
||||||
|
destRect->height = (float)(int)(sourceRect->height*resizeRatio);
|
||||||
|
|
||||||
|
sourceRect->height *= -1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ResizeRenderSize(ViewportType viewportType, int *screenWidth, int *screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect, RenderTexture2D *target)
|
||||||
|
{
|
||||||
|
*screenWidth = GetScreenWidth();
|
||||||
|
*screenHeight = GetScreenHeight();
|
||||||
|
|
||||||
|
switch(viewportType)
|
||||||
|
{
|
||||||
|
case KEEP_ASPECT_INTEGER: KeepAspectCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
case KEEP_HEIGHT_INTEGER: KeepHeightCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
case KEEP_WIDTH_INTEGER: KeepWidthCenteredInteger(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
case KEEP_ASPECT: KeepAspectCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
case KEEP_HEIGHT: KeepHeightCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
case KEEP_WIDTH: KeepWidthCentered(*screenWidth, *screenHeight, gameWidth, gameHeight, sourceRect, destRect); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnloadRenderTexture(*target);
|
||||||
|
*target = LoadRenderTexture((int)sourceRect->width, -(int)sourceRect->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example how to calculate position on RenderTexture
|
||||||
|
static Vector2 Screen2RenderTexturePosition(Vector2 point, Rectangle *textureRect, Rectangle *scaledRect)
|
||||||
|
{
|
||||||
|
Vector2 relativePosition = {point.x - scaledRect->x, point.y - scaledRect->y};
|
||||||
|
Vector2 ratio = {textureRect->width/scaledRect->width, -textureRect->height/scaledRect->height};
|
||||||
|
|
||||||
|
return (Vector2){relativePosition.x*ratio.x, relativePosition.y*ratio.x};
|
||||||
|
}
|
||||||
BIN
examples/core/core_viewport_scaling.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
@ -43,7 +43,7 @@ int main(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Set configuration flags for window creation
|
// Set configuration flags for window creation
|
||||||
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
|
//SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);// | FLAG_WINDOW_TRANSPARENT);
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
|
||||||
|
|
||||||
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
@ -97,7 +97,8 @@ int main(void)
|
|||||||
if (IsWindowState(FLAG_WINDOW_MINIMIZED))
|
if (IsWindowState(FLAG_WINDOW_MINIMIZED))
|
||||||
{
|
{
|
||||||
framesCounter++;
|
framesCounter++;
|
||||||
if (framesCounter >= 240) {
|
if (framesCounter >= 240)
|
||||||
|
{
|
||||||
RestoreWindow(); // Restore window after 3 seconds
|
RestoreWindow(); // Restore window after 3 seconds
|
||||||
framesCounter = 0;
|
framesCounter = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|||||||
86
examples/core/core_window_web.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - window web
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 1.3, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* This example has been adapted to compile for PLATFORM_WEB and PLATFORM_DESKTOP
|
||||||
|
* As you will notice, code structure is slightly different to the other examples
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - window web");
|
||||||
|
|
||||||
|
#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("Welcome to raylib web structure!", 220, 200, 20, SKYBLUE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
BIN
examples/core/core_window_web.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
@ -413,7 +413,7 @@ static MsfGifBuffer * msf_compress_frame(void * allocContext, int width, int hei
|
|||||||
|
|
||||||
//generate palette
|
//generate palette
|
||||||
typedef struct { uint8_t r, g, b; } Color3;
|
typedef struct { uint8_t r, g, b; } Color3;
|
||||||
Color3 table[256] = { {0} };
|
Color3 table[256] = { { 0 } };
|
||||||
int tableIdx = 1; //we start counting at 1 because 0 is the transparent color
|
int tableIdx = 1; //we start counting at 1 because 0 is the transparent color
|
||||||
//transparent is always last in the table
|
//transparent is always last in the table
|
||||||
tlb[tlbSize-1] = 0;
|
tlb[tlbSize-1] = 0;
|
||||||
@ -550,7 +550,7 @@ static void msf_free_gif_state(MsfGifState * handle) {
|
|||||||
|
|
||||||
int msf_gif_begin(MsfGifState * handle, int width, int height) { MsfTimeFunc
|
int msf_gif_begin(MsfGifState * handle, int width, int height) { MsfTimeFunc
|
||||||
//NOTE: we cannot stomp the entire struct to zero because we must preserve `customAllocatorContext`.
|
//NOTE: we cannot stomp the entire struct to zero because we must preserve `customAllocatorContext`.
|
||||||
MsfCookedFrame empty = {0}; //god I hate MSVC...
|
MsfCookedFrame empty = { 0 }; //god I hate MSVC...
|
||||||
handle->previousFrame = empty;
|
handle->previousFrame = empty;
|
||||||
handle->currentFrame = empty;
|
handle->currentFrame = empty;
|
||||||
handle->width = width;
|
handle->width = width;
|
||||||
@ -614,7 +614,7 @@ int msf_gif_frame(MsfGifState * handle, uint8_t * pixelData, int centiSecondsPer
|
|||||||
}
|
}
|
||||||
|
|
||||||
MsfGifResult msf_gif_end(MsfGifState * handle) { MsfTimeFunc
|
MsfGifResult msf_gif_end(MsfGifState * handle) { MsfTimeFunc
|
||||||
if (!handle->listHead) { MsfGifResult empty = {0}; return empty; }
|
if (!handle->listHead) { MsfGifResult empty = { 0 }; return empty; }
|
||||||
|
|
||||||
//first pass: determine total size
|
//first pass: determine total size
|
||||||
size_t total = 1; //1 byte for trailing marker
|
size_t total = 1; //1 byte for trailing marker
|
||||||
6051
examples/core/raygui.h
Normal file
18
examples/core/resources/text_file.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Starting of the Lorem ipsum dolor sit amet file
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque at interdum ex, et iaculis quam. Mauris consectetur, magna vel malesuada aliquam, mauris enim venenatis arcu, nec cursus orci ante a massa. Curabitur libero elit, cursus eu odio eget, suscipit rhoncus nibh. Nam justo elit, ullamcorper eget dolor et, ullamcorper tristique nulla. Nullam sagittis dolor in tristique tincidunt. Duis ac porttitor erat, a molestie sapien. Aliquam finibus in ipsum quis venenatis.
|
||||||
|
Mauris odio lorem, pharetra ut egestas quis, tristique eu mauris. Cras sed gravida velit. Suspendisse potenti. Suspendisse lobortis eleifend fermentum. Donec eu dolor est. Etiam ac felis eu ligula auctor feugiat eu quis diam. Sed eleifend id nibh porta viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi at tristique dui, nec pretium est. Mauris mollis massa quis massa aliquet efficitur. Phasellus posuere, elit id tempus consequat, massa ante scelerisque odio, finibus gravida elit tellus eget lectus.
|
||||||
|
Donec rutrum sagittis ligula a auctor. Aliquam aliquet tincidunt pulvinar. Aenean a porta ex. Aenean at sagittis nulla. Morbi congue luctus est nec gravida. In hac habitasse platea dictumst. Praesent commodo efficitur congue. Duis interdum enim in pharetra dapibus. Proin vestibulum finibus mauris vitae mollis.
|
||||||
|
Sed ultricies sed enim vel interdum. Nullam nec sagittis est, quis lobortis nunc. Donec auctor elementum velit vel pulvinar. Sed quis efficitur felis, at mollis elit. Integer id elit ante. Ut gravida ante vitae erat scelerisque scelerisque vel in massa. Praesent varius massa eu purus feugiat, non venenatis urna rhoncus. Pellentesque vehicula, tellus eu venenatis efficitur, libero eros lobortis justo, at ultricies lacus diam non libero. Sed metus nulla, consectetur in justo vitae, mollis maximus orci. Vestibulum dapibus ultrices leo, et facilisis odio molestie a. Phasellus facilisis vitae lorem quis viverra. Etiam imperdiet urna dolor, quis interdum ligula tristique id. Aliquam id dapibus enim.
|
||||||
|
Curabitur congue elit in magna tristique, sit amet porta quam viverra. Integer nec placerat libero. Praesent sem dolor, tristique eu augue non, ultricies mollis nibh. Fusce finibus, lorem sollicitudin eleifend gravida, eros quam tempus leo, ut iaculis libero ex vitae libero. Sed placerat fringilla accumsan. Nulla laoreet cursus justo nec elementum. Proin facilisis lobortis velit, a sollicitudin leo mollis eu. Aenean et leo est.
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque at interdum ex, et iaculis quam. Mauris consectetur, magna vel malesuada aliquam, mauris enim venenatis arcu, nec cursus orci ante a massa. Curabitur libero elit, cursus eu odio eget, suscipit rhoncus nibh. Nam justo elit, ullamcorper eget dolor et, ullamcorper tristique nulla. Nullam sagittis dolor in tristique tincidunt. Duis ac porttitor erat, a molestie sapien. Aliquam finibus in ipsum quis venenatis.
|
||||||
|
Mauris odio lorem, pharetra ut egestas quis, tristique eu mauris. Cras sed gravida velit. Suspendisse potenti. Suspendisse lobortis eleifend fermentum. Donec eu dolor est. Etiam ac felis eu ligula auctor feugiat eu quis diam. Sed eleifend id nibh porta viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi at tristique dui, nec pretium est. Mauris mollis massa quis massa aliquet efficitur. Phasellus posuere, elit id tempus consequat, massa ante scelerisque odio, finibus gravida elit tellus eget lectus.
|
||||||
|
Donec rutrum sagittis ligula a auctor. Aliquam aliquet tincidunt pulvinar. Aenean a porta ex. Aenean at sagittis nulla. Morbi congue luctus est nec gravida. In hac habitasse platea dictumst. Praesent commodo efficitur congue. Duis interdum enim in pharetra dapibus. Proin vestibulum finibus mauris vitae mollis.
|
||||||
|
Sed ultricies sed enim vel interdum. Nullam nec sagittis est, quis lobortis nunc. Donec auctor elementum velit vel pulvinar. Sed quis efficitur felis, at mollis elit. Integer id elit ante. Ut gravida ante vitae erat scelerisque scelerisque vel in massa. Praesent varius massa eu purus feugiat, non venenatis urna rhoncus. Pellentesque vehicula, tellus eu venenatis efficitur, libero eros lobortis justo, at ultricies lacus diam non libero. Sed metus nulla, consectetur in justo vitae, mollis maximus orci. Vestibulum dapibus ultrices leo, et facilisis odio molestie a. Phasellus facilisis vitae lorem quis viverra. Etiam imperdiet urna dolor, quis interdum ligula tristique id. Aliquam id dapibus enim.
|
||||||
|
wrapping text from the last available space wrapping text from the last available space wrapping text from the last available space
|
||||||
|
Curabitur congue elit in magna tristique, sit amet porta quam viverra. Integer nec placerat libero. Praesent sem dolor, tristique eu augue non, ultricies mollis nibh. Fusce finibus, lorem sollicitudin eleifend gravida, eros quam tempus leo, ut iaculis libero ex vitae libero. Sed placerat fringilla accumsan. Nulla laoreet cursus justo nec elementum. Proin facilisis lobortis velit, a sollicitudin leo mollis eu. Aenean et leo est.
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque at interdum ex, et iaculis quam. Mauris consectetur, magna vel malesuada aliquam, mauris enim venenatis arcu, nec cursus orci ante a massa. Curabitur libero elit, cursus eu odio eget, suscipit rhoncus nibh. Nam justo elit, ullamcorper eget dolor et, ullamcorper tristique nulla. Nullam sagittis dolor in tristique tincidunt. Duis ac porttitor erat, a molestie sapien. Aliquam finibus in ipsum quis venenatis.
|
||||||
|
Mauris odio lorem, pharetra ut egestas quis, tristique eu mauris. Cras sed gravida velit. Suspendisse potenti. Suspendisse lobortis eleifend fermentum. Donec eu dolor est. Etiam ac felis eu ligula auctor feugiat eu quis diam. Sed eleifend id nibh porta viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi at tristique dui, nec pretium est. Mauris mollis massa quis massa aliquet efficitur. Phasellus posuere, elit id tempus consequat, massa ante scelerisque odio, finibus gravida elit tellus eget lectus.
|
||||||
|
Donec rutrum sagittis ligula a auctor. Aliquam aliquet tincidunt pulvinar. Aenean a porta ex. Aenean at sagittis nulla. Morbi congue luctus est nec gravida. In hac habitasse platea dictumst. Praesent commodo efficitur congue. Duis interdum enim in pharetra dapibus. Proin vestibulum finibus mauris vitae mollis.
|
||||||
|
Sed ultricies sed enim vel interdum. Nullam nec sagittis est, quis lobortis nunc. Donec auctor elementum velit vel pulvinar. Sed quis efficitur felis, at mollis elit. Integer id elit ante. Ut gravida ante vitae erat scelerisque scelerisque vel in massa. Praesent varius massa eu purus feugiat, non venenatis urna rhoncus. Pellentesque vehicula, tellus eu venenatis efficitur, libero eros lobortis justo, at ultricies lacus diam non libero. Sed metus nulla, consectetur in justo vitae, mollis maximus orci. Vestibulum dapibus ultrices leo, et facilisis odio molestie a. Phasellus facilisis vitae lorem quis viverra. Etiam imperdiet urna dolor, quis interdum ligula tristique id. Aliquam id dapibus enim.
|
||||||
|
Curabitur congue elit in magna tristique, sit amet porta quam viverra. Integer nec placerat libero. Praesent sem dolor, tristique eu augue non, ultricies mollis nibh. Fusce finibus, lorem sollicitudin eleifend gravida, eros quam tempus leo, ut iaculis libero ex vitae libero. Sed placerat fringilla accumsan. Nulla laoreet cursus justo nec elementum. Proin facilisis lobortis velit, a sollicitudin leo mollis eu. Aenean et leo est.
|
||||||
|
Ending of the Lorem ipsum dolor sit amet file
|
||||||
@ -1,8 +1,8 @@
|
|||||||
GLFW_ICON ICON "raylib.ico"
|
GLFW_ICON ICON "raylib.ico"
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION 5,5,0,0
|
FILEVERSION 6,0,0,0
|
||||||
PRODUCTVERSION 5,5,0,0
|
PRODUCTVERSION 6,0,0,0
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -11,12 +11,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "raylib technologies"
|
VALUE "CompanyName", "raylib technologies"
|
||||||
VALUE "FileDescription", "raylib application (www.raylib.com)"
|
VALUE "FileDescription", "raylib application (www.raylib.com)"
|
||||||
VALUE "FileVersion", "5.5.0"
|
VALUE "FileVersion", "6.0.0"
|
||||||
VALUE "InternalName", "raylib-example"
|
VALUE "InternalName", "raylib-example"
|
||||||
VALUE "LegalCopyright", "(c) 2025 Ramon Santamaria (@raysan5)"
|
VALUE "LegalCopyright", "(c) 2026 Ramon Santamaria (@raysan5)"
|
||||||
VALUE "OriginalFilename", "raylib-example"
|
VALUE "OriginalFilename", "raylib-example"
|
||||||
VALUE "ProductName", "raylib-example"
|
VALUE "ProductName", "raylib-example"
|
||||||
VALUE "ProductVersion", "5.5.0"
|
VALUE "ProductVersion", "6.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@ -1,20 +1,23 @@
|
|||||||
#
|
#
|
||||||
# raylib examples list used to generate/update collection
|
# raylib examples list with available .c example files
|
||||||
# examples must be provided as: <example_category>;<example_name>;<example_stars>;<raylib_created_version>;<raylib_last_update_version>;<year_created>;<year_reviewed>;"<example_author_name>";<author_github_user>
|
#
|
||||||
|
# WARNING: List is not ordered by example name but by the display order on web,
|
||||||
|
# so it can not be automatically generated scanning available .c code files, only updated
|
||||||
|
# new examples are added at the end of each category; it's up to the user to reorder them as desired
|
||||||
|
#
|
||||||
|
# examples data is listed as: <example_category>;<example_name>;<example_stars>;<raylib_created_version>;<raylib_last_update_version>;<year_created>;<year_reviewed>;"<example_author_name>";<author_github_user>
|
||||||
#
|
#
|
||||||
# This list is used as the main reference by [rexm] tool for examples collection validation and management
|
# This list is used as the main reference by [rexm] tool for examples collection validation and management
|
||||||
# New examples must be added to this list and any possible rename must be made on this list first
|
|
||||||
#
|
|
||||||
# WARNING: List is not ordered by example name but by the display order on web
|
|
||||||
#
|
#
|
||||||
core;core_basic_window;★☆☆☆;1.0;1.0;2013;2025;"Ramon Santamaria";@raysan5
|
core;core_basic_window;★☆☆☆;1.0;1.0;2013;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_delta_time;★☆☆☆;5.5;6.0;2025;2025;"Robin";@RobinsAviary
|
||||||
core;core_input_keys;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
core;core_input_keys;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_input_mouse;★☆☆☆;1.0;5.5;2014;2025;"Ramon Santamaria";@raysan5
|
core;core_input_mouse;★☆☆☆;1.0;5.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_input_mouse_wheel;★☆☆☆;1.1;1.3;2014;2025;"Ramon Santamaria";@raysan5
|
core;core_input_mouse_wheel;★☆☆☆;1.1;1.3;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_input_gamepad;★☆☆☆;1.1;4.2;2013;2025;"Ramon Santamaria";@raysan5
|
core;core_input_gamepad;★☆☆☆;1.1;4.2;2013;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_input_multitouch;★☆☆☆;2.1;2.5;2019;2025;"Berni";@Berni8k
|
core;core_input_multitouch;★☆☆☆;2.1;2.5;2019;2025;"Berni";@Berni8k
|
||||||
core;core_input_gestures;★★☆☆;1.4;4.2;2016;2025;"Ramon Santamaria";@raysan5
|
core;core_input_gestures;★★☆☆;1.4;4.2;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_input_gestures_testbed;★★★☆;5.0;5.6-dev;2023;2025;"ubkp";@ubkp
|
core;core_input_gestures_testbed;★★★☆;5.0;6.0;2023;2025;"ubkp";@ubkp
|
||||||
core;core_input_virtual_controls;★★☆☆;5.0;5.0;2024;2025;"GreenSnakeLinux";@GreenSnakeLinux
|
core;core_input_virtual_controls;★★☆☆;5.0;5.0;2024;2025;"GreenSnakeLinux";@GreenSnakeLinux
|
||||||
core;core_2d_camera;★★☆☆;1.5;3.0;2016;2025;"Ramon Santamaria";@raysan5
|
core;core_2d_camera;★★☆☆;1.5;3.0;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_2d_camera_mouse_zoom;★★☆☆;4.2;4.2;2022;2025;"Jeffery Myers";@JeffM2501
|
core;core_2d_camera_mouse_zoom;★★☆☆;4.2;4.2;2022;2025;"Jeffery Myers";@JeffM2501
|
||||||
@ -24,12 +27,13 @@ core;core_3d_camera_mode;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@rays
|
|||||||
core;core_3d_camera_free;★☆☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
core;core_3d_camera_free;★☆☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_3d_camera_first_person;★★☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
core;core_3d_camera_first_person;★★☆☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_3d_camera_split_screen;★★★☆;3.7;4.0;2021;2025;"Jeffery Myers";@JeffM2501
|
core;core_3d_camera_split_screen;★★★☆;3.7;4.0;2021;2025;"Jeffery Myers";@JeffM2501
|
||||||
core;core_3d_camera_fps;★★★☆;5.5;5.5;2025;2025;"Agnis Aldins";@nezvers
|
core;core_3d_camera_fps;★★★☆;5.5;5.5;2025;2025;"Agnis Aldiņš";@nezvers
|
||||||
core;core_3d_picking;★★☆☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
|
core;core_3d_picking;★★☆☆;1.3;4.0;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_world_screen;★★☆☆;1.3;1.4;2015;2025;"Ramon Santamaria";@raysan5
|
core;core_world_screen;★★☆☆;1.3;1.4;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_window_flags;★★★☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
core;core_window_flags;★★★☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_window_letterbox;★★☆☆;2.5;4.0;2019;2025;"Anata";@anatagawa
|
core;core_window_letterbox;★★☆☆;2.5;4.0;2019;2025;"Anata";@anatagawa
|
||||||
core;core_window_should_close;★☆☆☆;4.2;4.2;2013;2025;"Ramon Santamaria";@raysan5
|
core;core_window_should_close;★☆☆☆;4.2;4.2;2013;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_monitor_detector;★☆☆☆;5.5;5.6;2025;2025;"Maicon Santana";@maiconpintoabreu
|
||||||
core;core_custom_logging;★★★☆;2.5;2.5;2018;2025;"Pablo Marcos Oltra";@pamarcos
|
core;core_custom_logging;★★★☆;2.5;2.5;2018;2025;"Pablo Marcos Oltra";@pamarcos
|
||||||
core;core_drop_files;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
core;core_drop_files;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_random_values;★☆☆☆;1.1;1.1;2014;2025;"Ramon Santamaria";@raysan5
|
core;core_random_values;★☆☆☆;1.1;1.1;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -41,10 +45,22 @@ core;core_custom_frame_control;★★★★;4.0;4.0;2021;2025;"Ramon Santamaria"
|
|||||||
core;core_smooth_pixelperfect;★★★☆;3.7;4.0;2021;2025;"Giancamillo Alessandroni";@NotManyIdeasDev
|
core;core_smooth_pixelperfect;★★★☆;3.7;4.0;2021;2025;"Giancamillo Alessandroni";@NotManyIdeasDev
|
||||||
core;core_random_sequence;★☆☆☆;5.0;5.0;2023;2025;"Dalton Overmyer";@REDl3east
|
core;core_random_sequence;★☆☆☆;5.0;5.0;2023;2025;"Dalton Overmyer";@REDl3east
|
||||||
core;core_automation_events;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
core;core_automation_events;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_high_dpi;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
core;core_highdpi_demo;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
||||||
core;core_render_texture;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_render_texture;★☆☆☆;6.0;6.0;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_undo_redo;★★★☆;5.5;5.6;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_viewport_scaling;★★☆☆;5.5;5.5;2025;2025;"Agnis Aldiņš";@nezvers
|
||||||
|
core;core_input_actions;★★☆☆;5.5;5.6;2025;2025;"Jett";@JettMonstersGoBoom
|
||||||
|
core;core_directory_files;★☆☆☆;5.5;5.6;2025;2025;"Hugo ARNAL";@hugoarnal
|
||||||
|
core;core_highdpi_testbed;★☆☆☆;6.0;6.0;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_screen_recording;★★☆☆;6.0;6.0;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_clipboard_text;★★☆☆;6.0;6.0;2025;2025;"Ananth S";@Ananth1839
|
||||||
|
core;core_text_file_loading;★☆☆☆;5.5;5.6;0;0;"Aanjishnu Bhattacharyya";@NimComPoo-04
|
||||||
|
core;core_compute_hash;★★☆☆;6.0;6.0;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_keyboard_testbed;★★☆☆;5.6;5.6;2026;2026;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_window_web;★☆☆☆;1.3;5.5;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_basic_shapes;★☆☆☆;1.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_basic_shapes;★☆☆☆;1.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_bouncing_ball;★☆☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_bouncing_ball;★☆☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_bullet_hell;★☆☆☆;5.6;5.6;2025;2025;"Zero";@zerohorsepower
|
||||||
shapes;shapes_colors_palette;★★☆☆;1.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_colors_palette;★★☆☆;1.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_logo_raylib_anim;★★☆☆;2.5;4.0;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_logo_raylib_anim;★★☆☆;2.5;4.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -55,6 +71,7 @@ shapes;shapes_following_eyes;★★☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@
|
|||||||
shapes;shapes_easings_ball;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_ball;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_easings_box;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_box;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_easings_rectangles;★★★☆;2.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_rectangles;★★★☆;2.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_recursive_tree;★★★☆;6.0;6.0;2025;2025;"Jopestpe";@jopestpe
|
||||||
shapes;shapes_ring_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_ring_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
shapes;shapes_circle_sector_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_circle_sector_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
shapes;shapes_rounded_rectangle_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_rounded_rectangle_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
@ -63,6 +80,26 @@ shapes;shapes_rectangle_advanced;★★★★;5.5;5.5;2024;2025;"Everton Jr.";@e
|
|||||||
shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_digital_clock;★★★★;5.5;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
|
shapes;shapes_digital_clock;★★★★;5.5;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
|
||||||
shapes;shapes_double_pendulum;★★☆☆;5.5;5.5;2025;2025;"JoeCheong";@Joecheong2006
|
shapes;shapes_double_pendulum;★★☆☆;5.5;5.5;2025;2025;"JoeCheong";@Joecheong2006
|
||||||
|
shapes;shapes_dashed_line;★☆☆☆;5.5;5.5;2025;2025;"Luís Almeida";@luis605
|
||||||
|
shapes;shapes_triangle_strip;★★☆☆;6.0;6.0;2025;2025;"Jopestpe";@jopestpe
|
||||||
|
shapes;shapes_vector_angle;★★☆☆;1.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_pie_chart;★★★☆;5.5;5.6;2025;2025;"Gideon Serfontein";@GideonSerf
|
||||||
|
shapes;shapes_kaleidoscope;★★☆☆;5.5;5.6;2025;2025;"Hugo ARNAL";@hugoarnal
|
||||||
|
shapes;shapes_clock_of_clocks;★★☆☆;5.5;6.0;2025;2025;"JP Mortiboys";@themushroompirates
|
||||||
|
shapes;shapes_math_sine_cosine;★★☆☆;6.0;6.0;2025;2025;"Jopestpe";@jopestpe
|
||||||
|
shapes;shapes_mouse_trail;★☆☆☆;5.6;6.0;2025;2025;"Balamurugan R";@Bala050814
|
||||||
|
shapes;shapes_simple_particles;★★☆☆;5.6;5.6;2025;2025;"Jordi Santonja";@JordSant
|
||||||
|
shapes;shapes_starfield_effect;★★☆☆;5.5;6.0;2025;2025;"JP Mortiboys";@themushroompirates
|
||||||
|
shapes;shapes_lines_drawing;★☆☆☆;6.0;5.6;2025;2025;"Robin";@RobinsAviary
|
||||||
|
shapes;shapes_math_angle_rotation;★☆☆☆;6.0;5.6;2025;2025;"Kris";@krispy-snacc
|
||||||
|
shapes;shapes_rlgl_color_wheel;★★★☆;6.0;6.0;2025;2025;"Robin";@RobinsAviary
|
||||||
|
shapes;shapes_rlgl_triangle;★★☆☆;6.0;6.0;2025;2025;"Robin";@RobinsAviary
|
||||||
|
shapes;shapes_ball_physics;★★☆☆;6.0;6.0;2025;2025;"David Buzatto";@davidbuzatto
|
||||||
|
shapes;shapes_penrose_tile;★★★★;5.5;6.0;2025;2025;"David Buzatto";@davidbuzatto
|
||||||
|
shapes;shapes_hilbert_curve;★★★☆;5.6;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
|
||||||
|
shapes;shapes_easings_testbed;★★★☆;2.5;2.5;2019;2025;"Juan Miguel López";@flashback-fx
|
||||||
|
textures;textures_clipboard_image;★☆☆☆;6.0;6.0;2026;2026;"Maicon Santana";@maiconpintoabreu
|
||||||
|
textures;textures_magnifying_glass;★★★☆;5.6;5.6;2026;2026;"Luke Vaughan";@badram
|
||||||
textures;textures_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
textures;textures_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
textures;textures_srcrec_dstrec;★★★☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
textures;textures_srcrec_dstrec;★★★☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
textures;textures_image_drawing;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
textures;textures_image_drawing;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -88,7 +125,11 @@ textures;textures_gif_player;★★★☆;4.2;4.2;2021;2025;"Ramon Santamaria";@
|
|||||||
textures;textures_image_kernel;★★★★;1.3;1.3;2015;2025;"Karim Salem";@kimo-s
|
textures;textures_image_kernel;★★★★;1.3;1.3;2015;2025;"Karim Salem";@kimo-s
|
||||||
textures;textures_image_channel;★★☆☆;5.5;5.5;2024;2025;"Bruno Cabral";@brccabral
|
textures;textures_image_channel;★★☆☆;5.5;5.5;2024;2025;"Bruno Cabral";@brccabral
|
||||||
textures;textures_image_rotate;★★☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
textures;textures_image_rotate;★★☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
|
textures;textures_screen_buffer;★★☆☆;5.5;5.5;2025;2025;"Agnis Aldiņš";@nezvers
|
||||||
textures;textures_textured_curve;★★★☆;4.5;4.5;2022;2025;"Jeffery Myers";@JeffM2501
|
textures;textures_textured_curve;★★★☆;4.5;4.5;2022;2025;"Jeffery Myers";@JeffM2501
|
||||||
|
textures;textures_sprite_stacking;★★☆☆;6.0;6.0;2025;2025;"Robin";@RobinsAviary
|
||||||
|
textures;textures_cellular_automata;★★☆☆;5.6;5.6;2025;2025;"Jordi Santonja";@JordSant
|
||||||
|
textures;textures_framebuffer_rendering;★★☆☆;5.6;5.6;2026;2026;"Jack Boakes";@jackboakes
|
||||||
text;text_sprite_fonts;★☆☆☆;1.7;3.7;2017;2025;"Ramon Santamaria";@raysan5
|
text;text_sprite_fonts;★☆☆☆;1.7;3.7;2017;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_font_spritefont;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
text;text_font_spritefont;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_font_filters;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
text;text_font_filters;★★☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -99,11 +140,13 @@ text;text_input_box;★★☆☆;1.7;3.5;2017;2025;"Ramon Santamaria";@raysan5
|
|||||||
text;text_writing_anim;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
text;text_writing_anim;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_rectangle_bounds;★★★★;2.5;4.0;2018;2025;"Vlad Adrian";@demizdor
|
text;text_rectangle_bounds;★★★★;2.5;4.0;2018;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_unicode_emojis;★★★★;2.5;4.0;2019;2025;"Vlad Adrian";@demizdor
|
text;text_unicode_emojis;★★★★;2.5;4.0;2019;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_unicode_ranges;★★★★;5.5;5.6;2025;2025;"Vlad Adrian";@demizdor
|
text;text_unicode_ranges;★★★★;5.5;5.6;2025;2025;"Vadim Gunko";@GuvaCode
|
||||||
text;text_3d_drawing;★★★★;3.5;4.0;2021;2025;"Vlad Adrian";@demizdor
|
text;text_3d_drawing;★★★★;3.5;4.0;2021;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_codepoints_loading;★★★☆;4.2;4.2;2022;2025;"Ramon Santamaria";@raysan5
|
text;text_codepoints_loading;★★★☆;4.2;4.2;2022;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_inline_styling;★★★☆;5.6-dev;5.6-dev;2025;2025;"Wagner Barongello";@SultansOfCode
|
text;text_inline_styling;★★★☆;6.0;6.0;2025;2025;"Wagner Barongello";@SultansOfCode
|
||||||
models;models_animation_playing;★★☆☆;2.5;3.5;2019;2025;"Culacant";@culacant
|
text;text_words_alignment;★☆☆☆;6.0;6.0;2025;2025;"JP Mortiboys";@themushroompirates
|
||||||
|
text;text_strings_management;★★★☆;6.0;6.0;2025;2025;"David Buzatto";@davidbuzatto
|
||||||
|
models;models_loading_iqm;★★☆☆;2.5;3.5;2019;2025;"Culacant";@culacant
|
||||||
models;models_billboard_rendering;★★★☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
models;models_billboard_rendering;★★★☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
models;models_box_collisions;★☆☆☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
models;models_box_collisions;★☆☆☆;1.3;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
models;models_cubicmap_rendering;★★☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
models;models_cubicmap_rendering;★★☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -123,9 +166,17 @@ models;models_waving_cubes;★★★☆;2.5;3.7;2019;2025;"Codecat";@codecat
|
|||||||
models;models_heightmap_rendering;★☆☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
models;models_heightmap_rendering;★☆☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
models;models_skybox_rendering;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
|
models;models_skybox_rendering;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
|
||||||
models;models_textured_cube;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@raysan5
|
models;models_textured_cube;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@raysan5
|
||||||
models;models_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
|
models;models_animation_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
|
||||||
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
|
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
|
||||||
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
|
models;models_tesseract_view;★★☆☆;6.0;6.0;2024;2025;"Timothy van der Valk";@arceryz
|
||||||
|
models;models_basic_voxel;★★☆☆;5.5;5.5;2025;2025;"Tim Little";@timlittle
|
||||||
|
models;models_rotating_cube;★☆☆☆;6.0;6.0;2025;2025;"Jopestpe";@jopestpe
|
||||||
|
models;models_decals;★★★★;6.0;6.0;2025;2025;"JP Mortiboys";@themushroompirates
|
||||||
|
models;models_directional_billboard;★★☆☆;6.0;6.0;2025;2025;"Robin";@RobinsAviary
|
||||||
|
models;models_animation_blend_custom;★★★★;5.5;6.0;2026;2026;"dmitrii-brand";@dmitrii-brand
|
||||||
|
models;models_animation_blending;★★★★;5.5;6.0;2024;2026;"Kirandeep";@Kirandeep-Singh-Khehra
|
||||||
|
models;models_animation_timing;★★★☆;6.0;6.0;2026;2026;"Ramon Santamaria";@raysan5
|
||||||
|
shaders;shaders_ascii_rendering;★★☆☆;5.5;6.0;2025;2025;"Maicon Santana";@maiconpintoabreu
|
||||||
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
|
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
|
||||||
shaders;shaders_model_shader;★★☆☆;1.3;3.7;2014;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_model_shader;★★☆☆;1.3;3.7;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shaders;shaders_shapes_textures;★★☆☆;1.7;3.7;2015;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_shapes_textures;★★☆☆;1.7;3.7;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
@ -137,13 +188,15 @@ shaders;shaders_texture_rendering;★★☆☆;2.0;3.7;2019;2025;"Michał Ciesie
|
|||||||
shaders;shaders_texture_outline;★★★☆;4.0;4.0;2021;2025;"Serenity Skiff";@GoldenThumbs
|
shaders;shaders_texture_outline;★★★☆;4.0;4.0;2021;2025;"Serenity Skiff";@GoldenThumbs
|
||||||
shaders;shaders_texture_waves;★★☆☆;2.5;3.7;2019;2025;"Anata";@anatagawa
|
shaders;shaders_texture_waves;★★☆☆;2.5;3.7;2019;2025;"Anata";@anatagawa
|
||||||
shaders;shaders_julia_set;★★★☆;2.5;4.0;2019;2025;"Josh Colclough";@joshcol9232
|
shaders;shaders_julia_set;★★★☆;2.5;4.0;2019;2025;"Josh Colclough";@joshcol9232
|
||||||
|
shaders;shaders_mandelbrot_set;★★★☆;6.0;6.0;2025;2025;"Jordi Santonja";@JordSant
|
||||||
|
shaders;shaders_color_correction;★★☆☆;6.0;6.0;2025;2025;"Jordi Santonja";@JordSant
|
||||||
shaders;shaders_eratosthenes_sieve;★★★☆;2.5;4.0;2019;2025;"ProfJski";@ProfJski
|
shaders;shaders_eratosthenes_sieve;★★★☆;2.5;4.0;2019;2025;"ProfJski";@ProfJski
|
||||||
shaders;shaders_fog_rendering;★★★☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
shaders;shaders_fog_rendering;★★★☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
||||||
shaders;shaders_simple_mask;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
shaders;shaders_simple_mask;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
||||||
shaders;shaders_hot_reloading;★★★☆;3.0;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_hot_reloading;★★★☆;3.0;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
||||||
shaders;shaders_mesh_instancing;★★★★;3.7;4.2;2020;2025;"seanpringle";@seanpringle
|
shaders;shaders_mesh_instancing;★★★★;3.7;4.2;2020;2025;"seanpringle";@seanpringle
|
||||||
shaders;shaders_multi_sample2d;★★☆☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_multi_sample2d;★★☆☆;3.5;3.5;2020;2025;"Ramon Santamaria";@raysan5
|
||||||
shaders;shaders_normalmap_rendering;★★★★;5.6;5.6;2025;2025;"Jeremy Montgomery";@Sir_Irk
|
shaders;shaders_normalmap_rendering;★★★★;6.0;6.0;2025;2025;"Jeremy Montgomery";@Sir_Irk
|
||||||
shaders;shaders_spotlight_rendering;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
shaders;shaders_spotlight_rendering;★★☆☆;2.5;3.7;2019;2025;"Chris Camacho";@chriscamacho
|
||||||
shaders;shaders_deferred_rendering;★★★★;4.5;4.5;2023;2025;"Justin Andreas Lacoste";@27justin
|
shaders;shaders_deferred_rendering;★★★★;4.5;4.5;2023;2025;"Justin Andreas Lacoste";@27justin
|
||||||
shaders;shaders_hybrid_rendering;★★★★;4.2;4.2;2022;2025;"Buğra Alptekin Sarı";@BugraAlptekinSari
|
shaders;shaders_hybrid_rendering;★★★★;4.2;4.2;2022;2025;"Buğra Alptekin Sarı";@BugraAlptekinSari
|
||||||
@ -154,18 +207,17 @@ shaders;shaders_depth_writing;★★☆☆;4.2;4.2;2022;2025;"Buğra Alptekin Sa
|
|||||||
shaders;shaders_basic_pbr;★★★★;5.0;5.5;2023;2025;"Afan OLOVCIC";@_DevDad
|
shaders;shaders_basic_pbr;★★★★;5.0;5.5;2023;2025;"Afan OLOVCIC";@_DevDad
|
||||||
shaders;shaders_lightmap_rendering;★★★☆;4.5;4.5;2019;2025;"Jussi Viitala";@nullstare
|
shaders;shaders_lightmap_rendering;★★★☆;4.5;4.5;2019;2025;"Jussi Viitala";@nullstare
|
||||||
shaders;shaders_rounded_rectangle;★★★☆;5.5;5.5;2025;2025;"Anstro Pleuton";@anstropleuton
|
shaders;shaders_rounded_rectangle;★★★☆;5.5;5.5;2025;2025;"Anstro Pleuton";@anstropleuton
|
||||||
shaders;shaders_depth_rendering;★★★☆;5.6-dev;5.6-dev;2025;2025;"Luís Almeida";@luis605
|
shaders;shaders_depth_rendering;★★★☆;6.0;6.0;2025;2025;"Luís Almeida";@luis605
|
||||||
|
shaders;shaders_game_of_life;★★★☆;6.0;6.0;2025;2025;"Jordi Santonja";@JordSant
|
||||||
|
shaders;shaders_rlgl_compute;★★★★;4.0;4.0;2021;2025;"Teddy Astie";@tsnake41
|
||||||
|
shaders;shaders_cel_shading;★★★☆;6.0;6.0;2026;2026;"Gleb A";@ggrizzly
|
||||||
audio;audio_module_playing;★☆☆☆;1.5;3.5;2016;2025;"Ramon Santamaria";@raysan5
|
audio;audio_module_playing;★☆☆☆;1.5;3.5;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
audio;audio_music_stream;★☆☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
audio;audio_music_stream;★☆☆☆;1.3;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
audio;audio_raw_stream;★★★☆;1.6;4.2;2015;2025;"Ramon Santamaria";@raysan5
|
audio;audio_raw_stream;★★★☆;1.6;6.0;2015;2026;"Ramon Santamaria";@raysan5
|
||||||
audio;audio_sound_loading;★☆☆☆;1.1;3.5;2014;2025;"Ramon Santamaria";@raysan5
|
audio;audio_sound_loading;★☆☆☆;1.1;3.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
audio;audio_mixed_processor;★★★★;4.2;4.2;2023;2025;"hkc";@hatkidchan
|
audio;audio_mixed_processor;★★★★;4.2;4.2;2023;2025;"hkc";@hatkidchan
|
||||||
audio;audio_stream_effects;★★★★;4.2;5.0;2022;2025;"Ramon Santamaria";@raysan5
|
audio;audio_stream_effects;★★★★;4.2;5.0;2022;2025;"Ramon Santamaria";@raysan5
|
||||||
audio;audio_sound_multi;★★☆☆;5.0;5.0;2023;2025;"Jeffery Myers";@JeffM2501
|
audio;audio_sound_multi;★★☆☆;5.0;5.0;2023;2025;"Jeffery Myers";@JeffM2501
|
||||||
audio;audio_sound_positioning;★★☆☆;5.5;5.5;2025;2025;"Le Juez Victor";@Bigfoot71
|
audio;audio_sound_positioning;★★☆☆;5.5;5.5;2025;2025;"Le Juez Victor";@Bigfoot71
|
||||||
others;rlgl_standalone;★★★★;1.6;4.0;2014;2025;"Ramon Santamaria";@raysan5
|
audio;audio_spectrum_visualizer;★★★☆;6.0;6.0;2025;2025;"IANN";@meisei4
|
||||||
others;rlgl_compute_shader;★★★★;4.0;4.0;2021;2025;"Teddy Astie";@tsnake41
|
audio;audio_stream_callback;★★★☆;6.0;6.0;2026;2026;"Dan Hoang";@dan-hoang
|
||||||
others;easings_testbed;★★★☆;2.5;3.0;2019;2025;"Juan Miguel López";@flashback-fx
|
|
||||||
others;raylib_opengl_interop;★★★★;3.8;4.0;2021;2025;"Stephan Soller";@arkanis
|
|
||||||
others;embedded_files_loading;★★☆☆;3.0;3.5;2020;2025;"Kristian Holmgren";@defutura
|
|
||||||
others;raymath_vector_angle;★★☆☆;1.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
|
||||||
|
|||||||
@ -36,8 +36,9 @@
|
|||||||
|
|
||||||
10. Have fun!
|
10. Have fun!
|
||||||
|
|
||||||
The following files should be updated when adding a new example, it's planned to create some
|
The following files must be updated when adding a new example,
|
||||||
script to automatize this process but not available yet
|
but it can be automatically done using the raylib provided tool: rexm
|
||||||
|
So, no worries if just the .c/.png are provided when adding the example.
|
||||||
|
|
||||||
- raylib/examples/<category>/<category>_example_name.c
|
- raylib/examples/<category>/<category>_example_name.c
|
||||||
- raylib/examples/<category>/<category>_example_name.png
|
- raylib/examples/<category>/<category>_example_name.png
|
||||||
|
|||||||
331
examples/models/models_animation_blend_custom.c
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [models] example - animation blend custom
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★★★] 4/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by dmitrii-brand (@dmitrii-brand) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* DETAILS: Example demonstrates per-bone animation blending, allowing smooth transitions
|
||||||
|
* between two animations by interpolating bone transforms. This is useful for:
|
||||||
|
* - Blending movement animations (walk/run) with action animations (jump/attack)
|
||||||
|
* - Creating smooth animation transitions
|
||||||
|
* - Layering animations (e.g., upper body attack while lower body walks)
|
||||||
|
*
|
||||||
|
* WARNING: GPU skinning must be enabled in raylib with a compilation flag,
|
||||||
|
* if not enabled, CPU skinning will be used instead
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2026 dmitrii-brand (@dmitrii-brand)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#include "rlgl.h" // Requried for: rlUpdateVertexBuffer() (CPU-skinning)
|
||||||
|
|
||||||
|
#include <string.h> // Required for: memcpy()
|
||||||
|
#include <stdlib.h> // Required for: NULL
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
static bool IsUpperBodyBone(const char *boneName);
|
||||||
|
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim1, int frame1,
|
||||||
|
ModelAnimation *anim2, int frame2, float blend, bool upperBodyBlend);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - animation blend custom");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
|
// Load gltf model
|
||||||
|
Model model = LoadModel("resources/models/gltf/greenman.glb");
|
||||||
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
|
// Load skinning shader
|
||||||
|
// WARNING: GPU skinning must be enabled in raylib with a compilation flag,
|
||||||
|
// if not enabled, CPU skinning will be used instead
|
||||||
|
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
||||||
|
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
||||||
|
model.materials[1].shader = skinningShader;
|
||||||
|
|
||||||
|
// Load gltf model animations
|
||||||
|
int animCount = 0;
|
||||||
|
ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/greenman.glb", &animCount);
|
||||||
|
|
||||||
|
// Use specific animation indices: 2-walk/move, 3-attack
|
||||||
|
int animIndex0 = 2; // Walk/Move animation (index 2)
|
||||||
|
int animIndex1 = 3; // Attack animation (index 3)
|
||||||
|
int animCurrentFrame0 = 0;
|
||||||
|
int animCurrentFrame1 = 0;
|
||||||
|
|
||||||
|
// Validate indices
|
||||||
|
if (animIndex0 >= animCount) animIndex0 = 0;
|
||||||
|
if (animIndex1 >= animCount) animIndex1 = (animCount > 1) ? 1 : 0;
|
||||||
|
|
||||||
|
bool upperBodyBlend = true; // Toggle: true = upper/lower body blending, false = uniform blending (50/50)
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
|
||||||
|
// Toggle upper/lower body blending mode (SPACE key)
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) upperBodyBlend = !upperBodyBlend;
|
||||||
|
|
||||||
|
// Update animation frames
|
||||||
|
ModelAnimation anim0 = anims[animIndex0];
|
||||||
|
ModelAnimation anim1 = anims[animIndex1];
|
||||||
|
|
||||||
|
animCurrentFrame0 = (animCurrentFrame0 + 1)%anim0.keyframeCount;
|
||||||
|
animCurrentFrame1 = (animCurrentFrame1 + 1)%anim1.keyframeCount;
|
||||||
|
|
||||||
|
// Blend the two animations
|
||||||
|
// When upperBodyBlend is ON: upper body = attack (1.0), lower body = walk (0.0)
|
||||||
|
// When upperBodyBlend is OFF: uniform blend at 0.5 (50% walk, 50% attack)
|
||||||
|
float blendFactor = (upperBodyBlend? 1.0f : 0.5f);
|
||||||
|
UpdateModelAnimationBones(&model, &anim0, animCurrentFrame0,
|
||||||
|
&anim1, animCurrentFrame1, blendFactor, upperBodyBlend);
|
||||||
|
|
||||||
|
// raylib provided animation blending function
|
||||||
|
//UpdateModelAnimationEx(model, anim0, (float)animCurrentFrame0,
|
||||||
|
// anim1, (float)animCurrentFrame1, blendFactor);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
DrawModel(model, position, 1.0f, WHITE);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
// Draw UI
|
||||||
|
DrawText(TextFormat("ANIM 0: %s", anim0.name), 10, 10, 20, GRAY);
|
||||||
|
DrawText(TextFormat("ANIM 1: %s", anim1.name), 10, 40, 20, GRAY);
|
||||||
|
DrawText(TextFormat("[SPACE] Toggle blending mode: %s",
|
||||||
|
upperBodyBlend? "Upper/Lower Body Blending" : "Uniform Blending"),
|
||||||
|
10, GetScreenHeight() - 30, 20, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModelAnimations(anims, animCount); // Unload model animation
|
||||||
|
UnloadModel(model); // Unload model and meshes/material
|
||||||
|
UnloadShader(skinningShader); // Unload GPU skinning shader
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Check if a bone is part of upper body (for selective blending)
|
||||||
|
static bool IsUpperBodyBone(const char *boneName)
|
||||||
|
{
|
||||||
|
// Common upper body bone names (adjust based on your model)
|
||||||
|
if (TextIsEqual(boneName, "spine") || TextIsEqual(boneName, "spine1") || TextIsEqual(boneName, "spine2") ||
|
||||||
|
TextIsEqual(boneName, "chest") || TextIsEqual(boneName, "upperChest") ||
|
||||||
|
TextIsEqual(boneName, "neck") || TextIsEqual(boneName, "head") ||
|
||||||
|
TextIsEqual(boneName, "shoulder") || TextIsEqual(boneName, "shoulder_L") || TextIsEqual(boneName, "shoulder_R") ||
|
||||||
|
TextIsEqual(boneName, "upperArm") || TextIsEqual(boneName, "upperArm_L") || TextIsEqual(boneName, "upperArm_R") ||
|
||||||
|
TextIsEqual(boneName, "lowerArm") || TextIsEqual(boneName, "lowerArm_L") || TextIsEqual(boneName, "lowerArm_R") ||
|
||||||
|
TextIsEqual(boneName, "hand") || TextIsEqual(boneName, "hand_L") || TextIsEqual(boneName, "hand_R") ||
|
||||||
|
TextIsEqual(boneName, "clavicle") || TextIsEqual(boneName, "clavicle_L") || TextIsEqual(boneName, "clavicle_R"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if bone name contains upper body keywords
|
||||||
|
if (strstr(boneName, "spine") != NULL || strstr(boneName, "chest") != NULL ||
|
||||||
|
strstr(boneName, "neck") != NULL || strstr(boneName, "head") != NULL ||
|
||||||
|
strstr(boneName, "shoulder") != NULL || strstr(boneName, "arm") != NULL ||
|
||||||
|
strstr(boneName, "hand") != NULL || strstr(boneName, "clavicle") != NULL)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blend two animations per-bone with selective upper/lower body blending
|
||||||
|
static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int frame0,
|
||||||
|
ModelAnimation *anim1, int frame1, float blend, bool upperBodyBlend)
|
||||||
|
{
|
||||||
|
// Validate inputs
|
||||||
|
if ((anim0->boneCount != 0) && (anim0->keyframePoses != NULL) &&
|
||||||
|
(anim1->boneCount != 0) && (anim1->keyframePoses != NULL) &&
|
||||||
|
(model->skeleton.boneCount != 0) && (model->skeleton.bindPose != NULL))
|
||||||
|
{
|
||||||
|
// Clamp blend factor to [0, 1]
|
||||||
|
blend = fminf(1.0f, fmaxf(0.0f, blend));
|
||||||
|
|
||||||
|
// Ensure frame indices are valid
|
||||||
|
if (frame0 >= anim0->keyframeCount) frame0 = anim0->keyframeCount - 1;
|
||||||
|
if (frame1 >= anim1->keyframeCount) frame1 = anim1->keyframeCount - 1;
|
||||||
|
if (frame0 < 0) frame0 = 0;
|
||||||
|
if (frame1 < 0) frame1 = 0;
|
||||||
|
|
||||||
|
// Get bone count (use minimum of all to be safe)
|
||||||
|
int boneCount = model->skeleton.boneCount;
|
||||||
|
if (anim0->boneCount < boneCount) boneCount = anim0->boneCount;
|
||||||
|
if (anim1->boneCount < boneCount) boneCount = anim1->boneCount;
|
||||||
|
|
||||||
|
// Blend each bone
|
||||||
|
for (int boneIndex = 0; boneIndex < boneCount; boneIndex++)
|
||||||
|
{
|
||||||
|
// Determine blend factor for this bone
|
||||||
|
float boneBlendFactor = blend;
|
||||||
|
|
||||||
|
// If upper body blending is enabled, use different blend factors for upper vs lower body
|
||||||
|
if (upperBodyBlend)
|
||||||
|
{
|
||||||
|
const char *boneName = model->skeleton.bones[boneIndex].name;
|
||||||
|
bool isUpperBody = IsUpperBodyBone(boneName);
|
||||||
|
|
||||||
|
// Upper body: use anim1 (attack), Lower body: use anim0 (walk)
|
||||||
|
// blend = 0.0 means full anim0 (walk), 1.0 means full anim1 (attack)
|
||||||
|
if (isUpperBody) boneBlendFactor = blend; // Upper body: blend towards anim1 (attack)
|
||||||
|
else boneBlendFactor = 1.0f - blend; // Lower body: blend towards anim0 (walk) - invert the blend
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get transforms from both animations
|
||||||
|
Transform *bindTransform = &model->skeleton.bindPose[boneIndex];
|
||||||
|
Transform *animTransform0 = &anim0->keyframePoses[frame0][boneIndex];
|
||||||
|
Transform *animTransform1 = &anim1->keyframePoses[frame1][boneIndex];
|
||||||
|
|
||||||
|
// Blend the transforms
|
||||||
|
Transform blended = { 0 };
|
||||||
|
blended.translation = Vector3Lerp(animTransform0->translation, animTransform1->translation, boneBlendFactor);
|
||||||
|
blended.rotation = QuaternionSlerp(animTransform0->rotation, animTransform1->rotation, boneBlendFactor);
|
||||||
|
blended.scale = Vector3Lerp(animTransform0->scale, animTransform1->scale, boneBlendFactor);
|
||||||
|
|
||||||
|
// Convert bind pose to matrix
|
||||||
|
Matrix bindMatrix = MatrixMultiply(MatrixMultiply(
|
||||||
|
MatrixScale(bindTransform->scale.x, bindTransform->scale.y, bindTransform->scale.z),
|
||||||
|
QuaternionToMatrix(bindTransform->rotation)),
|
||||||
|
MatrixTranslate(bindTransform->translation.x, bindTransform->translation.y, bindTransform->translation.z));
|
||||||
|
|
||||||
|
// Convert blended transform to matrix
|
||||||
|
Matrix blendedMatrix = MatrixMultiply(MatrixMultiply(
|
||||||
|
MatrixScale(blended.scale.x, blended.scale.y, blended.scale.z),
|
||||||
|
QuaternionToMatrix(blended.rotation)),
|
||||||
|
MatrixTranslate(blended.translation.x, blended.translation.y, blended.translation.z));
|
||||||
|
|
||||||
|
// Calculate final bone matrix (similar to UpdateModelAnimationBones)
|
||||||
|
model->boneMatrices[boneIndex] = MatrixMultiply(MatrixInvert(bindMatrix), blendedMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CPU skinning, updates CPU buffers and uploads them to GPU (if available)
|
||||||
|
// NOTE: Fallback in case GPU skinning is not supported or enabled
|
||||||
|
for (int m = 0; m < model->meshCount; m++)
|
||||||
|
{
|
||||||
|
Mesh mesh = model->meshes[m];
|
||||||
|
Vector3 animVertex = { 0 };
|
||||||
|
Vector3 animNormal = { 0 };
|
||||||
|
const int vertexValuesCount = mesh.vertexCount*3;
|
||||||
|
|
||||||
|
int boneIndex = 0;
|
||||||
|
int boneCounter = 0;
|
||||||
|
float boneWeight = 0.0f;
|
||||||
|
bool bufferUpdateRequired = false; // Flag to check when anim vertex information is updated
|
||||||
|
|
||||||
|
// Skip if missing bone data or missing anim buffers initialization
|
||||||
|
if ((mesh.boneWeights == NULL) || (mesh.boneIndices == NULL) ||
|
||||||
|
(mesh.animVertices == NULL) || (mesh.animNormals == NULL)) continue;
|
||||||
|
|
||||||
|
for (int vCounter = 0; vCounter < vertexValuesCount; vCounter += 3)
|
||||||
|
{
|
||||||
|
mesh.animVertices[vCounter] = 0;
|
||||||
|
mesh.animVertices[vCounter + 1] = 0;
|
||||||
|
mesh.animVertices[vCounter + 2] = 0;
|
||||||
|
if (mesh.animNormals != NULL)
|
||||||
|
{
|
||||||
|
mesh.animNormals[vCounter] = 0;
|
||||||
|
mesh.animNormals[vCounter + 1] = 0;
|
||||||
|
mesh.animNormals[vCounter + 2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterates over 4 bones per vertex
|
||||||
|
for (int j = 0; j < 4; j++, boneCounter++)
|
||||||
|
{
|
||||||
|
boneWeight = mesh.boneWeights[boneCounter];
|
||||||
|
boneIndex = mesh.boneIndices[boneCounter];
|
||||||
|
|
||||||
|
// Early stop when no transformation will be applied
|
||||||
|
if (boneWeight == 0.0f) continue;
|
||||||
|
animVertex = (Vector3){ mesh.vertices[vCounter], mesh.vertices[vCounter + 1], mesh.vertices[vCounter + 2] };
|
||||||
|
animVertex = Vector3Transform(animVertex, model->boneMatrices[boneIndex]);
|
||||||
|
mesh.animVertices[vCounter] += animVertex.x*boneWeight;
|
||||||
|
mesh.animVertices[vCounter + 1] += animVertex.y*boneWeight;
|
||||||
|
mesh.animVertices[vCounter + 2] += animVertex.z*boneWeight;
|
||||||
|
bufferUpdateRequired = true;
|
||||||
|
|
||||||
|
// Normals processing
|
||||||
|
// NOTE: We use meshes.baseNormals (default normal) to calculate meshes.normals (animated normals)
|
||||||
|
if ((mesh.normals != NULL) && (mesh.animNormals != NULL ))
|
||||||
|
{
|
||||||
|
animNormal = (Vector3){ mesh.normals[vCounter], mesh.normals[vCounter + 1], mesh.normals[vCounter + 2] };
|
||||||
|
animNormal = Vector3Transform(animNormal, MatrixTranspose(MatrixInvert(model->boneMatrices[boneIndex])));
|
||||||
|
mesh.animNormals[vCounter] += animNormal.x*boneWeight;
|
||||||
|
mesh.animNormals[vCounter + 1] += animNormal.y*boneWeight;
|
||||||
|
mesh.animNormals[vCounter + 2] += animNormal.z*boneWeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bufferUpdateRequired)
|
||||||
|
{
|
||||||
|
// Update GPU vertex buffers with updated data (position + normals)
|
||||||
|
rlUpdateVertexBuffer(mesh.vboId[SHADER_LOC_VERTEX_POSITION], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0);
|
||||||
|
if (mesh.normals != NULL) rlUpdateVertexBuffer(mesh.vboId[SHADER_LOC_VERTEX_NORMAL], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BIN
examples/models/models_animation_blend_custom.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
278
examples/models/models_animation_blending.c
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [models] example - animation blending
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★★★] 4/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 6.0
|
||||||
|
*
|
||||||
|
* Example contributed by Kirandeep (@Kirandeep-Singh-Khehra) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* WARNING: GPU skinning must be enabled in raylib with a compilation flag,
|
||||||
|
* if not enabled, CPU skinning will be used instead
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024-2026 Kirandeep (@Kirandeep-Singh-Khehra) and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h" // Required for: UI controls
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - animation blending");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 6.0f, 6.0f, 6.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 = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
|
// Load model
|
||||||
|
Model model = LoadModel("resources/models/gltf/robot.glb"); // Load character model
|
||||||
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model world position
|
||||||
|
|
||||||
|
// Load skinning shader
|
||||||
|
// WARNING: It requires SUPPORT_GPU_SKINNING enabled on raylib (disabled by default)
|
||||||
|
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
|
||||||
|
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
// Assign skinning shader to all materials shaders
|
||||||
|
//for (int i = 0; i < model.materialCount; i++) model.materials[i].shader = skinningShader;
|
||||||
|
|
||||||
|
// Load model animations
|
||||||
|
int animCount = 0;
|
||||||
|
ModelAnimation *anims = LoadModelAnimations("resources/models/gltf/robot.glb", &animCount);
|
||||||
|
|
||||||
|
// Animation playing variables
|
||||||
|
// NOTE: Two animations are played with a smooth transition between them
|
||||||
|
int currentAnimPlaying = 0; // Current animation playing (0 o 1)
|
||||||
|
int nextAnimToPlay = 1; // Next animation to play (to transition)
|
||||||
|
bool animTransition = false; // Flag to register anim transition state
|
||||||
|
|
||||||
|
int animIndex0 = 10; // Current animation playing (walking)
|
||||||
|
float animCurrentFrame0 = 0.0f; // Current animation frame (supporting interpolated frames)
|
||||||
|
float animFrameSpeed0 = 0.5f; // Current animation play speed
|
||||||
|
int animIndex1 = 6; // Next animation to play (running)
|
||||||
|
float animCurrentFrame1 = 0.0f; // Next animation frame (supporting interpolated frames)
|
||||||
|
float animFrameSpeed1 = 0.5f; // Next animation play speed
|
||||||
|
|
||||||
|
float animBlendFactor = 0.0f; // Blend factor from anim0[frame0] --> anim1[frame1], [0.0f..1.0f]
|
||||||
|
// NOTE: 0.0f results in full anim0[] and 1.0f in full anim1[]
|
||||||
|
|
||||||
|
float animBlendTime = 2.0f; // Time to blend from one playing animation to another (in seconds)
|
||||||
|
float animBlendTimeCounter = 0.0f; // Time counter (delta time)
|
||||||
|
|
||||||
|
bool animPause = false; // Pause animation
|
||||||
|
|
||||||
|
// UI required variables
|
||||||
|
char *animNames[64] = { 0 }; // Pointers to animation names for dropdown box
|
||||||
|
for (int i = 0; i < animCount; i++) animNames[i] = anims[i].name;
|
||||||
|
|
||||||
|
bool dropdownEditMode0 = false;
|
||||||
|
bool dropdownEditMode1 = false;
|
||||||
|
float animFrameProgress0 = 0.0f;
|
||||||
|
float animFrameProgress1 = 0.0f;
|
||||||
|
float animBlendProgress = 0.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_P)) animPause = !animPause;
|
||||||
|
|
||||||
|
if (!animPause)
|
||||||
|
{
|
||||||
|
// Start transition from anim0[] to anim1[]
|
||||||
|
if (IsKeyPressed(KEY_SPACE) && !animTransition)
|
||||||
|
{
|
||||||
|
if (currentAnimPlaying == 0)
|
||||||
|
{
|
||||||
|
// Transition anim0 --> anim1
|
||||||
|
nextAnimToPlay = 1;
|
||||||
|
animCurrentFrame1 = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Transition anim1 --> anim0
|
||||||
|
nextAnimToPlay = 0;
|
||||||
|
animCurrentFrame0 = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set animation transition
|
||||||
|
animTransition = true;
|
||||||
|
animBlendTimeCounter = 0.0f;
|
||||||
|
animBlendFactor = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animTransition)
|
||||||
|
{
|
||||||
|
// Playing anim0 and anim1 at the same time
|
||||||
|
animCurrentFrame0 += animFrameSpeed0;
|
||||||
|
if (animCurrentFrame0 >= anims[animIndex0].keyframeCount) animCurrentFrame0 = 0.0f;
|
||||||
|
animCurrentFrame1 += animFrameSpeed1;
|
||||||
|
if (animCurrentFrame1 >= anims[animIndex1].keyframeCount) animCurrentFrame1 = 0.0f;
|
||||||
|
|
||||||
|
// Increment blend factor over time to transition from anim0 --> anim1 over time
|
||||||
|
// NOTE: Time blending could be other than linear, using some easing
|
||||||
|
animBlendFactor = animBlendTimeCounter/animBlendTime;
|
||||||
|
animBlendTimeCounter += GetFrameTime();
|
||||||
|
animBlendProgress = animBlendFactor;
|
||||||
|
|
||||||
|
// Update model with animations blending
|
||||||
|
if (nextAnimToPlay == 1)
|
||||||
|
{
|
||||||
|
// Blend anim0 --> anim1
|
||||||
|
UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
|
||||||
|
anims[animIndex1], animCurrentFrame1, animBlendFactor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Blend anim1 --> anim0
|
||||||
|
UpdateModelAnimationEx(model, anims[animIndex1], animCurrentFrame1,
|
||||||
|
anims[animIndex0], animCurrentFrame0, animBlendFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if transition completed
|
||||||
|
if (animBlendFactor > 1.0f)
|
||||||
|
{
|
||||||
|
// Reset frame states
|
||||||
|
if (currentAnimPlaying == 0) animCurrentFrame0 = 0.0f;
|
||||||
|
else if (currentAnimPlaying == 1) animCurrentFrame1 = 0.0f;
|
||||||
|
currentAnimPlaying = nextAnimToPlay; // Update current animation playing
|
||||||
|
|
||||||
|
animBlendFactor = 0.0f; // Reset blend factor
|
||||||
|
animTransition = false; // Exit transition mode
|
||||||
|
animBlendTimeCounter = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Play only one anim, the current one
|
||||||
|
if (currentAnimPlaying == 0)
|
||||||
|
{
|
||||||
|
// Playing anim0 at defined speed
|
||||||
|
animCurrentFrame0 += animFrameSpeed0;
|
||||||
|
if (animCurrentFrame0 >= anims[animIndex0].keyframeCount) animCurrentFrame0 = 0.0f;
|
||||||
|
UpdateModelAnimation(model, anims[animIndex0], animCurrentFrame0);
|
||||||
|
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
|
||||||
|
// anims[animIndex1], animCurrentFrame1, 0.0f); // Same as above, first animation frame blend
|
||||||
|
}
|
||||||
|
else if (currentAnimPlaying == 1)
|
||||||
|
{
|
||||||
|
// Playing anim1 at defined speed
|
||||||
|
animCurrentFrame1 += animFrameSpeed1;
|
||||||
|
if (animCurrentFrame1 >= anims[animIndex1].keyframeCount) animCurrentFrame1 = 0.0f;
|
||||||
|
UpdateModelAnimation(model, anims[animIndex1], animCurrentFrame1);
|
||||||
|
//UpdateModelAnimationEx(model, anims[animIndex0], animCurrentFrame0,
|
||||||
|
// anims[animIndex1], animCurrentFrame1, 1.0f); // Same as above, second animation frame blend
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update progress bars values with current frame for each animation
|
||||||
|
animFrameProgress0 = animCurrentFrame0;
|
||||||
|
animFrameProgress1 = animCurrentFrame1;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
DrawModel(model, position, 1.0f, WHITE); // Draw animated model
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
if (animTransition) DrawText("ANIM TRANSITION BLENDING!", 170, 50, 30, BLUE);
|
||||||
|
|
||||||
|
// Draw UI elements
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
if (dropdownEditMode0) GuiDisable();
|
||||||
|
GuiSlider((Rectangle){ 10, 38, 160, 12 },
|
||||||
|
NULL, TextFormat("x%.1f", animFrameSpeed0), &animFrameSpeed0, 0.1f, 2.0f);
|
||||||
|
GuiEnable();
|
||||||
|
if (dropdownEditMode1) GuiDisable();
|
||||||
|
GuiSlider((Rectangle){ GetScreenWidth() - 170.0f, 38, 160, 12 },
|
||||||
|
TextFormat("%.1fx", animFrameSpeed1), NULL, &animFrameSpeed1, 0.1f, 2.0f);
|
||||||
|
GuiEnable();
|
||||||
|
|
||||||
|
// Draw animation selectors for blending transition
|
||||||
|
// NOTE: Transition does not start until requested
|
||||||
|
GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 1);
|
||||||
|
if (GuiDropdownBox((Rectangle){ 10, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
|
||||||
|
&animIndex0, dropdownEditMode0)) dropdownEditMode0 = !dropdownEditMode0;
|
||||||
|
|
||||||
|
// Blending process progress bar
|
||||||
|
if (nextAnimToPlay == 1) GuiSetStyle(PROGRESSBAR, PROGRESS_SIDE, 0); // Left-->Right
|
||||||
|
else GuiSetStyle(PROGRESSBAR, PROGRESS_SIDE, 1); // Right-->Left
|
||||||
|
GuiProgressBar((Rectangle){ 180, 14, 440, 16 }, NULL, NULL, &animBlendProgress, 0.0f, 1.0f);
|
||||||
|
GuiSetStyle(PROGRESSBAR, PROGRESS_SIDE, 0); // Reset to Left-->Right
|
||||||
|
|
||||||
|
if (GuiDropdownBox((Rectangle){ GetScreenWidth() - 170.0f, 10, 160, 24 }, TextJoin(animNames, animCount, ";"),
|
||||||
|
&animIndex1, dropdownEditMode1)) dropdownEditMode1 = !dropdownEditMode1;
|
||||||
|
|
||||||
|
// Draw playing timeline with keyframes for anim0[]
|
||||||
|
GuiProgressBar((Rectangle){ 60, GetScreenHeight() - 60.0f, GetScreenWidth() - 180.0f, 20 }, "ANIM 0",
|
||||||
|
TextFormat("FRAME: %.2f / %i", animFrameProgress0, anims[animIndex0].keyframeCount),
|
||||||
|
&animFrameProgress0, 0.0f, (float)anims[animIndex0].keyframeCount);
|
||||||
|
for (int i = 0; i < anims[animIndex0].keyframeCount; i++)
|
||||||
|
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex0].keyframeCount)*(float)i),
|
||||||
|
GetScreenHeight() - 60, 1, 20, BLUE);
|
||||||
|
|
||||||
|
// Draw playing timeline with keyframes for anim1[]
|
||||||
|
GuiProgressBar((Rectangle){ 60, GetScreenHeight() - 30.0f, GetScreenWidth() - 180.0f, 20 }, "ANIM 1",
|
||||||
|
TextFormat("FRAME: %.2f / %i", animFrameProgress1, anims[animIndex1].keyframeCount),
|
||||||
|
&animFrameProgress1, 0.0f, (float)anims[animIndex1].keyframeCount);
|
||||||
|
for (int i = 0; i < anims[animIndex1].keyframeCount; i++)
|
||||||
|
DrawRectangle(60 + (int)(((float)(GetScreenWidth() - 180)/(float)anims[animIndex1].keyframeCount)*(float)i),
|
||||||
|
GetScreenHeight() - 30, 1, 20, BLUE);
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModelAnimations(anims, animCount); // Unload model animation
|
||||||
|
UnloadModel(model); // Unload model and meshes/material
|
||||||
|
UnloadShader(skinningShader); // Unload GPU skinning shader
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/models/models_animation_blending.png
Normal file
|
After Width: | Height: | Size: 27 KiB |