From 64adfd8a3976b0f433ce272d86af4129cd723739 Mon Sep 17 00:00:00 2001 From: bhattial100541 Date: Mon, 15 Dec 2025 12:03:00 +0100 Subject: [PATCH] .. --- src/main.cpp | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ee584bc..272e351 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,21 +262,7 @@ int main() startTime = GetTime(); timerStarted = true; } - - // Klick-Erkennung -<<<<<<< HEAD - if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - Vector2 mouse = GetMousePosition(); - for (auto &c : cubes) - { - if (!c.IsFlipped() && !c.IsMatched()) - { - Vector2 screenPos = GetWorldToScreen({c.GetPosition().x, c.GetPosition().y, c.GetPosition().z}, camera); - if (fabs(mouse.x - screenPos.x) < 40 && fabs(mouse.y - screenPos.y) < 40) - c.FlipForward(); -======= - // Klick-Erkennung (nur wenn noch nicht 2 ausgewählt sind) + // Klick-Erkennung (Ray Picking) – nur wenn noch nicht 2 ausgewählt sind if (!gameWon && IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (second == nullptr)) { Vector2 mouse = GetMousePosition(); @@ -289,11 +275,7 @@ int main() { if (c.IsMatched() || c.IsFlipped()) continue; - - - - auto p = c.GetPosition(); - + Vec3 p = c.GetPosition(); BoundingBox box; box.min = { p.x - 0.75f, p.y - 0.75f, p.z - 0.75f }; @@ -318,32 +300,18 @@ int main() { second = hitCube; second->FlipForward(); ->>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett) } } } - // Animation aller Würfel + // Animation aller Würfel (KEINE first/second Auto-Zuweisung hier!) for (auto &c : cubes) { c.Update(flipSpeed); -<<<<<<< HEAD - if (c.IsFlipped() && !c.IsMatched()) - { - if (!first) first = &c; - else if (!second && &c != first) second = &c; - } } - // Matching-Logik - if (first && second) -======= - } - - // Matching-Logik // Matching-Logik: erst wenn beide vollständig umgedreht sind if (first && second && first->IsFlipped() && second->IsFlipped()) ->>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett) { moves++; @@ -360,13 +328,9 @@ int main() first->FlipBackward(); second->FlipBackward(); } -<<<<<<< HEAD - first = second = nullptr; -======= first = nullptr; second = nullptr; ->>>>>>> 5fc4346 (funktioniert, 3 oder 6 + Timer komplett) } // Gewinnprüfung