mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-21 04:59:17 -05:00
Compare commits
11 Commits
8e81ca0e60
...
180c3c13ba
| Author | SHA1 | Date | |
|---|---|---|---|
| 180c3c13ba | |||
| dbca900255 | |||
| 1061daf197 | |||
| fb5bc42190 | |||
| b04d2a2268 | |||
| b210d16597 | |||
| 4d6ef19fcc | |||
| fd40d2b374 | |||
| a78d575f75 | |||
| 8f1421ee5d | |||
| debbb90479 |
@ -68,7 +68,7 @@ int main(void)
|
|||||||
.z = 5.0f*sinf(th)
|
.z = 5.0f*sinf(th)
|
||||||
};
|
};
|
||||||
|
|
||||||
SetSoundPosition(camera, sound, spherePos, 20.0f);
|
SetSoundPosition(camera, sound, spherePos, 1.0f);
|
||||||
|
|
||||||
if (!IsSoundPlaying(sound)) PlaySound(sound);
|
if (!IsSoundPlaying(sound)) PlaySound(sound);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -148,10 +148,11 @@ int main(void)
|
|||||||
DrawText("Controls:", 20, 20, 10, BLACK);
|
DrawText("Controls:", 20, 20, 10, BLACK);
|
||||||
DrawText("- Right/Left to move", 40, 40, 10, DARKGRAY);
|
DrawText("- Right/Left to move", 40, 40, 10, DARKGRAY);
|
||||||
DrawText("- Space to jump", 40, 60, 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("- Mouse Wheel to Zoom in-out", 40, 80, 10, DARKGRAY);
|
||||||
DrawText("- C to change camera mode", 40, 100, 10, DARKGRAY);
|
DrawText("- R to reset position + zoom", 40, 100, 10, DARKGRAY);
|
||||||
DrawText("Current camera mode:", 20, 120, 10, BLACK);
|
DrawText("- C to change camera mode", 40, 120, 10, DARKGRAY);
|
||||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, DARKGRAY);
|
DrawText("Current camera mode:", 20, 140, 10, BLACK);
|
||||||
|
DrawText(cameraDescriptions[cameraOption], 40, 160, 10, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -117,7 +117,7 @@ int main(void)
|
|||||||
|
|
||||||
DrawRectangleV(position, size, releaseAction? BLUE : RED);
|
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);
|
DrawText("Use TAB key to toggles Actions keyset", 10, 50, 20, GREEN);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|||||||
@ -24,7 +24,8 @@
|
|||||||
// NOTE: Gamepad name ID depends on drivers and OS
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
#define XBOX_ALIAS_1 "xbox"
|
#define XBOX_ALIAS_1 "xbox"
|
||||||
#define XBOX_ALIAS_2 "x-box"
|
#define XBOX_ALIAS_2 "x-box"
|
||||||
#define PS_ALIAS "playstation"
|
#define PS_ALIAS_1 "playstation"
|
||||||
|
#define PS_ALIAS_2 "sony"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// 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 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);
|
//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);
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
|||||||
@ -51,11 +51,31 @@ int main(void)
|
|||||||
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *buttonLabels[BUTTON_MAX] = {
|
Vector2 arrowTris[4][3] = {
|
||||||
"Y", // Up
|
// Up
|
||||||
"X", // Left
|
{
|
||||||
"B", // Right
|
{ buttonPositions[0].x, buttonPositions[0].y - 12 },
|
||||||
"A" // Down
|
{ 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] = {
|
Color buttonLabelColors[BUTTON_MAX] = {
|
||||||
@ -128,9 +148,12 @@ int main(void)
|
|||||||
{
|
{
|
||||||
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
||||||
|
|
||||||
DrawText(buttonLabels[i],
|
DrawTriangle(
|
||||||
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
|
arrowTris[i][0],
|
||||||
20, buttonLabelColors[i]);
|
arrowTris[i][1],
|
||||||
|
arrowTris[i][2],
|
||||||
|
buttonLabelColors[i]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
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);
|
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 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 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);
|
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++)
|
for (int i = 0; i < MAX_COLORS_COUNT; i++)
|
||||||
{
|
{
|
||||||
colorsRecs[i].x = 20.0f + 100.0f *(i%7) + 10.0f *(i%7);
|
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].width = 100.0f;
|
||||||
colorsRecs[i].height = 100.0f;
|
colorsRecs[i].height = 100.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -841,6 +841,7 @@ ifeq ($(ROOT),root)
|
|||||||
# Copying raylib development files to $(RAYLIB_H_INSTALL_PATH).
|
# Copying raylib development files to $(RAYLIB_H_INSTALL_PATH).
|
||||||
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
||||||
cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
||||||
|
cp --update rcamera.h $(RAYLIB_H_INSTALL_PATH)/rcamera.h
|
||||||
cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
||||||
@echo "raylib development files installed/updated!"
|
@echo "raylib development files installed/updated!"
|
||||||
else
|
else
|
||||||
|
|||||||
@ -199,7 +199,7 @@ RLAPI Matrix GetCameraProjectionMatrix(Camera *camera, float aspect);
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#define CAMERA_MOVE_SPEED 5.4f // Units per second
|
#define CAMERA_MOVE_SPEED 5.4f // Units per second
|
||||||
#define CAMERA_ROTATION_SPEED 0.03f
|
#define CAMERA_ROTATION_SPEED 0.03f
|
||||||
#define CAMERA_PAN_SPEED 0.2f
|
#define CAMERA_PAN_SPEED 2.0f
|
||||||
|
|
||||||
// Camera mouse movement sensitivity
|
// Camera mouse movement sensitivity
|
||||||
#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f
|
#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f
|
||||||
|
|||||||
@ -3295,9 +3295,9 @@ Color GetImageColor(Image image, int x, int y)
|
|||||||
case PIXELFORMAT_UNCOMPRESSED_R32G32B32A32:
|
case PIXELFORMAT_UNCOMPRESSED_R32G32B32A32:
|
||||||
{
|
{
|
||||||
color.r = (unsigned char)(((float *)image.data)[(y*image.width + x)*4]*255.0f);
|
color.r = (unsigned char)(((float *)image.data)[(y*image.width + x)*4]*255.0f);
|
||||||
color.g = (unsigned char)(((float *)image.data)[(y*image.width + x)*4]*255.0f);
|
color.g = (unsigned char)(((float *)image.data)[(y*image.width + x)*4 + 1]*255.0f);
|
||||||
color.b = (unsigned char)(((float *)image.data)[(y*image.width + x)*4]*255.0f);
|
color.b = (unsigned char)(((float *)image.data)[(y*image.width + x)*4 + 2]*255.0f);
|
||||||
color.a = (unsigned char)(((float *)image.data)[(y*image.width + x)*4]*255.0f);
|
color.a = (unsigned char)(((float *)image.data)[(y*image.width + x)*4 + 3]*255.0f);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case PIXELFORMAT_UNCOMPRESSED_R16:
|
case PIXELFORMAT_UNCOMPRESSED_R16:
|
||||||
@ -3319,9 +3319,9 @@ Color GetImageColor(Image image, int x, int y)
|
|||||||
case PIXELFORMAT_UNCOMPRESSED_R16G16B16A16:
|
case PIXELFORMAT_UNCOMPRESSED_R16G16B16A16:
|
||||||
{
|
{
|
||||||
color.r = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4])*255.0f);
|
color.r = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4])*255.0f);
|
||||||
color.g = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4])*255.0f);
|
color.g = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4 + 1])*255.0f);
|
||||||
color.b = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4])*255.0f);
|
color.b = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4 + 2])*255.0f);
|
||||||
color.a = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4])*255.0f);
|
color.a = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[(y*image.width + x)*4 + 3])*255.0f);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: TRACELOG(LOG_WARNING, "Compressed image format does not support color reading"); break;
|
default: TRACELOG(LOG_WARNING, "Compressed image format does not support color reading"); break;
|
||||||
|
|||||||
Reference in New Issue
Block a user