summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
authorRay <[email protected]>2023-11-08 17:41:08 +0100
committerRay <[email protected]>2023-11-08 17:41:08 +0100
commitbbf0c3a46d27b723e73483bdd787c7713b31fe1a (patch)
treed0cb4223f357366f8eeb0171337f20f913100fd4 /examples/core
parentfe757b626703f91d59e04599ee033e993e00232b (diff)
downloadraylib-bbf0c3a46d27b723e73483bdd787c7713b31fe1a.tar.gz
raylib-bbf0c3a46d27b723e73483bdd787c7713b31fe1a.zip
REVIEWED: Added new examples to VS2022 solution
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_3d_camera_free.c2
-rw-r--r--examples/core/core_automation_events.pngbin0 -> 17155 bytes
-rw-r--r--examples/core/core_input_gamepad_info.c45
3 files changed, 28 insertions, 19 deletions
diff --git a/examples/core/core_3d_camera_free.c b/examples/core/core_3d_camera_free.c
index ec849758..3c30a426 100644
--- a/examples/core/core_3d_camera_free.c
+++ b/examples/core/core_3d_camera_free.c
@@ -47,7 +47,7 @@ int main(void)
//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_FREE);
- if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
+ if (IsKeyPressed('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
//----------------------------------------------------------------------------------
// Draw
diff --git a/examples/core/core_automation_events.png b/examples/core/core_automation_events.png
new file mode 100644
index 00000000..49cf3282
--- /dev/null
+++ b/examples/core/core_automation_events.png
Binary files differ
diff --git a/examples/core/core_input_gamepad_info.c b/examples/core/core_input_gamepad_info.c
index 55f0354b..9aebb815 100644
--- a/examples/core/core_input_gamepad_info.c
+++ b/examples/core/core_input_gamepad_info.c
@@ -31,40 +31,49 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad information");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
// Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
+ while (!WindowShouldClose()) // Detect window close button or ESC key
{
- int y = 10;
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+ // Draw
+ //----------------------------------------------------------------------------------
BeginDrawing();
- ClearBackground(RAYWHITE);
+ ClearBackground(RAYWHITE);
- for (int i = 0; i < 4; i++) // by default rcore.h has a MAX_GAMEPADS of 4 so mimmic that here.
- {
- if (IsGamepadAvailable(i))
+ for (int i = 0, y = 10; i < 4; i++) // MAX_GAMEPADS = 4
{
- DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 20, BLACK);
- y += 30;
- DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 20, BLACK);
- y += 30;
- for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
+ if (IsGamepadAvailable(i))
{
- DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 20, BLACK);
+ DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 20, BLACK);
y += 30;
- }
- for (int button = 0; button < 32; button++)
- {
- DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 20, BLACK);
+ DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 20, BLACK);
y += 30;
+
+ for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
+ {
+ DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 20, BLACK);
+ y += 30;
+ }
+
+ for (int button = 0; button < 32; button++)
+ {
+ DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 20, BLACK);
+ y += 30;
+ }
}
}
- }
- DrawFPS(GetScreenWidth() - 100, 100);
+ DrawFPS(GetScreenWidth() - 100, 100);
EndDrawing();
+ //----------------------------------------------------------------------------------
}
// De-Initialization