Compare commits
355 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
75a73d9417 | ||
![]() |
d042ed52fa | ||
![]() |
2cc05e5e92 | ||
![]() |
2a058338f3 | ||
![]() |
4d2b8471fa | ||
![]() |
26252c4c1d | ||
![]() |
c70d8acb33 | ||
![]() |
16dd57747c | ||
![]() |
24ba22a43a | ||
![]() |
2da3c6d288 | ||
![]() |
c7486a0339 | ||
![]() |
c86b3d0c05 | ||
![]() |
2d1b2efb92 | ||
![]() |
9ec4776812 | ||
![]() |
2f08845d1e | ||
![]() |
9f5efeb309 | ||
![]() |
182054b662 | ||
![]() |
a8bb9b6b19 | ||
![]() |
84252f9b70 | ||
![]() |
89409817b5 | ||
![]() |
7b360d8579 | ||
![]() |
83459159f4 | ||
![]() |
4b6e6d4dd4 | ||
![]() |
954ced21a4 | ||
![]() |
98c60838fe | ||
![]() |
09f28d0f57 | ||
![]() |
8aab52aeda | ||
![]() |
afd2ffb74a | ||
![]() |
825e42dc00 | ||
![]() |
b99b21fa38 | ||
![]() |
0018522031 | ||
![]() |
30fafb77db | ||
![]() |
ed19064405 | ||
![]() |
94c92a58a1 | ||
![]() |
9c9aeaef47 | ||
![]() |
cbbe948529 | ||
![]() |
823abf666e | ||
![]() |
685273675b | ||
![]() |
15cd4dce4e | ||
![]() |
9cbfcbb820 | ||
![]() |
fca83c9ff8 | ||
![]() |
54c7fa491e | ||
![]() |
c69ce1d750 | ||
![]() |
84a6724b33 | ||
![]() |
a847df921f | ||
![]() |
687fe2c3c7 | ||
![]() |
e98ea900cf | ||
![]() |
2ef9552454 | ||
![]() |
6a392f0eb2 | ||
![]() |
c00062655f | ||
![]() |
4ad375a378 | ||
![]() |
4a3509f06d | ||
![]() |
4fae37bb88 | ||
![]() |
646f1c3f71 | ||
![]() |
df5c64d0be | ||
![]() |
65ecde1e75 | ||
![]() |
728e1715cc | ||
![]() |
e484d58d9c | ||
![]() |
708e8c558c | ||
![]() |
4ec0ac89cd | ||
![]() |
196bda0597 | ||
![]() |
bf32081fa9 | ||
![]() |
13925f7bd4 | ||
![]() |
e6ad166ae3 | ||
![]() |
db5493b783 | ||
![]() |
5d6475c93b | ||
![]() |
ac475f46b9 | ||
![]() |
c21ca3ca1a | ||
![]() |
99f99bea47 | ||
![]() |
d0ff78e7f4 | ||
![]() |
3113a20390 | ||
![]() |
41959eeae1 | ||
![]() |
08da91047e | ||
![]() |
6e9d3eb0f9 | ||
![]() |
ed674d865b | ||
![]() |
233f7611da | ||
![]() |
f874fdc1ad | ||
![]() |
4e57bd1f18 | ||
![]() |
455be7f6f6 | ||
![]() |
23d66e9b6f | ||
![]() |
882e2abee1 | ||
![]() |
68ba34c17b | ||
![]() |
a286d9166b | ||
![]() |
fcd30c5649 | ||
![]() |
8ae0da1fa1 | ||
![]() |
25f5995be0 | ||
![]() |
cf6c6fefd7 | ||
![]() |
c5663ca015 | ||
![]() |
51c0b61a43 | ||
![]() |
634f8f0d0f | ||
![]() |
efa1c96d19 | ||
![]() |
423a45ac85 | ||
![]() |
dc385ba4ec | ||
![]() |
c8e8c0a002 | ||
![]() |
c04752c0e4 | ||
![]() |
ae87a35f6e | ||
![]() |
29c618a35e | ||
![]() |
036e77939f | ||
![]() |
de7bddb8df | ||
![]() |
fd05d3e353 | ||
![]() |
a640503119 | ||
![]() |
f24fd14814 | ||
![]() |
f98c4dc82b | ||
![]() |
f1d16386b6 | ||
![]() |
144681fc0f | ||
![]() |
03c82605a0 | ||
![]() |
183795b8aa | ||
![]() |
91e00431d4 | ||
![]() |
3b4d8442e0 | ||
![]() |
4f0165f32d | ||
![]() |
fb6ef2c2f4 | ||
![]() |
bb49102a4b | ||
![]() |
4cc394c376 | ||
![]() |
8eb6fc5612 | ||
![]() |
5e7686695f | ||
![]() |
e5a56fa985 | ||
![]() |
f10835cf09 | ||
![]() |
a5e79b7663 | ||
![]() |
b7461846ab | ||
![]() |
40119949cb | ||
![]() |
21229aa3f6 | ||
![]() |
1793f2c3b8 | ||
![]() |
4a637191f2 | ||
![]() |
8991573984 | ||
![]() |
7f2e67e924 | ||
![]() |
1ce010c7d4 | ||
![]() |
fe0cf8f9a9 | ||
![]() |
32508f6db1 | ||
![]() |
1c23edd1e5 | ||
![]() |
ea50092356 | ||
![]() |
891c4a458a | ||
![]() |
0c539cbf32 | ||
![]() |
70d405b41b | ||
![]() |
95da97fa74 | ||
![]() |
546c727520 | ||
![]() |
1656d17b22 | ||
![]() |
8fa5c9dce2 | ||
![]() |
b8b34a1b26 | ||
![]() |
6608c5a8a7 | ||
![]() |
a299bc289b | ||
![]() |
e0d8cceb65 | ||
![]() |
3a739c38c5 | ||
![]() |
d32feaa668 | ||
![]() |
f269fb46ea | ||
![]() |
63ea3449d3 | ||
![]() |
e97438114f | ||
![]() |
a5492dd5fc | ||
![]() |
fa057f512f | ||
![]() |
55f0abbe99 | ||
![]() |
9f5c5dfff4 | ||
![]() |
802f29fb0e | ||
![]() |
8a29e5eb5e | ||
![]() |
b804f38150 | ||
![]() |
46ea556593 | ||
![]() |
5335f262be | ||
![]() |
b11cda959d | ||
![]() |
8c8e5bb7c8 | ||
![]() |
59cf0f6a42 | ||
![]() |
5659249dfa | ||
![]() |
b894a78385 | ||
![]() |
3b45336929 | ||
![]() |
da28cff0f6 | ||
![]() |
5dbb93dbb4 | ||
![]() |
6cb0603fbe | ||
![]() |
8e30bd1f69 | ||
![]() |
6e5ceaa30d | ||
![]() |
e8c79f53a6 | ||
![]() |
e683fe88b9 | ||
![]() |
1bcb5ddd50 | ||
![]() |
4db2da9185 | ||
![]() |
1b39b2e261 | ||
![]() |
f144b6bae4 | ||
![]() |
2bd7245508 | ||
![]() |
b62f7c3057 | ||
![]() |
f4e455398c | ||
![]() |
85908befea | ||
![]() |
a6f5a0339a | ||
![]() |
c17c1ccaea | ||
![]() |
88e1fd9530 | ||
![]() |
2fa7e00f16 | ||
![]() |
5208d57f1e | ||
![]() |
76024b5036 | ||
![]() |
002dacef40 | ||
![]() |
580c0a7296 | ||
![]() |
67423ff64b | ||
![]() |
b135bcd422 | ||
![]() |
fb4105cf8a | ||
![]() |
d1f099374c | ||
![]() |
932396922d | ||
![]() |
afdf357fbe | ||
![]() |
8c117cfb57 | ||
![]() |
f13b30d606 | ||
![]() |
165b3dd215 | ||
![]() |
d218534fff | ||
![]() |
333fdf6b90 | ||
![]() |
625e4e2fb3 | ||
![]() |
949e93f9fe | ||
![]() |
e9792ef771 | ||
![]() |
9bf411f580 | ||
![]() |
11a8dacb0f | ||
![]() |
3bd7109d8b | ||
![]() |
9af10686b2 | ||
![]() |
c5377f4e05 | ||
![]() |
34db515acb | ||
![]() |
6ffb3c72fb | ||
![]() |
f582ab06ad | ||
![]() |
7c36289768 | ||
![]() |
544df87a8e | ||
![]() |
77558eec0c | ||
![]() |
d05acb1b68 | ||
![]() |
ef1f9fe450 | ||
![]() |
4e0378ab7c | ||
![]() |
075f599abb | ||
![]() |
94d0e83207 | ||
![]() |
ab459bf418 | ||
![]() |
35f1ebf9f3 | ||
![]() |
b1a90a7f91 | ||
![]() |
da5221910f | ||
![]() |
50c5df0838 | ||
![]() |
a7a81ca749 | ||
![]() |
4879106096 | ||
![]() |
e28fef6ee0 | ||
![]() |
9a578c5962 | ||
![]() |
0a345a6128 | ||
![]() |
94a1fdc2ae | ||
![]() |
acc322b3e1 | ||
![]() |
e5fe2c216e | ||
![]() |
e93475d854 | ||
![]() |
858ccb350d | ||
![]() |
7e568c8903 | ||
![]() |
60194753d7 | ||
![]() |
808aeabf4c | ||
![]() |
32330801c9 | ||
![]() |
535b9e606f | ||
![]() |
92bcf09c53 | ||
![]() |
aa982f80f5 | ||
![]() |
d7e7ef6a7d | ||
![]() |
055d8927cc | ||
![]() |
8692c49511 | ||
![]() |
ecd6f77de7 | ||
![]() |
5cfd59258a | ||
![]() |
9dd20577cd | ||
![]() |
ea45223f1f | ||
![]() |
12581c1721 | ||
![]() |
324259ef8e | ||
![]() |
773360caa3 | ||
![]() |
ca402e9d36 | ||
![]() |
6ac5d3bc06 | ||
![]() |
c52ba520ce | ||
![]() |
322ca97c24 | ||
![]() |
ef36950b72 | ||
![]() |
4e5f5764ce | ||
![]() |
3a9ed0e846 | ||
![]() |
997170a317 | ||
![]() |
8745d733f9 | ||
![]() |
86f683dcbb | ||
![]() |
04d9c4c183 | ||
![]() |
9964935a12 | ||
![]() |
72e909f556 | ||
![]() |
0919d43dfb | ||
![]() |
27e44c43c5 | ||
![]() |
07858c3a1f | ||
![]() |
fd2b0c7c38 | ||
![]() |
b8b0247043 | ||
![]() |
6da175fccb | ||
![]() |
037898be56 | ||
![]() |
82f71880e9 | ||
![]() |
0b04807258 | ||
![]() |
5837249d76 | ||
![]() |
ba640598e5 | ||
![]() |
a42bfa7794 | ||
![]() |
5436d93a3d | ||
![]() |
36552ff995 | ||
![]() |
0af2f45815 | ||
![]() |
39e22e98ce | ||
![]() |
e8fa630c28 | ||
![]() |
6e4cfa5ecf | ||
![]() |
c0d8ae7f4d | ||
![]() |
7834a4e2fc | ||
![]() |
0b24330d86 | ||
![]() |
0b7c2ab183 | ||
![]() |
f7acee9221 | ||
![]() |
8b3a82688e | ||
![]() |
067b884f39 | ||
![]() |
a98578c91d | ||
![]() |
14d3b0a084 | ||
![]() |
552033da27 | ||
![]() |
66556b8b47 | ||
![]() |
3434255ce6 | ||
![]() |
d686cc6c4a | ||
![]() |
d50194940d | ||
![]() |
e30421e84c | ||
![]() |
c944d62374 | ||
![]() |
84befaea24 | ||
![]() |
2be8753788 | ||
![]() |
a59433e7a3 | ||
![]() |
cd08ae7b85 | ||
![]() |
1ec87f7990 | ||
![]() |
bae1bf7b0a | ||
![]() |
024e48850e | ||
![]() |
9572d6c063 | ||
![]() |
d9c5614342 | ||
![]() |
4c6c182023 | ||
![]() |
fca60cb597 | ||
![]() |
6a4afae5cc | ||
![]() |
fd851d1d8b | ||
![]() |
9e450df053 | ||
![]() |
c7ae28aaa2 | ||
![]() |
19721c70ff | ||
![]() |
e25f1227c0 | ||
![]() |
4e4b6bef21 | ||
![]() |
a7714c842f | ||
![]() |
eae98e1c34 | ||
![]() |
ba257b09f5 | ||
![]() |
05fe1c22ed | ||
![]() |
7db895ab5d | ||
![]() |
ceb7325727 | ||
![]() |
7d2318c167 | ||
![]() |
a632a04a30 | ||
![]() |
2b4a1f295a | ||
![]() |
3cad094edd | ||
![]() |
c062f8d4fe | ||
![]() |
ee4b553c2a | ||
![]() |
3cb4edcbc3 | ||
![]() |
e1353b9f7d | ||
![]() |
47827ddda1 | ||
![]() |
387795311c | ||
![]() |
77eda6494e | ||
![]() |
b25cdf7f7d | ||
![]() |
765870fe8f | ||
![]() |
cc6cf9a741 | ||
![]() |
ab12193f10 | ||
![]() |
b926765ce0 | ||
![]() |
9ab6718234 | ||
![]() |
42c92e4f2e | ||
![]() |
b9e53cd135 | ||
![]() |
dc52c8f769 | ||
![]() |
032c8333d9 | ||
![]() |
b92c1bbbf7 | ||
![]() |
f5048742aa | ||
![]() |
e9ea3f50bf | ||
![]() |
a9e045a1a8 | ||
![]() |
7d0407c6a2 | ||
![]() |
c00cd38b01 | ||
![]() |
e96c22d6f8 | ||
![]() |
874dc89fca | ||
![]() |
5104567a24 | ||
![]() |
2968ba9938 | ||
![]() |
cae6f3c613 | ||
![]() |
bb8c1826d3 | ||
![]() |
274921cd35 | ||
![]() |
39fda7af82 | ||
![]() |
31934ac374 | ||
![]() |
d739895e4a | ||
![]() |
e37ef10595 |
14
.gitignore
vendored
@@ -1,13 +1,6 @@
|
|||||||
# Ignore generated files
|
# Ignore generated files
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# Ignore compiled binaries
|
|
||||||
src/*.o
|
|
||||||
src/*.exe
|
|
||||||
examples/*.o
|
|
||||||
examples/*.exe
|
|
||||||
templates/*.exe
|
|
||||||
|
|
||||||
# Ignore Android generated files and folders
|
# Ignore Android generated files and folders
|
||||||
src_android/obj/
|
src_android/obj/
|
||||||
templates/android_project/bin/
|
templates/android_project/bin/
|
||||||
@@ -48,6 +41,9 @@ _ReSharper*/
|
|||||||
[Tt]est[Rr]esult*
|
[Tt]est[Rr]esult*
|
||||||
ipch/
|
ipch/
|
||||||
*.opensdf
|
*.opensdf
|
||||||
|
|
||||||
|
# Ignore compiled binaries
|
||||||
|
*.o
|
||||||
*.exe
|
*.exe
|
||||||
!tools/rrem.exe
|
!tools/rrem.exe
|
||||||
|
|
||||||
@@ -63,4 +59,6 @@ xcschememanagement.plist
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
._.*
|
._.*
|
||||||
xcuserdata/
|
xcuserdata/
|
||||||
DerivedData/
|
DerivedData/
|
||||||
|
*.dll
|
||||||
|
src/libraylib.a
|
93
CHANGELOG
@@ -1,11 +1,102 @@
|
|||||||
changelog
|
changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Current Release: raylib 1.2.2 (31 December 2014)
|
Current Release: raylib 1.4.0 (22 February 2016)
|
||||||
|
|
||||||
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
|
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
|
||||||
NOTE: Current Release includes all previous updates.
|
NOTE: Current Release includes all previous updates.
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.4.0 (22 February 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This version supposed another big improvement for raylib, inlcuding new modules and new features.
|
||||||
|
More than 30 new functions have been added to previous raylib version.
|
||||||
|
Around 8 new examples and +10 new game samples have been added.
|
||||||
|
|
||||||
|
BIG changes:
|
||||||
|
[textures] IMAGE MANIPULATION: Functions to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
|
||||||
|
[text] SPRITEFONT SUPPORT: Added support for AngelCode fonts (.fnt) and TrueType fonts (.ttf).
|
||||||
|
[gestures] REDESIGN: Gestures system simplified and prepared to process generic touch events, including mouse events (multiplatform).
|
||||||
|
[physac] NEW MODULE: Basic 2D physics support, use colliders and rigidbodies; apply forces to physic objects.
|
||||||
|
|
||||||
|
other changes:
|
||||||
|
[rlgl] Removed GLEW library dependency, now using GLAD
|
||||||
|
[rlgl] Implemented alternative to glGetTexImage() on OpenGL ES
|
||||||
|
[rlgl] Using depth data on batch drawing
|
||||||
|
[rlgl] Reviewed glReadPixels() function
|
||||||
|
[core][rlgl] Reviewed raycast system, now 3D picking works
|
||||||
|
[core] Android: Reviewed Android App cycle, paused if inactive
|
||||||
|
[shaders] Implemented Blinn-Phong lighting shading model
|
||||||
|
[textures] Implemented Floyd-Steinberg dithering - ImageDither()
|
||||||
|
[text] Added line-break support to DrawText()
|
||||||
|
[text] Added TrueType Fonts support (using stb_truetype)
|
||||||
|
[models] Implement function: CalculateBoundingBox(Mesh mesh)
|
||||||
|
[models] Added functions to check Ray collisions
|
||||||
|
[models] Improve map resolution control on LoadHeightmap()
|
||||||
|
[camera] Corrected small-glitch on zoom-in with mouse-wheel
|
||||||
|
[gestures] Implemented SetGesturesEnabled() to enable only some gestures
|
||||||
|
[gestures] Implemented GetElapsedTime() on Windows system
|
||||||
|
[gestures] Support mouse gestures for desktop platforms
|
||||||
|
[raymath] Complete review of the module and converted to header-only
|
||||||
|
[easings] Added new module for easing animations
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[*] Lots of tweaks around
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.3.0 (01 September 2015)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This version supposed a big boost for raylib, new modules have been added with lots of features.
|
||||||
|
Most of the modules have been completely reviewed to accomodate to the new features.
|
||||||
|
Over 50 new functions have been added to previous raylib version.
|
||||||
|
Most of the examples have been redone and +10 new advanced examples have been added.
|
||||||
|
|
||||||
|
BIG changes:
|
||||||
|
[rlgl] SHADERS: Support for model shaders and postprocessing shaders (multiple functions)
|
||||||
|
[textures] FORMATS: Support for multiple internal formats, including compressed formats
|
||||||
|
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
|
||||||
|
[gestures] NEW MODULE: Gestures system for Android and HTML5 platforms
|
||||||
|
[raygui] NEW MODULE: Set of IMGUI elements for tools development (experimental)
|
||||||
|
|
||||||
|
smaller changes:
|
||||||
|
[rlgl] Added check for OpenGL supported extensions
|
||||||
|
[rlgl] Added function SetBlenMode() to select some predefined blending modes
|
||||||
|
[core] Added support for drop&drag of external files into running program
|
||||||
|
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
|
||||||
|
[core] Renamed function SetFlags() to SetConfigFlags()
|
||||||
|
[shapes] Simplified some functions to improve performance
|
||||||
|
[textures] Review of Image struct to support multiple data formats
|
||||||
|
[textures] Added function LoadImageEx()
|
||||||
|
[textures] Added function LoadImageRaw()
|
||||||
|
[textures] Added function LoadTextureEx()
|
||||||
|
[textures] Simplified function parameters LoadTextureFromImage()
|
||||||
|
[textures] Added function GetImageData()
|
||||||
|
[textures] Added function GetTextureData()
|
||||||
|
[textures] Renamed function ConvertToPOT() to ImageConvertToPOT()
|
||||||
|
[textures] Added function ImageConvertFormat()
|
||||||
|
[textures] Added function GenTextureMipmaps()
|
||||||
|
[text] Added support for Latin-1 Extended characters for default font
|
||||||
|
[text] Redesigned SpriteFont struct, replaced Character struct by Rectangle
|
||||||
|
[text] Removed function GetFontBaseSize(), use directly spriteFont.size
|
||||||
|
[models] Review of struct: Model (added shaders support)
|
||||||
|
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
|
||||||
|
[models] Added function DrawCubeTexture()
|
||||||
|
[models] Added function DrawQuad()
|
||||||
|
[models] Added function DrawRay()
|
||||||
|
[models] Simplified funtion DrawPlane()
|
||||||
|
[models] Removed function DrawPlaneEx()
|
||||||
|
[models] Simplified funtion DrawGizmo()
|
||||||
|
[models] Removed function DrawGizmoEx()
|
||||||
|
[models] Added function LoadModelEx()
|
||||||
|
[models] Review of function LoadCubicMap()
|
||||||
|
[models] Added function ResolveCollisionCubicmap()
|
||||||
|
[audio] Decopupled from raylib, now this module can be used as standalone
|
||||||
|
[audio] Added function UpdateMusicStream()
|
||||||
|
[raymath] Complete review of the module
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[*] Lots of tweaks around
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 1.2.2 (31 December 2014)
|
Release: raylib 1.2.2 (31 December 2014)
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
@@ -19,7 +19,7 @@ with a small [donation](http://www.raylib.com/helpme.htm) (just some euros...).
|
|||||||
raylib philosophy
|
raylib philosophy
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself.
|
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself (clear code).
|
||||||
* raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or
|
* raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or
|
||||||
has not a clear usefulness, better not to include it.
|
has not a clear usefulness, better not to include it.
|
||||||
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
||||||
@@ -32,6 +32,8 @@ contact
|
|||||||
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||||
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
|
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
342
LICENSE.md
@@ -37,3 +37,345 @@ All rBMF fonts provided with raylib are free to use (freeware) and have been des
|
|||||||
* Mecha - Captain Falcon
|
* Mecha - Captain Falcon
|
||||||
* PixelPlay - Aleksander Shevchuk
|
* PixelPlay - Aleksander Shevchuk
|
||||||
* PixAntiqua - Gerhard Großmann
|
* PixAntiqua - Gerhard Großmann
|
||||||
|
|
||||||
|
3d models
|
||||||
|
---------
|
||||||
|
|
||||||
|
dwarf 3d model used in examples is created by David Moreno and licensed as Creative Commons Attribution-NonCommercial 3.0
|
||||||
|
|
||||||
|
Full license provided below:
|
||||||
|
|
||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
Attribution-NonCommercial 3.0 Unported
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
|
||||||
|
DAMAGES RESULTING FROM ITS USE.
|
||||||
|
|
||||||
|
License
|
||||||
|
|
||||||
|
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
|
||||||
|
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
|
||||||
|
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
|
||||||
|
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||||
|
|
||||||
|
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
|
||||||
|
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
|
||||||
|
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
|
||||||
|
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
|
||||||
|
CONDITIONS.
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
|
||||||
|
a. "Adaptation" means a work based upon the Work, or upon the Work and
|
||||||
|
other pre-existing works, such as a translation, adaptation,
|
||||||
|
derivative work, arrangement of music or other alterations of a
|
||||||
|
literary or artistic work, or phonogram or performance and includes
|
||||||
|
cinematographic adaptations or any other form in which the Work may be
|
||||||
|
recast, transformed, or adapted including in any form recognizably
|
||||||
|
derived from the original, except that a work that constitutes a
|
||||||
|
Collection will not be considered an Adaptation for the purpose of
|
||||||
|
this License. For the avoidance of doubt, where the Work is a musical
|
||||||
|
work, performance or phonogram, the synchronization of the Work in
|
||||||
|
timed-relation with a moving image ("synching") will be considered an
|
||||||
|
Adaptation for the purpose of this License.
|
||||||
|
b. "Collection" means a collection of literary or artistic works, such as
|
||||||
|
encyclopedias and anthologies, or performances, phonograms or
|
||||||
|
broadcasts, or other works or subject matter other than works listed
|
||||||
|
in Section 1(f) below, which, by reason of the selection and
|
||||||
|
arrangement of their contents, constitute intellectual creations, in
|
||||||
|
which the Work is included in its entirety in unmodified form along
|
||||||
|
with one or more other contributions, each constituting separate and
|
||||||
|
independent works in themselves, which together are assembled into a
|
||||||
|
collective whole. A work that constitutes a Collection will not be
|
||||||
|
considered an Adaptation (as defined above) for the purposes of this
|
||||||
|
License.
|
||||||
|
c. "Distribute" means to make available to the public the original and
|
||||||
|
copies of the Work or Adaptation, as appropriate, through sale or
|
||||||
|
other transfer of ownership.
|
||||||
|
d. "Licensor" means the individual, individuals, entity or entities that
|
||||||
|
offer(s) the Work under the terms of this License.
|
||||||
|
e. "Original Author" means, in the case of a literary or artistic work,
|
||||||
|
the individual, individuals, entity or entities who created the Work
|
||||||
|
or if no individual or entity can be identified, the publisher; and in
|
||||||
|
addition (i) in the case of a performance the actors, singers,
|
||||||
|
musicians, dancers, and other persons who act, sing, deliver, declaim,
|
||||||
|
play in, interpret or otherwise perform literary or artistic works or
|
||||||
|
expressions of folklore; (ii) in the case of a phonogram the producer
|
||||||
|
being the person or legal entity who first fixes the sounds of a
|
||||||
|
performance or other sounds; and, (iii) in the case of broadcasts, the
|
||||||
|
organization that transmits the broadcast.
|
||||||
|
f. "Work" means the literary and/or artistic work offered under the terms
|
||||||
|
of this License including without limitation any production in the
|
||||||
|
literary, scientific and artistic domain, whatever may be the mode or
|
||||||
|
form of its expression including digital form, such as a book,
|
||||||
|
pamphlet and other writing; a lecture, address, sermon or other work
|
||||||
|
of the same nature; a dramatic or dramatico-musical work; a
|
||||||
|
choreographic work or entertainment in dumb show; a musical
|
||||||
|
composition with or without words; a cinematographic work to which are
|
||||||
|
assimilated works expressed by a process analogous to cinematography;
|
||||||
|
a work of drawing, painting, architecture, sculpture, engraving or
|
||||||
|
lithography; a photographic work to which are assimilated works
|
||||||
|
expressed by a process analogous to photography; a work of applied
|
||||||
|
art; an illustration, map, plan, sketch or three-dimensional work
|
||||||
|
relative to geography, topography, architecture or science; a
|
||||||
|
performance; a broadcast; a phonogram; a compilation of data to the
|
||||||
|
extent it is protected as a copyrightable work; or a work performed by
|
||||||
|
a variety or circus performer to the extent it is not otherwise
|
||||||
|
considered a literary or artistic work.
|
||||||
|
g. "You" means an individual or entity exercising rights under this
|
||||||
|
License who has not previously violated the terms of this License with
|
||||||
|
respect to the Work, or who has received express permission from the
|
||||||
|
Licensor to exercise rights under this License despite a previous
|
||||||
|
violation.
|
||||||
|
h. "Publicly Perform" means to perform public recitations of the Work and
|
||||||
|
to communicate to the public those public recitations, by any means or
|
||||||
|
process, including by wire or wireless means or public digital
|
||||||
|
performances; to make available to the public Works in such a way that
|
||||||
|
members of the public may access these Works from a place and at a
|
||||||
|
place individually chosen by them; to perform the Work to the public
|
||||||
|
by any means or process and the communication to the public of the
|
||||||
|
performances of the Work, including by public digital performance; to
|
||||||
|
broadcast and rebroadcast the Work by any means including signs,
|
||||||
|
sounds or images.
|
||||||
|
i. "Reproduce" means to make copies of the Work by any means including
|
||||||
|
without limitation by sound or visual recordings and the right of
|
||||||
|
fixation and reproducing fixations of the Work, including storage of a
|
||||||
|
protected performance or phonogram in digital form or other electronic
|
||||||
|
medium.
|
||||||
|
|
||||||
|
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
|
||||||
|
limit, or restrict any uses free from copyright or rights arising from
|
||||||
|
limitations or exceptions that are provided for in connection with the
|
||||||
|
copyright protection under copyright law or other applicable laws.
|
||||||
|
|
||||||
|
3. License Grant. Subject to the terms and conditions of this License,
|
||||||
|
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||||
|
perpetual (for the duration of the applicable copyright) license to
|
||||||
|
exercise the rights in the Work as stated below:
|
||||||
|
|
||||||
|
a. to Reproduce the Work, to incorporate the Work into one or more
|
||||||
|
Collections, and to Reproduce the Work as incorporated in the
|
||||||
|
Collections;
|
||||||
|
b. to create and Reproduce Adaptations provided that any such Adaptation,
|
||||||
|
including any translation in any medium, takes reasonable steps to
|
||||||
|
clearly label, demarcate or otherwise identify that changes were made
|
||||||
|
to the original Work. For example, a translation could be marked "The
|
||||||
|
original work was translated from English to Spanish," or a
|
||||||
|
modification could indicate "The original work has been modified.";
|
||||||
|
c. to Distribute and Publicly Perform the Work including as incorporated
|
||||||
|
in Collections; and,
|
||||||
|
d. to Distribute and Publicly Perform Adaptations.
|
||||||
|
|
||||||
|
The above rights may be exercised in all media and formats whether now
|
||||||
|
known or hereafter devised. The above rights include the right to make
|
||||||
|
such modifications as are technically necessary to exercise the rights in
|
||||||
|
other media and formats. Subject to Section 8(f), all rights not expressly
|
||||||
|
granted by Licensor are hereby reserved, including but not limited to the
|
||||||
|
rights set forth in Section 4(d).
|
||||||
|
|
||||||
|
4. Restrictions. The license granted in Section 3 above is expressly made
|
||||||
|
subject to and limited by the following restrictions:
|
||||||
|
|
||||||
|
a. You may Distribute or Publicly Perform the Work only under the terms
|
||||||
|
of this License. You must include a copy of, or the Uniform Resource
|
||||||
|
Identifier (URI) for, this License with every copy of the Work You
|
||||||
|
Distribute or Publicly Perform. You may not offer or impose any terms
|
||||||
|
on the Work that restrict the terms of this License or the ability of
|
||||||
|
the recipient of the Work to exercise the rights granted to that
|
||||||
|
recipient under the terms of the License. You may not sublicense the
|
||||||
|
Work. You must keep intact all notices that refer to this License and
|
||||||
|
to the disclaimer of warranties with every copy of the Work You
|
||||||
|
Distribute or Publicly Perform. When You Distribute or Publicly
|
||||||
|
Perform the Work, You may not impose any effective technological
|
||||||
|
measures on the Work that restrict the ability of a recipient of the
|
||||||
|
Work from You to exercise the rights granted to that recipient under
|
||||||
|
the terms of the License. This Section 4(a) applies to the Work as
|
||||||
|
incorporated in a Collection, but this does not require the Collection
|
||||||
|
apart from the Work itself to be made subject to the terms of this
|
||||||
|
License. If You create a Collection, upon notice from any Licensor You
|
||||||
|
must, to the extent practicable, remove from the Collection any credit
|
||||||
|
as required by Section 4(c), as requested. If You create an
|
||||||
|
Adaptation, upon notice from any Licensor You must, to the extent
|
||||||
|
practicable, remove from the Adaptation any credit as required by
|
||||||
|
Section 4(c), as requested.
|
||||||
|
b. You may not exercise any of the rights granted to You in Section 3
|
||||||
|
above in any manner that is primarily intended for or directed toward
|
||||||
|
commercial advantage or private monetary compensation. The exchange of
|
||||||
|
the Work for other copyrighted works by means of digital file-sharing
|
||||||
|
or otherwise shall not be considered to be intended for or directed
|
||||||
|
toward commercial advantage or private monetary compensation, provided
|
||||||
|
there is no payment of any monetary compensation in connection with
|
||||||
|
the exchange of copyrighted works.
|
||||||
|
c. If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||||
|
Collections, You must, unless a request has been made pursuant to
|
||||||
|
Section 4(a), keep intact all copyright notices for the Work and
|
||||||
|
provide, reasonable to the medium or means You are utilizing: (i) the
|
||||||
|
name of the Original Author (or pseudonym, if applicable) if supplied,
|
||||||
|
and/or if the Original Author and/or Licensor designate another party
|
||||||
|
or parties (e.g., a sponsor institute, publishing entity, journal) for
|
||||||
|
attribution ("Attribution Parties") in Licensor's copyright notice,
|
||||||
|
terms of service or by other reasonable means, the name of such party
|
||||||
|
or parties; (ii) the title of the Work if supplied; (iii) to the
|
||||||
|
extent reasonably practicable, the URI, if any, that Licensor
|
||||||
|
specifies to be associated with the Work, unless such URI does not
|
||||||
|
refer to the copyright notice or licensing information for the Work;
|
||||||
|
and, (iv) consistent with Section 3(b), in the case of an Adaptation,
|
||||||
|
a credit identifying the use of the Work in the Adaptation (e.g.,
|
||||||
|
"French translation of the Work by Original Author," or "Screenplay
|
||||||
|
based on original Work by Original Author"). The credit required by
|
||||||
|
this Section 4(c) may be implemented in any reasonable manner;
|
||||||
|
provided, however, that in the case of a Adaptation or Collection, at
|
||||||
|
a minimum such credit will appear, if a credit for all contributing
|
||||||
|
authors of the Adaptation or Collection appears, then as part of these
|
||||||
|
credits and in a manner at least as prominent as the credits for the
|
||||||
|
other contributing authors. For the avoidance of doubt, You may only
|
||||||
|
use the credit required by this Section for the purpose of attribution
|
||||||
|
in the manner set out above and, by exercising Your rights under this
|
||||||
|
License, You may not implicitly or explicitly assert or imply any
|
||||||
|
connection with, sponsorship or endorsement by the Original Author,
|
||||||
|
Licensor and/or Attribution Parties, as appropriate, of You or Your
|
||||||
|
use of the Work, without the separate, express prior written
|
||||||
|
permission of the Original Author, Licensor and/or Attribution
|
||||||
|
Parties.
|
||||||
|
d. For the avoidance of doubt:
|
||||||
|
|
||||||
|
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
|
||||||
|
which the right to collect royalties through any statutory or
|
||||||
|
compulsory licensing scheme cannot be waived, the Licensor
|
||||||
|
reserves the exclusive right to collect such royalties for any
|
||||||
|
exercise by You of the rights granted under this License;
|
||||||
|
ii. Waivable Compulsory License Schemes. In those jurisdictions in
|
||||||
|
which the right to collect royalties through any statutory or
|
||||||
|
compulsory licensing scheme can be waived, the Licensor reserves
|
||||||
|
the exclusive right to collect such royalties for any exercise by
|
||||||
|
You of the rights granted under this License if Your exercise of
|
||||||
|
such rights is for a purpose or use which is otherwise than
|
||||||
|
noncommercial as permitted under Section 4(b) and otherwise waives
|
||||||
|
the right to collect royalties through any statutory or compulsory
|
||||||
|
licensing scheme; and,
|
||||||
|
iii. Voluntary License Schemes. The Licensor reserves the right to
|
||||||
|
collect royalties, whether individually or, in the event that the
|
||||||
|
Licensor is a member of a collecting society that administers
|
||||||
|
voluntary licensing schemes, via that society, from any exercise
|
||||||
|
by You of the rights granted under this License that is for a
|
||||||
|
purpose or use which is otherwise than noncommercial as permitted
|
||||||
|
under Section 4(c).
|
||||||
|
e. Except as otherwise agreed in writing by the Licensor or as may be
|
||||||
|
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||||
|
Publicly Perform the Work either by itself or as part of any
|
||||||
|
Adaptations or Collections, You must not distort, mutilate, modify or
|
||||||
|
take other derogatory action in relation to the Work which would be
|
||||||
|
prejudicial to the Original Author's honor or reputation. Licensor
|
||||||
|
agrees that in those jurisdictions (e.g. Japan), in which any exercise
|
||||||
|
of the right granted in Section 3(b) of this License (the right to
|
||||||
|
make Adaptations) would be deemed to be a distortion, mutilation,
|
||||||
|
modification or other derogatory action prejudicial to the Original
|
||||||
|
Author's honor and reputation, the Licensor will waive or not assert,
|
||||||
|
as appropriate, this Section, to the fullest extent permitted by the
|
||||||
|
applicable national law, to enable You to reasonably exercise Your
|
||||||
|
right under Section 3(b) of this License (right to make Adaptations)
|
||||||
|
but not otherwise.
|
||||||
|
|
||||||
|
5. Representations, Warranties and Disclaimer
|
||||||
|
|
||||||
|
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||||
|
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||||
|
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||||
|
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||||
|
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||||
|
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
|
||||||
|
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
|
||||||
|
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
|
||||||
|
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
||||||
|
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
7. Termination
|
||||||
|
|
||||||
|
a. This License and the rights granted hereunder will terminate
|
||||||
|
automatically upon any breach by You of the terms of this License.
|
||||||
|
Individuals or entities who have received Adaptations or Collections
|
||||||
|
from You under this License, however, will not have their licenses
|
||||||
|
terminated provided such individuals or entities remain in full
|
||||||
|
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
|
||||||
|
survive any termination of this License.
|
||||||
|
b. Subject to the above terms and conditions, the license granted here is
|
||||||
|
perpetual (for the duration of the applicable copyright in the Work).
|
||||||
|
Notwithstanding the above, Licensor reserves the right to release the
|
||||||
|
Work under different license terms or to stop distributing the Work at
|
||||||
|
any time; provided, however that any such election will not serve to
|
||||||
|
withdraw this License (or any other license that has been, or is
|
||||||
|
required to be, granted under the terms of this License), and this
|
||||||
|
License will continue in full force and effect unless terminated as
|
||||||
|
stated above.
|
||||||
|
|
||||||
|
8. Miscellaneous
|
||||||
|
|
||||||
|
a. Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||||
|
the Licensor offers to the recipient a license to the Work on the same
|
||||||
|
terms and conditions as the license granted to You under this License.
|
||||||
|
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||||
|
offers to the recipient a license to the original Work on the same
|
||||||
|
terms and conditions as the license granted to You under this License.
|
||||||
|
c. If any provision of this License is invalid or unenforceable under
|
||||||
|
applicable law, it shall not affect the validity or enforceability of
|
||||||
|
the remainder of the terms of this License, and without further action
|
||||||
|
by the parties to this agreement, such provision shall be reformed to
|
||||||
|
the minimum extent necessary to make such provision valid and
|
||||||
|
enforceable.
|
||||||
|
d. No term or provision of this License shall be deemed waived and no
|
||||||
|
breach consented to unless such waiver or consent shall be in writing
|
||||||
|
and signed by the party to be charged with such waiver or consent.
|
||||||
|
e. This License constitutes the entire agreement between the parties with
|
||||||
|
respect to the Work licensed here. There are no understandings,
|
||||||
|
agreements or representations with respect to the Work not specified
|
||||||
|
here. Licensor shall not be bound by any additional provisions that
|
||||||
|
may appear in any communication from You. This License may not be
|
||||||
|
modified without the mutual written agreement of the Licensor and You.
|
||||||
|
f. The rights granted under, and the subject matter referenced, in this
|
||||||
|
License were drafted utilizing the terminology of the Berne Convention
|
||||||
|
for the Protection of Literary and Artistic Works (as amended on
|
||||||
|
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||||
|
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
|
||||||
|
and the Universal Copyright Convention (as revised on July 24, 1971).
|
||||||
|
These rights and subject matter take effect in the relevant
|
||||||
|
jurisdiction in which the License terms are sought to be enforced
|
||||||
|
according to the corresponding provisions of the implementation of
|
||||||
|
those treaty provisions in the applicable national law. If the
|
||||||
|
standard suite of rights granted under applicable copyright law
|
||||||
|
includes additional rights not granted under this License, such
|
||||||
|
additional rights are deemed to be included in the License; this
|
||||||
|
License is not intended to restrict the license of any rights under
|
||||||
|
applicable law.
|
||||||
|
|
||||||
|
|
||||||
|
Creative Commons Notice
|
||||||
|
|
||||||
|
Creative Commons is not a party to this License, and makes no warranty
|
||||||
|
whatsoever in connection with the Work. Creative Commons will not be
|
||||||
|
liable to You or any party on any legal theory for any damages
|
||||||
|
whatsoever, including without limitation any general, special,
|
||||||
|
incidental or consequential damages arising in connection to this
|
||||||
|
license. Notwithstanding the foregoing two (2) sentences, if Creative
|
||||||
|
Commons has expressly identified itself as the Licensor hereunder, it
|
||||||
|
shall have all rights and obligations of Licensor.
|
||||||
|
|
||||||
|
Except for the limited purpose of indicating to the public that the
|
||||||
|
Work is licensed under the CCPL, Creative Commons does not authorize
|
||||||
|
the use by either party of the trademark "Creative Commons" or any
|
||||||
|
related trademark or logo of Creative Commons without the prior
|
||||||
|
written consent of Creative Commons. Any permitted use will be in
|
||||||
|
compliance with Creative Commons' then-current trademark usage
|
||||||
|
guidelines, as may be published on its website or otherwise made
|
||||||
|
available upon request from time to time. For the avoidance of doubt,
|
||||||
|
this trademark restriction does not form part of the License.
|
||||||
|
|
||||||
|
Creative Commons may be contacted at https://creativecommons.org/.
|
||||||
|
226
README.md
@@ -6,17 +6,15 @@ about
|
|||||||
raylib is a simple and easy-to-use library to learn videogames programming.
|
raylib is a simple and easy-to-use library to learn videogames programming.
|
||||||
|
|
||||||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
|
raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
|
||||||
Allegro and SDL have also been analyzed for reference.
|
|
||||||
|
|
||||||
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm)
|
NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming;
|
||||||
|
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
|
||||||
Since version 1.2.2 raylib can compile directly for web (html5) using emscripten and asm.js,
|
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.htm)
|
||||||
to see a demo of raylib features working on web, [check here!] (http://www.raylib.com/raylib_demo.html)
|
|
||||||
|
|
||||||
history
|
history
|
||||||
-------
|
-------
|
||||||
|
|
||||||
I've developed videogames for some years and last year I had to taught videogames development
|
I've developed videogames for some years and 4 years ago I started teaching videogames development
|
||||||
to young people with artistic profile, most of them had never written a single line of code.
|
to young people with artistic profile, most of them had never written a single line of code.
|
||||||
|
|
||||||
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
||||||
@@ -35,7 +33,7 @@ I've coded quite a lot in C# and XNA and I really love it (in fact, my students
|
|||||||
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
||||||
raylib to XNA, MonoGame or similar libs extremely easily.
|
raylib to XNA, MonoGame or similar libs extremely easily.
|
||||||
|
|
||||||
raylib started as a weekend project and after three months of hard work, first version was published.
|
raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
|
||||||
|
|
||||||
Enjoy it.
|
Enjoy it.
|
||||||
|
|
||||||
@@ -45,10 +43,10 @@ notes on raylib 1.1
|
|||||||
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
||||||
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||||
|
|
||||||
A new module named [rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translate raylib-OpenGL-style
|
A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translate raylib-OpenGL-style
|
||||||
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||||
|
|
||||||
[rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath] (https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
||||||
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||||
|
|
||||||
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
||||||
@@ -60,7 +58,7 @@ notes on raylib 1.2
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
|
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
|
||||||
complete internal redesign of [core] (https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android] (http://www.android.com/) and [Raspberry Pi] (http://www.raspberrypi.org/).
|
complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||||
|
|
||||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
|
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
|
||||||
On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
|
On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
|
||||||
@@ -73,33 +71,82 @@ Now raylib can easily deploy games to Android devices and Raspberry Pi (console
|
|||||||
|
|
||||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
||||||
|
|
||||||
|
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
|
||||||
|
|
||||||
|
notes on raylib 1.3
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
|
||||||
|
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
|
||||||
|
|
||||||
|
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
|
||||||
|
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
|
||||||
|
in this release, check raylib/shaders folder.
|
||||||
|
|
||||||
|
Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.),
|
||||||
|
including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
||||||
|
|
||||||
|
A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
|
||||||
|
Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
|
||||||
|
|
||||||
|
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||||
|
|
||||||
|
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
|
||||||
|
primary intended for tools development. It's still in experimental state but already fully functional.
|
||||||
|
|
||||||
|
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||||
|
|
||||||
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
|
||||||
|
|
||||||
|
notes on raylib 1.4
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||||
|
|
||||||
|
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. Now a basic image processing can be done before converting the image to texture for usage.
|
||||||
|
|
||||||
|
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||||
|
|
||||||
|
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||||
|
|
||||||
|
[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
||||||
|
|
||||||
|
[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||||
|
|
||||||
|
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
||||||
|
|
||||||
|
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions, and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported). A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
|
||||||
|
|
||||||
|
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
|
||||||
|
|
||||||
|
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
|
||||||
|
|
||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Written in plain C code (C99)
|
* Written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses C# PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2)
|
* Hardware accelerated with OpenGL (1.1, 3.3 or ES2)
|
||||||
* Unique OpenGL abstraction layer [rlgl]
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
||||||
* Powerful fonts module with SpriteFonts support
|
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
* Multiple textures support, including DDS, PKM and mipmaps generation
|
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
|
||||||
* Basic 3d support for Shapes, Models, Heightmaps and Billboards
|
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||||
* Powerful math module for Vector and Matrix operations [raymath]
|
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||||
* Audio loading and playing with streaming support (WAV and OGG)
|
* Audio loading and playing with streaming support (WAV and OGG)
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
|
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
|
||||||
|
|
||||||
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for
|
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
|
||||||
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
|
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
|
||||||
|
|
||||||
raylib uses on its [audio] (https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft] (http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
|
raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
|
||||||
to accomodate to Android and Raspberry Pi.
|
to accomodate to Android, Raspberry Pi and HTML5.
|
||||||
|
|
||||||
On Android, raylib uses native_app_glue module (provided on Android NDK) and native Android libraries to manage window/context,
|
On Android, raylib uses `native_app_glue module` (provided on Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
|
||||||
inputs and activity cycle.
|
|
||||||
|
|
||||||
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
||||||
|
|
||||||
raylib is licensed under a zlib/libpng license. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
||||||
|
|
||||||
tools requirements
|
tools requirements
|
||||||
------------------
|
------------------
|
||||||
@@ -115,121 +162,17 @@ I believe those are the best tools to train spartan-programmers.
|
|||||||
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
|
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
|
||||||
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
|
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
|
||||||
|
|
||||||
Since raylib v1.1, you can download a windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
|
Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
|
||||||
|
|
||||||
building source (generate libraylib.a)
|
building source (generate libraylib.a)
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
**Building raylib sources on desktop platforms:**
|
Check raylib wiki page: [Building source](https://github.com/raysan5/raylib/wiki/Building-source)
|
||||||
|
|
||||||
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/src/ folder and type:
|
|
||||||
|
|
||||||
mingw32-make PLATFORM=PLATFORM_DESKTOP
|
|
||||||
|
|
||||||
NOTE: By default raylib compiles using OpenGL 1.1 to maximize compatibility; to use OpenGL 3.3 just type:
|
|
||||||
|
|
||||||
mingw32-make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_33
|
|
||||||
|
|
||||||
**Building raylib sources on Raspberry Pi:**
|
|
||||||
|
|
||||||
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
|
|
||||||
|
|
||||||
sudo apt-get install openal1
|
|
||||||
|
|
||||||
_Step 2._ Navigate from command line to raylib/src/ folder and type:
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
**Building raylib sources for Android:**
|
|
||||||
|
|
||||||
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
|
|
||||||
|
|
||||||
> Download and decompress on C: [Android SDK r23](http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
|
|
||||||
|
|
||||||
> Download and decompress on C: [Android NDK r10b](http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
|
|
||||||
|
|
||||||
> Download and decompress on C: [Apache Ant 1.9.4](http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
|
|
||||||
|
|
||||||
_Step 2._ Create the following environment variables with the correct paths:
|
|
||||||
|
|
||||||
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
|
|
||||||
ANDROID_NDK_ROOT = C:\android-ndk-r10b
|
|
||||||
ANT_HOME = C:\apache-ant-1.9.4
|
|
||||||
|
|
||||||
_Step 3._ Navigate from command line to folder raylib/template_android/ and type:
|
|
||||||
|
|
||||||
%ANDROID_NDK_ROOT%\ndk-build
|
|
||||||
|
|
||||||
NOTE: libraylib.a will be generated in folder raylib/src_android/obj/local/armeabi/, it must be copied
|
|
||||||
to Android project; if using raylib/template_android project, copy it to raylib/template_android/jni/libs/.
|
|
||||||
|
|
||||||
**Building raylib sources for Web (HTML5)**
|
|
||||||
|
|
||||||
_Step 1._ Make sure you have installed emscripten SDK:
|
|
||||||
|
|
||||||
> Download latest version from [here].(http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) I recommend following the portable version installation instructions.
|
|
||||||
|
|
||||||
_Step 2._ TODO
|
|
||||||
|
|
||||||
building examples
|
building examples
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
**Building raylib examples on desktop platforms:**
|
Check raylib wiki page: [Building examples](https://github.com/raysan5/raylib/wiki/Building-examples)
|
||||||
|
|
||||||
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/examples/ folder and type:
|
|
||||||
|
|
||||||
mingw32-make PLATFORM=PLATFORM_DESKTOP
|
|
||||||
|
|
||||||
NOTE: Make sure the following libs (and their headers) are placed on their respectibe MinGW folders:
|
|
||||||
|
|
||||||
libglfw3.a - GLFW3 (static version)
|
|
||||||
libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2
|
|
||||||
libopenal32.a - OpenAL Soft, audio device management
|
|
||||||
|
|
||||||
**Building raylib examples on Raspberry Pi:**
|
|
||||||
|
|
||||||
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
|
|
||||||
|
|
||||||
sudo apt-get install openal1
|
|
||||||
|
|
||||||
_Step 2._ Navigate from command line to raylib/examples/ folder and type:
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
**Building raylib project for Android (using template):**
|
|
||||||
|
|
||||||
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
|
|
||||||
|
|
||||||
> Download and decompress on C: [Android SDK r23] (http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
|
|
||||||
|
|
||||||
> Download and decompress on C: [Android NDK r10b] (http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
|
|
||||||
|
|
||||||
> Download and decompress on C: [Apache Ant 1.9.4] (http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
|
|
||||||
|
|
||||||
_Step 2._ Create the following environment variables with the correct paths:
|
|
||||||
|
|
||||||
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
|
|
||||||
ANDROID_NDK_ROOT = C:\android-ndk-r10b
|
|
||||||
ANT_HOME = C:\apache-ant-1.9.4
|
|
||||||
|
|
||||||
_Step 3._ To compile project, navigate from command line to folder raylib/template_android/ and type:
|
|
||||||
|
|
||||||
%ANDROID_NDK_ROOT%\ndk-build
|
|
||||||
|
|
||||||
_Step 4._ To generate APK, navigate to folder raylib/template_android/ and type:
|
|
||||||
|
|
||||||
%ANT_HOME%\bin\ant debug
|
|
||||||
|
|
||||||
_Step 5:_ To install APK into connected device (previously intalled drivers and activated USB debug mode on device):
|
|
||||||
|
|
||||||
%ANT_HOME%\bin\ant installd
|
|
||||||
|
|
||||||
_Step 6:_ To view log output from device:
|
|
||||||
|
|
||||||
%ANDROID_SDK_TOOLS%\adb logcat -c
|
|
||||||
%ANDROID_SDK_TOOLS%\adb -d logcat raylib:V *:S
|
|
||||||
|
|
||||||
**If you have any doubt, [just let me know][raysan5].**
|
|
||||||
|
|
||||||
contact
|
contact
|
||||||
-------
|
-------
|
||||||
@@ -237,19 +180,32 @@ contact
|
|||||||
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
* Webpage: [http://www.raylib.com](http://www.raylib.com)
|
||||||
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
|
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
||||||
|
|
||||||
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
||||||
|
|
||||||
If you feel you can help, then, [helpme!] (http://www.raylib.com/helpme.htm)
|
If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
|
||||||
|
|
||||||
acknowledgments
|
acknowledgements
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
||||||
|
|
||||||
- [Zopokx](https://github.com/Zopokx) for testing and hosting the web.
|
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
||||||
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
||||||
- Victor Dual for implementation and testing of 3D shapes functions.
|
- Victor Dual for implementating and testing of 3D shapes functions.
|
||||||
- Marc Palau for implementation and testing of 3D shapes functions.
|
- Marc Palau for implementating and testing of 3D shapes functions and helping on development of camera and getures modules.
|
||||||
|
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
||||||
|
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
||||||
|
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
|
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
|
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
|
- Sergio Martinez for helping on raygui development and tools development.
|
||||||
|
- Victor Fisac for developing physics raylib module (physac) and implementing light shaders and raycast system... and multiple tools and games.
|
||||||
|
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||||
|
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||||
|
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
43
ROADMAP.md
@@ -1,24 +1,37 @@
|
|||||||
roadmap
|
roadmap
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Current version of raylib is quite complete and functional but there is still a lot of things I would like to improve.
|
Current version of raylib is quite complete and functional but there is still a lot of things to add and improve.
|
||||||
Here it is a list of features I would like to add and functions to improve.
|
Here it is a wish list of features I would like to add and functions to improve.
|
||||||
|
|
||||||
Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add.
|
Note that around the raylib source code there are multiple TODO points with pending revisions/bugs. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||||
|
|
||||||
This roadmap is quite outdated... a full list of all the features we are working on should be listed here at some point...
|
raylib 1.5
|
||||||
|
|
||||||
raylib v1.x
|
Redesign Shaders/Textures system, use Materials
|
||||||
|
Redesign physics module (physac)
|
||||||
|
Basic GPU stats sytem (memory, draws, time...)
|
||||||
|
Procedural image generation functions (spot, gradient, noise...)
|
||||||
|
Procedural mesh generation functions (cube, cone, sphere...)
|
||||||
|
Touch-based camera controls for Android
|
||||||
|
Skybox and Fog support
|
||||||
|
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
|
||||||
|
|
||||||
|
raylib 1.4
|
||||||
|
|
||||||
|
[DONE] TTF fonts support (using stb_truetype)
|
||||||
|
[DONE] Raycast system for 3D picking (including collisions detection)
|
||||||
|
[DONE] Floyd-Steinberg dithering on 16bit image format conversion
|
||||||
|
[DONE] Basic image manipulation functions (crop, resize, draw...)
|
||||||
|
[DONE] Storage load/save data functionality
|
||||||
|
[DONE] Add Physics module (physac)
|
||||||
|
[DONE] Remove GLEW dependency -> Replaced by GLAD
|
||||||
|
[DONE] Redesign Raspberry PI inputs system
|
||||||
|
[DONE] Redesign gestures module to be multiplatform
|
||||||
|
[DONE] Module raymath as header-only and functions inline
|
||||||
|
[DONE] Add Easings module (easings.h)
|
||||||
|
|
||||||
- [DONE] Review Billboard Drawing functions
|
|
||||||
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
|
|
||||||
- Lighting support (only 3d mode)
|
|
||||||
- [DONE] Simple Collision Detection functions
|
|
||||||
- [IN PROGRESS] Default scene Camera controls (zoom, pan, rotate)
|
|
||||||
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
|
|
||||||
- [DONE] Software mipmapping generation and POT conversion (custom implementation)
|
|
||||||
- [IN PROGRESS] TTF fonts support
|
|
||||||
|
|
||||||
Any feature missing? Do you have a request? [Let me know!][raysan5]
|
Any feature missing? Do you have a request? [Let me know!][raysan5]
|
||||||
|
|
||||||
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
[isssues]: https://github.com/raysan5/raylib/issues
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
*
|
*
|
||||||
* NOTE: This example requires OpenAL Soft library installed
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ int main()
|
|||||||
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
|
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
|
||||||
|
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
float timePlayed = 0;
|
float timePlayed = 0.0f;
|
||||||
//float volume = 1.0;
|
//float volume = 1.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
|
||||||
@@ -58,7 +58,12 @@ int main()
|
|||||||
SetMusicVolume(volume);
|
SetMusicVolume(volume);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4; // We scale by 4 to fit 400 pixels
|
if (IsWindowMinimized()) PauseMusicStream();
|
||||||
|
else ResumeMusicStream();
|
||||||
|
|
||||||
|
timePlayed = GetMusicTimePlayed()/GetMusicTimeLength()*100*4; // We scale by 4 to fit 400 pixels
|
||||||
|
|
||||||
|
UpdateMusicStream(); // Update music buffer with new stream data
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -26,6 +26,8 @@ int main()
|
|||||||
|
|
||||||
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
||||||
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
|
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
91
examples/core_3d_camera_first_person.c
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - 3d camera first person
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_COLUMNS 20
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world (position, target, up vector)
|
||||||
|
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
|
// Generates some random columns
|
||||||
|
float heights[MAX_COLUMNS];
|
||||||
|
Vector3 positions[MAX_COLUMNS];
|
||||||
|
Color colors[MAX_COLUMNS];
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
{
|
||||||
|
heights[i] = (float)GetRandomValue(1, 12);
|
||||||
|
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
|
||||||
|
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 playerPosition = { 4.0f, 2.0f, 4.0f }; // Define player position
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FIRST_PERSON); // Set a first person camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCameraPlayer(&camera, &playerPosition); // Update camera and player position
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
||||||
|
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
||||||
|
DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME); // Draw a green wall
|
||||||
|
DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD); // Draw a yellow wall
|
||||||
|
|
||||||
|
// Draw some cubes around
|
||||||
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
{
|
||||||
|
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
|
||||||
|
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("First person camera default controls:", 20, 20, 10, GRAY);
|
||||||
|
DrawText("- Move with keys: W, A, S, D", 40, 50, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse move to look around", 40, 70, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_3d_camera_first_person.png
Normal file
After Width: | Height: | Size: 18 KiB |
78
examples/core_3d_camera_free.c
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Initialize 3d camera free
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
|
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FREE); // Set a free camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Free camera default controls:", 20, 20, 10, GRAY);
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 50, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 70, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 90, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 110, 10, DARKGRAY);
|
||||||
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 130, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_3d_camera_free.png
Normal file
After Width: | Height: | Size: 25 KiB |
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -21,11 +21,14 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera;
|
||||||
|
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0, 0.0, 0.0 };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now...
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@@ -40,14 +43,14 @@ int main()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(WHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2, 2, 2, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
94
examples/core_3d_picking.c
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Picking in 3d mode
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera;
|
||||||
|
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
|
||||||
|
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
|
||||||
|
|
||||||
|
Ray ray; // Picking line ray
|
||||||
|
|
||||||
|
bool collision = false;
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FREE); // Set a free camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
// NOTE: This function is NOT WORKING properly!
|
||||||
|
ray = GetMouseRay(GetMousePosition(), camera);
|
||||||
|
|
||||||
|
// Check collision between ray and box
|
||||||
|
collision = CheckCollisionRayBox(ray,
|
||||||
|
(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
|
||||||
|
(Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 });
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
|
||||||
|
|
||||||
|
DrawRay(ray, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY);
|
||||||
|
|
||||||
|
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_3d_picking.png
Normal file
After Width: | Height: | Size: 24 KiB |
@@ -15,7 +15,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -29,6 +29,8 @@ int main()
|
|||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@@ -52,7 +54,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
85
examples/core_basic_window_web.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||||
|
*
|
||||||
|
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
||||||
|
* As you will notice, code structure is slightly diferent to the other examples...
|
||||||
|
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//#define PLATFORM_WEB
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
#include <emscripten/emscripten.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void UpdateDrawFrame(void); // Update and Draw one frame
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Main Enry Point
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||||
|
#else
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
UpdateDrawFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void UpdateDrawFrame(void)
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
76
examples/core_drop_files.c
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Windows drop files
|
||||||
|
*
|
||||||
|
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
char **droppedFiles;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsFileDropped())
|
||||||
|
{
|
||||||
|
droppedFiles = GetDroppedFiles(&count);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
|
||||||
|
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
|
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
ClearDroppedFiles(); // Clear internal buffers
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_drop_files.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
115
examples/core_gestures_detection.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Gestures Detection
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define MAX_GESTURE_STRINGS 20
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection");
|
||||||
|
|
||||||
|
Vector2 touchPosition = { 0, 0 };
|
||||||
|
Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 };
|
||||||
|
|
||||||
|
int gesturesCount = 0;
|
||||||
|
char gestureStrings[MAX_GESTURE_STRINGS][32];
|
||||||
|
|
||||||
|
int currentGesture = GESTURE_NONE;
|
||||||
|
int lastGesture = GESTURE_NONE;
|
||||||
|
|
||||||
|
//SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected
|
||||||
|
|
||||||
|
SetTargetFPS(30);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
lastGesture = currentGesture;
|
||||||
|
touchPosition = GetTouchPosition(0);
|
||||||
|
|
||||||
|
if (CheckCollisionPointRec(touchPosition, touchArea) && IsGestureDetected())
|
||||||
|
{
|
||||||
|
currentGesture = GetGestureType();
|
||||||
|
|
||||||
|
if (currentGesture != lastGesture)
|
||||||
|
{
|
||||||
|
// Store gesture string
|
||||||
|
switch (currentGesture)
|
||||||
|
{
|
||||||
|
case GESTURE_TAP: strcpy(gestureStrings[gesturesCount], "GESTURE TAP"); break;
|
||||||
|
case GESTURE_DOUBLETAP: strcpy(gestureStrings[gesturesCount], "GESTURE DOUBLETAP"); break;
|
||||||
|
case GESTURE_HOLD: strcpy(gestureStrings[gesturesCount], "GESTURE HOLD"); break;
|
||||||
|
case GESTURE_DRAG: strcpy(gestureStrings[gesturesCount], "GESTURE DRAG"); break;
|
||||||
|
case GESTURE_SWIPE_RIGHT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE RIGHT"); break;
|
||||||
|
case GESTURE_SWIPE_LEFT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE LEFT"); break;
|
||||||
|
case GESTURE_SWIPE_UP: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE UP"); break;
|
||||||
|
case GESTURE_SWIPE_DOWN: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE DOWN"); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gesturesCount++;
|
||||||
|
|
||||||
|
// Reset gestures strings
|
||||||
|
if (gesturesCount >= MAX_GESTURE_STRINGS)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_GESTURE_STRINGS; i++) strcpy(gestureStrings[i], "\0");
|
||||||
|
|
||||||
|
gesturesCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else currentGesture = GESTURE_NONE;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawRectangleRec(touchArea, GRAY);
|
||||||
|
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f));
|
||||||
|
|
||||||
|
for (int i = 0; i < gesturesCount; i++)
|
||||||
|
{
|
||||||
|
if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f));
|
||||||
|
else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
|
if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY);
|
||||||
|
else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY);
|
||||||
|
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY);
|
||||||
|
|
||||||
|
if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
}
|
BIN
examples/core_gestures_detection.png
Normal file
After Width: | Height: | Size: 19 KiB |
@@ -8,7 +8,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ int main()
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||||
|
|
||||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
|
||||||
Vector2 gamepadMovement = { 0, 0 };
|
Vector2 gamepadMovement = { 0.0f, 0.0f };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set target frames-per-second
|
SetTargetFPS(60); // Set target frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -43,8 +43,8 @@ int main()
|
|||||||
|
|
||||||
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
|
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
|
||||||
{
|
{
|
||||||
ballPosition.x = screenWidth/2;
|
ballPosition.x = (float)screenWidth/2;
|
||||||
ballPosition.y = screenHeight/2;
|
ballPosition.y = (float)screenHeight/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ int main()
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
|
||||||
|
|
||||||
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
|
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
|
||||||
|
|
||||||
SetTargetFPS(60); // Set target frames-per-second
|
SetTargetFPS(60); // Set target frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -30,10 +30,10 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8;
|
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f;
|
||||||
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8;
|
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f;
|
||||||
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8;
|
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f;
|
||||||
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8;
|
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -20,8 +20,10 @@ int main()
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
||||||
|
|
||||||
int mouseX, mouseY;
|
Vector2 ballPosition = { -100.0f, -100.0f };
|
||||||
Vector2 ballPosition = { -100.0, -100.0 };
|
Color ballColor = DARKBLUE;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@@ -29,14 +31,11 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
ballPosition = GetMousePosition();
|
||||||
{
|
|
||||||
mouseX = GetMouseX();
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
|
||||||
mouseY = GetMouseY();
|
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
|
||||||
|
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
|
||||||
ballPosition.x = (float)mouseX;
|
|
||||||
ballPosition.y = (float)mouseY;
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -45,9 +44,9 @@ int main()
|
|||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 40, GOLD);
|
DrawCircleV(ballPosition, 40, ballColor);
|
||||||
|
|
||||||
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
* This test has been created using raylib 1.1 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.1 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ int main()
|
|||||||
|
|
||||||
int framesCounter = 0; // Variable used to count frames
|
int framesCounter = 0; // Variable used to count frames
|
||||||
|
|
||||||
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included)
|
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -37,7 +37,7 @@ int main()
|
|||||||
// Every two seconds (120 frames) a new random value is generated
|
// Every two seconds (120 frames) a new random value is generated
|
||||||
if (((framesCounter/120)%2) == 1)
|
if (((framesCounter/120)%2) == 1)
|
||||||
{
|
{
|
||||||
randValue = GetRandomValue(-8,5);
|
randValue = GetRandomValue(-8, 5);
|
||||||
framesCounter = 0;
|
framesCounter = 0;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
85
examples/core_storage_values.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Storage save/load values
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// NOTE: Storage positions must start with 0, directly related to file memory layout
|
||||||
|
typedef enum { STORAGE_SCORE = 0, STORAGE_HISCORE } StorageData;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values");
|
||||||
|
|
||||||
|
int score = 0;
|
||||||
|
int hiscore = 0;
|
||||||
|
|
||||||
|
int framesCounter = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
score = GetRandomValue(1000, 2000);
|
||||||
|
hiscore = GetRandomValue(2000, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER))
|
||||||
|
{
|
||||||
|
StorageSaveValue(STORAGE_SCORE, score);
|
||||||
|
StorageSaveValue(STORAGE_HISCORE, hiscore);
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
// NOTE: If requested position could not be found, value 0 is returned
|
||||||
|
score = StorageLoadValue(STORAGE_SCORE);
|
||||||
|
hiscore = StorageLoadValue(STORAGE_HISCORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
framesCounter++;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
|
||||||
|
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
|
||||||
|
|
||||||
|
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
|
||||||
|
|
||||||
|
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
|
||||||
|
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
|
||||||
|
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_storage_values.png
Normal file
After Width: | Height: | Size: 16 KiB |
77
examples/core_world_screen.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - World to screen
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
Vector2 cubeScreenPosition;
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FREE); // Set a free camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
|
|
||||||
|
// Calculate cube screen space position (with a little offset to be in top)
|
||||||
|
cubeScreenPosition = WorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
|
||||||
|
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
|
||||||
|
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/lighting_blinn_phong.png
Normal file
After Width: | Height: | Size: 49 KiB |
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
# Copyright (c) 2015 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.
|
||||||
@@ -23,21 +23,24 @@
|
|||||||
|
|
||||||
# define raylib platform to compile for
|
# define raylib platform to compile for
|
||||||
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
||||||
# WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
# determine SUBPLATFORM in case PLATFORM_DESKTOP selected
|
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
SUBPLATFORM=WINDOWS
|
PLATFORM_OS=WINDOWS
|
||||||
|
LIBPATH=win32
|
||||||
else
|
else
|
||||||
UNAMEOS:=$(shell uname)
|
UNAMEOS:=$(shell uname)
|
||||||
ifeq ($(UNAMEOS),Linux)
|
ifeq ($(UNAMEOS),Linux)
|
||||||
SUBPLATFORM=LINUX
|
PLATFORM_OS=LINUX
|
||||||
|
LIBPATH=linux
|
||||||
else
|
else
|
||||||
ifeq ($(UNAMEOS),Darwin)
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
SUBPLATFORM=OSX
|
PLATFORM_OS=OSX
|
||||||
|
LIBPATH=osx
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -47,10 +50,15 @@ endif
|
|||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# define emscripten compiler
|
# define emscripten compiler
|
||||||
CC = emcc
|
CC = emcc
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# define llvm compiler for mac
|
||||||
|
CC = clang
|
||||||
else
|
else
|
||||||
# define default gcc compiler
|
# define default gcc compiler
|
||||||
CC = gcc
|
CC = gcc
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# define compiler flags:
|
# define compiler flags:
|
||||||
# -O2 defines optimization level
|
# -O2 defines optimization level
|
||||||
@@ -74,34 +82,52 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
|
|||||||
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
||||||
else
|
else
|
||||||
INCLUDES = -I. -I../src
|
INCLUDES = -I. -I../src
|
||||||
|
# external libraries headers
|
||||||
|
# GLFW3
|
||||||
|
INCLUDES += -I../external/glfw3/include
|
||||||
|
# GLEW - Not required any more, replaced by GLAD
|
||||||
|
#INCLUDES += -I../external/glew/include
|
||||||
|
# OpenAL Soft
|
||||||
|
INCLUDES += -I../external/openal_soft/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define library paths containing required libs
|
# define library paths containing required libs
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
LFLAGS = -L. -L../src -L/opt/vc/lib
|
LFLAGS = -L. -L../src -L/opt/vc/lib
|
||||||
else
|
else
|
||||||
LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
|
LFLAGS = -L. -L../src
|
||||||
|
# external libraries to link with
|
||||||
|
# GLFW3
|
||||||
|
LFLAGS += -L../external/glfw3/lib/$(LIBPATH)
|
||||||
|
ifneq ($(PLATFORM_OS),OSX)
|
||||||
|
# OpenAL Soft
|
||||||
|
LFLAGS += -L../external/openal_soft/lib/$(LIBPATH)
|
||||||
|
# GLEW - Not required any more, replaced by GLAD
|
||||||
|
#LFLAGS += -L../external/glew/lib/$(LIBPATH)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define any libraries to link into executable
|
# define any libraries to link into executable
|
||||||
# if you want to link libraries (libname.so or libname.a), use the -lname
|
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(SUBPLATFORM),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# libraries for Debian GNU/Linux desktop compiling
|
# libraries for Debian GNU/Linux desktop compiling
|
||||||
# requires the following packages:
|
# requires the following packages:
|
||||||
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
||||||
LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
|
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread
|
||||||
endif
|
# on XWindow could require also below libraries, just uncomment
|
||||||
ifeq ($(SUBPLATFORM),OSX)
|
#LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
# libraries for OS X 10.9 desktop compiling
|
else
|
||||||
# requires the following packages:
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
# libraries for OS X 10.9 desktop compiling
|
||||||
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
|
# requires the following packages:
|
||||||
|
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
|
||||||
|
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
|
||||||
else
|
else
|
||||||
# libraries for Windows desktop compiling
|
# libraries for Windows desktop compiling
|
||||||
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
||||||
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
|
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
@@ -110,11 +136,12 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
|
|||||||
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
|
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# just adjust the correct path to libraylib.bc
|
||||||
LIBS = ../src/libraylib.bc
|
LIBS = ../src/libraylib.bc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define additional parameters and flags for windows
|
# define additional parameters and flags for windows
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# resources file contains windows exe icon
|
# resources file contains windows exe icon
|
||||||
# -Wl,--subsystem,windows hides the console window
|
# -Wl,--subsystem,windows hides the console window
|
||||||
WINFLAGS = ../src/resources -Wl,--subsystem,windows
|
WINFLAGS = ../src/resources -Wl,--subsystem,windows
|
||||||
@@ -130,9 +157,16 @@ EXAMPLES = \
|
|||||||
core_input_keys \
|
core_input_keys \
|
||||||
core_input_mouse \
|
core_input_mouse \
|
||||||
core_mouse_wheel \
|
core_mouse_wheel \
|
||||||
|
core_input_gamepad \
|
||||||
core_random_values \
|
core_random_values \
|
||||||
core_color_select \
|
core_color_select \
|
||||||
|
core_drop_files \
|
||||||
|
core_storage_values \
|
||||||
|
core_gestures_detection \
|
||||||
core_3d_mode \
|
core_3d_mode \
|
||||||
|
core_3d_picking \
|
||||||
|
core_3d_camera_free \
|
||||||
|
core_3d_camera_first_person \
|
||||||
shapes_logo_raylib \
|
shapes_logo_raylib \
|
||||||
shapes_basic_shapes \
|
shapes_basic_shapes \
|
||||||
shapes_colors_palette \
|
shapes_colors_palette \
|
||||||
@@ -140,22 +174,32 @@ EXAMPLES = \
|
|||||||
textures_logo_raylib \
|
textures_logo_raylib \
|
||||||
textures_image_loading \
|
textures_image_loading \
|
||||||
textures_rectangle \
|
textures_rectangle \
|
||||||
textures_compressed_dds \
|
|
||||||
textures_mipmaps \
|
|
||||||
textures_srcrec_dstrec \
|
textures_srcrec_dstrec \
|
||||||
|
textures_to_image \
|
||||||
|
textures_raw_data \
|
||||||
|
textures_formats_loading \
|
||||||
|
textures_particles_trail_blending \
|
||||||
|
textures_image_processing \
|
||||||
|
textures_image_drawing \
|
||||||
text_sprite_fonts \
|
text_sprite_fonts \
|
||||||
|
text_bmfont_ttf \
|
||||||
text_rbmf_fonts \
|
text_rbmf_fonts \
|
||||||
text_format_text \
|
text_format_text \
|
||||||
text_font_select \
|
text_font_select \
|
||||||
|
text_writing_anim \
|
||||||
models_geometric_shapes \
|
models_geometric_shapes \
|
||||||
models_planes \
|
models_box_collisions \
|
||||||
models_billboard \
|
models_billboard \
|
||||||
models_obj_loading \
|
models_obj_loading \
|
||||||
models_heightmap \
|
models_heightmap \
|
||||||
models_cubicmap \
|
models_cubicmap \
|
||||||
|
shaders_model_shader \
|
||||||
|
shaders_shapes_textures \
|
||||||
|
shaders_custom_uniform \
|
||||||
|
shaders_postprocessing \
|
||||||
audio_sound_loading \
|
audio_sound_loading \
|
||||||
audio_music_stream \
|
audio_music_stream \
|
||||||
#core_input_gamepad \
|
fix_dylib \
|
||||||
|
|
||||||
|
|
||||||
# typing 'make' will invoke the first target entry in the file,
|
# typing 'make' will invoke the first target entry in the file,
|
||||||
@@ -177,16 +221,18 @@ core_input_keys: core_input_keys.c
|
|||||||
core_input_mouse: core_input_mouse.c
|
core_input_mouse: core_input_mouse.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
||||||
# compile [core] example - gamepad input
|
|
||||||
core_input_gamepad: core_input_gamepad.c
|
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# compile [core] example - mouse wheel
|
# compile [core] example - mouse wheel
|
||||||
core_mouse_wheel: core_mouse_wheel.c
|
core_mouse_wheel: core_mouse_wheel.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - gamepad input
|
||||||
|
core_input_gamepad: core_input_gamepad.c
|
||||||
|
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_input_gamepad: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
|
||||||
|
endif
|
||||||
|
|
||||||
# compile [core] example - generate random values
|
# compile [core] example - generate random values
|
||||||
core_random_values: core_random_values.c
|
core_random_values: core_random_values.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
@@ -195,10 +241,42 @@ core_random_values: core_random_values.c
|
|||||||
core_color_select: core_color_select.c
|
core_color_select: core_color_select.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - drop files
|
||||||
|
core_drop_files: core_drop_files.c
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
|
||||||
|
endif
|
||||||
|
|
||||||
|
# compile [core] example - storage values
|
||||||
|
core_storage_values: core_storage_values.c
|
||||||
|
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
else
|
||||||
|
@echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
|
||||||
|
endif
|
||||||
|
|
||||||
|
# compile [core] example - gestures detection
|
||||||
|
core_gestures_detection: core_gestures_detection.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [core] example - 3d mode
|
# compile [core] example - 3d mode
|
||||||
core_3d_mode: core_3d_mode.c
|
core_3d_mode: core_3d_mode.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d picking
|
||||||
|
core_3d_picking: core_3d_picking.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d camera free
|
||||||
|
core_3d_camera_free: core_3d_camera_free.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 3d camera first person
|
||||||
|
core_3d_camera_first_person: core_3d_camera_first_person.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [shapes] example - raylib logo (with basic shapes)
|
# compile [shapes] example - raylib logo (with basic shapes)
|
||||||
shapes_logo_raylib: shapes_logo_raylib.c
|
shapes_logo_raylib: shapes_logo_raylib.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
@@ -227,21 +305,41 @@ textures_image_loading: textures_image_loading.c
|
|||||||
textures_rectangle: textures_rectangle.c
|
textures_rectangle: textures_rectangle.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [textures] example - compressed texture loading (DDS)
|
|
||||||
textures_compressed_dds: textures_compressed_dds.c
|
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
|
||||||
|
|
||||||
# compile [textures] example - texture mipmaps generation
|
|
||||||
textures_mipmaps: textures_mipmaps.c
|
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
|
||||||
|
|
||||||
# compile [textures] example - texture source and destination rectangles
|
# compile [textures] example - texture source and destination rectangles
|
||||||
textures_srcrec_dstrec: textures_srcrec_dstrec.c
|
textures_srcrec_dstrec: textures_srcrec_dstrec.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture to image
|
||||||
|
textures_to_image: textures_to_image.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture raw data
|
||||||
|
textures_raw_data: textures_raw_data.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture formats loading
|
||||||
|
textures_formats_loading: textures_formats_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture particles trail blending
|
||||||
|
textures_particles_trail_blending: textures_particles_trail_blending.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture image processing
|
||||||
|
textures_image_processing: textures_image_processing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [textures] example - texture image drawing
|
||||||
|
textures_image_drawing: textures_image_drawing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [text] example - sprite fonts loading
|
# compile [text] example - sprite fonts loading
|
||||||
text_sprite_fonts: text_sprite_fonts.c
|
text_sprite_fonts: text_sprite_fonts.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - bmfonts and ttf loading
|
||||||
|
text_bmfont_ttf: text_bmfont_ttf.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [text] example - raylib bitmap fonts (rBMF)
|
# compile [text] example - raylib bitmap fonts (rBMF)
|
||||||
text_rbmf_fonts: text_rbmf_fonts.c
|
text_rbmf_fonts: text_rbmf_fonts.c
|
||||||
@@ -255,10 +353,18 @@ text_format_text: text_format_text.c
|
|||||||
text_font_select: text_font_select.c
|
text_font_select: text_font_select.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text writing animation
|
||||||
|
text_writing_anim: text_writing_anim.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [models] example - basic geometric 3d shapes
|
# compile [models] example - basic geometric 3d shapes
|
||||||
models_geometric_shapes: models_geometric_shapes.c
|
models_geometric_shapes: models_geometric_shapes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [models] example - box collisions
|
||||||
|
models_box_collisions: models_box_collisions.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [models] example - basic window
|
# compile [models] example - basic window
|
||||||
models_planes: models_planes.c
|
models_planes: models_planes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
@@ -279,6 +385,22 @@ models_heightmap: models_heightmap.c
|
|||||||
models_cubicmap: models_cubicmap.c
|
models_cubicmap: models_cubicmap.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - model shader
|
||||||
|
shaders_model_shader: shaders_model_shader.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - shapes texture shader
|
||||||
|
shaders_shapes_textures: shaders_shapes_textures.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - custom uniform in shader
|
||||||
|
shaders_custom_uniform: shaders_custom_uniform.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - postprocessing shader
|
||||||
|
shaders_postprocessing: shaders_postprocessing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [audio] example - sound loading and playing (WAV and OGG)
|
# compile [audio] example - sound loading and playing (WAV and OGG)
|
||||||
audio_sound_loading: audio_sound_loading.c
|
audio_sound_loading: audio_sound_loading.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
@@ -287,15 +409,21 @@ audio_sound_loading: audio_sound_loading.c
|
|||||||
audio_music_stream: audio_music_stream.c
|
audio_music_stream: audio_music_stream.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# fix dylib install path name for each executable (MAC)
|
||||||
|
fix_dylib:
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
|
||||||
|
endif
|
||||||
|
|
||||||
# clean everything
|
# clean everything
|
||||||
clean:
|
clean:
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(SUBPLATFORM),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
find . -type f -perm +ugo+x -delete
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
else
|
else
|
||||||
ifeq ($(SUBPLATFORM),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find . -type f -executable -delete
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
|
||||||
rm -f *.o
|
|
||||||
else
|
else
|
||||||
del *.o *.exe
|
del *.o *.exe
|
||||||
endif
|
endif
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
*
|
*
|
||||||
* raylib [models] example - Drawing billboards
|
* raylib [models] example - Drawing billboards
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.2 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -21,24 +21,24 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
Texture2D lena = LoadTexture("resources/lena.png"); // Our texture for billboard
|
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
|
||||||
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
|
Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard
|
||||||
Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
|
|
||||||
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_LEFT)) camera.position.x -= 0.2;
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
if (IsKeyDown(KEY_RIGHT)) camera.position.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -48,11 +48,10 @@ int main()
|
|||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
|
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
|
||||||
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
|
|
||||||
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ int main()
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(lena); // Unload texture
|
UnloadTexture(bill); // Unload texture
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
BIN
examples/models_billboard.png
Normal file
After Width: | Height: | Size: 54 KiB |
119
examples/models_box_collisions.c
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [models] example - Detect basic 3d collisions (box vs sphere vs box)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
|
Vector3 playerPosition = { 0.0f, 1.0f, 2.0f };
|
||||||
|
Vector3 playerSize = { 1.0f, 2.0f, 1.0f };
|
||||||
|
Color playerColor = GREEN;
|
||||||
|
|
||||||
|
Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f };
|
||||||
|
Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f };
|
||||||
|
|
||||||
|
Vector3 enemySpherePos = { 4.0f, 0.0f, 0.0f };
|
||||||
|
float enemySphereSize = 1.5f;
|
||||||
|
|
||||||
|
bool collision = false;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Move player
|
||||||
|
if (IsKeyDown(KEY_RIGHT)) playerPosition.x += 0.2f;
|
||||||
|
else if (IsKeyDown(KEY_LEFT)) playerPosition.x -= 0.2f;
|
||||||
|
else if (IsKeyDown(KEY_DOWN)) playerPosition.z += 0.2f;
|
||||||
|
else if (IsKeyDown(KEY_UP)) playerPosition.z -= 0.2f;
|
||||||
|
|
||||||
|
collision = false;
|
||||||
|
|
||||||
|
// Check collisions player vs enemy-box
|
||||||
|
if (CheckCollisionBoxes((Vector3){ playerPosition.x - playerSize.x/2,
|
||||||
|
playerPosition.y - playerSize.y/2,
|
||||||
|
playerPosition.z - playerSize.z/2 },
|
||||||
|
(Vector3){ playerPosition.x + playerSize.x/2,
|
||||||
|
playerPosition.y + playerSize.y/2,
|
||||||
|
playerPosition.z + playerSize.z/2 },
|
||||||
|
(Vector3){ enemyBoxPos.x - enemyBoxSize.x/2,
|
||||||
|
enemyBoxPos.y - enemyBoxSize.y/2,
|
||||||
|
enemyBoxPos.z - enemyBoxSize.z/2 },
|
||||||
|
(Vector3){ enemyBoxPos.x + enemyBoxSize.x/2,
|
||||||
|
enemyBoxPos.y + enemyBoxSize.y/2,
|
||||||
|
enemyBoxPos.z + enemyBoxSize.z/2 })) collision = true;
|
||||||
|
|
||||||
|
// Check collisions player vs enemy-sphere
|
||||||
|
if (CheckCollisionBoxSphere((Vector3){ playerPosition.x - playerSize.x/2,
|
||||||
|
playerPosition.y - playerSize.y/2,
|
||||||
|
playerPosition.z - playerSize.z/2 },
|
||||||
|
(Vector3){ playerPosition.x + playerSize.x/2,
|
||||||
|
playerPosition.y + playerSize.y/2,
|
||||||
|
playerPosition.z + playerSize.z/2 },
|
||||||
|
enemySpherePos, enemySphereSize)) collision = true;
|
||||||
|
|
||||||
|
if (collision) playerColor = RED;
|
||||||
|
else playerColor = GREEN;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
// Draw enemy-box
|
||||||
|
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY);
|
||||||
|
DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw enemy-sphere
|
||||||
|
DrawSphere(enemySpherePos, enemySphereSize, GRAY);
|
||||||
|
DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw player
|
||||||
|
DrawCubeV(playerPosition, playerSize, playerColor);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/models_box_collisions.png
Normal file
After Width: | Height: | Size: 22 KiB |
@@ -2,10 +2,10 @@
|
|||||||
*
|
*
|
||||||
* raylib [models] example - Cubicmap loading and drawing
|
* raylib [models] example - Cubicmap loading and drawing
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.2 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -21,29 +21,32 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 16.0f, 14.0f, 16.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
|
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||||
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||||
Model map = LoadCubicmap(img); // Load cubicmap model
|
Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
|
||||||
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
|
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||||
|
SetModelTexture(&map, texture); // Bind texture to map model
|
||||||
|
|
||||||
|
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||||
|
|
||||||
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
|
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_UP)) camera.position.y += 0.2f;
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
else if (IsKeyDown(KEY_DOWN)) camera.position.y -= 0.2f;
|
|
||||||
|
|
||||||
if (IsKeyDown(KEY_RIGHT)) camera.position.z += 0.2f;
|
|
||||||
else if (IsKeyDown(KEY_LEFT)) camera.position.z -= 0.2f;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -54,13 +57,15 @@ int main()
|
|||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawModel(map, mapPosition, 1.0f, MAROON);
|
DrawModel(map, mapPosition, 1.0f, WHITE);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
|
||||||
|
|
||||||
DrawGizmo(mapPosition);
|
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||||
|
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
||||||
|
|
||||||
|
DrawText("cubicmap image used to", 658, 90, 10, GRAY);
|
||||||
|
DrawText("generate map 3d model", 658, 104, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
@@ -70,8 +75,9 @@ int main()
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Unload texture
|
UnloadTexture(cubicmap); // Unload cubicmap texture
|
||||||
UnloadModel(map); // Unload model
|
UnloadTexture(texture); // Unload map texture
|
||||||
|
UnloadModel(map); // Unload map model
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 403 KiB |
@@ -5,7 +5,7 @@
|
|||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.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
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -42,21 +42,21 @@ int main()
|
|||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
|
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
|
||||||
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
|
||||||
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
|
DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
|
DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN);
|
||||||
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
|
DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME);
|
||||||
|
|
||||||
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
|
DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE);
|
||||||
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
|
DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE);
|
||||||
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);
|
DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN);
|
||||||
|
|
||||||
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
|
DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
|
||||||
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);
|
DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
*
|
*
|
||||||
* raylib [models] example - Heightmap loading and drawing
|
* raylib [models] example - Heightmap loading and drawing
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -20,26 +20,29 @@ int main()
|
|||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define our custom camera to look into our 3d world
|
||||||
Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 18.0f, 16.0f, 18.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||||
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||||
Model map = LoadHeightmap(img, 4); // Load heightmap model
|
Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
SetModelTexture(&map, texture); // Bind texture to model
|
||||||
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
|
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!)
|
||||||
|
|
||||||
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
|
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// ...
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -50,13 +53,15 @@ int main()
|
|||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawModel(map, mapPosition, 0.5f, MAROON);
|
// NOTE: Model is scaled to 1/4 of its original size (128x128 units)
|
||||||
|
DrawModel(map, mapPosition, 1.0f, RED);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
DrawGrid(20, 1.0f);
|
||||||
|
|
||||||
DrawGizmo(mapPosition);
|
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
|
||||||
|
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 95 KiB |
@@ -2,10 +2,10 @@
|
|||||||
*
|
*
|
||||||
* raylib [models] example - Load and draw a 3d model (OBJ)
|
* raylib [models] example - Load and draw a 3d model (OBJ)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/catsham.png"); // Load model texture
|
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
|
||||||
Model cat = LoadModel("resources/cat.obj"); // Load OBJ model
|
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
||||||
SetModelTexture(&cat, texture); // Bind texture to model
|
SetModelTexture(&dwarf, texture); // Bind texture to model
|
||||||
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -36,10 +36,7 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2;
|
//...
|
||||||
if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -50,13 +47,15 @@ int main()
|
|||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture
|
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
DrawGizmo(catPosition); // Draw gizmo
|
DrawGizmo(position); // Draw gizmo
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
@@ -67,7 +66,7 @@ int main()
|
|||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Unload texture
|
UnloadTexture(texture); // Unload texture
|
||||||
UnloadModel(cat); // Unload model
|
UnloadModel(dwarf); // Unload model
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 125 KiB |
124
examples/physics_basic_rigidbody.c
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [physac] physics example - Basic rigidbody
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Victor Fisac and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define OBJECT_SIZE 50
|
||||||
|
#define PLAYER_INDEX 0
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [physics] example - basic rigidbody");
|
||||||
|
|
||||||
|
InitPhysics(3); // Initialize physics system with maximum physic objects
|
||||||
|
|
||||||
|
// Object initialization
|
||||||
|
Transform player = (Transform){(Vector2){(screenWidth - OBJECT_SIZE) / 2, (screenHeight - OBJECT_SIZE) / 2}, 0.0f, (Vector2){OBJECT_SIZE, OBJECT_SIZE}};
|
||||||
|
AddCollider(PLAYER_INDEX, (Collider){true, COLLIDER_RECTANGLE, (Rectangle){player.position.x, player.position.y, player.scale.x, player.scale.y}, 0});
|
||||||
|
AddRigidbody(PLAYER_INDEX, (Rigidbody){true, 1.0f, (Vector2){0, 0}, (Vector2){0, 0}, false, false, true, 0.5f, 1.0f});
|
||||||
|
|
||||||
|
// Floor initialization
|
||||||
|
// NOTE: floor doesn't need a rigidbody because it's a static physic object, just a collider to collide with other dynamic colliders (with rigidbody)
|
||||||
|
Transform floor = (Transform){(Vector2){0, screenHeight * 0.8f}, 0.0f, (Vector2){screenWidth, screenHeight * 0.2f}};
|
||||||
|
AddCollider(PLAYER_INDEX + 1, (Collider){true, COLLIDER_RECTANGLE, (Rectangle){floor.position.x, floor.position.y, floor.scale.x, floor.scale.y}, 0});
|
||||||
|
|
||||||
|
// Object properties initialization
|
||||||
|
float moveSpeed = 6.0f;
|
||||||
|
float jumpForce = 5.0f;
|
||||||
|
|
||||||
|
bool physicsDebug = false;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Update object physics
|
||||||
|
// NOTE: all physics detections and reactions are calculated in ApplyPhysics() function (You will live happier :D)
|
||||||
|
ApplyPhysics(PLAYER_INDEX, &player.position);
|
||||||
|
|
||||||
|
// Check jump button input
|
||||||
|
if (IsKeyDown(KEY_SPACE) && GetRigidbody(PLAYER_INDEX).isGrounded)
|
||||||
|
{
|
||||||
|
// Reset object Y velocity to avoid double jumping cases but keep the same X velocity that it already has
|
||||||
|
SetRigidbodyVelocity(PLAYER_INDEX, (Vector2){GetRigidbody(PLAYER_INDEX).velocity.x, 0});
|
||||||
|
|
||||||
|
// Add jumping force in Y axis
|
||||||
|
AddRigidbodyForce(PLAYER_INDEX, (Vector2){0, jumpForce});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check movement buttons input
|
||||||
|
if (IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_D))
|
||||||
|
{
|
||||||
|
// Set rigidbody velocity in X based on moveSpeed value and apply the same Y velocity that it already has
|
||||||
|
SetRigidbodyVelocity(PLAYER_INDEX, (Vector2){moveSpeed, GetRigidbody(PLAYER_INDEX).velocity.y});
|
||||||
|
}
|
||||||
|
else if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_A))
|
||||||
|
{
|
||||||
|
// Set rigidbody velocity in X based on moveSpeed negative value and apply the same Y velocity that it already has
|
||||||
|
SetRigidbodyVelocity(PLAYER_INDEX, (Vector2){-moveSpeed, GetRigidbody(PLAYER_INDEX).velocity.y});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check debug mode toggle button input
|
||||||
|
if (IsKeyPressed(KEY_P)) physicsDebug = !physicsDebug;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw information
|
||||||
|
DrawText("Use LEFT / RIGHT to MOVE and SPACE to JUMP", (screenWidth - MeasureText("Use LEFT / RIGHT to MOVE and SPACE to JUMP", 20)) / 2, screenHeight * 0.20f, 20, LIGHTGRAY);
|
||||||
|
DrawText("Use P to switch DEBUG MODE", (screenWidth - MeasureText("Use P to switch DEBUG MODE", 20)) / 2, screenHeight * 0.3f, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
// Check if debug mode is enabled
|
||||||
|
if (physicsDebug)
|
||||||
|
{
|
||||||
|
// Draw every internal physics stored collider if it is active
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
if (GetCollider(i).enabled)
|
||||||
|
{
|
||||||
|
DrawRectangleLines(GetCollider(i).bounds.x, GetCollider(i).bounds.y, GetCollider(i).bounds.width, GetCollider(i).bounds.height, GREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Draw player and floor
|
||||||
|
DrawRectangleRec((Rectangle){player.position.x, player.position.y, player.scale.x, player.scale.y}, GRAY);
|
||||||
|
DrawRectangleRec((Rectangle){floor.position.x, floor.position.y, floor.scale.x, floor.scale.y}, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadPhysics(); // Unload physic objects
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/physics_basic_rigidbody.png
Normal file
After Width: | Height: | Size: 18 KiB |
135
examples/physics_rigidbody_force.c
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [physac] physics example - Rigidbody forces
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Victor Fisac and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_OBJECTS 5
|
||||||
|
#define OBJECTS_OFFSET 150
|
||||||
|
|
||||||
|
#define FORCE_INTENSITY 250.0f // Customize by user
|
||||||
|
#define FORCE_RADIUS 100 // Customize by user
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [physics] example - rigidbodies forces");
|
||||||
|
|
||||||
|
InitPhysics(MAX_OBJECTS + 1); // Initialize physics system with maximum physic objects
|
||||||
|
|
||||||
|
// Physic Objects initialization
|
||||||
|
Transform objects[MAX_OBJECTS];
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_OBJECTS; i++)
|
||||||
|
{
|
||||||
|
objects[i] = (Transform){(Vector2){75 + OBJECTS_OFFSET * i, (screenHeight - 50) / 2}, 0.0f, (Vector2){50, 50}};
|
||||||
|
AddCollider(i, (Collider){true, COLLIDER_RECTANGLE, (Rectangle){objects[i].position.x, objects[i].position.y, objects[i].scale.x, objects[i].scale.y}, 0});
|
||||||
|
AddRigidbody(i, (Rigidbody){true, 1.0f, (Vector2){0, 0}, (Vector2){0, 0}, false, false, true, 0.5f, 0.5f});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Floor initialization
|
||||||
|
// NOTE: floor doesn't need a rigidbody because it's a static physic object, just a collider to collide with other dynamic colliders (with rigidbody)
|
||||||
|
Transform floor = (Transform){(Vector2){0, screenHeight * 0.8f}, 0.0f, (Vector2){screenWidth, screenHeight * 0.2f}};
|
||||||
|
AddCollider(MAX_OBJECTS, (Collider){true, COLLIDER_RECTANGLE, (Rectangle){floor.position.x, floor.position.y, floor.scale.x, floor.scale.y}, 0});
|
||||||
|
|
||||||
|
bool physicsDebug = false;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Update object physics
|
||||||
|
// NOTE: all physics detections and reactions are calculated in ApplyPhysics() function (You will live happier :D)
|
||||||
|
for (int i = 0; i < MAX_OBJECTS; i++)
|
||||||
|
{
|
||||||
|
ApplyPhysics(i, &objects[i].position);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check foce button input
|
||||||
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
AddForceAtPosition(GetMousePosition(), FORCE_INTENSITY, FORCE_RADIUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check debug mode toggle button input
|
||||||
|
if (IsKeyPressed(KEY_P)) physicsDebug = !physicsDebug;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Check if debug mode is enabled
|
||||||
|
if (physicsDebug)
|
||||||
|
{
|
||||||
|
// Draw every internal physics stored collider if it is active (floor included)
|
||||||
|
for (int i = 0; i < MAX_OBJECTS; i++)
|
||||||
|
{
|
||||||
|
if (GetCollider(i).enabled)
|
||||||
|
{
|
||||||
|
// Draw collider bounds
|
||||||
|
DrawRectangleLines(GetCollider(i).bounds.x, GetCollider(i).bounds.y, GetCollider(i).bounds.width, GetCollider(i).bounds.height, GREEN);
|
||||||
|
|
||||||
|
// Check if current collider is not floor
|
||||||
|
if (i < MAX_OBJECTS)
|
||||||
|
{
|
||||||
|
// Draw lines between mouse position and objects if they are in force range
|
||||||
|
if (CheckCollisionPointCircle(GetMousePosition(), (Vector2){GetCollider(i).bounds.x + GetCollider(i).bounds.width / 2, GetCollider(i).bounds.y + GetCollider(i).bounds.height / 2}, FORCE_RADIUS))
|
||||||
|
{
|
||||||
|
DrawLineV(GetMousePosition(), (Vector2){GetCollider(i).bounds.x + GetCollider(i).bounds.width / 2, GetCollider(i).bounds.y + GetCollider(i).bounds.height / 2}, RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw radius circle
|
||||||
|
DrawCircleLines(GetMousePosition().x, GetMousePosition().y, FORCE_RADIUS, RED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Draw objects
|
||||||
|
for (int i = 0; i < MAX_OBJECTS; i++)
|
||||||
|
{
|
||||||
|
DrawRectangleRec((Rectangle){objects[i].position.x, objects[i].position.y, objects[i].scale.x, objects[i].scale.y}, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw floor
|
||||||
|
DrawRectangleRec((Rectangle){floor.position.x, floor.position.y, floor.scale.x, floor.scale.y}, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Draw help messages
|
||||||
|
DrawText("Use LEFT MOUSE BUTTON to create a force in mouse position", (screenWidth - MeasureText("Use LEFT MOUSE BUTTON to create a force in mouse position", 20)) / 2, screenHeight * 0.20f, 20, LIGHTGRAY);
|
||||||
|
DrawText("Use P to switch DEBUG MODE", (screenWidth - MeasureText("Use P to switch DEBUG MODE", 20)) / 2, screenHeight * 0.3f, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadPhysics(); // Unload physic objects
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/physics_rigidbody_force.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
examples/resources/billboard.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
examples/resources/cat.png
Normal file
After Width: | Height: | Size: 379 KiB |
Before Width: | Height: | Size: 308 KiB |
Before Width: | Height: | Size: 302 KiB |
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 201 B |
BIN
examples/resources/cubicmap_atlas.png
Normal file
After Width: | Height: | Size: 36 KiB |
99
examples/resources/fonts/bmfont.fnt
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
info face="Arial Black" size=-32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 outline=0
|
||||||
|
common lineHeight=45 base=35 scaleW=512 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4
|
||||||
|
page id=0 file="bmfont.png"
|
||||||
|
chars count=95
|
||||||
|
char id=32 x=423 y=141 width=3 height=45 xoffset=-1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=33 x=323 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=34 x=123 y=141 width=16 height=45 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15
|
||||||
|
char id=35 x=221 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=36 x=244 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=37 x=70 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=38 x=390 y=0 width=25 height=45 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=15
|
||||||
|
char id=39 x=378 y=141 width=8 height=45 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=40 x=222 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=41 x=499 y=94 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=42 x=497 y=47 width=13 height=45 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=15
|
||||||
|
char id=43 x=394 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=44 x=367 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=45 x=261 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=46 x=356 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=47 x=248 y=141 width=11 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=48 x=382 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=49 x=496 y=0 width=14 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=50 x=134 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=51 x=359 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=52 x=313 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=53 x=336 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=54 x=178 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=55 x=478 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=56 x=290 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=57 x=90 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=58 x=345 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=59 x=334 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=60 x=0 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=61 x=21 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=62 x=310 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=63 x=352 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=64 x=279 y=0 width=26 height=45 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=15
|
||||||
|
char id=65 x=193 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=66 x=150 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=67 x=444 y=0 width=24 height=45 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=68 x=174 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=69 x=156 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=70 x=63 y=141 width=18 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=71 x=417 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=72 x=125 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=73 x=388 y=141 width=8 height=45 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=74 x=200 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=75 x=251 y=0 width=26 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=76 x=373 y=94 width=19 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=77 x=134 y=0 width=28 height=45 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=15
|
||||||
|
char id=78 x=100 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=79 x=363 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=80 x=112 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=81 x=335 y=0 width=26 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=82 x=470 y=0 width=24 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=83 x=75 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=84 x=50 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=85 x=25 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=86 x=307 y=0 width=26 height=45 xoffset=0 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=87 x=0 y=0 width=34 height=45 xoffset=-1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=88 x=222 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=89 x=164 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=90 x=0 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=91 x=274 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=92 x=300 y=141 width=10 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=93 x=287 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=94 x=457 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=95 x=103 y=141 width=18 height=45 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15
|
||||||
|
char id=96 x=312 y=141 width=9 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=97 x=474 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=98 x=68 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=99 x=267 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=100 x=46 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=101 x=198 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=102 x=141 y=141 width=15 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=103 x=222 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=104 x=415 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=105 x=398 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=106 x=235 y=141 width=11 height=45 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=107 x=405 y=47 width=21 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=108 x=407 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=109 x=102 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=110 x=331 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=111 x=428 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=112 x=266 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=113 x=288 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=114 x=158 y=141 width=15 height=45 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15
|
||||||
|
char id=115 x=244 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=116 x=175 y=141 width=14 height=45 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15
|
||||||
|
char id=117 x=436 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=118 x=451 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=119 x=36 y=0 width=32 height=45 xoffset=-1 yoffset=0 xadvance=30 page=0 chnl=15
|
||||||
|
char id=120 x=0 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=121 x=23 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=122 x=83 y=141 width=18 height=45 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15
|
||||||
|
char id=123 x=191 y=141 width=14 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=124 x=416 y=141 width=5 height=45 xoffset=2 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=125 x=207 y=141 width=13 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=126 x=42 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
BIN
examples/resources/fonts/bmfont.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
examples/resources/fonts/pixantiqua.ttf
Normal file
BIN
examples/resources/guybrush.png
Normal file
After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 463 KiB |
54966
examples/resources/model/dwarf.obj
Normal file
BIN
examples/resources/model/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
6433
examples/resources/model/shapes.obj
Normal file
BIN
examples/resources/parrots.png
Normal file
After Width: | Height: | Size: 288 KiB |
18
examples/resources/shaders/base.vs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
42
examples/resources/shaders/bloom.fs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 fragTintColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 sum = vec4(0);
|
||||||
|
vec4 tc = vec4(0);
|
||||||
|
|
||||||
|
for (int i = -4; i < 4; i++)
|
||||||
|
{
|
||||||
|
for (int j = -3; j < 3; j++)
|
||||||
|
{
|
||||||
|
sum += texture2D(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture2D(texture0, fragTexCoord).r < 0.3)
|
||||||
|
{
|
||||||
|
tc = sum*sum*0.012 + texture2D(texture0, fragTexCoord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (texture2D(texture0, fragTexCoord).r < 0.5)
|
||||||
|
{
|
||||||
|
tc = sum*sum*0.009 + texture2D(texture0, fragTexCoord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tc = sum*sum*0.0075 + texture2D(texture0, fragTexCoord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragColor = tc;
|
||||||
|
}
|
20
examples/resources/shaders/grayscale.fs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 fragTintColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 base = texture2D(texture0, fragTexCoord)*fragTintColor;
|
||||||
|
|
||||||
|
// Convert to grayscale using NTSC conversion weights
|
||||||
|
float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
|
||||||
|
|
||||||
|
fragColor = vec4(gray, gray, gray, fragTintColor.a);
|
||||||
|
}
|
76
examples/resources/shaders/phong.fs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
// Vertex shader input data
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec3 fragNormal;
|
||||||
|
|
||||||
|
// Diffuse data
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 fragTintColor;
|
||||||
|
|
||||||
|
// Light attributes
|
||||||
|
uniform vec3 light_ambientColor = vec3(0.6, 0.3, 0.0);
|
||||||
|
uniform vec3 light_diffuseColor = vec3(1.0, 0.5, 0.0);
|
||||||
|
uniform vec3 light_specularColor = vec3(0.0, 1.0, 0.0);
|
||||||
|
uniform float light_intensity = 1.0;
|
||||||
|
uniform float light_specIntensity = 1.0;
|
||||||
|
|
||||||
|
// Material attributes
|
||||||
|
uniform vec3 mat_ambientColor = vec3(1.0, 1.0, 1.0);
|
||||||
|
uniform vec3 mat_specularColor = vec3(1.0, 1.0, 1.0);
|
||||||
|
uniform float mat_glossiness = 50.0;
|
||||||
|
|
||||||
|
// World attributes
|
||||||
|
uniform vec3 lightPos;
|
||||||
|
uniform vec3 cameraPos;
|
||||||
|
|
||||||
|
// Fragment shader output data
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
vec3 AmbientLighting()
|
||||||
|
{
|
||||||
|
return (mat_ambientColor*light_ambientColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 DiffuseLighting(in vec3 N, in vec3 L)
|
||||||
|
{
|
||||||
|
// Lambertian reflection calculation
|
||||||
|
float diffuse = clamp(dot(N, L), 0, 1);
|
||||||
|
|
||||||
|
return (fragTintColor.xyz*light_diffuseColor*light_intensity*diffuse);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V)
|
||||||
|
{
|
||||||
|
float specular = 0.0;
|
||||||
|
|
||||||
|
// Calculate specular reflection only if the surface is oriented to the light source
|
||||||
|
if (dot(N, L) > 0)
|
||||||
|
{
|
||||||
|
// Calculate half vector
|
||||||
|
vec3 H = normalize(L + V);
|
||||||
|
|
||||||
|
// Calculate specular intensity
|
||||||
|
specular = pow(dot(N, H), 3 + mat_glossiness);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (mat_specularColor*light_specularColor*light_specIntensity*specular);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Normalize input vectors
|
||||||
|
vec3 L = normalize(lightPos);
|
||||||
|
vec3 V = normalize(cameraPos);
|
||||||
|
vec3 N = normalize(fragNormal);
|
||||||
|
|
||||||
|
vec3 ambient = AmbientLighting();
|
||||||
|
vec3 diffuse = DiffuseLighting(N, L);
|
||||||
|
vec3 specular = SpecularLighting(N, L, V);
|
||||||
|
|
||||||
|
// Get base color from texture
|
||||||
|
vec4 textureColor = texture(texture0, fragTexCoord);
|
||||||
|
vec3 finalColor = textureColor.rgb;
|
||||||
|
|
||||||
|
fragColor = vec4(finalColor * (ambient + diffuse + specular), textureColor.a);
|
||||||
|
}
|
29
examples/resources/shaders/phong.vs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
// Vertex input data
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
|
||||||
|
// Projection and model data
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
uniform mat4 modelMatrix;
|
||||||
|
//uniform mat4 viewMatrix; // Not used
|
||||||
|
|
||||||
|
// Attributes to fragment shader
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec3 fragNormal;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send texture coord to fragment shader
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
|
||||||
|
// Calculate view vector normal from model
|
||||||
|
mat3 normalMatrix = transpose(inverse(mat3(modelMatrix)));
|
||||||
|
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
18
examples/resources/shaders/shapes_base.vs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
attribute vec3 vertexPosition;
|
||||||
|
attribute vec2 vertexTexCoord;
|
||||||
|
attribute vec4 vertexColor;
|
||||||
|
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragTintColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragTintColor = vertexColor;
|
||||||
|
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
15
examples/resources/shaders/shapes_grayscale.fs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragTintColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 base = texture2D(texture0, fragTexCoord)*fragTintColor;
|
||||||
|
|
||||||
|
// Convert to grayscale using NTSC conversion weights
|
||||||
|
float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
|
||||||
|
|
||||||
|
gl_FragColor = vec4(gray, gray, gray, base.a);
|
||||||
|
}
|
41
examples/resources/shaders/swirl.fs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 fragTintColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
const float renderWidth = 800.0; // HARDCODED for example!
|
||||||
|
const float renderHeight = 480.0; // Use uniforms instead...
|
||||||
|
|
||||||
|
float radius = 250.0;
|
||||||
|
float angle = 0.8;
|
||||||
|
|
||||||
|
uniform vec2 center = vec2(200.0, 200.0);
|
||||||
|
|
||||||
|
void main (void)
|
||||||
|
{
|
||||||
|
vec2 texSize = vec2(renderWidth, renderHeight);
|
||||||
|
vec2 tc = fragTexCoord*texSize;
|
||||||
|
tc -= center;
|
||||||
|
float dist = length(tc);
|
||||||
|
|
||||||
|
if (dist < radius)
|
||||||
|
{
|
||||||
|
float percent = (radius - dist)/radius;
|
||||||
|
float theta = percent*percent*angle*8.0;
|
||||||
|
float s = sin(theta);
|
||||||
|
float c = cos(theta);
|
||||||
|
|
||||||
|
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
|
||||||
|
}
|
||||||
|
|
||||||
|
tc += center;
|
||||||
|
vec3 color = texture2D(texture0, tc/texSize).rgb;
|
||||||
|
|
||||||
|
fragColor = vec4(color, 1.0);;
|
||||||
|
}
|
BIN
examples/resources/smoke.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
examples/resources/texture_formats/sonic.png
Normal file
After Width: | Height: | Size: 114 KiB |