mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-14 17:59:17 -05:00
Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
@ -68,7 +68,7 @@ int main(void)
|
||||
.z = 5.0f*sinf(th)
|
||||
};
|
||||
|
||||
SetSoundPosition(camera, sound, spherePos, 20.0f);
|
||||
SetSoundPosition(camera, sound, spherePos, 1.0f);
|
||||
|
||||
if (!IsSoundPlaying(sound)) PlaySound(sound);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@ -148,10 +148,11 @@ int main(void)
|
||||
DrawText("Controls:", 20, 20, 10, BLACK);
|
||||
DrawText("- Right/Left to move", 40, 40, 10, DARKGRAY);
|
||||
DrawText("- Space to jump", 40, 60, 10, DARKGRAY);
|
||||
DrawText("- Mouse Wheel to Zoom in-out, R to reset zoom", 40, 80, 10, DARKGRAY);
|
||||
DrawText("- C to change camera mode", 40, 100, 10, DARKGRAY);
|
||||
DrawText("Current camera mode:", 20, 120, 10, BLACK);
|
||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, DARKGRAY);
|
||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 80, 10, DARKGRAY);
|
||||
DrawText("- R to reset position + zoom", 40, 100, 10, DARKGRAY);
|
||||
DrawText("- C to change camera mode", 40, 120, 10, DARKGRAY);
|
||||
DrawText("Current camera mode:", 20, 140, 10, BLACK);
|
||||
DrawText(cameraDescriptions[cameraOption], 40, 160, 10, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@ -117,7 +117,7 @@ int main(void)
|
||||
|
||||
DrawRectangleV(position, size, releaseAction? BLUE : RED);
|
||||
|
||||
DrawText((actionSet == 0)? "Current input set: WASD (default)" : "Current input set: Cursor", 10, 10, 20, WHITE);
|
||||
DrawText((actionSet == 0)? "Current input set: WASD (default)" : "Current input set: Arrow keys", 10, 10, 20, WHITE);
|
||||
DrawText("Use TAB key to toggles Actions keyset", 10, 50, 20, GREEN);
|
||||
|
||||
EndDrawing();
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
// NOTE: Gamepad name ID depends on drivers and OS
|
||||
#define XBOX_ALIAS_1 "xbox"
|
||||
#define XBOX_ALIAS_2 "x-box"
|
||||
#define PS_ALIAS "playstation"
|
||||
#define PS_ALIAS_1 "playstation"
|
||||
#define PS_ALIAS_2 "sony"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
@ -148,7 +149,8 @@ int main(void)
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
}
|
||||
else if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS) > -1)
|
||||
else if ((TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS_1) > -1) ||
|
||||
(TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS_2) > -1))
|
||||
{
|
||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||
|
||||
|
||||
@ -51,11 +51,31 @@ int main(void)
|
||||
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
||||
};
|
||||
|
||||
const char *buttonLabels[BUTTON_MAX] = {
|
||||
"Y", // Up
|
||||
"X", // Left
|
||||
"B", // Right
|
||||
"A" // Down
|
||||
Vector2 arrowTris[4][3] = {
|
||||
// Up
|
||||
{
|
||||
{ buttonPositions[0].x, buttonPositions[0].y - 12 },
|
||||
{ buttonPositions[0].x - 9, buttonPositions[0].y + 9 },
|
||||
{ buttonPositions[0].x + 9, buttonPositions[0].y + 9 }
|
||||
},
|
||||
// Left
|
||||
{
|
||||
{ buttonPositions[1].x + 9, buttonPositions[1].y - 9 },
|
||||
{ buttonPositions[1].x - 12, buttonPositions[1].y },
|
||||
{ buttonPositions[1].x + 9, buttonPositions[1].y + 9 }
|
||||
},
|
||||
// Right
|
||||
{
|
||||
{ buttonPositions[2].x + 12, buttonPositions[2].y },
|
||||
{ buttonPositions[2].x - 9, buttonPositions[2].y - 9 },
|
||||
{ buttonPositions[2].x - 9, buttonPositions[2].y + 9 }
|
||||
},
|
||||
// Down
|
||||
{
|
||||
{ buttonPositions[3].x - 9, buttonPositions[3].y - 9 },
|
||||
{ buttonPositions[3].x, buttonPositions[3].y + 12 },
|
||||
{ buttonPositions[3].x + 9, buttonPositions[3].y - 9 }
|
||||
}
|
||||
};
|
||||
|
||||
Color buttonLabelColors[BUTTON_MAX] = {
|
||||
@ -128,9 +148,12 @@ int main(void)
|
||||
{
|
||||
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
||||
|
||||
DrawText(buttonLabels[i],
|
||||
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
|
||||
20, buttonLabelColors[i]);
|
||||
DrawTriangle(
|
||||
arrowTris[i][0],
|
||||
arrowTris[i][1],
|
||||
arrowTris[i][2],
|
||||
buttonLabelColors[i]
|
||||
);
|
||||
}
|
||||
|
||||
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
||||
|
||||
@ -96,8 +96,6 @@ int main(void)
|
||||
{
|
||||
DrawRectangleRec(rectangles[i].rect, rectangles[i].color);
|
||||
|
||||
DrawText("Press SPACE to shuffle the sequence", 10, screenHeight - 96, 20, BLACK);
|
||||
|
||||
DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK);
|
||||
DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK);
|
||||
DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK);
|
||||
|
||||
@ -45,7 +45,7 @@ int main(void)
|
||||
for (int i = 0; i < MAX_COLORS_COUNT; i++)
|
||||
{
|
||||
colorsRecs[i].x = 20.0f + 100.0f *(i%7) + 10.0f *(i%7);
|
||||
colorsRecs[i].y = 80.0f + 100.0f *((float)i/7) + 10.0f *((float)i/7);
|
||||
colorsRecs[i].y = 80.0f + 100.0f *((int)i/7) + 10.0f *((float)i/7);
|
||||
colorsRecs[i].width = 100.0f;
|
||||
colorsRecs[i].height = 100.0f;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ RLAPI Matrix GetCameraProjectionMatrix(Camera *camera, float aspect);
|
||||
//----------------------------------------------------------------------------------
|
||||
#define CAMERA_MOVE_SPEED 5.4f // Units per second
|
||||
#define CAMERA_ROTATION_SPEED 0.03f
|
||||
#define CAMERA_PAN_SPEED 0.2f
|
||||
#define CAMERA_PAN_SPEED 2.0f
|
||||
|
||||
// Camera mouse movement sensitivity
|
||||
#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f
|
||||
|
||||
Reference in New Issue
Block a user