summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
authorRay <[email protected]>2017-04-04 01:54:49 +0200
committerRay <[email protected]>2017-04-04 01:54:49 +0200
commitdd4dd0e87d7d215a21b8fc129cbe1adc4b96afe8 (patch)
tree724f11991d301fc8bfd01ccd13321f66d8969329 /examples/core
parent5a230659ef39c6eb3bdb5412ca6e1bfc9eeda98e (diff)
downloadraylib-dd4dd0e87d7d215a21b8fc129cbe1adc4b96afe8.tar.gz
raylib-dd4dd0e87d7d215a21b8fc129cbe1adc4b96afe8.zip
Reorganize examples folder
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_2d_camera.c139
-rw-r--r--examples/core/core_2d_camera.pngbin0 -> 21470 bytes
-rw-r--r--examples/core/core_3d_camera_first_person.c92
-rw-r--r--examples/core/core_3d_camera_first_person.pngbin0 -> 17403 bytes
-rw-r--r--examples/core/core_3d_camera_free.c82
-rw-r--r--examples/core/core_3d_camera_free.pngbin0 -> 25317 bytes
-rw-r--r--examples/core/core_3d_mode.c72
-rw-r--r--examples/core/core_3d_mode.pngbin0 -> 8492 bytes
-rw-r--r--examples/core/core_3d_picking.c104
-rw-r--r--examples/core/core_3d_picking.pngbin0 -> 24402 bytes
-rw-r--r--examples/core/core_basic_window.c62
-rw-r--r--examples/core/core_basic_window.cpp62
-rw-r--r--examples/core/core_basic_window.pngbin0 -> 10297 bytes
-rw-r--r--examples/core/core_basic_window_web.c85
-rw-r--r--examples/core/core_color_select.c94
-rw-r--r--examples/core/core_color_select.pngbin0 -> 14328 bytes
-rw-r--r--examples/core/core_drop_files.c76
-rw-r--r--examples/core/core_drop_files.pngbin0 -> 4682 bytes
-rw-r--r--examples/core/core_gestures_detection.c115
-rw-r--r--examples/core/core_gestures_detection.pngbin0 -> 19480 bytes
-rw-r--r--examples/core/core_input_gamepad.c194
-rw-r--r--examples/core/core_input_gamepad.pngbin0 -> 38066 bytes
-rw-r--r--examples/core/core_input_keys.c59
-rw-r--r--examples/core/core_input_keys.pngbin0 -> 10379 bytes
-rw-r--r--examples/core/core_input_mouse.c61
-rw-r--r--examples/core/core_input_mouse.pngbin0 -> 15444 bytes
-rw-r--r--examples/core/core_mouse_wheel.c58
-rw-r--r--examples/core/core_mouse_wheel.pngbin0 -> 15375 bytes
-rw-r--r--examples/core/core_random_values.c65
-rw-r--r--examples/core/core_random_values.pngbin0 -> 15247 bytes
-rw-r--r--examples/core/core_storage_values.c85
-rw-r--r--examples/core/core_storage_values.pngbin0 -> 16147 bytes
-rw-r--r--examples/core/core_vr_simulator.c92
-rw-r--r--examples/core/core_vr_simulator.pngbin0 -> 177237 bytes
-rw-r--r--examples/core/core_world_screen.c74
-rw-r--r--examples/core/core_world_screen.pngbin0 -> 23813 bytes
-rw-r--r--examples/core/resources/ps3.pngbin0 -> 19345 bytes
-rw-r--r--examples/core/resources/xbox.pngbin0 -> 16177 bytes
38 files changed, 1671 insertions, 0 deletions
diff --git a/examples/core/core_2d_camera.c b/examples/core/core_2d_camera.c
new file mode 100644
index 00000000..f2f219ef
--- /dev/null
+++ b/examples/core/core_2d_camera.c
@@ -0,0 +1,139 @@
+/*******************************************************************************************
+*
+* raylib [core] example - 2d camera
+*
+* This example has been created using raylib 1.5 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+#define MAX_BUILDINGS 100
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
+
+ Rectangle player = { 400, 280, 40, 40 };
+ Rectangle buildings[MAX_BUILDINGS];
+ Color buildColors[MAX_BUILDINGS];
+
+ int spacing = 0;
+
+ for (int i = 0; i < MAX_BUILDINGS; i++)
+ {
+ buildings[i].width = GetRandomValue(50, 200);
+ buildings[i].height = GetRandomValue(100, 800);
+ buildings[i].y = screenHeight - 130 - buildings[i].height;
+ buildings[i].x = -6000 + spacing;
+
+ spacing += buildings[i].width;
+
+ buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
+ }
+
+ Camera2D camera;
+
+ camera.target = (Vector2){ player.x + 20, player.y + 20 };
+ camera.offset = (Vector2){ 0, 0 };
+ camera.rotation = 0.0f;
+ camera.zoom = 1.0f;
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsKeyDown(KEY_RIGHT))
+ {
+ player.x += 2; // Player movement
+ camera.offset.x -= 2; // Camera displacement with player movement
+ }
+ else if (IsKeyDown(KEY_LEFT))
+ {
+ player.x -= 2; // Player movement
+ camera.offset.x += 2; // Camera displacement with player movement
+ }
+
+ // Camera target follows player
+ camera.target = (Vector2){ player.x + 20, player.y + 20 };
+
+ // Camera rotation controls
+ if (IsKeyDown(KEY_A)) camera.rotation--;
+ else if (IsKeyDown(KEY_S)) camera.rotation++;
+
+ // Limit camera rotation to 80 degrees (-40 to 40)
+ if (camera.rotation > 40) camera.rotation = 40;
+ else if (camera.rotation < -40) camera.rotation = -40;
+
+ // Camera zoom controls
+ camera.zoom += ((float)GetMouseWheelMove()*0.05f);
+
+ if (camera.zoom > 3.0f) camera.zoom = 3.0f;
+ else if (camera.zoom < 0.1f) camera.zoom = 0.1f;
+
+ // Camera reset (zoom and rotation)
+ if (IsKeyPressed(KEY_R))
+ {
+ camera.zoom = 1.0f;
+ camera.rotation = 0.0f;
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin2dMode(camera);
+
+ DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
+
+ for (int i = 0; i < MAX_BUILDINGS; i++) DrawRectangleRec(buildings[i], buildColors[i]);
+
+ DrawRectangleRec(player, RED);
+
+ DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
+ DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
+
+ End2dMode();
+
+ DrawText("SCREEN AREA", 640, 10, 20, RED);
+
+ DrawRectangle(0, 0, screenWidth, 5, RED);
+ DrawRectangle(0, 5, 5, screenHeight - 10, RED);
+ DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED);
+ DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED);
+
+ DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5f));
+ DrawRectangleLines( 10, 10, 250, 113, BLUE);
+
+ DrawText("Free 2d camera controls:", 20, 20, 10, BLACK);
+ DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY);
+ DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY);
+ DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY);
+ DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_2d_camera.png b/examples/core/core_2d_camera.png
new file mode 100644
index 00000000..d2f9e634
--- /dev/null
+++ b/examples/core/core_2d_camera.png
Binary files differ
diff --git a/examples/core/core_3d_camera_first_person.c b/examples/core/core_3d_camera_first_person.c
new file mode 100644
index 00000000..3998af81
--- /dev/null
+++ b/examples/core/core_3d_camera_first_person.c
@@ -0,0 +1,92 @@
+/*******************************************************************************************
+*
+* raylib [core] example - 3d camera first person
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+#define MAX_COLUMNS 20
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
+
+ // Define the camera to look into our 3d world (position, target, up vector)
+ Camera camera = {{ 4.0f, 2.0f, 4.0f }, { 0.0f, 1.8f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
+
+ // Generates some random columns
+ float heights[MAX_COLUMNS];
+ Vector3 positions[MAX_COLUMNS];
+ Color colors[MAX_COLUMNS];
+
+ for (int i = 0; i < MAX_COLUMNS; i++)
+ {
+ heights[i] = (float)GetRandomValue(1, 12);
+ positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
+ colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
+ }
+
+ SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateCamera(&camera); // Update camera
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
+ DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
+ DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME); // Draw a green wall
+ DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD); // Draw a yellow wall
+
+ // Draw some cubes around
+ for (int i = 0; i < MAX_COLUMNS; i++)
+ {
+ DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
+ DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
+ }
+
+ End3dMode();
+
+ DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
+ DrawRectangleLines( 10, 10, 220, 70, BLUE);
+
+ DrawText("First person camera default controls:", 20, 20, 10, BLACK);
+ DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
+ DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_3d_camera_first_person.png b/examples/core/core_3d_camera_first_person.png
new file mode 100644
index 00000000..a995591f
--- /dev/null
+++ b/examples/core/core_3d_camera_first_person.png
Binary files differ
diff --git a/examples/core/core_3d_camera_free.c b/examples/core/core_3d_camera_free.c
new file mode 100644
index 00000000..d446e14a
--- /dev/null
+++ b/examples/core/core_3d_camera_free.c
@@ -0,0 +1,82 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Initialize 3d camera free
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
+
+ // Define the camera to look into our 3d world
+ Camera camera;
+ camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
+
+ SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateCamera(&camera); // Update camera
+
+ if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
+
+ DrawGrid(10, 1.0f);
+
+ End3dMode();
+
+ DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
+ DrawRectangleLines( 10, 10, 320, 133, BLUE);
+
+ DrawText("Free camera default controls:", 20, 20, 10, BLACK);
+ DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY);
+ DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY);
+ DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY);
+ DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY);
+ DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_3d_camera_free.png b/examples/core/core_3d_camera_free.png
new file mode 100644
index 00000000..7874eedc
--- /dev/null
+++ b/examples/core/core_3d_camera_free.png
Binary files differ
diff --git a/examples/core/core_3d_mode.c b/examples/core/core_3d_mode.c
new file mode 100644
index 00000000..5f761655
--- /dev/null
+++ b/examples/core/core_3d_mode.c
@@ -0,0 +1,72 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Initialize 3d mode
+*
+* 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()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
+
+ // Define the camera to look into our 3d world
+ Camera camera;
+ camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
+
+ DrawGrid(10, 1.0f);
+
+ End3dMode();
+
+ DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_3d_mode.png b/examples/core/core_3d_mode.png
new file mode 100644
index 00000000..de65daeb
--- /dev/null
+++ b/examples/core/core_3d_mode.png
Binary files differ
diff --git a/examples/core/core_3d_picking.c b/examples/core/core_3d_picking.c
new file mode 100644
index 00000000..bd5c3347
--- /dev/null
+++ b/examples/core/core_3d_picking.c
@@ -0,0 +1,104 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Picking in 3d mode
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
+
+ // Define the camera to look into our 3d world
+ Camera camera;
+ camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+
+ Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
+ Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
+
+ Ray ray; // Picking line ray
+
+ bool collision = false;
+
+ SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateCamera(&camera); // Update camera
+
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+ {
+ // NOTE: This function is NOT WORKING properly!
+ ray = GetMouseRay(GetMousePosition(), camera);
+
+ // Check collision between ray and box
+ collision = CheckCollisionRayBox(ray,
+ (BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
+ (Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }});
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ if (collision)
+ {
+ DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
+ DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
+
+ DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN);
+ }
+ else
+ {
+ DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
+ DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
+ }
+
+ DrawRay(ray, MAROON);
+
+ DrawGrid(10, 1.0f);
+
+ End3dMode();
+
+ DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
+
+ if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_3d_picking.png b/examples/core/core_3d_picking.png
new file mode 100644
index 00000000..254f2f88
--- /dev/null
+++ b/examples/core/core_3d_picking.png
Binary files differ
diff --git a/examples/core/core_basic_window.c b/examples/core/core_basic_window.c
new file mode 100644
index 00000000..fb83400a
--- /dev/null
+++ b/examples/core/core_basic_window.c
@@ -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()
+{
+ // 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;
+} \ No newline at end of file
diff --git a/examples/core/core_basic_window.cpp b/examples/core/core_basic_window.cpp
new file mode 100644
index 00000000..fa12026a
--- /dev/null
+++ b/examples/core/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;
+} \ No newline at end of file
diff --git a/examples/core/core_basic_window.png b/examples/core/core_basic_window.png
new file mode 100644
index 00000000..34618441
--- /dev/null
+++ b/examples/core/core_basic_window.png
Binary files differ
diff --git a/examples/core/core_basic_window_web.c b/examples/core/core_basic_window_web.c
new file mode 100644
index 00000000..1ecb22f3
--- /dev/null
+++ b/examples/core/core_basic_window_web.c
@@ -0,0 +1,85 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Basic window (adapted for HTML5 platform)
+*
+* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
+* As you will notice, code structure is slightly diferent to the other examples...
+* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+//#define PLATFORM_WEB
+
+#if defined(PLATFORM_WEB)
+ #include <emscripten/emscripten.h>
+#endif
+
+//----------------------------------------------------------------------------------
+// Global Variables Definition
+//----------------------------------------------------------------------------------
+int screenWidth = 800;
+int screenHeight = 450;
+
+//----------------------------------------------------------------------------------
+// Module Functions Declaration
+//----------------------------------------------------------------------------------
+void UpdateDrawFrame(void); // Update and Draw one frame
+
+//----------------------------------------------------------------------------------
+// Main Enry Point
+//----------------------------------------------------------------------------------
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
+
+#if defined(PLATFORM_WEB)
+ emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
+#else
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ UpdateDrawFrame();
+ }
+#endif
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+}
+
+//----------------------------------------------------------------------------------
+// Module Functions Definition
+//----------------------------------------------------------------------------------
+void UpdateDrawFrame(void)
+{
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+} \ No newline at end of file
diff --git a/examples/core/core_color_select.c b/examples/core/core_color_select.c
new file mode 100644
index 00000000..002a6931
--- /dev/null
+++ b/examples/core/core_color_select.c
@@ -0,0 +1,94 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Color selection by mouse (collision detection)
+*
+* 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()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
+
+ Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
+ GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
+ GREEN, SKYBLUE, PURPLE, BEIGE };
+
+ Rectangle colorsRecs[21]; // Rectangles array
+
+ // Fills colorsRecs data (for every rectangle)
+ for (int i = 0; i < 21; i++)
+ {
+ colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
+ colorsRecs[i].y = 60 + 100*(i/7) + 10*(i/7);
+ colorsRecs[i].width = 100;
+ colorsRecs[i].height = 100;
+ }
+
+ bool selected[21] = { false }; // Selected rectangles indicator
+
+ Vector2 mousePoint;
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ mousePoint = GetMousePosition();
+
+ for (int i = 0; i < 21; i++) // Iterate along all the rectangles
+ {
+ if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
+ {
+ colors[i].a = 120;
+
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
+ }
+ else colors[i].a = 255;
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ for (int i = 0; i < 21; i++) // Draw all rectangles
+ {
+ DrawRectangleRec(colorsRecs[i], colors[i]);
+
+ // Draw four rectangles around selected rectangle
+ if (selected[i])
+ {
+ 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
+ }
+ }
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_color_select.png b/examples/core/core_color_select.png
new file mode 100644
index 00000000..93ab83ae
--- /dev/null
+++ b/examples/core/core_color_select.png
Binary files differ
diff --git a/examples/core/core_drop_files.c b/examples/core/core_drop_files.c
new file mode 100644
index 00000000..5c1501b8
--- /dev/null
+++ b/examples/core/core_drop_files.c
@@ -0,0 +1,76 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Windows drop files
+*
+* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
+
+ int count = 0;
+ char **droppedFiles = { 0 };
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsFileDropped())
+ {
+ droppedFiles = GetDroppedFiles(&count);
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
+ else
+ {
+ DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
+
+ for (int i = 0; i < count; i++)
+ {
+ if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
+ else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
+
+ DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
+ }
+
+ DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
+ }
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ ClearDroppedFiles(); // Clear internal buffers
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_drop_files.png b/examples/core/core_drop_files.png
new file mode 100644
index 00000000..d46c44cf
--- /dev/null
+++ b/examples/core/core_drop_files.png
Binary files differ
diff --git a/examples/core/core_gestures_detection.c b/examples/core/core_gestures_detection.c
new file mode 100644
index 00000000..63a1e6bd
--- /dev/null
+++ b/examples/core/core_gestures_detection.c
@@ -0,0 +1,115 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Gestures Detection
+*
+* This example has been created using raylib 1.4 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+#include <string.h>
+
+#define MAX_GESTURE_STRINGS 20
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection");
+
+ Vector2 touchPosition = { 0, 0 };
+ Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 };
+
+ int gesturesCount = 0;
+ char gestureStrings[MAX_GESTURE_STRINGS][32];
+
+ int currentGesture = GESTURE_NONE;
+ int lastGesture = GESTURE_NONE;
+
+ //SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ lastGesture = currentGesture;
+ currentGesture = GetGestureDetected();
+ touchPosition = GetTouchPosition(0);
+
+ if (CheckCollisionPointRec(touchPosition, touchArea) && (currentGesture != GESTURE_NONE))
+ {
+ if (currentGesture != lastGesture)
+ {
+ // Store gesture string
+ switch (currentGesture)
+ {
+ case GESTURE_TAP: strcpy(gestureStrings[gesturesCount], "GESTURE TAP"); break;
+ case GESTURE_DOUBLETAP: strcpy(gestureStrings[gesturesCount], "GESTURE DOUBLETAP"); break;
+ case GESTURE_HOLD: strcpy(gestureStrings[gesturesCount], "GESTURE HOLD"); break;
+ case GESTURE_DRAG: strcpy(gestureStrings[gesturesCount], "GESTURE DRAG"); break;
+ case GESTURE_SWIPE_RIGHT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE RIGHT"); break;
+ case GESTURE_SWIPE_LEFT: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE LEFT"); break;
+ case GESTURE_SWIPE_UP: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE UP"); break;
+ case GESTURE_SWIPE_DOWN: strcpy(gestureStrings[gesturesCount], "GESTURE SWIPE DOWN"); break;
+ case GESTURE_PINCH_IN: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH IN"); break;
+ case GESTURE_PINCH_OUT: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH OUT"); break;
+ default: break;
+ }
+
+ gesturesCount++;
+
+ // Reset gestures strings
+ if (gesturesCount >= MAX_GESTURE_STRINGS)
+ {
+ for (int i = 0; i < MAX_GESTURE_STRINGS; i++) strcpy(gestureStrings[i], "\0");
+
+ gesturesCount = 0;
+ }
+ }
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawRectangleRec(touchArea, GRAY);
+ DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE);
+
+ DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f));
+
+ for (int i = 0; i < gesturesCount; i++)
+ {
+ if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f));
+ else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f));
+
+ if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY);
+ else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON);
+ }
+
+ DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY);
+ DrawText("DETECTED GESTURES", 50, 15, 10, GRAY);
+
+ if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+} \ No newline at end of file
diff --git a/examples/core/core_gestures_detection.png b/examples/core/core_gestures_detection.png
new file mode 100644
index 00000000..d2bbb5d7
--- /dev/null
+++ b/examples/core/core_gestures_detection.png
Binary files differ
diff --git a/examples/core/core_input_gamepad.c b/examples/core/core_input_gamepad.c
new file mode 100644
index 00000000..f98885e3
--- /dev/null
+++ b/examples/core/core_input_gamepad.c
@@ -0,0 +1,194 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Gamepad input
+*
+* NOTE: This example requires a Gamepad connected to the system
+* raylib is configured to work with the following gamepads:
+* Xbox 360 Controller (Xbox 360, Xbox One)
+* PLAYSTATION(R)3 Controller
+* Check raylib.h for buttons configuration
+*
+* This example has been created using raylib 1.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"
+
+// NOTE: Gamepad name ID depends on drivers and OS
+#if defined(PLATFORM_RPI)
+ #define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
+ #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
+#else
+ #define XBOX360_NAME_ID "Xbox 360 Controller"
+ #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
+#endif
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
+
+ Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
+ Texture2D texXboxPad = LoadTexture("resources/xbox.png");
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ // ...
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ if (IsGamepadAvailable(GAMEPAD_PLAYER1))
+ {
+ DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
+
+ if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
+ {
+ DrawTexture(texXboxPad, 0, 0, DARKGRAY);
+
+ // Draw buttons: xbox home
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
+
+ // Draw buttons: basic
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, GOLD);
+
+ // Draw buttons: d-pad
+ DrawRectangle(317, 202, 19, 71, BLACK);
+ DrawRectangle(293, 228, 69, 19, BLACK);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
+
+ // Draw buttons: left-right back
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RED);
+
+ // Draw axis: left joystick
+ DrawCircle(259, 152, 39, BLACK);
+ DrawCircle(259, 152, 34, LIGHTGRAY);
+ DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
+ 152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, BLACK);
+
+ // Draw axis: right joystick
+ DrawCircle(461, 237, 38, BLACK);
+ DrawCircle(461, 237, 33, LIGHTGRAY);
+ DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
+ 237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, BLACK);
+
+ // Draw axis: left-right triggers
+ DrawRectangle(170, 30, 15, 70, GRAY);
+ DrawRectangle(604, 30, 15, 70, GRAY);
+ DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RED);
+ DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
+
+ //DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
+ //DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
+ }
+ else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
+ {
+ DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
+
+ // Draw buttons: ps
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
+
+ // Draw buttons: basic
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, PINK);
+
+ // Draw buttons: d-pad
+ DrawRectangle(225, 132, 24, 84, BLACK);
+ DrawRectangle(195, 161, 84, 25, BLACK);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
+
+ // Draw buttons: left-right back buttons
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
+ if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RED);
+
+ // Draw axis: left joystick
+ DrawCircle(319, 255, 35, BLACK);
+ DrawCircle(319, 255, 31, LIGHTGRAY);
+ DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
+ 255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, BLACK);
+
+ // Draw axis: right joystick
+ DrawCircle(475, 255, 35, BLACK);
+ DrawCircle(475, 255, 31, LIGHTGRAY);
+ DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
+ 255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, BLACK);
+
+ // Draw axis: left-right triggers
+ DrawRectangle(169, 48, 15, 70, GRAY);
+ DrawRectangle(611, 48, 15, 70, GRAY);
+ DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RED);
+ DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
+ }
+ else
+ {
+ DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
+
+ // TODO: Draw generic gamepad
+ }
+
+ DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
+
+ for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
+ {
+ DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
+ }
+
+ if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
+ else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
+ }
+ else
+ {
+ DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
+
+ DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
+ }
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ UnloadTexture(texPs3Pad);
+ UnloadTexture(texXboxPad);
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_input_gamepad.png b/examples/core/core_input_gamepad.png
new file mode 100644
index 00000000..5996eece
--- /dev/null
+++ b/examples/core/core_input_gamepad.png
Binary files differ
diff --git a/examples/core/core_input_keys.c b/examples/core/core_input_keys.c
new file mode 100644
index 00000000..b2305246
--- /dev/null
+++ b/examples/core/core_input_keys.c
@@ -0,0 +1,59 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Keyboard input
+*
+* 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()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
+
+ Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
+
+ SetTargetFPS(60); // Set target frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f;
+ if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f;
+ if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f;
+ if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f;
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
+
+ DrawCircleV(ballPosition, 50, MAROON);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_input_keys.png b/examples/core/core_input_keys.png
new file mode 100644
index 00000000..48370321
--- /dev/null
+++ b/examples/core/core_input_keys.png
Binary files differ
diff --git a/examples/core/core_input_mouse.c b/examples/core/core_input_mouse.c
new file mode 100644
index 00000000..24d2dfcd
--- /dev/null
+++ b/examples/core/core_input_mouse.c
@@ -0,0 +1,61 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Mouse input
+*
+* 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()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
+
+ Vector2 ballPosition = { -100.0f, -100.0f };
+ Color ballColor = DARKBLUE;
+
+ SetTargetFPS(60);
+ //---------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ ballPosition = GetMousePosition();
+
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
+ else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
+ else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
+ //----------------------------------------------------------------------------------
+
+ // 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();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_input_mouse.png b/examples/core/core_input_mouse.png
new file mode 100644
index 00000000..a96e7faf
--- /dev/null
+++ b/examples/core/core_input_mouse.png
Binary files differ
diff --git a/examples/core/core_mouse_wheel.c b/examples/core/core_mouse_wheel.c
new file mode 100644
index 00000000..6a5252ee
--- /dev/null
+++ b/examples/core/core_mouse_wheel.c
@@ -0,0 +1,58 @@
+/*******************************************************************************************
+*
+* raylib [core] examples - Mouse wheel
+*
+* This test has been created using raylib 1.1 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
+
+ int boxPositionY = screenHeight/2 - 40;
+ int scrollSpeed = 4; // Scrolling speed in pixels
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ 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(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_mouse_wheel.png b/examples/core/core_mouse_wheel.png
new file mode 100644
index 00000000..26a1f243
--- /dev/null
+++ b/examples/core/core_mouse_wheel.png
Binary files differ
diff --git a/examples/core/core_random_values.c b/examples/core/core_random_values.c
new file mode 100644
index 00000000..06e550dd
--- /dev/null
+++ b/examples/core/core_random_values.c
@@ -0,0 +1,65 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Generate random values
+*
+* This example has been created using raylib 1.1 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
+
+ int framesCounter = 0; // Variable used to count frames
+
+ int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ framesCounter++;
+
+ // Every two seconds (120 frames) a new random value is generated
+ if (((framesCounter/120)%2) == 1)
+ {
+ randValue = GetRandomValue(-8, 5);
+ framesCounter = 0;
+ }
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
+
+ DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_random_values.png b/examples/core/core_random_values.png
new file mode 100644
index 00000000..6dd49475
--- /dev/null
+++ b/examples/core/core_random_values.png
Binary files differ
diff --git a/examples/core/core_storage_values.c b/examples/core/core_storage_values.c
new file mode 100644
index 00000000..43f0882f
--- /dev/null
+++ b/examples/core/core_storage_values.c
@@ -0,0 +1,85 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Storage save/load values
+*
+* This example has been created using raylib 1.4 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+// NOTE: Storage positions must start with 0, directly related to file memory layout
+typedef enum { STORAGE_SCORE = 0, STORAGE_HISCORE } StorageData;
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values");
+
+ int score = 0;
+ int hiscore = 0;
+
+ int framesCounter = 0;
+
+ SetTargetFPS(60);
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsKeyPressed(KEY_R))
+ {
+ score = GetRandomValue(1000, 2000);
+ hiscore = GetRandomValue(2000, 4000);
+ }
+
+ if (IsKeyPressed(KEY_ENTER))
+ {
+ StorageSaveValue(STORAGE_SCORE, score);
+ StorageSaveValue(STORAGE_HISCORE, hiscore);
+ }
+ else if (IsKeyPressed(KEY_SPACE))
+ {
+ // NOTE: If requested position could not be found, value 0 is returned
+ score = StorageLoadValue(STORAGE_SCORE);
+ hiscore = StorageLoadValue(STORAGE_HISCORE);
+ }
+
+ framesCounter++;
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
+ DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
+
+ DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
+
+ DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
+ DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);
+ DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_storage_values.png b/examples/core/core_storage_values.png
new file mode 100644
index 00000000..6cfd552d
--- /dev/null
+++ b/examples/core/core_storage_values.png
Binary files differ
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
new file mode 100644
index 00000000..5e6c6446
--- /dev/null
+++ b/examples/core/core_vr_simulator.c
@@ -0,0 +1,92 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Oculus Rift CV1
+*
+* Compile example using:
+* gcc -o $(NAME_PART).exe $(FILE_NAME) -I..\src\external -I..\src\external\OculusSDK\LibOVR\Include /
+* -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99 /
+* -Wl,-allow-multiple-definition
+*
+* #define SUPPORT_OCULUS_RIFT_CV1 / RLGL_OCULUS_SUPPORT
+* Enable Oculus Rift CV1 functionality
+*
+* This example has been created using raylib 1.5 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 1080;
+ int screenHeight = 600;
+
+ // NOTE: screenWidth/screenHeight should match VR device aspect ratio
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
+
+ InitVrSimulator(HMD_OCULUS_RIFT_CV1); // Init VR simulator (Oculus Rift CV1 parameters)
+
+ // Define the camera to look into our 3d world
+ Camera camera;
+ camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 60.0f; // Camera field-of-view Y
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
+
+ SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode
+
+ SetTargetFPS(90); // Set our game to run at 90 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateCamera(&camera); // Update camera (simulator mode)
+
+ if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ BeginVrDrawing();
+
+ Begin3dMode(camera);
+
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
+
+ DrawGrid(40, 1.0f);
+
+ End3dMode();
+
+ EndVrDrawing();
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseVrSimulator();
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_vr_simulator.png b/examples/core/core_vr_simulator.png
new file mode 100644
index 00000000..aa4d0932
--- /dev/null
+++ b/examples/core/core_vr_simulator.png
Binary files differ
diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c
new file mode 100644
index 00000000..f8c53c70
--- /dev/null
+++ b/examples/core/core_world_screen.c
@@ -0,0 +1,74 @@
+/*******************************************************************************************
+*
+* raylib [core] example - World to screen
+*
+* This example has been created using raylib 1.3 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
+
+ // Define the camera to look into our 3d world
+ Camera camera = {{ 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
+
+ Vector2 cubeScreenPosition;
+
+ SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateCamera(&camera); // Update camera
+
+ // Calculate cube screen space position (with a little offset to be in top)
+ cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
+
+ DrawGrid(10, 1.0f);
+
+ End3dMode();
+
+ DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
+ DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+} \ No newline at end of file
diff --git a/examples/core/core_world_screen.png b/examples/core/core_world_screen.png
new file mode 100644
index 00000000..b4853b45
--- /dev/null
+++ b/examples/core/core_world_screen.png
Binary files differ
diff --git a/examples/core/resources/ps3.png b/examples/core/resources/ps3.png
new file mode 100644
index 00000000..98befacc
--- /dev/null
+++ b/examples/core/resources/ps3.png
Binary files differ
diff --git a/examples/core/resources/xbox.png b/examples/core/resources/xbox.png
new file mode 100644
index 00000000..029c9109
--- /dev/null
+++ b/examples/core/resources/xbox.png
Binary files differ