233 Commits
1.1.1 ... 1.3.0

Author SHA1 Message Date
Ray
77558eec0c Merge pull request #28 from raysan5/develop
Integrating Develop branch
2015-09-03 01:49:58 +02:00
raysan5
d05acb1b68 Updated comments 2015-09-03 01:28:13 +02:00
raysan5
ef1f9fe450 Added strdup() function replacement
strdup() is not a C99 function (it's POSIX), not available in emscripten
2015-09-03 01:27:49 +02:00
raysan5
4e0378ab7c Updated to raylib 1.3 2015-09-02 22:26:02 +02:00
raysan5
075f599abb Updated comments 2015-09-02 22:25:50 +02:00
raysan5
94d0e83207 Corrected crazy bug about model textures
On OpenGL ES it was set to use GL_CLAMP_TO_EDGE wrap mode for textures.
On LoadOBJ() texture coordinates were wrongly Y-flipped
2015-09-02 20:36:05 +02:00
raysan5
ab459bf418 Added some comments 2015-09-02 20:34:14 +02:00
raysan5
35f1ebf9f3 Corrected model filenames 2015-09-02 20:33:58 +02:00
raysan5
b1a90a7f91 Added some useful postprocessing shaders
Shaders come in two flavours:
- shaders/gl330: OpenGL 3.3+ (Windows, Linux, OSX)
- shaders/gles100:  OpenGL ES 2.0 (Android, RPI, HTML5)
2015-09-02 02:44:16 +02:00
raysan5
da5221910f Added getures module to Android source project 2015-09-02 02:42:15 +02:00
raysan5
50c5df0838 Added some comments 2015-09-02 02:41:55 +02:00
raysan5
a7a81ca749 Added example: box collisions 2015-09-02 02:41:21 +02:00
raysan5
4879106096 Reviewed to work on Raspberry Pi
[rlgl] Extensions strings loading was redone to avoid a Segmentation
Fault on Raspberry Pi
2015-09-02 01:08:41 +02:00
raysan5
e28fef6ee0 Reviewed examples 2015-09-02 01:07:16 +02:00
raysan5
9a578c5962 Added shaders examples resources 2015-09-02 01:06:55 +02:00
raysan5
0a345a6128 Updated comment... 2015-09-02 01:06:08 +02:00
raysan5
94a1fdc2ae Updated some comments 2015-09-01 23:15:26 +02:00
raysan5
acc322b3e1 Added new examples: SHADERS 2015-09-01 22:59:43 +02:00
raysan5
e5fe2c216e Added some comments to examples 2015-09-01 22:59:16 +02:00
raysan5
e93475d854 Merge branch 'master' into develop 2015-08-31 01:28:59 +02:00
Ray
858ccb350d Merge pull request #27 from raysan5/develop
Merged branch 'master' into develop and remerged to master
2015-08-31 01:27:47 +02:00
raysan5
7e568c8903 Merge branch 'master' into develop 2015-08-31 01:23:56 +02:00
Ray
60194753d7 Merge pull request #26 from raysan5/develop
Develop branch integration
2015-08-31 01:16:34 +02:00
raysan5
808aeabf4c Updated with latest changes 2015-08-30 17:46:52 +02:00
raysan5
32330801c9 Updates some examples 2015-08-30 17:46:37 +02:00
raysan5
535b9e606f Redesigned UpdateCamera() function
Splitted into:
UpdateCamera()             // Update only camera
UpdateCameraPlayer()   // Update camera and player position
2015-08-30 17:46:19 +02:00
raysan5
92bcf09c53 Redesigned SpriteFont struct 2015-08-30 17:45:05 +02:00
raysan5
aa982f80f5 Reviewed some comments 2015-08-30 17:44:47 +02:00
raysan5
d7e7ef6a7d Added some comments 2015-08-30 17:44:14 +02:00
raysan5
055d8927cc Small code tweaks 2015-08-29 20:20:28 +02:00
raysan5
8692c49511 Corrected bug on first person camera 2015-08-29 20:20:09 +02:00
raysan5
ecd6f77de7 New textures loading examples 2015-08-29 17:01:56 +02:00
raysan5
5cfd59258a Detected issue 2015-08-29 17:01:36 +02:00
raysan5
9dd20577cd Corrected bugs on DDS and PKM loading 2015-08-29 17:01:25 +02:00
raysan5
ea45223f1f New examples added 2015-08-28 18:07:39 +02:00
raysan5
12581c1721 Changed mail address by twitter user
Probably more useful...
2015-08-28 14:17:35 +02:00
raysan5
324259ef8e Remove crappy example 2015-08-28 14:17:03 +02:00
raysan5
773360caa3 Removed resources 2015-08-28 14:16:42 +02:00
raysan5
ca402e9d36 New examples added (with some resources) 2015-08-28 14:16:28 +02:00
raysan5
6ac5d3bc06 Remove file 2015-08-28 14:14:52 +02:00
raysan5
c52ba520ce Small tweaks 2015-08-28 14:14:29 +02:00
raysan5
322ca97c24 Review camera system 2015-08-28 14:14:12 +02:00
raysan5
ef36950b72 New raylib module: raygui
Immediate Mode GUI (IMGUI)
2015-08-27 18:17:05 +02:00
raysan5
4e5f5764ce Updated 2015-08-27 16:52:54 +02:00
raysan5
3a9ed0e846 Merged master fixed conflict. 2015-08-27 16:32:06 +02:00
raysan5
997170a317 Examples reviewed 2015-08-27 16:13:49 +02:00
raysan5
8745d733f9 Replaced 3d model example resources
Cat replaced by dwarf
2015-08-27 16:13:49 +02:00
raysan5
86f683dcbb View description:
- Trying to implement rlglUnproject() - NOT WORKING
- Tested GLEW alternatives: glad and glLoadGen - NOT WORKING
2015-08-27 16:13:47 +02:00
raysan5
04d9c4c183 Some bugs corrected and trying to implement 3d picking 2015-08-27 16:13:46 +02:00
raysan5
9964935a12 Corrected bug to show cursor on free camera mode 2015-08-27 16:13:45 +02:00
raysan5
72e909f556 Added raylib 1.3 description and knowledgements 2015-08-27 16:13:44 +02:00
raysan5
0919d43dfb Updated changes 2015-08-27 16:13:44 +02:00
Ray
27e44c43c5 Depth buffer configuration 2015-08-10 10:20:53 +02:00
raysan5
07858c3a1f Reviewed ImageConvertToPOT() 2015-08-07 18:00:28 +02:00
raysan5
fd2b0c7c38 Added MSAA 4X support for EGL contexts 2015-08-07 17:25:05 +02:00
raysan5
b8b0247043 Added function SetBlendMode()
Useful to enable additive blend mode for particles
2015-08-07 17:24:28 +02:00
raysan5
6da175fccb Reviewed GetTextureData() 2015-08-07 17:23:53 +02:00
Ray
037898be56 Added some desired features to roadmap 2015-08-06 21:18:08 +02:00
Ray
82f71880e9 Smalll note added 2015-08-06 21:03:16 +02:00
Ray
0b04807258 Updated with latest changes 2015-08-05 19:20:02 +02:00
Ray
5837249d76 Updated license for 3d model dwarf 2015-08-05 19:19:15 +02:00
Ray
ba640598e5 Reviewed for standalone usage
Requires raymath as standalone and GLEW
2015-08-05 19:18:40 +02:00
Ray
a42bfa7794 Added trace log for data unloading 2015-08-05 19:17:56 +02:00
raysan5
5436d93a3d Review framebuffer creation and...
...shader loading security check
2015-08-03 17:27:53 +02:00
raysan5
36552ff995 Added security check if file not found 2015-08-03 17:27:04 +02:00
raysan5
0af2f45815 SetDefaultShader(): Solved issue 2015-07-31 12:40:33 +02:00
raysan5
39e22e98ce Added stb_vorbis lib compilation 2015-07-31 12:39:45 +02:00
raysan5
e8fa630c28 Audio module reviewed for standalone usage 2015-07-31 12:31:39 +02:00
raysan5
6e4cfa5ecf Added camera and gestures modules functions 2015-07-29 21:45:28 +02:00
raysan5
c0d8ae7f4d Decoupled some modules: audio, camera, gestures
Added window drop files support
2015-07-29 21:44:27 +02:00
raysan5
7834a4e2fc Replaced old mail by twitter user 2015-07-29 21:43:30 +02:00
raysan5
0b24330d86 Decoupling gestures system module
Now gestures system can be used as standalone module
2015-07-29 21:42:43 +02:00
raysan5
0b7c2ab183 Decoupling camera system module
Camera system can be used as standalone module
2015-07-29 21:42:11 +02:00
raysan5
f7acee9221 Decoupling audio module from raylib
Now audio module can be used as standalone module
2015-07-29 21:41:19 +02:00
Ray
8b3a82688e Merge pull request #24 from raysan5/develop
Integrate Develop branch
2015-07-28 17:38:37 +02:00
raysan5
067b884f39 Updated examples for next raylib version 2015-07-18 19:26:13 +02:00
raysan5
a98578c91d Updated minSdkVersion and added comments 2015-07-18 19:25:43 +02:00
raysan5
14d3b0a084 Corrected issue on mipmaps generations 2015-07-18 19:25:15 +02:00
raysan5
552033da27 Move shaders functions to module rlgl
Shader functionality owns to rlgl, not core module
2015-07-13 18:20:16 +02:00
raysan5
66556b8b47 Added some functions and renamed some others
Added:
- LoadImageRaw()
- ImageCopy()
Renamed:
- GetPixelData() -> GetImageData()
2015-07-13 18:19:29 +02:00
raysan5
3434255ce6 Decoupling camera system from raylib main library 2015-07-13 18:17:05 +02:00
raysan5
d686cc6c4a Some small code tweaks 2015-07-13 18:16:24 +02:00
raysan5
d50194940d Updated to raylib v1.3 2015-07-13 18:15:31 +02:00
raysan5
e30421e84c Updated to latest version 2.06 2015-07-13 18:14:47 +02:00
raysan5
c944d62374 Improved mipmaps support and image loading 2015-07-05 18:21:01 +02:00
raysan5
84befaea24 Corrected bug on GetHexValue() function 2015-07-05 18:19:49 +02:00
raysan5
2be8753788 Functions renaming for better consistency 2015-07-05 18:19:18 +02:00
Ray
a59433e7a3 Merge pull request #23 from raysan5/develop
Integrate develop branch
2015-07-03 20:49:16 +02:00
Ray
cd08ae7b85 Corrected bug on reset default shader 2015-06-24 09:57:03 +02:00
raysan5
1ec87f7990 Moved postpro texture to shader 2015-06-22 19:59:55 +02:00
raysan5
bae1bf7b0a Corrected bug on UnloadModel() 2015-06-18 03:08:21 +02:00
raysan5
024e48850e Corrected camera issue and added function 2015-06-17 19:56:52 +02:00
raysan5
9572d6c063 Updated postpro shaders system 2015-06-16 20:02:01 +02:00
raysan5
d9c5614342 Updated shader system 2015-06-16 10:52:26 +02:00
Marc Palau
4c6c182023 Corrected gesture tap issue and text scaling issue 2015-06-03 17:04:17 +02:00
Marc Palau
fca60cb597 Corrected camera issue 2015-06-03 17:01:57 +02:00
raysan5
6a4afae5cc Improved ResolveCollisionCubicmap()
Now it supports multiple maps one next to the other
2015-06-02 09:54:51 +02:00
raysan5
fd851d1d8b Improved custom shaders support
Corrected issues with textures loading
2015-05-21 14:13:51 +02:00
raysan5
9e450df053 Added extensions check on rlglInit() and more
Corrected shader version depending on OGL version
Corrected bug in gestures module
2015-05-21 00:18:22 +02:00
Gatonevermind
c7ae28aaa2 Small tweak 2015-05-18 13:12:24 +02:00
raysan5
19721c70ff Removed unused shaders 2015-05-11 18:22:29 +02:00
raysan5
e25f1227c0 Updated stb headers 2015-05-11 18:22:16 +02:00
Gatonevermind
4e4b6bef21 Corrected bug on PVR textures loading 2015-05-11 17:37:19 +02:00
raysan5
a7714c842f raymath module review and other changes
Complete review of matrix rotation math
Check compressed textures support
WIP: LoadImageFromData()
2015-05-11 00:15:46 +02:00
raysan5
eae98e1c34 Big batch of changes, check description:
- Camera system moved to a separate module [camera.c]
- WIP: Added customization functions for camera controls
- Added custom shaders support on batch drawing
- Complete redesign of textures module to support multiple texture
formats (compressed and uncompressed)
2015-05-04 23:46:31 +02:00
raysan5
ba257b09f5 Corrected input bug 2015-04-22 19:12:59 +02:00
raysan5
05fe1c22ed Updated to latest version 2015-04-22 18:37:09 +02:00
raysan5
7db895ab5d Corrected some bugs and warnings 2015-04-22 18:36:52 +02:00
Marc Palau
ceb7325727 Added Gestures System for Android and Web 2015-04-22 17:34:42 +02:00
raysan5
7d2318c167 WIP on shaders and textures
Moved functions: LoadShader(), UnloadShader()
Add support for PVR textures compressed/uncompressed
WIP: Detect available extensions for compressed textures
2015-04-13 20:15:28 +02:00
raysan5
a632a04a30 Big batch of changes! Check description:
Support multiple texture formats (uncompressed and compressed)
Postprocessing shaders support
Model struct redefined and improved
Extended loading functions for Textures and Models
Simplified functions: DrawPlane(), DrawQuad()
Deleted functions: DrawPlaneEx(), DrawGizmoEx()
Now Text module only depends on Textures module
Shapes: Reviewed functions to low lines/triangles usage
Removed useless tabs and spaces around code
2015-04-06 14:02:29 +02:00
nicobwah
2b4a1f295a Added support for Latin-1 Supplement characters
Extended default raylib font system to support Latin-1 Supplement
characters
2015-03-09 17:13:42 +01:00
Marc Palau
3cad094edd Changes integration (some WIP, view details)
Corrected GetMouseWheelMove()
Corrected camera system
Reviewed cubicmap resolution (collision detection)
Added QuaternionTransform()
WIP: Raycast system (not working)
WIP: Reviewing axis-angle rotations...
2015-03-02 20:52:58 +01:00
raysan5
c062f8d4fe Redesign shader system and more
Shader system has been completely redesigned
Added support for multiple texture color modes
2015-03-01 16:00:52 +01:00
raysan5
ee4b553c2a Renamed some functions 2015-02-26 13:52:03 +01:00
Marc Palau
3cb4edcbc3 Corrected camera system 2015-02-09 18:35:43 +01:00
raysan5
e1353b9f7d Removed some TODO already done 2015-02-09 18:29:32 +01:00
Ray
47827ddda1 Merge pull request #22 from procedural/hide-mouse
Functions to show and hide mouse cursor at runtime
2015-02-06 00:31:22 +01:00
Ray
387795311c Merge pull request #20 from procedural/cpp-fixes
Fixes for C++, bool type already defined
2015-02-06 00:21:37 +01:00
Marc Palau
77eda6494e Added cubicmap collision detection and resolution 2015-02-04 20:24:23 +01:00
Marc Palau
b25cdf7f7d Added support for multiple camera modes 2015-02-04 20:23:43 +01:00
Constantine Tarasenkov
765870fe8f No need to include raylib.h 2015-02-03 20:16:27 +03:00
Constantine Tarasenkov
cc6cf9a741 Adding functions to show and hide mouse cursor 2015-02-03 05:47:28 +03:00
Constantine Tarasenkov
ab12193f10 Fixes for C++ 2015-02-03 00:06:50 +03:00
Marc Palau
b926765ce0 Added functions and improvements
LoadCubicmap() supports custom texture rectangle (from texture atlas)
for every cubic-face.
CheckCollision*() for spheres and bounding-boxes.
2015-02-02 20:05:18 +01:00
raysan5
9ab6718234 Corrected bug, OGG loading on Android 2015-02-02 16:39:30 +01:00
raysan5
42c92e4f2e Add support for custom shaders
Custom shaders for models
Postprocessig on FBO (in progress)
Some useless spaces removed
2015-02-02 00:57:08 +01:00
raysan5
b9e53cd135 Removed useless spaces 2015-02-02 00:53:49 +01:00
Ray
dc52c8f769 Updated GLFW libs to 3.1
Recompiled by procedural! Thanks!
2015-01-26 22:11:59 +01:00
Ray
032c8333d9 Merge pull request #19 from procedural/linux
Fixes for makefiles, GLFW 3.1 library for Linux
2015-01-26 22:05:52 +01:00
Constantine Tarasenkov
b92c1bbbf7 Fixes for makefiles, GLFW 3.1 library for Linux 2015-01-25 17:53:29 +03:00
Ray
f5048742aa JUST DO - Global Game Jam 2015 2015-01-25 14:46:11 +01:00
Ray
e9ea3f50bf Updated GLFW to version 3.1 2015-01-24 14:40:39 +01:00
Ray
a9e045a1a8 Pause loop execution on window minimized 2015-01-21 00:13:17 +01:00
Ray
7d0407c6a2 Pause music when window minimized 2015-01-21 00:12:54 +01:00
Ray
c00cd38b01 Small note to remember 2015-01-21 00:12:30 +01:00
raysan5
e96c22d6f8 Updated makefiles for templates
Now support multiple platforms
2015-01-18 11:19:25 +01:00
raysan5
874dc89fca Adding support for TTF fonts (in progress) 2015-01-18 10:58:04 +01:00
raysan5
5104567a24 Some code tweaks 2015-01-18 10:57:30 +01:00
raysan5
2968ba9938 Ignore compiled binaries on templates (*.o, *.exe) 2015-01-18 10:56:37 +01:00
Ray
cae6f3c613 Merge pull request #16 from raysan5/develop
Integration from develop branch to master
2015-01-10 13:28:45 +01:00
raysan5
bb8c1826d3 Uploaded basic window example for web 2015-01-10 13:26:34 +01:00
Ray
274921cd35 Update README.md 2015-01-10 13:25:07 +01:00
Ray
39fda7af82 Merge pull request #15 from Galloman/develop
Improved support for mac osx.
2015-01-10 11:56:10 +01:00
David Gallardo
31934ac374 Improved support for mac.
Reference to libglfw dylib fixed
2015-01-08 22:09:29 +01:00
raysan5
d739895e4a Reorganized external folders by platform
Improved makefiles!
2015-01-08 21:10:06 +01:00
Ray
e37ef10595 Merge pull request #14 from raysan5/master
Integrate master into develop branch
2015-01-08 20:32:30 +01:00
raysan5
4a7e522d4b Review build system for Android and RPI 2015-01-04 18:05:50 +01:00
raysan5
b2a5390adb Added some last hour features to v1.2.2 2015-01-02 21:06:30 +01:00
raysan5
0bfd283526 Added support for model color tint
Also, added support for normals on models
2015-01-02 20:59:54 +01:00
raysan5
7ea8326b52 makefiles reorganization
Edited to better accomodate to multiple platforms
2015-01-02 20:59:05 +01:00
raysan5
8847602061 Examples review... 2015-01-02 20:58:06 +01:00
Ray
e6bc655d6a Rename models_cubesmap.c to models_cubicmap.c 2015-01-02 20:51:14 +01:00
raysan5
061ee04cb5 Integrated ratalaika pull-request
Added first version of OS X compilation support
Some conflicts manually resolved...
2015-01-02 10:18:43 +01:00
Ray
3c4a91658e Merge pull request #12 from raysan5/develop
Integration from develop branch
2014-12-31 19:28:38 +01:00
raysan5
fad81f36e4 Updated docs 2014-12-31 19:25:50 +01:00
raysan5
b482e26925 Small tweaks 2014-12-31 19:25:39 +01:00
raysan5
7ec6ebb9fa New raylib release, including html5 binaries 2014-12-31 19:25:16 +01:00
raysan5
5a98d2da1f Added raylib game showing raylib features 2014-12-31 19:24:51 +01:00
raysan5
21d8394170 Added small floppy game 2014-12-31 19:18:16 +01:00
raysan5
5e913c31a4 Updated example 2014-12-31 19:17:50 +01:00
raysan5
d51d6a4650 Prepare examples makefile to support emscripten 2014-12-31 19:17:41 +01:00
raysan5
3c57c6afc5 Updated to version 2.00b 2014-12-31 18:03:48 +01:00
raysan5
905b6ec53d Added full support for HTML5 (emscripten)
Corrected some bugs on the way...
Automatically convert textures to POT on RPI and WEB
2014-12-31 18:03:32 +01:00
raysan5
08a4ee34eb [texture] image data initialization 2014-12-17 19:47:17 +01:00
raysan5
1bd592fe67 [texture] image loading small check 2014-12-17 19:33:53 +01:00
raysan5
db1ad74ef2 [models] file open error check 2014-12-17 19:32:54 +01:00
raysan5
2e5f58255a Working on rotation math...
[models] Added DrawQuad()
2014-12-16 11:15:56 +01:00
raysan5
cfa60ab7e6 Added support for emscripten and more
Added PLATFORM_WEB support (emscripten-webgl)
[audio] Added LoadSoundFromWave()
[textures] Added LoadTextureFromImage() to replace CreateTexture()
Some TraceLogs edited...
2014-12-15 01:08:30 +01:00
raysan5
d3cf316e40 Added features and corrected bugs...
[core] Added SetMousePosition()
[models] LoadHeightmap() - Corrected textures bug
[raymath] Functions renaming
[WEB] Prepare environment for emscripten!
2014-12-09 13:21:55 +01:00
Palaui
a2c8ddca13 Revert "Corrected some bugs..."
This reverts commit 29d8b48503.
2014-12-09 13:10:28 +01:00
Palaui
29d8b48503 Corrected some bugs...
[core] Added SetMousePosition()
[models] LoadHeightmap() - Corrected textures bug
[raymath] Functions renaming
[WEB] Prepare environment for emscripten!
2014-12-09 13:10:05 +01:00
Ray
0c60609268 Merge pull request #11 from raysan5/develop
Develop branch integration
2014-11-24 20:14:58 +01:00
Palaui
63ed471ed2 Corrected bug on billboards 2014-11-24 17:23:05 +01:00
Ray
d16519f5de Merge pull request #9 from raysan5/master
Populate master changes to develop branch
2014-11-24 16:05:41 +01:00
raysan5
fcff83e65c Corrected Android bug on Native Activity cycle 2014-11-23 21:58:45 +01:00
raysan5
7375d0460a Updated stb headers 2014-11-23 21:58:17 +01:00
ratalaika
2706fa86cd Cleaned GLFW library for OS X 2014-11-22 00:23:25 +01:00
ratalaika
6bea9d0232 Added first version of OS X compilation support 2014-11-22 00:13:59 +01:00
ratalaika
ab05ace3ce Added first version of OS X compilation support 2014-11-22 00:13:09 +01:00
Ray
05ccc4fd42 Merge pull request #5 from debiatan/support_linux_desktop
Small fixes to support the Debian/GNU Linux distro. Hopefully Ubuntu too.
2014-11-09 13:39:27 +01:00
Miguel Lechón
a471b6197a Renamed the PLATFORM_LINUX_DESKTOP into PLATFORM_DESKTOP_LINUX. 2014-11-09 13:18:32 +01:00
Miguel Lechón
db2ad9648d Small fixes to support a Debian/GNU Linux distro. Hopefully Ubuntu too. 2014-11-09 12:07:03 +01:00
Ray
45b214d83e Merge pull request #3 from debiatan/fix_audio_64
Fixed WAV loading under 64-bit systems.
2014-11-09 11:29:13 +01:00
Miguel Lechón
e6ef3f6e6a Fixed WAV loading under 64-bit systems. 2014-11-09 08:06:58 +01:00
raysan5
9d27bba23f Small Fixes Update (1.2.1)
View CHANGELOG for description on small fixes and add-ons
2014-10-17 21:11:58 +02:00
Ray
063e26c521 Corrected issue with transparent surface in Raspberry Pi 2014-09-30 18:22:21 +02:00
Ray
9b5e66f5ea Added required linker libs 2014-09-30 18:15:04 +02:00
Ray
d025230707 Added required linker libs 2014-09-30 18:14:36 +02:00
Ray
c790891e60 Added required linker libs 2014-09-30 18:14:08 +02:00
Ray
78a660d409 Added required linker libs 2014-09-30 18:13:40 +02:00
Ray
4040f9095d Added required linker libs 2014-09-30 18:13:16 +02:00
Ray
d95f743b6f Added required linker libs 2014-09-30 18:12:27 +02:00
raysan5
5eff7d2642 Updated example filename 2014-09-30 00:00:52 +02:00
raysan5
51688c004c Code cleaning, removed useless spaces 2014-09-29 23:41:05 +02:00
raysan5
e2ff32eb84 Updated example screenshot 2014-09-28 01:53:40 +02:00
Ray
c79a46889f Update makefile 2014-09-28 01:47:40 +02:00
Ray
735bf98945 Update and rename shapes_color_palette.c to shapes_colors_palette.c 2014-09-28 00:45:14 +02:00
Ray
86446c6102 Update CHANGELOG 2014-09-21 18:39:12 +02:00
raysan5
0287319c38 Image renaming 2014-09-21 18:25:19 +02:00
raysan5
5ecb6801fa Examples renaming and test examples merge
Examples have been renamed for coherence with raylib modules and test
examples have been merged into examples folder.
2014-09-21 14:26:42 +02:00
Ray
3a0d164a76 Rename ex07c_3d_models.c to models_obj_loading.c 2014-09-21 14:13:05 +02:00
Ray
c389f62837 Rename ex07b_3d_shapes.c to models_geometric_shapes.c 2014-09-21 14:11:42 +02:00
Ray
b648a9ddee Rename ex07a_3d_mode.c to core_3d_mode.c 2014-09-21 14:11:15 +02:00
Ray
597b143634 Rename ex06c_font_select.c to text_font_select.c 2014-09-21 14:10:53 +02:00
Ray
1b2225a622 Rename ex06b_logo_anim.c to shapes_logo_raylib_anim.c 2014-09-21 14:10:33 +02:00
Ray
0cdeb4e267 Rename ex08_audio.c to audio_sound_loading.c 2014-09-21 14:10:03 +02:00
Ray
d09b9fbbde Rename ex06a_color_select.c to core_color_select.c 2014-09-21 14:09:36 +02:00
Ray
c40b3a287c Rename ex05b_rbmf_fonts.c to text_rbmf_fonts.c 2014-09-21 14:09:11 +02:00
Ray
1195025c4c Rename ex05a_sprite_fonts.c to text_sprite_fonts.c 2014-09-21 14:08:58 +02:00
Ray
a99ce2f306 Rename ex04b_texture_rectangle.c to textures_rectangle.c 2014-09-21 14:08:41 +02:00
Ray
9d47934a02 Rename ex04a_textures.c to textures_logo_raylib.c 2014-09-21 14:08:16 +02:00
Ray
3b6e5119f3 Rename ex03c_input_gamepad.c to core_input_gamepad.c 2014-09-21 14:07:48 +02:00
Ray
42b1cb1aaa Rename ex03b_input_mouse.c to core_input_mouse.c 2014-09-21 14:07:20 +02:00
Ray
1989b9fcd9 Rename ex03a_input_keys.c to core_input_keys.c 2014-09-21 14:07:04 +02:00
Ray
34d0851f79 Rename ex02c_color_palette.c to shapes_color_palette.c 2014-09-21 14:06:47 +02:00
Ray
b6d0e3adb2 Rename ex02b_basic_shapes.c to shapes_basic_shapes.c 2014-09-21 14:06:19 +02:00
Ray
07129b26c3 Rename ex02a_logo_raylib.c to shapes_logo_raylib.c 2014-09-21 14:06:00 +02:00
Ray
d25b56f6d4 Rename ex01_basic_window.c to core_basic_window.c 2014-09-21 14:05:04 +02:00
raysan5
42b7b11710 Android: Added support for Tap gesture 2014-09-19 12:34:25 +02:00
raysan5
e915812730 Updated with latest addition 2014-09-18 19:22:06 +02:00
raysan5
ace185954c Android project template for basic game
A basic Android template is provided to start a game
2014-09-18 19:02:12 +02:00
raysan5
1ef1f3d7ea Multiple templates to start a game
Some basic to advance templates are provided to be use as base code for
new games
2014-09-18 19:00:30 +02:00
raysan5
815f90974c Updated to ignore *.exe 2014-09-18 18:56:22 +02:00
raysan5
a08e0929bc Updated ignorable files 2014-09-18 18:52:28 +02:00
Ray
d86c5e3950 Update README.md 2014-09-16 23:25:31 +02:00
raysan5
278f82e536 Style formatting 2014-09-16 23:12:56 +02:00
raysan5
983cc8d291 Android project to compile raylib src 2014-09-16 23:10:27 +02:00
raysan5
8e2680f41f raylib 1.2 release files
Default libraylib.a uses OpenGL 1.1 to maximize compatibility
2014-09-16 22:54:42 +02:00
raysan5
fc6081fe70 raylib 1.2
This is a huge update. Check CHANGELOG for details
2014-09-16 22:51:31 +02:00
raysan5
01651af08a Update examples and remove .exe 2014-09-16 11:30:25 +02:00
raysan5
c56ef738ed Explicit define of functions prototypes
No-parameters functions use the prototype style FunctionName(void);
2014-09-03 17:06:10 +02:00
raysan5
d2b98fbb5c Removed useless spaces 2014-09-03 16:51:28 +02:00
367 changed files with 94964 additions and 14163 deletions

21
.gitignore vendored
View File

@@ -1,17 +1,11 @@
# Ignore generated files # Ignore generated files
# ... # ...
# Ignore compiled binaries # Ignore Android generated files and folders
src/core.o src_android/obj/
src/shapes.o templates/android_project/bin/
src/textures.o templates/android_project/obj/
src/text.o templates/android_project/libs/
src/models.o
src/audio.o
src/vector3.o
src/stb_image.o
src/*.exe
examples/*.o
# Ignore thumbnails created by windows # Ignore thumbnails created by windows
Thumbs.db Thumbs.db
@@ -48,6 +42,11 @@ _ReSharper*/
ipch/ ipch/
*.opensdf *.opensdf
# Ignore compiled binaries
*.o
*.exe
!tools/rrem.exe
# Ignore files build by xcode # Ignore files build by xcode
*.mode*v* *.mode*v*
*.pbxuser *.pbxuser

115
CHANGELOG
View File

@@ -1,11 +1,122 @@
changelog changelog
--------- ---------
Current Release: raylib 1.1.1 (22 July 2014) Current Release: raylib 1.3.0 (03 September 2015)
NOTE: Only versions marked as 'Release' are available on release folder, 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.3.0 (01 September 2015)
-----------------------------------------------
NOTE:
This version supposed a big boost for raylib, new modules have been added with lots of features.
Most of the modules have been completely reviewed to accomodate to the new features.
Over 50 new functions have been added to previous raylib version.
Most of the examples have been redone and +10 new advanced examples have been added.
BIG changes:
[rlgl] SHADERS: Support for model shaders and postprocessing shaders (multiple functions)
[textures] FORMATS: Support for multiple internal formats, including compressed formats
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
[gestures] NEW MODULE: Gestures system for Android and HTML5 platforms
[raygui] NEW MODULE: Set of IMGUI elements for tools development (experimental)
smaller changes:
[rlgl] Added check for OpenGL supported extensions
[rlgl] Added function SetBlenMode() to select some predefined blending modes
[core] Added support for drop&drag of external files into running program
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
[core] Renamed function SetFlags() to SetConfigFlags()
[shapes] Simplified some functions to improve performance
[textures] Review of Image struct to support multiple data formats
[textures] Added function LoadImageEx()
[textures] Added function LoadImageRaw()
[textures] Added function LoadTextureEx()
[textures] Simplified function parameters LoadTextureFromImage()
[textures] Added function GetImageData()
[textures] Added function GetTextureData()
[textures] Renamed function ConvertToPOT() to ImageConvertToPOT()
[textures] Added function ImageConvertFormat()
[textures] Added function GenTextureMipmaps()
[text] Added support for Latin-1 Extended characters for default font
[text] Redesigned SpriteFont struct, replaced Character struct by Rectangle
[text] Removed function GetFontBaseSize(), use directly spriteFont.size
[models] Review of struct: Model (added shaders support)
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
[models] Added function DrawCubeTexture()
[models] Added function DrawQuad()
[models] Added function DrawRay()
[models] Simplified funtion DrawPlane()
[models] Removed function DrawPlaneEx()
[models] Simplified funtion DrawGizmo()
[models] Removed function DrawGizmoEx()
[models] Added function LoadModelEx()
[models] Review of function LoadCubicMap()
[models] Added function ResolveCollisionCubicmap()
[audio] Decopupled from raylib, now this module can be used as standalone
[audio] Added function UpdateMusicStream()
[raymath] Complete review of the module
[stb] Updated to latest headers versions
[*] Lots of tweaks around
-----------------------------------------------
Release: raylib 1.2.2 (31 December 2014)
-----------------------------------------------
[*] Added support for HTML5 compiling (emscripten, asm.js)
[core] Corrected bug on input handling (keyboard and mouse)
[textures] Renamed function CreateTexture() to LoadTextureFromImage()
[textures] Added function ConvertToPOT()
[rlgl] Added support for color tint on models on GL 3.3+ and ES2
[rlgl] Added support for normals on models
[models] Corrected bug on DrawBillboard()
[models] Corrected bug on DrawHeightmap()
[models] Renamed LoadCubesmap() to LoadCubicmap()
[audio] Added function LoadSoundFromWave()
[makefile] Added support for Linux and OSX compiling
[stb] Updated to latest headers versions
[*] Lots of tweaks around
---------------------------------------------------------------
Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update)
---------------------------------------------------------------
[core] Added function SetupFlags() to preconfigure raylib Window
[core] Corrected bug on fullscreen mode
[rlgl] rlglDrawmodel() - Added rotation on Y axis
[text] MeasureTextEx() - Corrected bug on measures for default font
-----------------------------------------------
Release: raylib 1.2 (16 September 2014)
-----------------------------------------------
NOTE:
This version supposed a complete redesign of the [core] module to support Android and Raspberry Pi.
Multiples modules have also been tweaked to accomodate to the new platforms, specially [rlgl]
[core] Added multiple platforms support: Android and Raspberry Pi
[core] InitWindow() - Complete rewrite and split for Android
[core] InitDisplay() - Internal function added to calculate proper display size
[core] InitGraphics() - Internal function where OpenGL graphics are initialized
[core] Complete refactoring of input functions to accomodate to new platforms
[core] Mouse and Keyboard raw data reading functions added for Raspberry Pi
[core] GetTouchX(), GetTouchY() - Added for Android
[core] Added Android callbacks to process inputs and Android activity commands
[rlgl] Adjusted buffers depending on platform
[rlgl] Added security check in case deployed vertex excess buffer size
[rlgl] Adjusted indices type depending on GL version (int or short)
[rlgl] Fallback to VBOs only usage if VAOs not supported on ES2
[rlgl] rlglLoadModel() stores vbo ids on new Model struct
[textures] Added support for PKM files (ETC1, ETC2 compression support)
[shapes] DrawRectangleV() - Modified, depending on OGL version uses TRIANGLES or QUADS
[text] LoadSpriteFont() - Modified to use LoadImage()
[models] Minor changes on models loading to accomodate to new Model struct
[audio] PauseMusicStream(), ResumeMusicStream() - Added
[audio] Reduced music buffer size to avoid stalls on Raspberry Pi
[src] Added makefile for Windows and RPI
[src] Added resources file (raylib icon and executable info)
[examples] Added makefile for Windows and RPI
[examples] Renamed and merged with test examples for coherence with module names
[templates] Added multiple templates to be use as a base-code for games
----------------------------------------------- -----------------------------------------------
Release: raylib 1.1.1 (22 July 2014) Release: raylib 1.1.1 (22 July 2014)
----------------------------------------------- -----------------------------------------------

View File

@@ -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.

View File

@@ -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 Daniel 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/.

245
README.md
View File

@@ -5,10 +5,12 @@ about
raylib is a simple and easy-to-use library to learn videogames programming. raylib is a simple and easy-to-use library to learn videogames programming.
raylib is highly inspired by Borland BGI graphics lib (more specifically WinBGI) and by XNA framework. raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
Allegro and SDL have also been analyzed for reference. Allegro and SDL have also been analyzed for reference.
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm) NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming;
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.htm)
history history
------- -------
@@ -42,10 +44,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
@@ -53,28 +55,78 @@ support of DDS texture files (compressed and uncompressed) along with mipmaps su
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1. Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
Enjoy it. notes on raylib 1.2
-------------------
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
system has been written from scratch.
A new display initialization system has been created to support multiple resolutions, adding black bars if required;
user only defines desired screen size and it gets properly displayed.
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
notes on raylib 1.3
-------------------
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
in this release, check raylib/shaders folder.
Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.),
including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
primary intended for tools development. It's still in experimental state but already fully functional.
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
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: [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
* Powerful fonts module with SpriteFonts support * Powerful fonts module with SpriteFonts support
* Multiple textures support, including DDS and mipmaps generation * Outstanding texture formats support, including compressed formats
* 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 * 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**
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
window/context and input management (clean, focused, great license, well documented, modern, ...). multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
raylib is licensed under a zlib/libpng license like GLFW3. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md). raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
to accomodate to Android, Raspberry Pi and HTML5.
tool requirements On Android, raylib uses `native_app_glue module` (provided on Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
tools requirements
------------------ ------------------
raylib has been developed using exclusively two tools: raylib has been developed using exclusively two tools:
@@ -88,41 +140,131 @@ I believe those are the best tools to train spartan-programmers.
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way. to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
Since raylib v1.1, you can download a windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/) Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
building building source (generate libraylib.a)
-------- --------------------------------------
raylib could be build with the following command lines (Using GCC compiler): **Building raylib sources on desktop platforms:**
cd raylib/src _Step 1:_ Using MinGW make tool, just navigate from command line to `raylib/src/` folder and type:
gcc -c core.c -std=c99 -Wall
gcc -c shapes.c -std=c99 -Wall
gcc -c textures.c -std=c99 -Wall
gcc -c text.c -std=c99 -Wall
gcc -c models.c -std=c99 -Wall
gcc -c raymath.c -std=c99 -Wall
gcc -c rlgl.c -std=c99 -Wall
gcc -c audio.c -std=c99 -Wall
gcc -c utils.c -std=c99 -Wall
gcc -c stb_image.c -std=c99 -Wall
gcc -c stb_vorbis.c -std=c99 -Wall
ar rcs libraylib.a core.o shapes.o textures.o stb_image.o text.o models.o raymath.o rlgl.o utils.o stb_vorbis.o audio.o
To compile examples, make sure raylib.h is placed in the include path and the following libraries are placed in the libraries path: 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 downloading the [Portable Emscripten SDK for Windows](https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-1.25.0-portable-64bit.zip) and decompress it in `C:\emsdk-1.25.0` folder. After that, follow the portable version installation instructions.
_Step 2._ Open `raylib/src/makefile` on Notepad++ and run the script named `raylib_makefile_emscripten`
building examples
-----------------
**Building raylib examples on desktop platforms:**
_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:
libraylib.a - raylib
libglfw3.a - GLFW3 (static version) libglfw3.a - GLFW3 (static version)
libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2 libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2
libopenal32.a - OpenAL, audio device management libopenal32.a - OpenAL Soft, audio device management
It's also recommended to link with file icon.o for fancy raylib icon usage. Linking command:
cd raylib/examples **Building raylib examples on Raspberry Pi:**
gcc -o test_code.exe test_code.c icon.o -lraylib -lglfw3 -lglew32 -lopenal32 -lopengl32 -lgdi32 -std=c99 -Wl,--subsystem,windows
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
If you have any doubt, [let me know][raysan5].
sudo apt-get install openal1
_Step 2._ Navigate from command line to `raylib/examples/` folder and type:
make
**Building raylib examples for HTML5 (emscripten):**
_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 downloading the [Portable Emscripten SDK for Windows](https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-1.25.0-portable-64bit.zip) and decompress it in `C:\emsdk-1.25.0` folder. After that, follow the portable version installation instructions.
_Step 2._ Open `raylib/examples/makefile` on Notepad++ and run the script named `raylib_makefile_emscripten`
NOTE: At this moment, raylib examples are not ready to directly compile for HTML5, code needs to be reorganized due to the way web browsers work. To see how code should be refactored to fit compilation for web, check [core_basic_window_web.c](https://github.com/raysan5/raylib/blob/master/examples/core_basic_window_web.c) example.
**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
------- -------
@@ -133,16 +275,23 @@ contact
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) - [Zopokx](https://github.com/Zopokx) for testing the web.
- [Elendow](http://www.elendow.com) - [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual - Victor Dual for implementating and testing of 3D shapes functions.
- Marc Palau - 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.
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San" [raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San"

View File

@@ -4,19 +4,22 @@ 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 I would like to improve.
Here it is a list of features I would like to add and functions to improve. Here it is a 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. Around the source code there are multiple TODO points with pending revisions/bugs and here it is a list of desired features.
raylib v1.x raylib v1.4
- [DONE] Review Billboard Drawing functions - TTF fonts support (using stb_truetype)
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model - Raycast system for 3D picking (including collisions detection)
- Lighting support (only 3d mode) - Remove GLEW dependency (use another solution... glad?)
- [DONE] Simple Collision Detection functions - Floyd-Steinberg dithering on 16bit image format conversion
- Default scene Camera controls (zoom, pan, rotate) - Basic image manipulation functions (crop, resize, draw...)
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular) - Basic image procedural generation (spot, gradient, noise...)
- [DONE] Software mipmapping generation and POT conversion (custom implementation) - Basic GPU stats sytem (memory, draws, time...)
- TTF fonts support - LUA scripting support (wrapper to lua lib)
Check [GITHUB ISSUES][issues] for further details on implementation status for this features!
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:raysan@raysanweb.com "Ramon Santamaria - Ray San"
[isssues]: https://github.com/raysan5/raylib/issues

View File

@@ -1,13 +1,13 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Music playing (streaming) * raylib [audio] example - Music playing (streaming)
* *
* NOTE: This test requires OpenAL32 dll installed (or in the same folder) * NOTE: This example requires OpenAL Soft library installed
* *
* This test has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -19,58 +19,64 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - music playing (streaming)"); InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
InitAudioDevice(); // Initialize audio device InitAudioDevice(); // Initialize audio device
PlayMusicStream("resources/audio/deserve_to_be_loved.ogg"); // Load Music file PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
int framesCounter = 0; int framesCounter = 0;
float volume = 1.0;
float timePlayed = 0; float timePlayed = 0;
//float volume = 1.0;
SetTargetFPS(60);
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
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
framesCounter++; framesCounter++;
// Testing music fading // Testing music fading from one file to another
/* /*
if (framesCounter > 600) if (framesCounter > 600) // Wait for 10 seconds (600 frames)
{ {
volume -= 0.01; volume -= 0.01; // Decrement music volume level
// When music volume level equal or lower than 0,
// restore volume level and init another music file
if (volume <= 0) if (volume <= 0)
{ {
volume = 1.0; volume = 1.0;
framesCounter = -600; framesCounter = 0;
PlayMusicStream("resources/audio/destiny.ogg"); PlayMusicStream("resources/audio/another_file.ogg");
} }
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
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY); DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY);
DrawRectangle(200, 250, 400, 12, LIGHTGRAY); DrawRectangle(200, 250, 400, 12, LIGHTGRAY);
DrawRectangle(200, 250, (int)timePlayed, 12, MAROON); DrawRectangle(200, 250, (int)timePlayed, 12, MAROON);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -78,9 +84,9 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped) CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,13 +1,13 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 08 - Audio loading and playing * raylib [audio] example - Sound loading and playing
* *
* NOTE: This example requires OpenAL32 dll installed (or in the same folder) * NOTE: This example requires OpenAL Soft library installed
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -19,42 +19,48 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing"); InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
InitAudioDevice(); // Initialize audio device InitAudioDevice(); // Initialize audio device
Sound fx = 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
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound! if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav); // Play WAV sound
if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY); DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY);
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadSound(fx); // Unload sound data UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
CloseAudioDevice(); // Close audio device CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View 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
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
// 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, 2, 4 }; // 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, 0, 0 }, (Vector2){ 32, 32 }, LIGHTGRAY); // Draw ground
DrawCube((Vector3){ -16, 2.5, 0 }, 1, 5, 32, BLUE); // Draw a blue wall
DrawCube((Vector3){ 16, 2.5, 0 }, 1, 5, 32, LIME); // Draw a green wall
DrawCube((Vector3){ 0, 2.5, 16 }, 32, 5, 1, GOLD); // Draw a yellow wall
// Draw some cubes around
for (int i = 0; i < MAX_COLUMNS; i++)
{
DrawCube(positions[i], 2, heights[i], 2, colors[i]);
DrawCubeWires(positions[i], 2, heights[i], 2, 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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,75 @@
/*******************************************************************************************
*
* 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 = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Vector3 cubePosition = { 0.0, 0.0, 0.0 };
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(WHITE);
Begin3dMode(camera);
DrawCube(cubePosition, 2, 2, 2, RED);
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
DrawGrid(10.0, 1.0);
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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07a - Initialize 3d mode * raylib [core] example - Initialize 3d mode
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,13 +18,16 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
// 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.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode"); Vector3 cubePosition = { 0.0, 0.0, 0.0 };
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now...
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
@@ -32,25 +35,26 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// TODO: Update your variables here // TODO: Update your variables here
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(WHITE); ClearBackground(WHITE);
Begin3dMode(camera); Begin3dMode(camera);
DrawCube(position, 2, 2, 2, RED); DrawCube(cubePosition, 2, 2, 2, RED);
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
DrawGrid(10.0, 1.0); DrawGrid(10.0, 1.0);
End3dMode(); End3dMode();
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY); DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -59,6 +63,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Load and draw a 3d model (OBJ) * raylib [core] example - Picking in 3d mode
* *
* This test has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,62 +18,66 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
// 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 = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Vector3 cubePosition = { 0.0, 1.0, 0.0 };
InitWindow(screenWidth, screenHeight, "raylib test - 3d models in OpenGL 3.3+"); Ray ray; // Picking line ray
Texture2D texture = LoadTexture("resources/catwhite.png"); SetCameraMode(CAMERA_FREE); // Set a free camera mode
Model cat = LoadModel("resources/cat.obj"); SetCameraPosition(camera.position); // Set internal camera position to match our camera position
SetModelTexture(&cat, texture); 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)) position.x -= 0.2; UpdateCamera(&camera); // Update internal camera and our camera
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
//----------------------------------------------------------------------------------
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
// NOTE: This function is NOT WORKING properly!
ray = GetMouseRay(GetMousePosition(), camera);
// TODO: Check collision between ray and box
}
//----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawModel(cat, position, 0.1f, BEIGE); // OK_GL11, OK_GL33
//DrawModelWires(cat, position, 0.1f, RED); // OK_GL11, OK_GL33
DrawGrid(10.0, 1.0); // Draw a grid ClearBackground(RAYWHITE);
DrawGizmo(position); Begin3dMode(camera);
DrawCube(cubePosition, 2, 2, 2, GRAY);
DrawCubeWires(cubePosition, 2, 2, 2, DARKGRAY);
DrawGrid(10.0, 1.0);
DrawRay(ray, MAROON);
End3dMode(); End3dMode();
DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY);
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture CloseWindow(); // Close window and OpenGL context
UnloadModel(cat); // Unload model
CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,11 +1,21 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 01 - Basic Window * raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
*
* Enjoy using raylib. :)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -17,10 +27,10 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window"); InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
@@ -28,23 +38,23 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// TODO: Update your variables here // TODO: Update your variables here
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View 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();
//----------------------------------------------------------------------------------
}

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 06a - Color selection by mouse (collision detection) * raylib [core] example - Color selection by mouse (collision detection)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -17,78 +17,78 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 400; int screenHeight = 400;
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN, Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW, GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
GREEN, SKYBLUE, PURPLE, BEIGE }; GREEN, SKYBLUE, PURPLE, BEIGE };
Rectangle recs[21]; // Rectangles array Rectangle colorsRecs[21]; // Rectangles array
// Fills recs data (for every rectangle) // Fills colorsRecs data (for every rectangle)
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
{ {
recs[i].x = 20 + 100*(i%7) + 10*(i%7); colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
recs[i].y = 40 + 100*(i/7) + 10*(i/7); colorsRecs[i].y = 40 + 100*(i/7) + 10*(i/7);
recs[i].width = 100; colorsRecs[i].width = 100;
recs[i].height = 100; colorsRecs[i].height = 100;
} }
bool selected[21] = { false }; // Selected rectangles indicator bool selected[21] = { false }; // Selected rectangles indicator
Vector2 mousePoint; Vector2 mousePoint;
InitWindowEx(screenWidth, screenHeight, "raylib example 06a - color selection", false, "resources/mouse.png"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second
SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
mousePoint = GetMousePosition(); mousePoint = GetMousePosition();
for (int i = 0; i < 21; i++) // Iterate along all the rectangles for (int i = 0; i < 21; i++) // Iterate along all the rectangles
{ {
if (CheckCollisionPointRec(mousePoint, recs[i])) if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
{ {
colors[i].a = 120; colors[i].a = 120;
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i]; if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
} }
else colors[i].a = 255; else colors[i].a = 255;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
for (int i = 0; i < 21; i++) // Draw all rectangles for (int i = 0; i < 21; i++) // Draw all rectangles
{ {
DrawRectangleRec(recs[i], colors[i]); DrawRectangleRec(colorsRecs[i], colors[i]);
// Draw four rectangles around selected rectangle // Draw four rectangles around selected rectangle
if (selected[i]) if (selected[i])
{ {
DrawRectangle(recs[i].x, recs[i].y, 100, 10, RAYWHITE); // Square top rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE); // Square top rectangle
DrawRectangle(recs[i].x, recs[i].y, 10, 100, RAYWHITE); // Square left rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE); // Square left rectangle
DrawRectangle(recs[i].x + 90, recs[i].y, 10, 100, RAYWHITE); // Square right rectangle DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE); // Square right rectangle
DrawRectangle(recs[i].x, recs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
} }
} }
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,13 +1,13 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - OGG audio loading and playing * raylib [core] example - Windows drop files
* *
* NOTE: This test requires OpenAL32 dll installed (or in the same folder) * This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
* *
* This test has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -19,42 +19,58 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
InitWindow(screenWidth, screenHeight, "raylib test - ogg audio loading and playing"); int count = 0;
char **droppedFiles;
InitAudioDevice(); // Initialize audio device SetTargetFPS(60);
Sound fx = LoadSound("resources/audio/0564.ogg"); // Load audio file
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound! if (IsFileDropped())
{
droppedFiles = GetDroppedFiles(&count);
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY); if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
else
{
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
for (int i = 0; i < count; i++)
{
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
}
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
}
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadSound(fx); // Unload sound data ClearDroppedFiles(); // Clear internal buffers
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -1,11 +1,14 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03c - Gamepad input * raylib [core] example - Gamepad input
*
* NOTE: This example requires a Gamepad connected to the system
* raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -17,15 +20,15 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
Vector2 gamepadMove = { 0, 0 }; Vector2 gamepadMovement = { 0, 0 };
InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input"); SetTargetFPS(60); // Set target frames-per-second
SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
@@ -33,11 +36,11 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsGamepadAvailable(GAMEPAD_PLAYER1)) if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{ {
gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1); gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
ballPosition.x += gamepadMove.x; ballPosition.x += gamepadMovement.x;
ballPosition.y -= gamepadMove.y; ballPosition.y -= gamepadMovement.y;
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A)) if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
{ {
ballPosition.x = screenWidth/2; ballPosition.x = screenWidth/2;
@@ -45,17 +48,17 @@ int main()
} }
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY); DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON); DrawCircleV(ballPosition, 50, MAROON);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -64,6 +67,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,51 +1,51 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03a - Keyboard input * raylib [core] example - Keyboard input
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
int main() int main()
{ {
// Initialization // Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input");
SetTargetFPS(60); // Set target frames-per-second SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8; if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8;
if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8; if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8;
if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8; if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8;
if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8; if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY); DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON); DrawCircleV(ballPosition, 50, MAROON);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -54,6 +54,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 03b - Mouse input * raylib [core] example - Mouse input
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -17,14 +17,13 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector2 ballPosition = { -100.0, -100.0 }; InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
int counter = 0;
int mouseX, mouseY; int mouseX, mouseY;
Vector2 ballPosition = { -100.0, -100.0 };
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input");
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
@@ -34,22 +33,22 @@ int main()
{ {
mouseX = GetMouseX(); mouseX = GetMouseX();
mouseY = GetMouseY(); mouseY = GetMouseY();
ballPosition.x = (float)mouseX; ballPosition.x = (float)mouseX;
ballPosition.y = (float)mouseY; ballPosition.y = (float)mouseY;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawCircleV(ballPosition, 40, GOLD); DrawCircleV(ballPosition, 40, GOLD);
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY); DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -58,6 +57,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing GetMouseWheelMove() * raylib [core] examples - Mouse wheel
* *
* This test has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -17,33 +17,34 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - Mouse wheel"); InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
int positionY = 0; int boxPositionY = screenHeight/2 - 40;
int scrollSpeed = 4; // Scrolling speed in pixels int scrollSpeed = 4; // Scrolling speed in pixels
SetTargetFPS(60); SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
positionY -= (GetMouseWheelMove()*scrollSpeed); boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawRectangle(200, positionY, 80, 80, MAROON); DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
DrawText(FormatText("%i", positionY), 10, 10, 20, GRAY); DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -52,6 +53,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,65 @@
/*******************************************************************************************
*
* raylib [core] example - Generate random values
*
* This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
int framesCounter = 0; // Variable used to count frames
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
framesCounter++;
// Every two seconds (120 frames) a new random value is generated
if (((framesCounter/120)%2) == 1)
{
randValue = GetRandomValue(-8,5);
framesCounter = 0;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

View File

@@ -1,76 +0,0 @@
/*******************************************************************************************
*
* raylib example 05b - raylib bitmap font (rbmf) loading and using
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 560;
int screenHeight = 800;
InitWindow(screenWidth, screenHeight, "raylib example 05b - rBMF fonts");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
SpriteFont font3 = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
SpriteFont font4 = LoadSpriteFont("resources/fonts/setback.rbmf"); // SpriteFont loading
SpriteFont font5 = LoadSpriteFont("resources/fonts/romulus.rbmf"); // SpriteFont loading
SpriteFont font6 = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTextEx(font1, "TESTING ALAGARD FONT", (Vector2){ 100, 100 }, GetFontBaseSize(font1)*2, 2, MAROON);
DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
DrawTextEx(font5, "TESTING ROMULUS FONT", (Vector2){ 100, 430 }, GetFontBaseSize(font5)*2, 3, DARKPURPLE);
DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSpriteFont(font1); // SpriteFont unloading
UnloadSpriteFont(font2); // SpriteFont unloading
UnloadSpriteFont(font3); // SpriteFont unloading
UnloadSpriteFont(font4); // SpriteFont unloading
UnloadSpriteFont(font5); // SpriteFont unloading
UnloadSpriteFont(font6); // SpriteFont unloading
UnloadSpriteFont(font7); // SpriteFont unloading
UnloadSpriteFont(font8); // SpriteFont unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

409
examples/makefile Normal file
View File

@@ -0,0 +1,409 @@
#**************************************************************************************************
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# Copyright (c) 2015 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you
# wrote the original software. If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
# as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
#**************************************************************************************************
# define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS
LIBPATH=win32
else
UNAMEOS:=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
LIBPATH=linux
else
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX
LIBPATH=osx
endif
endif
endif
endif
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
ifeq ($(PLATFORM_OS),OSX)
# define llvm compiler for mac
CC = clang
else
# define default gcc compiler
CC = gcc
endif
endif
# define compiler flags:
# -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings
# -std=c99 use standard C from 1999 revision
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
else
CFLAGS = -O2 -Wall -std=c99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else
INCLUDES = -I. -I../src
# external libraries headers
# GLFW3
INCLUDES += -I../external/glfw3/include
# GLEW
INCLUDES += -I../external/glew/include
# OpenAL Soft
INCLUDES += -I../external/openal_soft/include
endif
# define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src -L/opt/vc/lib
else
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
LFLAGS += -L../external/glew/lib/$(LIBPATH)
endif
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling
# requires the following packages:
# libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../src/libraylib.bc
endif
# define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = ../src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
endif
# define all object files required
EXAMPLES = \
core_basic_window \
core_input_keys \
core_input_mouse \
core_mouse_wheel \
core_input_gamepad \
core_random_values \
core_color_select \
core_drop_files \
core_3d_mode \
core_3d_picking \
core_3d_camera_free \
core_3d_camera_first_person \
shapes_logo_raylib \
shapes_basic_shapes \
shapes_colors_palette \
shapes_logo_raylib_anim \
textures_logo_raylib \
textures_image_loading \
textures_rectangle \
textures_srcrec_dstrec \
textures_to_image \
textures_raw_data \
textures_formats_loading \
textures_particles_trail_blending \
text_sprite_fonts \
text_rbmf_fonts \
text_format_text \
text_font_select \
models_geometric_shapes \
models_box_collisions \
models_billboard \
models_obj_loading \
models_heightmap \
models_cubicmap \
shaders_model_shader \
shaders_shapes_textures \
shaders_custom_uniform \
shaders_postprocessing \
audio_sound_loading \
audio_music_stream \
fix_dylib \
#core_input_gamepad \
# typing 'make' will invoke the first target entry in the file,
# in this case, the 'default' target entry is raylib
default: examples
# compile all examples
examples: $(EXAMPLES)
# compile [core] example - basic window
core_basic_window: core_basic_window.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - keyboard input
core_input_keys: core_input_keys.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - mouse input
core_input_mouse: core_input_mouse.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
else
@echo core_input_gamepad: Only supported on desktop platform
endif
# compile [core] example - mouse wheel
core_mouse_wheel: core_mouse_wheel.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 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: Only supported on desktop platform
endif
# compile [core] example - generate random values
core_random_values: core_random_values.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - color selection (collision detection)
core_color_select: core_color_select.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d mode
core_3d_mode: core_3d_mode.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d picking
core_3d_picking: core_3d_picking.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d camera free
core_3d_camera_free: core_3d_camera_free.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d camera first person
core_3d_camera_first_person: core_3d_camera_first_person.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo (with basic shapes)
shapes_logo_raylib: shapes_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - basic shapes usage (rectangle, circle, ...)
shapes_basic_shapes: shapes_basic_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib color palette
shapes_colors_palette: shapes_colors_palette.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo animation
shapes_logo_raylib_anim: shapes_logo_raylib_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - raylib logo texture loading
textures_logo_raylib: textures_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - image loading and conversion to texture
textures_image_loading: textures_image_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture rectangle drawing
textures_rectangle: textures_rectangle.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture source and destination rectangles
textures_srcrec_dstrec: textures_srcrec_dstrec.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture to image
textures_to_image: textures_to_image.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture raw data
textures_raw_data: textures_raw_data.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture formats loading
textures_formats_loading: textures_formats_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture particles trail blending
textures_particles_trail_blending: textures_particles_trail_blending.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - sprite fonts loading
text_sprite_fonts: text_sprite_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - raylib bitmap fonts (rBMF)
text_rbmf_fonts: text_rbmf_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - text formatting
text_format_text: text_format_text.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - font selection program
text_font_select: text_font_select.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic geometric 3d shapes
models_geometric_shapes: models_geometric_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - box collisions
models_box_collisions: models_box_collisions.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic window
models_planes: models_planes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - billboard usage
models_billboard: models_billboard.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - OBJ model loading
models_obj_loading: models_obj_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - heightmap loading
models_heightmap: models_heightmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - cubesmap loading
models_cubicmap: models_cubicmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shaders] example - model shader
shaders_model_shader: shaders_model_shader.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shaders] example - shapes texture shader
shaders_shapes_textures: shaders_shapes_textures.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shaders] example - custom uniform in shader
shaders_custom_uniform: shaders_custom_uniform.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shaders] example - postprocessing shader
shaders_postprocessing: shaders_postprocessing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - sound loading and playing (WAV and OGG)
audio_sound_loading: audio_sound_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - music stream playing (OGG)
audio_music_stream: audio_music_stream.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# fix dylib install path name for each executable (MAC)
fix_dylib:
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
endif
# clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete
rm -f *.o
else
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
else
del *.o *.exe
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete
rm -f *.o
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js
endif
@echo Cleaning done
# instead of defining every module one by one, we can define a pattern
# this pattern below will automatically compile every module defined on $(OBJS)
#%.exe : %.c
# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib test - Testing Heightmap Loading and Drawing * raylib [models] example - Drawing billboards
* *
* This test 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) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,60 +18,55 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 12.0, 10.0, 12.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 5.0, 4.0, 5.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
Vector3 billPosition = { 0.0, 2.0, 0.0 }; // Position where draw billboard
InitWindow(screenWidth, screenHeight, "raylib test - Heightmap loading and drawing"); SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
Image img = LoadImage("resources/heightmap.png"); SetCameraTarget(camera.target); // Set internal camera target to match our camera target
Model map = LoadHeightmap(img, 4);
Texture2D texture = CreateTexture(img, false); SetTargetFPS(60); // Set our game to run at 60 frames-per-second
UnloadImage(img);
SetModelTexture(&map, texture);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// ... UpdateCamera(&camera); // Update internal camera and our camera
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(map, position, 0.5f, MAROON); DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0); // Draw a grid
DrawGizmo(position);
End3dMode(); End3dMode();
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture UnloadTexture(bill); // Unload texture
UnloadModel(map); // Unload model
CloseWindow(); // Close window and OpenGL context
CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View 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.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Vector3 playerPosition = { 0, 1, 2 };
Vector3 playerSize = { 1, 2, 1 };
Color playerColor = GREEN;
Vector3 enemyBoxPos = { -4, 1, 0 };
Vector3 enemyBoxSize = { 2, 2, 2 };
Vector3 enemySpherePos = { 4, 0, 0 };
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.0, 1.0); // 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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,86 @@
/*******************************************************************************************
*
* raylib [models] example - Cubicmap loading and drawing
*
* 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 - cubesmap loading and drawing");
// Define the camera to look into our 3d world
Camera camera = {{ 16.0, 14.0, 16.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
// 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, 0.0, -8 }; // Set model position
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
//--------------------------------------------------------------------------------------
// 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);
DrawModel(map, mapPosition, 1.0f, WHITE);
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);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(cubicmap); // Unload cubicmap texture
UnloadTexture(texture); // Unload map texture
UnloadModel(map); // Unload map model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07b - Draw some basic 3d shapes (cube, sphere, cylinder...) * raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,14 +18,14 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
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.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07b - 3d shapes");
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
{ {
@@ -33,35 +33,35 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// TODO: Update your variables here // TODO: Update your variables here
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
Begin3dMode(camera); Begin3dMode(camera);
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED); DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD); DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON); DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN); DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME); DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE); DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE); DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN); DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD); DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK); DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0); // Draw a grid
End3dMode(); End3dMode();
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -70,6 +70,6 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -0,0 +1,79 @@
/*******************************************************************************************
*
* raylib [models] example - Heightmap loading and drawing
*
* 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 - heightmap loading and drawing");
// Define our custom camera to look into our 3d world
Camera camera = {{ 24.0, 18.0, 24.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
Model map = LoadHeightmap(image, 32); // Load heightmap model
SetModelTexture(&map, texture); // Bind texture to model
Vector3 mapPosition = { -16, 0.0, -16 }; // Set model position (depends on model scaling!)
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
//--------------------------------------------------------------------------------------
// 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);
// NOTE: Model is scaled to 1/4 of its original size (128x128 units)
DrawModel(map, mapPosition, 1/4.0f, RED);
End3dMode();
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(map); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@@ -1,11 +1,11 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib example 07c - 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) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -18,49 +18,47 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 }; InitWindow(screenWidth, screenHeight, "raylib [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.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib example 07c - 3d models"); Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
SetModelTexture(&dwarf, texture); // Bind texture to model
Vector3 position = { 0.0, 0.0, 0.0 }; // 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
Texture2D texture = LoadTexture("resources/catwhite.png");
Model cat = LoadModel("resources/cat.obj");
SetModelTexture(&cat, texture); // Link texture to model
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KEY_LEFT)) position.x -= 0.2; //...
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(cat, position, 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.0, 1.0); // Draw a grid
DrawGizmo(position); 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);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
@@ -68,10 +66,10 @@ 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
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,19 @@
#version 330
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
out vec2 fragTexCoord;
uniform mat4 projectionMatrix;
uniform mat4 modelviewMatrix;
// NOTE: Add here your custom variables
void main()
{
fragTexCoord = vertexTexCoord;
gl_Position = projectionMatrix*modelviewMatrix*vec4(vertexPosition, 1.0);
}

View File

@@ -0,0 +1,42 @@
#version 330
in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 tintColor;
// 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;
}

View File

@@ -0,0 +1,20 @@
#version 330
in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 tintColor;
// NOTE: Add here your custom variables
void main()
{
vec4 base = texture2D(texture0, fragTexCoord)*tintColor;
// Convert to grayscale using NTSC conversion weights
float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
fragColor = vec4(gray, gray, gray, tintColor.a);
}

View File

@@ -0,0 +1,19 @@
#version 110
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
uniform mat4 projectionMatrix;
uniform mat4 modelviewMatrix;
varying vec2 fragTexCoord;
varying vec4 fragColor;
void main()
{
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
gl_Position = projectionMatrix*modelviewMatrix*vec4(vertexPosition, 1.0);
}

View File

@@ -0,0 +1,15 @@
#version 110
uniform sampler2D texture0;
varying vec2 fragTexCoord;
varying vec4 fragColor;
void main()
{
vec4 base = texture2D(texture0, fragTexCoord)*fragColor;
// 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);
}

View File

@@ -0,0 +1,41 @@
#version 330
in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 tintColor;
// NOTE: Add here your custom variables
const float renderWidth = 800; // HARDCODED for example!
const float renderHeight = 480; // Use uniforms instead...
float radius = 250.0;
float angle = 0.8;
uniform vec2 center = vec2(200, 200);
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);;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More