1004 Commits
1.2.2 ... 1.6.0

Author SHA1 Message Date
Ray
17f09cb034 Merge pull request #198 from raysan5/develop
Develop branch integration
2016-11-24 17:26:07 +01:00
raysan5
a81dfabf86 Update releases to latest version 2016-11-24 17:25:34 +01:00
Ray
784aa1b6b5 Merge pull request #197 from xspager/develop
[games] Fix building the games on Linux by adding missing libs
2016-11-24 16:12:07 +01:00
Daniel Lemos
fda91436b5 [games] Fix building the games on Linux by adding missing libs 2016-11-24 03:26:47 +00:00
Ray
05f68c22d5 Update README.md 2016-11-22 13:10:57 +01:00
Ray
0925f4ec4d Added physics samples to makefile 2016-11-22 12:53:32 +01:00
Ray
b8481369f7 Reviewed some lua examples and added new ones 2016-11-22 12:15:58 +01:00
Ray
f1bcfc1352 Corrected bug on GenTextureMipmaps()
texture.mipmaps value needs to be updated, so, texture must be passed by
reference instead of by value
2016-11-22 12:14:55 +01:00
Ray
d1c9c34b2f Merge pull request #195 from victorfisac/develop
Updated Physac to new version (library and examples)
2016-11-21 21:40:04 +01:00
victorfisac
e8630c78d0 Added new Physac examples 2016-11-21 20:31:30 +01:00
victorfisac
d0fca7e02b Removed old Physac examples 2016-11-21 20:31:07 +01:00
victorfisac
aa9353feb4 Updated Physac library 2016-11-21 20:30:46 +01:00
victorfisac
0716125ee9 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-11-21 20:27:43 +01:00
raysan5
918fc002d0 Simplified audio example 2016-11-21 19:50:31 +01:00
raysan5
bdbb1eb901 Added new text sample: text_bmfont_unordered
BMFont loading has been improved to support unordered chars and extended
characters (up to 255)
2016-11-21 19:49:54 +01:00
raysan5
481ce3d39d Corrected bug with alpha mask on font
Mask was wrongly applied to 8-bit font image, it generated dark borders
on the font. Grayscale image has to be considered as the alpha mask for
a completely white image to use it correctly.
2016-11-21 19:47:58 +01:00
Ray
85c400c006 rlua: Added functions notes
Functions that need to manage big data arrays don't work properly, that
functionality should be reviewed...
2016-11-21 00:07:31 +01:00
Ray
f0626324ab rlua: Added some missing functions
Updated to raylib 1.6 functionality
2016-11-21 00:00:27 +01:00
Ray
6fa5dec16d Updated 2016-11-20 23:00:41 +01:00
raysan5
0603e59cae Review examples and added new ones 2016-11-18 14:05:49 +01:00
raysan5
6b072e696d Updated releases
Latest raylib 1.6
2016-11-18 13:46:04 +01:00
raysan5
f7b706263a Some code tweaks
Correcting details that pop-up when testing the different platforms
2016-11-18 13:39:57 +01:00
raysan5
c7f0350182 Updated android template and lib 2016-11-18 13:39:19 +01:00
raysan5
b0d5a7a372 Corrected bug on Android 2016-11-17 13:50:56 +01:00
raysan5
bee283b12b Some tweaks around 2016-11-17 12:55:30 +01:00
raysan5
e23e73d9b2 raylib 1.6 html5 release 2016-11-16 19:44:08 +01:00
raysan5
6f3186eacc raylib 1.6 release (static and shared) 2016-11-16 19:43:49 +01:00
raysan5
f18c8cea16 Updated to support OpenAL Soft static library 2016-11-16 19:43:21 +01:00
raysan5
41e49c5a6e Remove CMakeList
Working on an updated version...
2016-11-16 19:10:03 +01:00
raysan5
5d46c27cd5 Update resource file for raylib 1.6 2016-11-16 19:08:42 +01:00
raysan5
6d1b712a96 Reviewed modules comments 2016-11-16 18:46:13 +01:00
raysan5
9d3ad52160 Removed byte typedef 2016-11-15 19:15:25 +01:00
Ray
4123233f78 Merge pull request #192 from raysan5/develop
Integrate Develop branch
2016-11-15 18:00:02 +01:00
Ray
a3d71dd58d Updated for raylib 1.6 2016-11-14 00:05:49 +01:00
Ray
2b50440a77 Review ROADMAP 2016-11-13 23:55:37 +01:00
Ray
9fb6eda5f1 Improved text measurement 2016-11-13 23:54:36 +01:00
Ray
38df2cad25 Improved text measurement
Still not working correctly, font offsets are not considered
correctly...
2016-11-13 23:53:28 +01:00
Ray
4245237892 Corrected SIGSEV bug 2016-11-13 23:47:28 +01:00
Ray
773b0b6bc0 Update ROADMAP.md 2016-11-06 14:09:30 +01:00
raysan5
66d22acfb3 Improve text example 2016-11-06 10:06:18 +01:00
raysan5
aa945055fa Corrected issue on chars drawing
Support by default unordered charsets
2016-11-03 18:57:46 +01:00
raysan5
ca96122a7b Raspberry Pi custom gamepad axis 2016-11-03 18:57:16 +01:00
raysan5
ed4fdfdaf8 Example tweak 2016-11-03 16:18:07 +01:00
raysan5
3be81b01d7 Brand new gamepad example 2016-11-02 13:39:58 +01:00
raysan5
f2d61d4d43 Improved gamepad support on Raspberry Pi 2016-11-02 13:39:48 +01:00
Ray
f16f39e8aa code tweaks to avoid some warnings 2016-11-02 00:50:08 +01:00
victorfisac
80f6b2f963 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-11-01 23:11:36 +01:00
raysan5
64f67f6e9f Improved gamepad support
new function: GetGamepadAxisCount()
new function: IsGamepadName()
2016-11-01 14:39:57 +01:00
raysan5
6d3b11ef91 Support unordered charset, neither fixed first char
Still requires some testing...
2016-11-01 00:58:21 +01:00
raysan5
3393fda384 Improve TTF loading 2016-10-31 20:39:30 +01:00
raysan5
673dcf9436 Comments tweaks 2016-10-31 20:39:03 +01:00
raysan5
cc917fbac6 Improve SpriteFont support
LoadSpriteFontTTF() - TTF font loading with custom parameters
2016-10-31 15:38:15 +01:00
raysan5
16101ce3d8 Reorganize defines check 2016-10-31 13:56:57 +01:00
raysan5
836d3341a5 Renamed OpenAL32 dll library 2016-10-31 13:54:37 +01:00
raysan5
988d39029f Support textures filtering 2016-10-29 22:17:19 +02:00
raysan5
43fd9ffe08 Tweak to avoid warnings 2016-10-29 22:16:54 +02:00
raysan5
02842a3e2f Review gamepad inputs
Added funtion: GetGamepadButtonPressed() - This function can be useful
for custom gamepad configuration
2016-10-27 13:41:43 +02:00
raysan5
4ff98f34bb Function to set texture parameters -IN PROGRESS- 2016-10-27 13:40:48 +02:00
raysan5
5c80f65082 Funtions added to set texture parameters
SetTextureFilter()
SetTextureWrap()
2016-10-27 13:40:17 +02:00
raysan5
137057f499 Function added: GenSpriteFont() 2016-10-27 13:39:47 +02:00
raysan5
6d34adbd60 Improving sprite fonts support...
Support grayscale (8 bit) textures for fonts
Load unordered chars data above char 126
2016-10-24 19:11:29 +02:00
raysan5
1142d4edae Force threads to finish on CloseWindow() 2016-10-24 19:08:23 +02:00
Ray
b8ce680511 Improved Android support 2016-10-18 00:15:23 +02:00
raysan5
0ce7f0c409 Some work on multiple inputs...
- Corrected bug and tested new gamepad system
- Reviewed Android key inputs system, unified with desktop
- Reorganize mouse functions on core
2016-10-17 18:18:13 +02:00
raysan5
d5e0f4e84e Added notes on vr tracking -> camera update 2016-10-17 17:02:33 +02:00
Ray
8f60996b64 Corrected some warnings 2016-10-17 00:03:38 +02:00
Ray
a9315fc422 Merge pull request #189 from raysan5/develop
Develop branch integration
2016-10-16 18:24:13 +02:00
Ray
1c05017548 Added OpenAL static library 2016-10-15 13:51:33 +02:00
Ray
9e285d8dc3 Updated gamepad system with extra check
Avoid out-of-bounds situation with button array
2016-10-15 13:17:57 +02:00
Ray
98d7a10c08 Improved gamepad system
- Support up to 4 gamepads
- Unified system between platforms
- Corrected some bugs
2016-10-14 11:14:41 +02:00
Ray
4a3ed6d73c Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-10-14 00:47:48 +02:00
Ray
b3bc4b21d1 Working on better gamepad support 2016-10-14 00:47:43 +02:00
raysan5
76a67a149e Added new wave functions to lua binding 2016-10-12 10:27:14 +02:00
Ray
97e3277d58 Updated standard shader
Corrects weird artifacts on web
2016-10-11 00:39:07 +02:00
raysan5
648676f46b Update examples to new camera system 2016-10-10 19:43:27 +02:00
raysan5
5fecf5c088 Review UpdateVrTracking() and rlglLoadRenderTexture() 2016-10-10 19:42:59 +02:00
raysan5
c384b375df Tweak to avoid warning 2016-10-10 19:42:02 +02:00
raysan5
b1651baea5 Added support for FLAC audio loading/streaming 2016-10-10 18:22:55 +02:00
Ray
4c791100cc Tweak int to float 2016-10-09 20:57:14 +02:00
Ray
5af1b4a7c9 Added simulated head-tracking on VR simulator
A simple 1st person camera... still requires some work...
2016-10-09 20:56:58 +02:00
Ray
3396743aba Corrected old issue with mouse buttons on web 2016-10-09 13:25:50 +02:00
Ray
efa286a550 Allow no default font loading
Useful if text module is not required...
2016-10-09 13:09:08 +02:00
Ray
b4a3f294bf Correct warning 2016-10-09 13:07:55 +02:00
victorfisac
2a158c4795 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-10-06 20:57:31 +02:00
Ray
db6538859c Added flag to allow resizable window 2016-10-05 00:48:44 +02:00
raysan5
b082807b0b Removed function: ResolveCollisionCubicmap()
Function was inefficient and should be rewritten from scratch, it
probably neither belongs to this module but an example...
2016-10-03 13:29:01 +02:00
raysan5
637d3195ec More review on camera system...
Sincerely, don't like it... it should be ported to quaternions... the
way it manages cameraTargetDistange and cameraAngle is confusing...
2016-10-03 13:27:22 +02:00
Ray
2ae9ce29eb Corrected issue on DrawPolyEx() 2016-10-02 23:04:46 +02:00
raysan5
978c49472a Working on camera system... 2016-09-26 19:15:44 +02:00
raysan5
753b549aa5 Improving camera system -IN PROGRESS- 2016-09-25 14:28:24 +02:00
Ray
87fc7254e7 Corrected crashing bug!
When SetTargetFPS(0) app crashes horribly (division by zero)
2016-09-23 23:25:13 +02:00
raysan5
65d4eb5e82 Simplify camera module -IN PROGRESS-
Removed internal Camera, not required any more
Removed useless functions
2016-09-22 14:38:17 +02:00
raysan5
4a65b19f0f Simplify supported image formats
Removed support for some unusual image formats
2016-09-22 14:35:50 +02:00
raysan5
1ffe713d93 Corrected bug 2016-09-21 12:29:03 +02:00
raysan5
478d3cbb79 Added standard shader for testing 2016-09-21 12:28:49 +02:00
raysan5
c5bf9623d1 Updated LibOVR to SDK version 1.8
Weird, OVR_Version.h still points to 1.7, probably a typo...
2016-09-20 20:16:19 +02:00
raysan5
79c8eb543e Corrected audio bugs and improved examples 2016-09-15 11:53:16 +02:00
raysan5
9923fe51a7 Tweak to avoid warning 2016-09-12 19:36:55 +02:00
raysan5
7f0880a735 Review spacing formatting
raylib uses spaces between '+' and '-' signs but not between '*' and '/'
signs, it's a chosen convention
2016-09-12 19:36:41 +02:00
raysan5
173f199313 Corrected text drawing within an image 2016-09-12 19:25:58 +02:00
Ray
94142ecce5 Some more work on audio... 2016-09-09 01:34:30 +02:00
Ray
0c58c1198f Working on new audio functions... 2016-09-08 01:03:05 +02:00
Ray
1e55c30824 Removed raygui from raylib repo (own repo) 2016-09-08 01:02:42 +02:00
Ray
8b35de3276 Added new audio functions -IN PROGRESS-
- LoadWave()
- LoadWaveEx()
- UnloadWave()
- WaveFormat()
- WaveCopy()
- WaveCrop()
- GetWaveData()
2016-09-08 00:20:06 +02:00
Ray
10280c4b91 Some code tweaks 2016-09-07 23:14:16 +02:00
raysan5
36f20376e6 Redesigned lighting shader system 2016-09-05 20:15:21 +02:00
Ray
9d66bc4a05 Added function: ImageAlphaMask() 2016-09-05 10:08:28 +02:00
raysan5
a9ab516dae Formatting tweaks 2016-08-31 10:27:29 +02:00
Ray
d27709b1f2 Merge pull request #188 from teodor-stoenescu/develop
Greater LoadOBJ() flexibility
2016-08-31 10:22:40 +02:00
Teodor Stoenescu
384602e5b5 Merge remote-tracking branch 'upstream/develop' into develop 2016-08-31 09:32:08 +03:00
Teodor Stoenescu
d0cf19e035 Greater LoadOBJ() flexibility
LoadOBJ can now load objects with having no texture coordinates or
objects having texture coordinates specified as tuples.
2016-08-31 09:24:39 +03:00
raysan5
be97583f00 Added function: UpdateSound() 2016-08-29 11:17:58 +02:00
raysan5
7dbb17792a Moved tool to folder 2016-08-27 21:05:16 +02:00
raysan5
4770e2010d Review Android project 2016-08-26 19:40:37 +02:00
raysan5
5d88eb1d95 Reviewed project includes 2016-08-25 15:12:05 +02:00
raysan5
f1c3f2870b Added TraceLog info on image spritefont loading 2016-08-25 15:11:52 +02:00
Ray
2a9b8d7a39 Merge pull request #184 from nounoursheureux/develop
Fix a typo in the DrawCube, DrawCubeWires and DrawCubeTexture definitions
2016-08-25 14:57:22 +02:00
Wilhem Barbier
1d71e1b754 Fix a typo in the DrawCube, DrawCubeWires and DrawCubeTexture definitions 2016-08-25 14:18:43 +02:00
raysan5
959a228815 Removed useless spacing 2016-08-16 11:09:55 +02:00
raysan5
342b89c5b9 Review Wave struct 2016-08-15 16:35:25 +02:00
raysan5
852813bdf1 Reviewed formatting 2016-08-15 16:35:25 +02:00
raysan5
1ffc4c7825 Corrected naming bug 2016-08-15 16:35:25 +02:00
Ray
bd26b66c27 Updated compiling notes 2016-08-15 16:18:04 +02:00
raysan5
3377a4485b Support shared/dynamic raylib compilation
Generates:
Win32:  raylib.dll, libraylibdll.a (import library)
Linux:  libraylib.so
2016-08-13 11:31:15 +02:00
Ray
c98b7eecd8 Merge pull request #180 from teodor-stoenescu/develop
Small fix for GenMeshCubicmap()
2016-08-12 20:47:17 +02:00
Teodor Stoenescu
6e20037f7d Small fix for GenMeshCubicmap()
This fix allows GenMeshCubicmap() to create cubic maps having cells of
arbitrary sizes.
2016-08-12 21:42:17 +03:00
raysan5
29f14186c1 Updated games to latest raylib version
Updated to new audio system
2016-08-11 12:08:41 +02:00
Ray
289e04a62a Ported camera module to header-only 2016-08-10 12:55:54 +02:00
Ray
a1b6b217e4 Comment tweak 2016-08-10 12:55:31 +02:00
Ray
eb9072a2f1 Renamed functions for consistency 2016-08-10 12:20:46 +02:00
Ray
cc2b3228d1 Updated for C++ 2016-08-09 23:03:29 +02:00
raysan5
caecb1c1eb Removed x64 configuration
It could be added in a future if required...
2016-08-08 17:29:31 +02:00
raysan5
7e36727328 Visual Studio 2015 project 2016-08-08 17:22:26 +02:00
raysan5
ed387d00aa Corrected issue with VS 2016-08-08 17:21:46 +02:00
raysan5
7fbd821727 Some code review tweaks 2016-08-07 13:51:01 +02:00
raysan5
f69f930b51 Some functions review 2016-08-07 13:38:48 +02:00
raysan5
cae209816c Code tweak to avoid warning 2016-08-07 13:38:14 +02:00
Ray
2c079d7c6e Review Lua examples and formatting 2016-08-07 11:14:08 +02:00
Ray
46248b0922 Merge pull request #175 from ghassanpl/develop
More fixes for Lua
2016-08-07 10:46:03 +02:00
ghassanpl
47b6e62744 Fixed bug with BoundingBox Lua constructor
Fixed use-after-free in DestroyLight
2016-08-06 22:14:49 +02:00
ghassanpl
6f27941e28 GetDroppedFiles and SetShaderValue in Lua working
Exposed Texture2D.id to Lua
Lights now have settable/gettable fields
2016-08-06 21:51:08 +02:00
ghassanpl
1950085893 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-08-06 20:46:15 +02:00
raysan5
306945fe14 Added trace on audio device closing 2016-08-06 19:30:56 +02:00
raysan5
16ac468bdb Remove functions from user exposure 2016-08-06 19:30:41 +02:00
raysan5
58c762baa3 Replaced tabs by spaces 2016-08-06 19:30:13 +02:00
raysan5
865b216ebe Updated Lua examples
Most of the examples already working! Only some of them still fail,
mostly related to data arrays...
2016-08-06 19:29:58 +02:00
ghassanpl
82a0fae678 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-08-06 17:10:56 +02:00
Ray
7f9513fbf4 Merge pull request #173 from ghassanpl/develop
Fixes for some Lua bugs
2016-08-06 17:09:57 +02:00
ghassanpl
cfe47cc854 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-08-06 17:03:07 +02:00
ghassanpl
4960e6b6d7 Fixes for some Lua bugs 2016-08-06 16:58:48 +02:00
raysan5
3b80e2c1e0 Redesigned gestures module to header-only 2016-08-06 16:32:46 +02:00
raysan5
d5f5f0a930 Updated raylib version to 1.6 2016-08-06 11:33:05 +02:00
raysan5
ae70540a96 Added example audio_raw_stream 2016-08-06 11:32:53 +02:00
raysan5
00c7e54d3c Add raylib lua examples 2016-08-06 11:32:35 +02:00
raysan5
5f1b4e9474 Updated Lua module 2016-08-06 11:30:34 +02:00
Ray
5da66e7ec8 Merge pull request #172 from LelixSuper/fix-makefile
Fix install command of src/ makefile
2016-08-04 17:13:20 +02:00
LelixSuper
3d519c7a39 Fix install command of src/ makefile 2016-08-04 15:48:37 +02:00
raysan5
80789e6140 Updated Lua binding 2016-08-04 13:40:53 +02:00
raysan5
055d501345 Corrected bug 2016-08-03 23:25:39 +02:00
raysan5
70ec517fda Updated some functions 2016-08-03 23:15:44 +02:00
raysan5
5c30e079f4 [rlua] new module: raylib Lua binding 2016-08-03 21:39:22 +02:00
raysan5
735968e685 [rlua] new module: raylib Lua binding 2016-08-03 21:38:21 +02:00
raysan5
d3d9aaceb1 Updated and comments 2016-08-03 09:26:30 +02:00
raysan5
8c0bd30fcb Corrected issue with Music type 2016-08-02 19:09:07 +02:00
raysan5
50ccc39d6b Updated LIBs 2016-08-02 17:55:04 +02:00
raysan5
68d647c1af Complete review and update
Simplified module for Music and AudioStream
Added support for raw audio streaming (with example)
2016-08-02 17:32:24 +02:00
raysan5
58d2f70b7e Review audio module and examples 2016-08-01 21:37:45 +02:00
raysan5
36cf1f7dfd Improved support for C++
Added compound literals (C99) alternative for C++ compilers that don't
support this feature
2016-08-01 18:05:07 +02:00
raysan5
2dc5f580a6 Removed audio errors register 2016-08-01 12:58:30 +02:00
raysan5
02c456432d Complete review of audio system
Still some work left...
2016-08-01 12:49:17 +02:00
Ray
a61b832c4a Merge pull request #166 from Bil152/develop
Code refractoring of music module to be more user-friendly (issue #144)
2016-07-30 12:45:31 +02:00
Ray
13ebc745fe Corrected bug on Linux linking 2016-07-30 10:03:32 +02:00
Bil152
8f7cb6fb19 Code refractoring of music model to be more friendly-user (issue #144) 2016-07-29 21:35:57 +02:00
raysan5
a008d49230 Corrected some issues to compile with MSC 2016-07-29 13:17:50 +02:00
raysan5
a422e39492 Corrected issue on OSX with High DPI display
Many thanks to Marcelo Paez (paezao)
2016-07-26 16:55:46 +02:00
raysan5
07a375e2d6 Corrected issue with HIghDPI display on OSX
Well, not tested yet but it should work...
2016-07-26 13:02:25 +02:00
raysan5
6d68c78989 Updated log output info 2016-07-26 12:44:33 +02:00
raysan5
9e8232d750 Redesigned bloom shader to work on RPI 2016-07-25 19:44:21 +02:00
raysan5
c604b53f78 Corrected issue with paths on RPI 2016-07-25 19:43:59 +02:00
raysan5
020601092e Added release version for RaspberryPi 2016-07-25 18:36:58 +02:00
raysan5
a94b553aff Updated release headers 2016-07-25 18:36:43 +02:00
raysan5
4facc03a64 Upload ptheads Win32 DLL 2016-07-25 08:50:40 +02:00
Ray
53056f3e7e Merge pull request #151 from raysan5/develop
Updated raylib cheatsheet
2016-07-22 23:58:46 +02:00
Ray
fbf0362943 Updated raylib cheatsheet 2016-07-22 23:57:52 +02:00
Ray
7fa1f2ffde Merge pull request #150 from raysan5/develop
Merge pull request #149 from raysan5/master
2016-07-22 18:32:05 +02:00
Ray
ab5d1df7cb Merge pull request #149 from raysan5/master
Merge OSX changes into develop branch
2016-07-22 18:31:36 +02:00
Ray
7921d85dc8 Merge pull request #148 from sol-prog/master
OS X compatiblity changes and compiled library
2016-07-22 18:30:23 +02:00
sol-prog
32a671b9da OS X comaptiblity changes and compiled library 2016-07-22 11:55:04 -04:00
Ray
ab0d19f356 Merge pull request #137 from raysan5/develop
Integrate Develop branch
2016-07-19 12:48:55 +02:00
raysan5
c482f37dfd Updated... again... 2016-07-19 11:32:10 +02:00
raysan5
c12737ae38 Removed old shader 2016-07-19 11:06:09 +02:00
raysan5
3140496a12 Updated 2016-07-19 11:01:27 +02:00
raysan5
61558ab83f Updated shaders pack
Some deep review of this shaders is required for optimization...
2016-07-19 10:57:35 +02:00
raysan5
76c9e9883d Update runtime DLL to version 1.6 2016-07-19 10:03:05 +02:00
Ray
5139948ef9 Updated to Oculus PC SDK 1.6 2016-07-19 09:42:48 +02:00
victorfisac
3e1321ac24 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-07-18 23:24:12 +02:00
Ray
13e18c23ed Merge pull request #136 from raysan5/develop
Updated
2016-07-18 17:25:02 +02:00
raysan5
af46222b12 Updated 2016-07-18 17:23:50 +02:00
Ray
eaec086177 Merge pull request #135 from raysan5/develop
Integrate Develop branch
2016-07-18 17:09:23 +02:00
raysan5
bec58075ff Update ro raylib 1.5 release 2016-07-18 17:08:13 +02:00
raysan5
0e6b249260 Review outputs by platform 2016-07-18 17:07:50 +02:00
raysan5
5ff9811ea8 Some code tweaks 2016-07-18 17:06:33 +02:00
Ray
6c2dc5574f Merge pull request #134 from LelixSuper/develop
Update Makefile of 'src/' folder
2016-07-18 15:34:02 +02:00
LelixSuper
ce1c4055f7 add GNU/Linux buils of library
The builds refer to de865a9 commit.
2016-07-18 15:22:32 +02:00
LelixSuper
de865a9b55 fix small things on 'src/' makefile 2016-07-18 15:13:43 +02:00
raysan5
697e1d4941 Update pthreads library (win32)
This library is only required by physac module to compulte physics in a
second thread
2016-07-18 14:53:11 +02:00
victorfisac
7a09043cba Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-07-18 14:08:34 +02:00
Ray
f5f3b4e095 Update README.md 2016-07-17 23:40:25 +02:00
raysan5
40fbe9da81 Added new example to makefile 2016-07-17 18:27:32 +02:00
LelixSuper
ebfb1978b8 allow to compile shared version of raylib 2016-07-17 17:56:57 +02:00
raysan5
8328353204 New example: XM module playing 2016-07-17 17:27:49 +02:00
LelixSuper
13c56887f1 fix 'external/stb_vorbis.c" compilation 2016-07-17 17:23:41 +02:00
LelixSuper
2272a4722f restore the original method to compile all modules
This commit restores the original method to compile all modules, but fix
prerequisites.
2016-07-17 17:18:34 +02:00
LelixSuper
94a5fc5c2c add some explanation of makefile in 'src/' 2016-07-17 15:54:52 +02:00
raysan5
a36cc7075a Corrected issue on drawing order 2016-07-17 12:40:56 +02:00
raysan5
f1f51bd9b6 Updated examples screenshots 2016-07-17 12:25:22 +02:00
raysan5
1eafa7020d Oculus Rift example with rlgl standalone 2016-07-16 22:41:31 +02:00
raysan5
55b9a2479a Expose Oculus Rift functionality directly 2016-07-16 22:41:13 +02:00
raysan5
52cb0d709a Code tweaks and comments 2016-07-16 22:40:51 +02:00
LelixSuper
d38fb9bda2 fix small things on makefile of 'src/' folder 2016-07-16 21:23:21 +02:00
LelixSuper
6efaa78058 improve the compilation of all modules 2016-07-16 21:01:43 +02:00
LelixSuper
e62c30c8b1 improve 'clean' target of 'src/' makefile 2016-07-16 20:24:14 +02:00
raysan5
0ba349bdf2 Removed oculus glfw sample (already on raylib)
Replaced by example rlgl_oculus_rift
2016-07-16 19:52:32 +02:00
raysan5
35bda8980f Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-07-16 19:25:58 +02:00
raysan5
cac378bd95 Added release versions of raylib 1.5 2016-07-16 19:25:53 +02:00
raysan5
be551d7707 Review comment 2016-07-16 19:25:24 +02:00
raysan5
bfb5ffedda Added rlgl standalone sample 2016-07-16 19:25:15 +02:00
raysan5
a05150392a Added audio standalone sample 2016-07-16 19:24:08 +02:00
LelixSuper
6f335d2c9e add 'install' and 'unistall' target
The first target allow makefile to install the dev files (static library and
header) to standard directories on GNU/Linux platforms; the second allow it to
unistall (remove) the dev files.

It needs lot of improvements.
2016-07-16 18:38:17 +02:00
LelixSuper
f685acd69e update '.gitignore' file to ignore VIM's files 2016-07-16 17:39:15 +02:00
LelixSuper
dbec22f2df restyle Makefile of 'src/' folder and fix targets 2016-07-16 17:31:54 +02:00
Ray
4ef3acfa41 Update README.md 2016-07-16 15:03:26 +02:00
raysan5
0fbd48a889 Corrected bug on OpenGL 1.1
Set makefile to default OpenGL 3.3 compilation
2016-07-16 14:58:53 +02:00
Ray
b7b51569e2 Update README.md 2016-07-16 10:34:39 +02:00
Ray
55491fdb36 Update README.md 2016-07-15 19:45:38 +02:00
Ray
a2794379a0 Merge pull request #132 from raysan5/develop
Develop branch integration
2016-07-15 19:44:18 +02:00
Ray
fc19e24eba Update README.md 2016-07-15 19:42:06 +02:00
Ray
da71c3d801 Update ROADMAP.md 2016-07-15 18:45:45 +02:00
Ray
e815e205da Update HELPME.md 2016-07-15 18:43:24 +02:00
raysan5
eb58a0596d Updated with latest changes 2016-07-15 18:37:11 +02:00
raysan5
7959ccd84d Review some functions, formatting and comments 2016-07-15 18:16:34 +02:00
raysan5
338bb3fd9c Review variables to raylib naming conventions
Some review work still required...
2016-07-13 20:05:53 +02:00
raysan5
11172118d1 Review comments 2016-07-13 20:05:00 +02:00
raysan5
9d6d68f00a Support VR mode disable on Oculus device 2016-07-12 18:44:45 +02:00
raysan5
31b64d4689 Updated for GLSL 100 2016-07-12 17:10:44 +02:00
raysan5
3876f19d6a Corrected some issues on OpenGL ES 2016-07-12 01:54:47 +02:00
raysan5
22672bc738 Added Oculus functions declaration and comments 2016-07-11 19:01:13 +02:00
raysan5
56ec22f5c9 Corrected some issues on OpenGL 1.1
Corrected lighting system crash and VR variables not found...
2016-07-11 17:34:12 +02:00
Ray
84d1b19f61 Added custom Oculus CV1 parameters
Matching the same stereo rendering result given by Oculus PC SDK for
Oculus Rift CV1 is very difficult because hardware has changed a lot and
DK2 distortion shader and parameters don't fit on CV1. Some custom
parameters have been calculated to simulate kind of CV1 stereo
rendering. Further work is required on this point.
2016-07-11 14:43:58 +02:00
Ray
24c267d324 Compute stereo config from device parameters
Simulator configuration is directly obtained from VR device parameters!
2016-07-10 20:09:18 +02:00
Ray
d587cc0e36 Setup values for Oculus Rift DK2
Oculus Rift CV1 default values seem not to be available...
2016-07-10 20:07:54 +02:00
Ray
1733125873 Do not expose raw audio context to final user...
...at least, directly, available if using directly audio module...
2016-07-08 23:17:18 +02:00
raysan5
884e13ac2f Updated VR support -IN PROGRESS-
- Embedded VR distortion shader
- Ready to support multiple VR devices
- Fallback to VR Simulator if device not ready
- Support mono rendering over stereo rendering
2016-07-08 20:32:06 +02:00
Ray
bcc2b17701 Rename standard_shader.h to shader_standard.h 2016-07-08 17:22:37 +02:00
Ray
3922bc27cd Supporting multiple HMD configurations
-IN PROGRESS-
2016-07-08 00:57:27 +02:00
raysan5
7cefbd8a94 Updated lighting system...
...to avoid dynamic conditions on for loop (lightsCount) on standard
shader, it seems GLSL 100 doesn't support that feature... on some GPUs
like RaspberryPi...
2016-07-06 20:33:46 +02:00
raysan5
e2a3a52ad6 Edited comment 2016-07-06 20:02:33 +02:00
raysan5
8fd4507847 Corrected bug on Raspberry Pi with strcat() 2016-07-06 20:02:15 +02:00
victorfisac
9fea631bfb Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-07-06 17:13:19 +02:00
raysan5
09cc27ca7a Added screenshot for example core_oculus_rift 2016-07-06 08:47:19 +02:00
Ray
bc80174357 VR Functions renaming (for generic HMD device)
Stereo rendering has been moved again to Begin3dMode() and End3dMode(),
it has some limitations but makes more sense...
2016-07-06 00:54:38 +02:00
victorfisac
1aecd5be07 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-07-05 11:57:05 +02:00
raysan5
2ff2096b36 Moved Oculus enable drawing to user side...
Still thinking about the best way to manage this...
2016-07-04 18:35:50 +02:00
raysan5
3fb1c446ea Corrected issue on RPI on model drawing 2016-07-04 18:34:28 +02:00
raysan5
8bdd03eeac Updated Oculus PC SDK to version 1.5 2016-07-04 18:34:02 +02:00
Ray
2f9abe6e13 Review ResolveCollisionCubicmap()
This function needs to be redesigned or removed...
2016-07-04 01:30:07 +02:00
Ray
ee72654b55 Redesigned stereo rendering mechanism
Now it's easier for the user! Just init Oculus device and get stereo
rendering!
2016-07-04 01:29:23 +02:00
Ray
164ead03c9 Update README.md 2016-07-02 10:29:30 +02:00
Ray
f88c95ce2d Updated examples and makefile 2016-06-30 00:26:56 +02:00
raysan5
308fcbb96c Added eyes projection/view matrices calculation
Based on HMD parameters (IPD, ScreenSize, LesnsSeparation...)
2016-06-27 20:10:28 +02:00
raysan5
be61d2f8c1 Added missing parameter 2016-06-27 20:09:10 +02:00
raysan5
6fbf6a1c23 Redesigned distortion shader, added chromatic aberration 2016-06-27 19:18:53 +02:00
raysan5
5a4eb34c39 Corrected issue on distortion shader 2016-06-27 18:59:03 +02:00
raysan5
c4922c9e88 Reorganize shaders to respective folders 2016-06-27 18:32:56 +02:00
raysan5
e977915577 Review examples makefile for RPI 2016-06-27 18:31:23 +02:00
raysan5
572936ec65 Added Oculus functions to raylib header 2016-06-27 18:30:58 +02:00
raysan5
a8bed54586 Corrected stream playing with index 2016-06-27 18:30:18 +02:00
raysan5
4b444e7cc3 Comment glBlitFramebuffer() 2016-06-26 18:43:10 +02:00
raysan5
9127b5a57d Enable/Disable VR experience 2016-06-26 15:36:12 +02:00
raysan5
8652e644dd Corrected bug on stereo rendering 2016-06-26 14:13:11 +02:00
Ray
4ff85c2ac2 Added notes about chromatic aberration 2016-06-26 10:22:17 +02:00
raysan5
6981e2bffa Get supported videomodes for fullscreen 2016-06-26 01:36:06 +02:00
raysan5
8fb84d9e63 Updated to new rlgl 2016-06-25 23:29:03 +02:00
raysan5
71ab202295 Removed rlglInitGraphics(), integrated into rlglInit()
Redesigned rlgl usage:
- rlViewport() must be called by user
- Internal projection/modelview matrices must be setup by user
2016-06-25 23:28:50 +02:00
raysan5
369b8532c0 Review rlglInitGraphics() 2016-06-25 22:42:35 +02:00
raysan5
f9f33926f7 Corrected window size to unify with other examples 2016-06-25 22:41:45 +02:00
raysan5
9ee96bea95 Unified functions: InitGraphicsDevice()
Following XNA style, now we have InitGraphicsDevice(), replacing
InitDisplay() + InitGraphics()
2016-06-25 21:28:50 +02:00
raysan5
5f7ac64c44 Removed function SetModelTexture()
It's more educational to go through new material system, so, I decide to
remove this function to avoid students confusion...
2016-06-24 19:49:36 +02:00
raysan5
b358402cb3 Some code tweaks (view description)
- Added support for RLGL_NO_STANDARD_SHADER
- Store framebuffer width and height as globals
- Reorganize rlglInit() function
2016-06-24 19:37:52 +02:00
raysan5
a522b6e23b Corrected issue with unclosed threads 2016-06-24 19:34:47 +02:00
raysan5
03d9583b94 Add oculus simulator (in case device is not detected) 2016-06-21 13:49:13 +02:00
raysan5
e913de58c7 Added distortion shader for testing 2016-06-21 13:45:35 +02:00
raysan5
afe033412b Code tweak 2016-06-21 13:45:13 +02:00
raysan5
c28a5fbd62 Code tweak 2016-06-21 13:44:56 +02:00
Ray
6062201e8f Simplify Oculus example...
...to align it with standard raylib code. Final goal would be having the
same code work for every platform with no changes...
2016-06-21 08:59:29 +02:00
raysan5
b01f5ff6a7 Starting work on VR simulator support
If Oculus device is not available or not initialized correctly,
simulated VR view is generated using stereo-rendering and distortion
2016-06-19 19:12:47 +02:00
Ray
24c9b1f717 Improving Oculus Rift example...
Under design... looking for the easiest and most comprehensive way for
the user to use VR...
2016-06-17 13:54:45 +02:00
Ray
9fdf4420d5 Corrected bugs on OpenGL 2.1 2016-06-17 00:29:46 +02:00
Ray
4df7a0f2f8 Added support for OpenGL 2.1 2016-06-16 20:25:50 +02:00
Ray
3468af213f Reviewing Oculus rendering... 2016-06-15 00:54:55 +02:00
Ray
d5d1305bc0 Merge pull request #131 from victorfisac/develop
Physac 1.0 module completed
2016-06-14 21:38:09 +02:00
victorfisac
1b0996fb0b Updated physac header documentation 2016-06-14 20:54:20 +02:00
victorfisac
1879a8129e Fixed little bug in physac example 2016-06-14 20:40:12 +02:00
victorfisac
4e84ded7ef Fixed spacing and set UpdatePhysics() function as static...
and remove static from PhysicsThread().
2016-06-14 20:38:49 +02:00
victorfisac
1a8fbe5cf0 Add pthread external library to source...
and add instructions in physac examples to run it successful.
2016-06-14 20:31:48 +02:00
victorfisac
5a1cbb2842 Fix current time value 2016-06-14 20:25:08 +02:00
victorfisac
54537e8f0b Fixed bug in delta time calculation...
and added PHYSAC_NO_THREADS define. Improved physac example drawing
frames per second in screen.
2016-06-14 20:23:46 +02:00
victorfisac
c9c1263e6f Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-14 19:16:24 +02:00
raysan5
d1a5374ac4 raylib Oculus Rift CV1 example... IT WORKS!!! 2016-06-14 18:38:57 +02:00
raysan5
c914010606 Correct issue on Oculus drawing 2016-06-14 18:37:28 +02:00
raysan5
56bd9da07c Update Oculus sample (will be moved soon) 2016-06-14 18:37:06 +02:00
raysan5
d60dc7c2eb Added Oculus Rift library dll 2016-06-14 17:34:51 +02:00
raysan5
97fc266ad4 Updated raylib Oculus example 2016-06-14 17:20:00 +02:00
raysan5
3ce0228206 Move Oculus Rift support to rlgl module 2016-06-14 17:16:20 +02:00
raysan5
0d0f306fc2 Add Oculus SDK LibOVR library to external deps. 2016-06-14 17:15:00 +02:00
raysan5
c25b4cdc69 Move OpenGL extensions loading to rlgl 2016-06-14 15:42:04 +02:00
raysan5
3a5fc0c320 Move global data to implementation 2016-06-14 12:12:02 +02:00
raysan5
3d6be7fd80 Added GetGestureDetected() again...
Required by gestures example....
2016-06-14 12:01:57 +02:00
raysan5
47afda2549 Removed useless function: GetGestureDetected()
Use instead: IsGestureDetected()
2016-06-14 11:55:32 +02:00
victorfisac
6a2bbae521 Updated physics examples with new module changes 2016-06-12 22:07:36 +02:00
victorfisac
5625c11e99 Added internal hi-resolution timer to physac...
... and now physac thread creation is done in InitPhysics() and it is
destroyed in ClosePhysics(). User just need to call these functions to
use physac module.
2016-06-12 22:07:06 +02:00
victorfisac
16609d6702 Revert "Make GetTime() public to be used externally"
This reverts commit 7999bbafa8.
2016-06-12 22:04:51 +02:00
victorfisac
8d2de09f3d Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-12 22:03:46 +02:00
raysan5
4dae3385c3 Record draw call for batch processing
Just started working on this, not sure if it would be available for
raylib 1.5
2016-06-12 19:40:08 +02:00
raysan5
66ec0b5d82 Oculus tracking correction 2016-06-12 10:47:50 +02:00
victorfisac
7999bbafa8 Make GetTime() public to be used externally 2016-06-11 19:14:25 +02:00
victorfisac
4c43a40788 Update physac examples with fixed timestep method 2016-06-11 19:11:30 +02:00
victorfisac
c10c49e44f Convert physac module from static steps to fixed time steps
Old physics update system used a static number of steps to calculate
physics (450 for desktop and 64 for android). It was too much and it was
limited by target frame time...

Now physics update runs in a secondary thread using a fixed delta time
value to update steps. Collisions are perfectly detected and resolved
and performance has been improved so much.
2016-06-11 18:35:46 +02:00
victorfisac
1a60f376a4 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-11 18:29:01 +02:00
raysan5
27ba7de1e4 Added some comments 2016-06-11 14:08:39 +02:00
raysan5
68a02e567d Avoid external variable whiteTexture
To get it, use GetDefaultTexture()
2016-06-11 12:41:03 +02:00
raysan5
c46c0fc652 Corrected keywords usage 2016-06-11 12:18:08 +02:00
raysan5
3884716948 Corrected a couple of warnings 2016-06-11 12:01:39 +02:00
raysan5
8de1427803 Remove release files from src directory 2016-06-11 11:48:42 +02:00
raysan5
bab08f1c89 Added release folder (again) 2016-06-11 11:21:55 +02:00
raysan5
d63e32a377 Remove include, not supported on html5
AL/alext.h is not supported on html5 OpenAL implementation, just
replaced by the defines used in audio module
2016-06-11 11:21:24 +02:00
raysan5
52b88e0991 Reduce extensions dependencies
Only using raylib required extensions... it could be further reduced!
2016-06-11 10:58:17 +02:00
raysan5
3e8427799c Corrected bug on cubemap generation 2016-06-11 10:56:20 +02:00
Ray
2963782992 Merge pull request #128 from victorfisac/develop
Adapted shaders for OpenGL ES 2.0
2016-06-10 08:58:37 +02:00
victorfisac
77f599885d Fixed GLSL 100 shaders
texture() doesn't exist in glsl 100, it must use texture2D().
2016-06-10 00:59:48 +02:00
victorfisac
7b07b68bfd Adapt standard shader to GL ES 2.0
Some shader calculations are now pre-calculated because some math
functions doesn't exist in glsl 110.
2016-06-10 00:49:51 +02:00
Ray
fb90477354 Merge pull request #127 from victorfisac/develop
Fix Android template with 1.5 raylib features (audio streaming, gestures)
2016-06-09 23:27:50 +02:00
victorfisac
cbda329bfd Removed physac old module from Android MK file 2016-06-09 22:12:46 +02:00
victorfisac
5d186639c9 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-09 22:09:33 +02:00
raysan5
e2cfc6b838 Reduced physic steps resolution 2016-06-09 21:00:21 +02:00
raysan5
3c1be60c66 Updated examples for new physac header-only 2016-06-09 20:02:42 +02:00
raysan5
5f4449f0a1 Removed physac functions from raylib header 2016-06-09 20:02:15 +02:00
raysan5
558ec3891b Converted physac module to header only 2016-06-09 20:01:59 +02:00
raysan5
dcbfb83031 Updated comments... 2016-06-09 20:01:39 +02:00
victorfisac
3524fc414b Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-09 13:12:18 +02:00
Ray
420b85da98 Update README.md 2016-06-09 11:42:00 +02:00
Ray
28c2759ae1 Update README.md 2016-06-09 01:30:08 +02:00
Ray
374e3e7e11 Updated to raylib 1.5 2016-06-09 01:23:07 +02:00
Ray
904ef0d4be Adjust to standard example screen size 2016-06-08 22:55:38 +02:00
Ray
99ee26b001 Review const char * 2016-06-08 22:52:54 +02:00
Ray
ee049641ba Merge pull request #126 from kd7tck/develop
clean up audio chiptunes support
2016-06-08 22:23:23 +02:00
Joshua Reisenauer
4f47f90336 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-08 12:02:39 -07:00
Ray
2d90cc59b6 Update distortion.fs 2016-06-08 18:48:25 +02:00
Ray
5576dea00b Rename raylib_rlgl_standalone.c to rlgl_standalone.c 2016-06-08 18:27:43 +02:00
victorfisac
8323f81ab5 Add physac module to android compile instructions...
... and switch from debug build to release
2016-06-08 17:27:55 +02:00
victorfisac
f5f5ce0d33 Fix default android project game with new functions 2016-06-08 17:27:13 +02:00
victorfisac
88f4747437 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-08 15:55:08 +02:00
raysan5
b79ede4edb Added distortion shader to render 2016-06-08 13:29:56 +02:00
raysan5
70a96fff80 Simplified Oculus integration 2016-06-08 13:16:01 +02:00
Joshua Reisenauer
7bf2854e94 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-07 16:07:57 -07:00
Joshua Reisenauer
f0d8c009ae cleaned things up 2016-06-07 16:03:21 -07:00
victorfisac
0ae486f07c Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-08 00:34:35 +02:00
Ray
79a6235811 Stereo rendering test
Trying to simulate Oculus Rift CV1 rendering without the device... for
Debug pourposes.
2016-06-08 00:32:34 +02:00
Ray
c99fc5108e Update screenshot 2016-06-08 00:31:00 +02:00
Ray
09fa002818 Corrected issue 2016-06-08 00:04:56 +02:00
Ray
ee795150fa Updated some code 2016-06-07 23:44:53 +02:00
victorfisac
f97f39987c Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-07 23:41:34 +02:00
raysan5
5631f822bd Reorganized device init/close 2016-06-07 20:46:03 +02:00
raysan5
ca13c2ed0c Converted raygui module to header only 2016-06-07 20:33:49 +02:00
raysan5
058af472ea Converted GLAD to header only 2016-06-07 18:57:20 +02:00
raysan5
3d5a408177 Remove DEBUG flag for raylib lib compilation
...on Android
2016-06-07 18:53:47 +02:00
Ray
9281e477eb Embed standard shader into raylib 2016-06-07 00:32:45 +02:00
Joshua Reisenauer
76536fe24b Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-06 15:30:41 -07:00
Ray
1bcf500eca Review fallback mechanism 2016-06-06 23:19:40 +02:00
Ray
522af9f477 Fallback to default shader 2016-06-06 23:16:14 +02:00
Ray
1c98e6b698 Merge pull request #125 from raysan5/develop
Develop branch integration
2016-06-06 20:46:06 +02:00
Ray
4dada32693 Include GLFW3 DLL 2016-06-06 20:40:17 +02:00
Ray
34aea08ba2 Update to OpenAL Soft 1.17.2 2016-06-06 20:39:59 +02:00
Ray
6b2823775e Remove OpenAL Soft 2016-06-06 20:34:11 +02:00
Ray
d999b3ed53 Merge branch 'develop' of https://github.com/raysan5/raylib into develop 2016-06-06 20:30:02 +02:00
Ray
5f5d191d88 Updated to GLFW 3.2 2016-06-06 20:26:02 +02:00
Ray
dd468e9ef9 Merge pull request #124 from LelixSuper/patch-1
Fix mistake in the make file
2016-06-06 20:20:21 +02:00
LelixSuper
302d84cedc Fix mistake in Makefile 2016-06-06 19:26:30 +02:00
Ray
ad8a5a95b2 Move and update CMakeList 2016-06-06 14:38:54 +02:00
Ray
29d505c98e Reorganize external libraries - BREAKING CHANGE -
Moved all external libraries used by raylib to external folder inside
raylib src. Makefile has already been update and also the different
includes in raylib modules.
2016-06-06 14:34:43 +02:00
Ray
688045307a Reorganize folder for Android library
Android build system has been simplified and now is included in src
folder, like other build systems.
2016-06-06 13:52:06 +02:00
Ray
72eb2632cc Corrected compilation bug on OpenGL 1.1 2016-06-05 23:51:41 +02:00
Joshua Reisenauer
e3b2485453 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-03 14:01:04 -07:00
raysan5
60232810d8 Added some comments 2016-06-03 19:00:58 +02:00
raysan5
d1133ca8d3 Some gestures comments tweaks... 2016-06-03 18:51:19 +02:00
raysan5
13bef7aa02 Work on Oculus functionality
Trying to find the best way to integrate Oculus support into raylib,
making it easy for the user...
2016-06-03 18:26:59 +02:00
raysan5
b574e105dd Basic raylib Oculus Rift template for reference
Not functional yet...
2016-06-03 18:08:50 +02:00
raysan5
4dfffff19b Review uniform name 2016-06-03 17:30:09 +02:00
raysan5
9417b9969d Remove GLEW 2016-06-03 17:26:37 +02:00
raysan5
46a7822eee Remove useless folder 2016-06-03 17:25:02 +02:00
raysan5
501ef80bed Updated camera 2d example 2016-06-03 13:22:24 +02:00
Ray
7ca6397223 Added support for Oculus Rift CV1 2016-06-03 00:53:51 +02:00
Ray
e2173922f0 Update eye render pose with layer data 2016-06-03 00:46:56 +02:00
Joshua Reisenauer
96fa716525 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-02 13:43:11 -07:00
raysan5
4bc339ea4e Updated Oculus sample 2016-06-02 20:25:11 +02:00
raysan5
0bc71d84f8 Added functions to customize internal matrix
Internal modelview and projection matrices can be replaced before
drawing.
2016-06-02 20:23:09 +02:00
raysan5
2168d8aa1a Removed DrawPhysicObjectInfo() function
To avoid additional dependencies
2016-06-02 19:16:11 +02:00
raysan5
cafc66a3c1 Rename for consistency with other functions 2016-06-02 19:09:56 +02:00
raysan5
4c9d0f16a5 Comment to avoid warning 2016-06-02 19:09:31 +02:00
raysan5
80b3c4cd2b Review comments to be value-generic 2016-06-02 18:49:40 +02:00
raysan5
5bcddca5e1 Remove useless stuff 2016-06-02 18:29:49 +02:00
raysan5
c286bea8e1 Remove GLEW dependency 2016-06-02 18:20:59 +02:00
raysan5
4fb3103dfa Corrected some formatting issues 2016-06-02 18:19:47 +02:00
raysan5
cf6d2e3985 Review coding style to match raylib style
Moved AudioError enum inside audio.c
2016-06-02 17:12:31 +02:00
Ray
7447b3e1da Merge pull request #123 from kd7tck/develop
mod player
2016-06-02 16:18:53 +02:00
Joshua Reisenauer
cf2975d062 convenient way to combine errors 2016-06-02 02:31:25 -07:00
Joshua Reisenauer
af1eb5453a I added audio errors
The only thing I did not change was the _g for globals. Is there any
other way we can mark globals?
2016-06-02 02:02:23 -07:00
Joshua Reisenauer
05f8e83ba9 cleanup 2016-06-02 00:03:00 -07:00
Joshua Reisenauer
21a01ec870 simplified mod 2016-06-01 20:36:54 -07:00
Joshua Reisenauer
ae6adb173b Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-06-01 20:17:39 -07:00
Joshua Reisenauer
90e1ed2b5e mod player added 2016-06-01 20:09:00 -07:00
Ray
17878550b1 Review heades usage
This is a first step toward a bigger project. Some modules could be
ported to header-only to be used as standalone.
2016-06-02 01:26:44 +02:00
Ray
7afa0b09ab Support raygui as standalone library 2016-06-02 01:24:27 +02:00
raysan5
0a27525a4b Dependencies review
Checking some files to be converted to header-only
2016-06-01 14:01:35 +02:00
raysan5
3e88156817 Ignore invalid warning 2016-06-01 12:38:06 +02:00
raysan5
897179a06c Corrected some issues on OpenGL 1.1 2016-06-01 12:37:51 +02:00
raysan5
8f91ed81c5 Updated Oculus sample to Oculus SDK 1.4
Still working on the sample but almost finished. Some rlgl internals
redesign required and it will be ready!
2016-05-31 20:08:36 +02:00
raysan5
d17a0cee1a Review text formatting (spacing, tabs...) 2016-05-31 19:12:37 +02:00
raysan5
302ec438dd Removed colTint, tint color is colDiffuse
Tint color could be applied to colDiffuse... but what's the best way?
Replace it? Multiply by? A point to think about...
2016-05-31 18:15:53 +02:00
raysan5
cac2a66deb Improved library consistency
Functions renamed to improve library consistency
2016-05-31 17:11:02 +02:00
Joshua Reisenauer
78b4494e2b Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-30 15:57:35 -07:00
Ray
caa7bc366b Reviewed DrawLight() function and some tweaks 2016-05-31 00:51:55 +02:00
Joshua Reisenauer
6ad8323860 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-30 15:39:21 -07:00
Joshua Reisenauer
9f2fc81df2 update to openal 2016-05-30 15:34:29 -07:00
Ray
8a4e28f81d Support Android internal data storage
Useful to save small data files (configuration and so)
For bigger files, external data storage should be used (SDCard)
2016-05-31 00:01:19 +02:00
Ray
4b93349db5 Merge pull request #122 from victorfisac/develop
Standard Lighting (3/3)
2016-05-30 23:25:18 +02:00
victorfisac
11cf455fe0 Standard Lighting (3/3)
- Added normal and specular maps to standard shader.
- Added full tint attribute to standard shader and material data type.
- Changed point light attenuation to radius.
2016-05-30 19:59:21 +02:00
victorfisac
b0a0c5d431 Added tint color attribute to material data type
It tints all fragments, ignores lighting. Useful for some features like
feedback (damage color, ...).
2016-05-30 19:55:13 +02:00
victorfisac
f2d61d4043 Remove normal depth
Scaling normal depth (y axis) makes disappear the specular of
fragments... So I think it can be removed, it is not a very
useful/important attribute.
2016-05-30 19:43:35 +02:00
victorfisac
0ff26f527f Added normal and specular maps logic to standard...
...shader and updated example.
2016-05-30 19:26:17 +02:00
victorfisac
5c32cf2095 Add 'dwarf' model normal and specular maps to resources folder 2016-05-30 19:19:15 +02:00
victorfisac
64f6c74c9a Add normal and specular maps to draw model process 2016-05-30 19:18:55 +02:00
victorfisac
2e26ce235d Add Draw3DCircle function and update raylib and rlgl header
Draw3DCircle is useful to draw point lights radius.
2016-05-30 19:18:11 +02:00
victorfisac
ae2d0d4cd8 Delete old example mesh resource file 2016-05-29 22:41:23 +02:00
victorfisac
26833f5aae Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-29 22:24:01 +02:00
raysan5
ea5b00528b Improved render to texture
Support render texture size different than screen size
2016-05-29 11:49:13 +02:00
Joshua Reisenauer
e4e315bbfc Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-29 01:09:29 -07:00
Ray
27df983ee0 Merge pull request #121 from kd7tck/develop
I made this for some others I am now working with
2016-05-27 19:55:41 +02:00
Joshua Reisenauer
5a041a6af5 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-25 11:26:31 -07:00
raysan5
3d6696f6c9 Renamed shader variables (more generic names) 2016-05-25 16:21:13 +02:00
raysan5
d53b6f4381 Renamed shader variables (more generic names)
Now shader maps use a generic naming convention for any kind of texture
maps (not only diffuse, normal or specular). Useful for custom shaders.
2016-05-25 16:19:57 +02:00
raysan5
48374c85dd Some tweaks
It seems there are some problems with DrawLights()
2016-05-23 11:25:04 +02:00
Joshua Reisenauer
f74791ed7b better build system 2016-05-23 02:12:22 -07:00
Joshua Reisenauer
f232f34981 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-22 15:03:10 -07:00
Ray
9811a37690 Merge pull request #120 from victorfisac/develop
Standard Lighting (2/3)
2016-05-21 20:11:23 +02:00
victorfisac
dcd6942ed1 Fix small bug and spacing 2016-05-21 18:22:15 +02:00
victorfisac
c320a21f2b Add standard lighting (2/3)
- 3 light types added (point, directional, spot).
- DrawLights() function added using line shapes.
- Standard lighting example added.
- Removed useless struct variables from material and light.
- Fixed light attributes dynamic locations errors.
- Standard vertex and fragment shaders temporally added until rewrite it
as char pointers in rlgl.
TODO:
- Add normal and specular maps calculations in standard shader.
- Add control structs to handle which attributes needs to be calculated
(textures, specular...).
- Adapt standard shader to version 110.
- Rewrite standard shader as char pointers in rlgl.
2016-05-21 18:16:39 +02:00
victorfisac
80eb4f3f50 Remove deprecated phong lighting shaders and example 2016-05-21 18:11:25 +02:00
victorfisac
30941c0dd1 Add Draw3DLine function and fixed MLT glossiness import value
In standard shader, material glossiness is a value from 0 to 1000 like
in MLT files. So, it doesn't need to be normalized.
2016-05-21 18:10:06 +02:00
victorfisac
cf71e1242e Fix some audio module compile warnings 2016-05-21 18:08:09 +02:00
victorfisac
0da7c499b6 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-21 18:06:36 +02:00
Ray
0b65b44a78 Merge pull request #119 from gordonmcshane/remove-local-properties
remove user-specific ant files
2016-05-21 11:14:23 +02:00
Ray
46e7a26770 Merge pull request #118 from gordonmcshane/gamepad-example-fix
fix example
2016-05-21 11:13:42 +02:00
Gordon McShane
c9ac176fa7 remove user-specific ant files 2016-05-20 11:27:18 -07:00
Gordon McShane
c0983f3400 fix example
- fix gamepad axis query in example broken by db4585b Improved gamepad support
2016-05-20 11:03:44 -07:00
victorfisac
30c8058fca Add standard lighting (1/3)
- Ambient and lambert lighting added.
- Ambient and diffuse colors linked to standard shader.
- Single light linked to standard shader.
- LoadStandardMaterial() and depending functions added.
2016-05-20 17:18:07 +02:00
victorfisac
c60cc9ee18 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-20 15:05:12 +02:00
raysan5
6dac1efefe Comented buggy code to avoid problems...
...on model drawing
2016-05-20 15:01:36 +02:00
Ray
8b3603cd48 Merge pull request #117 from victorfisac/develop
MTL loading shininess to material glossiness
2016-05-20 14:59:49 +02:00
victorfisac
3fa6fdacf2 Improved MTL loading shininess value 2016-05-20 14:24:53 +02:00
victorfisac
90c62c4cc0 Fix small warning
Material glossiness is a float type value...
2016-05-20 14:07:50 +02:00
victorfisac
4f1bee3165 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-20 14:03:23 +02:00
raysan5
dcf5f45f68 Add lighting system -IN PROGRESS-
Improved materials
2016-05-20 12:28:07 +02:00
raysan5
af890cf210 Updated to avoid pointers 2016-05-20 10:53:58 +02:00
raysan5
c9e30f7754 Review struct typedef to avoid pointers for users 2016-05-20 10:53:31 +02:00
raysan5
03cc031d00 Remove TODO comments (already done) 2016-05-20 09:40:48 +02:00
raysan5
7d1d9ff143 Support DYNAMIC_DRAW mesh loading 2016-05-20 09:36:02 +02:00
Ray
bdb450fccb Merge pull request #116 from kd7tck/newaudio
Redesign audio system to support multiple mix channels
2016-05-20 09:22:07 +02:00
Joshua Reisenauer
179f2f9e4f windows automated compile
Only works when raylib is installed on windows system.
2016-05-19 20:56:38 -07:00
Joshua Reisenauer
41c5f3a017 Buffer for raw audio 2016-05-19 20:44:09 -07:00
Joshua Reisenauer
847944e240 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into newaudio 2016-05-19 15:31:56 -07:00
Joshua Reisenauer
b10425492a name correction 2016-05-19 15:22:12 -07:00
raysan5
8bbbe8cd76 Corrected namings 2016-05-19 13:50:29 +02:00
raysan5
037edbaa13 Reorganize data for consistency 2016-05-18 13:22:14 +02:00
raysan5
bc08271da3 Updated shaders with comments 2016-05-18 12:04:27 +02:00
Joshua Reisenauer
cd7f25830b Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-16 19:54:03 -07:00
Joshua Reisenauer
706755d146 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-16 19:42:16 -07:00
Ray
0e29aa2951 Corrected function name
texture2D() is deprecated on GLSL 330
2016-05-17 00:39:56 +02:00
Ray
d84f922372 Merge pull request #114 from cHemingway/osx-fixes
Fix building examples on OSX
2016-05-17 00:10:28 +02:00
Joshua Reisenauer
76ff4d220e renamed everything so it is obvious what it does 2016-05-15 19:37:15 -07:00
Joshua Reisenauer
86fbf4fd8f logic bug fix 2016-05-15 02:09:57 -07:00
Joshua Reisenauer
d38d7a1bed clean up on buffering and preconditions 2016-05-14 16:30:32 -07:00
Joshua Reisenauer
8c5d403dda new function to check if music stream is ready
_g naming convention for globals, new error exit numbers.
2016-05-14 15:26:17 -07:00
Chris Hemingway
f575935ace Fix glfw name on OSX and remove unused directory warning 2016-05-14 10:45:29 +01:00
Joshua Reisenauer
ea4b5552c2 corrected typos 2016-05-14 00:25:40 -07:00
Chris Hemingway
b46a800597 Make GRAPHICS_API_OPENGL_33 work on OSX, closes #113 2016-05-14 01:10:05 +01:00
Chris Hemingway
b62bbb78ed Fix building examples on OSX 2016-05-13 23:01:48 +01:00
Joshua Reisenauer
5107a2dc40 bug fixes 2016-05-12 21:14:02 -07:00
Joshua Reisenauer
ded07690fd Merge remote-tracking branch 'refs/remotes/raysan5/develop' into newaudio 2016-05-12 16:06:22 -07:00
Joshua Reisenauer
83dbc07650 buffering of music now uses update audio context 2016-05-12 16:02:23 -07:00
raysan5
e060944b34 Added QuaternionInvert() 2016-05-12 13:02:04 +02:00
raysan5
075f51e0a3 Simplified internal (default) dynamic buffers 2016-05-12 12:20:23 +02:00
Joshua Reisenauer
f0ada8c40d apply index to remaining functions 2016-05-11 22:37:53 -07:00
Joshua Reisenauer
9737c58054 PlayMusicStream now uses index 2016-05-11 20:15:37 -07:00
Joshua Reisenauer
529d20ee6a Merge remote-tracking branch 'refs/remotes/raysan5/develop' into newaudio 2016-05-11 18:15:46 -07:00
Joshua Reisenauer
ad3d270c42 added set pitch for music streams 2016-05-11 18:14:59 -07:00
Ray
454b422fd6 Merge pull request #112 from kd7tck/develop
Base Audio Context System
2016-05-11 20:14:12 +02:00
raysan5
4d78d27bd9 Updated structs Mesh and Shader 2016-05-11 19:25:51 +02:00
Joshua Reisenauer
6db44500b7 adding multiple music streams 2016-05-11 00:37:10 -07:00
raysan5
6acfda599e Support indexed mesh data on OpenGL 1.1 path
Keep asking myself why I maintain this rendering path... -___-
2016-05-10 19:25:06 +02:00
raysan5
5c112ff542 Corrected tipo 2016-05-10 19:24:25 +02:00
raysan5
aee5d9a390 Code tweak 2016-05-10 19:24:05 +02:00
raysan5
1ddf594d15 Added support for indexed mesh data 2016-05-10 18:24:28 +02:00
Joshua Reisenauer
9799856ad4 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-10 02:00:42 -07:00
Joshua Reisenauer
b7f8e97b03 final fix for audiocontext system
now it works
2016-05-10 01:54:20 -07:00
Ray
ac44db26a2 Added reference 2016-05-09 13:16:44 +02:00
Ray
c85cd29049 Added defines for default shader names 2016-05-09 12:41:53 +02:00
Ray
3d0208223a First implementation of MTL loading
Not tested yet
2016-05-09 12:40:59 +02:00
Ray
dc4d5dabcd Added MTL loading info 2016-05-09 01:18:46 +02:00
Ray
f7d4951165 Improved vertex attribs support for models 2016-05-08 23:50:35 +02:00
raysan5
0bcb873cbb Improved mesh support
Depending on mesh data, it can be loaded and default vertex attribute
location points are set, including colors, tangents and texcoords2
2016-05-08 15:24:02 +02:00
raysan5
29761c2519 Testing new material usage 2016-05-07 18:29:04 +02:00
raysan5
eeb151586f Corrected issues with OpenGL 1.1 backend 2016-05-07 18:28:40 +02:00
raysan5
7ab008878a Library redesign to accomodate materials system 2016-05-07 18:07:15 +02:00
raysan5
ec72a8868e Comment tweak 2016-05-07 18:04:22 +02:00
raysan5
ba60918eaa Updated Oculus sample
Now GLFW3 windows/context creation works ok and a sample red rectangle
has been drawn using rlgl. Next step is working in tracking
position/orientation maths and try to get a simple 3d scene...
2016-05-04 20:25:32 +02:00
Joshua Reisenauer
e660700924 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-03 14:17:37 -07:00
raysan5
fd67e31f63 Renamed function for consistency 2016-05-03 19:27:06 +02:00
raysan5
8301980ba8 Clean up and consistency review
- Renamed some functions for consistency (default buffers)
- Removed mystrdup() function (implemented inline)
- Renamed TextFileRead() to ReadTextFile()
2016-05-03 19:20:25 +02:00
raysan5
5f73850fa6 Renamed functions for consistency 2016-05-03 18:04:21 +02:00
raysan5
e94acf86f8 Reorganized internal funcs 2016-05-03 17:54:50 +02:00
Joshua Reisenauer
d6feeb14ff pause on no data 2016-05-03 02:52:45 -07:00
Joshua Reisenauer
9d09ada33b new boolean floatingPoint option
Now floating point is either on or off. This simplifies the use of 16bit
vs float.
2016-05-02 21:59:55 -07:00
Joshua Reisenauer
c3208c5cd6 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-05-02 14:43:37 -07:00
Joshua Reisenauer
4636e3367c number remaining buffer transfer for updateAudioContext
updateAudioContext is almost done
2016-05-02 14:37:00 -07:00
Ray
f2152aa391 Reorganize functions 2016-05-02 14:11:57 +02:00
Ray
2646ed0393 Removed debug functions 2016-05-02 14:11:42 +02:00
Joshua Reisenauer
9ef0240e99 resamples added
Ease of use considered in api and channels are more convenient as
unsigned char type.
2016-05-02 01:24:24 -07:00
Joshua Reisenauer
790bc72806 bool return for failed update 2016-05-01 23:07:02 -07:00
Joshua Reisenauer
289a53221d merge fix 2016-05-01 20:00:51 -07:00
Joshua Reisenauer
a2a3d3aeb6 new silence generator 2016-05-01 18:53:40 -07:00
Ray
17732fa9c4 Corrected warning with array 2016-05-02 00:38:01 +02:00
Ray
fa98289ddb Added 2D camera mode functions
Removed BeginDrawingEx()
Added Begin2dMode() and End2dMode()
2016-05-02 00:37:33 +02:00
Ray
0e6d1cb272 Working on materials system... 2016-05-02 00:16:32 +02:00
raysan5
cc39b4660a New oculus sample to test... 2016-05-01 21:55:34 +02:00
Joshua Reisenauer
fa3112b40e Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-04-30 19:00:23 -07:00
Ray
6ca1fd59a9 Merge pull request #111 from kd7tck/develop
First stage of audio API update
2016-05-01 01:49:40 +02:00
Ray
1fb874cdc5 Check for WebGL/Webkit extensions
Improve DXT-ETC1 support on HTML5
2016-05-01 01:09:48 +02:00
Joshua Reisenauer
34e5fcf47e removed enums 2016-04-30 16:05:43 -07:00
Joshua Reisenauer
a1038f61b6 BPS type added to ensure consistency 2016-04-30 15:41:46 -07:00
Joshua Reisenauer
5f1e8b8278 hide struct from user
Hiding the struct from user should protect from accidentally modifying
the mix channel. This could cause serious errors down the road.
2016-04-29 23:43:21 -07:00
Joshua Reisenauer
91f1f324c0 First stage of audio API update
Look over changes and give feedback please.
2016-04-29 23:00:12 -07:00
Ray
eb36c351cf Merge pull request #110 from kd7tck/develop
quick fix (module audio support)
2016-04-27 09:09:31 +02:00
Joshua Reisenauer
f707c1ca46 this should work 2016-04-27 00:02:11 -07:00
Joshua Reisenauer
299ae7a4bd new trace logs and optimizations 2016-04-26 16:50:07 -07:00
Joshua Reisenauer
3104d3d6cd small fix for streaming
There is still an issue where audio will cut off after a brief moment
2016-04-25 22:18:49 -07:00
Joshua Reisenauer
04d9deac92 setting up openal 2016-04-25 20:05:03 -07:00
Joshua Reisenauer
f12754b01f quick fix
Boolean errors
2016-04-25 18:40:19 -07:00
Ray
f9bbce0da7 Merge pull request #109 from kd7tck/develop
Added proto version of jar_xm
2016-04-25 09:32:14 +02:00
Joshua Reisenauer
62087d21cc updated jar_xm 2016-04-24 23:44:49 -07:00
Joshua Reisenauer
89a84a621b implement 2016-04-24 22:04:31 -07:00
Joshua Reisenauer
1c370f5a17 cleaned up calculations 2016-04-24 22:00:40 -07:00
Joshua Reisenauer
cb05c51911 tabs to spaces fix 2016-04-24 18:18:18 -07:00
Joshua Reisenauer
ec2cbaa5eb Added proto version of jar_xm
This is an early draft, needs lots of work. Still need to figure out way
to calculate total length of song. This is hard because xm tracks stream
out zeros when done, only position in track can be found. Position does
not give any direct value of how much more time is left. I think that by
setting the loop count to 1 and seeking until the end I can total up the
number of samples and come up with a length.
2016-04-24 15:25:48 -07:00
raysan5
173529e048 Oculus SDK 1.3 + GLFW3 sample -NOT WORKING- 2016-04-23 11:29:19 +02:00
raysan5
9639b14e1b Reduce PCM buffer size for Android to avoid stalls 2016-04-17 14:48:20 +02:00
raysan5
17eefed08f Improved gestures system 2016-04-17 11:36:40 +02:00
raysan5
2e5d898443 Corrected bug with old FBO struct 2016-04-17 11:25:04 +02:00
raysan5
6b5e18e6bf Make mouse inputs available on Android for...
... easy code porting, transalating them to touches and gestures
internally.

Removed function SetCustomCursor(), it can be managed by the user.
2016-04-17 11:19:32 +02:00
raysan5
0da88ac5c5 Updated template game library name 2016-04-17 11:11:48 +02:00
raysan5
c8a30b262d Updated gestures example 2016-04-17 11:11:23 +02:00
raysan5
284eaf1576 Use Depth Texture on OpenGL 3.3 2016-04-10 19:38:57 +02:00
raysan5
c1e49d2b13 Removed function
I decided it is redundant and could be confusing (when mixed with 3D
drawing). It's not KISS.
2016-04-08 12:00:29 +02:00
raysan5
cde2c1aa6d Added depth drawing shader
NOTE: It requires a depth texture as input, it should be configured on
rlgl, by default RenderTexture (fbo) uses Depth Renderbuffer instead of
Depth Texture. Check rlglLoadRenderTexture()
2016-04-08 00:21:21 +02:00
raysan5
aa22d97983 Simplified texture flip and added comments 2016-04-07 13:31:53 +02:00
raysan5
4b51248372 Review shader and add comments 2016-04-07 12:43:45 +02:00
raysan5
1d545449bb Reviewed shaders and added comments 2016-04-07 12:32:32 +02:00
raysan5
78b502b0bf Folders rename for consistency on shaders version 2016-04-07 11:48:09 +02:00
raysan5
3b67a4cfba Update stb libs to latest version 2016-04-06 17:45:25 +02:00
Ray
1a2a44200a Merge pull request #108 from LelixSuper/develop
Fix Makefile files
2016-04-06 17:12:03 +02:00
LelixSuper
9361615786 Fix Makefile files
I've added .PHONY targets and fixed "clean" recipe.
2016-04-06 13:21:29 +02:00
raysan5
0133917bf9 Correct detail 2016-04-04 01:15:43 +02:00
Ray
b6cec214bd Unified internal shader to only one
Only defaultShader required, set default value for vertex color
attribute if not enabled and fragColor uniform
2016-04-03 20:14:07 +02:00
raysan5
a66c8531d6 Some code simplifications 2016-04-03 18:31:42 +02:00
Ray
37cc45a0a8 Merge pull request #107 from LelixSuper/develop
Cleaning of Makefile files
2016-04-03 18:20:04 +02:00
LelixSuper
a04a7b6ea5 Fix cleaning recipies for GNU/Linux 2016-04-03 16:07:44 +02:00
LelixSuper
f2f4079411 Remove recipes of GLEW from Makefile (not used any more) 2016-04-03 16:05:23 +02:00
LelixSuper
565b1089bd Remove duplicate code 2016-04-03 15:58:44 +02:00
raysan5
06a8d7eb06 Remove old postprocessing system 2016-04-01 10:39:33 +02:00
raysan5
108055cd62 Updated example to new render to texture system 2016-03-30 20:19:46 +02:00
raysan5
66b096d978 Added support for render to texture (use RenderTexture2D)
Now it's possible to render to texture, old postprocessing system will
be removed on next raylib version.
2016-03-30 20:09:16 +02:00
raysan5
1136d4222f Setting up for raylib 1.5.0 2016-03-28 01:18:40 +02:00
raysan5
136408d8b8 Corrected bug on bounding box
if mesh is not loaded properly it breaks the game!
2016-03-27 19:42:57 +02:00
raysan5
ee9bf76ae9 Remove old screenshot 2016-03-27 19:03:55 +02:00
raysan5
a3f16c8459 Improved 2d camera system -IN PROGRESS- 2016-03-27 18:34:05 +02:00
raysan5
956a6e6f77 Corrected bug and comments on model unloading 2016-03-27 18:34:05 +02:00
raysan5
8b7ca8b670 Review comments 2016-03-27 18:34:05 +02:00
Ray
35ee4e52c8 Merge pull request #105 from victorfisac/develop
Fix spacing and some comments
2016-03-24 12:25:56 +01:00
victorfisac
ea7afc8ec8 Fix spacing and some comments 2016-03-23 22:47:39 +01:00
Ray
db3dd9d200 Merge pull request #104 from victorfisac/develop
Physac redesign complete
2016-03-23 16:39:24 +01:00
victorfisac
60223a358b Physac redesign (3/3)
Finally, physics update is handled in main thread using steps to get
accuracy in collisions detection instead of moving it to a new thread.

Examples are finished as simple and clear as I could. Finally, physac
module is MORE simpler than in the first version, calculation everything
by the same way for both types of physic objects.

I tryed to add rotated physics a couple of times but I didn't get
anything good to get a base to improve it. Maybe for the next version...

No bugs or strange behaviours found during testing.
2016-03-23 15:50:41 +01:00
victorfisac
c453ac8265 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-03-23 15:38:04 +01:00
raysan5
269b120104 Review Android button inputs 2016-03-21 20:15:11 +01:00
raysan5
584e74c676 Corrected bug on touch position 2016-03-20 16:48:23 +01:00
raysan5
fa78023aa4 Understand mouse as touch in web 2016-03-20 16:28:59 +01:00
raysan5
ebc2b9a286 Improved windows resizing system...
...despite not being enabled on GLFW3
2016-03-20 14:20:42 +01:00
raysan5
5e45c3c824 Redesign to work as standalone
Redesigned to work as standalone and support fordward-compatible context
(shaders review)
2016-03-20 13:39:27 +01:00
Ray
e2ba22ec59 Improved 2D-3D drawing
Depth test disabled for 2D and only used on 3D; consequently LINES vs
TRIANGLES vs QUADS buffers drawing order maters... but blending also
works ok.
2016-03-17 13:51:48 +01:00
Ray
49df957058 Add support for multiple gamepads on RPI 2016-03-17 12:54:36 +01:00
Ray
95c1bf9544 Removed previous change that introduced a bug 2016-03-16 19:10:19 +01:00
Ray
db4585b3e2 Improved gamepad support
Now it works ok also in RaspberryPi
2016-03-16 17:52:09 +01:00
Ray
d6bc7b8877 Reset pointCount for gestures 2016-03-16 17:51:21 +01:00
Ray
ee52b13ae6 Corrected bug on GetCollisionRec() 2016-03-16 17:50:51 +01:00
Ray
d0e26247f4 Merge pull request #103 from victorfisac/develop
physac module redesign (2/3)
2016-03-16 17:28:47 +01:00
victorfisac
0caf925d5d Updated headers 2016-03-16 12:48:30 +01:00
victorfisac
dc68205a18 Updated and improved physac examples 2016-03-16 12:46:12 +01:00
victorfisac
7128ef686d physac module redesign (2/3)
physac module base almost finished. All collisions are now resolved
properly and some force functions was added.

COLLIDER_CAPSULE removed for now because in 2D everything is composed by
rectangle and circle colliders...

The last step is move physics update loop into another thread and update
it in a fixed time step based on fps.
2016-03-16 12:45:01 +01:00
victorfisac
d728494099 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-03-16 12:40:08 +01:00
Ray
5bcda7bf15 Merge pull request #102 from LelixSuper/develop
Fix examples and templates compiling on GNU/Linux
2016-03-13 19:31:36 +01:00
LelixSuper
9e7a3b7017 Remove GLEW library and uncomment other GNU/Linux dependences 2016-03-13 19:26:12 +01:00
LelixSuper
530e520727 Convert tabs to spaces when it is possible in Makefile files 2016-03-13 14:01:12 +01:00
LelixSuper
2e3e62a413 Raname all makefile files to "Makefile"
I've renamed all makefile files to "Makefile" because they appear in the first files.
2016-03-12 20:01:46 +01:00
LelixSuper
4d8f18e00b Add a missing library for compiling on GNU/Linux
I've added "-ldl" library, it's necessary to compile the project.
2016-03-12 19:39:13 +01:00
LelixSuper
ea8363a3b0 Update "libraries" and "includes" section
I've cleaned the GNU/Linux compilation, now you can compile without useless parameters.
2016-03-12 19:08:54 +01:00
LelixSuper
c5931c75c6 Update GNU/Linux compilation
If you have raylib on standard directories ("/usr/local/include/raylib/raylib.h" for the header and "/usr/local/lib/libraylib.a" for raylib library) you can compile without edit the makefile.
2016-03-12 18:49:28 +01:00
LelixSuper
d07e4f44f1 Edit the default target to conform to GNU standards
I've changed all default target names with 'all'. Here there is the explanation: <https://www.gnu.org/prep/standards/standards.html#Standard-Targets>.
2016-03-12 18:40:52 +01:00
Ray
dcabb49244 GESTURE SWIPE
change name variable
2016-03-09 10:15:28 +01:00
Ray
18a13679fd Review GuiToggleButton() 2016-03-07 09:38:55 +01:00
raysan5
6ee5718b2e Improved function GetKeyPressed()
To support multiple keys (including function keys)
2016-03-06 19:30:16 +01:00
raysan5
d0e7195a16 Added new functions to draw text on image 2016-03-06 19:28:58 +01:00
raysan5
7053724fd6 Default style tweak 2016-03-06 12:24:44 +01:00
raysan5
c9d22c7a14 Redesign to use Material type -IN PROGRESS-
Requires Shader access functions review
2016-03-06 02:05:16 +01:00
Ray
893facdf6d Merge pull request #101 from victorfisac/develop
Redesigned physac module (IN PROGRESS)
2016-03-05 20:16:52 +01:00
victorfisac
78e4772f21 Fixed physac header little mistake 2016-03-05 19:36:40 +01:00
victorfisac
305efcf5ad Redesigned physics module (IN PROGRESS)
physac modules is being redesigned. Physics base behaviour is done and
it is composed by three steps: apply physics, resolve collisions and fix
overlapping.

A basic example is currently in progress. The next steps are try to add
torque and unoriented physic collisions and implement physics basic
functions to add forces. Rigidbody grounding state is automatically
calculated and has a perfect result. Rigidbodies interacts well with
each others.

To achieve physics accuracy, UpdatePhysics() is called a number of times
per frame. In a future, it should be changed to another thread and call
it without any target frame restriction.

Basic physics example has been redone (not finished) using the new
module functions. Forces examples will be redone so I removed it from
branch.
2016-03-05 17:05:02 +01:00
raysan5
0d911127d7 Split mesh generation from model loading 2016-03-05 16:17:54 +01:00
raysan5
5ea18b9426 Support 2d camera system -IN PROGRESS- 2016-03-05 15:40:08 +01:00
raysan5
d8bd8634ab 3d Camera: Added support for field-of-view Y 2016-03-05 13:05:45 +01:00
Ray
dcbf2a0e0c Replaced tabs by spaces 2016-03-03 13:24:56 +01:00
raysan5
fffbf48dec Added support for Nearest-Neighbor image scaling
Specially useful on default font scaling
2016-03-02 19:22:55 +01:00
raysan5
a167067cbd Security check for unsupported BMFonts
- Check if first character is the expected Space char (32)
- Check if characters are ordered in definition file (.fnt)
2016-03-02 18:35:30 +01:00
raysan5
4476a9e241 Review rlglUnproject() system 2016-03-02 17:13:31 +01:00
raysan5
4011c13d4b Updated BoundingBox collision detections 2016-03-01 20:54:02 +01:00
raysan5
6106ab8a2e Added color to DrawBoundigBox() 2016-03-01 20:26:01 +01:00
raysan5
1674465bdc Adjust buffers usage
- Removed DrawQuad() function
- DrawBillboard() uses DrawBillboardRec()
- DrawPlane() uses RL_TRIANGLES
- DrawRectangleV() uses RL_TRIANGLES, that way, [shapes] module uses
only TRIANGLES buffers.
2016-03-01 19:00:12 +01:00
raysan5
8ca6f8c6ec Do not free model mesh 2016-03-01 15:37:01 +01:00
raysan5
04caf1c262 Corrected memory leak 2016-03-01 15:36:45 +01:00
victorfisac
68088bc5be Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-02-26 14:28:05 +01:00
Ray
0dfc7fffff Removed a couple of TODOs 2016-02-23 00:57:50 +01:00
Ray
75a73d9417 Merge pull request #88 from raysan5/develop
Develop branch integration
2016-02-21 16:51:14 +01:00
raysan5
d042ed52fa Updated 2016-02-21 16:19:40 +01:00
raysan5
2cc05e5e92 Corrected typo 2016-02-21 16:19:31 +01:00
raysan5
2a058338f3 Updated some files 2016-02-21 14:34:11 +01:00
Ray
4d2b8471fa Update README.md 2016-02-21 14:17:33 +01:00
Ray
26252c4c1d Merge pull request #87 from raysan5/develop
Integrate Develop branch
2016-02-21 12:23:05 +01:00
Ray
c70d8acb33 Update README.md 2016-02-21 12:22:44 +01:00
Ray
16dd57747c Merge pull request #86 from raysan5/master
Small change from master to develop
2016-02-21 12:19:48 +01:00
Ray
24ba22a43a Update ROADMAP.md 2016-02-21 12:18:36 +01:00
Ray
2da3c6d288 Merge pull request #85 from raysan5/develop
Integrate Develop branch
2016-02-21 12:14:39 +01:00
Ray
c7486a0339 Update README.md 2016-02-21 12:13:36 +01:00
raysan5
c86b3d0c05 Updated 2016-02-21 02:34:07 +01:00
Ray
2d1b2efb92 Merge pull request #84 from raysan5/develop
Integrate Develop branch
2016-02-21 02:30:28 +01:00
raysan5
9ec4776812 Corrected typo 2016-02-21 02:29:11 +01:00
raysan5
2f08845d1e Updated docs 2016-02-21 02:27:34 +01:00
raysan5
9f5efeb309 Update makefiles 2016-02-21 00:44:55 +01:00
raysan5
182054b662 Updated for web 2016-02-20 23:49:21 +01:00
raysan5
a8bb9b6b19 Updated image to POT 2016-02-20 22:43:10 +01:00
raysan5
84252f9b70 Uploaded raylib bitcode library (PLATFORM_WEB) 2016-02-20 20:29:20 +01:00
raysan5
89409817b5 Games makefile 2016-02-20 20:25:10 +01:00
raysan5
7b360d8579 Reorganized games folder
Simplified to match raylib installer package folder structure
2016-02-20 20:25:01 +01:00
raysan5
83459159f4 Corrected compiler complaint 2016-02-20 19:01:41 +01:00
Ray
4b6e6d4dd4 Merge pull request #83 from raysan5/develop
Develop branch integration
2016-02-20 01:09:47 +01:00
Ray
954ced21a4 Merge branch 'master' into develop
# Conflicts:
#	src/gestures.c
#	src/makefile
2016-02-20 01:08:43 +01:00
Ray San
98c60838fe Reviewed RPI inputs 2016-02-19 19:57:25 +01:00
Ray
09f28d0f57 Working on RPI gamepad support 2016-02-19 00:16:16 +01:00
Ray San
8aab52aeda Redesigned RPI input system -IN PROGRESS- 2016-02-18 14:05:48 +01:00
Ray
afd2ffb74a Updated gestures module
Using normalized [0..1] input points
2016-02-17 13:00:48 +01:00
raysan5
825e42dc00 Updated logo size on t-shirt 2016-02-14 12:25:32 +01:00
raysan5
b99b21fa38 Added raylib promotional T-shirt design 2016-02-14 01:14:49 +01:00
raysan5
0018522031 Updated show-logo and start reviewing RPI inputs 2016-02-13 19:14:22 +01:00
raysan5
30fafb77db Updated fullscreen issue comment 2016-02-13 17:39:38 +01:00
raysan5
ed19064405 Reviewed physics module
A deeper revision required, not clear enough for the user
Key: Create a PhysicObjects pool
2016-02-13 17:09:53 +01:00
raysan5
94c92a58a1 Some tweaks 2016-02-13 17:08:09 +01:00
raysan5
9c9aeaef47 Added web template (shell) for html5 games 2016-02-13 12:21:29 +01:00
raysan5
cbbe948529 Some code tweaks 2016-02-12 19:02:23 +01:00
raysan5
823abf666e Reviewed code TODOs 2016-02-12 12:22:56 +01:00
raysan5
685273675b Improved LoadHeightmap() 2016-02-11 15:51:04 +01:00
raysan5
15cd4dce4e Updated examples to make them clearer 2016-02-11 14:56:27 +01:00
raysan5
9cbfcbb820 Add a note about an issue 2016-02-11 14:56:00 +01:00
raysan5
fca83c9ff8 Solve bug on matrix multiply order for scale and rotation 2016-02-11 14:27:18 +01:00
raysan5
54c7fa491e Added 6 new examples 2016-02-11 12:26:45 +01:00
Ray
c69ce1d750 Updated comments 2016-02-10 13:54:32 +01:00
Ray
84a6724b33 Fixed a bug 2016-02-10 11:24:02 +01:00
Ray
a847df921f Reviewed gestures module 2016-02-10 10:31:06 +01:00
Ray
687fe2c3c7 Updated 2016-02-08 09:06:26 +01:00
Ray
e98ea900cf Reviewing gestures module (IN PROGRESS) 2016-02-08 09:06:23 +01:00
Ray
2ef9552454 WARNING message shortened 2016-02-08 09:06:20 +01:00
Ray
6a392f0eb2 GLAD not used on HTML5 2016-02-08 09:06:16 +01:00
raysan5
c00062655f GLAD only available on PLATFORM_DESKTOP 2016-02-07 11:35:36 +01:00
raysan5
4ad375a378 Code review
Most of this code was developed by students, it requires some additional
review to be used for teaching.
2016-02-07 11:23:12 +01:00
raysan5
4a3509f06d Added game sources: Skully Escape
This game was developed for King GameJam 2015
2016-02-07 11:09:12 +01:00
raysan5
4fae37bb88 Removed floppy game, available as sample 2016-02-07 11:08:31 +01:00
Ray
646f1c3f71 Some formating tweaks 2016-02-03 17:45:28 +01:00
Ray
df5c64d0be Functions parameters reorganize: Axis and Angle
sin(), cos() functions cached and replaced by float c99 versions sinf(),
cos()
2016-02-02 18:41:01 +01:00
Ray
65ecde1e75 Cleaned code a little bit 2016-02-02 17:59:13 +01:00
Ray
728e1715cc Redesigned gestures system...
...and improved mouse gestures support
Some testing still required...
2016-02-02 16:43:42 +01:00
Ray
e484d58d9c Uploaded gamejam game sources 2016-01-31 15:31:51 +01:00
Ray
708e8c558c Added a bunch of sample games
Those games have been developed by students and ported to a common base
template. Some of them still require some review to be consistent with
each other (formatting, variables naming, code structure...)
2016-01-29 07:26:06 -08:00
Ray
4ec0ac89cd Merge pull request #82 from procedural/disable-cursor
Disable cursor feature
2016-01-29 06:57:42 -08:00
Ray
196bda0597 Merge pull request #81 from procedural/fix-shader-versions
Fix shader versions
2016-01-29 06:53:05 -08:00
Ray
bf32081fa9 Merge pull request #80 from procedural/fix-compiling-on-linux
Fix raylib compiling on Linux
2016-01-29 06:52:41 -08:00
Constantine Tarasenkov
13925f7bd4 Add functions to disable and enable cursor 2016-01-29 09:09:18 +03:00
Constantine Tarasenkov
e6ad166ae3 2016-01-29 08:02:53 +03:00
Constantine Tarasenkov
db5493b783 Fix shader versions 2016-01-29 03:47:43 +03:00
Constantine Tarasenkov
5d6475c93b Fix raylib compiling on Linux 2016-01-29 03:22:51 +03:00
raysan5
ac475f46b9 Added touch points id to gestures
Required by ProcessGestureEvent()
2016-01-28 10:03:37 +01:00
Ray
c21ca3ca1a Updated screenshots 2016-01-26 20:26:46 +01:00
raysan5
99f99bea47 Simplified shader matrix uniforms 2016-01-25 13:54:09 +01:00
raysan5
d0ff78e7f4 Move Light struct to example 2016-01-25 13:39:23 +01:00
raysan5
3113a20390 Added bounding box calculation 2016-01-25 11:12:31 +01:00
raysan5
41959eeae1 Added support for mouse gestures (need testing)
Mouse input is interpreted as touches to allow mouse gestures
detection... and get an unified inputs system for all platforms!
2016-01-24 19:17:08 +01:00
raysan5
08da91047e Some code tweaks 2016-01-23 13:22:13 +01:00
raysan5
6e9d3eb0f9 Review comments 2016-01-23 12:37:42 +01:00
Ray
ed674d865b Merge pull request #79 from victorfisac/develop
Fixed hold gesture detection
2016-01-23 11:16:59 +01:00
victorfisac
233f7611da Fixed hold gesture detection
- Fixed gestures hold detection.
- Improved hold state detection for little touch position increments
(sensitivity).
2016-01-22 17:07:54 +01:00
victorfisac
f874fdc1ad Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-22 15:36:56 +01:00
raysan5
4e57bd1f18 Replaced GLEW by GLAD
Removed GLEW external dependency, now it works with GLAD
Kept GLEW path, just in case... detected weird behaviour when testing
with gDEBugger
2016-01-22 01:22:45 +01:00
raysan5
455be7f6f6 Try to implement GLAD support 2016-01-21 13:52:09 +01:00
raysan5
23d66e9b6f Move extensions loading to core module 2016-01-21 12:24:35 +01:00
raysan5
882e2abee1 Corrected bug 2016-01-21 12:24:12 +01:00
raysan5
68ba34c17b Updated struct types 2016-01-21 01:03:43 +01:00
Ray
a286d9166b Merge pull request #78 from victorfisac/develop
Added ray-sphere collision detection
2016-01-20 19:34:34 +01:00
victorfisac
fcd30c5649 Added ray-sphere collision detection 2016-01-20 19:28:47 +01:00
victorfisac
8ae0da1fa1 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-20 19:26:52 +01:00
victorfisac
25f5995be0 Revert "Added ray-sphere collision detection"
This reverts commit 423a45ac85.
2016-01-20 19:26:30 +01:00
raysan5
cf6c6fefd7 Review some function names for consistency with raymath 2016-01-20 19:23:58 +01:00
raysan5
c5663ca015 Some formatting tweaks 2016-01-20 19:09:48 +01:00
raysan5
51c0b61a43 Updated to latest version of stb libs 2016-01-20 18:48:52 +01:00
raysan5
634f8f0d0f Adapted easings as single header and inline functions 2016-01-20 18:20:36 +01:00
raysan5
efa1c96d19 Adapted raymath as single header library
Added support for single header implementation and also inline functions
support
2016-01-20 18:20:05 +01:00
victorfisac
423a45ac85 Added ray-sphere collision detection
- Added simple ray-sphere collision detection.
- Added extra function with extended parameters to obtain collision
point vector.
- Fixed bounding box calculations init values (were causing compiling
errors).
2016-01-20 16:01:59 +01:00
victorfisac
dc385ba4ec Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-20 15:59:32 +01:00
Ray
c8e8c0a002 Merge pull request #76 from kd7tck/develop
standalone raymath
2016-01-20 15:47:48 +01:00
victorfisac
c04752c0e4 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-20 13:48:00 +01:00
Joshua Reisenauer
ae87a35f6e standalone raymath
look over for errors
2016-01-19 15:00:48 -08:00
raysan5
29c618a35e Added some functions (incomplete) 2016-01-19 20:27:41 +01:00
raysan5
036e77939f Updated for raylib v1.4
Moved building information to raylib github Wiki page
2016-01-19 11:00:10 +01:00
raysan5
de7bddb8df Updated with progresses 2016-01-19 10:59:19 +01:00
raysan5
fd05d3e353 Rename VertexData struct to Mesh
Reviewed vertex type variables
2016-01-18 13:36:18 +01:00
raysan5
a640503119 Corrected literal value 2016-01-18 13:33:12 +01:00
raysan5
f24fd14814 Note on RPI inputs 2016-01-18 12:05:10 +01:00
raysan5
f98c4dc82b Corrected bug on fonts loading 2016-01-18 12:04:54 +01:00
Ray
f1d16386b6 Update shaders_basic_lighting.c 2016-01-17 02:13:08 +01:00
Ray
144681fc0f Rename lighting_blinn_phong.c to shaders_basic_lighting.c 2016-01-17 02:11:06 +01:00
raysan5
03c82605a0 Replaced deprecated texture2D() function by texture() 2016-01-16 12:53:48 +01:00
raysan5
183795b8aa Review literals type 2016-01-16 12:52:55 +01:00
Ray San
91e00431d4 Corrected some bugs 2016-01-14 09:19:56 +01:00
raysan5
3b4d8442e0 Corrected some float values 2016-01-13 19:30:35 +01:00
raysan5
4f0165f32d Example reviewed (more clear now) 2016-01-13 18:11:11 +01:00
raysan5
fb6ef2c2f4 Vertex shaders optimization 2016-01-13 17:13:28 +01:00
Ray
bb49102a4b Merge pull request #73 from victorfisac/develop
World to screen conversion and little review
2016-01-11 19:47:17 +01:00
victorfisac
4cc394c376 Added world to screen conversion
- Added function WorldToScreen(...).
- Added world to screen example.
- Review GetMouseRay() comment.
- Removed deprecated lighting functions from raylib header.
2016-01-11 15:59:26 +01:00
victorfisac
8eb6fc5612 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-11 15:09:23 +01:00
raysan5
5e7686695f Review Light/Material system
Simplified for the user (more intuitive and clear)
Removed lighting module dependency
2016-01-11 13:29:55 +01:00
raysan5
e5a56fa985 Change drawing order to avoid artifacts with...
... transparent elements
2016-01-11 11:59:15 +01:00
Ray
f10835cf09 Merge pull request #72 from victorfisac/develop
Fixed small glitch on zoom-in
2016-01-10 23:01:39 +01:00
victorfisac
a5e79b7663 Fixed small glitch on zoom-in with mouse wheel
It seems that now works. Tested all free camera features with some
directions and positions and no unexpected behaviours detected. I don't
know if those lines are really indispensable.
2016-01-08 02:53:26 +01:00
victorfisac
b7461846ab Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-08 02:47:44 +01:00
raysan5
40119949cb Ignore some files 2016-01-07 17:12:54 +01:00
Ray
21229aa3f6 Merge pull request #71 from victorfisac/develop
Implemented ray trace from mouse position
2016-01-07 17:04:56 +01:00
victorfisac
1793f2c3b8 Added collision check between ray and box
- Added CheckCollisionRayBox() function.
- Updated and improved core 3d picking example (currently working as
expected).
2016-01-07 16:18:24 +01:00
victorfisac
4a637191f2 Implemented ray trace from mouse position
- Fixed GetMouseRay() function.
- rlglUnproject() unused.
2016-01-07 15:34:49 +01:00
victorfisac
8991573984 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-06 19:19:31 +01:00
raysan5
7f2e67e924 Simplified MatrixMultiply() function 2016-01-06 17:22:24 +01:00
Ray
1ce010c7d4 Merge pull request #70 from victorfisac/develop
Fixed Android bug and added physic buttons inputs
2016-01-06 17:16:03 +01:00
victorfisac
fe0cf8f9a9 Added some comments and fixed spaces 2016-01-05 13:58:20 +01:00
victorfisac
32508f6db1 Fixed Android lock screen bug
- Fixed Android locking screen bug. OnDestroy() was called when locking
screen.
- Power button input must be handled by OS.
- AndroidManifest.xml is affected by configChanges="screenSize".
- Updated library header for android template.
2016-01-05 12:21:40 +01:00
victorfisac
1c23edd1e5 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-04 21:03:30 +01:00
victorfisac
ea50092356 Add Android physic buttons input detection
- Added functions for detect when pressed, during down and when
released.
- Added defines for back, menu, volume up and down button numbers.
2016-01-04 21:00:20 +01:00
raysan5
891c4a458a Matrix variables renaming 2016-01-04 20:02:57 +01:00
victorfisac
0c539cbf32 Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop 2016-01-04 19:28:52 +01:00
raysan5
70d405b41b Added functionality: Storage values
Two new functions added to save/load values as binary data:
- StorageSaveValue()
- StorageLoadValue()
2016-01-04 15:12:34 +01:00
raysan5
95da97fa74 Fixed bug: rlglGenerateMipmaps() 2016-01-04 15:09:44 +01:00
Ray
546c727520 Merge pull request #69 from victorfisac/develop
Improved lighting and physac engine modules and added new example
2016-01-04 12:40:54 +01:00
victorfisac
1656d17b22 Fixed little bug in lighting blinn phong example 2016-01-03 18:24:20 +01:00
victorfisac
8fa5c9dce2 Added rigidbody force example image 2016-01-03 18:05:09 +01:00
victorfisac
b8b34a1b26 Added new physics example
New physics example to see AddForceAtPosition() behaviour applied to 5
rigidbodies.
2016-01-03 17:58:16 +01:00
victorfisac
6608c5a8a7 Fixed physics basic example example name 2016-01-03 17:54:06 +01:00
victorfisac
a299bc289b Improved and added functions to physac engine module
- Improved physics calculations.
- Added AddForceAtPosition function (added to all enabled rigidbodies).
- Updated raylib header.
2016-01-03 17:53:29 +01:00
victorfisac
e0d8cceb65 Fixed lighting engine module newlines at end of file 2016-01-03 17:52:18 +01:00
raysan5
3a739c38c5 Updated Android project template 2016-01-03 13:01:42 +01:00
raysan5
d32feaa668 Reviewed Android inputs and gestures system
Corrected Android processing for some inputs (BACK button, VOLUME
buttons)
Redesigned Gestures system (some work still required)
SetEnabledGestures() - Only support desired gestures (requires some
review)
2016-01-03 13:01:21 +01:00
raysan5
f269fb46ea BUG: Gestures lib was processed two times 2016-01-03 12:57:44 +01:00
raysan5
63ea3449d3 Reorganized folders 2016-01-02 11:14:24 +01:00
raysan5
e97438114f Reviewed code 2016-01-02 11:14:04 +01:00
raysan5
a5492dd5fc Corrected compilation flag...
...to avoid .mem file creation
2016-01-02 11:00:23 +01:00
raysan5
fa057f512f Improved fonts support
Added LoadBMFont() to load AngelCode fonts (.fnt)
Implemented LoadTTF() to load .ttf fonts (crappy packaging)
2016-01-02 10:45:51 +01:00
raysan5
55f0abbe99 Updated to latest version 2016-01-02 10:44:03 +01:00
raysan5
9f5c5dfff4 Added module: easings (header only) 2016-01-02 10:43:17 +01:00
raysan5
802f29fb0e Eat Android Back key to avoid crash 2016-01-02 10:42:43 +01:00
raysan5
8a29e5eb5e Updated version to avoid warning 2016-01-02 10:42:01 +01:00
raysan5
b804f38150 Small code tweaks 2016-01-02 10:41:37 +01:00
raysan5
46ea556593 Gestures system is automatically Init and Updated 2015-12-31 13:34:45 +01:00
raysan5
5335f262be Updated makefiles 2015-12-31 13:34:03 +01:00
Ray
b11cda959d Update lighting_blinn_phong.c 2015-12-30 13:46:01 +01:00
Ray
8c8e5bb7c8 Update and rename physics.c to physac.c 2015-12-30 13:43:53 +01:00
Ray
59cf0f6a42 Update and rename physics.h to physac.h 2015-12-30 13:42:59 +01:00
raysan5
5659249dfa Some tweaks and details review 2015-12-30 13:35:03 +01:00
raysan5
b894a78385 Reviewed function GetCurrentTime() on WIN32 2015-12-30 13:34:45 +01:00
raysan5
3b45336929 Reviewed function: CheckCollisionCircleRec() 2015-12-30 13:34:00 +01:00
raysan5
da28cff0f6 Added function: SubText()
Useful to get a piece of text, could be used for text typing animations
2015-12-30 13:33:26 +01:00
raysan5
5dbb93dbb4 Added function: ImageDither()
Corrected some code details
2015-12-30 13:32:41 +01:00
Ray
6cb0603fbe Merge pull request #67 from victorfisac/develop
Fixed Android compilation with 1.3 updates
2015-12-30 13:24:39 +01:00
victorfisac
8e30bd1f69 Fixed and improved android template
- Added gestures module functions.
- Fixed screen tap detection.
2015-12-30 04:43:24 +01:00
victorfisac
6e5ceaa30d Fixed Android compilation with 1.3 updates
- Fixed Android MakeFile adding gestures module.
- Fixed Android project template functions names.
- Updated compiled library and header.
2015-12-30 03:12:52 +01:00
Ray
e8c79f53a6 Merge pull request #66 from victorfisac/develop
New matrix location points, lighting and physics engine modules with examples
2015-12-24 12:42:48 +01:00
victorfisac
e683fe88b9 Added physics engine-module and example
- Added new physics engine-module with four new data types: Physics,
Transform, Rigidbody and Collider. This library contains functions to
apply physics calculations to a position vector calculating collisions
automatically.

- Fixed some writing mistakes of lighting module.
2015-12-21 21:12:35 +01:00
victorfisac
1bcb5ddd50 Added lighting engine module
- New lighting engine module which contains new data types Light and
Material. These data types and functions facilitates making a basic 3D
iluminated program with a light and a model.

- Added lighting engine module example (currently included in raylib.h;
it might be compiled by separate and include lighting.h in game source C
file).

- Corrected some opengl defines control structures and added some TODO
to fix raylib-opengl 1.1 source build (note: now source can be compiled
without errors, but rlglReadPixels() won't work properly).

Note: most of functions of phong version 330 shader are not in v100
shaders, so I couldn't write a version 100 phong shader. These functions
are included from version 150.
2015-12-21 17:25:22 +01:00
victorfisac
4db2da9185 Added new matrix location points and extra functions
- New model and view transformation matrix added, useful for shaders.
Modelview matrix not deleted to keep opengl 1.1 pipeline compatibility.

- New extra function added DrawModelWiresEx() to set a rotation and
scale transformations to a wire model drawing.

- Other writing and little audio.c bug fixed.
2015-12-21 16:42:13 +01:00
raysan5
1b39b2e261 Added BeginDrawingEx()
BeginDrawing() function with extended parameters
2015-12-14 23:30:27 +01:00
raysan5
f144b6bae4 MeasureTextEx() - Added support for multi-line size measure 2015-12-09 20:57:50 +01:00
raysan5
2bd7245508 DrawTextureRec() function review to allow flipped rectangle 2015-12-09 20:22:42 +01:00
raysan5
b62f7c3057 Corrected bug 2015-12-09 20:21:58 +01:00
raysan5
f4e455398c Small bug corrected 2015-12-03 13:45:06 +01:00
raysan5
85908befea Corrected bug on spritefont loading 2015-12-03 13:44:45 +01:00
Ray
a6f5a0339a Corrected bug 2015-11-09 13:13:26 +01:00
Ray
c17c1ccaea Corrected html5 glfw3 bug
Mouse button values are inverted!
2015-11-05 13:42:18 +01:00
Ray
88e1fd9530 Added texture retrieval support on OpenGL ES 2.0
Updated functions:
Image GetTextureData(Texture2D texture);
void *rlglReadTexturePixels(Texture2D texture);
2015-11-05 12:32:47 +01:00
Ray
2fa7e00f16 Variables initialization 2015-11-05 12:28:45 +01:00
Ray
5208d57f1e Corrected alpha issue on screenshots taken 2015-11-05 09:46:18 +01:00
Ray
76024b5036 Added some texture functionality (view details)
LoadTextureEx() - Simplified parameters
UpdateTexture() - Added, allows updating GPU texture data
2015-11-04 18:33:46 +01:00
Ray
002dacef40 Merge pull request #62 from kd7tck/develop
Added Alpha Numeric Mapping For Develop Branch
2015-11-03 16:44:21 +01:00
Ray
580c0a7296 Moved gestures touch functionality back to core
Required gestures module when compiling for Android and Web
2015-10-30 11:30:32 +01:00
Ray
67423ff64b Removed unneeded comment 2015-10-27 19:24:14 +01:00
raysan5
b135bcd422 Corrected minor bugs 2015-10-26 12:14:26 +01:00
Ray San
fb4105cf8a Corrected bug on web 2015-10-26 11:50:28 +01:00
Ray San
d1f099374c Added support for s3tc compression on web 2015-10-26 11:50:13 +01:00
Joshua Reisenauer
932396922d Added Alpha Numeric Mapping For Develop Branch
GLFW mappings.
2015-10-26 00:21:52 -07:00
Ray
afdf357fbe Added some image manipulation functions
Added (or completed functions):

Image ImageText(const char *text, int fontSize, Color color);
Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int
spacing, Color tint);
void ImageFlipVertical(Image *image);
void ImageFlipHorizontal(Image *image);
void ImageColorTint(Image *image, Color color);
void ImageColorInvert(Image *image);
void ImageColorGrayscale(Image *image);
void ImageColorContrast(Image *image, float contrast);
void ImageColorBrightness(Image *image, int brightness);
2015-10-25 01:50:15 +02:00
Ray
8c117cfb57 Reviewed NPOT messages and usage 2015-10-24 11:19:04 +02:00
Ray San
f13b30d606 Feature: Line-break support for text 2015-10-21 18:24:44 +02:00
Ray San
165b3dd215 Add file required for image scaling 2015-10-21 18:24:12 +02:00
Ray San
d218534fff Feature: On desktop, center window on screen 2015-10-21 18:23:49 +02:00
Ray San
333fdf6b90 Corrected bugs and reviewed some functions 2015-10-20 19:59:08 +02:00
Ray San
625e4e2fb3 Revert "Corrected bugs and reviewed some functions"
This reverts commit 949e93f9fe.
2015-10-20 19:56:31 +02:00
Marc Palau
949e93f9fe Corrected bugs and reviewed some functions 2015-10-20 19:53:50 +02:00
raysan5
e9792ef771 Convert to UTF-8 2015-10-06 17:32:00 +02:00
raysan5
9bf411f580 Added a bunch of image manipulation functions:
Renamed functions (for coherence with new ones):
- ImageConvertToPOT() -> ImageToPOT()
- ImageConvertFormat() -> ImageFormat()

New functions added (IN PROGRESS):
- ImageCopy()
- ImageCrop()
- ImageResize() (Uses stb_image_resize.h)
- ImageDraw()
- ImageDrawText()
- ImageDrawTextEx()
- ImageFlipVertical()
- ImageFlipHorizontal()
- ImageColorInvert()
- ImageColorGrayscale()
- ImageColorContrast()
- ImageColorBrightness()
2015-10-06 17:30:03 +02:00
raysan5
11a8dacb0f Multiple code changes:
- Renamed function rlEnableFBO() -> rlEnablePostproFBO()
- Defined struct FBO
- Moved FBO creation to function: rlglLoadFBO()
- Reviewed rlglReadTexturePixels(), trying to support OpenGL ES -IN
PROGRESS-
2015-10-06 17:25:27 +02:00
raysan5
3bd7109d8b Reviewed GetCurrentTime() -IN PROGRESS-
Time measure on Windows platform done with:
QueryPerformanceCounter()
Testing required!
2015-10-06 17:21:04 +02:00
raysan5
9af10686b2 Added comments and more...
Corrected bug on defaultFont.size
Renamed funcs:
ImageConvertFormat() -> ImageFormat()
ImageConvertToPOT() -> ImageToPOT()
2015-10-06 17:17:53 +02:00
raysan5
c5377f4e05 Review CFLAGS for multiple platforms 2015-10-06 17:15:50 +02:00
raysan5
34db515acb Reviewed some comments and WritePNG() 2015-10-06 17:13:40 +02:00
Ray
6ffb3c72fb Solved bug with depth when drawing...
...shapes based on LINES, TRIANGLES and QUADS. Now the calling order of
the drawing functions is respected!
2015-09-21 12:48:43 +02:00
Ray
f582ab06ad Merge pull request #29 from procedural/linux-fixes
Fix compiling on Linux
2015-09-04 17:50:16 +02:00
Constantine Tarasenkov
7c36289768 Fix compiling on Linux 2015-09-04 15:38:14 +03:00
Ray
544df87a8e Corrected typo 2015-09-03 14:10:23 +02:00
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
602 changed files with 159646 additions and 38262 deletions

40
.gitignore vendored
View File

@@ -1,18 +1,15 @@
# Ignore generated files # Ignore generated files
# ... # ...
# Ignore compiled binaries # Ignore VIM's backup generated files
src/*.o *.swp
src/*.exe
examples/*.o
examples/*.exe
templates/*.exe
# Ignore Android generated files and folders # Ignore Android generated files and folders
src_android/obj/ src_android/obj/
templates/android_project/bin/ templates/android_project/bin/
templates/android_project/obj/ templates/android_project/obj/
templates/android_project/libs/ templates/android_project/libs/
local.properties
# Ignore thumbnails created by windows # Ignore thumbnails created by windows
Thumbs.db Thumbs.db
@@ -48,8 +45,11 @@ _ReSharper*/
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
ipch/ ipch/
*.opensdf *.opensdf
# Ignore compiled binaries
*.o
*.exe *.exe
!tools/rrem.exe !tools/rREM/rrem.exe
# Ignore files build by xcode # Ignore files build by xcode
*.mode*v* *.mode*v*
@@ -63,4 +63,28 @@ xcschememanagement.plist
.DS_Store .DS_Store
._.* ._.*
xcuserdata/ xcuserdata/
DerivedData/ DerivedData/
*.dll
src/libraylib.a
src/libraylib.bc
# oculus example
!examples/oculus_glfw_sample/
# external libraries DLLs
!src/external/glfw3/lib/win32/glfw3.dll
!src/external/openal_soft/lib/win32/OpenAL32.dll
!src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll
!src/external/pthread/lib/pthreadGC2.dll
# Visual Studio project
project/vs2015/*.db
project/vs2015/*.opendb
!project/vs2015/raylib.sln
!project/vs2015/raylib/*.vcxproj
!project/vs2015/examples/*.vcxproj
!project/vs2015/external/glfw3/lib/win32/glfw3.dll
!project/vs2015/external/openal_soft/lib/win32/OpenAL32.dll
!project/vs2015/external/openal_soft/lib/win64/OpenAL32.dll
!project/vs2015/external/lua/lib/win32/lua53.dll

242
CHANGELOG
View File

@@ -1,10 +1,246 @@
changelog changelog
--------- ---------
Current Release: raylib 1.2.2 (31 December 2014) Current Release: raylib 1.6.0 (20 November 2016)
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source. -----------------------------------------------
NOTE: Current Release includes all previous updates. Release: raylib 1.6.0 (20 November 2016)
-----------------------------------------------
NOTE:
This new raylib version commemorates raylib 3rd anniversary and represents another complete review of the library.
It includes some interesting new features and is a stepping stone towards raylib future.
HUGE changes:
[rlua] LUA BINDING: Complete raylib LUA binding, ALL raylib functions ported to LUA plus the +60 code examples.
[audio] COMPLETE REDESIGN: Improved music support and also raw audio data processing and playing, +20 new functions added.
[physac] COMPLETE REWRITE: Improved performance, functionality and simplified usage, moved to own repository and added multiple examples!
Other changes:
[core] Corrected issue on OSX with HighDPI display
[core] Added flag to allow resizable window
[core] Allow no default font loading
[core] Corrected old issue with mouse buttons on web
[core] Improved gamepad support, unified across platforms
[core] Gamepad id functionality: GetGamepadName(), IsGamepadName()
[core] Gamepad buttons/axis checking functionality:
[core] Reviewed Android key inputs system, unified with desktop
[rlgl] Redesigned lighting shader system
[rlgl] Updated standard shader for better performance
[rlgl] Support alpha on framebuffer: rlglLoadRenderTexture()
[rlgl] Reviewed UpdateVrTracking() to update camera
[rlgl] Added IsVrSimulator() to check for VR simulator
[shapes] Corrected issue on DrawPolyEx()
[textures] Simplified supported image formats support
[textures] Improved text drawing within an image: ImageDrawText()
[textures] Support image alpha mixing: ImageAlphaMask()
[textures] Support textures filtering: SetTextureFilter()
[textures] Support textures wrap modes: SetTextureWrap()
[text] Improved TTF spritefont generation: LoadSpriteFontTTF()
[text] Improved AngelCode fonts support (unordered chars)
[text] Added TraceLog info on image spritefont loading
[text] Improved text measurement: MeasureTextEx()
[models] Improved OBJ loading flexibility
[models] Reviewed functions: DrawLine3D(), DrawCircle3D()
[models] Removed function: ResolveCollisionCubicmap()
[camera] Redesigned camera system and ported to header-only
[camera] Removed function: UpdateCameraPlayer()
[gestures] Redesigned gestures module to header-only
[audio] Simplified Music loading and playing system
[audio] Added trace on audio device closing
[audio] Reviewed Wave struct, improved flexibility
[audio] Support sound data update: UpdateSound()
[audio] Added support for FLAC audio loading/streaming
[raygui] Removed raygui from raylib repo (moved to own repo)
[build] Added OpenAL static library
[build] Added Visual Studio 2015 projects
[build] Support shared/dynamic raylib compilation
[*] Updated LibOVR to SDK version 1.8
[*] Updated games to latest raylib version
[*] Improved examples and added new ones
[*] Improved Android support
-----------------------------------------------
Release: raylib 1.5.0 (18 July 2016)
-----------------------------------------------
NOTE:
Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned,
lots of bugs have been solved and some **AMAZING** new features have been added.
HUGE changes:
[rlgl] OCULUS RIFT CV1: Added support for VR, not oly Oculus Rift CV1 but also stereo rendering simulator (multiplatform).
[rlgl] MATERIALS SYSTEM: Added support for Materials (.mtl) and multiple material properties: diffuse, specular, normal.
[rlgl] LIGHTING SYSTEM: Added support for up to 8 lights of 3 different types: Omni, Directional and Spot.
[physac] REDESIGNED: Improved performance and simplified usage, physic objects now are managed internally in a second thread!
[audio] CHIPTUNES: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels supported.
other changes:
[core] Review Android button inputs
[core] Support Android internal data storage
[core] Renamed WorldToScreen() to GetWorldToScreen()
[core] Removed function SetCustomCursor()
[core] Removed functions BeginDrawingEx(), BeginDrawingPro()
[core] Replaced functions InitDisplay() + InitGraphics() with: InitGraphicsDevice()
[core] Added support for field-of-view Y (fovy) on 3d Camera
[core] Added 2D camera mode functions: Begin2dMode() - End2dMode()
[core] Translate mouse inputs to Android touch/gestures internally
[core] Translate mouse inputs as touch inputs in HTML5
[core] Improved function GetKeyPressed() to support multiple keys (including function keys)
[core] Improved gamepad support, specially for RaspberryPi (including multiple gamepads support)
[rlgl] Support stereo rendering simulation (duplicate draw calls by viewport, optimized)
[rlgl] Added distortion shader (embeded) to support custom VR simulator: shader_distortion.h
[rlgl] Added support for OpenGL 2.1 on desktop
[rlgl] Improved 2D vs 3D drawing system (lines, triangles, quads)
[rlgl] Improved DXT-ETC1 support on HTML5
[rlgl] Review function: rlglUnproject()
[rlgl] Removed function: rlglInitGraphics(), integrated into rlglInit()
[rlgl] Updated Mesh and Shader structs
[rlgl] Simplified internal (default) dynamic buffers
[rlgl] Added support for indexed and dynamic mesh data
[rlgl] Set fixed vertex attribs location points
[rlgl] Improved mesh data loading support
[rlgl] Added standard shader (embeded) to support materials and lighting: shader_standard.h
[rlgl] Added light functions: CreateLight(), DestroyLight()
[rlgl] Added wire mode functions: rlDisableWireMode(), rlEnableWireMode()
[rlgl] Review function consistency, added: rlglLoadMesh(), rlglUpdateMesh(), rlglDrawMesh(), rlglUnloadMesh()
[rlgl] Replaced SetCustomShader() by: BeginShaderMode() - EndShaderMode()
[rlgl] Replaced SetBlendMode() by: BeginBlendMode() - EndBlendMode()
[rlgl] Added functions to customize internal matrices: SetMatrixProjection(), SetMatrixModelview()
[rlgl] Unified internal shaders to only one default shader
[rlgl] Added support for render to texture (RenderTexture2D):
LoadRenderTexture() - UnloadRenderTexture()
BeginTextureMode() - EndTextureMode()
[rlgl] Removed SetShaderMap*() functions
[rlgl] Redesigned default buffers usage functions:
LoadDefaultBuffers() - UnloadDefaultBuffers()
UpdateDefaultBuffers() - DrawDefaultBuffers()
[shapes] Corrected bug on GetCollisionRec()
[textures] Added support for Nearest-Neighbor image scaling
[textures] Added functions to draw text on image: ImageDrawText(), ImageDrawTextEx()
[text] Reorganized internal functions: Added LoadImageFont()
[text] Security check for unsupported BMFonts
[models] Split mesh creation from model loading on heightmap and cubicmap
[models] Updated BoundingBox collision detections
[models] Added color parameter to DrawBoundigBox()
[models] Removed function: DrawQuad()
[models] Removed function: SetModelTexture()
[models] Redesigned DrawPlane() to use RL_TRIANGLES
[models] Redesigned DrawRectangleV() to use RL_TRIANGLES
[models] Redesign to accomodate new materials system: LoadMaterial()
[models] Added material functions: LoadDefaultMaterial(), LoadStandardMaterial()
[models] Added MTL material loading support: LoadMTL()
[models] Added function: DrawLight()
[audio] Renamed SoundIsPlaying() to IsSoundPlaying()
[audio] Renamed MusicIsPlaying() to IsMusicPlaying()
[audio] Support multiple Music streams (indexed)
[audio] Support multiple mixing channels
[gestures] Improved and reviewed gestures system
[raymath] Added QuaternionInvert()
[raymath] Removed function: PrintMatrix()
[raygui] Ported to header-only library (https://github.com/raysan5/raygui)
[shaders] Added depth drawing shader (requires a depth texture)
[shaders] Reviewed included shaders and added comments
[OpenAL Soft] Updated to latest version (1.17.2)
[GLFW3] Updated to latest version (3.2)
[stb] Updated to latest headers versions
[GLAD] Converted to header only library and simplified to only used extensions
[*] Reorganize library folders: external libs moved to src/external folder
[*] Reorganize src folder for Android library
[*] Review external dependencies usage
[*] Improved Linux and OSX build systems
[*] Lots of tweaks and bugs corrected all around
-----------------------------------------------
Release: raylib 1.4.0 (22 February 2016)
-----------------------------------------------
NOTE:
This version supposed another big improvement for raylib, including new modules and new features.
More than 30 new functions have been added to previous raylib version.
Around 8 new examples and +10 new game samples have been added.
BIG changes:
[textures] IMAGE MANIPULATION: Functions to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
[text] SPRITEFONT SUPPORT: Added support for AngelCode fonts (.fnt) and TrueType fonts (.ttf).
[gestures] REDESIGN: Gestures system simplified and prepared to process generic touch events, including mouse events (multiplatform).
[physac] NEW MODULE: Basic 2D physics support, use colliders and rigidbodies; apply forces to physic objects.
other changes:
[rlgl] Removed GLEW library dependency, now using GLAD
[rlgl] Implemented alternative to glGetTexImage() on OpenGL ES
[rlgl] Using depth data on batch drawing
[rlgl] Reviewed glReadPixels() function
[core][rlgl] Reviewed raycast system, now 3D picking works
[core] Android: Reviewed Android App cycle, paused if inactive
[shaders] Implemented Blinn-Phong lighting shading model
[textures] Implemented Floyd-Steinberg dithering - ImageDither()
[text] Added line-break support to DrawText()
[text] Added TrueType Fonts support (using stb_truetype)
[models] Implement function: CalculateBoundingBox(Mesh mesh)
[models] Added functions to check Ray collisions
[models] Improve map resolution control on LoadHeightmap()
[camera] Corrected small-glitch on zoom-in with mouse-wheel
[gestures] Implemented SetGesturesEnabled() to enable only some gestures
[gestures] Implemented GetElapsedTime() on Windows system
[gestures] Support mouse gestures for desktop platforms
[raymath] Complete review of the module and converted to header-only
[easings] Added new module for easing animations
[stb] Updated to latest headers versions
[*] Lots of tweaks around
-----------------------------------------------
Release: raylib 1.3.0 (01 September 2015)
-----------------------------------------------
NOTE:
This version supposed a big boost for raylib, new modules have been added with lots of features.
Most of the modules have been completely reviewed to accomodate to the new features.
Over 50 new functions have been added to previous raylib version.
Most of the examples have been redone and +10 new advanced examples have been added.
BIG changes:
[rlgl] SHADERS: Support for model shaders and postprocessing shaders (multiple functions)
[textures] FORMATS: Support for multiple internal formats, including compressed formats
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
[gestures] NEW MODULE: Gestures system for Android and HTML5 platforms
[raygui] NEW MODULE: Set of IMGUI elements for tools development (experimental)
smaller changes:
[rlgl] Added check for OpenGL supported extensions
[rlgl] Added function SetBlenMode() to select some predefined blending modes
[core] Added support for drop&drag of external files into running program
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
[core] Renamed function SetFlags() to SetConfigFlags()
[shapes] Simplified some functions to improve performance
[textures] Review of Image struct to support multiple data formats
[textures] Added function LoadImageEx()
[textures] Added function LoadImageRaw()
[textures] Added function LoadTextureEx()
[textures] Simplified function parameters LoadTextureFromImage()
[textures] Added function GetImageData()
[textures] Added function GetTextureData()
[textures] Renamed function ConvertToPOT() to ImageConvertToPOT()
[textures] Added function ImageConvertFormat()
[textures] Added function GenTextureMipmaps()
[text] Added support for Latin-1 Extended characters for default font
[text] Redesigned SpriteFont struct, replaced Character struct by Rectangle
[text] Removed function GetFontBaseSize(), use directly spriteFont.size
[models] Review of struct: Model (added shaders support)
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
[models] Added function DrawCubeTexture()
[models] Added function DrawQuad()
[models] Added function DrawRay()
[models] Simplified funtion DrawPlane()
[models] Removed function DrawPlaneEx()
[models] Simplified funtion DrawGizmo()
[models] Removed function DrawGizmoEx()
[models] Added function LoadModelEx()
[models] Review of function LoadCubicMap()
[models] Added function ResolveCollisionCubicmap()
[audio] Decopupled from raylib, now this module can be used as standalone
[audio] Added function UpdateMusicStream()
[raymath] Complete review of the module
[stb] Updated to latest headers versions
[*] Lots of tweaks around
----------------------------------------------- -----------------------------------------------
Release: raylib 1.2.2 (31 December 2014) Release: raylib 1.2.2 (31 December 2014)

View File

@@ -7,23 +7,21 @@ please, [let me know][raysan5].
The following help is highly appreciated: The following help is highly appreciated:
- C programming - Can you write / review / test / improve the code? - C programming - Can you write / review / test / improve the code?
- Translators / Localizators - Can you translate raylib to another language?
- Documentation / Tutorials / Example writters - Can you write some tutorial / example? - Documentation / Tutorials / Example writters - Can you write some tutorial / example?
- Web Development - Can you help with the web? Can you setup a forum? - Web Development - Can you help with the web? Can you setup a forum?
- Porting to Linux, OSX... - Can you compile and test raylib on another OS? - Porting to Linux, OSX, RaspberryPi, consoles... - Can you compile and test raylib on another systems?
- Testers of current features and multiple systems - Can you find some bug on raylib? - Testers of current features and multiple systems - Can you find some bug on raylib?
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
with a small [donation](http://www.raylib.com/helpme.htm) (just some euros...). It will really motivate to continue improving this project (and pay some bills… or some coffee). with a small [donation](http://www.raylib.com/helpme.htm) or contributing with [raylib patreon](https://www.patreon.com/raysan5). It will really motivate to continue improving this project (and pay some bills… or some coffee).
raylib philosophy raylib philosophy
------------------ ------------------
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself. * raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself.
* raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or * raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or has not a clear usefulness, better not to include it.
has not a clear usefulness, better not to include it.
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free. * raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
* raylib is, hopefully, collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated. * raylib is collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
* raylib's license (and its external libs respective licenses) allow using it for commercial products. * raylib's license (and its external libs respective licenses) allow using it for commercial products.
contact contact
@@ -32,6 +30,8 @@ contact
* Webpage: [http://www.raylib.com](http://www.raylib.com) * Webpage: [http://www.raylib.com](http://www.raylib.com)
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5) * Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames) * Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San" [raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"

View File

@@ -7,7 +7,7 @@ source code
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
BSD-like license that allows static linking with closed source software: BSD-like license that allows static linking with closed source software:
Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software. will the authors be held liable for any damages arising from the use of this software.
@@ -37,3 +37,345 @@ All rBMF fonts provided with raylib are free to use (freeware) and have been des
* Mecha - Captain Falcon * Mecha - Captain Falcon
* PixelPlay - Aleksander Shevchuk * PixelPlay - Aleksander Shevchuk
* PixAntiqua - Gerhard Großmann * PixAntiqua - Gerhard Großmann
3d models
---------
dwarf 3d model used in examples is created by David Moreno and licensed as Creative Commons Attribution-NonCommercial 3.0
Full license provided below:
Creative Commons Legal Code
Attribution-NonCommercial 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and
other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and includes
cinematographic adaptations or any other form in which the Work may be
recast, transformed, or adapted including in any form recognizably
derived from the original, except that a work that constitutes a
Collection will not be considered an Adaptation for the purpose of
this License. For the avoidance of doubt, where the Work is a musical
work, performance or phonogram, the synchronization of the Work in
timed-relation with a moving image ("synching") will be considered an
Adaptation for the purpose of this License.
b. "Collection" means a collection of literary or artistic works, such as
encyclopedias and anthologies, or performances, phonograms or
broadcasts, or other works or subject matter other than works listed
in Section 1(f) below, which, by reason of the selection and
arrangement of their contents, constitute intellectual creations, in
which the Work is included in its entirety in unmodified form along
with one or more other contributions, each constituting separate and
independent works in themselves, which together are assembled into a
collective whole. A work that constitutes a Collection will not be
considered an Adaptation (as defined above) for the purposes of this
License.
c. "Distribute" means to make available to the public the original and
copies of the Work or Adaptation, as appropriate, through sale or
other transfer of ownership.
d. "Licensor" means the individual, individuals, entity or entities that
offer(s) the Work under the terms of this License.
e. "Original Author" means, in the case of a literary or artistic work,
the individual, individuals, entity or entities who created the Work
or if no individual or entity can be identified, the publisher; and in
addition (i) in the case of a performance the actors, singers,
musicians, dancers, and other persons who act, sing, deliver, declaim,
play in, interpret or otherwise perform literary or artistic works or
expressions of folklore; (ii) in the case of a phonogram the producer
being the person or legal entity who first fixes the sounds of a
performance or other sounds; and, (iii) in the case of broadcasts, the
organization that transmits the broadcast.
f. "Work" means the literary and/or artistic work offered under the terms
of this License including without limitation any production in the
literary, scientific and artistic domain, whatever may be the mode or
form of its expression including digital form, such as a book,
pamphlet and other writing; a lecture, address, sermon or other work
of the same nature; a dramatic or dramatico-musical work; a
choreographic work or entertainment in dumb show; a musical
composition with or without words; a cinematographic work to which are
assimilated works expressed by a process analogous to cinematography;
a work of drawing, painting, architecture, sculpture, engraving or
lithography; a photographic work to which are assimilated works
expressed by a process analogous to photography; a work of applied
art; an illustration, map, plan, sketch or three-dimensional work
relative to geography, topography, architecture or science; a
performance; a broadcast; a phonogram; a compilation of data to the
extent it is protected as a copyrightable work; or a work performed by
a variety or circus performer to the extent it is not otherwise
considered a literary or artistic work.
g. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License with
respect to the Work, or who has received express permission from the
Licensor to exercise rights under this License despite a previous
violation.
h. "Publicly Perform" means to perform public recitations of the Work and
to communicate to the public those public recitations, by any means or
process, including by wire or wireless means or public digital
performances; to make available to the public Works in such a way that
members of the public may access these Works from a place and at a
place individually chosen by them; to perform the Work to the public
by any means or process and the communication to the public of the
performances of the Work, including by public digital performance; to
broadcast and rebroadcast the Work by any means including signs,
sounds or images.
i. "Reproduce" means to make copies of the Work by any means including
without limitation by sound or visual recordings and the right of
fixation and reproducing fixations of the Work, including storage of a
protected performance or phonogram in digital form or other electronic
medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising from
limitations or exceptions that are provided for in connection with the
copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
b. to create and Reproduce Adaptations provided that any such Adaptation,
including any translation in any medium, takes reasonable steps to
clearly label, demarcate or otherwise identify that changes were made
to the original Work. For example, a translation could be marked "The
original work was translated from English to Spanish," or a
modification could indicate "The original work has been modified.";
c. to Distribute and Publicly Perform the Work including as incorporated
in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights in
other media and formats. Subject to Section 8(f), all rights not expressly
granted by Licensor are hereby reserved, including but not limited to the
rights set forth in Section 4(d).
4. Restrictions. The license granted in Section 3 above is expressly made
subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms
of this License. You must include a copy of, or the Uniform Resource
Identifier (URI) for, this License with every copy of the Work You
Distribute or Publicly Perform. You may not offer or impose any terms
on the Work that restrict the terms of this License or the ability of
the recipient of the Work to exercise the rights granted to that
recipient under the terms of the License. You may not sublicense the
Work. You must keep intact all notices that refer to this License and
to the disclaimer of warranties with every copy of the Work You
Distribute or Publicly Perform. When You Distribute or Publicly
Perform the Work, You may not impose any effective technological
measures on the Work that restrict the ability of a recipient of the
Work from You to exercise the rights granted to that recipient under
the terms of the License. This Section 4(a) applies to the Work as
incorporated in a Collection, but this does not require the Collection
apart from the Work itself to be made subject to the terms of this
License. If You create a Collection, upon notice from any Licensor You
must, to the extent practicable, remove from the Collection any credit
as required by Section 4(c), as requested. If You create an
Adaptation, upon notice from any Licensor You must, to the extent
practicable, remove from the Adaptation any credit as required by
Section 4(c), as requested.
b. You may not exercise any of the rights granted to You in Section 3
above in any manner that is primarily intended for or directed toward
commercial advantage or private monetary compensation. The exchange of
the Work for other copyrighted works by means of digital file-sharing
or otherwise shall not be considered to be intended for or directed
toward commercial advantage or private monetary compensation, provided
there is no payment of any monetary compensation in connection with
the exchange of copyrighted works.
c. If You Distribute, or Publicly Perform the Work or any Adaptations or
Collections, You must, unless a request has been made pursuant to
Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i) the
name of the Original Author (or pseudonym, if applicable) if supplied,
and/or if the Original Author and/or Licensor designate another party
or parties (e.g., a sponsor institute, publishing entity, journal) for
attribution ("Attribution Parties") in Licensor's copyright notice,
terms of service or by other reasonable means, the name of such party
or parties; (ii) the title of the Work if supplied; (iii) to the
extent reasonably practicable, the URI, if any, that Licensor
specifies to be associated with the Work, unless such URI does not
refer to the copyright notice or licensing information for the Work;
and, (iv) consistent with Section 3(b), in the case of an Adaptation,
a credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or "Screenplay
based on original Work by Original Author"). The credit required by
this Section 4(c) may be implemented in any reasonable manner;
provided, however, that in the case of a Adaptation or Collection, at
a minimum such credit will appear, if a credit for all contributing
authors of the Adaptation or Collection appears, then as part of these
credits and in a manner at least as prominent as the credits for the
other contributing authors. For the avoidance of doubt, You may only
use the credit required by this Section for the purpose of attribution
in the manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original Author,
Licensor and/or Attribution Parties, as appropriate, of You or Your
use of the Work, without the separate, express prior written
permission of the Original Author, Licensor and/or Attribution
Parties.
d. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme cannot be waived, the Licensor
reserves the exclusive right to collect such royalties for any
exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme can be waived, the Licensor reserves
the exclusive right to collect such royalties for any exercise by
You of the rights granted under this License if Your exercise of
such rights is for a purpose or use which is otherwise than
noncommercial as permitted under Section 4(b) and otherwise waives
the right to collect royalties through any statutory or compulsory
licensing scheme; and,
iii. Voluntary License Schemes. The Licensor reserves the right to
collect royalties, whether individually or, in the event that the
Licensor is a member of a collecting society that administers
voluntary licensing schemes, via that society, from any exercise
by You of the rights granted under this License that is for a
purpose or use which is otherwise than noncommercial as permitted
under Section 4(c).
e. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute or
Publicly Perform the Work either by itself or as part of any
Adaptations or Collections, You must not distort, mutilate, modify or
take other derogatory action in relation to the Work which would be
prejudicial to the Original Author's honor or reputation. Licensor
agrees that in those jurisdictions (e.g. Japan), in which any exercise
of the right granted in Section 3(b) of this License (the right to
make Adaptations) would be deemed to be a distortion, mutilation,
modification or other derogatory action prejudicial to the Original
Author's honor and reputation, the Licensor will waive or not assert,
as appropriate, this Section, to the fullest extent permitted by the
applicable national law, to enable You to reasonably exercise Your
right under Section 3(b) of this License (right to make Adaptations)
but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or Collections
from You under this License, however, will not have their licenses
terminated provided such individuals or entities remain in full
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is
perpetual (for the duration of the applicable copyright in the Work).
Notwithstanding the above, Licensor reserves the right to release the
Work under different license terms or to stop distributing the Work at
any time; provided, however that any such election will not serve to
withdraw this License (or any other license that has been, or is
required to be, granted under the terms of this License), and this
License will continue in full force and effect unless terminated as
stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection,
the Licensor offers to the recipient a license to the Work on the same
terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
offers to the recipient a license to the original Work on the same
terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties with
respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that
may appear in any communication from You. This License may not be
modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this
License were drafted utilizing the terminology of the Berne Convention
for the Protection of Literary and Artistic Works (as amended on
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
and the Universal Copyright Convention (as revised on July 24, 1971).
These rights and subject matter take effect in the relevant
jurisdiction in which the License terms are sought to be enforced
according to the corresponding provisions of the implementation of
those treaty provisions in the applicable national law. If the
standard suite of rights granted under applicable copyright law
includes additional rights not granted under this License, such
additional rights are deemed to be included in the License; this
License is not intended to restrict the license of any rights under
applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty
whatsoever in connection with the Work. Creative Commons will not be
liable to You or any party on any legal theory for any damages
whatsoever, including without limitation any general, special,
incidental or consequential damages arising in connection to this
license. Notwithstanding the foregoing two (2) sentences, if Creative
Commons has expressly identified itself as the Licensor hereunder, it
shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, Creative Commons does not authorize
the use by either party of the trademark "Creative Commons" or any
related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in
compliance with Creative Commons' then-current trademark usage
guidelines, as may be published on its website or otherwise made
available upon request from time to time. For the avoidance of doubt,
this trademark restriction does not form part of the License.
Creative Commons may be contacted at https://creativecommons.org/.

303
README.md
View File

@@ -1,4 +1,4 @@
<img src="http://www.raylib.com/img/fb_raylib_logo.png" width=256> <img src="https://github.com/raysan5/raylib/blob/master/logo/logo256x256.png" width=256>
about about
----- -----
@@ -6,17 +6,15 @@ about
raylib is a simple and easy-to-use library to learn videogames programming. raylib is a simple and easy-to-use library to learn videogames programming.
raylib is highly inspired by Borland BGI graphics lib and by XNA framework. raylib is highly inspired by Borland BGI graphics lib and by XNA framework.
Allegro and SDL have also been analyzed for reference.
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm) NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming;
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
Since version 1.2.2 raylib can compile directly for web (html5) using emscripten and asm.js, pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.htm)
to see a demo of raylib features working on web, [check here!] (http://www.raylib.com/raylib_demo.html)
history history
------- -------
I've developed videogames for some years and last year I had to taught videogames development I've developed videogames for some years and 4 years ago I started teaching videogames development
to young people with artistic profile, most of them had never written a single line of code. to young people with artistic profile, most of them had never written a single line of code.
I started with C language basis and, after searching for the most simple and easy-to-use library to teach I started with C language basis and, after searching for the most simple and easy-to-use library to teach
@@ -35,7 +33,7 @@ I've coded quite a lot in C# and XNA and I really love it (in fact, my students
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
raylib to XNA, MonoGame or similar libs extremely easily. raylib to XNA, MonoGame or similar libs extremely easily.
raylib started as a weekend project and after three months of hard work, first version was published. raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
Enjoy it. Enjoy it.
@@ -45,10 +43,10 @@ notes on raylib 1.1
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0. complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
A new module named [rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translate raylib-OpenGL-style A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define. immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
[rlgl] (https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath] (https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
a bunch of useful functions for 3d-math with vectors, matrices and quaternions. a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
@@ -60,7 +58,7 @@ notes on raylib 1.2
------------------- -------------------
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
complete internal redesign of [core] (https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android] (http://www.android.com/) and [Raspberry Pi] (http://www.raspberrypi.org/). complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user. It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
@@ -73,33 +71,143 @@ Now raylib can easily deploy games to Android devices and Raspberry Pi (console
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2. Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
notes on raylib 1.3
-------------------
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
in this release, check raylib/shaders folder.
Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
primary intended for tools development. It's still in experimental state but already fully functional.
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
notes on raylib 1.4
-------------------
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
Now a basic image processing can be done before converting the image to texture for usage.
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse.
This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`).
Gamepad support has also been added (experimental).
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
notes on raylib 1.5
-------------------
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/develop/CHANGELOG) file for a more detailed list of changes.
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
notes on raylib 1.6
-------------------
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
Complete raylib LUA binding. All raylib functions plus the +60 code examples have been ported to LUA, now LUA users can enjoy coding videogames in LUA while using all the internal power of raylib. This addition also open the doors to LUA scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to LUA scripts while keep using raylib functionality.
Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
features features
-------- --------
* Written in plain C code (C99) * Written in plain C code (C99)
* Uses C# PascalCase/camelCase notation * Uses PascalCase/camelCase notation
* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2) * Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
* Unique OpenGL abstraction layer [rlgl] * Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
* Powerful fonts module with SpriteFonts support * Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
* Multiple textures support, including DDS, PKM and mipmaps generation * Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
* Basic 3d support for Shapes, Models, Heightmaps and Billboards * Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
* Powerful math module for Vector and Matrix operations [raymath] * Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
* Audio loading and playing with streaming support (WAV and OGG) * Shaders support, including Model shaders and Postprocessing shaders
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD)
* VR stereo rendering support with configurable HMD device parameters
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
* Custom color palette for fancy visuals on raywhite background * Custom color palette for fancy visuals on raywhite background
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5** * Minimal external dependencies (GLFW3, OpenGL, OpenAL)
* Complete binding to LUA
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...). multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
raylib uses on its [audio] (https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft] (http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours, raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
to accomodate to Android and Raspberry Pi. to accomodate to Android, Raspberry Pi and HTML5.
On Android, raylib uses native_app_glue module (provided on Android NDK) and native Android libraries to manage window/context, On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
inputs and activity cycle.
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading. On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
raylib is licensed under a zlib/libpng license. View [LICENSE] (https://github.com/raysan5/raylib/blob/master/LICENSE.md). On Oculus Rift CV1, raylib uses Oculus PC SDK libraries but only the core C library ([LibOVR](https://github.com/raysan5/raylib/tree/develop/src/external/OculusSDK/LibOVR)); runtime library (LibOVRRT32_1.dll) must be linked at compilation time.
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
tools requirements tools requirements
------------------ ------------------
@@ -115,121 +223,17 @@ I believe those are the best tools to train spartan-programmers.
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way. to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
Since raylib v1.1, you can download a windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/) Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
building source (generate libraylib.a) building source (generate libraylib.a)
-------------------------------------- --------------------------------------
**Building raylib sources on desktop platforms:** Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/src/ folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
NOTE: By default raylib compiles using OpenGL 1.1 to maximize compatibility; to use OpenGL 3.3 just type:
mingw32-make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_33
**Building raylib sources on Raspberry Pi:**
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
sudo apt-get install openal1
_Step 2._ Navigate from command line to raylib/src/ folder and type:
make
**Building raylib sources for Android:**
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
> Download and decompress on C: [Android SDK r23](http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
> Download and decompress on C: [Android NDK r10b](http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
> Download and decompress on C: [Apache Ant 1.9.4](http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
_Step 2._ Create the following environment variables with the correct paths:
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
ANDROID_NDK_ROOT = C:\android-ndk-r10b
ANT_HOME = C:\apache-ant-1.9.4
_Step 3._ Navigate from command line to folder raylib/template_android/ and type:
%ANDROID_NDK_ROOT%\ndk-build
NOTE: libraylib.a will be generated in folder raylib/src_android/obj/local/armeabi/, it must be copied
to Android project; if using raylib/template_android project, copy it to raylib/template_android/jni/libs/.
**Building raylib sources for Web (HTML5)**
_Step 1._ Make sure you have installed emscripten SDK:
> Download latest version from [here].(http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) I recommend following the portable version installation instructions.
_Step 2._ TODO
building examples building examples
----------------- -----------------
**Building raylib examples on desktop platforms:** Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
_Step 1:_ Using MinGW make tool, just navigate from command line to raylib/examples/ folder and type:
mingw32-make PLATFORM=PLATFORM_DESKTOP
NOTE: Make sure the following libs (and their headers) are placed on their respectibe MinGW folders:
libglfw3.a - GLFW3 (static version)
libglew32.a - GLEW, OpenGL extension loading, only required if using OpenGL 3.3+ or ES2
libopenal32.a - OpenAL Soft, audio device management
**Building raylib examples on Raspberry Pi:**
_Step 1._ Make sure you have installed in your Raspberry Pi OpenAL Soft library for audio:
sudo apt-get install openal1
_Step 2._ Navigate from command line to raylib/examples/ folder and type:
make
**Building raylib project for Android (using template):**
_Step 1._ Make sure you have installed Android SDK, Android NDK and Apache Ant tools:
> Download and decompress on C: [Android SDK r23] (http://dl.google.com/android/android-sdk_r23.0.2-windows.zip)
> Download and decompress on C: [Android NDK r10b] (http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip)
> Download and decompress on C: [Apache Ant 1.9.4] (http://ftp.cixug.es/apache//ant/binaries/apache-ant-1.9.4-bin.zip)
_Step 2._ Create the following environment variables with the correct paths:
ANDROID_SDK_TOOLS = C:\android-sdk\platform-tools
ANDROID_NDK_ROOT = C:\android-ndk-r10b
ANT_HOME = C:\apache-ant-1.9.4
_Step 3._ To compile project, navigate from command line to folder raylib/template_android/ and type:
%ANDROID_NDK_ROOT%\ndk-build
_Step 4._ To generate APK, navigate to folder raylib/template_android/ and type:
%ANT_HOME%\bin\ant debug
_Step 5:_ To install APK into connected device (previously intalled drivers and activated USB debug mode on device):
%ANT_HOME%\bin\ant installd
_Step 6:_ To view log output from device:
%ANDROID_SDK_TOOLS%\adb logcat -c
%ANDROID_SDK_TOOLS%\adb -d logcat raylib:V *:S
**If you have any doubt, [just let me know][raysan5].**
contact contact
------- -------
@@ -237,19 +241,38 @@ contact
* Webpage: [http://www.raylib.com](http://www.raylib.com) * Webpage: [http://www.raylib.com](http://www.raylib.com)
* Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5) * Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5)
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames) * Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
If you are using raylib and you enjoy it, please, [let me know][raysan5]. If you are using raylib and you enjoy it, please, [let me know][raysan5].
If you feel you can help, then, [helpme!] (http://www.raylib.com/helpme.htm) If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
acknowledgments acknowledgements
--------------- ---------------
The following people have contributed in some way to make raylib project a reality. Big thanks to them! I believe that time is the most valuable resource and the following people have invested part of their time
contributing (in some way or another) to make raylib project better. Huge thanks!
- [Zopokx](https://github.com/Zopokx) for testing and hosting the web. - [Zopokx](https://github.com/Zopokx) for testing the web.
- [Elendow](http://www.elendow.com) for testing and helping on web development. - [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual for implementation and testing of 3D shapes functions. - Victor Dual for implementing and testing 3D shapes functions.
- Marc Palau for implementation and testing of 3D shapes functions. - Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
- Kevin Gato for improving texture internal formats support and helping on raygui development.
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Sergio Martinez for helping on raygui development and tools development (raygui_styler).
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing materials and lighting systems... among multiple other improvements and multiple tools and games.
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
- Marcelo Paez (paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San" [raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"

View File

@@ -1,24 +1,48 @@
roadmap roadmap
------- -------
Current version of raylib is quite complete and functional but there is still a lot of things I would like to improve. Current version of raylib is quite complete and functional but there is still a lot of things to add and improve.
Here it is a list of features I would like to add and functions to improve. Here it is a wish list of features I would like to add and functions to improve.
Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add. Note raylib source code has multiple TODO points with pending things to review and improve. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
This roadmap is quite outdated... a full list of all the features we are working on should be listed here at some point... raylib 1.x
raylib v1.x Basic GPU stats sytem (memory, draws, time...)
Improved custom file-format (.rres) and packaging tool
Procedural image generation functions (spot, gradient, noise...)
Procedural mesh generation functions (cube, cone, sphere...)
Touch-based camera controls for Android
Gamepad support on HTML5
raylib 1.6
[DONE] LUA scripting support (raylib lua wrapper)
[DONE] Redesigned audio module
raylib 1.5
[DONE] Support Oculus Rift CV1 and VR stereo rendering (simulator)
[DONE] Redesign Shaders/Textures system -> New Materials system
[DONE] Support lighting: Omni, Directional and Spot lights
[DONE] Redesign physics module (physac)
[DONE] Chiptunes audio modules support
raylib 1.4
[DONE] TTF fonts support (using stb_truetype)
[DONE] Raycast system for 3D picking (including collisions detection)
[DONE] Floyd-Steinberg dithering on 16bit image format conversion
[DONE] Basic image manipulation functions (crop, resize, draw...)
[DONE] Storage load/save data functionality
[DONE] Add Physics module (physac)
[DONE] Remove GLEW dependency -> Replaced by GLAD
[DONE] Redesign Raspberry PI inputs system
[DONE] Redesign gestures module to be multiplatform
[DONE] Module raymath as header-only and functions inline
[DONE] Add Easings module (easings.h)
- [DONE] Review Billboard Drawing functions
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
- Lighting support (only 3d mode)
- [DONE] Simple Collision Detection functions
- [IN PROGRESS] Default scene Camera controls (zoom, pan, rotate)
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
- [DONE] Software mipmapping generation and POT conversion (custom implementation)
- [IN PROGRESS] TTF fonts support
Any feature missing? Do you have a request? [Let me know!][raysan5] Any feature missing? Do you have a request? [Let me know!][raysan5]
[raysan5]: mailto:raysan@raysanweb.com "Ramon Santamaria - Ray San" [raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
[isssues]: https://github.com/raysan5/raylib/issues

View File

Before

Width:  |  Height:  |  Size: 371 KiB

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

547
examples/Makefile Normal file
View File

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

View File

@@ -0,0 +1,141 @@
/*******************************************************************************************
*
* raylib [audio] example - Module playing (streaming)
*
* NOTE: This example requires OpenAL Soft library installed
*
* This example has been created using raylib 1.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_CIRCLES 64
typedef struct {
Vector2 position;
float radius;
float alpha;
float speed;
Color color;
} CircleWave;
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // NOTE: Try to enable MSAA 4X
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
InitAudioDevice(); // Initialize audio device
Color colors[14] = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE };
// Creates ome circles for visual effect
CircleWave circles[MAX_CIRCLES];
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
{
circles[i].alpha = 0.0f;
circles[i].radius = GetRandomValue(10, 40);
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
circles[i].color = colors[GetRandomValue(0, 13)];
}
Music xm = LoadMusicStream("resources/audio/mini1111.xm");
PlayMusicStream(xm);
float timePlayed = 0.0f;
bool pause = false;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateMusicStream(xm); // Update music buffer with new stream data
// Restart music playing (stop and play)
if (IsKeyPressed(KEY_SPACE))
{
StopMusicStream(xm);
PlayMusicStream(xm);
}
// Pause/Resume music playing
if (IsKeyPressed(KEY_P))
{
pause = !pause;
if (pause) PauseMusicStream(xm);
else ResumeMusicStream(xm);
}
// Get timePlayed scaled to bar dimensions
timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2;
// Color circles animation
for (int i = MAX_CIRCLES - 1; (i >= 0) && !pause; i--)
{
circles[i].alpha += circles[i].speed;
circles[i].radius += circles[i].speed*10.0f;
if (circles[i].alpha > 1.0f) circles[i].speed *= -1;
if (circles[i].alpha <= 0.0f)
{
circles[i].alpha = 0.0f;
circles[i].radius = GetRandomValue(10, 40);
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
circles[i].color = colors[GetRandomValue(0, 13)];
circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(WHITE);
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
{
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha));
}
// Draw time bar
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadMusicStream(xm); // Unload music stream buffers from RAM
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,101 @@
-------------------------------------------------------------------------------------------
--
-- raylib [audio] example - Module playing (streaming)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
MAX_CIRCLES = 64
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)")
InitAudioDevice() -- Initialize audio device
local colors = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE }
-- Creates ome circles for visual effect
local circles = {}
for i = MAX_CIRCLES, 1, -1 do
circles[i] = {}
circles[i].alpha = 0.0
circles[i].radius = GetRandomValue(10, 40)
circles[i].position = Vector2(0, 0)
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius)
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius)
circles[i].speed = GetRandomValue(1, 100)/20000.0
circles[i].color = colors[GetRandomValue(1, 14)]
end
local xm = LoadMusicStream("resources/audio/mini1111.xm")
PlayMusicStream(xm)
local timePlayed = 0.0
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
for i = MAX_CIRCLES, 1, -1 do
circles[i].alpha = circles[i].alpha + circles[i].speed
circles[i].radius = circles[i].radius + circles[i].speed*10.0
if (circles[i].alpha > 1.0) then circles[i].speed = circles[i].speed*-1 end
if (circles[i].alpha <= 0.0) then
circles[i].alpha = 0.0
circles[i].radius = GetRandomValue(10, 40)
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius)
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius)
circles[i].color = colors[GetRandomValue(1, 14)]
circles[i].speed = GetRandomValue(1, 100)/20000.0
end
end
-- Get timePlayed scaled to bar dimensions
timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2
UpdateMusicStream(xm) -- Update music buffer with new stream data
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
for i = MAX_CIRCLES, 1, -1 do
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha))
end
-- Draw time bar
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY)
DrawRectangle(20, screenHeight - 20 - 12, timePlayed//1, 12, MAROON)
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, WHITE)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadMusicStream(xm) -- Unload music stream buffers from RAM
CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -4,10 +4,10 @@
* *
* NOTE: This example requires OpenAL Soft library installed * NOTE: This example requires OpenAL Soft library installed
* *
* This example has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -24,11 +24,12 @@ int main()
InitAudioDevice(); // Initialize audio device InitAudioDevice(); // Initialize audio device
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
PlayMusicStream(music);
int framesCounter = 0; float timePlayed = 0.0f;
float timePlayed = 0; bool pause = false;
//float volume = 1.0;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -38,27 +39,26 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
framesCounter++; UpdateMusicStream(music); // Update music buffer with new stream data
// Testing music fading from one file to another // Restart music playing (stop and play)
/* if (IsKeyPressed(KEY_SPACE))
if (framesCounter > 600) // Wait for 10 seconds (600 frames)
{ {
volume -= 0.01; // Decrement music volume level StopMusicStream(music);
PlayMusicStream(music);
// When music volume level equal or lower than 0,
// restore volume level and init another music file
if (volume <= 0)
{
volume = 1.0;
framesCounter = 0;
PlayMusicStream("resources/audio/another_file.ogg");
}
SetMusicVolume(volume);
} }
*/
timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4; // We scale by 4 to fit 400 pixels // Pause/Resume music playing
if (IsKeyPressed(KEY_P))
{
pause = !pause;
if (pause) PauseMusicStream(music);
else ResumeMusicStream(music);
}
// Get timePlayed scaled to bar dimensions (400 pixels)
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -67,10 +67,14 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY); DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY);
DrawRectangle(200, 250, 400, 12, LIGHTGRAY); DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
DrawRectangle(200, 250, (int)timePlayed, 12, MAROON); DrawRectangle(200, 200, (int)timePlayed, 12, MAROON);
DrawRectangleLines(200, 200, 400, 12, GRAY);
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY);
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -78,9 +82,11 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped) UnloadMusicStream(music); // Unload music stream buffers from RAM
CloseWindow(); // Close window and OpenGL context CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;

View File

@@ -0,0 +1,66 @@
-------------------------------------------------------------------------------------------
--
-- raylib [audio] example - Music playing (streaming)
--
-- NOTE: This example requires OpenAL Soft library installed
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)")
InitAudioDevice() -- Initialize audio device
local music = LoadMusicStream("resources/audio/guitar_noodling.ogg")
PlayMusicStream(music)
local framesCounter = 0
local timePlayed = 0.0
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
framesCounter = framesCounter + 1
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4 -- We scale by 4 to fit 400 pixels
UpdateMusicStream(music) -- Update music buffer with new stream data
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY)
DrawRectangle(200, 250, 400, 12, LIGHTGRAY)
DrawRectangle(200, 250, timePlayed//1, 12, MAROON)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadMusicStream(music) -- Unload music stream buffers from RAM
CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

111
examples/audio_raw_stream.c Normal file
View File

@@ -0,0 +1,111 @@
/*******************************************************************************************
*
* raylib [audio] example - Raw audio streaming
*
* NOTE: This example requires OpenAL Soft library installed
*
* This example has been created using raylib 1.6 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <stdlib.h> // Required for: malloc(), free()
#include <math.h> // Required for: sinf()
#define MAX_SAMPLES 20000
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming");
InitAudioDevice(); // Initialize audio device
// Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
AudioStream stream = InitAudioStream(22050, 32, 1);
// Fill audio stream with some samples (sine wave)
float *data = (float *)malloc(sizeof(float)*MAX_SAMPLES);
for (int i = 0; i < MAX_SAMPLES; i++)
{
data[i] = sinf(((2*PI*(float)i)/2)*DEG2RAD);
}
// NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
// for that reason, there is a clip everytime audio stream is looped
PlayAudioStream(stream);
int totalSamples = MAX_SAMPLES;
int samplesLeft = totalSamples;
Vector2 position = { 0, 0 };
SetTargetFPS(30); // Set our game to run at 30 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// Refill audio stream if required
if (IsAudioBufferProcessed(stream))
{
int numSamples = 0;
if (samplesLeft >= 4096) numSamples = 4096;
else numSamples = samplesLeft;
UpdateAudioStream(stream, data + (totalSamples - samplesLeft), numSamples);
samplesLeft -= numSamples;
// Reset samples feeding (loop audio)
if (samplesLeft <= 0) samplesLeft = totalSamples;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, LIGHTGRAY);
// NOTE: Draw a part of the sine wave (only screen width)
for (int i = 0; i < GetScreenWidth(); i++)
{
position.x = i;
position.y = 250 + 50*data[i];
DrawPixelV(position, RED);
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
free(data); // Unload sine wave data
CloseAudioStream(stream); // Close raw audio stream and delete buffers from RAM
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,97 @@
-------------------------------------------------------------------------------------------
--
-- raylib [audio] example - Raw audio streaming
--
-- NOTE: This example requires OpenAL Soft library installed
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
MAX_SAMPLES = 20000
DEG2RAD = math.pi/180.0
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming")
InitAudioDevice() -- Initialize audio device
-- Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
local stream = InitAudioStream(22050, 32, 1)
-- Fill audio stream with some samples (sine wave)
local data = {}
for i = 1, MAX_SAMPLES do
data[i] = math.sin(((2*math.pi*i)/2)*DEG2RAD)
end
-- NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
-- for that reason, there is a clip everytime audio stream is looped
PlayAudioStream(stream)
local totalSamples = MAX_SAMPLES
local samplesLeft = totalSamples
local position = Vector2(0, 0)
SetTargetFPS(30) -- Set our game to run at 30 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- Refill audio stream if required
if (IsAudioBufferProcessed(stream)) then
local numSamples = 0
if (samplesLeft >= 4096) then numSamples = 4096
else numSamples = samplesLeft end
UpdateAudioStream(stream, data + (totalSamples - samplesLeft), numSamples)
samplesLeft = samplesLeft - numSamples
-- Reset samples feeding (loop audio)
if (samplesLeft <= 0) then samplesLeft = totalSamples end
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, LIGHTGRAY)
-- NOTE: Draw a part of the sine wave (only screen width)
for i = 1, GetScreenWidth() do
position.x = (i - 1)
position.y = 250 + 50*data[i]
DrawPixelV(position, RED)
end
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseAudioStream(stream) -- Close raw audio stream and delete buffers from RAM
CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -7,7 +7,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -26,6 +26,8 @@ int main()
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -34,7 +36,6 @@ int main()
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav); // Play WAV sound if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav); // Play WAV sound
if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -0,0 +1,59 @@
-------------------------------------------------------------------------------------------
--
-- raylib [audio] example - Sound loading and playing
--
-- NOTE: This example requires OpenAL Soft library installed
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing")
InitAudioDevice() -- Initialize audio device
local fxWav = LoadSound("resources/audio/weird.wav") -- Load WAV audio file
local fxOgg = LoadSound("resources/audio/tanatana.ogg") -- Load OGG audio file
SetTargetFPS(60)
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
if (IsKeyPressed(KEY.SPACE)) then PlaySound(fxWav) end -- Play WAV sound
if (IsKeyPressed(KEY.ENTER)) then PlaySound(fxOgg) end -- Play OGG sound
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY)
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadSound(fxWav) -- Unload sound data
UnloadSound(fxOgg) -- Unload sound data
CloseAudioDevice() -- Close audio device
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,81 @@
/*******************************************************************************************
*
* raylib [audio] example - Using audio module as standalone module
*
* NOTE: This example does not require any graphic device, it can run directly on console.
*
* [audio] module requires some external libs:
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
* jar_xm - XM module file loading
* jar_mod - MOD audio file loading
*
* Compile audio module using:
* gcc -c audio.c stb_vorbis.c -Wall -std=c99 -DAUDIO_STANDALONE
*
* Compile example using:
* gcc -o $(NAME_PART).exe $(FILE_NAME) audio.o stb_vorbis.o -lopenal32 -std=c99
*
* This example has been created using raylib 1.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include <stdio.h>
#include <conio.h> // Windows only, no stardard library
#include "audio.h"
#define KEY_ESCAPE 27
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
unsigned char key;
InitAudioDevice();
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
PlayMusicStream(music);
printf("\nPress s or d to play sounds...\n");
//--------------------------------------------------------------------------------------
// Main loop
while (key != KEY_ESCAPE)
{
if (kbhit()) key = getch();
if (key == 's')
{
PlaySound(fxWav);
key = 0;
}
if (key == 'd')
{
PlaySound(fxOgg);
key = 0;
}
UpdateMusicStream(music);
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
UnloadMusicStream(music); // Unload music stream data
CloseAudioDevice();
//--------------------------------------------------------------------------------------
return 0;
}

139
examples/core_2d_camera.c Normal file
View File

@@ -0,0 +1,139 @@
/*******************************************************************************************
*
* raylib [core] example - 2d camera
*
* This example has been created using raylib 1.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_BUILDINGS 100
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
Rectangle player = { 400, 280, 40, 40 };
Rectangle buildings[MAX_BUILDINGS];
Color buildColors[MAX_BUILDINGS];
int spacing = 0;
for (int i = 0; i < MAX_BUILDINGS; i++)
{
buildings[i].width = GetRandomValue(50, 200);
buildings[i].height = GetRandomValue(100, 800);
buildings[i].y = screenHeight - 130 - buildings[i].height;
buildings[i].x = -6000 + spacing;
spacing += buildings[i].width;
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
}
Camera2D camera;
camera.target = (Vector2){ player.x + 20, player.y + 20 };
camera.offset = (Vector2){ 0, 0 };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_RIGHT))
{
player.x += 2; // Player movement
camera.offset.x -= 2; // Camera displacement with player movement
}
else if (IsKeyDown(KEY_LEFT))
{
player.x -= 2; // Player movement
camera.offset.x += 2; // Camera displacement with player movement
}
// Camera target follows player
camera.target = (Vector2){ player.x + 20, player.y + 20 };
// Camera rotation controls
if (IsKeyDown(KEY_A)) camera.rotation--;
else if (IsKeyDown(KEY_S)) camera.rotation++;
// Limit camera rotation to 80 degrees (-40 to 40)
if (camera.rotation > 40) camera.rotation = 40;
else if (camera.rotation < -40) camera.rotation = -40;
// Camera zoom controls
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
else if (camera.zoom < 0.1f) camera.zoom = 0.1f;
// Camera reset (zoom and rotation)
if (IsKeyPressed(KEY_R))
{
camera.zoom = 1.0f;
camera.rotation = 0.0f;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin2dMode(camera);
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
for (int i = 0; i < MAX_BUILDINGS; i++) DrawRectangleRec(buildings[i], buildColors[i]);
DrawRectangleRec(player, RED);
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
End2dMode();
DrawText("SCREEN AREA", 640, 10, 20, RED);
DrawRectangle(0, 0, screenWidth, 5, RED);
DrawRectangle(0, 5, 5, screenHeight - 10, RED);
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED);
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED);
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
DrawRectangleLines( 10, 10, 250, 113, BLUE);
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK);
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY);
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

130
examples/core_2d_camera.lua Normal file
View File

@@ -0,0 +1,130 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - 2d camera
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
MAX_BUILDINGS = 100
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera")
local player = Rectangle(400, 280, 40, 40)
local buildings = {}
local buildColors = {}
local spacing = 0;
for i = 1, MAX_BUILDINGS do
buildings[i] = Rectangle(0, 0, 0, 0)
buildings[i].width = GetRandomValue(50, 200)
buildings[i].height = GetRandomValue(100, 800)
buildings[i].y = screenHeight - 130 - buildings[i].height
buildings[i].x = -6000 + spacing
spacing = spacing + buildings[i].width
buildColors[i] = Color(GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255)
end
local camera = Camera2D(Vector2(0, 0), Vector2(0, 0), 0.0, 1.0)
camera.target = Vector2(player.x + 20, player.y + 20)
camera.offset = Vector2(0, 0)
camera.rotation = 0.0
camera.zoom = 1.0
SetTargetFPS(60)
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
if (IsKeyDown(KEY.RIGHT)) then
player.x = player.x + 2 -- Player movement
camera.offset.x = camera.offset.x - 2 -- Camera displacement with player movement
elseif (IsKeyDown(KEY.LEFT)) then
player.x = player.x - 2 -- Player movement
camera.offset.x = camera.offset.x + 2 -- Camera displacement with player movement
end
-- Camera target follows player
camera.target = Vector2(player.x + 20, player.y + 20)
-- Camera rotation controls
if (IsKeyDown(KEY.A)) then camera.rotation = camera.rotation - 1
elseif (IsKeyDown(KEY.S)) then camera.rotation = camera.rotation + 1
end
-- Limit camera rotation to 80 degrees (-40 to 40)
if (camera.rotation > 40) then camera.rotation = 40
elseif (camera.rotation < -40) then camera.rotation = -40
end
-- Camera zoom controls
camera.zoom = camera.zoom + (GetMouseWheelMove()*0.05)
if (camera.zoom > 3.0) then camera.zoom = 3.0
elseif (camera.zoom < 0.1) then camera.zoom = 0.1
end
-- Camera reset (zoom and rotation)
if (IsKeyPressed(KEY.R)) then
camera.zoom = 1.0
camera.rotation = 0.0
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin2dMode(camera)
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY)
for i = 1, MAX_BUILDINGS, 1 do DrawRectangleRec(buildings[i], buildColors[i]) end
DrawRectangleRec(player, RED)
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN)
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN)
End2dMode()
DrawText("SCREEN AREA", 640, 10, 20, RED)
DrawRectangle(0, 0, screenWidth, 5, RED)
DrawRectangle(0, 5, 5, screenHeight - 10, RED)
DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED)
DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED)
DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5))
DrawRectangleLines( 10, 10, 250, 113, BLUE)
DrawText("Free 2d camera controls:", 20, 20, 10, BLACK)
DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY)
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY)
DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY)
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY)
EndDrawing();
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

BIN
examples/core_2d_camera.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,92 @@
/*******************************************************************************************
*
* raylib [core] example - 3d camera first person
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_COLUMNS 20
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
// Define the camera to look into our 3d world (position, target, up vector)
Camera camera = {{ 4.0f, 2.0f, 4.0f }, { 0.0f, 1.8f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
// Generates some random columns
float heights[MAX_COLUMNS];
Vector3 positions[MAX_COLUMNS];
Color colors[MAX_COLUMNS];
for (int i = 0; i < MAX_COLUMNS; i++)
{
heights[i] = (float)GetRandomValue(1, 12);
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
}
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME); // Draw a green wall
DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD); // Draw a yellow wall
// Draw some cubes around
for (int i = 0; i < MAX_COLUMNS; i++)
{
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
}
End3dMode();
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
DrawRectangleLines( 10, 10, 220, 70, BLUE);
DrawText("First person camera default controls:", 20, 20, 10, BLACK);
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,84 @@
--------------------------------------------------------------------------------------------
--
-- raylib [core] example - 3d camera first person
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
--------------------------------------------------------------------------------------------
MAX_COLUMNS = 20
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person")
-- Define the camera to look into our 3d world (position, target, up vector)
local camera = Camera(Vector3(4.0, 2.0, 4.0), Vector3(0.0, 1.8, 0.0), Vector3(0.0, 1.0, 0.0), 60.0)
-- Generates some random columns
local heights = {}
local positions = {}
local colors = {}
for i = 1, MAX_COLUMNS do
heights[i] = GetRandomValue(1, 12)
positions[i] = Vector3(GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15))
colors[i] = Color(GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255)
end
local playerPosition = Vector3(4.0, 2.0, 4.0) -- Define player position
SetCameraMode(camera, CameraMode.FIRST_PERSON) -- Set a first person camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawPlane(Vector3(0.0, 0.0, 0.0), Vector2(32.0, 32.0), LIGHTGRAY) -- Draw ground
DrawCube(Vector3(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, BLUE) -- Draw a blue wall
DrawCube(Vector3(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, LIME) -- Draw a green wall
DrawCube(Vector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, GOLD) -- Draw a yellow wall
-- Draw some cubes around
for i = 1, MAX_COLUMNS do
DrawCube(positions[i], 2.0, heights[i], 2.0, colors[i])
DrawCubeWires(positions[i], 2.0, heights[i], 2.0, MAROON)
end
End3dMode()
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5))
DrawRectangleLines( 10, 10, 220, 70, BLUE)
DrawText("First person camera default controls:", 20, 20, 10, BLACK)
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY)
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,82 @@
/*******************************************************************************************
*
* raylib [core] example - Initialize 3d camera free
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
// Define the camera to look into our 3d world
Camera camera;
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(10, 1.0f);
End3dMode();
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
DrawRectangleLines( 10, 10, 320, 133, BLUE);
DrawText("Free camera default controls:", 20, 20, 10, BLACK);
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,72 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Initialize 3d camera free
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
--------------------------------------------------------------------------------------------
-- Initialization
----------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
-- Define the camera to look into our 3d world
local camera = {}
camera.position = Vector3(10.0, 10.0, 10.0) -- Camera position
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
camera.fovy = 45.0 -- Camera field-of-view Y
local cubePosition = Vector3(0.0, 0.0, 0.0)
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
DrawGrid(10, 1.0)
End3dMode()
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5))
DrawRectangleLines( 10, 10, 320, 133, BLUE)
DrawText("Free camera default controls:", 20, 20, 10, BLACK)
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY)
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY)
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY)
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -21,11 +21,15 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode"); InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera;
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
Vector3 cubePosition = { 0.0, 0.0, 0.0 }; Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now... SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -40,14 +44,14 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(WHITE); ClearBackground(RAYWHITE);
Begin3dMode(camera); Begin3dMode(camera);
DrawCube(cubePosition, 2, 2, 2, RED); DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2, 2, 2, MAROON); DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(10.0, 1.0); DrawGrid(10, 1.0f);
End3dMode(); End3dMode();

64
examples/core_3d_mode.lua Normal file
View File

@@ -0,0 +1,64 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Initialize 3d mode
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode")
-- Define the camera to look into our 3d world
local camera = {}
camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
camera.fovy = 45.0 -- Camera field-of-view Y
local cubePosition = Vector3(0.0, 0.0, 0.0)
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- TODO: Update your variables here
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera) -- ERROR: Lua Error: attempt to index a number value (?)
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
DrawGrid(10, 1.0)
End3dMode()
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY)
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

104
examples/core_3d_picking.c Normal file
View File

@@ -0,0 +1,104 @@
/*******************************************************************************************
*
* raylib [core] example - Picking in 3d mode
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
// Define the camera to look into our 3d world
Camera camera;
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
Ray ray; // Picking line ray
bool collision = false;
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
// NOTE: This function is NOT WORKING properly!
ray = GetMouseRay(GetMousePosition(), camera);
// Check collision between ray and box
collision = CheckCollisionRayBox(ray,
(BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
(Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }});
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
if (collision)
{
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN);
}
else
{
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
}
DrawRay(ray, MAROON);
DrawGrid(10, 1.0f);
End3dMode();
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,96 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Picking in 3d mode
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking")
-- Define the camera to look into our 3d world
local camera = {}
camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
camera.fovy = 45.0 -- Camera field-of-view Y
local cubePosition = Vector3(0.0, 1.0, 0.0)
local cubeSize = Vector3(2.0, 2.0, 2.0)
local ray = Ray(Vector3(0, 0, 0), Vector3(0, 0, 0)) -- Picking line ray
local collision = false
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then
-- NOTE: This function is NOT WORKING properly!
ray = GetMouseRay(GetMousePosition(), camera)
-- Check collision between ray and box
collision = CheckCollisionRayBox(ray,
BoundingBox(Vector3(cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2),
Vector3(cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2)))
--print("collision check:", collision)
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
if (collision) then
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED)
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON)
DrawCubeWires(cubePosition, cubeSize.x + 0.2, cubeSize.y + 0.2, cubeSize.z + 0.2, GREEN)
else
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY)
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY)
end
DrawRay(ray, MAROON)
DrawGrid(10, 1.0)
End3dMode()
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY)
if (collision) then
DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30))/2, screenHeight*0.1, 30, GREEN)
end
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -15,7 +15,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -29,6 +29,8 @@ int main()
int screenHeight = 450; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -52,7 +54,7 @@ int main()
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

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

View File

@@ -0,0 +1,44 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Basic window
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
SetTargetFPS(60) -- Set target frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- TODO: Update your variables here
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

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

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -16,7 +16,7 @@ int main()
// Initialization // Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 400; int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)"); InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
@@ -30,7 +30,7 @@ int main()
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
{ {
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7); colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
colorsRecs[i].y = 40 + 100*(i/7) + 10*(i/7); colorsRecs[i].y = 60 + 100*(i/7) + 10*(i/7);
colorsRecs[i].width = 100; colorsRecs[i].width = 100;
colorsRecs[i].height = 100; colorsRecs[i].height = 100;
} }

View File

@@ -0,0 +1,82 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Color selection by mouse (collision detection)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
NUM_RECTANGLES = 21
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)")
local colors = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
GREEN, SKYBLUE, PURPLE, BEIGE }
local colorsRecs = {} -- Rectangles array
local selected = {}
-- Fills colorsRecs data (for every rectangle)
for i = 1, NUM_RECTANGLES do
colorsRecs[i] = Rectangle(0, 0, 0, 0)
colorsRecs[i].x = 20 + 100*((i-1)%7) + 10*((i-1)%7)
colorsRecs[i].y = 60 + 100*((i-1)//7) + 10*((i-1)//7) -- Using floor division: //
colorsRecs[i].width = 100
colorsRecs[i].height = 100
selected[i] = false
end
local mousePoint = Vector2(0, 0)
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
mousePoint = GetMousePosition()
for i = 1, NUM_RECTANGLES do -- Iterate along all the rectangles
if (CheckCollisionPointRec(mousePoint, colorsRecs[i])) then
colors[i].a = 120
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then selected[i] = not selected[i] end
else colors[i].a = 255 end
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
for i = 1, NUM_RECTANGLES do -- Draw all rectangles
DrawRectangleRec(colorsRecs[i], colors[i])
-- Draw four rectangles around selected rectangle
if (selected[i]) then
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE) -- Square top rectangle
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square left rectangle
DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square right rectangle
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE) -- Square bottom rectangle
end
end
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,76 @@
/*******************************************************************************************
*
* raylib [core] example - Windows drop files
*
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
int count = 0;
char **droppedFiles = { 0 };
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsFileDropped())
{
droppedFiles = GetDroppedFiles(&count);
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
else
{
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
for (int i = 0; i < count; i++)
{
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
}
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClearDroppedFiles(); // Clear internal buffers
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,66 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Windows drop files
--
-- This example only works on platforms that support drag & drop (Windows, Linux, OSX)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files")
local count = 0
local droppedFiles = {}
SetTargetFPS(60)
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
if (IsFileDropped()) then
droppedFiles = GetDroppedFiles()
count = #droppedFiles
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
if (count == 0) then DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY)
else
DrawText("Dropped files:", 100, 40, 20, DARKGRAY)
for i = 0, count-1 do
if (i%2 == 0) then DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5))
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3)) end
DrawText(droppedFiles[i+1], 120, 100 + 40*i, 10, GRAY)
end
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY)
end
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
ClearDroppedFiles() -- Clear internal buffers
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,115 @@
/*******************************************************************************************
*
* raylib [core] example - Gestures Detection
*
* This example has been created using raylib 1.4 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <string.h>
#define MAX_GESTURE_STRINGS 20
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection");
Vector2 touchPosition = { 0, 0 };
Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 };
int gesturesCount = 0;
char gestureStrings[MAX_GESTURE_STRINGS][32];
int currentGesture = GESTURE_NONE;
int lastGesture = GESTURE_NONE;
//SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
lastGesture = currentGesture;
currentGesture = GetGestureDetected();
touchPosition = GetTouchPosition(0);
if (CheckCollisionPointRec(touchPosition, touchArea) && (currentGesture != GESTURE_NONE))
{
if (currentGesture != lastGesture)
{
// Store gesture string
switch (currentGesture)
{
case GESTURE_TAP: strcpy(gestureStrings[gesturesCount], "GESTURE TAP"); break;
case GESTURE_DOUBLETAP: strcpy(gestureStrings[gesturesCount], "GESTURE DOUBLETAP"); break;
case GESTURE_HOLD: strcpy(gestureStrings[gesturesCount], "GESTURE HOLD"); break;
case GESTURE_DRAG: strcpy(gestureStrings[gesturesCount], "GESTURE DRAG"); break;
case GESTURE_SWIPE_RIGHT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE RIGHT"); break;
case GESTURE_SWIPE_LEFT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE LEFT"); break;
case GESTURE_SWIPE_UP: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE UP"); break;
case GESTURE_SWIPE_DOWN: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE DOWN"); break;
case GESTURE_PINCH_IN: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH IN"); break;
case GESTURE_PINCH_OUT: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH OUT"); break;
default: break;
}
gesturesCount++;
// Reset gestures strings
if (gesturesCount >= MAX_GESTURE_STRINGS)
{
for (int i = 0; i < MAX_GESTURE_STRINGS; i++) strcpy(gestureStrings[i], "\0");
gesturesCount = 0;
}
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawRectangleRec(touchArea, GRAY);
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE);
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f));
for (int i = 0; i < gesturesCount; i++)
{
if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f));
else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f));
if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY);
else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON);
}
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY);
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY);
if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View File

@@ -0,0 +1,102 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Gestures Detection
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
MAX_GESTURE_STRINGS = 20
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection")
local touchPosition = Vector2(0, 0)
local touchArea = Rectangle(220, 10, screenWidth - 230, screenHeight - 20)
local gesturesCount = 0
local gestureStrings = {}
for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "" end
local currentGesture = Gestures.NONE
local lastGesture = Gestures.NONE
--SetGesturesEnabled(0b0000000000001001) -- Enable only some gestures to be detected
SetTargetFPS(60)
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
lastGesture = currentGesture
currentGesture = GetGestureDetected()
touchPosition = GetTouchPosition(0)
if (CheckCollisionPointRec(touchPosition, touchArea) and (currentGesture ~= Gestures.NONE)) then
if (currentGesture ~= lastGesture) then
-- Store gesture string
if (currentGesture == Gestures.TAP) then gestureStrings[gesturesCount] = "GESTURE TAP"
elseif (currentGesture == Gestures.DOUBLETAP) then gestureStrings[gesturesCount] = "GESTURE DOUBLETAP"
elseif (currentGesture == Gestures.HOLD) then gestureStrings[gesturesCount] = "GESTURE HOLD"
elseif (currentGesture == Gestures.DRAG) then gestureStrings[gesturesCount] = "GESTURE DRAG"
elseif (currentGesture == Gestures.SWIPE_RIGHT) then gestureStrings[gesturesCount] = "GESTURE SWIPE RIGHT"
elseif (currentGesture == Gestures.SWIPE_LEFT) then gestureStrings[gesturesCount] = "GESTURE SWIPE LEFT"
elseif (currentGesture == Gestures.SWIPE_UP) then gestureStrings[gesturesCount] = "GESTURE SWIPE UP"
elseif (currentGesture == Gestures.SWIPE_DOWN) then gestureStrings[gesturesCount] = "GESTURE SWIPE DOWN"
elseif (currentGesture == Gestures.PINCH_IN) then gestureStrings[gesturesCount] = "GESTURE PINCH IN"
elseif (currentGesture == Gestures.PINCH_OUT) then gestureStrings[gesturesCount] = "GESTURE PINCH OUT"
end
gesturesCount = gesturesCount + 1
-- Reset gestures strings
if (gesturesCount >= MAX_GESTURE_STRINGS) then
for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "\0" end
gesturesCount = 0
end
end
end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawRectangleRec(touchArea, GRAY)
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE)
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5))
for i = 1, gesturesCount do
if ((i - 1)%2 == 0) then DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.5))
else DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.3)) end
if (i < gesturesCount) then DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, DARKGRAY)
else DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, MAROON) end
end
DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY)
DrawText("DETECTED GESTURES", 50, 15, 10, GRAY)
if (currentGesture ~= GESTURE_NONE) then DrawCircleV(touchPosition, 30, MAROON) end
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -3,17 +3,29 @@
* raylib [core] example - Gamepad input * raylib [core] example - Gamepad input
* *
* NOTE: This example requires a Gamepad connected to the system * 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 * raylib is configured to work with the following gamepads:
* Xbox 360 Controller (Xbox 360, Xbox One)
* PLAYSTATION(R)3 Controller
* Check raylib.h for buttons configuration
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.6 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * 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) 2013-2016 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
// NOTE: Gamepad name ID depends on drivers and OS
#if defined(PLATFORM_RPI)
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#else
#define XBOX360_NAME_ID "Xbox 360 Controller"
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#endif
int main() int main()
{ {
// Initialization // Initialization
@@ -21,12 +33,14 @@ int main()
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input"); InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
Texture2D texXboxPad = LoadTexture("resources/xbox.png");
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; SetTargetFPS(60);
Vector2 gamepadMovement = { 0, 0 };
SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -34,19 +48,7 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsGamepadAvailable(GAMEPAD_PLAYER1)) // ...
{
gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
ballPosition.x += gamepadMovement.x;
ballPosition.y -= gamepadMovement.y;
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
{
ballPosition.x = screenWidth/2;
ballPosition.y = screenHeight/2;
}
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -54,10 +56,127 @@ int main()
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY); if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
{
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
// Draw buttons: xbox home
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
DrawCircleV(ballPosition, 50, MAROON); // Draw buttons: basic
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, GOLD);
// Draw buttons: d-pad
DrawRectangle(317, 202, 19, 71, BLACK);
DrawRectangle(293, 228, 69, 19, BLACK);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
// Draw buttons: left-right back
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RED);
// Draw axis: left joystick
DrawCircle(259, 152, 39, BLACK);
DrawCircle(259, 152, 34, LIGHTGRAY);
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, BLACK);
// Draw axis: right joystick
DrawCircle(461, 237, 38, BLACK);
DrawCircle(461, 237, 33, LIGHTGRAY);
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, BLACK);
// Draw axis: left-right triggers
DrawRectangle(170, 30, 15, 70, GRAY);
DrawRectangle(604, 30, 15, 70, GRAY);
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RED);
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
}
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
{
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
// Draw buttons: ps
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
// Draw buttons: basic
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, PINK);
// Draw buttons: d-pad
DrawRectangle(225, 132, 24, 84, BLACK);
DrawRectangle(195, 161, 84, 25, BLACK);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
// Draw buttons: left-right back buttons
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RED);
// Draw axis: left joystick
DrawCircle(319, 255, 35, BLACK);
DrawCircle(319, 255, 31, LIGHTGRAY);
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, BLACK);
// Draw axis: right joystick
DrawCircle(475, 255, 35, BLACK);
DrawCircle(475, 255, 31, LIGHTGRAY);
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, BLACK);
// Draw axis: left-right triggers
DrawRectangle(169, 48, 15, 70, GRAY);
DrawRectangle(611, 48, 15, 70, GRAY);
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RED);
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
}
else
{
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
// TODO: Draw generic gamepad
}
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
{
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
}
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
}
else
{
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
}
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -65,6 +184,9 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texPs3Pad);
UnloadTexture(texXboxPad);
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -0,0 +1,163 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Gamepad input
--
-- NOTE: This example requires a Gamepad connected to the system
-- raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input")
local texPs3Pad = LoadTexture("resources/ps3.png")
local texXboxPad = LoadTexture("resources/xbox.png")
SetTargetFPS(60) -- Set target frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- ...
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
if (IsGamepadAvailable(GAMEPAD.PLAYER1)) then
DrawText(string.format("GP1: %s", GetGamepadName(GAMEPAD.PLAYER1)), 10, 10, 10, BLACK)
if (IsGamepadName(GAMEPAD.PLAYER1, "Xbox 360 Controller")) then
DrawTexture(texXboxPad, 0, 0, DARKGRAY)
-- Draw buttons: xbox home
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_HOME)) then DrawCircle(394, 89, 19, RED) end
-- Draw buttons: basic
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_START)) then DrawCircle(436, 150, 9, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_SELECT)) then DrawCircle(352, 150, 9, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_X)) then DrawCircle(501, 151, 15, BLUE) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_A)) then DrawCircle(536, 187, 15, LIME) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_B)) then DrawCircle(572, 151, 15, MAROON) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_Y)) then DrawCircle(536, 115, 15, GOLD) end
-- Draw buttons: d-pad
DrawRectangle(317, 202, 19, 71, BLACK)
DrawRectangle(293, 228, 69, 19, BLACK)
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_UP)) then DrawRectangle(317, 202, 19, 26, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_DOWN)) then DrawRectangle(317, 202 + 45, 19, 26, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LEFT)) then DrawRectangle(292, 228, 25, 19, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RIGHT)) then DrawRectangle(292 + 44, 228, 26, 19, RED) end
-- Draw buttons: left-right back
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LB)) then DrawCircle(259, 61, 20, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RB)) then DrawCircle(536, 61, 20, RED) end
-- Draw axis: left joystick
DrawCircle(259, 152, 39, BLACK)
DrawCircle(259, 152, 34, LIGHTGRAY)
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_X)*20),
152 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_Y)*20), 25, BLACK)
-- Draw axis: right joystick
DrawCircle(461, 237, 38, BLACK)
DrawCircle(461, 237, 33, LIGHTGRAY)
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RIGHT_X)*20),
237 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RIGHT_Y)*20), 25, BLACK)
-- Draw axis: left-right triggers
DrawRectangle(170, 30, 15, 70, GRAY)
DrawRectangle(604, 30, 15, 70, GRAY)
DrawRectangle(170, 30, 15, (((1.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT))/2.0)*70), RED)
DrawRectangle(604, 30, 15, (((1.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT))/2.0)*70), RED)
--DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT)), 10, 40, 10, BLACK)
--DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT)), 10, 60, 10, BLACK)
elseif (IsGamepadName(GAMEPAD.PLAYER1, "PLAYSTATION(R)3 Controller")) then
DrawTexture(texPs3Pad, 0, 0, DARKGRAY)
-- Draw buttons: ps
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_PS)) then DrawCircle(396, 222, 13, RED) end
-- Draw buttons: basic
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SELECT)) then DrawRectangle(328, 170, 32, 13, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_START)) then DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_TRIANGLE)) then DrawCircle(557, 144, 13, LIME) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CIRCLE)) then DrawCircle(586, 173, 13, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CROSS)) then DrawCircle(557, 203, 13, VIOLET) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SQUARE)) then DrawCircle(527, 173, 13, PINK) end
-- Draw buttons: d-pad
DrawRectangle(225, 132, 24, 84, BLACK)
DrawRectangle(195, 161, 84, 25, BLACK)
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_UP)) then DrawRectangle(225, 132, 24, 29, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_DOWN)) then DrawRectangle(225, 132 + 54, 24, 30, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_LEFT)) then DrawRectangle(195, 161, 30, 25, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_RIGHT)) then DrawRectangle(195 + 54, 161, 30, 25, RED) end
-- Draw buttons: left-right back buttons
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_L1)) then DrawCircle(239, 82, 20, RED) end
if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_R1)) then DrawCircle(557, 82, 20, RED) end
-- Draw axis: left joystick
DrawCircle(319, 255, 35, BLACK)
DrawCircle(319, 255, 31, LIGHTGRAY)
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_LEFT_X)*20),
255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_LEFT_Y)*20), 25, BLACK)
-- Draw axis: right joystick
DrawCircle(475, 255, 35, BLACK)
DrawCircle(475, 255, 31, LIGHTGRAY)
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_RIGHT_X)*20),
255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_RIGHT_Y)*20), 25, BLACK)
-- Draw axis: left-right triggers
DrawRectangle(169, 48, 15, 70, GRAY)
DrawRectangle(611, 48, 15, 70, GRAY)
DrawRectangle(169, 48, 15, (((1.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_L2))/2.0)*70), RED)
DrawRectangle(611, 48, 15, (((1.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_R2))/2.0)*70), RED)
else
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY)
-- TODO: Draw generic gamepad
end
DrawText(string.format("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD.PLAYER1)), 10, 50, 10, MAROON)
for i = 1, GetGamepadAxisCount(GAMEPAD.PLAYER1) do -- Iterate along all the rectangles
DrawText(string.format("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD.PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY)
end
if (GetGamepadButtonPressed() ~= -1) then DrawText(string.format("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED)
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY) end
else
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY)
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY)
end
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadTexture(texPs3Pad) -- Unload gamepad texture
UnloadTexture(texXboxPad) -- Unload gamepad texture
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -20,7 +20,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input"); InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
SetTargetFPS(60); // Set target frames-per-second SetTargetFPS(60); // Set target frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -30,10 +30,10 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8; if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f;
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8; if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f;
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8; if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f;
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8; if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@@ -0,0 +1,51 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Keyboard input
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
local ballPosition = Vector2(screenWidth/2, screenHeight/2)
SetTargetFPS(60) -- Set target frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
if (IsKeyDown(KEY.RIGHT)) then ballPosition.x = ballPosition.x + 0.8 end
if (IsKeyDown(KEY.LEFT)) then ballPosition.x = ballPosition.x - 0.8 end
if (IsKeyDown(KEY.UP)) then ballPosition.y = ballPosition.y - 0.8 end
if (IsKeyDown(KEY.DOWN)) then ballPosition.y = ballPosition.y + 0.8 end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY)
DrawCircleV(ballPosition, 50, MAROON)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -20,8 +20,10 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input"); InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
int mouseX, mouseY; Vector2 ballPosition = { -100.0f, -100.0f };
Vector2 ballPosition = { -100.0, -100.0 }; Color ballColor = DARKBLUE;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Main game loop // Main game loop
@@ -29,14 +31,11 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballPosition = GetMousePosition();
{
mouseX = GetMouseX(); if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
mouseY = GetMouseY(); else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
ballPosition.x = (float)mouseX;
ballPosition.y = (float)mouseY;
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -45,9 +44,9 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawCircleV(ballPosition, 40, GOLD); DrawCircleV(ballPosition, 40, ballColor);
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY); DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -0,0 +1,54 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Mouse input
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input")
local ballPosition = Vector2(-100.0, -100.0)
local ballColor = DARKBLUE
SetTargetFPS(60) -- Set target frames-per-second
-----------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
------------------------------------------------------------------------------------
ballPosition = GetMousePosition()
if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then ballColor = MAROON
elseif (IsMouseButtonPressed(MOUSE.MIDDLE_BUTTON)) then ballColor = LIME
elseif (IsMouseButtonPressed(MOUSE.RIGHT_BUTTON)) then ballColor = DARKBLUE
end
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawCircleV(ballPosition, 40, ballColor)
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY)
EndDrawing()
------------------------------------------------------------------------------------
end
-- De-Initialization
----------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -5,7 +5,7 @@
* This test has been created using raylib 1.1 (www.raylib.com) * This test has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/

View File

@@ -0,0 +1,50 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] examples - Mouse wheel
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel")
local boxPositionY = screenHeight/2 - 40
local scrollSpeed = 4 -- Scrolling speed in pixels
SetTargetFPS(60) -- Set target frames-per-second
----------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
------------------------------------------------------------------------------------
boxPositionY = boxPositionY - (GetMouseWheelMove()*scrollSpeed)
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON)
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY)
DrawText(string.format("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY)
EndDrawing()
------------------------------------------------------------------------------------
end
-- De-Initialization
----------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------

View File

@@ -0,0 +1,85 @@
/*******************************************************************************************
*
* raylib [core] example - Oculus Rift CV1
*
* Compile example using:
* gcc -o $(NAME_PART).exe $(FILE_NAME) -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99
*
* This example has been created using raylib 1.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 1080;
int screenHeight = 600;
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
// NOTE: If device is not available, it fallbacks to default device (simulator)
InitVrDevice(HMD_OCULUS_RIFT_CV1); // Init VR device (Oculus Rift CV1)
// Define the camera to look into our 3d world
Camera camera;
camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 60.0f; // Camera field-of-view Y
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsVrSimulator()) UpdateCamera(&camera); // Update camera (simulator mode)
else if (IsVrDeviceReady()) UpdateVrTracking(&camera); // Update camera with device tracking data
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(40, 1.0f);
End3dMode();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseVrDevice(); // Close VR device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,73 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Oculus Rift CV1
--
-- NOTE: Example requires linkage with LibOVR
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 1080
local screenHeight = 600
-- NOTE: screenWidth/screenHeight should match VR device aspect ratio
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift")
-- NOTE: If device is not available, it fallbacks to default device (simulator)
InitVrDevice(VrDevice.OCULUS_RIFT_CV1) -- Init VR device (Oculus Rift CV1)
-- Define the camera to look into our 3d world
local camera = {}
camera.position = Vector3(5.0, 5.0, 5.0) -- Camera position
camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
camera.fovy = 60.0 -- Camera field-of-view Y
local cubePosition = Vector3(0.0, 0.0, 0.0)
SetTargetFPS(90) -- Set our game to run at 90 frames-per-second
----------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
------------------------------------------------------------------------------------
UpdateVrTracking()
if (IsKeyPressed(KEY.SPACE)) then ToggleVrMode() end
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
DrawGrid(10, 1.0)
End3dMode()
DrawFPS(10, 10)
EndDrawing()
------------------------------------------------------------------------------------
end
-- De-Initialization
----------------------------------------------------------------------------------------
CloseVrDevice() -- Close VR device
CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -22,7 +22,7 @@ int main()
int framesCounter = 0; // Variable used to count frames int framesCounter = 0; // Variable used to count frames
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included) int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -37,7 +37,7 @@ int main()
// Every two seconds (120 frames) a new random value is generated // Every two seconds (120 frames) a new random value is generated
if (((framesCounter/120)%2) == 1) if (((framesCounter/120)%2) == 1)
{ {
randValue = GetRandomValue(-8,5); randValue = GetRandomValue(-8, 5);
framesCounter = 0; framesCounter = 0;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

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

View File

@@ -0,0 +1,85 @@
/*******************************************************************************************
*
* raylib [core] example - Storage save/load values
*
* This example has been created using raylib 1.4 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
// NOTE: Storage positions must start with 0, directly related to file memory layout
typedef enum { STORAGE_SCORE = 0, STORAGE_HISCORE } StorageData;
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values");
int score = 0;
int hiscore = 0;
int framesCounter = 0;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_R))
{
score = GetRandomValue(1000, 2000);
hiscore = GetRandomValue(2000, 4000);
}
if (IsKeyPressed(KEY_ENTER))
{
StorageSaveValue(STORAGE_SCORE, score);
StorageSaveValue(STORAGE_HISCORE, hiscore);
}
else if (IsKeyPressed(KEY_SPACE))
{
// NOTE: If requested position could not be found, value 0 is returned
score = StorageLoadValue(STORAGE_SCORE);
hiscore = StorageLoadValue(STORAGE_HISCORE);
}
framesCounter++;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,74 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - Storage save/load values
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- NOTE: Storage positions must start with 0, directly related to file memory layout
STORAGE_SCORE = 0
STORAGE_HISCORE = 1
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values")
local score = 0
local hiscore = 0
local framesCounter = 0
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
if (IsKeyPressed(KEY.R)) then
score = GetRandomValue(1000, 2000)
hiscore = GetRandomValue(2000, 4000)
end
if (IsKeyPressed(KEY.ENTER)) then
StorageSaveValue(STORAGE_SCORE, score)
StorageSaveValue(STORAGE_HISCORE, hiscore)
elseif (IsKeyPressed(KEY.SPACE)) then
-- NOTE: If requested position could not be found, value 0 is returned
score = StorageLoadValue(STORAGE_SCORE)
hiscore = StorageLoadValue(STORAGE_HISCORE)
end
framesCounter = framesCounter + 1
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText(string.format("SCORE: %i", score), 280, 130, 40, MAROON)
DrawText(string.format("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK)
DrawText(string.format("frames: %i", framesCounter), 10, 10, 20, LIME)
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY)
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY)
DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,74 @@
/*******************************************************************************************
*
* raylib [core] example - World to screen
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
// Define the camera to look into our 3d world
Camera camera = {{ 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
Vector2 cubeScreenPosition;
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
// Calculate cube screen space position (with a little offset to be in top)
cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(10, 1.0f);
End3dMode();
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,66 @@
-------------------------------------------------------------------------------------------
--
-- raylib [core] example - World to screen
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local cubePosition = Vector3(0.0, 0.0, 0.0)
local cubeScreenPosition = Vector2(0, 0)
SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
----------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
-- Calculate cube screen space position (with a little offset to be in top)
cubeScreenPosition = GetWorldToScreen(Vector3(cubePosition.x, cubePosition.y + 2.5, cubePosition.z), camera)
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
DrawGrid(10, 1.0)
End3dMode()
DrawText("Enemy: 100 / 100", cubeScreenPosition.x//1 - MeasureText("Enemy: 100 / 100", 20)//2, cubeScreenPosition.y//1, 20, BLACK)
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))//2, 25, 20, GRAY)
EndDrawing()
------------------------------------------------------------------------------------
end
-- De-Initialization
----------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,316 +0,0 @@
#**************************************************************************************************
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
#
# 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 examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
# determine SUBPLATFORM 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)
SUBPLATFORM=WINDOWS
else
UNAMEOS:=$(shell uname)
ifeq ($(UNAMEOS),Linux)
SUBPLATFORM=LINUX
else
ifeq ($(UNAMEOS),Darwin)
SUBPLATFORM=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
# define default gcc compiler
CC = gcc
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
endif
# define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src -L/opt/vc/lib
else
LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
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 ($(SUBPLATFORM),LINUX)
# libraries for Debian GNU/Linux desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
endif
ifeq ($(SUBPLATFORM),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
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),PLATFORM_DESKTOP)
# 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_random_values \
core_color_select \
core_3d_mode \
shapes_logo_raylib \
shapes_basic_shapes \
shapes_colors_palette \
shapes_logo_raylib_anim \
textures_logo_raylib \
textures_image_loading \
textures_rectangle \
textures_compressed_dds \
textures_mipmaps \
textures_srcrec_dstrec \
text_sprite_fonts \
text_rbmf_fonts \
text_format_text \
text_font_select \
models_geometric_shapes \
models_planes \
models_billboard \
models_obj_loading \
models_heightmap \
models_cubicmap \
audio_sound_loading \
audio_music_stream \
#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)
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
endif
# compile [core] example - mouse wheel
core_mouse_wheel: core_mouse_wheel.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# 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 [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 - compressed texture loading (DDS)
textures_compressed_dds: textures_compressed_dds.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture mipmaps generation
textures_mipmaps: textures_mipmaps.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture source and destination rectangles
textures_srcrec_dstrec: textures_srcrec_dstrec.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 - 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 [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)
# clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(SUBPLATFORM),OSX)
rm -f *.o
else
ifeq ($(SUBPLATFORM),LINUX)
find . -type f -executable -delete
rm -f *.o
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

@@ -2,10 +2,10 @@
* *
* raylib [models] example - Drawing billboards * raylib [models] example - Drawing billboards
* *
* This example has been created using raylib 1.2 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -21,24 +21,22 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Texture2D lena = LoadTexture("resources/lena.png"); // Our texture for billboard Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard
Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KEY_LEFT)) camera.position.x -= 0.2; UpdateCamera(&camera); // Update camera
if (IsKeyDown(KEY_RIGHT)) camera.position.x += 0.2;
if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -48,11 +46,10 @@ int main()
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
Begin3dMode(camera); Begin3dMode(camera);
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE); DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
DrawGrid(10, 1.0f); // Draw a grid
DrawGrid(10.0, 1.0); // Draw a grid
End3dMode(); End3dMode();
@@ -64,7 +61,7 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(lena); // Unload texture UnloadTexture(bill); // Unload texture
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -0,0 +1,62 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Drawing billboards
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(5.0, 4.0, 5.0), Vector3(0.0, 2.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local bill = LoadTexture("resources/billboard.png") -- Our texture billboard
local billPosition = Vector3(0.0, 2.0, 0.0) -- Position where draw billboard
SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawBillboard(camera, bill, billPosition, 2.0, WHITE)
DrawGrid(10, 1.0) -- Draw a grid
End3dMode()
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadTexture(bill) -- Unload texture
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -0,0 +1,121 @@
/*******************************************************************************************
*
* raylib [models] example - Detect basic 3d collisions (box vs sphere vs box)
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions");
// Define the camera to look into our 3d world
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Vector3 playerPosition = { 0.0f, 1.0f, 2.0f };
Vector3 playerSize = { 1.0f, 2.0f, 1.0f };
Color playerColor = GREEN;
Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f };
Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f };
Vector3 enemySpherePos = { 4.0f, 0.0f, 0.0f };
float enemySphereSize = 1.5f;
bool collision = false;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// Move player
if (IsKeyDown(KEY_RIGHT)) playerPosition.x += 0.2f;
else if (IsKeyDown(KEY_LEFT)) playerPosition.x -= 0.2f;
else if (IsKeyDown(KEY_DOWN)) playerPosition.z += 0.2f;
else if (IsKeyDown(KEY_UP)) playerPosition.z -= 0.2f;
collision = false;
// Check collisions player vs enemy-box
if (CheckCollisionBoxes(
(BoundingBox){(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 }},
(BoundingBox){(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(
(BoundingBox){(Vector3){ playerPosition.x - playerSize.x/2,
playerPosition.y - playerSize.y/2,
playerPosition.z - playerSize.z/2 },
(Vector3){ playerPosition.x + playerSize.x/2,
playerPosition.y + playerSize.y/2,
playerPosition.z + playerSize.z/2 }},
enemySpherePos, enemySphereSize)) collision = true;
if (collision) playerColor = RED;
else playerColor = GREEN;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
// Draw enemy-box
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY);
DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY);
// Draw enemy-sphere
DrawSphere(enemySpherePos, enemySphereSize, GRAY);
DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY);
// Draw player
DrawCubeV(playerPosition, playerSize, playerColor);
DrawGrid(10, 1.0f); // Draw a grid
End3dMode();
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -0,0 +1,115 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Detect basic 3d collisions (box vs sphere vs box)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local playerPosition = Vector3(0.0, 1.0, 2.0)
local playerSize = Vector3(1.0, 2.0, 1.0)
local playerColor = GREEN
local enemyBoxPos = Vector3(-4.0, 1.0, 0.0)
local enemyBoxSize = Vector3(2.0, 2.0, 2.0)
local enemySpherePos = Vector3(4.0, 0.0, 0.0)
local enemySphereSize = 1.5
local collision = false
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- Move player
if (IsKeyDown(KEY.RIGHT)) then playerPosition.x = playerPosition.x + 0.2
elseif (IsKeyDown(KEY.LEFT)) then playerPosition.x = playerPosition.x - 0.2
elseif (IsKeyDown(KEY.DOWN)) then playerPosition.z = playerPosition.z + 0.2
elseif (IsKeyDown(KEY.UP)) then playerPosition.z = playerPosition.z - 0.2 end
collision = false
-- Check collisions player vs enemy-box
if (CheckCollisionBoxes(
BoundingBox(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)),
BoundingBox(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)))) then collision = true
end
-- Check collisions player vs enemy-sphere
if (CheckCollisionBoxSphere(
BoundingBox(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)) then collision = true
end
if (collision) then playerColor = RED
else playerColor = GREEN end
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
-- Draw enemy-box
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY)
DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY)
-- Draw enemy-sphere
DrawSphere(enemySpherePos, enemySphereSize, GRAY)
DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY)
-- Draw player
DrawCubeV(playerPosition, playerSize, playerColor)
DrawGrid(10, 1.0) -- Draw a grid
End3dMode()
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY)
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -2,10 +2,10 @@
* *
* raylib [models] example - Cubicmap loading and drawing * raylib [models] example - Cubicmap loading and drawing
* *
* This example has been created using raylib 1.2 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -21,29 +21,31 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 16.0f, 14.0f, 16.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM) Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM) Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
Model map = LoadCubicmap(img); // Load cubicmap model Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
SetModelTexture(&map, texture); // Bind texture to model
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position // NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
map.material.texDiffuse = texture; // Set map diffuse texture
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KEY_UP)) camera.position.y += 0.2f; UpdateCamera(&camera); // Update camera
else if (IsKeyDown(KEY_DOWN)) camera.position.y -= 0.2f;
if (IsKeyDown(KEY_RIGHT)) camera.position.z += 0.2f;
else if (IsKeyDown(KEY_LEFT)) camera.position.z -= 0.2f;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -54,13 +56,15 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(map, mapPosition, 1.0f, MAROON); DrawModel(map, mapPosition, 1.0f, WHITE);
DrawGrid(10.0, 1.0);
DrawGizmo(mapPosition);
End3dMode(); End3dMode();
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
DrawText("cubicmap image used to", 658, 90, 10, GRAY);
DrawText("generate map 3d model", 658, 104, 10, GRAY);
DrawFPS(10, 10); DrawFPS(10, 10);
@@ -70,8 +74,9 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture UnloadTexture(cubicmap); // Unload cubicmap texture
UnloadModel(map); // Unload model UnloadTexture(texture); // Unload map texture
UnloadModel(map); // Unload map model
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -0,0 +1,77 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Cubicmap loading and drawing
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(16.0, 14.0, 16.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local image = LoadImage("resources/cubicmap.png") -- Load cubicmap image (RAM)
local cubicmap = LoadTextureFromImage(image) -- Convert image to texture to display (VRAM)
local map = LoadCubicmap(image) -- Load cubicmap model (generate model from image)
-- NOTE: By default each cube is mapped to one part of texture atlas
local texture = LoadTexture("resources/cubicmap_atlas.png") -- Load map texture
map.material.texDiffuse = texture -- Set map diffuse texture
local mapPosition = Vector3(-16.0, 0.0, -8.0) -- Set model position
UnloadImage(image) -- Unload cubesmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawModel(map, mapPosition, 1.0, WHITE)
End3dMode()
DrawTextureEx(cubicmap, (Vector2)(screenWidth - cubicmap.width*4 - 20, 20), 0.0, 4.0, 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()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadTexture(cubicmap) -- Unload cubicmap texture
UnloadTexture(texture) -- Unload map texture
UnloadModel(map) -- Unload map model
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 403 KiB

View File

@@ -5,7 +5,7 @@
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -21,7 +21,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes"); InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -42,21 +42,21 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED); DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD); DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON); DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON);
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN); DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN);
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME); DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME);
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE); DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE);
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE); DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE);
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN); DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN);
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD); DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD);
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK); DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK);
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10, 1.0f); // Draw a grid
End3dMode(); End3dMode();

View File

@@ -0,0 +1,67 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- TODO: Update your variables here
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera) -- ERROR: Lua Error: attempt to index a number value
DrawCube(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, RED)
DrawCubeWires(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, GOLD)
DrawCubeWires(Vector3(-4.0, 0.0, -2.0), 3.0, 6.0, 2.0, MAROON)
DrawSphere(Vector3(-1.0, 0.0, -2.0), 1.0, GREEN)
DrawSphereWires(Vector3(1.0, 0.0, 2.0), 2.0, 16, 16, LIME)
DrawCylinder(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, SKYBLUE)
DrawCylinderWires(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, DARKBLUE)
DrawCylinderWires(Vector3(4.5, -1.0, 2.0), 1.0, 1.0, 2.0, 6, BROWN)
DrawCylinder(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, GOLD)
DrawCylinderWires(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, PINK)
DrawGrid(10, 1.0) -- Draw a grid
End3dMode()
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

View File

@@ -2,10 +2,10 @@
* *
* raylib [models] example - Heightmap loading and drawing * raylib [models] example - Heightmap loading and drawing
* *
* This example has been created using raylib 1.1 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -20,26 +20,28 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
// Define the camera to look into our 3d world // Define our custom camera to look into our 3d world
Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 18.0f, 16.0f, 18.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM) Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM) Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
Model map = LoadHeightmap(img, 4); // Load heightmap model Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size
SetModelTexture(&map, texture); // Bind texture to model map.material.texDiffuse = texture; // Set map diffuse texture
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!)
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// ... UpdateCamera(&camera); // Update camera
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -50,13 +52,15 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(map, mapPosition, 0.5f, MAROON); // NOTE: Model is scaled to 1/4 of its original size (128x128 units)
DrawModel(map, mapPosition, 1.0f, RED);
DrawGrid(10.0, 1.0); DrawGrid(20, 1.0f);
DrawGizmo(mapPosition);
End3dMode(); End3dMode();
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@@ -0,0 +1,72 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Heightmap loading and drawing
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing")
-- Define our custom camera to look into our 3d world
local camera = Camera(Vector3(18.0, 16.0, 18.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local image = LoadImage("resources/heightmap.png") -- Load heightmap image (RAM)
local texture = LoadTextureFromImage(image) -- Convert image to texture (VRAM)
local map = LoadHeightmap(image, Vector3(16, 8, 16)) -- Load heightmap model with defined size
map.material.texDiffuse = texture -- Set map diffuse texture
local mapPosition = Vector3(-8.0, 0.0, -8.0) -- Set model position (depends on model scaling!)
UnloadImage(image) -- Unload heightmap image from RAM, already uploaded to VRAM
SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
----------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
camera = UpdateCamera(camera) -- Update camera
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
-- NOTE: Model is scaled to 1/4 of its original size (128x128 units)
DrawModel(map, mapPosition, 1.0, RED)
DrawGrid(20, 1.0)
End3dMode()
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE)
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN)
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadTexture(texture) -- Unload texture
UnloadModel(map) -- Unload model
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -2,10 +2,10 @@
* *
* raylib [models] example - Load and draw a 3d model (OBJ) * raylib [models] example - Load and draw a 3d model (OBJ)
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -21,12 +21,12 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading"); InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Texture2D texture = LoadTexture("resources/catsham.png"); // Load model texture Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
Model cat = LoadModel("resources/cat.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
SetModelTexture(&cat, texture); // Bind texture to model dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -36,10 +36,7 @@ int main()
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2; //...
if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -50,13 +47,15 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10, 1.0f); // Draw a grid
DrawGizmo(catPosition); // Draw gizmo DrawGizmo(position); // Draw gizmo
End3dMode(); End3dMode();
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
DrawFPS(10, 10); DrawFPS(10, 10);
@@ -67,7 +66,7 @@ int main()
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture UnloadTexture(texture); // Unload texture
UnloadModel(cat); // Unload model UnloadModel(dwarf); // Unload model
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -0,0 +1,67 @@
-------------------------------------------------------------------------------------------
--
-- raylib [models] example - Load and draw a 3d model (OBJ)
--
-- This example has been created using raylib 1.6 (www.raylib.com)
-- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
--
-- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
--
-------------------------------------------------------------------------------------------
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
local screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading")
-- Define the camera to look into our 3d world
local camera = Camera(Vector3(3.0, 3.0, 3.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
local texture = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model texture
dwarf.material.texDiffuse = texture -- Set dwarf model diffuse texture
local position = Vector3(0.0, 0.0, 0.0) -- Set model position
SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-------------------------------------------------------------------------------------------
-- Main game loop
while not WindowShouldClose() do -- Detect window close button or ESC key
-- Update
---------------------------------------------------------------------------------------
-- ...
---------------------------------------------------------------------------------------
-- Draw
---------------------------------------------------------------------------------------
BeginDrawing()
ClearBackground(RAYWHITE)
Begin3dMode(camera)
DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
DrawGrid(10, 1.0) -- Draw a grid
DrawGizmo(position) -- Draw gizmo
End3dMode()
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
DrawFPS(10, 10)
EndDrawing()
---------------------------------------------------------------------------------------
end
-- De-Initialization
-------------------------------------------------------------------------------------------
UnloadTexture(texture) -- Unload texture
UnloadModel(dwarf) -- Unload model
CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

122
examples/physics_demo.c Normal file
View File

@@ -0,0 +1,122 @@
/*******************************************************************************************
*
* Physac - Physics demo
*
* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external'
*
* Copyright (c) 2016 Victor Fisac
*
********************************************************************************************/
#include "raylib.h"
#define PHYSAC_IMPLEMENTATION
#include "..\src\physac.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics demo");
SetTargetFPS(60);
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
// Initialize physics and default physics bodies
InitPhysics();
// Create floor rectangle physics body
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
// Create obstacle circle physics body
PhysicsBody circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2, screenHeight/2 }, 45, 10);
circle->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
{
ResetPhysics();
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
floor->enabled = false;
circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2, screenHeight/2 }, 45, 10);
circle->enabled = false;
}
// Physics body creation inputs
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10);
// Destroy falling physics bodies
int bodiesCount = GetPhysicsBodiesCount();
for (int i = bodiesCount - 1; i >= 0; i--)
{
PhysicsBody body = GetPhysicsBody(i);
if (body != NULL && (body->position.y > screenHeight*2)) DestroyPhysicsBody(body);
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(BLACK);
DrawFPS(screenWidth - 90, screenHeight - 30);
// Draw created physics bodies
bodiesCount = GetPhysicsBodiesCount();
for (int i = 0; i < bodiesCount; i++)
{
PhysicsBody body = GetPhysicsBody(i);
if (body != NULL)
{
int vertexCount = GetPhysicsShapeVerticesCount(i);
for (int j = 0; j < vertexCount; j++)
{
// Get physics bodies shape vertices to draw lines
// Note: GetPhysicsShapeVertex() already calculates rotation transformations
Vector2 vertexA = GetPhysicsShapeVertex(body, j);
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
}
}
}
DrawText("Left mouse button to create a polygon", 10, 10, 10, WHITE);
DrawText("Right mouse button to create a circle", 10, 25, 10, WHITE);
DrawText("Press 'R' to reset example", 10, 40, 10, WHITE);
DrawText("Physac", logoX, logoY, 30, WHITE);
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

BIN
examples/physics_demo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

136
examples/physics_friction.c Normal file
View File

@@ -0,0 +1,136 @@
/*******************************************************************************************
*
* Physac - Physics friction
*
* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external'
*
* Copyright (c) 2016 Victor Fisac
*
********************************************************************************************/
#include "raylib.h"
#define PHYSAC_IMPLEMENTATION
#include "..\src\physac.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics friction");
SetTargetFPS(60);
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
// Initialize physics and default physics bodies
InitPhysics();
// Create floor rectangle physics body
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
PhysicsBody wall = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight*0.8f }, 10, 80, 10);
wall->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
// Create left ramp physics body
PhysicsBody rectLeft = CreatePhysicsBodyRectangle((Vector2){ 25, screenHeight - 5 }, 250, 250, 10);
rectLeft->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
SetPhysicsBodyRotation(rectLeft, 30*DEG2RAD);
// Create right ramp physics body
PhysicsBody rectRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 25, screenHeight - 5 }, 250, 250, 10);
rectRight->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
SetPhysicsBodyRotation(rectRight, 330*DEG2RAD);
// Create dynamic physics bodies
PhysicsBody bodyA = CreatePhysicsBodyRectangle((Vector2){ 35, screenHeight*0.6f }, 40, 40, 10);
bodyA->staticFriction = 0.1f;
bodyA->dynamicFriction = 0.1f;
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD);
PhysicsBody bodyB = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 35, screenHeight*0.6f }, 40, 40, 10);
bodyB->staticFriction = 1;
bodyB->dynamicFriction = 1;
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
{
// Reset dynamic physics bodies position, velocity and rotation
bodyA->position = (Vector2){ 35, screenHeight*0.6f };
bodyA->velocity = (Vector2){ 0, 0 };
bodyA->angularVelocity = 0;
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD);
bodyB->position = (Vector2){ screenWidth - 35, screenHeight*0.6f };
bodyB->velocity = (Vector2){ 0, 0 };
bodyB->angularVelocity = 0;
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD);
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(BLACK);
DrawFPS(screenWidth - 90, screenHeight - 30);
// Draw created physics bodies
int bodiesCount = GetPhysicsBodiesCount();
for (int i = 0; i < bodiesCount; i++)
{
PhysicsBody body = GetPhysicsBody(i);
if (body != NULL)
{
int vertexCount = GetPhysicsShapeVerticesCount(i);
for (int j = 0; j < vertexCount; j++)
{
// Get physics bodies shape vertices to draw lines
// Note: GetPhysicsShapeVertex() already calculates rotation transformations
Vector2 vertexA = GetPhysicsShapeVertex(body, j);
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
}
}
}
DrawRectangle(0, screenHeight - 49, screenWidth, 49, BLACK);
DrawText("Friction amount", (screenWidth - MeasureText("Friction amount", 30))/2, 75, 30, WHITE);
DrawText("0.1", bodyA->position.x - MeasureText("0.1", 20)/2, bodyA->position.y - 7, 20, WHITE);
DrawText("1", bodyB->position.x - MeasureText("1", 20)/2, bodyB->position.y - 7, 20, WHITE);
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE);
DrawText("Physac", logoX, logoY, 30, WHITE);
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

122
examples/physics_movement.c Normal file
View File

@@ -0,0 +1,122 @@
/*******************************************************************************************
*
* Physac - Physics movement
*
* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external'
*
* Copyright (c) 2016 Victor Fisac
*
********************************************************************************************/
#include "raylib.h"
#define PHYSAC_IMPLEMENTATION
#include "..\src\physac.h"
#define VELOCITY 0.5f
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics movement");
SetTargetFPS(60);
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
// Initialize physics and default physics bodies
InitPhysics();
// Create floor and walls rectangle physics body
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
PhysicsBody platformLeft = CreatePhysicsBodyRectangle((Vector2){ screenWidth*0.25f, screenHeight*0.6f }, screenWidth*0.25f, 10, 10);
PhysicsBody platformRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth*0.75f, screenHeight*0.6f }, screenWidth*0.25f, 10, 10);
PhysicsBody wallLeft = CreatePhysicsBodyRectangle((Vector2){ -5, screenHeight/2 }, 10, screenHeight, 10);
PhysicsBody wallRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth + 5, screenHeight/2 }, 10, screenHeight, 10);
// Disable dynamics to floor and walls physics bodies
floor->enabled = false;
platformLeft->enabled = false;
platformRight->enabled = false;
wallLeft->enabled = false;
wallRight->enabled = false;
// Create movement physics body
PhysicsBody body = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight/2 }, 50, 50, 1);
body->freezeOrient = true; // Constrain body rotation to avoid little collision torque amounts
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
{
// Reset movement physics body position, velocity and rotation
body->position = (Vector2){ screenWidth/2, screenHeight/2 };
body->velocity = (Vector2){ 0, 0 };
SetPhysicsBodyRotation(body, 0);
}
// Horizontal movement input
if (IsKeyDown(KEY_RIGHT)) body->velocity.x = VELOCITY;
else if (IsKeyDown(KEY_LEFT)) body->velocity.x = -VELOCITY;
// Vertical movement input checking if player physics body is grounded
if (IsKeyDown(KEY_UP) && body->isGrounded) body->velocity.y = -VELOCITY*4;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(BLACK);
DrawFPS(screenWidth - 90, screenHeight - 30);
// Draw created physics bodies
int bodiesCount = GetPhysicsBodiesCount();
for (int i = 0; i < bodiesCount; i++)
{
PhysicsBody body = GetPhysicsBody(i);
int vertexCount = GetPhysicsShapeVerticesCount(i);
for (int j = 0; j < vertexCount; j++)
{
// Get physics bodies shape vertices to draw lines
// Note: GetPhysicsShapeVertex() already calculates rotation transformations
Vector2 vertexA = GetPhysicsShapeVertex(body, j);
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
}
}
DrawText("Use 'ARROWS' to move player", 10, 10, 10, WHITE);
DrawText("Press 'R' to reset example", 10, 30, 10, WHITE);
DrawText("Physac", logoX, logoY, 30, WHITE);
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,115 @@
/*******************************************************************************************
*
* Physac - Physics restitution
*
* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external'
*
* Copyright (c) 2016 Victor Fisac
*
********************************************************************************************/
#include "raylib.h"
#define PHYSAC_IMPLEMENTATION
#include "..\src\physac.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics restitution");
SetTargetFPS(60);
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
// Initialize physics and default physics bodies
InitPhysics();
// Create floor rectangle physics body
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
floor->restitution = 1;
// Create circles physics body
PhysicsBody circleA = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.25f, screenHeight/2 }, 30, 10);
circleA->restitution = 0;
PhysicsBody circleB = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.5f, screenHeight/2 }, 30, 10);
circleB->restitution = 0.5f;
PhysicsBody circleC = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.75f, screenHeight/2 }, 30, 10);
circleC->restitution = 1;
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
{
// Reset circles physics bodies position and velocity
circleA->position = (Vector2){ screenWidth*0.25f, screenHeight/2 };
circleA->velocity = (Vector2){ 0, 0 };
circleB->position = (Vector2){ screenWidth*0.5f, screenHeight/2 };
circleB->velocity = (Vector2){ 0, 0 };
circleC->position = (Vector2){ screenWidth*0.75f, screenHeight/2 };
circleC->velocity = (Vector2){ 0, 0 };
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(BLACK);
DrawFPS(screenWidth - 90, screenHeight - 30);
// Draw created physics bodies
int bodiesCount = GetPhysicsBodiesCount();
for (int i = 0; i < bodiesCount; i++)
{
PhysicsBody body = GetPhysicsBody(i);
int vertexCount = GetPhysicsShapeVerticesCount(i);
for (int j = 0; j < vertexCount; j++)
{
// Get physics bodies shape vertices to draw lines
// Note: GetPhysicsShapeVertex() already calculates rotation transformations
Vector2 vertexA = GetPhysicsShapeVertex(body, j);
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
Vector2 vertexB = GetPhysicsShapeVertex(body, jj);
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
}
}
DrawText("Restitution amount", (screenWidth - MeasureText("Restitution amount", 30))/2, 75, 30, WHITE);
DrawText("0", circleA->position.x - MeasureText("0", 20)/2, circleA->position.y - 7, 20, WHITE);
DrawText("0.5", circleB->position.x - MeasureText("0.5", 20)/2, circleB->position.y - 7, 20, WHITE);
DrawText("1", circleC->position.x - MeasureText("1", 20)/2, circleC->position.y - 7, 20, WHITE);
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE);
DrawText("Physac", logoX, logoY, 30, WHITE);
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

107
examples/physics_shatter.c Normal file
View File

@@ -0,0 +1,107 @@
/*******************************************************************************************
*
* Physac - Body shatter
*
* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external'
*
* Copyright (c) 2016 Victor Fisac
*
********************************************************************************************/
#include "raylib.h"
#define PHYSAC_IMPLEMENTATION
#include "..\src\physac.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Body shatter");
SetTargetFPS(60);
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
// Initialize physics and default physics bodies
InitPhysics();
SetPhysicsGravity(0, 0);
// Create random polygon physics body to shatter
PhysicsBody body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
{
ResetPhysics();
// Create random polygon physics body to shatter
body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
}
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input
{
// Note: some values need to be stored in variables due to asynchronous changes during main thread
int count = GetPhysicsBodiesCount();
for (int i = count - 1; i >= 0; i--)
{
PhysicsBody currentBody = GetPhysicsBody(i);
if (currentBody != NULL) PhysicsShatter(currentBody, GetMousePosition(), 10/currentBody->inverseMass);
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(BLACK);
// Draw created physics bodies
int bodiesCount = GetPhysicsBodiesCount();
for (int i = 0; i < bodiesCount; i++)
{
PhysicsBody currentBody = GetPhysicsBody(i);
int vertexCount = GetPhysicsShapeVerticesCount(i);
for (int j = 0; j < vertexCount; j++)
{
// Get physics bodies shape vertices to draw lines
// Note: GetPhysicsShapeVertex() already calculates rotation transformations
Vector2 vertexA = GetPhysicsShapeVertex(currentBody, j);
int jj = (((j + 1) < vertexCount) ? (j + 1) : 0); // Get next vertex or first to close the shape
Vector2 vertexB = GetPhysicsShapeVertex(currentBody, jj);
DrawLineV(vertexA, vertexB, GREEN); // Draw a line between two vertex positions
}
}
DrawText("Left mouse button in polygon area to shatter body\nPress 'R' to reset example", 10, 10, 10, WHITE);
DrawText("Physac", logoX, logoY, 30, WHITE);
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff

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