Prechádzať zdrojové kódy

Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop

victorfisac 9 rokov pred
rodič
commit
2a158c4795
100 zmenil súbory, kde vykonal 11119 pridanie a 168 odobranie
  1. 14 2
      .gitignore
  2. 1 0
      README.md
  3. 0 0
      docs/raylib_cheatsheet_v1.0.png
  4. BIN
      docs/raylib_cheatsheet_v1.5.png
  5. 28 4
      examples/Makefile
  6. 29 7
      examples/audio_module_playing.c
  7. 122 0
      examples/audio_module_playing.lua
  8. 32 31
      examples/audio_music_stream.c
  9. 66 0
      examples/audio_music_stream.lua
  10. 111 0
      examples/audio_raw_stream.c
  11. 97 0
      examples/audio_raw_stream.lua
  12. 0 1
      examples/audio_sound_loading.c
  13. 59 0
      examples/audio_sound_loading.lua
  14. 7 4
      examples/audio_standalone.c
  15. 130 0
      examples/core_2d_camera.lua
  16. 3 6
      examples/core_3d_camera_first_person.c
  17. 85 0
      examples/core_3d_camera_first_person.lua
  18. 4 5
      examples/core_3d_camera_free.c
  19. 75 0
      examples/core_3d_camera_free.lua
  20. 64 0
      examples/core_3d_mode.lua
  21. 98 0
      examples/core_3d_picking.lua
  22. 62 0
      examples/core_basic_window.cpp
  23. 44 0
      examples/core_basic_window.lua
  24. 82 0
      examples/core_color_select.lua
  25. 66 0
      examples/core_drop_files.lua
  26. 102 0
      examples/core_gestures_detection.lua
  27. 63 0
      examples/core_input_gamepad.lua
  28. 51 0
      examples/core_input_keys.lua
  29. 54 0
      examples/core_input_mouse.lua
  30. 50 0
      examples/core_mouse_wheel.lua
  31. 73 0
      examples/core_oculus_rift.lua
  32. 56 0
      examples/core_random_values.lua
  33. 74 0
      examples/core_storage_values.lua
  34. 69 0
      examples/core_world_screen.lua
  35. 65 0
      examples/models_billboard.lua
  36. 115 0
      examples/models_box_collisions.lua
  37. 4 6
      examples/models_cubicmap.c
  38. 79 0
      examples/models_cubicmap.lua
  39. 67 0
      examples/models_geometric_shapes.lua
  40. 73 0
      examples/models_heightmap.lua
  41. 67 0
      examples/models_obj_loading.lua
  42. 9 2
      examples/physics_basic_rigidbody.c
  43. 9 3
      examples/physics_forces.c
  44. BIN
      examples/resources/audio/2t2m_spa.xm
  45. BIN
      examples/resources/audio/chiptun1.mod
  46. BIN
      examples/resources/audio/mini1111.xm
  47. 16 14
      examples/resources/shaders/glsl100/bloom.fs
  48. 161 0
      examples/resources/shaders/glsl100/standard.fs
  49. 23 0
      examples/resources/shaders/glsl100/standard.vs
  50. 16 14
      examples/resources/shaders/glsl330/bloom.fs
  51. 150 0
      examples/resources/shaders/glsl330/standard.fs
  52. 23 0
      examples/resources/shaders/glsl330/standard.vs
  53. 90 0
      examples/rlua_execute_file.c
  54. 115 0
      examples/shaders_custom_uniform.lua
  55. 7 10
      examples/shaders_model_shader.c
  56. 85 0
      examples/shaders_model_shader.lua
  57. 101 0
      examples/shaders_postprocessing.lua
  58. 101 0
      examples/shaders_shapes_textures.lua
  59. 114 0
      examples/shaders_standard_lighting.lua
  60. 64 0
      examples/shapes_basic_shapes.lua
  61. 89 0
      examples/shapes_colors_palette.lua
  62. 48 0
      examples/shapes_logo_raylib.lua
  63. 127 0
      examples/shapes_logo_raylib_anim.lua
  64. 59 0
      examples/text_bmfont_ttf.lua
  65. 143 0
      examples/text_font_select.lua
  66. 54 0
      examples/text_format_text.lua
  67. 87 0
      examples/text_rbmf_fonts.lua
  68. 72 0
      examples/text_sprite_fonts.lua
  69. 52 0
      examples/text_writing_anim.lua
  70. 217 0
      examples/textures_formats_loading.lua
  71. 70 0
      examples/textures_image_drawing.lua
  72. 55 0
      examples/textures_image_loading.lua
  73. 134 0
      examples/textures_image_processing.lua
  74. 49 0
      examples/textures_logo_raylib.lua
  75. 113 0
      examples/textures_particles_trail_blending.lua
  76. 83 0
      examples/textures_raw_data.lua
  77. 69 0
      examples/textures_rectangle.lua
  78. 71 0
      examples/textures_srcrec_dstrec.lua
  79. 60 0
      examples/textures_to_image.lua
  80. 297 0
      games/arkanoid.lua
  81. 9 6
      games/drturtle/05_drturtle_audio.c
  82. 10 7
      games/drturtle/06_drturtle_final.c
  83. 11 8
      games/drturtle/drturtle_final_web.c
  84. 11 6
      games/just_do/just_do.c
  85. 15 5
      games/light_my_ritual/light_my_ritual.c
  86. 14 7
      games/light_my_ritual/screens/screen_gameplay.c
  87. 1 4
      games/light_my_ritual/screens/screen_logo_raylib.c
  88. 3 7
      games/makefile
  89. 14 6
      games/raylib_demo/raylib_demo.c
  90. 8 3
      games/skully_escape/skully_escape.c
  91. 97 0
      project/vs2015/examples/core_basic_window.vcxproj
  92. 97 0
      project/vs2015/examples/core_basic_window_cpp.vcxproj
  93. 22 0
      project/vs2015/external/glfw3/COPYING.txt
  94. 4235 0
      project/vs2015/external/glfw3/include/GLFW/glfw3.h
  95. 456 0
      project/vs2015/external/glfw3/include/GLFW/glfw3native.h
  96. BIN
      project/vs2015/external/glfw3/lib/win32/glfw3.dll
  97. BIN
      project/vs2015/external/glfw3/lib/win32/glfw3.lib
  98. BIN
      project/vs2015/external/glfw3/lib/win32/glfw3dll.lib
  99. 256 0
      project/vs2015/external/lua/include/lauxlib.h
  100. 486 0
      project/vs2015/external/lua/include/lua.h

+ 14 - 2
.gitignore

@@ -49,7 +49,7 @@ ipch/
 # Ignore compiled binaries
 *.o
 *.exe
-!tools/rrem.exe
+!tools/rREM/rrem.exe
 
 # Ignore files build by xcode
 *.mode*v*
@@ -75,4 +75,16 @@ src/libraylib.bc
 !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/pthreadGC2.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
+

+ 1 - 0
README.md

@@ -249,6 +249,7 @@ contributing (in some way or another) to make raylib project better. Huge thanks
  - [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:[email protected] "Ramon Santamaria - Ray San"

+ 0 - 0
docs/cheatsheet.png → docs/raylib_cheatsheet_v1.0.png


BIN
docs/raylib_cheatsheet_v1.5.png


+ 28 - 4
examples/Makefile

@@ -77,8 +77,27 @@ 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
+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
@@ -97,7 +116,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
 endif
 
 # define library paths containing required libs
-LFLAGS = -L. -L../src
+LFLAGS = -L. -L../src -L$(RAYLIB_PATH)
 
 ifeq ($(PLATFORM),PLATFORM_RPI)
     LFLAGS += -L/opt/vc/lib
@@ -120,7 +139,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
         # libraries for Debian GNU/Linux desktop compiling
         # requires the following packages:
         # libglfw3-dev libopenal-dev libegl1-mesa-dev
-        LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl
+        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
@@ -210,6 +229,7 @@ EXAMPLES = \
     audio_sound_loading \
     audio_music_stream \
     audio_module_playing \
+    audio_raw_stream \
     fix_dylib \
 
 
@@ -436,10 +456,14 @@ audio_sound_loading: audio_sound_loading.c
 audio_music_stream: audio_music_stream.c
 	$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
 
-# compile [audio] example - module playing (OGG)
+# 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)
+
 # fix dylib install path name for each executable (MAC)
 fix_dylib:
 ifeq ($(PLATFORM_OS),OSX)

+ 29 - 7
examples/audio_module_playing.c

@@ -57,9 +57,12 @@ int main()
     // Create a RenderTexture2D to be used for render to texture
     RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
 
-    PlayMusicStream(0, "resources/audio/2t2m_spa.xm");         // Play module stream
+    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
     //--------------------------------------------------------------------------------------
@@ -69,7 +72,29 @@ int main()
     {
         // Update
         //----------------------------------------------------------------------------------
-        for (int i = MAX_CIRCLES - 1; i >= 0; i--)
+        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;
@@ -86,11 +111,6 @@ int main()
                 circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
             }
         }
-
-        // Get timePlayed scaled to bar dimensions
-        timePlayed = (GetMusicTimePlayed(0)/GetMusicTimeLength(0)*(screenWidth - 40))*2;
-        
-        UpdateMusicStream(0);        // Update music buffer with new stream data
         //----------------------------------------------------------------------------------
 
         // Draw
@@ -129,6 +149,8 @@ int main()
     UnloadShader(shader);           // Unload shader
     UnloadRenderTexture(target);    // Unload render texture
     
+    UnloadMusicStream(xm);          // Unload music stream buffers from RAM
+    
     CloseAudioDevice();     // Close audio device (music streaming is automatically stopped)
 
     CloseWindow();          // Close window and OpenGL context

+ 122 - 0
examples/audio_module_playing.lua

@@ -0,0 +1,122 @@
+-------------------------------------------------------------------------------------------
+--
+--   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
+
+-- Load postprocessing bloom shader
+local shader = LoadShader("resources/shaders/glsl330/base.vs", 
+                          "resources/shaders/glsl330/bloom.fs")
+
+-- Create a RenderTexture2D to be used for render to texture
+local target = LoadRenderTexture(screenWidth, screenHeight)
+
+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(BLACK)
+        
+        BeginTextureMode(target)   -- Enable drawing to texture
+
+            for i = MAX_CIRCLES, 1, -1 do
+                DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha))
+            end
+            
+        EndTextureMode()           -- End drawing to texture (now we have a texture available for next passes)
+        
+        BeginShaderMode(shader)
+
+            -- NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
+            DrawTextureRec(target.texture, Rectangle(0, 0, target.texture.width, -target.texture.height), Vector2(0, 0), WHITE)
+            
+        EndShaderMode()
+
+        -- 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
+-------------------------------------------------------------------------------------------
+UnloadShader(shader)           -- Unload shader
+UnloadRenderTexture(target)    -- Unload render texture
+
+UnloadMusicStream(xm)          -- Unload music stream buffers from RAM
+
+CloseAudioDevice()     -- Close audio device (music streaming is automatically stopped)
+
+CloseWindow()          -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 32 - 31
examples/audio_music_stream.c

@@ -24,11 +24,12 @@ int main()
 
     InitAudioDevice();              // Initialize audio device
 
-    PlayMusicStream(0, "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 volume = 1.0;
+    bool pause = false;
 
     SetTargetFPS(60);               // Set our game to run at 60 frames-per-second
     //--------------------------------------------------------------------------------------
@@ -38,32 +39,26 @@ int main()
     {
         // Update
         //----------------------------------------------------------------------------------
-        framesCounter++;
-
-        // Testing music fading from one file to another
-/*
-        if (framesCounter > 600)    // Wait for 10 seconds (600 frames)
+        UpdateMusicStream(music);        // Update music buffer with new stream data
+        
+        // Restart music playing (stop and play)
+        if (IsKeyPressed(KEY_SPACE)) 
         {
-            volume -= 0.01;         // Decrement music volume level
-
-            // When music volume level equal or lower than 0,
-            // restore volume level and init another music file
-            if (volume <= 0)
-            {
-                volume = 1.0;
-                framesCounter = 0;
-                PlayMusicStream(1, "resources/audio/another_file.ogg");
-            }
-
-            SetMusicVolume(volume);
+            StopMusicStream(music);
+            PlayMusicStream(music);
         }
-*/
-        if (IsWindowMinimized()) PauseMusicStream(0);
-        else ResumeMusicStream(0);
-
-        timePlayed = GetMusicTimePlayed(0)/GetMusicTimeLength(0)*100*4; // We scale by 4 to fit 400 pixels
         
-        UpdateMusicStream(0);        // Update music buffer with new stream data
+        // 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
@@ -72,10 +67,14 @@ int main()
 
             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, 250, (int)timePlayed, 12, MAROON);
+            DrawRectangle(200, 200, 400, 12, LIGHTGRAY);
+            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();
         //----------------------------------------------------------------------------------
@@ -83,9 +82,11 @@ int main()
 
     // De-Initialization
     //--------------------------------------------------------------------------------------
-    CloseAudioDevice();     // Close audio device (music streaming is automatically stopped)
+    UnloadMusicStream(music);   // Unload music stream buffers from RAM
+
+    CloseAudioDevice();         // Close audio device (music streaming is automatically stopped)
 
-    CloseWindow();          // Close window and OpenGL context
+    CloseWindow();              // Close window and OpenGL context
     //--------------------------------------------------------------------------------------
 
     return 0;

+ 66 - 0
examples/audio_music_stream.lua

@@ -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 - 0
examples/audio_raw_stream.c

@@ -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;
+}

+ 97 - 0
examples/audio_raw_stream.lua

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

+ 0 - 1
examples/audio_sound_loading.c

@@ -36,7 +36,6 @@ int main()
         // Update
         //----------------------------------------------------------------------------------
         if (IsKeyPressed(KEY_SPACE)) PlaySound(fxWav);      // Play WAV sound
-
         if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg);      // Play OGG sound
         //----------------------------------------------------------------------------------
 

+ 59 - 0
examples/audio_sound_loading.lua

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

+ 7 - 4
examples/audio_standalone.c

@@ -39,7 +39,8 @@ int main()
     Sound fxWav = LoadSound("resources/audio/weird.wav");         // Load WAV audio file
     Sound fxOgg = LoadSound("resources/audio/tanatana.ogg");      // Load OGG audio file
     
-    PlayMusicStream(0, "resources/audio/guitar_noodling.ogg");
+    Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
+    PlayMusicStream(music);
 
     printf("\nPress s or d to play sounds...\n");
     
@@ -59,11 +60,13 @@ int main()
             key = 0;
         }
         
-        UpdateMusicStream(0);
+        UpdateMusicStream(music);
     }
     
-    UnloadSound(fxWav);     // Unload sound data
-    UnloadSound(fxOgg);     // Unload sound data
+    UnloadSound(fxWav);         // Unload sound data
+    UnloadSound(fxOgg);         // Unload sound data
+    
+    UnloadMusicStream(music);   // Unload music stream data
     
     CloseAudioDevice();
     

+ 130 - 0
examples/core_2d_camera.lua

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

+ 3 - 6
examples/core_3d_camera_first_person.c

@@ -23,7 +23,7 @@ int main()
     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
     
     // Define the camera to look into our 3d world (position, target, up vector)
-    Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
+    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];
@@ -37,10 +37,7 @@ int main()
         colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
     }
     
-    Vector3 playerPosition = { 4.0f, 2.0f, 4.0f };       // Define player position
-    
-    SetCameraMode(CAMERA_FIRST_PERSON);         // Set a first person camera mode
-    SetCameraFovy(camera.fovy);                 // Set internal camera field-of-view Y
+    SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
 
     SetTargetFPS(60);                           // Set our game to run at 60 frames-per-second
     //--------------------------------------------------------------------------------------
@@ -50,7 +47,7 @@ int main()
     {
         // Update
         //----------------------------------------------------------------------------------
-        UpdateCameraPlayer(&camera, &playerPosition); // Update camera and player position
+        UpdateCamera(&camera);                  // Update camera and player position
         //----------------------------------------------------------------------------------
 
         // Draw

+ 85 - 0
examples/core_3d_camera_first_person.lua

@@ -0,0 +1,85 @@
+--------------------------------------------------------------------------------------------
+--
+--  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(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 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(CameraMode.FIRST_PERSON)         -- Set a first person camera mode
+SetCameraFovy(camera.fovy)                 -- Set internal camera field-of-view Y
+
+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, playerPosition = UpdateCameraPlayer(camera, playerPosition) -- Update camera and player position
+    ---------------------------------------------------------------------------------------
+
+    -- 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
+-------------------------------------------------------------------------------------------

+ 4 - 5
examples/core_3d_camera_free.c

@@ -22,17 +22,14 @@ int main()
 
     // Define the camera to look into our 3d world
     Camera camera;
-    camera.position = (Vector3){ 0.0f, 10.0f, 10.0f };  // Camera position
+    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_FREE);         // Set a free camera mode
-    SetCameraPosition(camera.position); // Set internal camera position to match our camera position
-    SetCameraTarget(camera.target);     // Set internal camera target to match our camera target
-    SetCameraFovy(camera.fovy);         // Set internal camera field-of-view Y
+    SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
 
     SetTargetFPS(60);                   // Set our game to run at 60 frames-per-second
     //--------------------------------------------------------------------------------------
@@ -43,6 +40,8 @@ int main()
         // Update
         //----------------------------------------------------------------------------------
         UpdateCamera(&camera);          // Update internal camera and our camera
+        
+        if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
         //----------------------------------------------------------------------------------
 
         // Draw

+ 75 - 0
examples/core_3d_camera_free.lua

@@ -0,0 +1,75 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(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)
+
+SetCameraMode(CameraMode.FREE)         -- Set a free camera mode
+SetCameraPosition(camera.position) -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)     -- Set internal camera target to match our camera target
+SetCameraFovy(camera.fovy)         -- Set internal camera field-of-view Y
+
+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 internal camera and our 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
+-------------------------------------------------------------------------------------------

+ 64 - 0
examples/core_3d_mode.lua

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

+ 98 - 0
examples/core_3d_picking.lua

@@ -0,0 +1,98 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(CameraMode.FREE)         -- Set a free camera mode
+SetCameraPosition(camera.position) -- Set internal camera position to match our camera position
+SetCameraFovy(camera.fovy)         -- Set internal camera field-of-view Y
+
+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 internal camera and our 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
+-------------------------------------------------------------------------------------------

+ 62 - 0
examples/core_basic_window.cpp

@@ -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;
+}

+ 44 - 0
examples/core_basic_window.lua

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

+ 82 - 0
examples/core_color_select.lua

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

+ 66 - 0
examples/core_drop_files.lua

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

+ 102 - 0
examples/core_gestures_detection.lua

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

+ 63 - 0
examples/core_input_gamepad.lua

@@ -0,0 +1,63 @@
+-------------------------------------------------------------------------------------------
+--
+--  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 ballPosition = Vector2(screenWidth/2, screenHeight/2)
+local gamepadMovement = Vector2(0, 0)
+
+SetTargetFPS(60)                   -- Set target frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do    -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    if (IsGamepadAvailable(GAMEPAD.PLAYER1)) then
+        gamepadMovement.x = GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_X)
+        gamepadMovement.y = GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_Y)
+
+        ballPosition.x = ballPosition.x + gamepadMovement.x
+        ballPosition.y = ballPosition.y - gamepadMovement.y
+
+        if (IsGamepadButtonPressed(GAMEPAD.PLAYER1, GAMEPAD.BUTTON_A)) then
+            ballPosition.x = screenWidth/2
+            ballPosition.y = screenHeight/2
+        end
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY)
+
+        DrawCircleV(ballPosition, 50, MAROON)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 51 - 0
examples/core_input_keys.lua

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

+ 54 - 0
examples/core_input_mouse.lua

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

+ 50 - 0
examples/core_mouse_wheel.lua

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

+ 73 - 0
examples/core_oculus_rift.lua

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

+ 56 - 0
examples/core_random_values.lua

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

+ 74 - 0
examples/core_storage_values.lua

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

+ 69 - 0
examples/core_world_screen.lua

@@ -0,0 +1,69 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(CameraMode.FREE)          -- Set a free camera mode
+SetCameraPosition(camera.position)      -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)          -- Set internal camera target to match our camera target
+SetCameraFovy(camera.fovy)              -- Set internal camera field-of-view Y
+
+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 internal camera and our 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
+----------------------------------------------------------------------------------------

+ 65 - 0
examples/models_billboard.lua

@@ -0,0 +1,65 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(CameraMode.ORBITAL)      -- Set an orbital camera mode
+SetCameraPosition(camera.position) -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)     -- Set internal camera target to match our camera target
+SetCameraFovy(camera.fovy)         -- Set internal camera field-of-view Y
+
+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 internal camera and our 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
+-------------------------------------------------------------------------------------------

+ 115 - 0
examples/models_box_collisions.lua

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

+ 4 - 6
examples/models_cubicmap.c

@@ -35,19 +35,17 @@ int main()
 
     UnloadImage(image);     // Unload cubesmap image from RAM, already uploaded to VRAM
     
-    SetCameraMode(CAMERA_ORBITAL);      // Set an orbital camera mode
-    SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
-    SetCameraFovy(camera.fovy);         // Set internal camera field-of-view Y
+    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
-    while (!WindowShouldClose())        // Detect window close button or ESC key
+    while (!WindowShouldClose())            // Detect window close button or ESC key
     {
         // Update
         //----------------------------------------------------------------------------------
-        UpdateCamera(&camera);          // Update internal camera and our camera
+        UpdateCamera(&camera);              // Update internal camera and our camera
         //----------------------------------------------------------------------------------
 
         // Draw

+ 79 - 0
examples/models_cubicmap.lua

@@ -0,0 +1,79 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(CameraMode.ORBITAL)      -- Set an orbital camera mode
+SetCameraPosition(camera.position)     -- Set internal camera position to match our custom camera position
+SetCameraFovy(camera.fovy)             -- Set internal camera field-of-view Y
+
+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 internal camera and our 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
+-------------------------------------------------------------------------------------------

+ 67 - 0
examples/models_geometric_shapes.lua

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

+ 73 - 0
examples/models_heightmap.lua

@@ -0,0 +1,73 @@
+-------------------------------------------------------------------------------------------
+--
+--  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(CameraMode.ORBITAL)      -- Set an orbital camera mode
+SetCameraPosition(camera.position) -- Set internal camera position to match our custom camera position
+
+SetTargetFPS(60)                   -- Set our game to run at 60 frames-per-second
+----------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    camera = UpdateCamera(camera)           -- Update internal camera and our camera
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        Begin3dMode(camera)
+
+            -- NOTE: Model is scaled to 1/4 of its original size (128x128 units)
+            DrawModel(map, mapPosition, 1.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
+-------------------------------------------------------------------------------------------

+ 67 - 0
examples/models_obj_loading.lua

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

+ 9 - 2
examples/physics_basic_rigidbody.c

@@ -5,9 +5,16 @@
 *   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)
 *
+*   NOTE:
+*   Physac requires multi-threading, when InitPhysics() a second thread is created to manage
+*   physics calculations. To accomplish that, physac uses pthread Win32 library that can be
+*   found inside raylib/src/external/pthread directory. 
 *
-*   Compile example using:
-*   cmd /c IF NOT EXIST pthreadGC2.dll copy C:\raylib\raylib\src\external\pthread\pthreadGC2.dll $(CURRENT_DIRECTORY) /Y
+*   Add pthread library when compiling physac example:
+*   gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon -L../src/external/pthread/lib \
+*   -I../src -I../src/external/pthread/include -lraylib -lglfw3 -lopengl32 -lgdi32 -lpthreadGC2 -std=c99 -Wall
+*
+*   Note that pthreadGC2.dll must be also copied to project directory!
 *
 *   Copyright (c) 2016 Victor Fisac and Ramon Santamaria (@raysan5)
 *

+ 9 - 3
examples/physics_forces.c

@@ -5,10 +5,16 @@
 *   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)
 *
-*   NOTE: This example requires raylib module [rlgl]
+*   NOTE:
+*   Physac requires multi-threading, when InitPhysics() a second thread is created to manage
+*   physics calculations. To accomplish that, physac uses pthread Win32 library that can be
+*   found inside raylib/src/external/pthread directory. 
 *
-*   Compile example using:
-*   cmd /c IF NOT EXIST pthreadGC2.dll copy C:\raylib\raylib\src\external\pthread\pthreadGC2.dll $(CURRENT_DIRECTORY) /Y
+*   Add pthread library when compiling physac example:
+*   gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon -L../src/external/pthread/lib \
+*   -I../src -I../src/external/pthread/include -lraylib -lglfw3 -lopengl32 -lgdi32 -lpthreadGC2 -std=c99 -Wall
+*
+*   Note that pthreadGC2.dll must be also copied to project directory!
 *
 *   Copyright (c) 2016 Victor Fisac and Ramon Santamaria (@raysan5)
 *

BIN
examples/resources/audio/2t2m_spa.xm


BIN
examples/resources/audio/chiptun1.mod


BIN
examples/resources/audio/mini1111.xm


+ 16 - 14
examples/resources/shaders/glsl100/bloom.fs

@@ -8,30 +8,32 @@ varying vec4 fragColor;
 
 // Input uniform values
 uniform sampler2D texture0;
-uniform vec4 fragTintColor;
+uniform vec4 colDiffuse;
 
 // NOTE: Add here your custom variables
 
+const vec2 size = vec2(800, 450);   // render size
+const float samples = 5.0;          // pixels per axis; higher = bigger glow, worse performance
+const float quality = 2.5; 	        // lower = smaller glow, better quality
+
 void main()
 {
     vec4 sum = vec4(0);
-    vec4 tc = vec4(0);
+    vec2 sizeFactor = vec2(1)/size*quality;
+
+    // Texel color fetching from texture sampler
+    vec4 source = texture2D(texture0, fragTexCoord);
 
-    for (int i = -4; i < 4; i++)
+    const int range = 2;            // should be = (samples - 1)/2;
+
+    for (int x = -range; x <= range; x++)
     {
-        for (int j = -3; j < 3; j++)
+        for (int y = -range; y <= range; y++)
         {
-            sum += texture2D(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25;
+            sum += texture2D(texture0, fragTexCoord + vec2(x, y)*sizeFactor);
         }
     }
-    
-    // Texel color fetching from texture sampler
-    vec4 texelColor = texture2D(texture0, fragTexCoord);
-    
+
     // Calculate final fragment color
-    if (texelColor.r < 0.3) tc = sum*sum*0.012 + texelColor;
-    else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor;
-    else tc = sum*sum*0.0075 + texelColor;
-    
-    gl_FragColor = tc;
+    gl_FragColor = ((sum/(samples*samples)) + source)*colDiffuse;
 }

+ 161 - 0
examples/resources/shaders/glsl100/standard.fs

@@ -0,0 +1,161 @@
+#version 100
+
+precision mediump float;
+
+varying vec3 fragPosition;
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+varying vec3 fragNormal;
+
+uniform sampler2D texture0;
+uniform sampler2D texture1;
+uniform sampler2D texture2;
+
+uniform vec4 colAmbient;
+uniform vec4 colDiffuse;
+uniform vec4 colSpecular;
+uniform float glossiness;
+
+uniform int useNormal;
+uniform int useSpecular;
+
+uniform mat4 modelMatrix;
+uniform vec3 viewDir;
+
+struct Light {
+    int enabled;
+    int type;
+    vec3 position;
+    vec3 direction;
+    vec4 diffuse;
+    float intensity;
+    float radius;
+    float coneAngle;
+};
+
+const int maxLights = 8;
+uniform Light lights[maxLights];
+
+vec3 ComputeLightPoint(Light l, vec3 n, vec3 v, float s)
+{
+/*
+    vec3 surfacePos = vec3(modelMatrix*vec4(fragPosition, 1.0));
+    vec3 surfaceToLight = l.position - surfacePos;
+    
+    // Diffuse shading
+    float brightness = clamp(float(dot(n, surfaceToLight)/(length(surfaceToLight)*length(n))), 0.0, 1.0);
+    float diff = 1.0/dot(surfaceToLight/l.radius, surfaceToLight/l.radius)*brightness*l.intensity;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diff > 0.0)
+    {
+        vec3 h = normalize(-l.direction + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    return (diff*l.diffuse.rgb + spec*colSpecular.rgb);
+*/
+    return vec3(0.5);
+}
+
+vec3 ComputeLightDirectional(Light l, vec3 n, vec3 v, float s)
+{
+/*
+    vec3 lightDir = normalize(-l.direction);
+    
+    // Diffuse shading
+    float diff = clamp(float(dot(n, lightDir)), 0.0, 1.0)*l.intensity;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diff > 0.0)
+    {
+        vec3 h = normalize(lightDir + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    // Combine results
+    return (diff*l.intensity*l.diffuse.rgb + spec*colSpecular.rgb);
+*/
+    return vec3(0.5);
+}
+
+vec3 ComputeLightSpot(Light l, vec3 n, vec3 v, float s)
+{
+/*
+    vec3 surfacePos = vec3(modelMatrix*vec4(fragPosition, 1));
+    vec3 lightToSurface = normalize(surfacePos - l.position);
+    vec3 lightDir = normalize(-l.direction);
+    
+    // Diffuse shading
+    float diff = clamp(float(dot(n, lightDir)), 0.0, 1.0)*l.intensity;
+    
+    // Spot attenuation
+    float attenuation = clamp(float(dot(n, lightToSurface)), 0.0, 1.0);
+    attenuation = dot(lightToSurface, -lightDir);
+    
+    float lightToSurfaceAngle = degrees(acos(attenuation));
+    if (lightToSurfaceAngle > l.coneAngle) attenuation = 0.0;
+    
+    float falloff = (l.coneAngle - lightToSurfaceAngle)/l.coneAngle;
+    
+    // Combine diffuse and attenuation
+    float diffAttenuation = diff*attenuation;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diffAttenuation > 0.0)
+    {
+        vec3 h = normalize(lightDir + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    return (falloff*(diffAttenuation*l.diffuse.rgb + spec*colSpecular.rgb));
+*/
+    return vec3(0.5);
+}
+
+void main()
+{
+    // Calculate fragment normal in screen space
+    // NOTE: important to multiply model matrix by fragment normal to apply model transformation (rotation and scale)
+    mat3 normalMatrix = mat3(modelMatrix);
+    vec3 normal = normalize(normalMatrix*fragNormal);
+
+    // Normalize normal and view direction vectors
+    vec3 n = normalize(normal);
+    vec3 v = normalize(viewDir);
+
+    // Calculate diffuse texture color fetching
+    vec4 texelColor = texture2D(texture0, fragTexCoord);
+    vec3 lighting = colAmbient.rgb;
+    
+    // Calculate normal texture color fetching or set to maximum normal value by default
+    if (useNormal == 1)
+    {
+        n *= texture2D(texture1, fragTexCoord).rgb;
+        n = normalize(n);
+    }
+    
+    // Calculate specular texture color fetching or set to maximum specular value by default
+    float spec = 1.0;
+    if (useSpecular == 1) spec *= normalize(texture2D(texture2, fragTexCoord).r);
+    
+    for (int i = 0; i < maxLights; i++)
+    {
+        // Check if light is enabled
+        if (lights[i].enabled == 1)
+        {
+            // Calculate lighting based on light type
+            if(lights[i].type == 0) lighting += ComputeLightPoint(lights[i], n, v, spec);
+            else if(lights[i].type == 1) lighting += ComputeLightDirectional(lights[i], n, v, spec);
+            else if(lights[i].type == 2) lighting += ComputeLightSpot(lights[i], n, v, spec);
+            
+            // NOTE: It seems that too many ComputeLight*() operations inside for loop breaks the shader on RPI
+        }
+    }
+    
+    // Calculate final fragment color
+    gl_FragColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a);
+}

+ 23 - 0
examples/resources/shaders/glsl100/standard.vs

@@ -0,0 +1,23 @@
+#version 100
+
+attribute vec3 vertexPosition;
+attribute vec3 vertexNormal;
+attribute vec2 vertexTexCoord;
+attribute vec4 vertexColor;
+
+varying vec3 fragPosition;
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+varying vec3 fragNormal;
+
+uniform mat4 mvpMatrix;
+
+void main()
+{
+    fragPosition = vertexPosition;
+    fragTexCoord = vertexTexCoord;
+    fragColor = vertexColor;
+    fragNormal = vertexNormal;
+
+    gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
+}

+ 16 - 14
examples/resources/shaders/glsl330/bloom.fs

@@ -6,33 +6,35 @@ in vec4 fragColor;
 
 // Input uniform values
 uniform sampler2D texture0;
-uniform vec4 fragTintColor;
+uniform vec4 colDiffuse;
 
 // Output fragment color
 out vec4 finalColor;
 
 // NOTE: Add here your custom variables
 
+const vec2 size = vec2(800, 450);   // render size
+const float samples = 5.0;          // pixels per axis; higher = bigger glow, worse performance
+const float quality = 2.5; 	        // lower = smaller glow, better quality
+
 void main()
 {
     vec4 sum = vec4(0);
-    vec4 tc = vec4(0);
+    vec2 sizeFactor = vec2(1)/size*quality;
+
+    // Texel color fetching from texture sampler
+    vec4 source = texture(texture0, fragTexCoord);
+
+    const int range = 2;            // should be = (samples - 1)/2;
 
-    for (int i = -4; i < 4; i++)
+    for (int x = -range; x <= range; x++)
     {
-        for (int j = -3; j < 3; j++)
+        for (int y = -range; y <= range; y++)
         {
-            sum += texture(texture0, fragTexCoord + vec2(j, i)*0.004)*0.25;
+            sum += texture(texture0, fragTexCoord + vec2(x, y)*sizeFactor);
         }
     }
-    
-    // Texel color fetching from texture sampler
-    vec4 texelColor = texture(texture0, fragTexCoord);
-    
-    // Calculate final fragment color
-    if (texelColor.r < 0.3) tc = sum*sum*0.012 + texelColor;
-    else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor;
-    else tc = sum*sum*0.0075 + texelColor;
 
-    finalColor = tc;
+    // Calculate final fragment color
+    finalColor = ((sum/(samples*samples)) + source)*colDiffuse;
 }

+ 150 - 0
examples/resources/shaders/glsl330/standard.fs

@@ -0,0 +1,150 @@
+#version 330
+
+in vec3 fragPosition;
+in vec2 fragTexCoord;
+in vec4 fragColor;
+in vec3 fragNormal;
+
+out vec4 finalColor;
+
+uniform sampler2D texture0;
+uniform sampler2D texture1;
+uniform sampler2D texture2;
+
+uniform vec4 colAmbient;
+uniform vec4 colDiffuse;
+uniform vec4 colSpecular;
+uniform float glossiness;
+
+uniform int useNormal;
+uniform int useSpecular;
+
+uniform mat4 modelMatrix;
+uniform vec3 viewDir;
+
+struct Light {
+    int enabled;
+    int type;
+    vec3 position;
+    vec3 direction;
+    vec4 diffuse;
+    float intensity;
+    float radius;
+    float coneAngle;
+};
+
+const int maxLights = 8;
+uniform Light lights[maxLights];
+
+vec3 ComputeLightPoint(Light l, vec3 n, vec3 v, float s)
+{
+    vec3 surfacePos = vec3(modelMatrix*vec4(fragPosition, 1));
+    vec3 surfaceToLight = l.position - surfacePos;
+    
+    // Diffuse shading
+    float brightness = clamp(float(dot(n, surfaceToLight)/(length(surfaceToLight)*length(n))), 0.0, 1.0);
+    float diff = 1.0/dot(surfaceToLight/l.radius, surfaceToLight/l.radius)*brightness*l.intensity;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diff > 0.0)
+    {
+        vec3 h = normalize(-l.direction + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    return (diff*l.diffuse.rgb + spec*colSpecular.rgb);
+}
+
+vec3 ComputeLightDirectional(Light l, vec3 n, vec3 v, float s)
+{
+    vec3 lightDir = normalize(-l.direction);
+    
+    // Diffuse shading
+    float diff = clamp(float(dot(n, lightDir)), 0.0, 1.0)*l.intensity;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diff > 0.0)
+    {
+        vec3 h = normalize(lightDir + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    // Combine results
+    return (diff*l.intensity*l.diffuse.rgb + spec*colSpecular.rgb);
+}
+
+vec3 ComputeLightSpot(Light l, vec3 n, vec3 v, float s)
+{
+    vec3 surfacePos = vec3(modelMatrix*vec4(fragPosition, 1));
+    vec3 lightToSurface = normalize(surfacePos - l.position);
+    vec3 lightDir = normalize(-l.direction);
+    
+    // Diffuse shading
+    float diff = clamp(float(dot(n, lightDir)), 0.0, 1.0)*l.intensity;
+    
+    // Spot attenuation
+    float attenuation = clamp(float(dot(n, lightToSurface)), 0.0, 1.0);
+    attenuation = dot(lightToSurface, -lightDir);
+    
+    float lightToSurfaceAngle = degrees(acos(attenuation));
+    if (lightToSurfaceAngle > l.coneAngle) attenuation = 0.0;
+    
+    float falloff = (l.coneAngle - lightToSurfaceAngle)/l.coneAngle;
+    
+    // Combine diffuse and attenuation
+    float diffAttenuation = diff*attenuation;
+    
+    // Specular shading
+    float spec = 0.0;
+    if (diffAttenuation > 0.0)
+    {
+        vec3 h = normalize(lightDir + v);
+        spec = pow(dot(n, h), 3.0 + glossiness)*s;
+    }
+    
+    return (falloff*(diffAttenuation*l.diffuse.rgb + spec*colSpecular.rgb));
+}
+
+void main()
+{
+    // Calculate fragment normal in screen space
+    // NOTE: important to multiply model matrix by fragment normal to apply model transformation (rotation and scale)
+    mat3 normalMatrix = mat3(modelMatrix);
+    vec3 normal = normalize(normalMatrix*fragNormal);
+
+    // Normalize normal and view direction vectors
+    vec3 n = normalize(normal);
+    vec3 v = normalize(viewDir);
+
+    // Calculate diffuse texture color fetching
+    vec4 texelColor = texture(texture0, fragTexCoord);
+    vec3 lighting = colAmbient.rgb;
+    
+    // Calculate normal texture color fetching or set to maximum normal value by default
+    if (useNormal == 1)
+    {
+        n *= texture(texture1, fragTexCoord).rgb;
+        n = normalize(n);
+    }
+    
+    // Calculate specular texture color fetching or set to maximum specular value by default
+    float spec = 1.0;
+    if (useSpecular == 1) spec *= normalize(texture(texture2, fragTexCoord).r);
+    
+    for (int i = 0; i < maxLights; i++)
+    {
+        // Check if light is enabled
+        if (lights[i].enabled == 1)
+        {
+            // Calculate lighting based on light type
+            if (lights[i].type == 0) lighting += ComputeLightPoint(lights[i], n, v, spec);
+            else if (lights[i].type == 1) lighting += ComputeLightDirectional(lights[i], n, v, spec);
+            else if (lights[i].type == 2) lighting += ComputeLightSpot(lights[i], n, v, spec);
+        }
+    }
+    
+    // Calculate final fragment color
+    finalColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a);
+}

+ 23 - 0
examples/resources/shaders/glsl330/standard.vs

@@ -0,0 +1,23 @@
+#version 330 
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+in vec2 vertexTexCoord;
+in vec4 vertexColor;
+
+out vec3 fragPosition;
+out vec2 fragTexCoord;
+out vec4 fragColor;
+out vec3 fragNormal;
+
+uniform mat4 mvpMatrix;
+
+void main()
+{
+    fragPosition = vertexPosition;
+    fragTexCoord = vertexTexCoord;
+    fragColor = vertexColor;
+    fragNormal = vertexNormal;
+
+    gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
+}

+ 90 - 0
examples/rlua_execute_file.c

@@ -0,0 +1,90 @@
+/*******************************************************************************************
+*
+*   raylib [rlua] example - Lua file execution
+*
+*   NOTE: This example requires Lua library (http://luabinaries.sourceforge.net/download.html)
+*
+*   Compile example using:
+*   gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon          /
+*       -I../src -I../src/external/lua/include -L../src/external/lua/lib    /
+*       -lraylib -lglfw3 -lopengl32 -lopenal32 -llua53 -lgdi32 -std=c99
+*
+*   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) 2013-2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+#define RLUA_IMPLEMENTATION
+#include "rlua.h"
+
+int main()
+{
+    // Initialization
+    //--------------------------------------------------------------------------------------
+    InitLuaDevice();
+    //--------------------------------------------------------------------------------------
+
+    // ExecuteLuaFile("core_basic_window.lua");                 // OK!
+    // ExecuteLuaFile("core_input_keys.lua");                   // OK!
+    // ExecuteLuaFile("core_input_mouse.lua");                  // OK!
+    // ExecuteLuaFile("core_mouse_wheel.lua");                  // OK!
+    // ExecuteLuaFile("core_input_gamepad.lua");                // OK!
+    // ExecuteLuaFile("core_random_values.lua");                // OK!
+    // ExecuteLuaFile("core_color_select.lua");                 // OK!
+    // ExecuteLuaFile("core_drop_files.lua");                   // OK!
+    // ExecuteLuaFile("core_storage_values.lua");               // OK!
+    // ExecuteLuaFile("core_gestures_detection.lua");           // OK!
+    // ExecuteLuaFile("core_3d_mode.lua");                      // OK!
+    // ExecuteLuaFile("core_3d_picking.lua");                   // OK!
+    // ExecuteLuaFile("core_3d_camera_free.lua");               // OK!
+    // ExecuteLuaFile("core_3d_camera_first_person.lua");       // OK!
+    // ExecuteLuaFile("core_2d_camera.lua");                    // OK!
+    // ExecuteLuaFile("core_world_screen.lua");                 // OK!
+    // ExecuteLuaFile("core_oculus_rift.lua");                  // OK!
+    // ExecuteLuaFile("shapes_logo_raylib.lua");                // OK!
+    // ExecuteLuaFile("shapes_basic_shapes.lua");               // OK!
+    // ExecuteLuaFile("shapes_colors_palette.lua");             // OK!
+    // ExecuteLuaFile("shapes_logo_raylib_anim.lua");           // OK! NOTE: Use lua string.sub() instead of raylib SubText()
+    // ExecuteLuaFile("textures_logo_raylib.lua");              // OK!
+    // ExecuteLuaFile("textures_image_loading.lua");            // OK!
+    // ExecuteLuaFile("textures_rectangle.lua");                // OK!
+    // ExecuteLuaFile("textures_srcrec_dstrec.lua");            // OK!
+    // ExecuteLuaFile("textures_to_image.lua");                 // OK!
+    // ExecuteLuaFile("textures_raw_data.lua");                 // ERROR: LoadImageEx()
+    // ExecuteLuaFile("textures_formats_loading.lua");          // OK!
+    // ExecuteLuaFile("textures_particles_trail_blending.lua"); // OK!
+    // ExecuteLuaFile("textures_image_processing.lua");         // ERROR: GetImageData() --> UpdateTexture()
+    // ExecuteLuaFile("textures_image_drawing.lua");            // OK!
+    // ExecuteLuaFile("text_sprite_fonts.lua");                 // OK!
+    // ExecuteLuaFile("text_bmfont_ttf.lua");                   // OK!
+    // ExecuteLuaFile("text_rbmf_fonts.lua");                   // OK!
+    // ExecuteLuaFile("text_format_text.lua");                  // OK! NOTE: Use lua string.format() instead of raylib FormatText()
+    // ExecuteLuaFile("text_font_select.lua");                  // OK!
+    // ExecuteLuaFile("text_writing_anim.lua");                 // OK!
+    // ExecuteLuaFile("models_geometric_shapes.lua");           // OK!
+    // ExecuteLuaFile("models_box_collisions.lua");             // OK!
+    // ExecuteLuaFile("models_billboard.lua");                  // OK!
+    // ExecuteLuaFile("models_obj_loading.lua");                // OK!
+    // ExecuteLuaFile("models_heightmap.lua");                  // OK!
+    // ExecuteLuaFile("models_cubicmap.lua");                   // OK!
+    // ExecuteLuaFile("shaders_model_shader.lua");              // OK!
+    // ExecuteLuaFile("shaders_shapes_textures.lua");           // OK!
+    // ExecuteLuaFile("shaders_custom_uniform.lua");            // OK!
+    // ExecuteLuaFile("shaders_postprocessing.lua");            // OK!
+    // ExecuteLuaFile("shaders_standard_lighting.lua");         // OK!
+    // ExecuteLuaFile("audio_sound_loading.lua");               // OK!
+    // ExecuteLuaFile("audio_music_stream.lua");                // OK!
+    // ExecuteLuaFile("audio_module_playing.lua");              // OK!
+    // ExecuteLuaFile("audio_raw_stream.lua");                  // ERROR: UpdateAudioStream()
+
+    // De-Initialization
+    //--------------------------------------------------------------------------------------
+    CloseLuaDevice();        // Close Lua device and free resources
+    //--------------------------------------------------------------------------------------
+
+    return 0;
+}

+ 115 - 0
examples/shaders_custom_uniform.lua

@@ -0,0 +1,115 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shaders] example - Apply a postprocessing shader and connect a custom uniform variable
+--
+--  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
+--        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
+--
+--  NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
+--        on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
+--        raylib comes with shaders ready for both versions, check raylib/shaders install folder
+--
+--  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
+
+SetConfigFlags(FLAG.MSAA_4X_HINT)      -- Enable Multi Sampling Anti Aliasing 4x (if available)
+
+InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable")
+
+-- 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 (diffuse map)
+dwarf.material.texDiffuse = texture                                    -- Set dwarf model diffuse texture
+
+local position = Vector3(0.0, 0.0, 0.0)                                -- Set model position
+
+local shader = LoadShader("resources/shaders/glsl330/base.vs", 
+                          "resources/shaders/glsl330/swirl.fs")        -- Load postpro shader
+
+-- Get variable (uniform) location on the shader to connect with the program
+-- NOTE: If uniform variable could not be found in the shader, function returns -1
+local swirlCenterLoc = GetShaderLocation(shader, "center")
+
+local swirlCenter = { screenWidth/2, screenHeight/2 }
+
+-- Create a RenderTexture2D to be used for render to texture
+local target = LoadRenderTexture(screenWidth, screenHeight)
+
+-- Setup orbital camera
+SetCameraMode(CameraMode.ORBITAL)          -- Set an orbital camera mode
+SetCameraPosition(camera.position)     -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)         -- Set internal camera target to match our camera target
+
+SetTargetFPS(60)                       -- Set our game to run at 60 frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do       -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    local mousePosition = GetMousePosition()
+
+    swirlCenter[1] = mousePosition.x
+    swirlCenter[2] = screenHeight - mousePosition.y
+
+    -- Send new value to the shader to be used on drawing
+    SetShaderValue(shader, swirlCenterLoc, swirlCenter)
+    
+    camera = UpdateCamera(camera)      -- Update internal camera and our camera
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+        
+        BeginTextureMode(target)       -- Enable drawing to texture
+
+            Begin3dMode(camera)
+
+                DrawModel(dwarf, position, 2.0, WHITE)   -- Draw 3d model with texture
+
+                DrawGrid(10, 1.0)     -- Draw a grid
+
+            End3dMode()
+            
+            DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED)
+        
+        EndTextureMode()           -- End drawing to texture (now we have a texture available for next passes)
+        
+        BeginShaderMode(shader)
+        
+            -- NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
+            DrawTextureRec(target.texture, Rectangle(0, 0, target.texture.width, -target.texture.height), Vector2(0, 0), WHITE)
+        
+        EndShaderMode()
+        
+        DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
+
+        DrawFPS(10, 10)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadShader(shader)           -- Unload shader
+UnloadTexture(texture)         -- Unload texture
+UnloadModel(dwarf)             -- Unload model
+UnloadRenderTexture(target)    -- Unload render texture
+
+CloseWindow()                  -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 7 - 10
examples/shaders_model_shader.c

@@ -37,25 +37,22 @@ int main()
     Shader shader = LoadShader("resources/shaders/glsl330/base.vs", 
                                "resources/shaders/glsl330/grayscale.fs");   // Load model shader
 
-    dwarf.material.shader = shader;            // Set shader effect to 3d model
-    dwarf.material.texDiffuse = texture;       // Bind texture to model
+    dwarf.material.shader = shader;             // Set shader effect to 3d model
+    dwarf.material.texDiffuse = texture;        // Bind texture to model
     
-    Vector3 position = { 0.0f, 0.0f, 0.0f };   // Set model position
+    Vector3 position = { 0.0f, 0.0f, 0.0f };    // Set model position
     
-    // Setup orbital camera
-    SetCameraMode(CAMERA_ORBITAL);          // Set an orbital camera mode
-    SetCameraPosition(camera.position);     // Set internal camera position to match our camera position
-    SetCameraTarget(camera.target);         // Set internal camera target to match our camera target
+    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
-    while (!WindowShouldClose())            // Detect window close button or ESC key
+    while (!WindowShouldClose())                // Detect window close button or ESC key
     {
         // Update
         //----------------------------------------------------------------------------------
-        UpdateCamera(&camera);              // Update internal camera and our camera
+        UpdateCamera(&camera);                  // Update internal camera and our camera
         //----------------------------------------------------------------------------------
 
         // Draw

+ 85 - 0
examples/shaders_model_shader.lua

@@ -0,0 +1,85 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shaders] example - Apply a shader to a 3d model
+--
+--  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
+--        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
+--
+--  NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
+--        on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
+--        raylib comes with shaders ready for both versions, check raylib/shaders install folder
+--
+--  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
+
+SetConfigFlags(FLAG.MSAA_4X_HINT)      -- Enable Multi Sampling Anti Aliasing 4x (if available)
+
+InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
+
+-- 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
+local shader = LoadShader("resources/shaders/glsl330/base.vs", 
+                          "resources/shaders/glsl330/grayscale.fs")    -- Load model shader
+
+dwarf.material.shader = shader            -- Set shader effect to 3d model
+dwarf.material.texDiffuse = texture       -- Bind texture to model
+
+local position = Vector3(0.0, 0.0, 0.0)   -- Set model position
+
+-- Setup orbital camera
+SetCameraMode(CameraMode.ORBITAL)             -- Set an orbital camera mode
+SetCameraPosition(camera.position)        -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)            -- Set internal camera target to match our camera target
+
+SetTargetFPS(60)                          -- Set our game to run at 60 frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do          -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    camera = UpdateCamera(camera)         -- Update internal camera and our camera
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        Begin3dMode(camera)
+
+            DrawModel(dwarf, position, 2.0, WHITE)   -- Draw 3d model with texture
+
+            DrawGrid(10, 1.0)     -- Draw a grid
+
+        End3dMode()
+        
+        DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
+
+        DrawFPS(10, 10)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadShader(shader)       -- Unload shader
+UnloadTexture(texture)     -- Unload texture
+UnloadModel(dwarf)         -- Unload model
+
+CloseWindow()              -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 101 - 0
examples/shaders_postprocessing.lua

@@ -0,0 +1,101 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shaders] example - Apply a postprocessing shader to a scene
+--
+--  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
+--        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
+--
+--  NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
+--        on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
+--        raylib comes with shaders ready for both versions, check raylib/shaders install folder
+--
+--  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
+
+SetConfigFlags(FLAG.MSAA_4X_HINT)      -- Enable Multi Sampling Anti Aliasing 4x (if available)
+
+InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader")
+
+-- 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 (diffuse map)
+dwarf.material.texDiffuse = texture                                    -- Set dwarf model diffuse texture
+
+local position = Vector3(0.0, 0.0, 0.0)                                -- Set model position
+
+local shader = LoadShader("resources/shaders/glsl330/base.vs", 
+                          "resources/shaders/glsl330/bloom.fs")        -- Load postpro shader
+
+-- Create a RenderTexture2D to be used for render to texture
+local target = LoadRenderTexture(screenWidth, screenHeight)
+
+-- Setup orbital camera
+SetCameraMode(CameraMode.ORBITAL)          -- Set an orbital camera mode
+SetCameraPosition(camera.position)     -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)         -- Set internal camera target to match our camera target
+
+SetTargetFPS(60)                       -- Set our game to run at 60 frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do       -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    camera = UpdateCamera(camera)      -- Update internal camera and our camera
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        BeginTextureMode(target)       -- Enable drawing to texture
+
+            Begin3dMode(camera)
+
+                DrawModel(dwarf, position, 2.0, WHITE)   -- Draw 3d model with texture
+
+                DrawGrid(10, 1.0)      -- Draw a grid
+
+            End3dMode()
+      
+            DrawText("HELLO POSTPROCESSING!", 70, 190, 50, RED)
+            
+        EndTextureMode()           -- End drawing to texture (now we have a texture available for next passes)
+        
+        BeginShaderMode(shader)
+        
+            -- NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
+            DrawTextureRec(target.texture, Rectangle(0, 0, target.texture.width, -target.texture.height), Vector2(0, 0), WHITE)
+            
+        EndShaderMode()
+        
+        DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY)
+
+        DrawFPS(10, 10)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadShader(shader)           -- Unload shader
+UnloadTexture(texture)         -- Unload texture
+UnloadModel(dwarf)             -- Unload model
+UnloadRenderTexture(target)    -- Unload render texture
+
+CloseWindow()                  -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 101 - 0
examples/shaders_shapes_textures.lua

@@ -0,0 +1,101 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shaders] example - Apply a shader to some shape or texture
+--
+--  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
+--        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
+--
+--  NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
+--        on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
+--        raylib comes with shaders ready for both versions, check raylib/shaders install folder
+--
+--  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 [shaders] example - shapes and texture shaders")
+
+local sonic = LoadTexture("resources/texture_formats/sonic.png")
+
+-- NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version 
+local shader = LoadShader("resources/shaders/glsl330/base.vs", 
+                          "resources/shaders/glsl330/grayscale.fs")
+                           
+-- Shader usage is also different than models/postprocessing, shader is just activated when required
+
+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)
+        
+        -- Start drawing with default shader
+
+        DrawText("USING DEFAULT SHADER", 20, 40, 10, RED)
+        
+        DrawCircle(80, 120, 35, DARKBLUE)
+        DrawCircleGradient(80, 220, 60, GREEN, SKYBLUE)
+        DrawCircleLines(80, 340, 80, DARKBLUE)
+
+        
+        -- Activate our custom shader to be applied on next shapes/textures drawings
+        BeginShaderMode(shader)
+        
+            DrawText("USING CUSTOM SHADER", 190, 40, 10, RED)
+
+            DrawRectangle(250 - 60, 90, 120, 60, RED)
+            DrawRectangleGradient(250 - 90, 170, 180, 130, MAROON, GOLD)
+            DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE)
+
+        -- Activate our default shader for next drawings
+        EndShaderMode()
+        
+        DrawText("USING DEFAULT SHADER", 370, 40, 10, RED)
+        
+        DrawTriangle(Vector2(430, 80),
+                     Vector2(430 - 60, 150),
+                     Vector2(430 + 60, 150), VIOLET)
+                     
+        DrawTriangleLines(Vector2(430, 160),
+                          Vector2(430 - 20, 230),
+                          Vector2(430 + 20, 230), DARKBLUE)
+
+        DrawPoly(Vector2(430, 320), 6, 80, 0, BROWN)
+        
+        -- Activate our custom shader to be applied on next shapes/textures drawings
+        BeginShaderMode(shader)
+
+            DrawTexture(sonic, 380, -10, WHITE)    -- Using custom shader
+        
+        -- Activate our default shader for next drawings
+        EndShaderMode()
+        
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadShader(shader)   -- Unload shader
+UnloadTexture(sonic)   -- Unload texture
+
+CloseWindow()          -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 114 - 0
examples/shaders_standard_lighting.lua

@@ -0,0 +1,114 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shaders] example - Standard lighting (materials and lights)
+--
+--  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
+--        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
+--
+--  NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
+--        on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
+--        raylib comes with shaders ready for both versions, check raylib/shaders install folder
+--
+--  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
+
+SetConfigFlags(FLAG.MSAA_4X_HINT)      -- Enable Multi Sampling Anti Aliasing 4x (if available)
+
+InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
+
+-- Define the camera to look into our 3d world
+local camera = Camera(Vector3(4.0, 4.0, 4.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 position = Vector3(0.0, 0.0, 0.0)                                  -- Set model position
+
+local material = LoadStandardMaterial()
+
+material.texDiffuse = LoadTexture("resources/model/dwarf_diffuse.png")   -- Load model diffuse texture
+material.texNormal = LoadTexture("resources/model/dwarf_normal.png")     -- Load model normal texture
+material.texSpecular = LoadTexture("resources/model/dwarf_specular.png") -- Load model specular texture
+material.colDiffuse = WHITE
+material.colAmbient = Color(0, 0, 10, 255)
+material.colSpecular = WHITE
+material.glossiness = 50.0
+
+dwarf.material = material      -- Apply material to model
+
+local spotLight = CreateLight(LightType.SPOT, Vector3(3.0, 5.0, 2.0), Color(255, 255, 255, 255))
+spotLight.target = Vector3(0.0, 0.0, 0.0)
+spotLight.intensity = 2.0
+spotLight.diffuse = Color(255, 100, 100, 255)
+spotLight.coneAngle = 60.0
+
+local dirLight = CreateLight(LightType.DIRECTIONAL, Vector3(0.0, -3.0, -3.0), Color(255, 255, 255, 255))
+dirLight.target = Vector3(1.0, -2.0, -2.0)
+dirLight.intensity = 2.0
+dirLight.diffuse = Color(100, 255, 100, 255)
+
+local pointLight = CreateLight(LightType.POINT, Vector3(0.0, 4.0, 5.0), Color(255, 255, 255, 255))
+pointLight.intensity = 2.0
+pointLight.diffuse = Color(100, 100, 255, 255)
+pointLight.radius = 3.0
+
+-- Setup orbital camera
+SetCameraMode(CameraMode.ORBITAL)      -- Set an orbital camera mode
+SetCameraPosition(camera.position)     -- Set internal camera position to match our camera position
+SetCameraTarget(camera.target)         -- Set internal camera target to match our camera target
+
+SetTargetFPS(60)                       -- Set our game to run at 60 frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do       -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    camera = UpdateCamera(camera)      -- Update internal camera and our camera
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        Begin3dMode(camera)
+            
+            DrawModel(dwarf, position, 2.0, WHITE)   -- Draw 3d model with texture
+            
+            DrawLight(spotLight)       -- Draw spot light
+            DrawLight(dirLight)        -- Draw directional light
+            DrawLight(pointLight)      -- Draw point light
+
+            DrawGrid(10, 1.0)          -- Draw a grid
+
+        End3dMode()
+        
+        DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
+        
+        DrawFPS(10, 10)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadMaterial(material)   -- Unload material and assigned textures
+UnloadModel(dwarf)         -- Unload model
+
+-- Destroy all created lights
+DestroyLight(pointLight)
+DestroyLight(dirLight)
+DestroyLight(spotLight)
+
+CloseWindow()              -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 64 - 0
examples/shapes_basic_shapes.lua

@@ -0,0 +1,64 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
+--
+--  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 [shapes] example - basic shapes drawing")
+
+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("some basic shapes available on raylib", 20, 20, 20, DARKGRAY)
+
+        DrawLine(18, 42, screenWidth - 18, 42, BLACK)
+
+        DrawCircle(screenWidth/4, 120, 35, DARKBLUE)
+        DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE)
+        DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE)
+
+        DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED)
+        DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD)
+        DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE)
+
+        DrawTriangle(Vector2(screenWidth/4*3, 80),
+                     Vector2(screenWidth/4*3 - 60, 150),
+                     Vector2(screenWidth/4*3 + 60, 150), VIOLET)
+
+        DrawTriangleLines(Vector2(screenWidth/4*3, 160),
+                          Vector2(screenWidth/4*3 - 20, 230),
+                          Vector2(screenWidth/4*3 + 20, 230), DARKBLUE)
+
+        DrawPoly(Vector2(screenWidth/4*3, 320), 6, 80, 0, BROWN)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 89 - 0
examples/shapes_colors_palette.lua

@@ -0,0 +1,89 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shapes] example - Draw raylib custom color palette
+--
+--  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 [shapes] example - raylib color palette")
+
+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("raylib color palette", 28, 42, 20, BLACK)
+
+        DrawRectangle(26, 80, 100, 100, DARKGRAY)
+        DrawRectangle(26, 188, 100, 100, GRAY)
+        DrawRectangle(26, 296, 100, 100, LIGHTGRAY)
+        DrawRectangle(134, 80, 100, 100, MAROON)
+        DrawRectangle(134, 188, 100, 100, RED)
+        DrawRectangle(134, 296, 100, 100, PINK)
+        DrawRectangle(242, 80, 100, 100, ORANGE)
+        DrawRectangle(242, 188, 100, 100, GOLD)
+        DrawRectangle(242, 296, 100, 100, YELLOW)
+        DrawRectangle(350, 80, 100, 100, DARKGREEN)
+        DrawRectangle(350, 188, 100, 100, LIME)
+        DrawRectangle(350, 296, 100, 100, GREEN)
+        DrawRectangle(458, 80, 100, 100, DARKBLUE)
+        DrawRectangle(458, 188, 100, 100, BLUE)
+        DrawRectangle(458, 296, 100, 100, SKYBLUE)
+        DrawRectangle(566, 80, 100, 100, DARKPURPLE)
+        DrawRectangle(566, 188, 100, 100, VIOLET)
+        DrawRectangle(566, 296, 100, 100, PURPLE)
+        DrawRectangle(674, 80, 100, 100, DARKBROWN)
+        DrawRectangle(674, 188, 100, 100, BROWN)
+        DrawRectangle(674, 296, 100, 100, BEIGE)
+
+
+        DrawText("DARKGRAY", 65, 166, 10, BLACK)
+        DrawText("GRAY", 93, 274, 10, BLACK)
+        DrawText("LIGHTGRAY", 61, 382, 10, BLACK)
+        DrawText("MAROON", 186, 166, 10, BLACK)
+        DrawText("RED", 208, 274, 10, BLACK)
+        DrawText("PINK", 204, 382, 10, BLACK)
+        DrawText("ORANGE", 295, 166, 10, BLACK)
+        DrawText("GOLD", 310, 274, 10, BLACK)
+        DrawText("YELLOW", 300, 382, 10, BLACK)
+        DrawText("DARKGREEN", 382, 166, 10, BLACK)
+        DrawText("LIME", 420, 274, 10, BLACK)
+        DrawText("GREEN", 410, 382, 10, BLACK)
+        DrawText("DARKBLUE", 498, 166, 10, BLACK)
+        DrawText("BLUE", 526, 274, 10, BLACK)
+        DrawText("SKYBLUE", 505, 382, 10, BLACK)
+        DrawText("DARKPURPLE", 592, 166, 10, BLACK)
+        DrawText("VIOLET", 621, 274, 10, BLACK)
+        DrawText("PURPLE", 620, 382, 10, BLACK)
+        DrawText("DARKBROWN", 705, 166, 10, BLACK)
+        DrawText("BROWN", 733, 274, 10, BLACK)
+        DrawText("BEIGE", 737, 382, 10, BLACK)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 48 - 0
examples/shapes_logo_raylib.lua

@@ -0,0 +1,48 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shapes] example - Draw raylib logo using basic shapes
+--
+--  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 [shapes] example - raylib logo using shapes")
+
+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)
+
+        DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK)
+        DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE)
+        DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK)
+
+        DrawText("this is NOT a texture!", 350, 370, 10, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 127 - 0
examples/shapes_logo_raylib_anim.lua

@@ -0,0 +1,127 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [shapes] example - raylib logo animation
+--
+--  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 [shapes] example - raylib logo animation")
+
+local logoPositionX = screenWidth/2 - 128
+local logoPositionY = screenHeight/2 - 128
+
+local framesCounter = 0
+local lettersCount = 0
+
+local topSideRecWidth = 16
+local leftSideRecHeight = 16
+
+local bottomSideRecWidth = 16
+local rightSideRecHeight = 16
+
+local state = 0                -- Tracking animation states (State Machine)
+local alpha = 1.0              -- Useful for fading
+
+SetTargetFPS(60)               -- Set target frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    if (state == 0) then                    -- State 0: Small box blinking
+        framesCounter = framesCounter + 1
+
+        if (framesCounter == 120) then
+            state = 1
+            framesCounter = 0               -- Reset counter... will be used later...
+        end
+    elseif (state == 1) then                -- State 1: Top and left bars growing
+        topSideRecWidth = topSideRecWidth + 4
+        leftSideRecHeight = leftSideRecHeight + 4
+
+        if (topSideRecWidth == 256) then state = 2 end
+    elseif (state == 2) then                -- State 2: Bottom and right bars growing
+        bottomSideRecWidth = bottomSideRecWidth + 4
+        rightSideRecHeight = rightSideRecHeight + 4
+
+        if (bottomSideRecWidth == 256) then state = 3 end
+    elseif (state == 3) then                -- State 3: Letters appearing (one by one)
+        framesCounter = framesCounter + 1
+
+        if (framesCounter//12 == 1) then    -- Every 12 frames, one more letter!
+            lettersCount = lettersCount + 1
+            framesCounter = 0
+        end
+
+        if (lettersCount >= 10) then        -- When all letters have appeared, just fade out everything
+            alpha = alpha - 0.02
+
+            if (alpha <= 0.0) then
+                alpha = 0.0
+                state = 4
+            end
+        end
+    elseif (state == 4) then                -- State 4: Reset and Replay
+        if (IsKeyPressed(KEY.R)) then
+            framesCounter = 0
+            lettersCount = 0
+
+            topSideRecWidth = 16
+            leftSideRecHeight = 16
+
+            bottomSideRecWidth = 16
+            rightSideRecHeight = 16
+
+            alpha = 1.0
+            state = 0                       -- Return to State 0
+        end
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        if (state == 0) then
+            if ((framesCounter//15)%2 == 1) then DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK) end
+        elseif (state == 1) then
+            DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK)
+            DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK)
+        elseif (state == 2) then
+            DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK)
+            DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK)
+
+            DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK)
+            DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK)
+        elseif (state == 3) then
+            DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha))
+            DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha))
+
+            DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha))
+            DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha))
+
+            DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha))
+
+            DrawText(string.sub("raylib", 0, lettersCount), screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(BLACK, alpha))
+        elseif (state == 4) then DrawText("[R] REPLAY", 340, 200, 20, GRAY) end
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 59 - 0
examples/text_bmfont_ttf.lua

@@ -0,0 +1,59 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - BMFont and TTF SpriteFonts loading
+--
+--  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 [text] example - bmfont and ttf sprite fonts loading")
+
+local msgBm = "THIS IS AN AngelCode SPRITE FONT"
+local msgTtf = "THIS FONT has been GENERATED from TTF"
+
+-- NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
+local fontBm = LoadSpriteFont("resources/fonts/bmfont.fnt")       -- BMFont (AngelCode)
+local fontTtf = LoadSpriteFont("resources/fonts/pixantiqua.ttf")  -- TTF font
+
+local fontPosition = Vector2(0, 0)
+fontPosition.x = screenWidth/2 - MeasureTextEx(fontBm, msgBm, fontBm.size, 0).x/2
+fontPosition.y = screenHeight/2 - fontBm.size/2 - 80
+
+SetTargetFPS(60)            -- Set target frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update variables here...
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTextEx(fontBm, msgBm, fontPosition, fontBm.size, 0, MAROON)
+        DrawTextEx(fontTtf, msgTtf, Vector2(60.0, 240.0), fontTtf.size, 2, LIME)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadSpriteFont(fontBm)     -- AngelCode SpriteFont unloading
+UnloadSpriteFont(fontTtf)    -- TTF SpriteFont unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 143 - 0
examples/text_font_select.lua

@@ -0,0 +1,143 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - Font selector
+--
+--  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 [text] example - font selector")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+local fonts = {}        -- SpriteFont array
+
+fonts[1] = LoadSpriteFont("resources/fonts/alagard.rbmf")       -- SpriteFont loading
+fonts[2] = LoadSpriteFont("resources/fonts/pixelplay.rbmf")     -- SpriteFont loading
+fonts[3] = LoadSpriteFont("resources/fonts/mecha.rbmf")         -- SpriteFont loading
+fonts[4] = LoadSpriteFont("resources/fonts/setback.rbmf")       -- SpriteFont loading
+fonts[5] = LoadSpriteFont("resources/fonts/romulus.rbmf")       -- SpriteFont loading
+fonts[6] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf")    -- SpriteFont loading
+fonts[7] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf")    -- SpriteFont loading
+fonts[8] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf") -- SpriteFont loading
+
+local currentFont = 1        -- Selected font
+
+local colors = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED }
+
+local fontNames = { "[1] Alagard", "[2] PixelPlay", "[3] MECHA", "[4] Setback",
+                    "[5] Romulus", "[6] PixAntiqua", "[7] Alpha Beta", "[8] Jupiter Crash" }
+
+local text = "THIS is THE FONT you SELECTED!"     -- Main text
+
+local textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1)
+
+local mousePoint
+
+local btnNextOutColor = DARKBLUE       -- Button color (outside line)
+local btnNextInColor = SKYBLUE         -- Button color (inside)
+
+local framesCounter = 0      -- Useful to count frames button is 'active' = clicked
+
+local positionY = 180        -- Text selector and button Y position
+
+local btnNextRec = Rectangle(673, positionY, 109, 44)    -- Button rectangle (useful for collision)
+
+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
+    ---------------------------------------------------------------------------------------
+
+    -- Keyboard-based font selection (easy)
+    if (IsKeyPressed(KEY.RIGHT)) then
+        if (currentFont < 8) then currentFont = currentFont + 1 end
+    end
+
+    if (IsKeyPressed(KEY.LEFT)) then
+        if (currentFont > 1) then currentFont = currentFont - 1 end
+    end
+    
+    if (IsKeyPressed(KEY.ZERO)) then currentFont = 0
+    elseif (IsKeyPressed(KEY.ONE)) then currentFont = 1
+    elseif (IsKeyPressed(KEY.TWO)) then currentFont = 2
+    elseif (IsKeyPressed(KEY.THREE)) then currentFont = 3
+    elseif (IsKeyPressed(KEY.FOUR)) then currentFont = 4
+    elseif (IsKeyPressed(KEY.FIVE)) then currentFont = 5
+    elseif (IsKeyPressed(KEY.SIX)) then currentFont = 6
+    elseif (IsKeyPressed(KEY.SEVEN)) then currentFont = 7
+    end
+
+    -- Mouse-based font selection (NEXT button logic)
+    mousePoint = GetMousePosition()
+
+    if (CheckCollisionPointRec(mousePoint, btnNextRec)) then
+        -- Mouse hover button logic
+        if (framesCounter == 0) then
+            btnNextOutColor = DARKPURPLE
+            btnNextInColor = PURPLE
+        end
+
+        if (IsMouseButtonDown(MOUSE.LEFT_BUTTON)) then
+            framesCounter = 20         -- Frames button is 'active'
+            btnNextOutColor = MAROON
+            btnNextInColor = RED
+        end
+    else
+        -- Mouse not hover button
+        btnNextOutColor = DARKBLUE
+        btnNextInColor = SKYBLUE
+    end
+    
+    if (framesCounter > 0) then framesCounter = framesCounter - 1 end
+
+    if (framesCounter == 1) then     -- We change font on frame 1
+        currentFont = currentFont + 1
+        if (currentFont > 7) then currentFont = 0 end
+    end
+
+    -- Text measurement for better positioning on screen
+    textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1)
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+        
+        DrawText("font selector - use arroys, button or numbers", 160, 80, 20, DARKGRAY)
+        DrawLine(120, 120, 680, 120, DARKGRAY)
+
+        DrawRectangle(18, positionY, 644, 44, DARKGRAY)
+        DrawRectangle(20, positionY + 2, 640, 40, LIGHTGRAY)
+        DrawText(fontNames[currentFont], 30, positionY + 13, 20, BLACK)
+        DrawText("< >", 610, positionY + 8, 30, BLACK)
+
+        DrawRectangleRec(btnNextRec, btnNextOutColor)
+        DrawRectangle(675, positionY + 2, 105, 40, btnNextInColor)
+        DrawText("NEXT", 700, positionY + 13, 20, btnNextOutColor)
+
+        DrawTextEx(fonts[currentFont], text, Vector2(screenWidth/2 - textSize.x/2,
+                   260 + (70 - textSize.y)/2), fonts[currentFont].size*3,
+                   1, colors[currentFont])
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+for i = 1, 8 do UnloadSpriteFont(fonts[i]) end       -- SpriteFont(s) unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 54 - 0
examples/text_format_text.lua

@@ -0,0 +1,54 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - Text formatting
+--
+--  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 [text] example - text formatting")
+
+local score = 100020
+local hiscore = 200450
+local lives = 5
+
+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(string.format("Score: %08i", score), 200, 80, 20, RED)
+
+        DrawText(string.format("HiScore: %08i", hiscore), 200, 120, 20, GREEN)
+
+        DrawText(string.format("Lives: %02i", lives), 200, 160, 40, BLUE)
+
+        DrawText(string.format("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 87 - 0
examples/text_rbmf_fonts.lua

@@ -0,0 +1,87 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - raylib bitmap font (rbmf) loading and usage
+--
+--  NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
+--        To view details and credits for those fonts, check raylib license file
+--
+--  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 [text] example - rBMF fonts")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+local fonts = {}
+
+fonts[1] = LoadSpriteFont("resources/fonts/alagard.rbmf")       -- rBMF font loading
+fonts[2] = LoadSpriteFont("resources/fonts/pixelplay.rbmf")     -- rBMF font loading
+fonts[3] = LoadSpriteFont("resources/fonts/mecha.rbmf")         -- rBMF font loading
+fonts[4] = LoadSpriteFont("resources/fonts/setback.rbmf")       -- rBMF font loading
+fonts[5] = LoadSpriteFont("resources/fonts/romulus.rbmf")       -- rBMF font loading
+fonts[6] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf")    -- rBMF font loading
+fonts[7] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf")    -- rBMF font loading
+fonts[8] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf") -- rBMF font loading
+
+local messages = { "ALAGARD FONT designed by Hewett Tsoi", 
+                   "PIXELPLAY FONT designed by Aleksander Shevchuk",
+                   "MECHA FONT designed by Captain Falcon",  
+                   "SETBACK FONT designed by Brian Kent (AEnigma)", 
+                   "ROMULUS FONT designed by Hewett Tsoi", 
+                   "PIXANTIQUA FONT designed by Gerhard Grossmann",
+                   "ALPHA_BETA FONT designed by Brian Kent (AEnigma)",
+                   "JUPITER_CRASH FONT designed by Brian Kent (AEnigma)" }
+                            
+local spacings = { 2, 4, 8, 4, 3, 4, 4, 1 }
+
+local positions = {}
+
+for i = 1, 8 do
+    positions[i] = Vector2(0, 0)
+    positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].size*2, spacings[i]).x/2
+    positions[i].y = 60 + fonts[i].size + 45*(i - 1)
+end
+
+local colors = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, BLACK }
+
+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("free fonts included with raylib", 250, 20, 20, DARKGRAY)
+        DrawLine(220, 50, 590, 50, DARKGRAY)
+        
+        for i = 1, 8 do
+            DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].size*2, spacings[i], colors[i])
+        end
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+for i = 1, 8 do UnloadSpriteFont(fonts[i]) end       -- SpriteFont unloading
+
+CloseWindow()                 -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 72 - 0
examples/text_sprite_fonts.lua

@@ -0,0 +1,72 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - SpriteFont loading and usage
+--
+--  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 [text] example - sprite fonts usage")
+
+local msg1 = "THIS IS A custom SPRITE FONT..."
+local msg2 = "...and this is ANOTHER CUSTOM font..."
+local msg3 = "...and a THIRD one! GREAT! :D"
+
+-- NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
+local font1 = LoadSpriteFont("resources/fonts/custom_mecha.png")          -- SpriteFont loading
+local font2 = LoadSpriteFont("resources/fonts/custom_alagard.png")        -- SpriteFont loading
+local font3 = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png")  -- SpriteFont loading
+
+local fontPosition1 = Vector2(0, 0)
+local fontPosition2 = Vector2(0, 0)
+local fontPosition3 = Vector2(0, 0)
+
+fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, font1.size, -3).x/2
+fontPosition1.y = screenHeight/2 - font1.size/2 - 80
+
+fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, font2.size, -2).x/2
+fontPosition2.y = screenHeight/2 - font2.size/2 - 10
+
+fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, font3.size, 2).x/2
+fontPosition3.y = screenHeight/2 - font3.size/2 + 50
+
+SetTargetFPS(60)            -- Set target frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update variables here...
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTextEx(font1, msg1, fontPosition1, font1.size, -3, WHITE)
+        DrawTextEx(font2, msg2, fontPosition2, font2.size, -2, WHITE)
+        DrawTextEx(font3, msg3, fontPosition3, font3.size, 2, WHITE)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadSpriteFont(font1)      -- SpriteFont unloading
+UnloadSpriteFont(font2)      -- SpriteFont unloading
+UnloadSpriteFont(font3)      -- SpriteFont unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 52 - 0
examples/text_writing_anim.lua

@@ -0,0 +1,52 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [text] example - Text Writing Animation
+--
+--  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 [text] example - text writing anim")
+
+local message = "This sample illustrates a text writing\nanimation effect! Check it out! )"
+
+local framesCounter = 0
+
+SetTargetFPS(60)            -- Set target frames-per-second
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    framesCounter = framesCounter + 1
+    
+    if (IsKeyPressed(KEY.ENTER)) then framesCounter = 0 end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawText(string.sub(message, 0, framesCounter//10), 210, 160, 20, MAROON)
+        
+        DrawText("PRESS [ENTER] to RESTART!", 240, 280, 20, LIGHTGRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------   
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 217 - 0
examples/textures_formats_loading.lua

@@ -0,0 +1,217 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - texture formats loading (compressed and uncompressed)
+--
+--  NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed textures,
+--        OpenGL 1.1 does not support compressed textures, only uncompressed ones.
+--
+--  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_TEXTURES = 24
+
+PNG_R8G8B8A8 = 1
+PVR_GRAYSCALE = 2
+PVR_GRAY_ALPHA = 3
+PVR_R5G6B5 = 4 
+PVR_R5G5B5A1 = 5
+PVR_R4G4B4A4 = 6
+DDS_R5G6B5 = 7
+DDS_R5G5B5A1 = 8
+DDS_R4G4B4A4 = 9
+DDS_R8G8B8A8 = 10
+DDS_DXT1_RGB = 11
+DDS_DXT1_RGBA = 12
+DDS_DXT3_RGBA = 13
+DDS_DXT5_RGBA = 14
+PKM_ETC1_RGB = 15
+PKM_ETC2_RGB = 16
+PKM_ETC2_EAC_RGBA = 17
+KTX_ETC1_RGB = 18
+KTX_ETC2_RGB = 19
+KTX_ETC2_EAC_RGBA = 20
+ASTC_4x4_LDR = 21
+ASTC_8x8_LDR = 22
+PVR_PVRT_RGB = 23
+PVR_PVRT_RGBA = 24
+
+local formatText = {
+    "PNG_R8G8B8A8",
+    "PVR_GRAYSCALE",
+    "PVR_GRAY_ALPHA",
+    "PVR_R5G6B5",
+    "PVR_R5G5B5A1",
+    "PVR_R4G4B4A4",
+    "DDS_R5G6B5",
+    "DDS_R5G5B5A1",
+    "DDS_R4G4B4A4",
+    "DDS_R8G8B8A8",
+    "DDS_DXT1_RGB",
+    "DDS_DXT1_RGBA",
+    "DDS_DXT3_RGBA",
+    "DDS_DXT5_RGBA",
+    "PKM_ETC1_RGB",
+    "PKM_ETC2_RGB",
+    "PKM_ETC2_EAC_RGBA",
+    "KTX_ETC1_RGB",
+    "KTX_ETC2_RGB",
+    "KTX_ETC2_EAC_RGBA",
+    "ASTC_4x4_LDR",
+    "ASTC_8x8_LDR",
+    "PVR_PVRT_RGB",
+    "PVR_PVRT_RGBA"
+}
+
+-- Initialization
+-------------------------------------------------------------------------------------------
+local screenWidth = 800
+local screenHeight = 450
+
+InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture formats loading")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+local sonic = {}
+
+sonic[PNG_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic.png")
+
+-- Load UNCOMPRESSED PVR texture data
+sonic[PVR_GRAYSCALE] = LoadTexture("resources/texture_formats/sonic_GRAYSCALE.pvr")
+sonic[PVR_GRAY_ALPHA] = LoadTexture("resources/texture_formats/sonic_L8A8.pvr")
+sonic[PVR_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.pvr")
+sonic[PVR_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_R5G5B5A1.pvr")
+sonic[PVR_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_R4G4B4A4.pvr")
+
+-- Load UNCOMPRESSED DDS texture data
+sonic[DDS_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.dds")
+sonic[DDS_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_A1R5G5B5.dds")
+sonic[DDS_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_A4R4G4B4.dds")
+sonic[DDS_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic_A8R8G8B8.dds")
+
+-- Load COMPRESSED DXT DDS texture data (if supported)
+sonic[DDS_DXT1_RGB] = LoadTexture("resources/texture_formats/sonic_DXT1_RGB.dds")
+sonic[DDS_DXT1_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT1_RGBA.dds")
+sonic[DDS_DXT3_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT3_RGBA.dds")
+sonic[DDS_DXT5_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT5_RGBA.dds")
+
+-- Load COMPRESSED ETC texture data (if supported)
+sonic[PKM_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.pkm")
+sonic[PKM_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.pkm")
+sonic[PKM_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm")
+
+sonic[KTX_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.ktx")
+sonic[KTX_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.ktx")
+sonic[KTX_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx")
+
+-- Load COMPRESSED ASTC texture data (if supported)
+sonic[ASTC_4x4_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_4x4_ldr.astc")
+sonic[ASTC_8x8_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_8x8_ldr.astc")
+
+-- Load COMPRESSED PVR texture data (if supported)
+sonic[PVR_PVRT_RGB] = LoadTexture("resources/texture_formats/sonic_PVRT_RGB.pvr")
+sonic[PVR_PVRT_RGBA] = LoadTexture("resources/texture_formats/sonic_PVRT_RGBA.pvr")
+
+local selectedFormat = PNG_R8G8B8A8
+
+local selectRecs = {}
+
+for i = 1, NUM_TEXTURES do
+    if ((i - 1) < NUM_TEXTURES//2) then selectRecs[i] = Rectangle(40, 30 + 32*(i - 1), 150, 30)
+    else selectRecs[i] = Rectangle(40 + 152, 30 + 32*((i - 1) - NUM_TEXTURES//2), 150, 30) end
+end
+
+-- Texture sizes in KB
+local textureSizes = { 
+    512*512*32/8/1024,      --PNG_R8G8B8A8 (32 bpp)
+    512*512*8/8/1024,       --PVR_GRAYSCALE (8 bpp)
+    512*512*16/8/1024,      --PVR_GRAY_ALPHA (16 bpp) 
+    512*512*16/8/1024,      --PVR_R5G6B5 (16 bpp)
+    512*512*16/8/1024,      --PVR_R5G5B5A1 (16 bpp) 
+    512*512*16/8/1024,      --PVR_R4G4B4A4 (16 bpp)
+    512*512*16/8/1024,      --DDS_R5G6B5 (16 bpp)
+    512*512*16/8/1024,      --DDS_R5G5B5A1 (16 bpp)
+    512*512*16/8/1024,      --DDS_R4G4B4A4 (16 bpp)
+    512*512*32/8/1024,      --DDS_R8G8B8A8 (32 bpp)
+    512*512*4/8/1024,       --DDS_DXT1_RGB (4 bpp) -Compressed-
+    512*512*4/8/1024,       --DDS_DXT1_RGBA (4 bpp) -Compressed-
+    512*512*8/8/1024,       --DDS_DXT3_RGBA (8 bpp) -Compressed-
+    512*512*8/8/1024,       --DDS_DXT5_RGBA (8 bpp) -Compressed-
+    512*512*4/8/1024,       --PKM_ETC1_RGB (4 bpp) -Compressed-
+    512*512*4/8/1024,       --PKM_ETC2_RGB (4 bpp) -Compressed-
+    512*512*8/8/1024,       --PKM_ETC2_EAC_RGBA (8 bpp) -Compressed-
+    512*512*4/8/1024,       --KTX_ETC1_RGB (4 bpp) -Compressed-
+    512*512*4/8/1024,       --KTX_ETC2_RGB (4 bpp) -Compressed-
+    512*512*8/8/1024,       --KTX_ETC2_EAC_RGBA (8 bpp) -Compressed-
+    512*512*8/8/1024,       --ASTC_4x4_LDR (8 bpp) -Compressed-
+    512*512*2/8/1024,       --ASTC_8x8_LDR (2 bpp) -Compressed-
+    512*512*4/8/1024,       --PVR_PVRT_RGB (4 bpp) -Compressed-
+    512*512*4/8/1024,       --PVR_PVRT_RGBA (4 bpp) -Compressed-
+}
+
+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.DOWN)) then
+        selectedFormat = selectedFormat + 1
+        if (selectedFormat > NUM_TEXTURES) then selectedFormat = 1 end
+    elseif (IsKeyPressed(KEY.UP)) then
+        selectedFormat = selectedFormat - 1
+        if (selectedFormat < 1) then selectedFormat = NUM_TEXTURES end
+    elseif (IsKeyPressed(KEY.RIGHT)) then
+        if (selectedFormat < NUM_TEXTURES//2) then selectedFormat = selectedFormat + NUM_TEXTURES//2 end
+    elseif (IsKeyPressed(KEY.LEFT)) then
+        if (selectedFormat > NUM_TEXTURES//2) then selectedFormat = selectedFormat - NUM_TEXTURES//2 end
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+        
+        -- Draw rectangles
+        for i = 1, NUM_TEXTURES do
+            if (i == selectedFormat) then
+                DrawRectangleRec(selectRecs[i], SKYBLUE)
+                DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE)
+                DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)//2, selectRecs[i].y + 11, 10, DARKBLUE)
+            else
+                DrawRectangleRec(selectRecs[i], LIGHTGRAY)
+                DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY)
+                DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)//2, selectRecs[i].y + 11, 10, DARKGRAY)
+            end
+        end
+        
+        -- Draw selected texture
+        if (sonic[selectedFormat].id ~= 0) then DrawTexture(sonic[selectedFormat], 350, -10, WHITE)
+        else
+            DrawRectangleLines(488, 165, 200, 110, DARKGRAY)
+            DrawText("FORMAT", 550, 180, 20, MAROON)
+            DrawText("NOT SUPPORTED", 500, 210, 20, MAROON)
+            DrawText("ON YOUR GPU", 520, 240, 20, MAROON)
+        end
+        
+        DrawText("Select texture format (use cursor keys):", 40, 10, 10, DARKGRAY)
+        DrawText("Required GPU memory size (VRAM):", 40, 427, 10, DARKGRAY)
+        DrawText(string.format("%4.0f KB", textureSizes[selectedFormat]), 240, 420, 20, DARKBLUE)
+        
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+for i = 1, NUM_TEXTURES do UnloadTexture(sonic[i]) end
+
+CloseWindow()                  -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 70 - 0
examples/textures_image_drawing.lua

@@ -0,0 +1,70 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Image loading and drawing on it
+--
+--  NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
+--
+--  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 [textures] example - image drawing")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+local cat = LoadImage("resources/cat.png")             -- Load image in CPU memory (RAM)
+cat = ImageCrop(cat, Rectangle(100, 10, 280, 380))     -- Crop an image piece
+cat = ImageFlipHorizontal(cat)                         -- Flip cropped image horizontally
+cat = ImageResize(cat, 150, 200)                       -- Resize flipped-cropped image
+
+local parrots = LoadImage("resources/parrots.png")     -- Load image in CPU memory (RAM)
+
+-- Draw one image over the other with a scaling of 1.5f
+parrots = ImageDraw(parrots, cat, Rectangle(0, 0, cat.width, cat.height), Rectangle(30, 40, cat.width*1.5, cat.height*1.5))
+parrots = ImageCrop(parrots, Rectangle(0, 50, parrots.width, parrots.height - 100)) -- Crop resulting image
+
+UnloadImage(cat)       -- Unload image from RAM
+
+local texture = LoadTextureFromImage(parrots)      -- Image converted to texture, uploaded to GPU memory (VRAM)
+UnloadImage(parrots)   -- Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
+
+SetTargetFPS(60)
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update your variables here
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, WHITE)
+        DrawRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, DARKGRAY)
+
+        DrawText("We are drawing only one texture from various images composed!", 240, 350, 10, DARKGRAY)
+        DrawText("Source images have been cropped, scaled, flipped and copied one over the other.", 190, 370, 10, DARKGRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(texture)       -- Texture unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 55 - 0
examples/textures_image_loading.lua

@@ -0,0 +1,55 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Image loading and texture creation
+--
+--  NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
+--
+--  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 [textures] example - image loading")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+local image = LoadImage("resources/raylib_logo.png")  -- Loaded in CPU memory (RAM)
+local texture = LoadTextureFromImage(image)           -- Image converted to texture, GPU memory (VRAM)
+
+UnloadImage(image)   -- Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update your variables here
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
+
+        DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(texture)       -- Texture unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 134 - 0
examples/textures_image_processing.lua

@@ -0,0 +1,134 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Image processing
+--
+--  NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
+--
+--  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)
+--
+-------------------------------------------------------------------------------------------
+
+--#include <stdlib.h>     -- Required for: free()
+
+NUM_PROCESSES = 8
+
+-- enum ImageProcess
+local COLOR_NONE = 1
+local COLOR_GRAYSCALE = 2
+local COLOR_TINT = 3
+local COLOR_INVERT = 4
+local COLOR_CONTRAST = 5
+local COLOR_BRIGHTNESS = 6
+local FLIP_VERTICAL = 7
+local FLIP_HORIZONTAL = 8
+
+local processText = {
+    "NO PROCESSING",
+    "COLOR GRAYSCALE",
+    "COLOR TINT",
+    "COLOR INVERT",
+    "COLOR CONTRAST",
+    "COLOR BRIGHTNESS",
+    "FLIP VERTICAL",
+    "FLIP HORIZONTAL"
+}
+
+-- Initialization
+-------------------------------------------------------------------------------------------
+local screenWidth = 800
+local screenHeight = 450
+
+InitWindow(screenWidth, screenHeight, "raylib [textures] example - image processing")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+local image = LoadImage("resources/parrots.png")   -- Loaded in CPU memory (RAM)
+image = ImageFormat(image, TextureFormat.UNCOMPRESSED_R8G8B8A8)         -- Format image to RGBA 32bit (required for texture update)
+local texture = LoadTextureFromImage(image)        -- Image converted to texture, GPU memory (VRAM)
+
+local currentProcess = COLOR_NONE
+local textureReload = false
+
+local selectRecs = {}
+
+for i = 1, NUM_PROCESSES do selectRecs[i] = Rectangle(40, 50 + 32*i, 150, 30) end
+
+SetTargetFPS(60)
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    if (IsKeyPressed(KEY.DOWN)) then
+        currentProcess = currentProcess + 1
+        if (currentProcess > NUM_PROCESSES) then currentProcess = 1 end
+        textureReload = true
+    elseif (IsKeyPressed(KEY.UP)) then
+        currentProcess = currentProcess - 1
+        if (currentProcess < 1) then currentProcess = NUM_PROCESSES end
+        textureReload = true
+    end
+    
+    if (textureReload) then
+        UnloadImage(image)                         -- Unload current image data
+        image = LoadImage("resources/parrots.png") -- Re-load image data
+
+        -- NOTE: Image processing is a costly CPU process to be done every frame, 
+        -- If image processing is required in a frame-basis, it should be done 
+        -- with a texture and by shaders
+        if (currentProcess == COLOR_GRAYSCALE) then image = ImageColorGrayscale(image)
+        elseif (currentProcess == COLOR_TINT) then image = ImageColorTint(image, GREEN)
+        elseif (currentProcess == COLOR_INVERT) then image = ImageColorInvert(image)
+        elseif (currentProcess == COLOR_CONTRAST) then image = ImageColorContrast(image, -40)
+        elseif (currentProcess == COLOR_BRIGHTNESS) then image = ImageColorBrightness(image, -80)
+        elseif (currentProcess == FLIP_VERTICAL) then image = ImageFlipVertical(image)
+        elseif (currentProcess == FLIP_HORIZONTAL) then image = ImageFlipHorizontal(image)
+        end
+        
+        local pixels = {}
+        pixels = GetImageData(image)                -- Get pixel data from image (RGBA 32bit)
+        texture = UpdateTexture(texture, pixels)    -- Update texture with new image data
+
+        textureReload = false
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+        
+        DrawText("IMAGE PROCESSING:", 40, 30, 10, DARKGRAY)
+        
+        -- Draw rectangles
+        for i = 1, NUM_PROCESSES do
+            if (i == currentProcess) then
+                DrawRectangleRec(selectRecs[i], SKYBLUE)
+                DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE)
+                DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)//2, selectRecs[i].y + 11, 10, DARKBLUE)
+            else
+                DrawRectangleRec(selectRecs[i], LIGHTGRAY)
+                DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY)
+                DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)//2, selectRecs[i].y + 11, 10, DARKGRAY)
+            end
+        end
+
+        DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE)
+        DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK)
+        
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(texture)       -- Unload texture from VRAM
+UnloadImage(image)           -- Unload image from RAM
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 49 - 0
examples/textures_logo_raylib.lua

@@ -0,0 +1,49 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Texture 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 [textures] example - texture loading and drawing")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+local texture = LoadTexture("resources/raylib_logo.png")        -- Texture loading
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update your variables here
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
+
+        DrawText("this IS a texture!", 360, 370, 10, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(texture)       -- Texture unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 113 - 0
examples/textures_particles_trail_blending.lua

@@ -0,0 +1,113 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib example - particles trail blending
+--
+--  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_PARTICLES = 200
+
+-- Initialization
+-------------------------------------------------------------------------------------------
+local screenWidth = 800
+local screenHeight = 450
+
+InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles trail blending")
+
+-- Particles pool, reuse them!
+local mouseTail = {}
+
+-- Initialize particles
+for i = 1, MAX_PARTICLES do
+    mouseTail[i] = {}
+    mouseTail[i].position = Vector2(0, 0)
+    mouseTail[i].color = Color(GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255)
+    mouseTail[i].alpha = 1.0
+    mouseTail[i].size = GetRandomValue(1, 30)/20.0
+    mouseTail[i].rotation = GetRandomValue(0, 360)
+    mouseTail[i].active = false
+end
+
+local gravity = 3.0
+
+local smoke = LoadTexture("resources/smoke.png")
+
+local blending = BlendMode.ALPHA
+
+SetTargetFPS(60)
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    
+    -- Activate one particle every frame and Update active particles
+    -- NOTE: Particles initial position should be mouse position when activated
+    -- NOTE: Particles fall down with gravity and rotation... and disappear after 2 seconds (alpha = 0)
+    -- NOTE: When a particle disappears, active = false and it can be reused.
+    for i = 1, MAX_PARTICLES do
+        if (not mouseTail[i].active) then
+            mouseTail[i].active = true
+            mouseTail[i].alpha = 1.0
+            mouseTail[i].position = GetMousePosition()
+            break
+        end
+    end
+
+    for i = 1, MAX_PARTICLES do
+        if (mouseTail[i].active) then
+            mouseTail[i].position.y = mouseTail[i].position.y + gravity
+            mouseTail[i].alpha = mouseTail[i].alpha - 0.01
+            
+            if (mouseTail[i].alpha <= 0.0) then mouseTail[i].active = false end
+            
+            mouseTail[i].rotation = mouseTail[i].rotation + 5.0
+        end
+    end
+    
+    if (IsKeyPressed(KEY.SPACE)) then
+        if (blending == BlendMode.ALPHA) then blending = BlendMode.ADDITIVE
+        else blending = BlendMode.ALPHA end
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(DARKGRAY)
+        
+        BeginBlendMode(blending)
+
+            -- Draw active particles
+            for i = 1, MAX_PARTICLES do
+                if (mouseTail[i].active) then 
+                    DrawTexturePro(smoke, Rectangle(0, 0, smoke.width, smoke.height), 
+                        Rectangle(mouseTail[i].position.x, mouseTail[i].position.y, 
+                                  smoke.width*mouseTail[i].size//1, smoke.height*mouseTail[i].size//1),
+                        Vector2(smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2), 
+                        mouseTail[i].rotation, Fade(mouseTail[i].color, mouseTail[i].alpha)) end
+            end
+        
+        EndBlendMode()
+        
+        DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, BLACK)
+        
+        if (blending == BlendMode.ALPHA) then DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK)
+        else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE) end
+        
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(smoke)
+
+CloseWindow()        -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 83 - 0
examples/textures_raw_data.lua

@@ -0,0 +1,83 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Load textures from raw data
+--
+--  NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
+--
+--  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)
+--
+-------------------------------------------------------------------------------------------
+
+--#include <stdlib.h>     -- Required for malloc() and free()
+
+-- Initialization
+-------------------------------------------------------------------------------------------
+local screenWidth = 800
+local screenHeight = 450
+
+InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture from raw data")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+-- Load RAW image data (512x512, 32bit RGBA, no file header)
+local sonicRaw = LoadImageRaw("resources/texture_formats/sonic_R8G8B8A8.raw", 512, 512, TextureFormat.UNCOMPRESSED_R8G8B8A8, 0)
+local sonic = LoadTextureFromImage(sonicRaw)   -- Upload CPU (RAM) image to GPU (VRAM)
+UnloadImage(sonicRaw)                              -- Unload CPU (RAM) image data
+
+-- Generate a checked texture by code (1024x1024 pixels)
+local width = 1024
+local height = 1024
+
+-- Dynamic memory allocation to store pixels data (Color type)
+local pixels = {}
+
+for y = 1, height do
+    for x = 1, width do
+        if ((((x - 1)/32+(y - 1)//32)//1)%2 == 0) then pixels[(y - 1)*height + x] = DARKBLUE
+        else pixels[(y - 1)*height + x] = SKYBLUE end
+    end
+end
+
+-- Load pixels data into an image structure and create texture
+local checkedIm = LoadImageEx(pixels, width, height)
+local checked = LoadTextureFromImage(checkedIm)
+UnloadImage(checkedIm)     -- Unload CPU (RAM) image data
+
+-- Dynamic memory must be freed after using it
+--free(pixels)               -- Unload CPU (RAM) pixels data
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update your variables here
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.3))
+        DrawTexture(sonic, 330, -20, WHITE)
+
+        DrawText("CHECKED TEXTURE ", 84, 100, 30, DARKBLUE)
+        DrawText("GENERATED by CODE", 72, 164, 30, DARKBLUE)
+        DrawText("and RAW IMAGE LOADING", 46, 226, 30, DARKBLUE)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(sonic)       -- Texture unloading
+UnloadTexture(checked)     -- Texture unloading
+
+CloseWindow()              -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 69 - 0
examples/textures_rectangle.lua

@@ -0,0 +1,69 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Texture loading and drawing a part defined by a rectangle
+--
+--  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 [texture] example - texture rectangle")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+local guybrush = LoadTexture("resources/guybrush.png")        -- Texture loading
+
+local position = Vector2(350.0, 240.0)
+local frameRec = Rectangle(0, 0, guybrush.width/7, guybrush.height)
+local currentFrame = 0
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    if (IsKeyPressed(KEY.RIGHT)) then
+        currentFrame = currentFrame + 1
+        
+        if (currentFrame > 6) then currentFrame = 0 end
+        
+        frameRec.x = currentFrame*guybrush.width/7
+    end
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(guybrush, 35, 40, WHITE)
+        DrawRectangleLines(35, 40, guybrush.width, guybrush.height, LIME)
+        
+        DrawTextureRec(guybrush, frameRec, position, WHITE)  -- Draw part of the texture
+        
+        DrawRectangleLines(35 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED)
+        
+        DrawText("PRESS RIGHT KEY to", 540, 310, 10, GRAY)
+        DrawText("CHANGE DRAWING RECTANGLE", 520, 330, 10, GRAY)
+        
+        DrawText("Guybrush Ulysses Threepwood,", 100, 300, 10, GRAY)
+        DrawText("main character of the Monkey Island series", 80, 320, 10, GRAY)
+        DrawText("of computer adventure games by LucasArts.", 80, 340, 10, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(guybrush)       -- Texture unloading
+
+CloseWindow()                 -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 71 - 0
examples/textures_srcrec_dstrec.lua

@@ -0,0 +1,71 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Texture source and destination rectangles
+--
+--  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 [textures] examples - texture source and destination rectangles")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+local guybrush = LoadTexture("resources/guybrush.png")        -- Texture loading
+
+local frameWidth = guybrush.width/7
+local frameHeight = guybrush.height
+
+-- NOTE: Source rectangle (part of the texture to use for drawing)
+local sourceRec = Rectangle(0, 0, frameWidth, frameHeight)
+
+-- NOTE: Destination rectangle (screen rectangle where drawing part of texture)
+local destRec = Rectangle(screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2)
+
+-- NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
+local origin = Vector2(frameWidth, frameHeight)
+
+local rotation = 0
+
+SetTargetFPS(60)
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    rotation = rotation + 1
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        -- NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
+        -- sourceRec defines the part of the texture we use for drawing
+        -- destRec defines the rectangle where our texture part will fit (scaling it to fit)
+        -- origin defines the point of the texture used as reference for rotation and scaling
+        -- rotation defines the texture rotation (using origin as rotation point)
+        DrawTexturePro(guybrush, sourceRec, destRec, origin, rotation, WHITE)
+
+        DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY)
+        DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(guybrush)       -- Texture unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 60 - 0
examples/textures_to_image.lua

@@ -0,0 +1,60 @@
+-------------------------------------------------------------------------------------------
+--
+--  raylib [textures] example - Retrieve image data from texture: GetTextureData() 
+--
+--  NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
+--
+--  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 [textures] example - texture to image")
+
+-- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+
+local image = LoadImage("resources/raylib_logo.png")  -- Load image data into CPU memory (RAM)
+local texture = LoadTextureFromImage(image)           -- Image converted to texture, GPU memory (RAM -> VRAM)
+UnloadImage(image)                                    -- Unload image data from CPU memory (RAM)
+
+image = GetTextureData(texture)                       -- Retrieve image data from GPU memory (VRAM -> RAM)
+UnloadTexture(texture)                                -- Unload texture from GPU memory (VRAM)
+
+texture = LoadTextureFromImage(image)                 -- Recreate texture from retrieved image data (RAM -> VRAM)
+UnloadImage(image)                                    -- Unload retrieved image data from CPU memory (RAM)
+-------------------------------------------------------------------------------------------
+
+-- Main game loop
+while not WindowShouldClose() do            -- Detect window close button or ESC key
+    -- Update
+    ---------------------------------------------------------------------------------------
+    -- TODO: Update your variables here
+    ---------------------------------------------------------------------------------------
+
+    -- Draw
+    ---------------------------------------------------------------------------------------
+    BeginDrawing()
+
+        ClearBackground(RAYWHITE)
+
+        DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
+
+        DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY)
+
+    EndDrawing()
+    ---------------------------------------------------------------------------------------
+end
+
+-- De-Initialization
+-------------------------------------------------------------------------------------------
+UnloadTexture(texture)       -- Texture unloading
+
+CloseWindow()                -- Close window and OpenGL context
+-------------------------------------------------------------------------------------------

+ 297 - 0
games/arkanoid.lua

@@ -0,0 +1,297 @@
+--[[
+
+   raylib - sample game: arkanoid
+
+   Sample game Marc Palau and Ramon Santamaria
+
+   This game has been created using raylib v1.3 (www.raylib.com)
+   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+
+   Copyright (c) 2015 Ramon Santamaria (@raysan5)
+   
+   Translated to Lua by Ghassan Al-Mashareqa ([email protected])
+
+--]]
+
+------------------------------------------------------------------------------------
+-- Some Defines
+------------------------------------------------------------------------------------
+PLAYER_MAX_LIFE = 5
+LINES_OF_BRICKS = 5
+BRICKS_PER_LINE = 20
+
+------------------------------------------------------------------------------------
+-- Types and Structures Definition
+------------------------------------------------------------------------------------
+
+GameScreen = { LOGO = 0, TITLE = 1, GAMEPLAY = 2, ENDING = 3 }
+
+function Player()
+	return { position = Vector2(0,0), size = Vector2(0,0), life = 0 }
+end
+
+function Ball()
+	return { position = Vector2(0,0), speed = Vector2(0,0), radius = 0, active = false }
+end
+
+function Brick()
+	return { position = Vector2(0,0), active = false }
+end
+
+--------------------------------------------------------------------------------------
+-- Global Variables Declaration
+--------------------------------------------------------------------------------------
+screenWidth = 800;
+screenHeight = 450;
+
+framesCounter = 0;
+gameOver = false;
+pause = false;
+
+player = Player()
+ball = Ball()
+brick = {}--[LINES_OF_BRICKS][BRICKS_PER_LINE];
+for i = 0, LINES_OF_BRICKS-1 do
+	brick[i] = {}
+	for j = 0, BRICKS_PER_LINE-1 do
+		brick[i][j] = Brick()
+	end
+end
+brickSize = Vector2(0,0)
+
+
+--------------------------------------------------------------------------------------
+-- Module Functions Definitions (local)
+--------------------------------------------------------------------------------------
+
+-- Initialize game variables
+function InitGame()
+
+    brickSize = Vector2(GetScreenWidth()/BRICKS_PER_LINE, 40)
+
+    -- Initialize player
+    player.position = Vector2(screenWidth/2, screenHeight*7/8)
+    player.size = Vector2(screenWidth/10, 20)
+    player.life = PLAYER_MAX_LIFE;
+    
+    -- Initialize ball
+    ball.position = Vector2(screenWidth/2, screenHeight*7/8 - 30)
+    ball.speed = Vector2(0, 0)
+    ball.radius = 7;
+    ball.active = false;
+    
+    -- Initialize bricks
+    local initialDownPosition = 50;
+
+    for i = 0, LINES_OF_BRICKS-1 do
+        for j = 0, BRICKS_PER_LINE-1 do
+            brick[i][j].position = Vector2(j*brickSize.x + brickSize.x/2, i*brickSize.y + initialDownPosition)
+            brick[i][j].active = true;
+        end
+    end
+end
+
+-- Update game (one frame)
+function UpdateGame()
+
+    if (not gameOver) then
+        if (IsKeyPressed(KEY.P)) then pause = not pause; end
+
+        if (not pause) then
+            -- Player movement
+            if (IsKeyDown(KEY.LEFT)) then player.position.x = player.position.x - 5; end
+            if ((player.position.x - player.size.x/2) <= 0) then player.position.x = player.size.x/2; end
+            if (IsKeyDown(KEY.RIGHT)) then player.position.x = player.position.x + 5; end
+            if ((player.position.x + player.size.x/2) >= screenWidth) then player.position.x = screenWidth - player.size.x/2; end
+
+            -- Launch ball
+            if (not ball.active) then
+                if (IsKeyPressed(KEY.SPACE)) then
+                    ball.active = true;
+                    ball.speed = Vector2(0, -5)
+                end
+            end
+            
+            UpdateBall();
+
+            -- Game over logic
+            if (player.life <= 0) then
+							gameOver = true;
+            else
+                gameOver = true;
+                
+                for i = 0, LINES_OF_BRICKS-1 do
+                    for j = 0, BRICKS_PER_LINE-1 do
+                        if (brick[i][j].active) then gameOver = false; end
+                    end
+                end
+            end
+        end
+    else
+        if (IsKeyPressed(KEY.ENTER)) then
+            InitGame();
+            gameOver = false;
+        end
+    end
+
+end
+
+-- Draw game (one frame)
+function DrawGame()
+
+    BeginDrawing();
+
+        ClearBackground(RAYWHITE);
+
+        if (not gameOver) then
+            -- Draw player bar
+            DrawRectangle(player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y, BLACK);
+
+            -- Draw player lives
+            for i = 0, player.life-1 do
+							DrawRectangle(20 + 40*i, screenHeight - 30, 35, 10, LIGHTGRAY);
+						end
+            
+            -- Draw ball
+            DrawCircleV(ball.position, ball.radius, MAROON);
+            
+            -- Draw bricks
+            for i = 0, LINES_OF_BRICKS-1 do
+                for j = 0, BRICKS_PER_LINE-1 do
+                    if (brick[i][j].active) then
+                        if ((i + j) % 2 == 0) then
+													DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, GRAY);
+                        else 
+													DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, DARKGRAY);
+												end
+                    end
+                end
+            end
+            
+            if (pause) then
+							DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
+						end
+        else 
+					DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
+				end
+
+    EndDrawing();
+end
+
+-- Unload game variables
+function UnloadGame()
+    -- TODO: Unload all dynamic loaded data (textures, sounds, models...)
+end
+
+-- Update and Draw (one frame)
+function UpdateDrawFrame()
+    UpdateGame();
+    DrawGame();
+end
+
+----------------------------------------------------------------------------------------
+-- Additional module functions
+----------------------------------------------------------------------------------------
+function UpdateBall()
+    -- Update position
+    if (ball.active) then
+        ball.position.x = ball.position.x + ball.speed.x;
+        ball.position.y = ball.position.y + ball.speed.y;
+    else
+        ball.position = Vector2(player.position.x, screenHeight*7/8 - 30);
+    end
+
+    -- Bounce in x
+    if (((ball.position.x + ball.radius) >= screenWidth) or ((ball.position.x - ball.radius) <= 0)) 
+    then
+			ball.speed.x = ball.speed.x * -1;
+		end
+
+    -- Bounce in y
+    if ((ball.position.y - ball.radius) <= 0) then
+			ball.speed.y = ball.speed.y * -1;
+		end
+
+    -- Ball reaches bottom of the screen
+    if ((ball.position.y + ball.radius) >= screenHeight) then
+        ball.speed = Vector2(0, 0);
+        ball.active = false;
+
+        player.life = player.life - 1;
+    end
+
+    -- 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)) then
+        if (ball.speed.y > 0) then
+            ball.speed.y = ball.speed.y * -1;
+            ball.speed.x = (ball.position.x - player.position.x)/(player.size.x/2)*5;
+        end
+    end
+
+    -- Collision logic: ball vs bricks
+    for i = 0,LINES_OF_BRICKS-1 do
+        for j = 0,BRICKS_PER_LINE-1 do
+            if (brick[i][j].active) then
+                -- Hit below
+                if (((ball.position.y - ball.radius) <= (brick[i][j].position.y + brickSize.y/2)) and
+                    ((ball.position.y - ball.radius) > (brick[i][j].position.y + brickSize.y/2 + ball.speed.y)) and
+                    ((math.abs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) and (ball.speed.y < 0))
+                then
+                    brick[i][j].active = false;
+                    ball.speed.y = ball.speed.y * -1;
+                -- Hit above
+                elseif (((ball.position.y + ball.radius) >= (brick[i][j].position.y - brickSize.y/2)) and
+                        ((ball.position.y + ball.radius) < (brick[i][j].position.y - brickSize.y/2 + ball.speed.y)) and
+                        ((math.abs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) and (ball.speed.y > 0))
+                then
+                    brick[i][j].active = false;
+                    ball.speed.y = ball.speed.y * -1;
+                -- Hit left
+                elseif (((ball.position.x + ball.radius) >= (brick[i][j].position.x - brickSize.x/2)) and
+                        ((ball.position.x + ball.radius) < (brick[i][j].position.x - brickSize.x/2 + ball.speed.x)) and
+                        ((math.abs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) and (ball.speed.x > 0))
+                then
+                    brick[i][j].active = false;
+                    ball.speed.x = ball.speed.x * -1;
+                -- Hit right
+                elseif (((ball.position.x - ball.radius) <= (brick[i][j].position.x + brickSize.x/2)) and
+                        ((ball.position.x - ball.radius) > (brick[i][j].position.x + brickSize.x/2 + ball.speed.x)) and
+                        ((math.abs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) and (ball.speed.x < 0))
+                then
+                    brick[i][j].active = false;
+                    ball.speed.x = ball.speed.x * -1;
+                end
+            end
+        end
+    end
+end
+
+InitWindow(screenWidth, screenHeight, "sample game: arkanoid");
+
+InitGame();
+
+SetTargetFPS(60);
+----------------------------------------------------------------------------------------
+
+-- Main game loop
+while (not WindowShouldClose())    -- Detect window close button or ESC key
+do
+		-- Update
+		------------------------------------------------------------------------------------
+		UpdateGame();
+		------------------------------------------------------------------------------------
+
+		-- Draw
+		------------------------------------------------------------------------------------
+		DrawGame();
+		------------------------------------------------------------------------------------
+end
+
+UnloadGame();         -- Unload loaded data (textures, sounds, models...)
+
+CloseWindow();        -- Close window and OpenGL context

+ 9 - 6
games/drturtle/05_drturtle_audio.c

@@ -12,7 +12,7 @@
 *
 *   Enjoy using raylib. :)
 *
-*   This game has been created using raylib 1.1 (www.raylib.com)
+*   This game 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 Ramon Santamaria (Ray San - [email protected])
@@ -59,8 +59,9 @@ int main()
     Sound die = LoadSound("resources/die.wav");
     Sound growl = LoadSound("resources/gamera.wav");
     
-    // Start playing streaming music
-    PlayMusicStream("resources/speeding.ogg");
+    // Load music stream and start playing music
+    Music music = LoadMusicStream("resources/speeding.ogg");
+    PlayMusicStream(music);
 
     // Define scrolling variables
     int backScrolling = 0;
@@ -118,6 +119,8 @@ int main()
     {
         // Update
         //----------------------------------------------------------------------------------
+        UpdateMusicStream(music);   // Refill music stream buffers (if required)
+        
         framesCounter++;
 
         // Game screens management
@@ -458,10 +461,10 @@ int main()
     UnloadSound(die);
     UnloadSound(growl);
     
-    StopMusicStream();      // Stop music
-    CloseAudioDevice();     // Close audio device
+    UnloadMusicStream(music);   // Unload music
+    CloseAudioDevice();         // Close audio device
     
-    CloseWindow();          // Close window and OpenGL context
+    CloseWindow();              // Close window and OpenGL context
     //--------------------------------------------------------------------------------------
     
     return 0;

+ 10 - 7
games/drturtle/06_drturtle_final.c

@@ -12,7 +12,7 @@
 *
 *   Enjoy using raylib. :)
 *
-*   This game has been created using raylib 1.1 (www.raylib.com)
+*   This game 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 Ramon Santamaria (Ray San - [email protected])
@@ -39,7 +39,7 @@ int main()
     InitWindow(screenWidth, screenHeight, "Dr. Turtle & Mr. GAMERA");
     
     // Initialize audio device
-    InitAudioDevice();      
+    InitAudioDevice();    
     
     // Load game resources: textures
     Texture2D sky = LoadTexture("resources/sky.png");
@@ -62,8 +62,9 @@ int main()
     Sound die = LoadSound("resources/die.wav");
     Sound growl = LoadSound("resources/gamera.wav");
     
-    // Start playing streaming music
-    PlayMusicStream("resources/speeding.ogg");
+    // Load music stream and start playing music
+    Music music = LoadMusicStream("resources/speeding.ogg");
+    PlayMusicStream(music);
 
     // Define scrolling variables
     int backScrolling = 0;
@@ -127,6 +128,8 @@ int main()
     {
         // Update
         //----------------------------------------------------------------------------------
+        UpdateMusicStream(music);   // Refill music stream buffers (if required)
+        
         framesCounter++;
         
         // Sea color tint effect
@@ -483,10 +486,10 @@ int main()
     UnloadSound(die);
     UnloadSound(growl);
     
-    StopMusicStream();      // Stop music
-    CloseAudioDevice();     // Close audio device
+    UnloadMusicStream(music);   // Unload music
+    CloseAudioDevice();         // Close audio device
     
-    CloseWindow();          // Close window and OpenGL context
+    CloseWindow();              // Close window and OpenGL context
     //--------------------------------------------------------------------------------------
     
     return 0;

+ 11 - 8
games/drturtle/drturtle_final_web.c

@@ -12,7 +12,7 @@
 *
 *   Enjoy using raylib. :)
 *
-*   This game has been created using raylib 1.1 (www.raylib.com)
+*   This game 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 Ramon Santamaria (Ray San - [email protected])
@@ -54,6 +54,8 @@ Sound eat;
 Sound die;
 Sound growl;
 
+Music music;
+
 // Define scrolling variables
 int backScrolling = 0;
 int seaScrolling = 0;
@@ -124,8 +126,9 @@ int main()
     die = LoadSound("resources/die.wav");
     growl = LoadSound("resources/gamera.wav");
     
-    // Start playing streaming music
-    PlayMusicStream("resources/speeding.ogg");
+    // Load music stream and start playing music
+    music = LoadMusicStream("resources/speeding.ogg");
+    PlayMusicStream(music);
     
     playerBounds = (Rectangle){ 30 + 14, playerRail*120 + 90 + 14, 100, 100 };
     
@@ -190,10 +193,10 @@ int main()
     UnloadSound(die);
     UnloadSound(growl);
     
-    StopMusicStream();      // Stop music
-    CloseAudioDevice();     // Close audio device
+    UnloadMusicStream(music);   // Unload music
+    CloseAudioDevice();         // Close audio device
     
-    CloseWindow();          // Close window and OpenGL context
+    CloseWindow();              // Close window and OpenGL context
     //--------------------------------------------------------------------------------------
     
     return 0;
@@ -206,8 +209,8 @@ void UpdateDrawFrame(void)
 {
     // Update
     //----------------------------------------------------------------------------------
-    UpdateMusicStream();
-    
+    UpdateMusicStream(music);   // Refill music stream buffers (if required)
+        
     framesCounter++;
     
     // Sea color tint effect

+ 11 - 6
games/just_do/just_do.c

@@ -6,7 +6,7 @@
 *
 *   Developed by: Ramon Santamaria (Ray San)
 *
-*   This game has been created using raylib (www.raylib.com)
+*   This game 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 - Copyright (c) 2015 Ramon Santamaria (Ray San - [email protected])
@@ -23,7 +23,7 @@
 //----------------------------------------------------------------------------------
 // Global Variables Definition (local to this module)
 //----------------------------------------------------------------------------------
-const int screenWidth = 1280;      // Moved to screens.h
+const int screenWidth = 1280;     // Moved to screens.h
 const int screenHeight = 720;     // Moved to screens.h
 
 // Required variables to manage screen transitions (fade-in, fade-out)
@@ -35,6 +35,7 @@ int transToScreen = -1;
 int framesCounter = 0;
 
 //static Sound levelWin;
+Music music;
 
 //----------------------------------------------------------------------------------
 // Local Functions Declaration
@@ -57,10 +58,11 @@ int main(void)
     //SetupFlags(FLAG_FULLSCREEN_MODE);
     InitWindow(screenWidth, screenHeight, windowTitle);
 
-    // TODO: Load global data here (assets that must be available in all screens, i.e. fonts)
+    // Load global data here (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();
     
     levelWin = LoadSound("resources/win.wav");
+    music = LoadMusicStream("resources/ambient.ogg");
     
     // Setup and Init first screen
     currentScreen = LOGO;
@@ -85,8 +87,9 @@ int main(void)
     // De-Initialization
     //--------------------------------------------------------------------------------------
     
-    // TODO: Unload all global loaded data (i.e. fonts) here!
+    // Unload all global loaded data (i.e. fonts) here!
     UnloadSound(levelWin);
+    UnloadMusicStream(music);
     
     CloseAudioDevice();
     
@@ -197,6 +200,8 @@ void UpdateDrawFrame(void)
             InitLevel08Screen();
         }
         
+        UpdateMusicStream(music);
+        
         switch(currentScreen) 
         {
             case LOGO: 
@@ -209,8 +214,8 @@ void UpdateDrawFrame(void)
                     TransitionToScreen(LEVEL00);
                     InitLevel00Screen();
                     
-                    PlayMusicStream("resources/ambient.ogg");
-                    SetMusicVolume(0.6f);
+                    PlayMusicStream(music);
+                    SetMusicVolume(music, 0.6f);
                 }
             } break;
             case LEVEL00: 

+ 15 - 5
games/light_my_ritual/light_my_ritual.c

@@ -35,6 +35,8 @@ bool onTransition = false;
 bool transFadeOut = false;
 int transFromScreen = -1;
 int transToScreen = -1;
+
+static Music music;
     
 //----------------------------------------------------------------------------------
 // Local Functions Declaration
@@ -66,11 +68,13 @@ int main(void)
     
     UnloadImage(image);                         // Unload image from CPU memory (RAM)
     
-    //PlayMusicStream("resources/audio/come_play_with_me.ogg");
-    
     font = LoadSpriteFont("resources/font_arcadian.png");
 	//doors = LoadTexture("resources/textures/doors.png");
     //sndDoor = LoadSound("resources/audio/door.ogg");
+    
+    music = LoadMusicStream("resources/audio/ambient.ogg");
+    PlayMusicStream(music);
+    SetMusicVolume(music, 1.0f);
 
     // Setup and Init first screen
     currentScreen = LOGO_RL;
@@ -105,6 +109,8 @@ int main(void)
     UnloadSpriteFont(font);
     //UnloadSound(sndDoor);
     
+    UnloadMusicStream(music);
+    
     free(lightsMap);
     
     CloseAudioDevice();
@@ -218,13 +224,17 @@ void UpdateDrawFrame(void)
                 rlUpdateLogoScreen();
                 
                 if (rlFinishLogoScreen()) TransitionToScreen(TITLE);
-                
+
             } break;
             case TITLE: 
             {
                 UpdateTitleScreen();
                 
-                if (FinishTitleScreen() == 1) TransitionToScreen(GAMEPLAY);
+                if (FinishTitleScreen() == 1)
+                {
+                    StopMusicStream(music);
+                    TransitionToScreen(GAMEPLAY);
+                }
 
             } break;
             case GAMEPLAY:
@@ -244,7 +254,7 @@ void UpdateDrawFrame(void)
         UpdateTransition();
     }
     
-    UpdateMusicStream();
+    if (currentScreen != GAMEPLAY) UpdateMusicStream(music);
     //----------------------------------------------------------------------------------
     
     // Draw

+ 14 - 7
games/light_my_ritual/screens/screen_gameplay.c

@@ -64,7 +64,7 @@ typedef struct Enemy {
     Color color;
 } Enemy;
 
-typedef struct Light {
+typedef struct LightSpot {
     Vector2 position;
     int radius;
     int requiredEnergy;
@@ -74,7 +74,7 @@ typedef struct Light {
     int framesCounter;
     int currentFrame;
     Rectangle frameRec;
-} Light;
+} LightSpot;
 
 typedef enum { LEVEL_I, LEVEL_II, LEVEL_III, LEVEL_FINISHED } LightedLevel;
 
@@ -92,9 +92,9 @@ static bool pause;
 
 static Player player;
 
-static Light lightsI[MAX_LIGHTS_I];
-static Light lightsII[MAX_LIGHTS_II];
-static Light lightsIII[MAX_LIGHTS_III];
+static LightSpot lightsI[MAX_LIGHTS_I];
+static LightSpot lightsII[MAX_LIGHTS_II];
+static LightSpot lightsIII[MAX_LIGHTS_III];
 
 static Enemy enemies[MAX_ENEMIES];
 
@@ -133,6 +133,8 @@ static Rectangle lightOff, lightOn;
 
 static Sound fxLightOn, fxLightOff;
 
+static Music music;
+
 // Debug variables
 static bool enemiesStopped;
 
@@ -286,7 +288,8 @@ void InitGameplayScreen(void)
     
     enemiesStopped = false;
     
-    PlayMusicStream("resources/audio/ritual.ogg");
+    music = LoadMusicStream("resources/audio/ritual.ogg");
+    PlayMusicStream(music);
 }
 
 // Gameplay Screen Update logic
@@ -549,10 +552,12 @@ void UpdateGameplayScreen(void)
     {
         alphaRitual += 0.02f;
         
-        SetMusicVolume(1.0f - alphaRitual);  
+        SetMusicVolume(music, 1.0f - alphaRitual);  
         
         if (alphaRitual > 1.0f) finishScreen = 1;
     }
+    
+    UpdateMusicStream(music);
 }
 
 // Gameplay Screen Draw logic
@@ -757,6 +762,8 @@ void UnloadGameplayScreen(void)
     // Unload sounds
     UnloadSound(fxLightOn);
     UnloadSound(fxLightOff);
+    
+    UnloadMusicStream(music);
 }
 
 // Gameplay Screen should finish?

+ 1 - 4
games/light_my_ritual/screens/screen_logo_raylib.c

@@ -75,9 +75,6 @@ void rlInitLogoScreen(void)
     
     state = 0;
     alpha = 1.0f;
-    
-    PlayMusicStream("resources/audio/ambient.ogg");
-    SetMusicVolume(1.0f);
 }
 
 // Logo Screen Update logic
@@ -204,7 +201,7 @@ void rlDrawLogoScreen(void)
 // Logo Screen Unload logic
 void rlUnloadLogoScreen(void)
 {
-    // TODO: Unload LOGO screen variables here!
+    // Unload LOGO screen variables here!
 }
 
 // Logo Screen should finish?

+ 3 - 7
games/makefile

@@ -86,8 +86,6 @@ else
 # external libraries headers
 # GLFW3
     INCLUDES += -I../external/glfw3/include
-# GLEW - Not required any more, replaced by GLAD
-    #INCLUDES += -I../external/glew/include
 # OpenAL Soft
     INCLUDES += -I../external/openal_soft/include
 endif
@@ -103,8 +101,6 @@ else
     ifneq ($(PLATFORM_OS),OSX)
     # OpenAL Soft
     	LFLAGS += -L../external/openal_soft/lib/$(LIBPATH)
-    # GLEW: Not used, replaced by GLAD
-        #LFLAGS += -L../../external/glew/lib/$(LIBPATH)
     endif
 endif
 
@@ -115,9 +111,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
         # libraries for Debian GNU/Linux desktop compiling
         # requires the following packages:
         # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
-        LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread
-	# on XWindow could require also below libraries, just uncomment
-	#LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+        LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -lpthread -ldl
+        # on XWindow could require also below libraries:
+        LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
     else
     ifeq ($(PLATFORM_OS),OSX)
         # libraries for OS X 10.9 desktop compiling

+ 14 - 6
games/raylib_demo/raylib_demo.c

@@ -123,6 +123,8 @@ Model cat;
 Sound fxWav;
 Sound fxOgg;
 
+Music music;
+
 Vector2 soundBallsPosition[MAX_BALLS];
 Color soundBallsColor[MAX_BALLS];
 bool soundBallsActive[MAX_BALLS];
@@ -203,11 +205,13 @@ int main()
 
     catTexture = LoadTexture("resources/catsham.png");   // Load model texture
     cat = LoadModel("resources/cat.obj");                // Load OBJ model
-    cat.material.texDiffuse = texture;                   // Set cat model diffuse texture
+    cat.material.texDiffuse = catTexture;                // Set cat model diffuse texture
     
     fxWav = LoadSound("resources/audio/weird.wav");         // Load WAV audio file
     fxOgg = LoadSound("resources/audio/tanatana.ogg");      // Load OGG audio file
     
+    music = LoadMusicStream("resources/audio/guitar_noodling.ogg");     // Load music
+    
     for (int i = 0; i < MAX_BALLS; i++)
     {
         soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
@@ -267,6 +271,8 @@ int main()
 
     UnloadSound(fxWav);
     UnloadSound(fxOgg);
+    
+    UnloadMusicStream(music);
 
     CloseAudioDevice();
     
@@ -464,11 +470,11 @@ void UpdateDrawOneFrame(void)
 
                 if (selectedModule == AUDIO)
                 {
-                    if (IsKeyPressed(KEY_SPACE) && !MusicIsPlaying()) PlayMusicStream("resources/audio/guitar_noodling.ogg");         // Play music stream
+                    if (IsKeyPressed(KEY_SPACE) && !IsMusicPlaying(music)) PlayMusicStream(music);         // Play music stream
 
                     if (IsKeyPressed('S'))
                     {
-                        StopMusicStream();
+                        StopMusicStream(music);
                         timePlayed = 0.0f;
 
                         for (int i = 0; i < MAX_BALLS; i++)
@@ -482,9 +488,11 @@ void UpdateDrawOneFrame(void)
                         }
                     }
 
-                    if (MusicIsPlaying())
+                    if (IsMusicPlaying(music))
                     {
-                        timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4;
+                        UpdateMusicStream(music);
+                        
+                        timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4;
 
                         if ((framesCounter%10) == 0)
                         {
@@ -842,7 +850,7 @@ void UpdateDrawOneFrame(void)
                         DrawRectangle(150, 390, 400, 12, LIGHTGRAY);
                         DrawRectangle(150, 390, (int)timePlayed, 12, MAROON);
 
-                        if (MusicIsPlaying())
+                        if (IsMusicPlaying(music))
                         {
                             DrawText("PRESS 'S' to STOP PLAYING MUSIC", 165, 425, 20, GRAY);
 

+ 8 - 3
games/skully_escape/skully_escape.c

@@ -2,7 +2,7 @@
 *
 *   SKULLY ESCAPE [KING GAME JAM 2015]
 *
-*   This game has been created using raylib (www.raylib.com)
+*   This game 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 Ramon Santamaria (Ray San - [email protected])
@@ -32,6 +32,8 @@ int transFromScreen = -1;
 int transToScreen = -1;
 
 static int framesCounter = 0;
+
+Music music;
     
 //----------------------------------------------------------------------------------
 // Local Functions Declaration
@@ -57,7 +59,8 @@ int main(void)
     // Global data loading (assets that must be available in all screens, i.e. fonts)
     InitAudioDevice();
     
-    PlayMusicStream("resources/audio/come_play_with_me.ogg");
+    music = LoadMusicStream("resources/audio/come_play_with_me.ogg");
+    PlayMusicStream(music);
     
     font = LoadSpriteFont("resources/textures/alagard.png");
 	doors = LoadTexture("resources/textures/doors.png");
@@ -93,6 +96,8 @@ int main(void)
     UnloadSound(sndDoor);
     UnloadSound(sndScream);
     
+    UnloadMusicStream(music);
+    
     CloseAudioDevice();
     
     CloseWindow();        // Close window and OpenGL context
@@ -368,7 +373,7 @@ void UpdateDrawFrame(void)
         UpdateTransition();
     }
     
-    UpdateMusicStream();
+    UpdateMusicStream(music);
     //----------------------------------------------------------------------------------
     
     // Draw

+ 97 - 0
project/vs2015/examples/core_basic_window.vcxproj

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{0981CA98-E4A5-4DF1-987F-A41D09131EFC}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>core_basic_window</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <ProjectName>core_basic_window</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <CompileAs>CompileAsC</CompileAs>
+      <AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(SolutionDir)external\glfw3\lib\win32;$(SolutionDir)external\openal_soft\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\examples\core_basic_window.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\raylib\raylib.vcxproj">
+      <Project>{e89d61ac-55de-4482-afd4-df7242ebc859}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 97 - 0
project/vs2015/examples/core_basic_window_cpp.vcxproj

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{B655E850-3322-42F7-941D-6AC18FD66CA1}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>raylib_example_cpp</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <ProjectName>core_basic_window_cpp</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <CompileAs>CompileAsCpp</CompileAs>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)external\glfw3\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\raylib\raylib.vcxproj">
+      <Project>{e89d61ac-55de-4482-afd4-df7242ebc859}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\examples\core_basic_window.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
project/vs2015/external/glfw3/COPYING.txt

@@ -0,0 +1,22 @@
+Copyright (c) 2002-2006 Marcus Geelnard
+Copyright (c) 2006-2016 Camilla Berglund <[email protected]>
+
+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.
+

+ 4235 - 0
project/vs2015/external/glfw3/include/GLFW/glfw3.h

@@ -0,0 +1,4235 @@
+/*************************************************************************
+ * GLFW 3.2 - www.glfw.org
+ * A library for OpenGL, window and input
+ *------------------------------------------------------------------------
+ * Copyright (c) 2002-2006 Marcus Geelnard
+ * Copyright (c) 2006-2016 Camilla Berglund <[email protected]>
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _glfw3_h_
+#define _glfw3_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*************************************************************************
+ * Doxygen documentation
+ *************************************************************************/
+
+/*! @file glfw3.h
+ *  @brief The header of the GLFW 3 API.
+ *
+ *  This is the header file of the GLFW 3 API.  It defines all its types and
+ *  declares all its functions.
+ *
+ *  For more information about how to use this file, see @ref build_include.
+ */
+/*! @defgroup context Context reference
+ *
+ *  This is the reference documentation for OpenGL and OpenGL ES context related
+ *  functions.  For more task-oriented information, see the @ref context_guide.
+ */
+/*! @defgroup vulkan Vulkan reference
+ *
+ *  This is the reference documentation for Vulkan related functions and types.
+ *  For more task-oriented information, see the @ref vulkan_guide.
+ */
+/*! @defgroup init Initialization, version and error reference
+ *
+ *  This is the reference documentation for initialization and termination of
+ *  the library, version management and error handling.  For more task-oriented
+ *  information, see the @ref intro_guide.
+ */
+/*! @defgroup input Input reference
+ *
+ *  This is the reference documentation for input related functions and types.
+ *  For more task-oriented information, see the @ref input_guide.
+ */
+/*! @defgroup monitor Monitor reference
+ *
+ *  This is the reference documentation for monitor related functions and types.
+ *  For more task-oriented information, see the @ref monitor_guide.
+ */
+/*! @defgroup window Window reference
+ *
+ *  This is the reference documentation for window related functions and types,
+ *  including creation, deletion and event polling.  For more task-oriented
+ *  information, see the @ref window_guide.
+ */
+
+
+/*************************************************************************
+ * Compiler- and platform-specific preprocessor work
+ *************************************************************************/
+
+/* If we are we on Windows, we want a single define for it.
+ */
+#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
+ #define _WIN32
+#endif /* _WIN32 */
+
+/* It is customary to use APIENTRY for OpenGL function pointer declarations on
+ * all platforms.  Additionally, the Windows OpenGL header needs APIENTRY.
+ */
+#ifndef APIENTRY
+ #ifdef _WIN32
+  #define APIENTRY __stdcall
+ #else
+  #define APIENTRY
+ #endif
+#endif /* APIENTRY */
+
+/* Some Windows OpenGL headers need this.
+ */
+#if !defined(WINGDIAPI) && defined(_WIN32)
+ #define WINGDIAPI __declspec(dllimport)
+ #define GLFW_WINGDIAPI_DEFINED
+#endif /* WINGDIAPI */
+
+/* Some Windows GLU headers need this.
+ */
+#if !defined(CALLBACK) && defined(_WIN32)
+ #define CALLBACK __stdcall
+ #define GLFW_CALLBACK_DEFINED
+#endif /* CALLBACK */
+
+/* Most Windows GLU headers need wchar_t.
+ * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
+ * Include it unconditionally to avoid surprising side-effects.
+ */
+#include <stddef.h>
+#include <stdint.h>
+
+/* Include the chosen client API headers.
+ */
+#if defined(__APPLE__)
+ #if defined(GLFW_INCLUDE_GLCOREARB)
+  #include <OpenGL/gl3.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <OpenGL/gl3ext.h>
+  #endif
+ #elif !defined(GLFW_INCLUDE_NONE)
+  #if !defined(GLFW_INCLUDE_GLEXT)
+   #define GL_GLEXT_LEGACY
+  #endif
+  #include <OpenGL/gl.h>
+ #endif
+ #if defined(GLFW_INCLUDE_GLU)
+  #include <OpenGL/glu.h>
+ #endif
+#else
+ #if defined(GLFW_INCLUDE_GLCOREARB)
+  #include <GL/glcorearb.h>
+ #elif defined(GLFW_INCLUDE_ES1)
+  #include <GLES/gl.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <GLES/glext.h>
+  #endif
+ #elif defined(GLFW_INCLUDE_ES2)
+  #include <GLES2/gl2.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <GLES2/gl2ext.h>
+  #endif
+ #elif defined(GLFW_INCLUDE_ES3)
+  #include <GLES3/gl3.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <GLES2/gl2ext.h>
+  #endif
+ #elif defined(GLFW_INCLUDE_ES31)
+  #include <GLES3/gl31.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <GLES2/gl2ext.h>
+  #endif
+ #elif defined(GLFW_INCLUDE_VULKAN)
+  #include <vulkan/vulkan.h>
+ #elif !defined(GLFW_INCLUDE_NONE)
+  #include <GL/gl.h>
+  #if defined(GLFW_INCLUDE_GLEXT)
+   #include <GL/glext.h>
+  #endif
+ #endif
+ #if defined(GLFW_INCLUDE_GLU)
+  #include <GL/glu.h>
+ #endif
+#endif
+
+#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
+ /* GLFW_DLL must be defined by applications that are linking against the DLL
+  * version of the GLFW library.  _GLFW_BUILD_DLL is defined by the GLFW
+  * configuration header when compiling the DLL version of the library.
+  */
+ #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
+#endif
+
+/* GLFWAPI is used to declare public API functions for export
+ * from the DLL / shared library / dynamic library.
+ */
+#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
+ /* We are building GLFW as a Win32 DLL */
+ #define GLFWAPI __declspec(dllexport)
+#elif defined(_WIN32) && defined(GLFW_DLL)
+ /* We are calling GLFW as a Win32 DLL */
+ #define GLFWAPI __declspec(dllimport)
+#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
+ /* We are building GLFW as a shared / dynamic library */
+ #define GLFWAPI __attribute__((visibility("default")))
+#else
+ /* We are building or calling GLFW as a static library */
+ #define GLFWAPI
+#endif
+
+
+/*************************************************************************
+ * GLFW API tokens
+ *************************************************************************/
+
+/*! @name GLFW version macros
+ *  @{ */
+/*! @brief The major version number of the GLFW library.
+ *
+ *  This is incremented when the API is changed in non-compatible ways.
+ *  @ingroup init
+ */
+#define GLFW_VERSION_MAJOR          3
+/*! @brief The minor version number of the GLFW library.
+ *
+ *  This is incremented when features are added to the API but it remains
+ *  backward-compatible.
+ *  @ingroup init
+ */
+#define GLFW_VERSION_MINOR          2
+/*! @brief The revision number of the GLFW library.
+ *
+ *  This is incremented when a bug fix release is made that does not contain any
+ *  API changes.
+ *  @ingroup init
+ */
+#define GLFW_VERSION_REVISION       0
+/*! @} */
+
+/*! @name Boolean values
+ *  @{ */
+/*! @brief One.
+ *
+ *  One.  Seriously.  You don't _need_ to use this symbol in your code.  It's
+ *  just semantic sugar for the number 1.  You can use `1` or `true` or `_True`
+ *  or `GL_TRUE` or whatever you want.
+ */
+#define GLFW_TRUE                   1
+/*! @brief Zero.
+ *
+ *  Zero.  Seriously.  You don't _need_ to use this symbol in your code.  It's
+ *  just just semantic sugar for the number 0.  You can use `0` or `false` or
+ *  `_False` or `GL_FALSE` or whatever you want.
+ */
+#define GLFW_FALSE                  0
+/*! @} */
+
+/*! @name Key and button actions
+ *  @{ */
+/*! @brief The key or mouse button was released.
+ *
+ *  The key or mouse button was released.
+ *
+ *  @ingroup input
+ */
+#define GLFW_RELEASE                0
+/*! @brief The key or mouse button was pressed.
+ *
+ *  The key or mouse button was pressed.
+ *
+ *  @ingroup input
+ */
+#define GLFW_PRESS                  1
+/*! @brief The key was held down until it repeated.
+ *
+ *  The key was held down until it repeated.
+ *
+ *  @ingroup input
+ */
+#define GLFW_REPEAT                 2
+/*! @} */
+
+/*! @defgroup keys Keyboard keys
+ *
+ *  See [key input](@ref input_key) for how these are used.
+ *
+ *  These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
+ *  but re-arranged to map to 7-bit ASCII for printable keys (function keys are
+ *  put in the 256+ range).
+ *
+ *  The naming of the key codes follow these rules:
+ *   - The US keyboard layout is used
+ *   - Names of printable alpha-numeric characters are used (e.g. "A", "R",
+ *     "3", etc.)
+ *   - For non-alphanumeric characters, Unicode:ish names are used (e.g.
+ *     "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
+ *     correspond to the Unicode standard (usually for brevity)
+ *   - Keys that lack a clear US mapping are named "WORLD_x"
+ *   - For non-printable keys, custom names are used (e.g. "F4",
+ *     "BACKSPACE", etc.)
+ *
+ *  @ingroup input
+ *  @{
+ */
+
+/* The unknown key */
+#define GLFW_KEY_UNKNOWN            -1
+
+/* Printable keys */
+#define GLFW_KEY_SPACE              32
+#define GLFW_KEY_APOSTROPHE         39  /* ' */
+#define GLFW_KEY_COMMA              44  /* , */
+#define GLFW_KEY_MINUS              45  /* - */
+#define GLFW_KEY_PERIOD             46  /* . */
+#define GLFW_KEY_SLASH              47  /* / */
+#define GLFW_KEY_0                  48
+#define GLFW_KEY_1                  49
+#define GLFW_KEY_2                  50
+#define GLFW_KEY_3                  51
+#define GLFW_KEY_4                  52
+#define GLFW_KEY_5                  53
+#define GLFW_KEY_6                  54
+#define GLFW_KEY_7                  55
+#define GLFW_KEY_8                  56
+#define GLFW_KEY_9                  57
+#define GLFW_KEY_SEMICOLON          59  /* ; */
+#define GLFW_KEY_EQUAL              61  /* = */
+#define GLFW_KEY_A                  65
+#define GLFW_KEY_B                  66
+#define GLFW_KEY_C                  67
+#define GLFW_KEY_D                  68
+#define GLFW_KEY_E                  69
+#define GLFW_KEY_F                  70
+#define GLFW_KEY_G                  71
+#define GLFW_KEY_H                  72
+#define GLFW_KEY_I                  73
+#define GLFW_KEY_J                  74
+#define GLFW_KEY_K                  75
+#define GLFW_KEY_L                  76
+#define GLFW_KEY_M                  77
+#define GLFW_KEY_N                  78
+#define GLFW_KEY_O                  79
+#define GLFW_KEY_P                  80
+#define GLFW_KEY_Q                  81
+#define GLFW_KEY_R                  82
+#define GLFW_KEY_S                  83
+#define GLFW_KEY_T                  84
+#define GLFW_KEY_U                  85
+#define GLFW_KEY_V                  86
+#define GLFW_KEY_W                  87
+#define GLFW_KEY_X                  88
+#define GLFW_KEY_Y                  89
+#define GLFW_KEY_Z                  90
+#define GLFW_KEY_LEFT_BRACKET       91  /* [ */
+#define GLFW_KEY_BACKSLASH          92  /* \ */
+#define GLFW_KEY_RIGHT_BRACKET      93  /* ] */
+#define GLFW_KEY_GRAVE_ACCENT       96  /* ` */
+#define GLFW_KEY_WORLD_1            161 /* non-US #1 */
+#define GLFW_KEY_WORLD_2            162 /* non-US #2 */
+
+/* Function keys */
+#define GLFW_KEY_ESCAPE             256
+#define GLFW_KEY_ENTER              257
+#define GLFW_KEY_TAB                258
+#define GLFW_KEY_BACKSPACE          259
+#define GLFW_KEY_INSERT             260
+#define GLFW_KEY_DELETE             261
+#define GLFW_KEY_RIGHT              262
+#define GLFW_KEY_LEFT               263
+#define GLFW_KEY_DOWN               264
+#define GLFW_KEY_UP                 265
+#define GLFW_KEY_PAGE_UP            266
+#define GLFW_KEY_PAGE_DOWN          267
+#define GLFW_KEY_HOME               268
+#define GLFW_KEY_END                269
+#define GLFW_KEY_CAPS_LOCK          280
+#define GLFW_KEY_SCROLL_LOCK        281
+#define GLFW_KEY_NUM_LOCK           282
+#define GLFW_KEY_PRINT_SCREEN       283
+#define GLFW_KEY_PAUSE              284
+#define GLFW_KEY_F1                 290
+#define GLFW_KEY_F2                 291
+#define GLFW_KEY_F3                 292
+#define GLFW_KEY_F4                 293
+#define GLFW_KEY_F5                 294
+#define GLFW_KEY_F6                 295
+#define GLFW_KEY_F7                 296
+#define GLFW_KEY_F8                 297
+#define GLFW_KEY_F9                 298
+#define GLFW_KEY_F10                299
+#define GLFW_KEY_F11                300
+#define GLFW_KEY_F12                301
+#define GLFW_KEY_F13                302
+#define GLFW_KEY_F14                303
+#define GLFW_KEY_F15                304
+#define GLFW_KEY_F16                305
+#define GLFW_KEY_F17                306
+#define GLFW_KEY_F18                307
+#define GLFW_KEY_F19                308
+#define GLFW_KEY_F20                309
+#define GLFW_KEY_F21                310
+#define GLFW_KEY_F22                311
+#define GLFW_KEY_F23                312
+#define GLFW_KEY_F24                313
+#define GLFW_KEY_F25                314
+#define GLFW_KEY_KP_0               320
+#define GLFW_KEY_KP_1               321
+#define GLFW_KEY_KP_2               322
+#define GLFW_KEY_KP_3               323
+#define GLFW_KEY_KP_4               324
+#define GLFW_KEY_KP_5               325
+#define GLFW_KEY_KP_6               326
+#define GLFW_KEY_KP_7               327
+#define GLFW_KEY_KP_8               328
+#define GLFW_KEY_KP_9               329
+#define GLFW_KEY_KP_DECIMAL         330
+#define GLFW_KEY_KP_DIVIDE          331
+#define GLFW_KEY_KP_MULTIPLY        332
+#define GLFW_KEY_KP_SUBTRACT        333
+#define GLFW_KEY_KP_ADD             334
+#define GLFW_KEY_KP_ENTER           335
+#define GLFW_KEY_KP_EQUAL           336
+#define GLFW_KEY_LEFT_SHIFT         340
+#define GLFW_KEY_LEFT_CONTROL       341
+#define GLFW_KEY_LEFT_ALT           342
+#define GLFW_KEY_LEFT_SUPER         343
+#define GLFW_KEY_RIGHT_SHIFT        344
+#define GLFW_KEY_RIGHT_CONTROL      345
+#define GLFW_KEY_RIGHT_ALT          346
+#define GLFW_KEY_RIGHT_SUPER        347
+#define GLFW_KEY_MENU               348
+
+#define GLFW_KEY_LAST               GLFW_KEY_MENU
+
+/*! @} */
+
+/*! @defgroup mods Modifier key flags
+ *
+ *  See [key input](@ref input_key) for how these are used.
+ *
+ *  @ingroup input
+ *  @{ */
+
+/*! @brief If this bit is set one or more Shift keys were held down.
+ */
+#define GLFW_MOD_SHIFT           0x0001
+/*! @brief If this bit is set one or more Control keys were held down.
+ */
+#define GLFW_MOD_CONTROL         0x0002
+/*! @brief If this bit is set one or more Alt keys were held down.
+ */
+#define GLFW_MOD_ALT             0x0004
+/*! @brief If this bit is set one or more Super keys were held down.
+ */
+#define GLFW_MOD_SUPER           0x0008
+
+/*! @} */
+
+/*! @defgroup buttons Mouse buttons
+ *
+ *  See [mouse button input](@ref input_mouse_button) for how these are used.
+ *
+ *  @ingroup input
+ *  @{ */
+#define GLFW_MOUSE_BUTTON_1         0
+#define GLFW_MOUSE_BUTTON_2         1
+#define GLFW_MOUSE_BUTTON_3         2
+#define GLFW_MOUSE_BUTTON_4         3
+#define GLFW_MOUSE_BUTTON_5         4
+#define GLFW_MOUSE_BUTTON_6         5
+#define GLFW_MOUSE_BUTTON_7         6
+#define GLFW_MOUSE_BUTTON_8         7
+#define GLFW_MOUSE_BUTTON_LAST      GLFW_MOUSE_BUTTON_8
+#define GLFW_MOUSE_BUTTON_LEFT      GLFW_MOUSE_BUTTON_1
+#define GLFW_MOUSE_BUTTON_RIGHT     GLFW_MOUSE_BUTTON_2
+#define GLFW_MOUSE_BUTTON_MIDDLE    GLFW_MOUSE_BUTTON_3
+/*! @} */
+
+/*! @defgroup joysticks Joysticks
+ *
+ *  See [joystick input](@ref joystick) for how these are used.
+ *
+ *  @ingroup input
+ *  @{ */
+#define GLFW_JOYSTICK_1             0
+#define GLFW_JOYSTICK_2             1
+#define GLFW_JOYSTICK_3             2
+#define GLFW_JOYSTICK_4             3
+#define GLFW_JOYSTICK_5             4
+#define GLFW_JOYSTICK_6             5
+#define GLFW_JOYSTICK_7             6
+#define GLFW_JOYSTICK_8             7
+#define GLFW_JOYSTICK_9             8
+#define GLFW_JOYSTICK_10            9
+#define GLFW_JOYSTICK_11            10
+#define GLFW_JOYSTICK_12            11
+#define GLFW_JOYSTICK_13            12
+#define GLFW_JOYSTICK_14            13
+#define GLFW_JOYSTICK_15            14
+#define GLFW_JOYSTICK_16            15
+#define GLFW_JOYSTICK_LAST          GLFW_JOYSTICK_16
+/*! @} */
+
+/*! @defgroup errors Error codes
+ *
+ *  See [error handling](@ref error_handling) for how these are used.
+ *
+ *  @ingroup init
+ *  @{ */
+/*! @brief GLFW has not been initialized.
+ *
+ *  This occurs if a GLFW function was called that must not be called unless the
+ *  library is [initialized](@ref intro_init).
+ *
+ *  @analysis Application programmer error.  Initialize GLFW before calling any
+ *  function that requires initialization.
+ */
+#define GLFW_NOT_INITIALIZED        0x00010001
+/*! @brief No context is current for this thread.
+ *
+ *  This occurs if a GLFW function was called that needs and operates on the
+ *  current OpenGL or OpenGL ES context but no context is current on the calling
+ *  thread.  One such function is @ref glfwSwapInterval.
+ *
+ *  @analysis Application programmer error.  Ensure a context is current before
+ *  calling functions that require a current context.
+ */
+#define GLFW_NO_CURRENT_CONTEXT     0x00010002
+/*! @brief One of the arguments to the function was an invalid enum value.
+ *
+ *  One of the arguments to the function was an invalid enum value, for example
+ *  requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
+ *  glfwGetWindowAttrib.
+ *
+ *  @analysis Application programmer error.  Fix the offending call.
+ */
+#define GLFW_INVALID_ENUM           0x00010003
+/*! @brief One of the arguments to the function was an invalid value.
+ *
+ *  One of the arguments to the function was an invalid value, for example
+ *  requesting a non-existent OpenGL or OpenGL ES version like 2.7.
+ *
+ *  Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
+ *  result in a @ref GLFW_VERSION_UNAVAILABLE error.
+ *
+ *  @analysis Application programmer error.  Fix the offending call.
+ */
+#define GLFW_INVALID_VALUE          0x00010004
+/*! @brief A memory allocation failed.
+ *
+ *  A memory allocation failed.
+ *
+ *  @analysis A bug in GLFW or the underlying operating system.  Report the bug
+ *  to our [issue tracker](https://github.com/glfw/glfw/issues).
+ */
+#define GLFW_OUT_OF_MEMORY          0x00010005
+/*! @brief GLFW could not find support for the requested API on the system.
+ *
+ *  GLFW could not find support for the requested API on the system.
+ *
+ *  @analysis The installed graphics driver does not support the requested
+ *  API, or does not support it via the chosen context creation backend.
+ *  Below are a few examples.
+ *
+ *  @par
+ *  Some pre-installed Windows graphics drivers do not support OpenGL.  AMD only
+ *  supports OpenGL ES via EGL, while Nvidia and Intel only support it via
+ *  a WGL or GLX extension.  OS X does not provide OpenGL ES at all.  The Mesa
+ *  EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
+ *  driver.  Older graphics drivers do not support Vulkan.
+ */
+#define GLFW_API_UNAVAILABLE        0x00010006
+/*! @brief The requested OpenGL or OpenGL ES version is not available.
+ *
+ *  The requested OpenGL or OpenGL ES version (including any requested context
+ *  or framebuffer hints) is not available on this machine.
+ *
+ *  @analysis The machine does not support your requirements.  If your
+ *  application is sufficiently flexible, downgrade your requirements and try
+ *  again.  Otherwise, inform the user that their machine does not match your
+ *  requirements.
+ *
+ *  @par
+ *  Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
+ *  comes out before the 4.x series gets that far, also fail with this error and
+ *  not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
+ *  will exist.
+ */
+#define GLFW_VERSION_UNAVAILABLE    0x00010007
+/*! @brief A platform-specific error occurred that does not match any of the
+ *  more specific categories.
+ *
+ *  A platform-specific error occurred that does not match any of the more
+ *  specific categories.
+ *
+ *  @analysis A bug or configuration error in GLFW, the underlying operating
+ *  system or its drivers, or a lack of required resources.  Report the issue to
+ *  our [issue tracker](https://github.com/glfw/glfw/issues).
+ */
+#define GLFW_PLATFORM_ERROR         0x00010008
+/*! @brief The requested format is not supported or available.
+ *
+ *  If emitted during window creation, the requested pixel format is not
+ *  supported.
+ *
+ *  If emitted when querying the clipboard, the contents of the clipboard could
+ *  not be converted to the requested format.
+ *
+ *  @analysis If emitted during window creation, one or more
+ *  [hard constraints](@ref window_hints_hard) did not match any of the
+ *  available pixel formats.  If your application is sufficiently flexible,
+ *  downgrade your requirements and try again.  Otherwise, inform the user that
+ *  their machine does not match your requirements.
+ *
+ *  @par
+ *  If emitted when querying the clipboard, ignore the error or report it to
+ *  the user, as appropriate.
+ */
+#define GLFW_FORMAT_UNAVAILABLE     0x00010009
+/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
+ *
+ *  A window that does not have an OpenGL or OpenGL ES context was passed to
+ *  a function that requires it to have one.
+ *
+ *  @analysis Application programmer error.  Fix the offending call.
+ */
+#define GLFW_NO_WINDOW_CONTEXT      0x0001000A
+/*! @} */
+
+#define GLFW_FOCUSED                0x00020001
+#define GLFW_ICONIFIED              0x00020002
+#define GLFW_RESIZABLE              0x00020003
+#define GLFW_VISIBLE                0x00020004
+#define GLFW_DECORATED              0x00020005
+#define GLFW_AUTO_ICONIFY           0x00020006
+#define GLFW_FLOATING               0x00020007
+#define GLFW_MAXIMIZED              0x00020008
+
+#define GLFW_RED_BITS               0x00021001
+#define GLFW_GREEN_BITS             0x00021002
+#define GLFW_BLUE_BITS              0x00021003
+#define GLFW_ALPHA_BITS             0x00021004
+#define GLFW_DEPTH_BITS             0x00021005
+#define GLFW_STENCIL_BITS           0x00021006
+#define GLFW_ACCUM_RED_BITS         0x00021007
+#define GLFW_ACCUM_GREEN_BITS       0x00021008
+#define GLFW_ACCUM_BLUE_BITS        0x00021009
+#define GLFW_ACCUM_ALPHA_BITS       0x0002100A
+#define GLFW_AUX_BUFFERS            0x0002100B
+#define GLFW_STEREO                 0x0002100C
+#define GLFW_SAMPLES                0x0002100D
+#define GLFW_SRGB_CAPABLE           0x0002100E
+#define GLFW_REFRESH_RATE           0x0002100F
+#define GLFW_DOUBLEBUFFER           0x00021010
+
+#define GLFW_CLIENT_API             0x00022001
+#define GLFW_CONTEXT_VERSION_MAJOR  0x00022002
+#define GLFW_CONTEXT_VERSION_MINOR  0x00022003
+#define GLFW_CONTEXT_REVISION       0x00022004
+#define GLFW_CONTEXT_ROBUSTNESS     0x00022005
+#define GLFW_OPENGL_FORWARD_COMPAT  0x00022006
+#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
+#define GLFW_OPENGL_PROFILE         0x00022008
+#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
+#define GLFW_CONTEXT_NO_ERROR       0x0002200A
+#define GLFW_CONTEXT_CREATION_API   0x0002200B
+
+#define GLFW_NO_API                          0
+#define GLFW_OPENGL_API             0x00030001
+#define GLFW_OPENGL_ES_API          0x00030002
+
+#define GLFW_NO_ROBUSTNESS                   0
+#define GLFW_NO_RESET_NOTIFICATION  0x00031001
+#define GLFW_LOSE_CONTEXT_ON_RESET  0x00031002
+
+#define GLFW_OPENGL_ANY_PROFILE              0
+#define GLFW_OPENGL_CORE_PROFILE    0x00032001
+#define GLFW_OPENGL_COMPAT_PROFILE  0x00032002
+
+#define GLFW_CURSOR                 0x00033001
+#define GLFW_STICKY_KEYS            0x00033002
+#define GLFW_STICKY_MOUSE_BUTTONS   0x00033003
+
+#define GLFW_CURSOR_NORMAL          0x00034001
+#define GLFW_CURSOR_HIDDEN          0x00034002
+#define GLFW_CURSOR_DISABLED        0x00034003
+
+#define GLFW_ANY_RELEASE_BEHAVIOR            0
+#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
+#define GLFW_RELEASE_BEHAVIOR_NONE  0x00035002
+
+#define GLFW_NATIVE_CONTEXT_API     0x00036001
+#define GLFW_EGL_CONTEXT_API        0x00036002
+
+/*! @defgroup shapes Standard cursor shapes
+ *
+ *  See [standard cursor creation](@ref cursor_standard) for how these are used.
+ *
+ *  @ingroup input
+ *  @{ */
+
+/*! @brief The regular arrow cursor shape.
+ *
+ *  The regular arrow cursor.
+ */
+#define GLFW_ARROW_CURSOR           0x00036001
+/*! @brief The text input I-beam cursor shape.
+ *
+ *  The text input I-beam cursor shape.
+ */
+#define GLFW_IBEAM_CURSOR           0x00036002
+/*! @brief The crosshair shape.
+ *
+ *  The crosshair shape.
+ */
+#define GLFW_CROSSHAIR_CURSOR       0x00036003
+/*! @brief The hand shape.
+ *
+ *  The hand shape.
+ */
+#define GLFW_HAND_CURSOR            0x00036004
+/*! @brief The horizontal resize arrow shape.
+ *
+ *  The horizontal resize arrow shape.
+ */
+#define GLFW_HRESIZE_CURSOR         0x00036005
+/*! @brief The vertical resize arrow shape.
+ *
+ *  The vertical resize arrow shape.
+ */
+#define GLFW_VRESIZE_CURSOR         0x00036006
+/*! @} */
+
+#define GLFW_CONNECTED              0x00040001
+#define GLFW_DISCONNECTED           0x00040002
+
+#define GLFW_DONT_CARE              -1
+
+
+/*************************************************************************
+ * GLFW API types
+ *************************************************************************/
+
+/*! @brief Client API function pointer type.
+ *
+ *  Generic function pointer used for returning client API function pointers
+ *  without forcing a cast from a regular pointer.
+ *
+ *  @sa @ref context_glext
+ *  @sa glfwGetProcAddress
+ *
+ *  @since Added in version 3.0.
+ 
+ *  @ingroup context
+ */
+typedef void (*GLFWglproc)(void);
+
+/*! @brief Vulkan API function pointer type.
+ *
+ *  Generic function pointer used for returning Vulkan API function pointers
+ *  without forcing a cast from a regular pointer.
+ *
+ *  @sa @ref vulkan_proc
+ *  @sa glfwGetInstanceProcAddress
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+typedef void (*GLFWvkproc)(void);
+
+/*! @brief Opaque monitor object.
+ *
+ *  Opaque monitor object.
+ *
+ *  @see @ref monitor_object
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+typedef struct GLFWmonitor GLFWmonitor;
+
+/*! @brief Opaque window object.
+ *
+ *  Opaque window object.
+ *
+ *  @see @ref window_object
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+typedef struct GLFWwindow GLFWwindow;
+
+/*! @brief Opaque cursor object.
+ *
+ *  Opaque cursor object.
+ *
+ *  @see @ref cursor_object
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup cursor
+ */
+typedef struct GLFWcursor GLFWcursor;
+
+/*! @brief The function signature for error callbacks.
+ *
+ *  This is the function signature for error callback functions.
+ *
+ *  @param[in] error An [error code](@ref errors).
+ *  @param[in] description A UTF-8 encoded string describing the error.
+ *
+ *  @sa @ref error_handling
+ *  @sa glfwSetErrorCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup init
+ */
+typedef void (* GLFWerrorfun)(int,const char*);
+
+/*! @brief The function signature for window position callbacks.
+ *
+ *  This is the function signature for window position callback functions.
+ *
+ *  @param[in] window The window that was moved.
+ *  @param[in] xpos The new x-coordinate, in screen coordinates, of the
+ *  upper-left corner of the client area of the window.
+ *  @param[in] ypos The new y-coordinate, in screen coordinates, of the
+ *  upper-left corner of the client area of the window.
+ *
+ *  @sa @ref window_pos
+ *  @sa glfwSetWindowPosCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
+
+/*! @brief The function signature for window resize callbacks.
+ *
+ *  This is the function signature for window size callback functions.
+ *
+ *  @param[in] window The window that was resized.
+ *  @param[in] width The new width, in screen coordinates, of the window.
+ *  @param[in] height The new height, in screen coordinates, of the window.
+ *
+ *  @sa @ref window_size
+ *  @sa glfwSetWindowSizeCallback
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
+
+/*! @brief The function signature for window close callbacks.
+ *
+ *  This is the function signature for window close callback functions.
+ *
+ *  @param[in] window The window that the user attempted to close.
+ *
+ *  @sa @ref window_close
+ *  @sa glfwSetWindowCloseCallback
+ *
+ *  @since Added in version 2.5.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowclosefun)(GLFWwindow*);
+
+/*! @brief The function signature for window content refresh callbacks.
+ *
+ *  This is the function signature for window refresh callback functions.
+ *
+ *  @param[in] window The window whose content needs to be refreshed.
+ *
+ *  @sa @ref window_refresh
+ *  @sa glfwSetWindowRefreshCallback
+ *
+ *  @since Added in version 2.5.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
+
+/*! @brief The function signature for window focus/defocus callbacks.
+ *
+ *  This is the function signature for window focus callback functions.
+ *
+ *  @param[in] window The window that gained or lost input focus.
+ *  @param[in] focused `GLFW_TRUE` if the window was given input focus, or
+ *  `GLFW_FALSE` if it lost it.
+ *
+ *  @sa @ref window_focus
+ *  @sa glfwSetWindowFocusCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
+
+/*! @brief The function signature for window iconify/restore callbacks.
+ *
+ *  This is the function signature for window iconify/restore callback
+ *  functions.
+ *
+ *  @param[in] window The window that was iconified or restored.
+ *  @param[in] iconified `GLFW_TRUE` if the window was iconified, or
+ *  `GLFW_FALSE` if it was restored.
+ *
+ *  @sa @ref window_iconify
+ *  @sa glfwSetWindowIconifyCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
+
+/*! @brief The function signature for framebuffer resize callbacks.
+ *
+ *  This is the function signature for framebuffer resize callback
+ *  functions.
+ *
+ *  @param[in] window The window whose framebuffer was resized.
+ *  @param[in] width The new width, in pixels, of the framebuffer.
+ *  @param[in] height The new height, in pixels, of the framebuffer.
+ *
+ *  @sa @ref window_fbsize
+ *  @sa glfwSetFramebufferSizeCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
+
+/*! @brief The function signature for mouse button callbacks.
+ *
+ *  This is the function signature for mouse button callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] button The [mouse button](@ref buttons) that was pressed or
+ *  released.
+ *  @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
+ *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ *  held down.
+ *
+ *  @sa @ref input_mouse_button
+ *  @sa glfwSetMouseButtonCallback
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle and modifier mask parameters.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
+
+/*! @brief The function signature for cursor position callbacks.
+ *
+ *  This is the function signature for cursor position callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] xpos The new cursor x-coordinate, relative to the left edge of
+ *  the client area.
+ *  @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
+ *  client area.
+ *
+ *  @sa @ref cursor_pos
+ *  @sa glfwSetCursorPosCallback
+ *
+ *  @since Added in version 3.0.  Replaces `GLFWmouseposfun`.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
+
+/*! @brief The function signature for cursor enter/leave callbacks.
+ *
+ *  This is the function signature for cursor enter/leave callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
+ *  area, or `GLFW_FALSE` if it left it.
+ *
+ *  @sa @ref cursor_enter
+ *  @sa glfwSetCursorEnterCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
+
+/*! @brief The function signature for scroll callbacks.
+ *
+ *  This is the function signature for scroll callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] xoffset The scroll offset along the x-axis.
+ *  @param[in] yoffset The scroll offset along the y-axis.
+ *
+ *  @sa @ref scrolling
+ *  @sa glfwSetScrollCallback
+ *
+ *  @since Added in version 3.0.  Replaces `GLFWmousewheelfun`.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
+
+/*! @brief The function signature for keyboard key callbacks.
+ *
+ *  This is the function signature for keyboard key callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] key The [keyboard key](@ref keys) that was pressed or released.
+ *  @param[in] scancode The system-specific scancode of the key.
+ *  @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
+ *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ *  held down.
+ *
+ *  @sa @ref input_key
+ *  @sa glfwSetKeyCallback
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle, scancode and modifier mask parameters.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
+
+/*! @brief The function signature for Unicode character callbacks.
+ *
+ *  This is the function signature for Unicode character callback functions.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] codepoint The Unicode code point of the character.
+ *
+ *  @sa @ref input_char
+ *  @sa glfwSetCharCallback
+ *
+ *  @since Added in version 2.4.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
+
+/*! @brief The function signature for Unicode character with modifiers
+ *  callbacks.
+ *
+ *  This is the function signature for Unicode character with modifiers callback
+ *  functions.  It is called for each input character, regardless of what
+ *  modifier keys are held down.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] codepoint The Unicode code point of the character.
+ *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ *  held down.
+ *
+ *  @sa @ref input_char
+ *  @sa glfwSetCharModsCallback
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
+
+/*! @brief The function signature for file drop callbacks.
+ *
+ *  This is the function signature for file drop callbacks.
+ *
+ *  @param[in] window The window that received the event.
+ *  @param[in] count The number of dropped files.
+ *  @param[in] paths The UTF-8 encoded file and/or directory path names.
+ *
+ *  @sa @ref path_drop
+ *  @sa glfwSetDropCallback
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
+
+/*! @brief The function signature for monitor configuration callbacks.
+ *
+ *  This is the function signature for monitor configuration callback functions.
+ *
+ *  @param[in] monitor The monitor that was connected or disconnected.
+ *  @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
+ *
+ *  @sa @ref monitor_event
+ *  @sa glfwSetMonitorCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
+
+/*! @brief The function signature for joystick configuration callbacks.
+ *
+ *  This is the function signature for joystick configuration callback
+ *  functions.
+ *
+ *  @param[in] joy The joystick that was connected or disconnected.
+ *  @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
+ *
+ *  @sa @ref joystick_event
+ *  @sa glfwSetJoystickCallback
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup input
+ */
+typedef void (* GLFWjoystickfun)(int,int);
+
+/*! @brief Video mode type.
+ *
+ *  This describes a single video mode.
+ *
+ *  @sa @ref monitor_modes
+ *  @sa glfwGetVideoMode glfwGetVideoModes
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added refresh rate member.
+ *
+ *  @ingroup monitor
+ */
+typedef struct GLFWvidmode
+{
+    /*! The width, in screen coordinates, of the video mode.
+     */
+    int width;
+    /*! The height, in screen coordinates, of the video mode.
+     */
+    int height;
+    /*! The bit depth of the red channel of the video mode.
+     */
+    int redBits;
+    /*! The bit depth of the green channel of the video mode.
+     */
+    int greenBits;
+    /*! The bit depth of the blue channel of the video mode.
+     */
+    int blueBits;
+    /*! The refresh rate, in Hz, of the video mode.
+     */
+    int refreshRate;
+} GLFWvidmode;
+
+/*! @brief Gamma ramp.
+ *
+ *  This describes the gamma ramp for a monitor.
+ *
+ *  @sa @ref monitor_gamma
+ *  @sa glfwGetGammaRamp glfwSetGammaRamp
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+typedef struct GLFWgammaramp
+{
+    /*! An array of value describing the response of the red channel.
+     */
+    unsigned short* red;
+    /*! An array of value describing the response of the green channel.
+     */
+    unsigned short* green;
+    /*! An array of value describing the response of the blue channel.
+     */
+    unsigned short* blue;
+    /*! The number of elements in each array.
+     */
+    unsigned int size;
+} GLFWgammaramp;
+
+/*! @brief Image data.
+ *
+ *  @sa @ref cursor_custom
+ *
+ *  @since Added in version 2.1.
+ *  @glfw3 Removed format and bytes-per-pixel members.
+ */
+typedef struct GLFWimage
+{
+    /*! The width, in pixels, of this image.
+     */
+    int width;
+    /*! The height, in pixels, of this image.
+     */
+    int height;
+    /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
+     */
+    unsigned char* pixels;
+} GLFWimage;
+
+
+/*************************************************************************
+ * GLFW API functions
+ *************************************************************************/
+
+/*! @brief Initializes the GLFW library.
+ *
+ *  This function initializes the GLFW library.  Before most GLFW functions can
+ *  be used, GLFW must be initialized, and before an application terminates GLFW
+ *  should be terminated in order to free any resources allocated during or
+ *  after initialization.
+ *
+ *  If this function fails, it calls @ref glfwTerminate before returning.  If it
+ *  succeeds, you should call @ref glfwTerminate before the application exits.
+ *
+ *  Additional calls to this function after successful initialization but before
+ *  termination will return `GLFW_TRUE` immediately.
+ *
+ *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark @osx This function will change the current directory of the
+ *  application to the `Contents/Resources` subdirectory of the application's
+ *  bundle, if present.  This can be disabled with a
+ *  [compile-time option](@ref compile_options_osx).
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref intro_init
+ *  @sa glfwTerminate
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup init
+ */
+GLFWAPI int glfwInit(void);
+
+/*! @brief Terminates the GLFW library.
+ *
+ *  This function destroys all remaining windows and cursors, restores any
+ *  modified gamma ramps and frees any other allocated resources.  Once this
+ *  function is called, you must again call @ref glfwInit successfully before
+ *  you will be able to use most GLFW functions.
+ *
+ *  If GLFW has been successfully initialized, this function should be called
+ *  before the application exits.  If initialization fails, there is no need to
+ *  call this function, as it is called by @ref glfwInit before it returns
+ *  failure.
+ *
+ *  @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @warning The contexts of any remaining windows must not be current on any
+ *  other thread when this function is called.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref intro_init
+ *  @sa glfwInit
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup init
+ */
+GLFWAPI void glfwTerminate(void);
+
+/*! @brief Retrieves the version of the GLFW library.
+ *
+ *  This function retrieves the major, minor and revision numbers of the GLFW
+ *  library.  It is intended for when you are using GLFW as a shared library and
+ *  want to ensure that you are using the minimum required version.
+ *
+ *  Any or all of the version arguments may be `NULL`.
+ *
+ *  @param[out] major Where to store the major version number, or `NULL`.
+ *  @param[out] minor Where to store the minor version number, or `NULL`.
+ *  @param[out] rev Where to store the revision number, or `NULL`.
+ *
+ *  @errors None.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref intro_version
+ *  @sa glfwGetVersionString
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup init
+ */
+GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
+
+/*! @brief Returns a string describing the compile-time configuration.
+ *
+ *  This function returns the compile-time generated
+ *  [version string](@ref intro_version_string) of the GLFW library binary.  It
+ *  describes the version, platform, compiler and any platform-specific
+ *  compile-time options.  It should not be confused with the OpenGL or OpenGL
+ *  ES version string, queried with `glGetString`.
+ *
+ *  __Do not use the version string__ to parse the GLFW library version.  The
+ *  @ref glfwGetVersion function provides the version of the running library
+ *  binary in numerical format.
+ *
+ *  @return The ASCII encoded GLFW version string.
+ *
+ *  @errors None.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @pointer_lifetime The returned string is static and compile-time generated.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref intro_version
+ *  @sa glfwGetVersion
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup init
+ */
+GLFWAPI const char* glfwGetVersionString(void);
+
+/*! @brief Sets the error callback.
+ *
+ *  This function sets the error callback, which is called with an error code
+ *  and a human-readable description each time a GLFW error occurs.
+ *
+ *  The error callback is called on the thread where the error occurred.  If you
+ *  are using GLFW from multiple threads, your error callback needs to be
+ *  written accordingly.
+ *
+ *  Because the description string may have been generated specifically for that
+ *  error, it is not guaranteed to be valid after the callback has returned.  If
+ *  you wish to use it after the callback returns, you need to make a copy.
+ *
+ *  Once set, the error callback remains set even after the library has been
+ *  terminated.
+ *
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set.
+ *
+ *  @errors None.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref error_handling
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup init
+ */
+GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
+
+/*! @brief Returns the currently connected monitors.
+ *
+ *  This function returns an array of handles for all currently connected
+ *  monitors.  The primary monitor is always first in the returned array.  If no
+ *  monitors were found, this function returns `NULL`.
+ *
+ *  @param[out] count Where to store the number of monitors in the returned
+ *  array.  This is set to zero if an error occurred.
+ *  @return An array of monitor handles, or `NULL` if no monitors were found or
+ *  if an [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is guaranteed to be valid only until the
+ *  monitor configuration changes or the library is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_monitors
+ *  @sa @ref monitor_event
+ *  @sa glfwGetPrimaryMonitor
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
+
+/*! @brief Returns the primary monitor.
+ *
+ *  This function returns the primary monitor.  This is usually the monitor
+ *  where elements like the task bar or global menu bar are located.
+ *
+ *  @return The primary monitor, or `NULL` if no monitors were found or if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @remark The primary monitor is always first in the array returned by @ref
+ *  glfwGetMonitors.
+ *
+ *  @sa @ref monitor_monitors
+ *  @sa glfwGetMonitors
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
+
+/*! @brief Returns the position of the monitor's viewport on the virtual screen.
+ *
+ *  This function returns the position, in screen coordinates, of the upper-left
+ *  corner of the specified monitor.
+ *
+ *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` position arguments will be set to zero.
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
+ *  @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_properties
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
+
+/*! @brief Returns the physical size of the monitor.
+ *
+ *  This function returns the size, in millimetres, of the display area of the
+ *  specified monitor.
+ *
+ *  Some systems do not provide accurate monitor size information, either
+ *  because the monitor
+ *  [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
+ *  data is incorrect or because the driver does not report it accurately.
+ *
+ *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` size arguments will be set to zero.
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @param[out] widthMM Where to store the width, in millimetres, of the
+ *  monitor's display area, or `NULL`.
+ *  @param[out] heightMM Where to store the height, in millimetres, of the
+ *  monitor's display area, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @remark @win32 calculates the returned physical size from the
+ *  current resolution and system DPI instead of querying the monitor EDID data.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_properties
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
+
+/*! @brief Returns the name of the specified monitor.
+ *
+ *  This function returns a human-readable name, encoded as UTF-8, of the
+ *  specified monitor.  The name typically reflects the make and model of the
+ *  monitor and is not guaranteed to be unique among the connected monitors.
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @return The UTF-8 encoded name of the monitor, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified monitor is
+ *  disconnected or the library is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_properties
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
+
+/*! @brief Sets the monitor configuration callback.
+ *
+ *  This function sets the monitor configuration callback, or removes the
+ *  currently set callback.  This is called when a monitor is connected to or
+ *  disconnected from the system.
+ *
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_event
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
+
+/*! @brief Returns the available video modes for the specified monitor.
+ *
+ *  This function returns an array of all video modes supported by the specified
+ *  monitor.  The returned array is sorted in ascending order, first by color
+ *  bit depth (the sum of all channel depths) and then by resolution area (the
+ *  product of width and height).
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @param[out] count Where to store the number of video modes in the returned
+ *  array.  This is set to zero if an error occurred.
+ *  @return An array of video modes, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified monitor is
+ *  disconnected, this function is called again for that monitor or the library
+ *  is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_modes
+ *  @sa glfwGetVideoMode
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Changed to return an array of modes for a specific monitor.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
+
+/*! @brief Returns the current mode of the specified monitor.
+ *
+ *  This function returns the current video mode of the specified monitor.  If
+ *  you have created a full screen window for that monitor, the return value
+ *  will depend on whether that window is iconified.
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @return The current mode of the monitor, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified monitor is
+ *  disconnected or the library is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_modes
+ *  @sa glfwGetVideoModes
+ *
+ *  @since Added in version 3.0.  Replaces `glfwGetDesktopMode`.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
+
+/*! @brief Generates a gamma ramp and sets it for the specified monitor.
+ *
+ *  This function generates a 256-element gamma ramp from the specified exponent
+ *  and then calls @ref glfwSetGammaRamp with it.  The value must be a finite
+ *  number greater than zero.
+ *
+ *  @param[in] monitor The monitor whose gamma ramp to set.
+ *  @param[in] gamma The desired exponent.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_gamma
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
+
+/*! @brief Returns the current gamma ramp for the specified monitor.
+ *
+ *  This function returns the current gamma ramp of the specified monitor.
+ *
+ *  @param[in] monitor The monitor to query.
+ *  @return The current gamma ramp, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned structure and its arrays are allocated and
+ *  freed by GLFW.  You should not free them yourself.  They are valid until the
+ *  specified monitor is disconnected, this function is called again for that
+ *  monitor or the library is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_gamma
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
+
+/*! @brief Sets the current gamma ramp for the specified monitor.
+ *
+ *  This function sets the current gamma ramp for the specified monitor.  The
+ *  original gamma ramp for that monitor is saved by GLFW the first time this
+ *  function is called and is restored by @ref glfwTerminate.
+ *
+ *  @param[in] monitor The monitor whose gamma ramp to set.
+ *  @param[in] ramp The gamma ramp to use.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @remark Gamma ramp sizes other than 256 are not supported by all platforms
+ *  or graphics hardware.
+ *
+ *  @remark @win32 The gamma ramp size must be 256.
+ *
+ *  @pointer_lifetime The specified gamma ramp is copied before this function
+ *  returns.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref monitor_gamma
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup monitor
+ */
+GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
+/*! @brief Resets all window hints to their default values.
+ *
+ *  This function resets all window hints to their
+ *  [default values](@ref window_hints_values).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_hints
+ *  @sa glfwWindowHint
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwDefaultWindowHints(void);
+
+/*! @brief Sets the specified window hint to the desired value.
+ *
+ *  This function sets hints for the next call to @ref glfwCreateWindow.  The
+ *  hints, once set, retain their values until changed by a call to @ref
+ *  glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
+ *  terminated.
+ *
+ *  This function does not check whether the specified hint values are valid.
+ *  If you set hints to invalid values this will instead be reported by the next
+ *  call to @ref glfwCreateWindow.
+ *
+ *  @param[in] hint The [window hint](@ref window_hints) to set.
+ *  @param[in] value The new value of the window hint.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_INVALID_ENUM.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_hints
+ *  @sa glfwDefaultWindowHints
+ *
+ *  @since Added in version 3.0.  Replaces `glfwOpenWindowHint`.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwWindowHint(int hint, int value);
+
+/*! @brief Creates a window and its associated context.
+ *
+ *  This function creates a window and its associated OpenGL or OpenGL ES
+ *  context.  Most of the options controlling how the window and its context
+ *  should be created are specified with [window hints](@ref window_hints).
+ *
+ *  Successful creation does not change which context is current.  Before you
+ *  can use the newly created context, you need to
+ *  [make it current](@ref context_current).  For information about the `share`
+ *  parameter, see @ref context_sharing.
+ *
+ *  The created window, framebuffer and context may differ from what you
+ *  requested, as not all parameters and hints are
+ *  [hard constraints](@ref window_hints_hard).  This includes the size of the
+ *  window, especially for full screen windows.  To query the actual attributes
+ *  of the created window, framebuffer and context, see @ref
+ *  glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
+ *
+ *  To create a full screen window, you need to specify the monitor the window
+ *  will cover.  If no monitor is specified, the window will be windowed mode.
+ *  Unless you have a way for the user to choose a specific monitor, it is
+ *  recommended that you pick the primary monitor.  For more information on how
+ *  to query connected monitors, see @ref monitor_monitors.
+ *
+ *  For full screen windows, the specified size becomes the resolution of the
+ *  window's _desired video mode_.  As long as a full screen window is not
+ *  iconified, the supported video mode most closely matching the desired video
+ *  mode is set for the specified monitor.  For more information about full
+ *  screen windows, including the creation of so called _windowed full screen_
+ *  or _borderless full screen_ windows, see @ref window_windowed_full_screen.
+ *
+ *  By default, newly created windows use the placement recommended by the
+ *  window system.  To create the window at a specific position, make it
+ *  initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
+ *  hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
+ *  it.
+ *
+ *  As long as at least one full screen window is not iconified, the screensaver
+ *  is prohibited from starting.
+ *
+ *  Window systems put limits on window sizes.  Very large or very small window
+ *  dimensions may be overridden by the window system on creation.  Check the
+ *  actual [size](@ref window_size) after creation.
+ *
+ *  The [swap interval](@ref buffer_swap) is not set during window creation and
+ *  the initial value may vary depending on driver settings and defaults.
+ *
+ *  @param[in] width The desired width, in screen coordinates, of the window.
+ *  This must be greater than zero.
+ *  @param[in] height The desired height, in screen coordinates, of the window.
+ *  This must be greater than zero.
+ *  @param[in] title The initial, UTF-8 encoded window title.
+ *  @param[in] monitor The monitor to use for full screen mode, or `NULL` for
+ *  windowed mode.
+ *  @param[in] share The window whose context to share resources with, or `NULL`
+ *  to not share resources.
+ *  @return The handle of the created window, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
+ *  GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @remark @win32 Window creation will fail if the Microsoft GDI software
+ *  OpenGL implementation is the only one available.
+ *
+ *  @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
+ *  will be set as the initial icon for the window.  If no such icon is present,
+ *  the `IDI_WINLOGO` icon will be used instead.  To set a different icon, see
+ *  @ref glfwSetWindowIcon.
+ *
+ *  @remark @win32 The context to share resources with must not be current on
+ *  any other thread.
+ *
+ *  @remark @osx The GLFW window has no icon, as it is not a document
+ *  window, but the dock icon will be the same as the application bundle's icon.
+ *  For more information on bundles, see the
+ *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
+ *  in the Mac Developer Library.
+ *
+ *  @remark @osx The first time a window is created the menu bar is populated
+ *  with common commands like Hide, Quit and About.  The About entry opens
+ *  a minimal about dialog with information from the application's bundle.  The
+ *  menu bar can be disabled with a
+ *  [compile-time option](@ref compile_options_osx).
+ *
+ *  @remark @osx On OS X 10.10 and later the window frame will not be rendered
+ *  at full resolution on Retina displays unless the `NSHighResolutionCapable`
+ *  key is enabled in the application bundle's `Info.plist`.  For more
+ *  information, see
+ *  [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
+ *  in the Mac Developer Library.  The GLFW test and example programs use
+ *  a custom `Info.plist` template for this, which can be found as
+ *  `CMake/MacOSXBundleInfo.plist.in` in the source tree.
+ *
+ *  @remark @x11 Some window managers will not respect the placement of
+ *  initially hidden windows.
+ *
+ *  @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
+ *  a window to reach its requested state.  This means you may not be able to
+ *  query the final size, position or other attributes directly after window
+ *  creation.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_creation
+ *  @sa glfwDestroyWindow
+ *
+ *  @since Added in version 3.0.  Replaces `glfwOpenWindow`.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
+
+/*! @brief Destroys the specified window and its context.
+ *
+ *  This function destroys the specified window and its context.  On calling
+ *  this function, no further callbacks will be called for that window.
+ *
+ *  If the context of the specified window is current on the main thread, it is
+ *  detached before being destroyed.
+ *
+ *  @param[in] window The window to destroy.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @note The context of the specified window must not be current on any other
+ *  thread when this function is called.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_creation
+ *  @sa glfwCreateWindow
+ *
+ *  @since Added in version 3.0.  Replaces `glfwCloseWindow`.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
+
+/*! @brief Checks the close flag of the specified window.
+ *
+ *  This function returns the value of the close flag of the specified window.
+ *
+ *  @param[in] window The window to query.
+ *  @return The value of the close flag.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @sa @ref window_close
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
+
+/*! @brief Sets the close flag of the specified window.
+ *
+ *  This function sets the value of the close flag of the specified window.
+ *  This can be used to override the user's attempt to close the window, or
+ *  to signal that it should be closed.
+ *
+ *  @param[in] window The window whose flag to change.
+ *  @param[in] value The new value.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @sa @ref window_close
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
+
+/*! @brief Sets the title of the specified window.
+ *
+ *  This function sets the window title, encoded as UTF-8, of the specified
+ *  window.
+ *
+ *  @param[in] window The window whose title to change.
+ *  @param[in] title The UTF-8 encoded window title.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @remark @osx The window title will not be updated until the next time you
+ *  process events.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_title
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
+
+/*! @brief Sets the icon for the specified window.
+ *
+ *  This function sets the icon of the specified window.  If passed an array of
+ *  candidate images, those of or closest to the sizes desired by the system are
+ *  selected.  If no images are specified, the window reverts to its default
+ *  icon.
+ *
+ *  The desired image sizes varies depending on platform and system settings.
+ *  The selected images will be rescaled as needed.  Good sizes include 16x16,
+ *  32x32 and 48x48.
+ *
+ *  @param[in] window The window whose icon to set.
+ *  @param[in] count The number of images in the specified array, or zero to
+ *  revert to the default window icon.
+ *  @param[in] images The images to create the icon from.  This is ignored if
+ *  count is zero.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The specified image data is copied before this function
+ *  returns.
+ *
+ *  @remark @osx The GLFW window has no icon, as it is not a document
+ *  window, so this function does nothing.  The dock icon will be the same as
+ *  the application bundle's icon.  For more information on bundles, see the
+ *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
+ *  in the Mac Developer Library.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_icon
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
+
+/*! @brief Retrieves the position of the client area of the specified window.
+ *
+ *  This function retrieves the position, in screen coordinates, of the
+ *  upper-left corner of the client area of the specified window.
+ *
+ *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` position arguments will be set to zero.
+ *
+ *  @param[in] window The window to query.
+ *  @param[out] xpos Where to store the x-coordinate of the upper-left corner of
+ *  the client area, or `NULL`.
+ *  @param[out] ypos Where to store the y-coordinate of the upper-left corner of
+ *  the client area, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_pos
+ *  @sa glfwSetWindowPos
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
+
+/*! @brief Sets the position of the client area of the specified window.
+ *
+ *  This function sets the position, in screen coordinates, of the upper-left
+ *  corner of the client area of the specified windowed mode window.  If the
+ *  window is a full screen window, this function does nothing.
+ *
+ *  __Do not use this function__ to move an already visible window unless you
+ *  have very good reasons for doing so, as it will confuse and annoy the user.
+ *
+ *  The window manager may put limits on what positions are allowed.  GLFW
+ *  cannot and should not override these limits.
+ *
+ *  @param[in] window The window to query.
+ *  @param[in] xpos The x-coordinate of the upper-left corner of the client area.
+ *  @param[in] ypos The y-coordinate of the upper-left corner of the client area.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_pos
+ *  @sa glfwGetWindowPos
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
+
+/*! @brief Retrieves the size of the client area of the specified window.
+ *
+ *  This function retrieves the size, in screen coordinates, of the client area
+ *  of the specified window.  If you wish to retrieve the size of the
+ *  framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
+ *
+ *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` size arguments will be set to zero.
+ *
+ *  @param[in] window The window whose size to retrieve.
+ *  @param[out] width Where to store the width, in screen coordinates, of the
+ *  client area, or `NULL`.
+ *  @param[out] height Where to store the height, in screen coordinates, of the
+ *  client area, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_size
+ *  @sa glfwSetWindowSize
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
+
+/*! @brief Sets the size limits of the specified window.
+ *
+ *  This function sets the size limits of the client area of the specified
+ *  window.  If the window is full screen, the size limits only take effect
+ *  once it is made windowed.  If the window is not resizable, this function
+ *  does nothing.
+ *
+ *  The size limits are applied immediately to a windowed mode window and may
+ *  cause it to be resized.
+ *
+ *  The maximum dimensions must be greater than or equal to the minimum
+ *  dimensions and all must be greater than or equal to zero.
+ *
+ *  @param[in] window The window to set limits for.
+ *  @param[in] minwidth The minimum width, in screen coordinates, of the client
+ *  area, or `GLFW_DONT_CARE`.
+ *  @param[in] minheight The minimum height, in screen coordinates, of the
+ *  client area, or `GLFW_DONT_CARE`.
+ *  @param[in] maxwidth The maximum width, in screen coordinates, of the client
+ *  area, or `GLFW_DONT_CARE`.
+ *  @param[in] maxheight The maximum height, in screen coordinates, of the
+ *  client area, or `GLFW_DONT_CARE`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark If you set size limits and an aspect ratio that conflict, the
+ *  results are undefined.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_sizelimits
+ *  @sa glfwSetWindowAspectRatio
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+
+/*! @brief Sets the aspect ratio of the specified window.
+ *
+ *  This function sets the required aspect ratio of the client area of the
+ *  specified window.  If the window is full screen, the aspect ratio only takes
+ *  effect once it is made windowed.  If the window is not resizable, this
+ *  function does nothing.
+ *
+ *  The aspect ratio is specified as a numerator and a denominator and both
+ *  values must be greater than zero.  For example, the common 16:9 aspect ratio
+ *  is specified as 16 and 9, respectively.
+ *
+ *  If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
+ *  ratio limit is disabled.
+ *
+ *  The aspect ratio is applied immediately to a windowed mode window and may
+ *  cause it to be resized.
+ *
+ *  @param[in] window The window to set limits for.
+ *  @param[in] numer The numerator of the desired aspect ratio, or
+ *  `GLFW_DONT_CARE`.
+ *  @param[in] denom The denominator of the desired aspect ratio, or
+ *  `GLFW_DONT_CARE`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark If you set size limits and an aspect ratio that conflict, the
+ *  results are undefined.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_sizelimits
+ *  @sa glfwSetWindowSizeLimits
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
+
+/*! @brief Sets the size of the client area of the specified window.
+ *
+ *  This function sets the size, in screen coordinates, of the client area of
+ *  the specified window.
+ *
+ *  For full screen windows, this function updates the resolution of its desired
+ *  video mode and switches to the video mode closest to it, without affecting
+ *  the window's context.  As the context is unaffected, the bit depths of the
+ *  framebuffer remain unchanged.
+ *
+ *  If you wish to update the refresh rate of the desired video mode in addition
+ *  to its resolution, see @ref glfwSetWindowMonitor.
+ *
+ *  The window manager may put limits on what sizes are allowed.  GLFW cannot
+ *  and should not override these limits.
+ *
+ *  @param[in] window The window to resize.
+ *  @param[in] width The desired width, in screen coordinates, of the window
+ *  client area.
+ *  @param[in] height The desired height, in screen coordinates, of the window
+ *  client area.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_size
+ *  @sa glfwGetWindowSize
+ *  @sa glfwSetWindowMonitor
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
+
+/*! @brief Retrieves the size of the framebuffer of the specified window.
+ *
+ *  This function retrieves the size, in pixels, of the framebuffer of the
+ *  specified window.  If you wish to retrieve the size of the window in screen
+ *  coordinates, see @ref glfwGetWindowSize.
+ *
+ *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` size arguments will be set to zero.
+ *
+ *  @param[in] window The window whose framebuffer to query.
+ *  @param[out] width Where to store the width, in pixels, of the framebuffer,
+ *  or `NULL`.
+ *  @param[out] height Where to store the height, in pixels, of the framebuffer,
+ *  or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_fbsize
+ *  @sa glfwSetFramebufferSizeCallback
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
+
+/*! @brief Retrieves the size of the frame of the window.
+ *
+ *  This function retrieves the size, in screen coordinates, of each edge of the
+ *  frame of the specified window.  This size includes the title bar, if the
+ *  window has one.  The size of the frame may vary depending on the
+ *  [window-related hints](@ref window_hints_wnd) used to create it.
+ *
+ *  Because this function retrieves the size of each window frame edge and not
+ *  the offset along a particular coordinate axis, the retrieved values will
+ *  always be zero or positive.
+ *
+ *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` size arguments will be set to zero.
+ *
+ *  @param[in] window The window whose frame size to query.
+ *  @param[out] left Where to store the size, in screen coordinates, of the left
+ *  edge of the window frame, or `NULL`.
+ *  @param[out] top Where to store the size, in screen coordinates, of the top
+ *  edge of the window frame, or `NULL`.
+ *  @param[out] right Where to store the size, in screen coordinates, of the
+ *  right edge of the window frame, or `NULL`.
+ *  @param[out] bottom Where to store the size, in screen coordinates, of the
+ *  bottom edge of the window frame, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_size
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+
+/*! @brief Iconifies the specified window.
+ *
+ *  This function iconifies (minimizes) the specified window if it was
+ *  previously restored.  If the window is already iconified, this function does
+ *  nothing.
+ *
+ *  If the specified window is a full screen window, the original monitor
+ *  resolution is restored until the window is restored.
+ *
+ *  @param[in] window The window to iconify.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_iconify
+ *  @sa glfwRestoreWindow
+ *  @sa glfwMaximizeWindow
+ *
+ *  @since Added in version 2.1.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
+
+/*! @brief Restores the specified window.
+ *
+ *  This function restores the specified window if it was previously iconified
+ *  (minimized) or maximized.  If the window is already restored, this function
+ *  does nothing.
+ *
+ *  If the specified window is a full screen window, the resolution chosen for
+ *  the window is restored on the selected monitor.
+ *
+ *  @param[in] window The window to restore.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_iconify
+ *  @sa glfwIconifyWindow
+ *  @sa glfwMaximizeWindow
+ *
+ *  @since Added in version 2.1.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
+
+/*! @brief Maximizes the specified window.
+ *
+ *  This function maximizes the specified window if it was previously not
+ *  maximized.  If the window is already maximized, this function does nothing.
+ *
+ *  If the specified window is a full screen window, this function does nothing.
+ *
+ *  @param[in] window The window to maximize.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @par Thread Safety
+ *  This function may only be called from the main thread.
+ *
+ *  @sa @ref window_iconify
+ *  @sa glfwIconifyWindow
+ *  @sa glfwRestoreWindow
+ *
+ *  @since Added in GLFW 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
+
+/*! @brief Makes the specified window visible.
+ *
+ *  This function makes the specified window visible if it was previously
+ *  hidden.  If the window is already visible or is in full screen mode, this
+ *  function does nothing.
+ *
+ *  @param[in] window The window to make visible.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_hide
+ *  @sa glfwHideWindow
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwShowWindow(GLFWwindow* window);
+
+/*! @brief Hides the specified window.
+ *
+ *  This function hides the specified window if it was previously visible.  If
+ *  the window is already hidden or is in full screen mode, this function does
+ *  nothing.
+ *
+ *  @param[in] window The window to hide.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_hide
+ *  @sa glfwShowWindow
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwHideWindow(GLFWwindow* window);
+
+/*! @brief Brings the specified window to front and sets input focus.
+ *
+ *  This function brings the specified window to front and sets input focus.
+ *  The window should already be visible and not iconified.
+ *
+ *  By default, both windowed and full screen mode windows are focused when
+ *  initially created.  Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable
+ *  this behavior.
+ *
+ *  __Do not use this function__ to steal focus from other applications unless
+ *  you are certain that is what the user wants.  Focus stealing can be
+ *  extremely disruptive.
+ *
+ *  @param[in] window The window to give input focus.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_focus
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwFocusWindow(GLFWwindow* window);
+
+/*! @brief Returns the monitor that the window uses for full screen mode.
+ *
+ *  This function returns the handle of the monitor that the specified window is
+ *  in full screen on.
+ *
+ *  @param[in] window The window to query.
+ *  @return The monitor, or `NULL` if the window is in windowed mode or an error
+ *  occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_monitor
+ *  @sa glfwSetWindowMonitor
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
+
+/*! @brief Sets the mode, monitor, video mode and placement of a window.
+ *
+ *  This function sets the monitor that the window uses for full screen mode or,
+ *  if the monitor is `NULL`, makes it windowed mode.
+ *
+ *  When setting a monitor, this function updates the width, height and refresh
+ *  rate of the desired video mode and switches to the video mode closest to it.
+ *  The window position is ignored when setting a monitor.
+ *
+ *  When the monitor is `NULL`, the position, width and height are used to
+ *  place the window client area.  The refresh rate is ignored when no monitor
+ *  is specified.
+ *
+ *  If you only wish to update the resolution of a full screen window or the
+ *  size of a windowed mode window, see @ref glfwSetWindowSize.
+ *
+ *  When a window transitions from full screen to windowed mode, this function
+ *  restores any previous window settings such as whether it is decorated,
+ *  floating, resizable, has size or aspect ratio limits, etc..
+ *
+ *  @param[in] window The window whose monitor, size or video mode to set.
+ *  @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
+ *  @param[in] xpos The desired x-coordinate of the upper-left corner of the
+ *  client area.
+ *  @param[in] ypos The desired y-coordinate of the upper-left corner of the
+ *  client area.
+ *  @param[in] width The desired with, in screen coordinates, of the client area
+ *  or video mode.
+ *  @param[in] height The desired height, in screen coordinates, of the client
+ *  area or video mode.
+ *  @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
+ *  or `GLFW_DONT_CARE`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_monitor
+ *  @sa @ref window_full_screen
+ *  @sa glfwGetWindowMonitor
+ *  @sa glfwSetWindowSize
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+
+/*! @brief Returns an attribute of the specified window.
+ *
+ *  This function returns the value of an attribute of the specified window or
+ *  its OpenGL or OpenGL ES context.
+ *
+ *  @param[in] window The window to query.
+ *  @param[in] attrib The [window attribute](@ref window_attribs) whose value to
+ *  return.
+ *  @return The value of the attribute, or zero if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark Framebuffer related hints are not window attributes.  See @ref
+ *  window_attribs_fb for more information.
+ *
+ *  @remark Zero is a valid value for many window and context related
+ *  attributes so you cannot use a return value of zero as an indication of
+ *  errors.  However, this function should not fail as long as it is passed
+ *  valid arguments and the library has been [initialized](@ref intro_init).
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_attribs
+ *
+ *  @since Added in version 3.0.  Replaces `glfwGetWindowParam` and
+ *  `glfwGetGLVersion`.
+ *
+ *  @ingroup window
+ */
+GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
+
+/*! @brief Sets the user pointer of the specified window.
+ *
+ *  This function sets the user-defined pointer of the specified window.  The
+ *  current value is retained until the window is destroyed.  The initial value
+ *  is `NULL`.
+ *
+ *  @param[in] window The window whose pointer to set.
+ *  @param[in] pointer The new value.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @sa @ref window_userptr
+ *  @sa glfwGetWindowUserPointer
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
+
+/*! @brief Returns the user pointer of the specified window.
+ *
+ *  This function returns the current value of the user-defined pointer of the
+ *  specified window.  The initial value is `NULL`.
+ *
+ *  @param[in] window The window whose pointer to return.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @sa @ref window_userptr
+ *  @sa glfwSetWindowUserPointer
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
+
+/*! @brief Sets the position callback for the specified window.
+ *
+ *  This function sets the position callback of the specified window, which is
+ *  called when the window is moved.  The callback is provided with the screen
+ *  position of the upper-left corner of the client area of the window.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_pos
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
+
+/*! @brief Sets the size callback for the specified window.
+ *
+ *  This function sets the size callback of the specified window, which is
+ *  called when the window is resized.  The callback is provided with the size,
+ *  in screen coordinates, of the client area of the window.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_size
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
+
+/*! @brief Sets the close callback for the specified window.
+ *
+ *  This function sets the close callback of the specified window, which is
+ *  called when the user attempts to close the window, for example by clicking
+ *  the close widget in the title bar.
+ *
+ *  The close flag is set before this callback is called, but you can modify it
+ *  at any time with @ref glfwSetWindowShouldClose.
+ *
+ *  The close callback is not triggered by @ref glfwDestroyWindow.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @remark @osx Selecting Quit from the application menu will trigger the close
+ *  callback for all windows.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_close
+ *
+ *  @since Added in version 2.5.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
+
+/*! @brief Sets the refresh callback for the specified window.
+ *
+ *  This function sets the refresh callback of the specified window, which is
+ *  called when the client area of the window needs to be redrawn, for example
+ *  if the window has been exposed after having been covered by another window.
+ *
+ *  On compositing window systems such as Aero, Compiz or Aqua, where the window
+ *  contents are saved off-screen, this callback may be called only very
+ *  infrequently or never at all.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_refresh
+ *
+ *  @since Added in version 2.5.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
+
+/*! @brief Sets the focus callback for the specified window.
+ *
+ *  This function sets the focus callback of the specified window, which is
+ *  called when the window gains or loses input focus.
+ *
+ *  After the focus callback is called for a window that lost input focus,
+ *  synthetic key and mouse button release events will be generated for all such
+ *  that had been pressed.  For more information, see @ref glfwSetKeyCallback
+ *  and @ref glfwSetMouseButtonCallback.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_focus
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
+
+/*! @brief Sets the iconify callback for the specified window.
+ *
+ *  This function sets the iconification callback of the specified window, which
+ *  is called when the window is iconified or restored.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_iconify
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
+
+/*! @brief Sets the framebuffer resize callback for the specified window.
+ *
+ *  This function sets the framebuffer resize callback of the specified window,
+ *  which is called when the framebuffer of the specified window is resized.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_fbsize
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
+
+/*! @brief Processes all pending events.
+ *
+ *  This function processes only those events that are already in the event
+ *  queue and then returns immediately.  Processing events will cause the window
+ *  and input callbacks associated with those events to be called.
+ *
+ *  On some platforms, a window move, resize or menu operation will cause event
+ *  processing to block.  This is due to how event processing is designed on
+ *  those platforms.  You can use the
+ *  [window refresh callback](@ref window_refresh) to redraw the contents of
+ *  your window when necessary during such operations.
+ *
+ *  On some platforms, certain events are sent directly to the application
+ *  without going through the event queue, causing callbacks to be called
+ *  outside of a call to one of the event processing functions.
+ *
+ *  Event processing is not required for joystick input to work.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref events
+ *  @sa glfwWaitEvents
+ *  @sa glfwWaitEventsTimeout
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwPollEvents(void);
+
+/*! @brief Waits until events are queued and processes them.
+ *
+ *  This function puts the calling thread to sleep until at least one event is
+ *  available in the event queue.  Once one or more events are available,
+ *  it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
+ *  are processed and the function then returns immediately.  Processing events
+ *  will cause the window and input callbacks associated with those events to be
+ *  called.
+ *
+ *  Since not all events are associated with callbacks, this function may return
+ *  without a callback having been called even if you are monitoring all
+ *  callbacks.
+ *
+ *  On some platforms, a window move, resize or menu operation will cause event
+ *  processing to block.  This is due to how event processing is designed on
+ *  those platforms.  You can use the
+ *  [window refresh callback](@ref window_refresh) to redraw the contents of
+ *  your window when necessary during such operations.
+ *
+ *  On some platforms, certain callbacks may be called outside of a call to one
+ *  of the event processing functions.
+ *
+ *  If no windows exist, this function returns immediately.  For synchronization
+ *  of threads in applications that do not create windows, use your threading
+ *  library of choice.
+ *
+ *  Event processing is not required for joystick input to work.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref events
+ *  @sa glfwPollEvents
+ *  @sa glfwWaitEventsTimeout
+ *
+ *  @since Added in version 2.5.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwWaitEvents(void);
+
+/*! @brief Waits with timeout until events are queued and processes them.
+ *
+ *  This function puts the calling thread to sleep until at least one event is
+ *  available in the event queue, or until the specified timeout is reached.  If
+ *  one or more events are available, it behaves exactly like @ref
+ *  glfwPollEvents, i.e. the events in the queue are processed and the function
+ *  then returns immediately.  Processing events will cause the window and input
+ *  callbacks associated with those events to be called.
+ *
+ *  The timeout value must be a positive finite number.
+ *
+ *  Since not all events are associated with callbacks, this function may return
+ *  without a callback having been called even if you are monitoring all
+ *  callbacks.
+ *
+ *  On some platforms, a window move, resize or menu operation will cause event
+ *  processing to block.  This is due to how event processing is designed on
+ *  those platforms.  You can use the
+ *  [window refresh callback](@ref window_refresh) to redraw the contents of
+ *  your window when necessary during such operations.
+ *
+ *  On some platforms, certain callbacks may be called outside of a call to one
+ *  of the event processing functions.
+ *
+ *  If no windows exist, this function returns immediately.  For synchronization
+ *  of threads in applications that do not create windows, use your threading
+ *  library of choice.
+ *
+ *  Event processing is not required for joystick input to work.
+ *
+ *  @param[in] timeout The maximum amount of time, in seconds, to wait.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref events
+ *  @sa glfwPollEvents
+ *  @sa glfwWaitEvents
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwWaitEventsTimeout(double timeout);
+
+/*! @brief Posts an empty event to the event queue.
+ *
+ *  This function posts an empty event from the current thread to the event
+ *  queue, causing @ref glfwWaitEvents to return.
+ *
+ *  If no windows exist, this function returns immediately.  For synchronization
+ *  of threads in applications that do not create windows, use your threading
+ *  library of choice.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref events
+ *  @sa glfwWaitEvents
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwPostEmptyEvent(void);
+
+/*! @brief Returns the value of an input option for the specified window.
+ *
+ *  This function returns the value of an input option for the specified window.
+ *  The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
+ *  `GLFW_STICKY_MOUSE_BUTTONS`.
+ *
+ *  @param[in] window The window to query.
+ *  @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
+ *  `GLFW_STICKY_MOUSE_BUTTONS`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_INVALID_ENUM.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa glfwSetInputMode
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
+
+/*! @brief Sets an input option for the specified window.
+ *
+ *  This function sets an input mode option for the specified window.  The mode
+ *  must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
+ *  `GLFW_STICKY_MOUSE_BUTTONS`.
+ *
+ *  If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
+ *  modes:
+ *  - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
+ *  - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
+ *    area of the window but does not restrict the cursor from leaving.
+ *  - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
+ *    and unlimited cursor movement.  This is useful for implementing for
+ *    example 3D camera controls.
+ *
+ *  If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
+ *  enable sticky keys, or `GLFW_FALSE` to disable it.  If sticky keys are
+ *  enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
+ *  the next time it is called even if the key had been released before the
+ *  call.  This is useful when you are only interested in whether keys have been
+ *  pressed but not when or in which order.
+ *
+ *  If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
+ *  `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
+ *  If sticky mouse buttons are enabled, a mouse button press will ensure that
+ *  @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
+ *  if the mouse button had been released before the call.  This is useful when
+ *  you are only interested in whether mouse buttons have been pressed but not
+ *  when or in which order.
+ *
+ *  @param[in] window The window whose input mode to set.
+ *  @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
+ *  `GLFW_STICKY_MOUSE_BUTTONS`.
+ *  @param[in] value The new value of the specified input mode.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa glfwGetInputMode
+ *
+ *  @since Added in version 3.0.  Replaces `glfwEnable` and `glfwDisable`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
+
+/*! @brief Returns the localized name of the specified printable key.
+ *
+ *  This function returns the localized name of the specified printable key.
+ *  This is intended for displaying key bindings to the user.
+ *
+ *  If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
+ *  the scancode is ignored.  If a non-printable key or (if the key is
+ *  `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
+ *  specified, this function returns `NULL`.          
+ *
+ *  This behavior allows you to pass in the arguments passed to the
+ *  [key callback](@ref input_key) without modification.
+ *
+ *  The printable keys are:
+ *  - `GLFW_KEY_APOSTROPHE`
+ *  - `GLFW_KEY_COMMA`
+ *  - `GLFW_KEY_MINUS`
+ *  - `GLFW_KEY_PERIOD`
+ *  - `GLFW_KEY_SLASH`
+ *  - `GLFW_KEY_SEMICOLON`
+ *  - `GLFW_KEY_EQUAL`
+ *  - `GLFW_KEY_LEFT_BRACKET`
+ *  - `GLFW_KEY_RIGHT_BRACKET`
+ *  - `GLFW_KEY_BACKSLASH`
+ *  - `GLFW_KEY_WORLD_1`
+ *  - `GLFW_KEY_WORLD_2`
+ *  - `GLFW_KEY_0` to `GLFW_KEY_9`
+ *  - `GLFW_KEY_A` to `GLFW_KEY_Z`
+ *  - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
+ *  - `GLFW_KEY_KP_DECIMAL`
+ *  - `GLFW_KEY_KP_DIVIDE`
+ *  - `GLFW_KEY_KP_MULTIPLY`
+ *  - `GLFW_KEY_KP_SUBTRACT`
+ *  - `GLFW_KEY_KP_ADD`
+ *  - `GLFW_KEY_KP_EQUAL`
+ *
+ *  @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
+ *  @param[in] scancode The scancode of the key to query.
+ *  @return The localized name of the key, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the next call to @ref
+ *  glfwGetKeyName, or until the library is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_key_name
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup input
+ */
+GLFWAPI const char* glfwGetKeyName(int key, int scancode);
+
+/*! @brief Returns the last reported state of a keyboard key for the specified
+ *  window.
+ *
+ *  This function returns the last state reported for the specified key to the
+ *  specified window.  The returned state is one of `GLFW_PRESS` or
+ *  `GLFW_RELEASE`.  The higher-level action `GLFW_REPEAT` is only reported to
+ *  the key callback.
+ *
+ *  If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
+ *  `GLFW_PRESS` the first time you call it for a key that was pressed, even if
+ *  that key has already been released.
+ *
+ *  The key functions deal with physical keys, with [key tokens](@ref keys)
+ *  named after their use on the standard US keyboard layout.  If you want to
+ *  input text, use the Unicode character callback instead.
+ *
+ *  The [modifier key bit masks](@ref mods) are not key tokens and cannot be
+ *  used with this function.
+ *
+ *  __Do not use this function__ to implement [text input](@ref input_char).
+ *
+ *  @param[in] window The desired window.
+ *  @param[in] key The desired [keyboard key](@ref keys).  `GLFW_KEY_UNKNOWN` is
+ *  not a valid key for this function.
+ *  @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_INVALID_ENUM.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_key
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup input
+ */
+GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
+
+/*! @brief Returns the last reported state of a mouse button for the specified
+ *  window.
+ *
+ *  This function returns the last state reported for the specified mouse button
+ *  to the specified window.  The returned state is one of `GLFW_PRESS` or
+ *  `GLFW_RELEASE`.
+ *
+ *  If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
+ *  `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
+ *  even if that mouse button has already been released.
+ *
+ *  @param[in] window The desired window.
+ *  @param[in] button The desired [mouse button](@ref buttons).
+ *  @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_INVALID_ENUM.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_mouse_button
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup input
+ */
+GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
+
+/*! @brief Retrieves the position of the cursor relative to the client area of
+ *  the window.
+ *
+ *  This function returns the position of the cursor, in screen coordinates,
+ *  relative to the upper-left corner of the client area of the specified
+ *  window.
+ *
+ *  If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
+ *  position is unbounded and limited only by the minimum and maximum values of
+ *  a `double`.
+ *
+ *  The coordinate can be converted to their integer equivalents with the
+ *  `floor` function.  Casting directly to an integer type works for positive
+ *  coordinates, but fails for negative ones.
+ *
+ *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
+ *  non-`NULL` position arguments will be set to zero.
+ *
+ *  @param[in] window The desired window.
+ *  @param[out] xpos Where to store the cursor x-coordinate, relative to the
+ *  left edge of the client area, or `NULL`.
+ *  @param[out] ypos Where to store the cursor y-coordinate, relative to the to
+ *  top edge of the client area, or `NULL`.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_pos
+ *  @sa glfwSetCursorPos
+ *
+ *  @since Added in version 3.0.  Replaces `glfwGetMousePos`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
+
+/*! @brief Sets the position of the cursor, relative to the client area of the
+ *  window.
+ *
+ *  This function sets the position, in screen coordinates, of the cursor
+ *  relative to the upper-left corner of the client area of the specified
+ *  window.  The window must have input focus.  If the window does not have
+ *  input focus when this function is called, it fails silently.
+ *
+ *  __Do not use this function__ to implement things like camera controls.  GLFW
+ *  already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
+ *  cursor, transparently re-centers it and provides unconstrained cursor
+ *  motion.  See @ref glfwSetInputMode for more information.
+ *
+ *  If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
+ *  unconstrained and limited only by the minimum and maximum values of
+ *  a `double`.
+ *
+ *  @param[in] window The desired window.
+ *  @param[in] xpos The desired x-coordinate, relative to the left edge of the
+ *  client area.
+ *  @param[in] ypos The desired y-coordinate, relative to the top edge of the
+ *  client area.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_pos
+ *  @sa glfwGetCursorPos
+ *
+ *  @since Added in version 3.0.  Replaces `glfwSetMousePos`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
+
+/*! @brief Creates a custom cursor.
+ *
+ *  Creates a new custom cursor image that can be set for a window with @ref
+ *  glfwSetCursor.  The cursor can be destroyed with @ref glfwDestroyCursor.
+ *  Any remaining cursors are destroyed by @ref glfwTerminate.
+ *
+ *  The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
+ *  bits per channel.  They are arranged canonically as packed sequential rows,
+ *  starting from the top-left corner.
+ *
+ *  The cursor hotspot is specified in pixels, relative to the upper-left corner
+ *  of the cursor image.  Like all other coordinate systems in GLFW, the X-axis
+ *  points to the right and the Y-axis points down.
+ *
+ *  @param[in] image The desired cursor image.
+ *  @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
+ *  @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
+ *  @return The handle of the created cursor, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The specified image data is copied before this function
+ *  returns.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_object
+ *  @sa glfwDestroyCursor
+ *  @sa glfwCreateStandardCursor
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
+
+/*! @brief Creates a cursor with a standard shape.
+ *
+ *  Returns a cursor with a [standard shape](@ref shapes), that can be set for
+ *  a window with @ref glfwSetCursor.
+ *
+ *  @param[in] shape One of the [standard shapes](@ref shapes).
+ *  @return A new cursor ready to use or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_object
+ *  @sa glfwCreateCursor
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
+
+/*! @brief Destroys a cursor.
+ *
+ *  This function destroys a cursor previously created with @ref
+ *  glfwCreateCursor.  Any remaining cursors will be destroyed by @ref
+ *  glfwTerminate.
+ *
+ *  @param[in] cursor The cursor object to destroy.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @reentrancy This function must not be called from a callback.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_object
+ *  @sa glfwCreateCursor
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
+
+/*! @brief Sets the cursor for the window.
+ *
+ *  This function sets the cursor image to be used when the cursor is over the
+ *  client area of the specified window.  The set cursor will only be visible
+ *  when the [cursor mode](@ref cursor_mode) of the window is
+ *  `GLFW_CURSOR_NORMAL`.
+ *
+ *  On some platforms, the set cursor may not be visible unless the window also
+ *  has input focus.
+ *
+ *  @param[in] window The window to set the cursor for.
+ *  @param[in] cursor The cursor to set, or `NULL` to switch back to the default
+ *  arrow cursor.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_object
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
+
+/*! @brief Sets the key callback.
+ *
+ *  This function sets the key callback of the specified window, which is called
+ *  when a key is pressed, repeated or released.
+ *
+ *  The key functions deal with physical keys, with layout independent
+ *  [key tokens](@ref keys) named after their values in the standard US keyboard
+ *  layout.  If you want to input text, use the
+ *  [character callback](@ref glfwSetCharCallback) instead.
+ *
+ *  When a window loses input focus, it will generate synthetic key release
+ *  events for all pressed keys.  You can tell these events from user-generated
+ *  events by the fact that the synthetic ones are generated after the focus
+ *  loss event has been processed, i.e. after the
+ *  [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
+ *
+ *  The scancode of a key is specific to that platform or sometimes even to that
+ *  machine.  Scancodes are intended to allow users to bind keys that don't have
+ *  a GLFW key token.  Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
+ *  state is not saved and so it cannot be queried with @ref glfwGetKey.
+ *
+ *  Sometimes GLFW needs to generate synthetic key events, in which case the
+ *  scancode may be zero.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new key callback, or `NULL` to remove the currently
+ *  set callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_key
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
+
+/*! @brief Sets the Unicode character callback.
+ *
+ *  This function sets the character callback of the specified window, which is
+ *  called when a Unicode character is input.
+ *
+ *  The character callback is intended for Unicode text input.  As it deals with
+ *  characters, it is keyboard layout dependent, whereas the
+ *  [key callback](@ref glfwSetKeyCallback) is not.  Characters do not map 1:1
+ *  to physical keys, as a key may produce zero, one or more characters.  If you
+ *  want to know whether a specific physical key was pressed or released, see
+ *  the key callback instead.
+ *
+ *  The character callback behaves as system text input normally does and will
+ *  not be called if modifier keys are held down that would prevent normal text
+ *  input on that platform, for example a Super (Command) key on OS X or Alt key
+ *  on Windows.  There is a
+ *  [character with modifiers callback](@ref glfwSetCharModsCallback) that
+ *  receives these events.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_char
+ *
+ *  @since Added in version 2.4.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
+
+/*! @brief Sets the Unicode character with modifiers callback.
+ *
+ *  This function sets the character with modifiers callback of the specified
+ *  window, which is called when a Unicode character is input regardless of what
+ *  modifier keys are used.
+ *
+ *  The character with modifiers callback is intended for implementing custom
+ *  Unicode character input.  For regular Unicode text input, see the
+ *  [character callback](@ref glfwSetCharCallback).  Like the character
+ *  callback, the character with modifiers callback deals with characters and is
+ *  keyboard layout dependent.  Characters do not map 1:1 to physical keys, as
+ *  a key may produce zero, one or more characters.  If you want to know whether
+ *  a specific physical key was pressed or released, see the
+ *  [key callback](@ref glfwSetKeyCallback) instead.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or an
+ *  error occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_char
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
+
+/*! @brief Sets the mouse button callback.
+ *
+ *  This function sets the mouse button callback of the specified window, which
+ *  is called when a mouse button is pressed or released.
+ *
+ *  When a window loses input focus, it will generate synthetic mouse button
+ *  release events for all pressed mouse buttons.  You can tell these events
+ *  from user-generated events by the fact that the synthetic ones are generated
+ *  after the focus loss event has been processed, i.e. after the
+ *  [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref input_mouse_button
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter and return value.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
+
+/*! @brief Sets the cursor position callback.
+ *
+ *  This function sets the cursor position callback of the specified window,
+ *  which is called when the cursor is moved.  The callback is provided with the
+ *  position, in screen coordinates, relative to the upper-left corner of the
+ *  client area of the window.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_pos
+ *
+ *  @since Added in version 3.0.  Replaces `glfwSetMousePosCallback`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
+
+/*! @brief Sets the cursor enter/exit callback.
+ *
+ *  This function sets the cursor boundary crossing callback of the specified
+ *  window, which is called when the cursor enters or leaves the client area of
+ *  the window.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref cursor_enter
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
+
+/*! @brief Sets the scroll callback.
+ *
+ *  This function sets the scroll callback of the specified window, which is
+ *  called when a scrolling device is used, such as a mouse wheel or scrolling
+ *  area of a touchpad.
+ *
+ *  The scroll callback receives all scrolling input, like that from a mouse
+ *  wheel or a touchpad scrolling area.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
+ *  set callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref scrolling
+ *
+ *  @since Added in version 3.0.  Replaces `glfwSetMouseWheelCallback`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
+
+/*! @brief Sets the file drop callback.
+ *
+ *  This function sets the file drop callback of the specified window, which is
+ *  called when one or more dragged files are dropped on the window.
+ *
+ *  Because the path array and its strings may have been generated specifically
+ *  for that event, they are not guaranteed to be valid after the callback has
+ *  returned.  If you wish to use them after the callback returns, you need to
+ *  make a deep copy.
+ *
+ *  @param[in] window The window whose callback to set.
+ *  @param[in] cbfun The new file drop callback, or `NULL` to remove the
+ *  currently set callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref path_drop
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
+
+/*! @brief Returns whether the specified joystick is present.
+ *
+ *  This function returns whether the specified joystick is present.
+ *
+ *  @param[in] joy The [joystick](@ref joysticks) to query.
+ *  @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref joystick
+ *
+ *  @since Added in version 3.0.  Replaces `glfwGetJoystickParam`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI int glfwJoystickPresent(int joy);
+
+/*! @brief Returns the values of all axes of the specified joystick.
+ *
+ *  This function returns the values of all axes of the specified joystick.
+ *  Each element in the array is a value between -1.0 and 1.0.
+ *
+ *  Querying a joystick slot with no device present is not an error, but will
+ *  cause this function to return `NULL`.  Call @ref glfwJoystickPresent to
+ *  check device presence.
+ *
+ *  @param[in] joy The [joystick](@ref joysticks) to query.
+ *  @param[out] count Where to store the number of axis values in the returned
+ *  array.  This is set to zero if an error occurred.
+ *  @return An array of axis values, or `NULL` if the joystick is not present.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified joystick is
+ *  disconnected, this function is called again for that joystick or the library
+ *  is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref joystick_axis
+ *
+ *  @since Added in version 3.0.  Replaces `glfwGetJoystickPos`.
+ *
+ *  @ingroup input
+ */
+GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
+
+/*! @brief Returns the state of all buttons of the specified joystick.
+ *
+ *  This function returns the state of all buttons of the specified joystick.
+ *  Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ *  Querying a joystick slot with no device present is not an error, but will
+ *  cause this function to return `NULL`.  Call @ref glfwJoystickPresent to
+ *  check device presence.
+ *
+ *  @param[in] joy The [joystick](@ref joysticks) to query.
+ *  @param[out] count Where to store the number of button states in the returned
+ *  array.  This is set to zero if an error occurred.
+ *  @return An array of button states, or `NULL` if the joystick is not present.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified joystick is
+ *  disconnected, this function is called again for that joystick or the library
+ *  is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref joystick_button
+ *
+ *  @since Added in version 2.2.
+ *  @glfw3 Changed to return a dynamic array.
+ *
+ *  @ingroup input
+ */
+GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
+
+/*! @brief Returns the name of the specified joystick.
+ *
+ *  This function returns the name, encoded as UTF-8, of the specified joystick.
+ *  The returned string is allocated and freed by GLFW.  You should not free it
+ *  yourself.
+ *
+ *  Querying a joystick slot with no device present is not an error, but will
+ *  cause this function to return `NULL`.  Call @ref glfwJoystickPresent to
+ *  check device presence.
+ *
+ *  @param[in] joy The [joystick](@ref joysticks) to query.
+ *  @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
+ *  is not present.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the specified joystick is
+ *  disconnected, this function is called again for that joystick or the library
+ *  is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref joystick_name
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI const char* glfwGetJoystickName(int joy);
+
+/*! @brief Sets the joystick configuration callback.
+ *
+ *  This function sets the joystick configuration callback, or removes the
+ *  currently set callback.  This is called when a joystick is connected to or
+ *  disconnected from the system.
+ *
+ *  @param[in] cbfun The new callback, or `NULL` to remove the currently set
+ *  callback.
+ *  @return The previously set callback, or `NULL` if no callback was set or the
+ *  library had not been [initialized](@ref intro_init).
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref joystick_event
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup input
+ */
+GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
+
+/*! @brief Sets the clipboard to the specified string.
+ *
+ *  This function sets the system clipboard to the specified, UTF-8 encoded
+ *  string.
+ *
+ *  @param[in] window The window that will own the clipboard contents.
+ *  @param[in] string A UTF-8 encoded string.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The specified string is copied before this function
+ *  returns.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref clipboard
+ *  @sa glfwGetClipboardString
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
+
+/*! @brief Returns the contents of the clipboard as a string.
+ *
+ *  This function returns the contents of the system clipboard, if it contains
+ *  or is convertible to a UTF-8 encoded string.  If the clipboard is empty or
+ *  if its contents cannot be converted, `NULL` is returned and a @ref
+ *  GLFW_FORMAT_UNAVAILABLE error is generated.
+ *
+ *  @param[in] window The window that will request the clipboard contents.
+ *  @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
+ *  if an [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the next call to @ref
+ *  glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
+ *  is terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref clipboard
+ *  @sa glfwSetClipboardString
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
+
+/*! @brief Returns the value of the GLFW timer.
+ *
+ *  This function returns the value of the GLFW timer.  Unless the timer has
+ *  been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
+ *  was initialized.
+ *
+ *  The resolution of the timer is system dependent, but is usually on the order
+ *  of a few micro- or nanoseconds.  It uses the highest-resolution monotonic
+ *  time source on each supported platform.
+ *
+ *  @return The current value, in seconds, or zero if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.  Reading and
+ *  writing of the internal timer offset is not atomic, so it needs to be
+ *  externally synchronized with calls to @ref glfwSetTime.
+ *
+ *  @sa @ref time
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup input
+ */
+GLFWAPI double glfwGetTime(void);
+
+/*! @brief Sets the GLFW timer.
+ *
+ *  This function sets the value of the GLFW timer.  It then continues to count
+ *  up from that value.  The value must be a positive finite number less than
+ *  or equal to 18446744073.0, which is approximately 584.5 years.
+ *
+ *  @param[in] time The new value, in seconds.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_INVALID_VALUE.
+ *
+ *  @remark The upper limit of the timer is calculated as
+ *  floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
+ *  storing nanoseconds in 64 bits.  The limit may be increased in the future.
+ *
+ *  @thread_safety This function may be called from any thread.  Reading and
+ *  writing of the internal timer offset is not atomic, so it needs to be
+ *  externally synchronized with calls to @ref glfwGetTime.
+ *
+ *  @sa @ref time
+ *
+ *  @since Added in version 2.2.
+ *
+ *  @ingroup input
+ */
+GLFWAPI void glfwSetTime(double time);
+
+/*! @brief Returns the current value of the raw timer.
+ *
+ *  This function returns the current value of the raw timer, measured in
+ *  1&nbsp;/&nbsp;frequency seconds.  To get the frequency, call @ref
+ *  glfwGetTimerFrequency.
+ *
+ *  @return The value of the timer, or zero if an 
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref time
+ *  @sa glfwGetTimerFrequency
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup input
+ */
+GLFWAPI uint64_t glfwGetTimerValue(void);
+
+/*! @brief Returns the frequency, in Hz, of the raw timer.
+ *
+ *  This function returns the frequency, in Hz, of the raw timer.
+ *
+ *  @return The frequency of the timer, in Hz, or zero if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref time
+ *  @sa glfwGetTimerValue
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup input
+ */
+GLFWAPI uint64_t glfwGetTimerFrequency(void);
+
+/*! @brief Makes the context of the specified window current for the calling
+ *  thread.
+ *
+ *  This function makes the OpenGL or OpenGL ES context of the specified window
+ *  current on the calling thread.  A context can only be made current on
+ *  a single thread at a time and each thread can have only a single current
+ *  context at a time.
+ *
+ *  By default, making a context non-current implicitly forces a pipeline flush.
+ *  On machines that support `GL_KHR_context_flush_control`, you can control
+ *  whether a context performs this flush by setting the
+ *  [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
+ *
+ *  The specified window must have an OpenGL or OpenGL ES context.  Specifying
+ *  a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
+ *  error.
+ *
+ *  @param[in] window The window whose context to make current, or `NULL` to
+ *  detach the current context.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref context_current
+ *  @sa glfwGetCurrentContext
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup context
+ */
+GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
+
+/*! @brief Returns the window whose context is current on the calling thread.
+ *
+ *  This function returns the window whose OpenGL or OpenGL ES context is
+ *  current on the calling thread.
+ *
+ *  @return The window whose context is current, or `NULL` if no window's
+ *  context is current.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref context_current
+ *  @sa glfwMakeContextCurrent
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup context
+ */
+GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
+
+/*! @brief Swaps the front and back buffers of the specified window.
+ *
+ *  This function swaps the front and back buffers of the specified window when
+ *  rendering with OpenGL or OpenGL ES.  If the swap interval is greater than
+ *  zero, the GPU driver waits the specified number of screen updates before
+ *  swapping the buffers.
+ *
+ *  The specified window must have an OpenGL or OpenGL ES context.  Specifying
+ *  a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
+ *  error.
+ *
+ *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
+ *  see `vkQueuePresentKHR` instead.
+ *
+ *  @param[in] window The window whose buffers to swap.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark __EGL:__ The context of the specified window must be current on the
+ *  calling thread.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref buffer_swap
+ *  @sa glfwSwapInterval
+ *
+ *  @since Added in version 1.0.
+ *  @glfw3 Added window handle parameter.
+ *
+ *  @ingroup window
+ */
+GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
+
+/*! @brief Sets the swap interval for the current context.
+ *
+ *  This function sets the swap interval for the current OpenGL or OpenGL ES
+ *  context, i.e. the number of screen updates to wait from the time @ref
+ *  glfwSwapBuffers was called before swapping the buffers and returning.  This
+ *  is sometimes called _vertical synchronization_, _vertical retrace
+ *  synchronization_ or just _vsync_.
+ *
+ *  Contexts that support either of the `WGL_EXT_swap_control_tear` and
+ *  `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
+ *  which allow the driver to swap even if a frame arrives a little bit late.
+ *  You can check for the presence of these extensions using @ref
+ *  glfwExtensionSupported.  For more information about swap tearing, see the
+ *  extension specifications.
+ *
+ *  A context must be current on the calling thread.  Calling this function
+ *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
+ *  see the present mode of your swapchain instead.
+ *
+ *  @param[in] interval The minimum number of screen updates to wait for
+ *  until the buffers are swapped by @ref glfwSwapBuffers.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark This function is not called during context creation, leaving the
+ *  swap interval set to whatever is the default on that platform.  This is done
+ *  because some swap interval extensions used by GLFW do not allow the swap
+ *  interval to be reset to zero once it has been set to a non-zero value.
+ *
+ *  @remark Some GPU drivers do not honor the requested swap interval, either
+ *  because of a user setting that overrides the application's request or due to
+ *  bugs in the driver.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref buffer_swap
+ *  @sa glfwSwapBuffers
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup context
+ */
+GLFWAPI void glfwSwapInterval(int interval);
+
+/*! @brief Returns whether the specified extension is available.
+ *
+ *  This function returns whether the specified
+ *  [API extension](@ref context_glext) is supported by the current OpenGL or
+ *  OpenGL ES context.  It searches both for client API extension and context
+ *  creation API extensions.
+ *
+ *  A context must be current on the calling thread.  Calling this function
+ *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ *  As this functions retrieves and searches one or more extension strings each
+ *  call, it is recommended that you cache its results if it is going to be used
+ *  frequently.  The extension strings will not change during the lifetime of
+ *  a context, so there is no danger in doing this.
+ *
+ *  This function does not apply to Vulkan.  If you are using Vulkan, see @ref
+ *  glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
+ *  and `vkEnumerateDeviceExtensionProperties` instead.
+ *
+ *  @param[in] extension The ASCII encoded name of the extension.
+ *  @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
+ *  otherwise.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
+ *  GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref context_glext
+ *  @sa glfwGetProcAddress
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup context
+ */
+GLFWAPI int glfwExtensionSupported(const char* extension);
+
+/*! @brief Returns the address of the specified function for the current
+ *  context.
+ *
+ *  This function returns the address of the specified OpenGL or OpenGL ES
+ *  [core or extension function](@ref context_glext), if it is supported
+ *  by the current context.
+ *
+ *  A context must be current on the calling thread.  Calling this function
+ *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
+ *  see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
+ *  `vkGetDeviceProcAddr` instead.
+ *
+ *  @param[in] procname The ASCII encoded name of the function.
+ *  @return The address of the function, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remark The address of a given function is not guaranteed to be the same
+ *  between contexts.
+ *
+ *  @remark This function may return a non-`NULL` address despite the
+ *  associated version or extension not being available.  Always check the
+ *  context version or extension string first.
+ *
+ *  @pointer_lifetime The returned function pointer is valid until the context
+ *  is destroyed or the library is terminated.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref context_glext
+ *  @sa glfwExtensionSupported
+ *
+ *  @since Added in version 1.0.
+ *
+ *  @ingroup context
+ */
+GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
+
+/*! @brief Returns whether the Vulkan loader has been found.
+ *
+ *  This function returns whether the Vulkan loader has been found.  This check
+ *  is performed by @ref glfwInit.
+ *
+ *  The availability of a Vulkan loader does not by itself guarantee that window
+ *  surface creation or even device creation is possible.  Call @ref
+ *  glfwGetRequiredInstanceExtensions to check whether the extensions necessary
+ *  for Vulkan surface creation are available and @ref
+ *  glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
+ *  a physical device supports image presentation.
+ *
+ *  @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref vulkan_support
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+GLFWAPI int glfwVulkanSupported(void);
+
+/*! @brief Returns the Vulkan instance extensions required by GLFW.
+ *
+ *  This function returns an array of names of Vulkan instance extensions required
+ *  by GLFW for creating Vulkan surfaces for GLFW windows.  If successful, the
+ *  list will always contains `VK_KHR_surface`, so if you don't require any
+ *  additional extensions you can pass this list directly to the
+ *  `VkInstanceCreateInfo` struct.
+ *
+ *  If Vulkan is not available on the machine, this function returns `NULL` and
+ *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
+ *  to check whether Vulkan is available.
+ *
+ *  If Vulkan is available but no set of extensions allowing window surface
+ *  creation was found, this function returns `NULL`.  You may still use Vulkan
+ *  for off-screen rendering and compute work.
+ *
+ *  @param[out] count Where to store the number of extensions in the returned
+ *  array.  This is set to zero if an error occurred.
+ *  @return An array of ASCII encoded extension names, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_API_UNAVAILABLE.
+ *
+ *  @remarks Additional extensions may be required by future versions of GLFW.
+ *  You should check if any extensions you wish to enable are already in the
+ *  returned array, as it is an error to specify an extension more than once in
+ *  the `VkInstanceCreateInfo` struct.
+ *
+ *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is guaranteed to be valid only until the
+ *  library is terminated.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref vulkan_ext
+ *  @sa glfwCreateWindowSurface
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
+
+#if defined(VK_VERSION_1_0)
+
+/*! @brief Returns the address of the specified Vulkan instance function.
+ *
+ *  This function returns the address of the specified Vulkan core or extension
+ *  function for the specified instance.  If instance is set to `NULL` it can
+ *  return any function exported from the Vulkan loader, including at least the
+ *  following functions:
+ *
+ *  - `vkEnumerateInstanceExtensionProperties`
+ *  - `vkEnumerateInstanceLayerProperties`
+ *  - `vkCreateInstance`
+ *  - `vkGetInstanceProcAddr`
+ *
+ *  If Vulkan is not available on the machine, this function returns `NULL` and
+ *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
+ *  to check whether Vulkan is available.
+ *
+ *  This function is equivalent to calling `vkGetInstanceProcAddr` with
+ *  a platform-specific query of the Vulkan loader as a fallback.
+ *
+ *  @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
+ *  functions related to instance creation.
+ *  @param[in] procname The ASCII encoded name of the function.
+ *  @return The address of the function, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_API_UNAVAILABLE.
+ *
+ *  @pointer_lifetime The returned function pointer is valid until the library
+ *  is terminated.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref vulkan_proc
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
+
+/*! @brief Returns whether the specified queue family can present images.
+ *
+ *  This function returns whether the specified queue family of the specified
+ *  physical device supports presentation to the platform GLFW was built for.
+ *
+ *  If Vulkan or the required window surface creation instance extensions are
+ *  not available on the machine, or if the specified instance was not created
+ *  with the required extensions, this function returns `GLFW_FALSE` and
+ *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
+ *  to check whether Vulkan is available and @ref
+ *  glfwGetRequiredInstanceExtensions to check what instance extensions are
+ *  required.
+ *
+ *  @param[in] instance The instance that the physical device belongs to.
+ *  @param[in] device The physical device that the queue family belongs to.
+ *  @param[in] queuefamily The index of the queue family to query.
+ *  @return `GLFW_TRUE` if the queue family supports presentation, or
+ *  `GLFW_FALSE` otherwise.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @thread_safety This function may be called from any thread.  For
+ *  synchronization details of Vulkan objects, see the Vulkan specification.
+ *
+ *  @sa @ref vulkan_present
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+
+/*! @brief Creates a Vulkan surface for the specified window.
+ *
+ *  This function creates a Vulkan surface for the specified window.
+ *
+ *  If the Vulkan loader was not found at initialization, this function returns
+ *  `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
+ *  error.  Call @ref glfwVulkanSupported to check whether the Vulkan loader was
+ *  found.
+ *
+ *  If the required window surface creation instance extensions are not
+ *  available or if the specified instance was not created with these extensions
+ *  enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
+ *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref
+ *  glfwGetRequiredInstanceExtensions to check what instance extensions are
+ *  required.
+ *
+ *  The window surface must be destroyed before the specified Vulkan instance.
+ *  It is the responsibility of the caller to destroy the window surface.  GLFW
+ *  does not destroy it for you.  Call `vkDestroySurfaceKHR` to destroy the
+ *  surface.
+ *
+ *  @param[in] instance The Vulkan instance to create the surface in.
+ *  @param[in] window The window to create the surface for.
+ *  @param[in] allocator The allocator to use, or `NULL` to use the default
+ *  allocator.
+ *  @param[out] surface Where to store the handle of the surface.  This is set
+ *  to `VK_NULL_HANDLE` if an error occurred.
+ *  @return `VK_SUCCESS` if successful, or a Vulkan error code if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ *  @remarks If an error occurs before the creation call is made, GLFW returns
+ *  the Vulkan error code most appropriate for the error.  Appropriate use of
+ *  @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
+ *  eliminate almost all occurrences of these errors.
+ *
+ *  @thread_safety This function may be called from any thread.  For
+ *  synchronization details of Vulkan objects, see the Vulkan specification.
+ *
+ *  @sa @ref vulkan_surface
+ *  @sa glfwGetRequiredInstanceExtensions
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup vulkan
+ */
+GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+#endif /*VK_VERSION_1_0*/
+
+
+/*************************************************************************
+ * Global definition cleanup
+ *************************************************************************/
+
+/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
+
+#ifdef GLFW_WINGDIAPI_DEFINED
+ #undef WINGDIAPI
+ #undef GLFW_WINGDIAPI_DEFINED
+#endif
+
+#ifdef GLFW_CALLBACK_DEFINED
+ #undef CALLBACK
+ #undef GLFW_CALLBACK_DEFINED
+#endif
+
+/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _glfw3_h_ */
+

+ 456 - 0
project/vs2015/external/glfw3/include/GLFW/glfw3native.h

@@ -0,0 +1,456 @@
+/*************************************************************************
+ * GLFW 3.2 - www.glfw.org
+ * A library for OpenGL, window and input
+ *------------------------------------------------------------------------
+ * Copyright (c) 2002-2006 Marcus Geelnard
+ * Copyright (c) 2006-2016 Camilla Berglund <[email protected]>
+ *
+ * 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.
+ *
+ *************************************************************************/
+
+#ifndef _glfw3_native_h_
+#define _glfw3_native_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*************************************************************************
+ * Doxygen documentation
+ *************************************************************************/
+
+/*! @file glfw3native.h
+ *  @brief The header of the native access functions.
+ *
+ *  This is the header file of the native access functions.  See @ref native for
+ *  more information.
+ */
+/*! @defgroup native Native access
+ *
+ *  **By using the native access functions you assert that you know what you're
+ *  doing and how to fix problems caused by using them.  If you don't, you
+ *  shouldn't be using them.**
+ *
+ *  Before the inclusion of @ref glfw3native.h, you may define exactly one
+ *  window system API macro and zero or more context creation API macros.
+ *
+ *  The chosen backends must match those the library was compiled for.  Failure
+ *  to do this will cause a link-time error.
+ *
+ *  The available window API macros are:
+ *  * `GLFW_EXPOSE_NATIVE_WIN32`
+ *  * `GLFW_EXPOSE_NATIVE_COCOA`
+ *  * `GLFW_EXPOSE_NATIVE_X11`
+ *  * `GLFW_EXPOSE_NATIVE_WAYLAND`
+ *  * `GLFW_EXPOSE_NATIVE_MIR`
+ *
+ *  The available context API macros are:
+ *  * `GLFW_EXPOSE_NATIVE_WGL`
+ *  * `GLFW_EXPOSE_NATIVE_NSGL`
+ *  * `GLFW_EXPOSE_NATIVE_GLX`
+ *  * `GLFW_EXPOSE_NATIVE_EGL`
+ *
+ *  These macros select which of the native access functions that are declared
+ *  and which platform-specific headers to include.  It is then up your (by
+ *  definition platform-specific) code to handle which of these should be
+ *  defined.
+ */
+
+
+/*************************************************************************
+ * System headers and types
+ *************************************************************************/
+
+#if defined(GLFW_EXPOSE_NATIVE_WIN32)
+ // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+ // example to allow applications to correctly declare a GL_ARB_debug_output
+ // callback) but windows.h assumes no one will define APIENTRY before it does
+ #undef APIENTRY
+ #include <windows.h>
+#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
+ #include <ApplicationServices/ApplicationServices.h>
+ #if defined(__OBJC__)
+  #import <Cocoa/Cocoa.h>
+ #else
+  typedef void* id;
+ #endif
+#elif defined(GLFW_EXPOSE_NATIVE_X11)
+ #include <X11/Xlib.h>
+ #include <X11/extensions/Xrandr.h>
+#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
+ #include <wayland-client.h>
+#elif defined(GLFW_EXPOSE_NATIVE_MIR)
+ #include <mir_toolkit/mir_client_library.h>
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_WGL)
+ /* WGL is declared by windows.h */
+#endif
+#if defined(GLFW_EXPOSE_NATIVE_NSGL)
+ /* NSGL is declared by Cocoa.h */
+#endif
+#if defined(GLFW_EXPOSE_NATIVE_GLX)
+ #include <GL/glx.h>
+#endif
+#if defined(GLFW_EXPOSE_NATIVE_EGL)
+ #include <EGL/egl.h>
+#endif
+
+
+/*************************************************************************
+ * Functions
+ *************************************************************************/
+
+#if defined(GLFW_EXPOSE_NATIVE_WIN32)
+/*! @brief Returns the adapter device name of the specified monitor.
+ *
+ *  @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
+ *  of the specified monitor, or `NULL` if an [error](@ref error_handling)
+ *  occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup native
+ */
+GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
+
+/*! @brief Returns the display device name of the specified monitor.
+ *
+ *  @return The UTF-8 encoded display device name (for example
+ *  `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup native
+ */
+GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `HWND` of the specified window.
+ *
+ *  @return The `HWND` of the specified window, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_WGL)
+/*! @brief Returns the `HGLRC` of the specified window.
+ *
+ *  @return The `HGLRC` of the specified window, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_COCOA)
+/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
+ *
+ *  @return The `CGDirectDisplayID` of the specified monitor, or
+ *  `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup native
+ */
+GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `NSWindow` of the specified window.
+ *
+ *  @return The `NSWindow` of the specified window, or `nil` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_NSGL)
+/*! @brief Returns the `NSOpenGLContext` of the specified window.
+ *
+ *  @return The `NSOpenGLContext` of the specified window, or `nil` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_X11)
+/*! @brief Returns the `Display` used by GLFW.
+ *
+ *  @return The `Display` used by GLFW, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI Display* glfwGetX11Display(void);
+
+/*! @brief Returns the `RRCrtc` of the specified monitor.
+ *
+ *  @return The `RRCrtc` of the specified monitor, or `None` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup native
+ */
+GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
+
+/*! @brief Returns the `RROutput` of the specified monitor.
+ *
+ *  @return The `RROutput` of the specified monitor, or `None` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.1.
+ *
+ *  @ingroup native
+ */
+GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `Window` of the specified window.
+ *
+ *  @return The `Window` of the specified window, or `None` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_GLX)
+/*! @brief Returns the `GLXContext` of the specified window.
+ *
+ *  @return The `GLXContext` of the specified window, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
+
+/*! @brief Returns the `GLXWindow` of the specified window.
+ *
+ *  @return The `GLXWindow` of the specified window, or `None` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
+/*! @brief Returns the `struct wl_display*` used by GLFW.
+ *
+ *  @return The `struct wl_display*` used by GLFW, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
+
+/*! @brief Returns the `struct wl_output*` of the specified monitor.
+ *
+ *  @return The `struct wl_output*` of the specified monitor, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the main `struct wl_surface*` of the specified window.
+ *
+ *  @return The main `struct wl_surface*` of the specified window, or `NULL` if
+ *  an [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_MIR)
+/*! @brief Returns the `MirConnection*` used by GLFW.
+ *
+ *  @return The `MirConnection*` used by GLFW, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI MirConnection* glfwGetMirDisplay(void);
+
+/*! @brief Returns the Mir output ID of the specified monitor.
+ *
+ *  @return The Mir output ID of the specified monitor, or zero if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `MirSurface*` of the specified window.
+ *
+ *  @return The `MirSurface*` of the specified window, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.2.
+ *
+ *  @ingroup native
+ */
+GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_EGL)
+/*! @brief Returns the `EGLDisplay` used by GLFW.
+ *
+ *  @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
+
+/*! @brief Returns the `EGLContext` of the specified window.
+ *
+ *  @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
+
+/*! @brief Returns the `EGLSurface` of the specified window.
+ *
+ *  @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.0.
+ *
+ *  @ingroup native
+ */
+GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _glfw3_native_h_ */
+

BIN
project/vs2015/external/glfw3/lib/win32/glfw3.dll


BIN
project/vs2015/external/glfw3/lib/win32/glfw3.lib


BIN
project/vs2015/external/glfw3/lib/win32/glfw3dll.lib


+ 256 - 0
project/vs2015/external/lua/include/lauxlib.h

@@ -0,0 +1,256 @@
+/*
+** $Id: lauxlib.h,v 1.129 2015/11/23 11:29:43 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "lua.h"
+
+
+
+/* extra error code for 'luaL_load' */
+#define LUA_ERRFILE     (LUA_ERRERR+1)
+
+
+typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+
+
+#define LUAL_NUMSIZES	(sizeof(lua_Integer)*16 + sizeof(lua_Number))
+
+LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz);
+#define luaL_checkversion(L)  \
+	  luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
+
+LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
+LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
+LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg);
+LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg,
+                                                          size_t *l);
+LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg,
+                                          const char *def, size_t *l);
+LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg);
+LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def);
+
+LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg);
+LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg,
+                                          lua_Integer def);
+
+LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
+LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t);
+LUALIB_API void (luaL_checkany) (lua_State *L, int arg);
+
+LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
+LUALIB_API void  (luaL_setmetatable) (lua_State *L, const char *tname);
+LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
+LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
+
+LUALIB_API void (luaL_where) (lua_State *L, int lvl);
+LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
+
+LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
+                                   const char *const lst[]);
+
+LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
+LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
+
+/* predefined references */
+#define LUA_NOREF       (-2)
+#define LUA_REFNIL      (-1)
+
+LUALIB_API int (luaL_ref) (lua_State *L, int t);
+LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+
+LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
+                                               const char *mode);
+
+#define luaL_loadfile(L,f)	luaL_loadfilex(L,f,NULL)
+
+LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
+                                   const char *name, const char *mode);
+LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
+
+LUALIB_API lua_State *(luaL_newstate) (void);
+
+LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx);
+
+LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
+                                                  const char *r);
+
+LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
+
+LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
+
+LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
+                                  const char *msg, int level);
+
+LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
+                                 lua_CFunction openf, int glb);
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+
+#define luaL_newlibtable(L,l)	\
+  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
+
+#define luaL_newlib(L,l)  \
+  (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
+
+#define luaL_argcheck(L, cond,arg,extramsg)	\
+		((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
+#define luaL_checkstring(L,n)	(luaL_checklstring(L, (n), NULL))
+#define luaL_optstring(L,n,d)	(luaL_optlstring(L, (n), (d), NULL))
+
+#define luaL_typename(L,i)	lua_typename(L, lua_type(L,(i)))
+
+#define luaL_dofile(L, fn) \
+	(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_dostring(L, s) \
+	(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_getmetatable(L,n)	(lua_getfield(L, LUA_REGISTRYINDEX, (n)))
+
+#define luaL_opt(L,f,n,d)	(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
+
+#define luaL_loadbuffer(L,s,sz,n)	luaL_loadbufferx(L,s,sz,n,NULL)
+
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+typedef struct luaL_Buffer {
+  char *b;  /* buffer address */
+  size_t size;  /* buffer size */
+  size_t n;  /* number of characters in buffer */
+  lua_State *L;
+  char initb[LUAL_BUFFERSIZE];  /* initial buffer */
+} luaL_Buffer;
+
+
+#define luaL_addchar(B,c) \
+  ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
+   ((B)->b[(B)->n++] = (c)))
+
+#define luaL_addsize(B,s)	((B)->n += (s))
+
+LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
+LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
+LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
+LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
+LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
+LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
+
+#define luaL_prepbuffer(B)	luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
+
+/* }====================================================== */
+
+
+
+/*
+** {======================================================
+** File handles for IO library
+** =======================================================
+*/
+
+/*
+** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
+** initial structure 'luaL_Stream' (it may contain other fields
+** after that initial structure).
+*/
+
+#define LUA_FILEHANDLE          "FILE*"
+
+
+typedef struct luaL_Stream {
+  FILE *f;  /* stream (NULL for incompletely created streams) */
+  lua_CFunction closef;  /* to close stream (NULL for closed streams) */
+} luaL_Stream;
+
+/* }====================================================== */
+
+
+
+/* compatibility with old module system */
+#if defined(LUA_COMPAT_MODULE)
+
+LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
+                                   int sizehint);
+LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
+                                const luaL_Reg *l, int nup);
+
+#define luaL_register(L,n,l)	(luaL_openlib(L,(n),(l),0))
+
+#endif
+
+
+/*
+** {==================================================================
+** "Abstraction Layer" for basic report of messages and errors
+** ===================================================================
+*/
+
+/* print a string */
+#if !defined(lua_writestring)
+#define lua_writestring(s,l)   fwrite((s), sizeof(char), (l), stdout)
+#endif
+
+/* print a newline and flush the output */
+#if !defined(lua_writeline)
+#define lua_writeline()        (lua_writestring("\n", 1), fflush(stdout))
+#endif
+
+/* print an error message */
+#if !defined(lua_writestringerror)
+#define lua_writestringerror(s,p) \
+        (fprintf(stderr, (s), (p)), fflush(stderr))
+#endif
+
+/* }================================================================== */
+
+
+/*
+** {============================================================
+** Compatibility with deprecated conversions
+** =============================================================
+*/
+#if defined(LUA_COMPAT_APIINTCASTS)
+
+#define luaL_checkunsigned(L,a)	((lua_Unsigned)luaL_checkinteger(L,a))
+#define luaL_optunsigned(L,a,d)	\
+	((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d)))
+
+#define luaL_checkint(L,n)	((int)luaL_checkinteger(L, (n)))
+#define luaL_optint(L,n,d)	((int)luaL_optinteger(L, (n), (d)))
+
+#define luaL_checklong(L,n)	((long)luaL_checkinteger(L, (n)))
+#define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, (n), (d)))
+
+#endif
+/* }============================================================ */
+
+
+
+#endif
+
+

+ 486 - 0
project/vs2015/external/lua/include/lua.h

@@ -0,0 +1,486 @@
+/*
+** $Id: lua.h,v 1.331 2016/05/30 15:53:28 roberto Exp $
+** Lua - A Scripting Language
+** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+** See Copyright Notice at the end of this file
+*/
+
+
+#ifndef lua_h
+#define lua_h
+
+#include <stdarg.h>
+#include <stddef.h>
+
+
+#include "luaconf.h"
+
+
+#define LUA_VERSION_MAJOR	"5"
+#define LUA_VERSION_MINOR	"3"
+#define LUA_VERSION_NUM		503
+#define LUA_VERSION_RELEASE	"3"
+
+#define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
+#define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
+#define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2016 Lua.org, PUC-Rio"
+#define LUA_AUTHORS	"R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
+
+
+/* mark for precompiled code ('<esc>Lua') */
+#define LUA_SIGNATURE	"\x1bLua"
+
+/* option for multiple returns in 'lua_pcall' and 'lua_call' */
+#define LUA_MULTRET	(-1)
+
+
+/*
+** Pseudo-indices
+** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
+** space after that to help overflow detection)
+*/
+#define LUA_REGISTRYINDEX	(-LUAI_MAXSTACK - 1000)
+#define lua_upvalueindex(i)	(LUA_REGISTRYINDEX - (i))
+
+
+/* thread status */
+#define LUA_OK		0
+#define LUA_YIELD	1
+#define LUA_ERRRUN	2
+#define LUA_ERRSYNTAX	3
+#define LUA_ERRMEM	4
+#define LUA_ERRGCMM	5
+#define LUA_ERRERR	6
+
+
+typedef struct lua_State lua_State;
+
+
+/*
+** basic types
+*/
+#define LUA_TNONE		(-1)
+
+#define LUA_TNIL		0
+#define LUA_TBOOLEAN		1
+#define LUA_TLIGHTUSERDATA	2
+#define LUA_TNUMBER		3
+#define LUA_TSTRING		4
+#define LUA_TTABLE		5
+#define LUA_TFUNCTION		6
+#define LUA_TUSERDATA		7
+#define LUA_TTHREAD		8
+
+#define LUA_NUMTAGS		9
+
+
+
+/* minimum Lua stack available to a C function */
+#define LUA_MINSTACK	20
+
+
+/* predefined values in the registry */
+#define LUA_RIDX_MAINTHREAD	1
+#define LUA_RIDX_GLOBALS	2
+#define LUA_RIDX_LAST		LUA_RIDX_GLOBALS
+
+
+/* type of numbers in Lua */
+typedef LUA_NUMBER lua_Number;
+
+
+/* type for integer functions */
+typedef LUA_INTEGER lua_Integer;
+
+/* unsigned integer type */
+typedef LUA_UNSIGNED lua_Unsigned;
+
+/* type for continuation-function contexts */
+typedef LUA_KCONTEXT lua_KContext;
+
+
+/*
+** Type for C functions registered with Lua
+*/
+typedef int (*lua_CFunction) (lua_State *L);
+
+/*
+** Type for continuation functions
+*/
+typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
+
+
+/*
+** Type for functions that read/write blocks when loading/dumping Lua chunks
+*/
+typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
+
+typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
+
+
+/*
+** Type for memory-allocation functions
+*/
+typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
+
+
+
+/*
+** generic extra include file
+*/
+#if defined(LUA_USER_H)
+#include LUA_USER_H
+#endif
+
+
+/*
+** RCS ident string
+*/
+extern const char lua_ident[];
+
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
+LUA_API void       (lua_close) (lua_State *L);
+LUA_API lua_State *(lua_newthread) (lua_State *L);
+
+LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
+
+
+LUA_API const lua_Number *(lua_version) (lua_State *L);
+
+
+/*
+** basic stack manipulation
+*/
+LUA_API int   (lua_absindex) (lua_State *L, int idx);
+LUA_API int   (lua_gettop) (lua_State *L);
+LUA_API void  (lua_settop) (lua_State *L, int idx);
+LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
+LUA_API void  (lua_rotate) (lua_State *L, int idx, int n);
+LUA_API void  (lua_copy) (lua_State *L, int fromidx, int toidx);
+LUA_API int   (lua_checkstack) (lua_State *L, int n);
+
+LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);
+
+
+/*
+** access functions (stack -> C)
+*/
+
+LUA_API int             (lua_isnumber) (lua_State *L, int idx);
+LUA_API int             (lua_isstring) (lua_State *L, int idx);
+LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
+LUA_API int             (lua_isinteger) (lua_State *L, int idx);
+LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
+LUA_API int             (lua_type) (lua_State *L, int idx);
+LUA_API const char     *(lua_typename) (lua_State *L, int tp);
+
+LUA_API lua_Number      (lua_tonumberx) (lua_State *L, int idx, int *isnum);
+LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
+LUA_API int             (lua_toboolean) (lua_State *L, int idx);
+LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
+LUA_API size_t          (lua_rawlen) (lua_State *L, int idx);
+LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
+LUA_API void	       *(lua_touserdata) (lua_State *L, int idx);
+LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
+LUA_API const void     *(lua_topointer) (lua_State *L, int idx);
+
+
+/*
+** Comparison and arithmetic functions
+*/
+
+#define LUA_OPADD	0	/* ORDER TM, ORDER OP */
+#define LUA_OPSUB	1
+#define LUA_OPMUL	2
+#define LUA_OPMOD	3
+#define LUA_OPPOW	4
+#define LUA_OPDIV	5
+#define LUA_OPIDIV	6
+#define LUA_OPBAND	7
+#define LUA_OPBOR	8
+#define LUA_OPBXOR	9
+#define LUA_OPSHL	10
+#define LUA_OPSHR	11
+#define LUA_OPUNM	12
+#define LUA_OPBNOT	13
+
+LUA_API void  (lua_arith) (lua_State *L, int op);
+
+#define LUA_OPEQ	0
+#define LUA_OPLT	1
+#define LUA_OPLE	2
+
+LUA_API int   (lua_rawequal) (lua_State *L, int idx1, int idx2);
+LUA_API int   (lua_compare) (lua_State *L, int idx1, int idx2, int op);
+
+
+/*
+** push functions (C -> stack)
+*/
+LUA_API void        (lua_pushnil) (lua_State *L);
+LUA_API void        (lua_pushnumber) (lua_State *L, lua_Number n);
+LUA_API void        (lua_pushinteger) (lua_State *L, lua_Integer n);
+LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len);
+LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
+LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
+                                                      va_list argp);
+LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
+LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
+LUA_API void  (lua_pushboolean) (lua_State *L, int b);
+LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
+LUA_API int   (lua_pushthread) (lua_State *L);
+
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API int (lua_getglobal) (lua_State *L, const char *name);
+LUA_API int (lua_gettable) (lua_State *L, int idx);
+LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k);
+LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n);
+LUA_API int (lua_rawget) (lua_State *L, int idx);
+LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
+LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p);
+
+LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
+LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
+LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
+LUA_API int  (lua_getuservalue) (lua_State *L, int idx);
+
+
+/*
+** set functions (stack -> Lua)
+*/
+LUA_API void  (lua_setglobal) (lua_State *L, const char *name);
+LUA_API void  (lua_settable) (lua_State *L, int idx);
+LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_seti) (lua_State *L, int idx, lua_Integer n);
+LUA_API void  (lua_rawset) (lua_State *L, int idx);
+LUA_API void  (lua_rawseti) (lua_State *L, int idx, lua_Integer n);
+LUA_API void  (lua_rawsetp) (lua_State *L, int idx, const void *p);
+LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
+LUA_API void  (lua_setuservalue) (lua_State *L, int idx);
+
+
+/*
+** 'load' and 'call' functions (load and run Lua code)
+*/
+LUA_API void  (lua_callk) (lua_State *L, int nargs, int nresults,
+                           lua_KContext ctx, lua_KFunction k);
+#define lua_call(L,n,r)		lua_callk(L, (n), (r), 0, NULL)
+
+LUA_API int   (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
+                            lua_KContext ctx, lua_KFunction k);
+#define lua_pcall(L,n,r,f)	lua_pcallk(L, (n), (r), (f), 0, NULL)
+
+LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
+                          const char *chunkname, const char *mode);
+
+LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
+
+
+/*
+** coroutine functions
+*/
+LUA_API int  (lua_yieldk)     (lua_State *L, int nresults, lua_KContext ctx,
+                               lua_KFunction k);
+LUA_API int  (lua_resume)     (lua_State *L, lua_State *from, int narg);
+LUA_API int  (lua_status)     (lua_State *L);
+LUA_API int (lua_isyieldable) (lua_State *L);
+
+#define lua_yield(L,n)		lua_yieldk(L, (n), 0, NULL)
+
+
+/*
+** garbage-collection function and options
+*/
+
+#define LUA_GCSTOP		0
+#define LUA_GCRESTART		1
+#define LUA_GCCOLLECT		2
+#define LUA_GCCOUNT		3
+#define LUA_GCCOUNTB		4
+#define LUA_GCSTEP		5
+#define LUA_GCSETPAUSE		6
+#define LUA_GCSETSTEPMUL	7
+#define LUA_GCISRUNNING		9
+
+LUA_API int (lua_gc) (lua_State *L, int what, int data);
+
+
+/*
+** miscellaneous functions
+*/
+
+LUA_API int   (lua_error) (lua_State *L);
+
+LUA_API int   (lua_next) (lua_State *L, int idx);
+
+LUA_API void  (lua_concat) (lua_State *L, int n);
+LUA_API void  (lua_len)    (lua_State *L, int idx);
+
+LUA_API size_t   (lua_stringtonumber) (lua_State *L, const char *s);
+
+LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
+LUA_API void      (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
+
+
+
+/*
+** {==============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_getextraspace(L)	((void *)((char *)(L) - LUA_EXTRASPACE))
+
+#define lua_tonumber(L,i)	lua_tonumberx(L,(i),NULL)
+#define lua_tointeger(L,i)	lua_tointegerx(L,(i),NULL)
+
+#define lua_pop(L,n)		lua_settop(L, -(n)-1)
+
+#define lua_newtable(L)		lua_createtable(L, 0, 0)
+
+#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
+
+#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)
+
+#define lua_isfunction(L,n)	(lua_type(L, (n)) == LUA_TFUNCTION)
+#define lua_istable(L,n)	(lua_type(L, (n)) == LUA_TTABLE)
+#define lua_islightuserdata(L,n)	(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
+#define lua_isnil(L,n)		(lua_type(L, (n)) == LUA_TNIL)
+#define lua_isboolean(L,n)	(lua_type(L, (n)) == LUA_TBOOLEAN)
+#define lua_isthread(L,n)	(lua_type(L, (n)) == LUA_TTHREAD)
+#define lua_isnone(L,n)		(lua_type(L, (n)) == LUA_TNONE)
+#define lua_isnoneornil(L, n)	(lua_type(L, (n)) <= 0)
+
+#define lua_pushliteral(L, s)	lua_pushstring(L, "" s)
+
+#define lua_pushglobaltable(L)  \
+	((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))
+
+#define lua_tostring(L,i)	lua_tolstring(L, (i), NULL)
+
+
+#define lua_insert(L,idx)	lua_rotate(L, (idx), 1)
+
+#define lua_remove(L,idx)	(lua_rotate(L, (idx), -1), lua_pop(L, 1))
+
+#define lua_replace(L,idx)	(lua_copy(L, -1, (idx)), lua_pop(L, 1))
+
+/* }============================================================== */
+
+
+/*
+** {==============================================================
+** compatibility macros for unsigned conversions
+** ===============================================================
+*/
+#if defined(LUA_COMPAT_APIINTCASTS)
+
+#define lua_pushunsigned(L,n)	lua_pushinteger(L, (lua_Integer)(n))
+#define lua_tounsignedx(L,i,is)	((lua_Unsigned)lua_tointegerx(L,i,is))
+#define lua_tounsigned(L,i)	lua_tounsignedx(L,(i),NULL)
+
+#endif
+/* }============================================================== */
+
+/*
+** {======================================================================
+** Debug API
+** =======================================================================
+*/
+
+
+/*
+** Event codes
+*/
+#define LUA_HOOKCALL	0
+#define LUA_HOOKRET	1
+#define LUA_HOOKLINE	2
+#define LUA_HOOKCOUNT	3
+#define LUA_HOOKTAILCALL 4
+
+
+/*
+** Event masks
+*/
+#define LUA_MASKCALL	(1 << LUA_HOOKCALL)
+#define LUA_MASKRET	(1 << LUA_HOOKRET)
+#define LUA_MASKLINE	(1 << LUA_HOOKLINE)
+#define LUA_MASKCOUNT	(1 << LUA_HOOKCOUNT)
+
+typedef struct lua_Debug lua_Debug;  /* activation record */
+
+
+/* Functions to be called by the debugger in specific events */
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+
+LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
+LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
+LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);
+LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);
+
+LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);
+LUA_API void  (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
+                                               int fidx2, int n2);
+
+LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
+LUA_API lua_Hook (lua_gethook) (lua_State *L);
+LUA_API int (lua_gethookmask) (lua_State *L);
+LUA_API int (lua_gethookcount) (lua_State *L);
+
+
+struct lua_Debug {
+  int event;
+  const char *name;	/* (n) */
+  const char *namewhat;	/* (n) 'global', 'local', 'field', 'method' */
+  const char *what;	/* (S) 'Lua', 'C', 'main', 'tail' */
+  const char *source;	/* (S) */
+  int currentline;	/* (l) */
+  int linedefined;	/* (S) */
+  int lastlinedefined;	/* (S) */
+  unsigned char nups;	/* (u) number of upvalues */
+  unsigned char nparams;/* (u) number of parameters */
+  char isvararg;        /* (u) */
+  char istailcall;	/* (t) */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  struct CallInfo *i_ci;  /* active function */
+};
+
+/* }====================================================================== */
+
+
+/******************************************************************************
+* Copyright (C) 1994-2016 Lua.org, PUC-Rio.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+
+
+#endif

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov