diff --git a/HISTORY.md b/HISTORY.md
new file mode 100644
index 00000000..c5fd1c99
--- /dev/null
+++ b/HISTORY.md
@@ -0,0 +1,165 @@
+
+
+history
+-------
+
+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.
+
+I started with C language basis and, after searching for the most simple and easy-to-use library to teach
+videogames programming, I found WinBGI; it was great and it worked very well with students, in just a
+couple of weeks that people that had never written a single line of code were able to program (and understand)
+a simple PONG and some of them even a BREAKOUT!
+
+But WinBGI was not the clearer and most organized lib. There were a lot of things I found useless and
+confusing and some function names were not clear enough for most of the students; not to mention points
+like no transparencies support or no hardware acceleration.
+
+So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured,
+plain C coding and, the most important, primarily intended to LEARN videogames programming.
+
+I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# after C),
+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 started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
+
+Enjoy it.
+
+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
+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 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.
+
+[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.
+
+Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
+support of DDS texture files (compressed and uncompressed) along with mipmaps support.
+
+Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
+
+notes on raylib 1.2
+-------------------
+
+On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
+complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
+
+It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
+On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
+system has been written from scratch.
+
+A new display initialization system has been created to support multiple resolutions, adding black bars if required;
+user only defines desired screen size and it gets properly displayed.
+
+Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
+
+Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
+
+In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
+
+notes on raylib 1.3
+-------------------
+
+On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
+improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
+
+Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
+attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
+in this release, check raylib/shaders folder.
+
+Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
+A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
+Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
+
+New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
+
+[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
+primary intended for tools development. It's still in experimental state but already fully functional.
+
+Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
+
+Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
+
+notes on raylib 1.4
+-------------------
+
+On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
+lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
+
+First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
+Now a basic image processing can be done before converting the image to texture for usage.
+
+SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
+Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
+
+New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
+Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
+
+[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
+
+[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse.
+This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
+
+Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`).
+Gamepad support has also been added (experimental).
+
+Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
+and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
+A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
+
+Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
+how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
+
+Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
+
+notes on raylib 1.5
+-------------------
+
+On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
+
+VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
+
+New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
+
+New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
+
+Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
+
+Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
+
+Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
+
+Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
+
+This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/develop/CHANGELOG) file for a more detailed list of changes.
+
+Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
+
+Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
+
+notes on raylib 1.6
+-------------------
+
+On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
+
+Complete raylib Lua binding. All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
+
+Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
+
+Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
+
+Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
+
+Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
+
+Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
+
+Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
+
+New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
+
diff --git a/README.md b/README.md
index b868172e..fde1e279 100644
--- a/README.md
+++ b/README.md
@@ -11,170 +11,6 @@ NOTE for ADVENTURERS: raylib is a programming library to learn videogames progra
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
-history
--------
-
-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.
-
-I started with C language basis and, after searching for the most simple and easy-to-use library to teach
-videogames programming, I found WinBGI; it was great and it worked very well with students, in just a
-couple of weeks that people that had never written a single line of code were able to program (and understand)
-a simple PONG and some of them even a BREAKOUT!
-
-But WinBGI was not the clearer and most organized lib. There were a lot of things I found useless and
-confusing and some function names were not clear enough for most of the students; not to mention points
-like no transparencies support or no hardware acceleration.
-
-So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured,
-plain C coding and, the most important, primarily intended to LEARN videogames programming.
-
-I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# after C),
-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 started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
-
-Enjoy it.
-
-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
-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 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.
-
-[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.
-
-Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
-support of DDS texture files (compressed and uncompressed) along with mipmaps support.
-
-Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
-
-notes on raylib 1.2
--------------------
-
-On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a
-complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
-
-It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
-On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input
-system has been written from scratch.
-
-A new display initialization system has been created to support multiple resolutions, adding black bars if required;
-user only defines desired screen size and it gets properly displayed.
-
-Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
-
-Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
-
-In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
-
-notes on raylib 1.3
--------------------
-
-On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
-improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
-
-Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
-attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
-in this release, check raylib/shaders folder.
-
-Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
-A brand new [camera](https://github.com/raysan5/raylib/blob/develop/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
-Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
-
-New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
-
-[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (Immediate Mode GUI) module offers a set of functions to create simple user interfaces,
-primary intended for tools development. It's still in experimental state but already fully functional.
-
-Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
-
-Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
-
-notes on raylib 1.4
--------------------
-
-On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
-lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
-
-First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
-Now a basic image processing can be done before converting the image to texture for usage.
-
-SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
-Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
-
-New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
-Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
-
-[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
-
-[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse.
-This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
-
-Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`).
-Gamepad support has also been added (experimental).
-
-Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
-and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
-A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
-
-Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
-how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
-
-Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
-
-notes on raylib 1.5
--------------------
-
-On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
-
-VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
-
-New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
-
-New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
-
-Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
-
-Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
-
-Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
-
-Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
-
-This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/develop/CHANGELOG) file for a more detailed list of changes.
-
-Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
-
-Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
-
-notes on raylib 1.6
--------------------
-
-On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
-
-Complete raylib Lua binding. All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
-
-Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
-
-Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
-
-Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
-
-Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
-
-Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
-
-Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
-
-New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
-
-
features
--------
@@ -189,24 +25,22 @@ features
* 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)
+ * Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
* 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
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
- * Complete binding to LUA
+ * Complete binding to LUA: [raylib-lua](https://github.com/raysan5/raylib-lua)
-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, ...).
+raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option I found for
+multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, maintained, ...).
raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
to accomodate to Android, Raspberry Pi and HTML5.
-On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
+On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity life cycle.
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
-On Oculus Rift CV1, raylib uses Oculus PC SDK libraries but only the core C library ([LibOVR](https://github.com/raysan5/raylib/tree/develop/src/external/OculusSDK/LibOVR)); runtime library (LibOVRRT32_1.dll) must be linked at compilation time.
-
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
tools requirements
@@ -279,3 +113,8 @@ contributing (in some way or another) to make raylib project better. Huge thanks
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
+
+license
+-------
+
+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. Check [LICENSE](LICENSE.md) for further details.
diff --git a/games/makefile b/games/Makefile
similarity index 100%
rename from games/makefile
rename to games/Makefile
diff --git a/games/arkanoid.c b/games/arkanoid.c
index f10f9383..6231fb8b 100644
--- a/games/arkanoid.c
+++ b/games/arkanoid.c
@@ -77,9 +77,6 @@ static void DrawGame(void); // Draw game (one frame)
static void UnloadGame(void); // Unload game
static void UpdateDrawFrame(void); // Update and Draw (one frame)
-// Additional module functions
-static void UpdateBall(void);
-
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@@ -165,13 +162,13 @@ void UpdateGame(void)
if (!pause)
{
- // Player movement
+ // Player movement logic
if (IsKeyDown(KEY_LEFT)) player.position.x -= 5;
if ((player.position.x - player.size.x/2) <= 0) player.position.x = player.size.x/2;
if (IsKeyDown(KEY_RIGHT)) player.position.x += 5;
if ((player.position.x + player.size.x/2) >= screenWidth) player.position.x = screenWidth - player.size.x/2;
- // Launch ball
+ // Ball launching logic
if (!ball.active)
{
if (IsKeyPressed(KEY_SPACE))
@@ -181,7 +178,81 @@ void UpdateGame(void)
}
}
- UpdateBall();
+ // Ball movement logic
+ if (ball.active)
+ {
+ ball.position.x += ball.speed.x;
+ ball.position.y += ball.speed.y;
+ }
+ else
+ {
+ ball.position = (Vector2){ player.position.x, screenHeight*7/8 - 30 };
+ }
+
+ // Collision logic: ball vs walls
+ if (((ball.position.x + ball.radius) >= screenWidth) || ((ball.position.x - ball.radius) <= 0)) ball.speed.x *= -1;
+ if ((ball.position.y - ball.radius) <= 0) ball.speed.y *= -1;
+ if ((ball.position.y + ball.radius) >= screenHeight)
+ {
+ ball.speed = (Vector2){ 0, 0 };
+ ball.active = false;
+
+ player.life--;
+ }
+
+ // Collision logic: ball vs player
+ if (CheckCollisionCircleRec(ball.position, ball.radius,
+ (Rectangle){ player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y}))
+ {
+ if (ball.speed.y > 0)
+ {
+ ball.speed.y *= -1;
+ ball.speed.x = (ball.position.x - player.position.x)/(player.size.x/2)*5;
+ }
+ }
+
+ // Collision logic: ball vs bricks
+ for (int i = 0; i < LINES_OF_BRICKS; i++)
+ {
+ for (int j = 0; j < BRICKS_PER_LINE; j++)
+ {
+ if (brick[i][j].active)
+ {
+ // Hit below
+ if (((ball.position.y - ball.radius) <= (brick[i][j].position.y + brickSize.y/2)) &&
+ ((ball.position.y - ball.radius) > (brick[i][j].position.y + brickSize.y/2 + ball.speed.y)) &&
+ ((fabs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) && (ball.speed.y < 0))
+ {
+ brick[i][j].active = false;
+ ball.speed.y *= -1;
+ }
+ // Hit above
+ else if (((ball.position.y + ball.radius) >= (brick[i][j].position.y - brickSize.y/2)) &&
+ ((ball.position.y + ball.radius) < (brick[i][j].position.y - brickSize.y/2 + ball.speed.y)) &&
+ ((fabs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) && (ball.speed.y > 0))
+ {
+ brick[i][j].active = false;
+ ball.speed.y *= -1;
+ }
+ // Hit left
+ else if (((ball.position.x + ball.radius) >= (brick[i][j].position.x - brickSize.x/2)) &&
+ ((ball.position.x + ball.radius) < (brick[i][j].position.x - brickSize.x/2 + ball.speed.x)) &&
+ ((fabs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) && (ball.speed.x > 0))
+ {
+ brick[i][j].active = false;
+ ball.speed.x *= -1;
+ }
+ // Hit right
+ else if (((ball.position.x - ball.radius) <= (brick[i][j].position.x + brickSize.x/2)) &&
+ ((ball.position.x - ball.radius) > (brick[i][j].position.x + brickSize.x/2 + ball.speed.x)) &&
+ ((fabs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) && (ball.speed.x < 0))
+ {
+ brick[i][j].active = false;
+ ball.speed.x *= -1;
+ }
+ }
+ }
+ }
// Game over logic
if (player.life <= 0) gameOver = true;
@@ -260,90 +331,4 @@ void UpdateDrawFrame(void)
{
UpdateGame();
DrawGame();
-}
-
-//--------------------------------------------------------------------------------------
-// Additional module functions
-//--------------------------------------------------------------------------------------
-static void UpdateBall()
-{
- // Update position
- if (ball.active)
- {
- ball.position.x += ball.speed.x;
- ball.position.y += ball.speed.y;
- }
- else
- {
- ball.position = (Vector2){ player.position.x, screenHeight*7/8 - 30 };
- }
-
- // Bounce in x
- if (((ball.position.x + ball.radius) >= screenWidth) || ((ball.position.x - ball.radius) <= 0)) ball.speed.x *= -1;
-
- // Bounce in y
- if ((ball.position.y - ball.radius) <= 0) ball.speed.y *= -1;
-
- // Ball reaches bottom of the screen
- if ((ball.position.y + ball.radius) >= screenHeight)
- {
- ball.speed = (Vector2){ 0, 0 };
- ball.active = false;
-
- player.life--;
- }
-
- // Collision logic: ball vs player
- if (CheckCollisionCircleRec(ball.position, ball.radius,
- (Rectangle){ player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y}))
- {
- if (ball.speed.y > 0)
- {
- ball.speed.y *= -1;
- ball.speed.x = (ball.position.x - player.position.x)/(player.size.x/2)*5;
- }
- }
-
- // Collision logic: ball vs bricks
- for (int i = 0; i < LINES_OF_BRICKS; i++)
- {
- for (int j = 0; j < BRICKS_PER_LINE; j++)
- {
- if (brick[i][j].active)
- {
- // Hit below
- if (((ball.position.y - ball.radius) <= (brick[i][j].position.y + brickSize.y/2)) &&
- ((ball.position.y - ball.radius) > (brick[i][j].position.y + brickSize.y/2 + ball.speed.y)) &&
- ((fabs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) && (ball.speed.y < 0))
- {
- brick[i][j].active = false;
- ball.speed.y *= -1;
- }
- // Hit above
- else if (((ball.position.y + ball.radius) >= (brick[i][j].position.y - brickSize.y/2)) &&
- ((ball.position.y + ball.radius) < (brick[i][j].position.y - brickSize.y/2 + ball.speed.y)) &&
- ((fabs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) && (ball.speed.y > 0))
- {
- brick[i][j].active = false;
- ball.speed.y *= -1;
- }
- // Hit left
- else if (((ball.position.x + ball.radius) >= (brick[i][j].position.x - brickSize.x/2)) &&
- ((ball.position.x + ball.radius) < (brick[i][j].position.x - brickSize.x/2 + ball.speed.x)) &&
- ((fabs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) && (ball.speed.x > 0))
- {
- brick[i][j].active = false;
- ball.speed.x *= -1;
- }
- // Hit right
- else if (((ball.position.x - ball.radius) <= (brick[i][j].position.x + brickSize.x/2)) &&
- ((ball.position.x - ball.radius) > (brick[i][j].position.x + brickSize.x/2 + ball.speed.x)) &&
- ((fabs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) && (ball.speed.x < 0))
- {
- brick[i][j].active = false;
- ball.speed.x *= -1;
- }
- }
- }
- }
}
\ No newline at end of file
diff --git a/games/asteroids.c b/games/asteroids.c
index 53ebbd8e..11063889 100644
--- a/games/asteroids.c
+++ b/games/asteroids.c
@@ -82,9 +82,9 @@ static Meteor bigMeteor[MAX_BIG_METEORS];
static Meteor mediumMeteor[MAX_MEDIUM_METEORS];
static Meteor smallMeteor[MAX_SMALL_METEORS];
-static int countMediumMeteors;
-static int countSmallMeteors;
-static int meteorsDestroyed;
+static int midMeteorsCount;
+static int smallMeteorsCount;
+static int destroyedMeteorsCount;
//------------------------------------------------------------------------------------
// Module Functions Declaration (local)
@@ -95,7 +95,6 @@ static void DrawGame(void); // Draw game (one frame)
static void UnloadGame(void); // Unload game
static void UpdateDrawFrame(void); // Update and Draw (one frame)
-static void InitShoot(Shoot shoot);
static void DrawSpaceship(Vector2 position, float rotation, Color color);
//------------------------------------------------------------------------------------
@@ -164,7 +163,7 @@ void InitGame(void)
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
player.color = LIGHTGRAY;
- meteorsDestroyed = 0;
+ destroyedMeteorsCount = 0;
// Initialization shoot
for (int i = 0; i < PLAYER_MAX_SHOOTS; i++)
@@ -237,8 +236,8 @@ void InitGame(void)
smallMeteor[i].color = BLUE;
}
- countMediumMeteors = 0;
- countSmallMeteors = 0;
+ midMeteorsCount = 0;
+ smallMeteorsCount = 0;
}
// Update game (one frame)
@@ -250,17 +249,15 @@ void UpdateGame(void)
if (!pause)
{
- // Player logic
-
- // Rotation
+ // Player logic: rotation
if (IsKeyDown(KEY_LEFT)) player.rotation -= 5;
if (IsKeyDown(KEY_RIGHT)) player.rotation += 5;
- // Speed
+ // Player logic: speed
player.speed.x = sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
player.speed.y = cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
- // Controller
+ // Player logic: acceleration
if (IsKeyDown(KEY_UP))
{
if (player.acceleration < 1) player.acceleration += 0.04f;
@@ -276,17 +273,17 @@ void UpdateGame(void)
else if (player.acceleration < 0) player.acceleration = 0;
}
- // Movement
+ // Player logic: movement
player.position.x += (player.speed.x*player.acceleration);
player.position.y -= (player.speed.y*player.acceleration);
- // Wall behaviour for player
+ // Collision logic: player vs walls
if (player.position.x > screenWidth + shipHeight) player.position.x = -(shipHeight);
else if (player.position.x < -(shipHeight)) player.position.x = screenWidth + shipHeight;
if (player.position.y > (screenHeight + shipHeight)) player.position.y = -(shipHeight);
else if (player.position.y < -(shipHeight)) player.position.y = screenHeight + shipHeight;
- // Activation of shoot
+ // Player shoot logic
if (IsKeyPressed(KEY_SPACE))
{
for (int i = 0; i < PLAYER_MAX_SHOOTS; i++)
@@ -318,7 +315,7 @@ void UpdateGame(void)
shoot[i].position.x += shoot[i].speed.x;
shoot[i].position.y -= shoot[i].speed.y;
- // Wall behaviour for shoot
+ // Collision logic: shoot vs walls
if (shoot[i].position.x > screenWidth + shoot[i].radius)
{
shoot[i].active = false;
@@ -351,7 +348,7 @@ void UpdateGame(void)
}
}
- // Collision Player to meteors
+ // Collision logic: player vs meteors
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
for (int a = 0; a < MAX_BIG_METEORS; a++)
@@ -369,16 +366,16 @@ void UpdateGame(void)
if (CheckCollisionCircles((Vector2){player.collider.x, player.collider.y}, player.collider.z, smallMeteor[a].position, smallMeteor[a].radius) && smallMeteor[a].active) gameOver = true;
}
- // Meteor logic
+ // Meteors logic: big meteors
for (int i = 0; i < MAX_BIG_METEORS; i++)
{
if (bigMeteor[i].active)
{
- // movement
+ // Movement
bigMeteor[i].position.x += bigMeteor[i].speed.x;
bigMeteor[i].position.y += bigMeteor[i].speed.y;
- // wall behaviour
+ // Collision logic: meteor vs wall
if (bigMeteor[i].position.x > screenWidth + bigMeteor[i].radius) bigMeteor[i].position.x = -(bigMeteor[i].radius);
else if (bigMeteor[i].position.x < 0 - bigMeteor[i].radius) bigMeteor[i].position.x = screenWidth + bigMeteor[i].radius;
if (bigMeteor[i].position.y > screenHeight + bigMeteor[i].radius) bigMeteor[i].position.y = -(bigMeteor[i].radius);
@@ -386,15 +383,16 @@ void UpdateGame(void)
}
}
+ // Meteors logic: medium meteors
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
{
if (mediumMeteor[i].active)
{
- // movement
+ // Movement
mediumMeteor[i].position.x += mediumMeteor[i].speed.x;
mediumMeteor[i].position.y += mediumMeteor[i].speed.y;
- // wall behaviour
+ // Collision logic: meteor vs wall
if (mediumMeteor[i].position.x > screenWidth + mediumMeteor[i].radius) mediumMeteor[i].position.x = -(mediumMeteor[i].radius);
else if (mediumMeteor[i].position.x < 0 - mediumMeteor[i].radius) mediumMeteor[i].position.x = screenWidth + mediumMeteor[i].radius;
if (mediumMeteor[i].position.y > screenHeight + mediumMeteor[i].radius) mediumMeteor[i].position.y = -(mediumMeteor[i].radius);
@@ -402,15 +400,16 @@ void UpdateGame(void)
}
}
+ // Meteors logic: small meteors
for (int i = 0; i < MAX_SMALL_METEORS; i++)
{
if (smallMeteor[i].active)
{
- // movement
+ // Movement
smallMeteor[i].position.x += smallMeteor[i].speed.x;
smallMeteor[i].position.y += smallMeteor[i].speed.y;
- // wall behaviour
+ // Collision logic: meteor vs wall
if (smallMeteor[i].position.x > screenWidth + smallMeteor[i].radius) smallMeteor[i].position.x = -(smallMeteor[i].radius);
else if (smallMeteor[i].position.x < 0 - smallMeteor[i].radius) smallMeteor[i].position.x = screenWidth + smallMeteor[i].radius;
if (smallMeteor[i].position.y > screenHeight + smallMeteor[i].radius) smallMeteor[i].position.y = -(smallMeteor[i].radius);
@@ -418,7 +417,7 @@ void UpdateGame(void)
}
}
- // Collision behaviour
+ // Collision logic: player-shoots vs meteors
for (int i = 0; i < PLAYER_MAX_SHOOTS; i++)
{
if ((shoot[i].active))
@@ -430,31 +429,30 @@ void UpdateGame(void)
shoot[i].active = false;
shoot[i].lifeSpawn = 0;
bigMeteor[a].active = false;
- meteorsDestroyed++;
+ destroyedMeteorsCount++;
+
for (int j = 0; j < 2; j ++)
{
- if (countMediumMeteors%2 == 0)
+ if (midMeteorsCount%2 == 0)
{
- mediumMeteor[countMediumMeteors].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
- mediumMeteor[countMediumMeteors].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
+ mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
+ mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
}
else
{
- mediumMeteor[countMediumMeteors].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
- mediumMeteor[countMediumMeteors].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
+ mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
+ mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
}
- mediumMeteor[countMediumMeteors].active = true;
- countMediumMeteors ++;
+ mediumMeteor[midMeteorsCount].active = true;
+ midMeteorsCount ++;
}
//bigMeteor[a].position = (Vector2){-100, -100};
bigMeteor[a].color = RED;
a = MAX_BIG_METEORS;
}
}
- }
- if ((shoot[i].active))
- {
+
for (int b = 0; b < MAX_MEDIUM_METEORS; b++)
{
if (mediumMeteor[b].active && CheckCollisionCircles(shoot[i].position, shoot[i].radius, mediumMeteor[b].position, mediumMeteor[b].radius))
@@ -462,31 +460,30 @@ void UpdateGame(void)
shoot[i].active = false;
shoot[i].lifeSpawn = 0;
mediumMeteor[b].active = false;
- meteorsDestroyed++;
+ destroyedMeteorsCount++;
+
for (int j = 0; j < 2; j ++)
{
- if (countSmallMeteors%2 == 0)
+ if (smallMeteorsCount%2 == 0)
{
- smallMeteor[countSmallMeteors].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
- smallMeteor[countSmallMeteors].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
+ smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
+ smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
}
else
{
- smallMeteor[countSmallMeteors].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
- smallMeteor[countSmallMeteors].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
+ smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
+ smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
}
- smallMeteor[countSmallMeteors].active = true;
- countSmallMeteors ++;
+ smallMeteor[smallMeteorsCount].active = true;
+ smallMeteorsCount ++;
}
//mediumMeteor[b].position = (Vector2){-100, -100};
mediumMeteor[b].color = GREEN;
b = MAX_MEDIUM_METEORS;
}
}
- }
- if ((shoot[i].active))
- {
+
for (int c = 0; c < MAX_SMALL_METEORS; c++)
{
if (smallMeteor[c].active && CheckCollisionCircles(shoot[i].position, shoot[i].radius, smallMeteor[c].position, smallMeteor[c].radius))
@@ -494,7 +491,7 @@ void UpdateGame(void)
shoot[i].active = false;
shoot[i].lifeSpawn = 0;
smallMeteor[c].active = false;
- meteorsDestroyed++;
+ destroyedMeteorsCount++;
smallMeteor[c].color = YELLOW;
// smallMeteor[c].position = (Vector2){-100, -100};
c = MAX_SMALL_METEORS;
@@ -504,7 +501,7 @@ void UpdateGame(void)
}
}
- if (meteorsDestroyed == MAX_BIG_METEORS + MAX_MEDIUM_METEORS + MAX_SMALL_METEORS) victory = true;
+ if (destroyedMeteorsCount == MAX_BIG_METEORS + MAX_MEDIUM_METEORS + MAX_SMALL_METEORS) victory = true;
}
else
{
diff --git a/games/drturtle/makefile b/games/drturtle/Makefile
similarity index 100%
rename from games/drturtle/makefile
rename to games/drturtle/Makefile
diff --git a/games/just_do/makefile b/games/just_do/Makefile
similarity index 100%
rename from games/just_do/makefile
rename to games/just_do/Makefile
diff --git a/games/light_my_ritual/makefile b/games/light_my_ritual/Makefile
similarity index 100%
rename from games/light_my_ritual/makefile
rename to games/light_my_ritual/Makefile
diff --git a/games/skully_escape/makefile b/games/skully_escape/Makefile
similarity index 100%
rename from games/skully_escape/makefile
rename to games/skully_escape/Makefile
diff --git a/src/external/android/native_app_glue/Android.mk b/src/external/android/native_app_glue/Android.mk
new file mode 100644
index 00000000..00252fcb
--- /dev/null
+++ b/src/external/android/native_app_glue/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= android_native_app_glue
+LOCAL_SRC_FILES:= android_native_app_glue.c
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
+LOCAL_EXPORT_LDLIBS := -llog
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/external/android/native_app_glue/NOTICE b/src/external/android/native_app_glue/NOTICE
new file mode 100644
index 00000000..d6c09229
--- /dev/null
+++ b/src/external/android/native_app_glue/NOTICE
@@ -0,0 +1,13 @@
+Copyright (C) 2016 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/src/external/android/native_app_glue/android_native_app_glue.c b/src/external/android/native_app_glue/android_native_app_glue.c
new file mode 100644
index 00000000..d503d8da
--- /dev/null
+++ b/src/external/android/native_app_glue/android_native_app_glue.c
@@ -0,0 +1,441 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "android_native_app_glue.h"
+#include
+
+#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__))
+#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "threaded_app", __VA_ARGS__))
+
+/* For debug builds, always enable the debug traces in this library */
+#ifndef NDEBUG
+# define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, "threaded_app", __VA_ARGS__))
+#else
+# define LOGV(...) ((void)0)
+#endif
+
+static void free_saved_state(struct android_app* android_app) {
+ pthread_mutex_lock(&android_app->mutex);
+ if (android_app->savedState != NULL) {
+ free(android_app->savedState);
+ android_app->savedState = NULL;
+ android_app->savedStateSize = 0;
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+}
+
+int8_t android_app_read_cmd(struct android_app* android_app) {
+ int8_t cmd;
+ if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd)) {
+ switch (cmd) {
+ case APP_CMD_SAVE_STATE:
+ free_saved_state(android_app);
+ break;
+ }
+ return cmd;
+ } else {
+ LOGE("No data on command pipe!");
+ }
+ return -1;
+}
+
+static void print_cur_config(struct android_app* android_app) {
+ char lang[2], country[2];
+ AConfiguration_getLanguage(android_app->config, lang);
+ AConfiguration_getCountry(android_app->config, country);
+
+ LOGV("Config: mcc=%d mnc=%d lang=%c%c cnt=%c%c orien=%d touch=%d dens=%d "
+ "keys=%d nav=%d keysHid=%d navHid=%d sdk=%d size=%d long=%d "
+ "modetype=%d modenight=%d",
+ AConfiguration_getMcc(android_app->config),
+ AConfiguration_getMnc(android_app->config),
+ lang[0], lang[1], country[0], country[1],
+ AConfiguration_getOrientation(android_app->config),
+ AConfiguration_getTouchscreen(android_app->config),
+ AConfiguration_getDensity(android_app->config),
+ AConfiguration_getKeyboard(android_app->config),
+ AConfiguration_getNavigation(android_app->config),
+ AConfiguration_getKeysHidden(android_app->config),
+ AConfiguration_getNavHidden(android_app->config),
+ AConfiguration_getSdkVersion(android_app->config),
+ AConfiguration_getScreenSize(android_app->config),
+ AConfiguration_getScreenLong(android_app->config),
+ AConfiguration_getUiModeType(android_app->config),
+ AConfiguration_getUiModeNight(android_app->config));
+}
+
+void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd) {
+ switch (cmd) {
+ case APP_CMD_INPUT_CHANGED:
+ LOGV("APP_CMD_INPUT_CHANGED\n");
+ pthread_mutex_lock(&android_app->mutex);
+ if (android_app->inputQueue != NULL) {
+ AInputQueue_detachLooper(android_app->inputQueue);
+ }
+ android_app->inputQueue = android_app->pendingInputQueue;
+ if (android_app->inputQueue != NULL) {
+ LOGV("Attaching input queue to looper");
+ AInputQueue_attachLooper(android_app->inputQueue,
+ android_app->looper, LOOPER_ID_INPUT, NULL,
+ &android_app->inputPollSource);
+ }
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ break;
+
+ case APP_CMD_INIT_WINDOW:
+ LOGV("APP_CMD_INIT_WINDOW\n");
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->window = android_app->pendingWindow;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ break;
+
+ case APP_CMD_TERM_WINDOW:
+ LOGV("APP_CMD_TERM_WINDOW\n");
+ pthread_cond_broadcast(&android_app->cond);
+ break;
+
+ case APP_CMD_RESUME:
+ case APP_CMD_START:
+ case APP_CMD_PAUSE:
+ case APP_CMD_STOP:
+ LOGV("activityState=%d\n", cmd);
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->activityState = cmd;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ break;
+
+ case APP_CMD_CONFIG_CHANGED:
+ LOGV("APP_CMD_CONFIG_CHANGED\n");
+ AConfiguration_fromAssetManager(android_app->config,
+ android_app->activity->assetManager);
+ print_cur_config(android_app);
+ break;
+
+ case APP_CMD_DESTROY:
+ LOGV("APP_CMD_DESTROY\n");
+ android_app->destroyRequested = 1;
+ break;
+ }
+}
+
+void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) {
+ switch (cmd) {
+ case APP_CMD_TERM_WINDOW:
+ LOGV("APP_CMD_TERM_WINDOW\n");
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->window = NULL;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ break;
+
+ case APP_CMD_SAVE_STATE:
+ LOGV("APP_CMD_SAVE_STATE\n");
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->stateSaved = 1;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ break;
+
+ case APP_CMD_RESUME:
+ free_saved_state(android_app);
+ break;
+ }
+}
+
+void app_dummy() {
+
+}
+
+static void android_app_destroy(struct android_app* android_app) {
+ LOGV("android_app_destroy!");
+ free_saved_state(android_app);
+ pthread_mutex_lock(&android_app->mutex);
+ if (android_app->inputQueue != NULL) {
+ AInputQueue_detachLooper(android_app->inputQueue);
+ }
+ AConfiguration_delete(android_app->config);
+ android_app->destroyed = 1;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ // Can't touch android_app object after this.
+}
+
+static void process_input(struct android_app* app, struct android_poll_source* source) {
+ AInputEvent* event = NULL;
+ while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
+ LOGV("New input event: type=%d\n", AInputEvent_getType(event));
+ if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
+ continue;
+ }
+ int32_t handled = 0;
+ if (app->onInputEvent != NULL) handled = app->onInputEvent(app, event);
+ AInputQueue_finishEvent(app->inputQueue, event, handled);
+ }
+}
+
+static void process_cmd(struct android_app* app, struct android_poll_source* source) {
+ int8_t cmd = android_app_read_cmd(app);
+ android_app_pre_exec_cmd(app, cmd);
+ if (app->onAppCmd != NULL) app->onAppCmd(app, cmd);
+ android_app_post_exec_cmd(app, cmd);
+}
+
+static void* android_app_entry(void* param) {
+ struct android_app* android_app = (struct android_app*)param;
+
+ android_app->config = AConfiguration_new();
+ AConfiguration_fromAssetManager(android_app->config, android_app->activity->assetManager);
+
+ print_cur_config(android_app);
+
+ android_app->cmdPollSource.id = LOOPER_ID_MAIN;
+ android_app->cmdPollSource.app = android_app;
+ android_app->cmdPollSource.process = process_cmd;
+ android_app->inputPollSource.id = LOOPER_ID_INPUT;
+ android_app->inputPollSource.app = android_app;
+ android_app->inputPollSource.process = process_input;
+
+ ALooper* looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
+ ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL,
+ &android_app->cmdPollSource);
+ android_app->looper = looper;
+
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->running = 1;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+
+ android_main(android_app);
+
+ android_app_destroy(android_app);
+ return NULL;
+}
+
+// --------------------------------------------------------------------
+// Native activity interaction (called from main thread)
+// --------------------------------------------------------------------
+
+static struct android_app* android_app_create(ANativeActivity* activity,
+ void* savedState, size_t savedStateSize) {
+ struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app));
+ memset(android_app, 0, sizeof(struct android_app));
+ android_app->activity = activity;
+
+ pthread_mutex_init(&android_app->mutex, NULL);
+ pthread_cond_init(&android_app->cond, NULL);
+
+ if (savedState != NULL) {
+ android_app->savedState = malloc(savedStateSize);
+ android_app->savedStateSize = savedStateSize;
+ memcpy(android_app->savedState, savedState, savedStateSize);
+ }
+
+ int msgpipe[2];
+ if (pipe(msgpipe)) {
+ LOGE("could not create pipe: %s", strerror(errno));
+ return NULL;
+ }
+ android_app->msgread = msgpipe[0];
+ android_app->msgwrite = msgpipe[1];
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create(&android_app->thread, &attr, android_app_entry, android_app);
+
+ // Wait for thread to start.
+ pthread_mutex_lock(&android_app->mutex);
+ while (!android_app->running) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+
+ return android_app;
+}
+
+static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) {
+ if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) {
+ LOGE("Failure writing android_app cmd: %s\n", strerror(errno));
+ }
+}
+
+static void android_app_set_input(struct android_app* android_app, AInputQueue* inputQueue) {
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->pendingInputQueue = inputQueue;
+ android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
+ while (android_app->inputQueue != android_app->pendingInputQueue) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+}
+
+static void android_app_set_window(struct android_app* android_app, ANativeWindow* window) {
+ pthread_mutex_lock(&android_app->mutex);
+ if (android_app->pendingWindow != NULL) {
+ android_app_write_cmd(android_app, APP_CMD_TERM_WINDOW);
+ }
+ android_app->pendingWindow = window;
+ if (window != NULL) {
+ android_app_write_cmd(android_app, APP_CMD_INIT_WINDOW);
+ }
+ while (android_app->window != android_app->pendingWindow) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+}
+
+static void android_app_set_activity_state(struct android_app* android_app, int8_t cmd) {
+ pthread_mutex_lock(&android_app->mutex);
+ android_app_write_cmd(android_app, cmd);
+ while (android_app->activityState != cmd) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+}
+
+static void android_app_free(struct android_app* android_app) {
+ pthread_mutex_lock(&android_app->mutex);
+ android_app_write_cmd(android_app, APP_CMD_DESTROY);
+ while (!android_app->destroyed) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+ pthread_mutex_unlock(&android_app->mutex);
+
+ close(android_app->msgread);
+ close(android_app->msgwrite);
+ pthread_cond_destroy(&android_app->cond);
+ pthread_mutex_destroy(&android_app->mutex);
+ free(android_app);
+}
+
+static void onDestroy(ANativeActivity* activity) {
+ LOGV("Destroy: %p\n", activity);
+ android_app_free((struct android_app*)activity->instance);
+}
+
+static void onStart(ANativeActivity* activity) {
+ LOGV("Start: %p\n", activity);
+ android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_START);
+}
+
+static void onResume(ANativeActivity* activity) {
+ LOGV("Resume: %p\n", activity);
+ android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_RESUME);
+}
+
+static void* onSaveInstanceState(ANativeActivity* activity, size_t* outLen) {
+ struct android_app* android_app = (struct android_app*)activity->instance;
+ void* savedState = NULL;
+
+ LOGV("SaveInstanceState: %p\n", activity);
+ pthread_mutex_lock(&android_app->mutex);
+ android_app->stateSaved = 0;
+ android_app_write_cmd(android_app, APP_CMD_SAVE_STATE);
+ while (!android_app->stateSaved) {
+ pthread_cond_wait(&android_app->cond, &android_app->mutex);
+ }
+
+ if (android_app->savedState != NULL) {
+ savedState = android_app->savedState;
+ *outLen = android_app->savedStateSize;
+ android_app->savedState = NULL;
+ android_app->savedStateSize = 0;
+ }
+
+ pthread_mutex_unlock(&android_app->mutex);
+
+ return savedState;
+}
+
+static void onPause(ANativeActivity* activity) {
+ LOGV("Pause: %p\n", activity);
+ android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_PAUSE);
+}
+
+static void onStop(ANativeActivity* activity) {
+ LOGV("Stop: %p\n", activity);
+ android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_STOP);
+}
+
+static void onConfigurationChanged(ANativeActivity* activity) {
+ struct android_app* android_app = (struct android_app*)activity->instance;
+ LOGV("ConfigurationChanged: %p\n", activity);
+ android_app_write_cmd(android_app, APP_CMD_CONFIG_CHANGED);
+}
+
+static void onLowMemory(ANativeActivity* activity) {
+ struct android_app* android_app = (struct android_app*)activity->instance;
+ LOGV("LowMemory: %p\n", activity);
+ android_app_write_cmd(android_app, APP_CMD_LOW_MEMORY);
+}
+
+static void onWindowFocusChanged(ANativeActivity* activity, int focused) {
+ LOGV("WindowFocusChanged: %p -- %d\n", activity, focused);
+ android_app_write_cmd((struct android_app*)activity->instance,
+ focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS);
+}
+
+static void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window) {
+ LOGV("NativeWindowCreated: %p -- %p\n", activity, window);
+ android_app_set_window((struct android_app*)activity->instance, window);
+}
+
+static void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window) {
+ LOGV("NativeWindowDestroyed: %p -- %p\n", activity, window);
+ android_app_set_window((struct android_app*)activity->instance, NULL);
+}
+
+static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue) {
+ LOGV("InputQueueCreated: %p -- %p\n", activity, queue);
+ android_app_set_input((struct android_app*)activity->instance, queue);
+}
+
+static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue) {
+ LOGV("InputQueueDestroyed: %p -- %p\n", activity, queue);
+ android_app_set_input((struct android_app*)activity->instance, NULL);
+}
+
+void ANativeActivity_onCreate(ANativeActivity* activity,
+ void* savedState, size_t savedStateSize) {
+ LOGV("Creating: %p\n", activity);
+ activity->callbacks->onDestroy = onDestroy;
+ activity->callbacks->onStart = onStart;
+ activity->callbacks->onResume = onResume;
+ activity->callbacks->onSaveInstanceState = onSaveInstanceState;
+ activity->callbacks->onPause = onPause;
+ activity->callbacks->onStop = onStop;
+ activity->callbacks->onConfigurationChanged = onConfigurationChanged;
+ activity->callbacks->onLowMemory = onLowMemory;
+ activity->callbacks->onWindowFocusChanged = onWindowFocusChanged;
+ activity->callbacks->onNativeWindowCreated = onNativeWindowCreated;
+ activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed;
+ activity->callbacks->onInputQueueCreated = onInputQueueCreated;
+ activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed;
+
+ activity->instance = android_app_create(activity, savedState, savedStateSize);
+}
diff --git a/src/external/android_native_app_glue.h b/src/external/android/native_app_glue/android_native_app_glue.h
similarity index 99%
rename from src/external/android_native_app_glue.h
rename to src/external/android/native_app_glue/android_native_app_glue.h
index 1b8c1f10..97202e09 100644
--- a/src/external/android_native_app_glue.h
+++ b/src/external/android/native_app_glue/android_native_app_glue.h
@@ -39,7 +39,7 @@ extern "C" {
* risk having the system force-close the application. This programming
* model is direct, lightweight, but constraining.
*
- * The 'threaded_native_app' static library is used to provide a different
+ * The 'android_native_app_glue' static library is used to provide a different
* execution model where the application can implement its own main event
* loop in a different thread instead. Here's how it works:
*