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

This commit is contained in:
victorfisac 2017-04-06 15:28:04 +02:00
commit 54f070a0f4
287 changed files with 171295 additions and 23161 deletions

View file

@ -4,7 +4,7 @@
* *
* NOTE: This example requires OpenAL Soft library installed * NOTE: This example requires OpenAL Soft library installed
* *
* This example has been created using raylib 1.3 (www.raylib.com) * This example has been created using raylib 1.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2015 Ramon Santamaria (@raysan5) * Copyright (c) 2015 Ramon Santamaria (@raysan5)

View file

@ -183,7 +183,7 @@ Module['FS_createPath']('/resources', 'audio', true, true);
} }
} }
loadPackage({"files": [{"audio": 1, "start": 0, "crunched": 0, "end": 506938, "filename": "/resources/audio/guitar_noodling.ogg"}], "remote_package_size": 506938, "package_uuid": "7234e469-90de-4413-8a21-6025f306c05f"}); loadPackage({"files": [{"audio": 1, "start": 0, "crunched": 0, "end": 506938, "filename": "/resources/audio/guitar_noodling.ogg"}], "remote_package_size": 506938, "package_uuid": "9de29365-b1e1-4689-9d31-b95e29ce0312"});
})(); })();

View file

@ -183,7 +183,7 @@ Module['FS_createPath']('/resources', 'audio', true, true);
} }
} }
loadPackage({"files": [{"audio": 1, "start": 0, "crunched": 0, "end": 6246, "filename": "/resources/audio/weird.wav"}, {"audio": 1, "start": 6246, "crunched": 0, "end": 63574, "filename": "/resources/audio/tanatana.ogg"}], "remote_package_size": 63574, "package_uuid": "ac0b8b01-6644-4217-8a43-cdb652585250"}); loadPackage({"files": [{"audio": 1, "start": 0, "crunched": 0, "end": 6246, "filename": "/resources/audio/weird.wav"}, {"audio": 1, "start": 6246, "crunched": 0, "end": 63574, "filename": "/resources/audio/tanatana.ogg"}], "remote_package_size": 63574, "package_uuid": "504f90a1-2c55-47ff-9400-0508e5042415"});
})(); })();

View file

@ -24,7 +24,7 @@ int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
// Define the camera to look into our 3d world (position, target, up vector) // 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 // Generates some random columns
float heights[MAX_COLUMNS]; float heights[MAX_COLUMNS];

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,7 @@
* *
* raylib [core] example - Initialize 3d camera free (adapted for HTML5 platform) * raylib [core] example - Initialize 3d camera free (adapted for HTML5 platform)
* *
* This example has been created using raylib 1.3 (www.raylib.com) * This example has been created using raylib 1.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2015 Ramon Santamaria (@raysan5) * Copyright (c) 2015 Ramon Santamaria (@raysan5)
@ -41,8 +41,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera; camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
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.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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y

View file

@ -7103,29 +7103,22 @@ function getTempRet0() {
} }
function _main() { function _main() {
var $$byval_copy = 0, $$sroa$03$0$$sroa_idx = 0, $$sroa$2$0$$sroa_idx1 = 0, $$sroa$29$0$$sroa_idx10 = 0, $$sroa$3$0$$sroa_idx2 = 0, $$sroa$311$0$$sroa_idx12 = 0, $0 = 0, $1 = 0, $2 = 0, $3 = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0; var $0 = 0, $1 = 0, $camera$byval_copy = 0, dest = 0, label = 0, sp = 0, src = 0, stop = 0;
sp = STACKTOP; sp = STACKTOP;
STACKTOP = STACKTOP + 80|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(80|0); STACKTOP = STACKTOP + 48|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(48|0);
$$byval_copy = sp + 40|0; $camera$byval_copy = sp;
$0 = sp; $0 = HEAP32[2]|0;
$1 = HEAP32[2]|0; $1 = HEAP32[3]|0;
$2 = HEAP32[3]|0; _InitWindow($0,$1,3396);
_InitWindow($1,$2,3396); HEAPF32[3535] = 10.0;
HEAPF32[$0>>2] = 0.0; HEAPF32[(14144)>>2] = 10.0;
$$sroa$29$0$$sroa_idx10 = ((($0)) + 4|0); HEAPF32[(14148)>>2] = 10.0;
HEAPF32[$$sroa$29$0$$sroa_idx10>>2] = 10.0; ;HEAP32[(14152)>>2]=0|0;HEAP32[(14152)+4>>2]=0|0;HEAP32[(14152)+8>>2]=0|0;HEAP32[(14152)+12>>2]=0|0;
$$sroa$311$0$$sroa_idx12 = ((($0)) + 8|0); HEAPF32[(14168)>>2] = 1.0;
HEAPF32[$$sroa$311$0$$sroa_idx12>>2] = 10.0; HEAPF32[(14172)>>2] = 0.0;
$$sroa$03$0$$sroa_idx = ((($0)) + 12|0); HEAPF32[(14176)>>2] = 45.0;
$$sroa$2$0$$sroa_idx1 = ((($0)) + 28|0); dest=$camera$byval_copy; src=14140; stop=dest+40|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
;HEAP32[$$sroa$03$0$$sroa_idx>>2]=0|0;HEAP32[$$sroa$03$0$$sroa_idx+4>>2]=0|0;HEAP32[$$sroa$03$0$$sroa_idx+8>>2]=0|0;HEAP32[$$sroa$03$0$$sroa_idx+12>>2]=0|0; _SetCameraMode($camera$byval_copy,1);
HEAPF32[$$sroa$2$0$$sroa_idx1>>2] = 1.0;
$$sroa$3$0$$sroa_idx2 = ((($0)) + 32|0);
HEAPF32[$$sroa$3$0$$sroa_idx2>>2] = 0.0;
$3 = ((($0)) + 36|0);
HEAPF32[$3>>2] = 45.0;
dest=$$byval_copy; src=$0; stop=dest+40|0; do { HEAP32[dest>>2]=HEAP32[src>>2]|0; dest=dest+4|0; src=src+4|0; } while ((dest|0) < (stop|0));
_SetCameraMode($$byval_copy,1);
_emscripten_set_main_loop((1|0),0,1); _emscripten_set_main_loop((1|0),0,1);
_CloseWindow(); _CloseWindow();
STACKTOP = sp;return 0; STACKTOP = sp;return 0;

View file

@ -45,7 +45,7 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking"); InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
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.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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y

View file

@ -7110,7 +7110,7 @@ function _main() {
$0 = HEAP32[2]|0; $0 = HEAP32[2]|0;
$1 = HEAP32[3]|0; $1 = HEAP32[3]|0;
_InitWindow($0,$1,3548); _InitWindow($0,$1,3548);
HEAPF32[3541] = 0.0; HEAPF32[3541] = 10.0;
HEAPF32[(14168)>>2] = 10.0; HEAPF32[(14168)>>2] = 10.0;
HEAPF32[(14172)>>2] = 10.0; HEAPF32[(14172)>>2] = 10.0;
;HEAP32[(14176)>>2]=0|0;HEAP32[(14176)+4>>2]=0|0;HEAP32[(14176)+8>>2]=0|0;HEAP32[(14176)+12>>2]=0|0; ;HEAP32[(14176)>>2]=0|0;HEAP32[(14176)+4>>2]=0|0;HEAP32[(14176)+8>>2]=0|0;HEAP32[(14176)+12>>2]=0|0;

View file

@ -25,7 +25,6 @@
int screenWidth = 800; int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Functions Declaration // Module Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,113 @@
/*******************************************************************************************
*
* raylib [core] example - VR Simulator (Oculus Rift CV1 parameters)
*
* This example has been created using raylib 1.7 (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"
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
Camera camera;
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
// NOTE: If device is not available, it fallbacks to default device (simulator)
InitVrSimulator(HMD_OCULUS_RIFT_CV1); // Init VR simulator (Oculus Rift CV1 parameters)
// Define the camera to look into our 3d world
camera.position = (Vector3){ 5.0f, 5.0f, 5.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 = 60.0f; // Camera field-of-view Y
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode
#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
//--------------------------------------------------------------------------------------
CloseVrSimulator(); // Close VR simulator
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
void UpdateDrawFrame(void)
{
// 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();
//----------------------------------------------------------------------------------
}

File diff suppressed because one or more lines are too long

View file

@ -22,7 +22,7 @@ int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; Camera camera = {{ 8.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 }; Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };

File diff suppressed because one or more lines are too long

View file

@ -227,6 +227,7 @@ EXAMPLES = \
core_3d_camera_first_person \ core_3d_camera_first_person \
core_2d_camera \ core_2d_camera \
core_world_screen \ core_world_screen \
core_vr_simulator \
shapes_logo_raylib \ shapes_logo_raylib \
shapes_basic_shapes \ shapes_basic_shapes \
shapes_colors_palette \ shapes_colors_palette \
@ -291,11 +292,7 @@ core_mouse_wheel: core_mouse_wheel.c
# compile [core] example - gamepad input # compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c core_input_gamepad: core_input_gamepad.c
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI)) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/ps3.png --preload-file resources/xbox.png
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
else
@echo core_input_gamepad: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
endif
# compile [core] example - generate random values # compile [core] example - generate random values
core_random_values: core_random_values.c core_random_values: core_random_values.c
@ -350,8 +347,8 @@ core_world_screen: core_world_screen.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - oculus rift # compile [core] example - oculus rift
#core_oculus_rift: core_oculus_rift.c core_vr_simulator: core_vr_simulator.c
# $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo (with basic shapes) # compile [shapes] example - raylib logo (with basic shapes)
shapes_logo_raylib: shapes_logo_raylib.c shapes_logo_raylib: shapes_logo_raylib.c
@ -415,7 +412,7 @@ text_sprite_fonts: text_sprite_fonts.c
# compile [text] example - bmfonts and ttf loading # compile [text] example - bmfonts and ttf loading
text_bmfont_ttf: text_bmfont_ttf.c text_bmfont_ttf: text_bmfont_ttf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/fonts/bmfont.fnt --preload-file resources/fonts/pixantiqua.ttf $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/fonts/bmfont.fnt --preload-file resources/fonts/bmfont.png --preload-file resources/fonts/pixantiqua.ttf -s ALLOW_MEMORY_GROWTH=1
# compile [text] example - raylib bitmap fonts (rBMF) # compile [text] example - raylib bitmap fonts (rBMF)
text_rbmf_fonts: text_rbmf_fonts.c text_rbmf_fonts: text_rbmf_fonts.c
@ -435,11 +432,11 @@ text_writing_anim: text_writing_anim.c
# compile [text] example - text ttf loading # compile [text] example - text ttf loading
text_ttf_loading: text_ttf_loading.c text_ttf_loading: text_ttf_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/fonts/KAISG.ttf -s ALLOW_MEMORY_GROWTH=1
# compile [text] example - text bmfont unordered # compile [text] example - text bmfont unordered
text_bmfont_unordered: text_bmfont_unordered.c text_bmfont_unordered: text_bmfont_unordered.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/fonts/pixantiqua.fnt --preload-file resources/fonts/pixantiqua_0.png
# compile [models] example - basic geometric 3d shapes # compile [models] example - basic geometric 3d shapes
models_geometric_shapes: models_geometric_shapes.c models_geometric_shapes: models_geometric_shapes.c
@ -471,7 +468,7 @@ models_cubicmap: models_cubicmap.c
# compile [models] example - model ray picking # compile [models] example - model ray picking
models_ray_picking: models_ray_picking.c models_ray_picking: models_ray_picking.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/model/lowpoly-tower.obj --preload-file resources/model/lowpoly-tower.png
# compile [shaders] example - model shader # compile [shaders] example - model shader
shaders_model_shader: shaders_model_shader.c shaders_model_shader: shaders_model_shader.c
@ -479,7 +476,7 @@ shaders_model_shader: shaders_model_shader.c
# compile [shaders] example - shapes texture shader # compile [shaders] example - shapes texture shader
shaders_shapes_textures: shaders_shapes_textures.c shaders_shapes_textures: shaders_shapes_textures.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/texture_formats/sonic.png --preload-file resources/shaders/glsl100/shapes_base.vs --preload-file resources/shaders/glsl100/shapes_grayscale.fs $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) --preload-file resources/texture_formats/sonic.png --preload-file resources/shaders/glsl100/base.vs --preload-file resources/shaders/glsl100/grayscale.fs
# compile [shaders] example - custom uniform in shader # compile [shaders] example - custom uniform in shader
shaders_custom_uniform: shaders_custom_uniform.c shaders_custom_uniform: shaders_custom_uniform.c

View file

@ -22,7 +22,7 @@ int screenWidth = 800;
int screenHeight = 450; int screenHeight = 450;
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
Texture2D bill; // Our texture billboard Texture2D bill; // Our texture billboard
Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard

File diff suppressed because one or more lines are too long

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