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
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 4e8c535..f1c45b6 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,17 +7,22 @@
-
-
+ {
+ "useNewFormat": true
+}
+
+
+
+
+
+
@@ -25,10 +30,12 @@
-
-
-
-
+
+
+
+
+
+
@@ -38,6 +45,7 @@
+
@@ -47,10 +55,10 @@
-
+ {
+ "customColor": "",
+ "associatedIndex": 1
+}
@@ -58,14 +66,21 @@
1763452643165
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e31108..80d2908 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@ set(SRC_FILES
${CMAKE_CURRENT_LIST_DIR}/main.cpp
${CMAKE_CURRENT_LIST_DIR}/gamecube.cpp
${CMAKE_CURRENT_LIST_DIR}/gamematrix.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/createCube.cpp
)
set(INCLUDE_DIRS
diff --git a/createCube.cpp b/createCube.cpp
new file mode 100644
index 0000000..8f1900d
--- /dev/null
+++ b/createCube.cpp
@@ -0,0 +1,71 @@
+#include "createCube.h"
+#include
+
+std::vector createCubes(int pairs)
+{
+ //zwei bis zehn paare
+ if (pairs >10 || pairs <= 1)
+ {
+ // 6 Karten-Positionen im 3x2 Raster
+ return {{-2, 0, -2}, {0, 0, -2}, {2, 0, -2},{-2, 0, 0}, {0, 0, 0}, {2, 0, 0}}; // Default field
+ }
+ std::vector fieldSize = calculateFieldSize(pairs);
+ std::vector cubePositions;
+ //std::cout<<(fieldSize[0])< calculateFieldSize(int pairs)
+{
+ std::vector best_field = {pairs, 2};
+ int cube_count = pairs *2;
+ int test_count = 3;
+ while (test_count < pairs)
+ {
+ for (int i = 3; i < pairs; i++)
+ {
+ if (test_count * i == cube_count && test_count + i < best_field[0] + best_field[1])
+ {
+ best_field[1] = test_count;
+ best_field[0] = i;
+ }
+ }
+ test_count++;
+ }
+ return best_field;
+
+};
+
+std::vector getColors(int pairs)
+{
+ if (pairs >10) pairs = 10;
+ std::vector returnColors;
+ Color colors[] = {
+ {230, 25, 75, 255}, // Red
+ {60, 180, 75, 255}, // Green
+ {0, 130, 200, 255}, // Blue
+ {245, 130, 48, 255}, // Orange
+ {145, 30, 180, 255}, // Purple
+ {255, 225, 25, 255}, // Yellow
+ {70, 240, 240, 255}, // Cyan
+ {240, 50, 230, 255}, // Magenta
+ {210, 245, 60, 255}, // Lime
+ {250, 190, 190, 255} // Pink
+ };
+ for (int i = 0; i < pairs; i++)
+ {
+ returnColors.push_back(colors[i]);
+ }
+ std::cout << returnColors.size() << std::endl;
+ return returnColors;
+};
diff --git a/createCube.h b/createCube.h
new file mode 100644
index 0000000..e92e6f4
--- /dev/null
+++ b/createCube.h
@@ -0,0 +1,11 @@
+#pragma once
+#include "gamecube.h"
+
+
+
+std::vector createCubes(int pairs);
+
+std::vector getColors(int pairs);
+
+std::vector calculateFieldSize(int pairs);
+
diff --git a/main.cpp b/main.cpp
index 9d1abe5..8fd4b96 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,4 +1,5 @@
#include "gamecube.h"
+#include "createCube.h"
#include
#include
@@ -17,21 +18,22 @@ int main()
SetTargetFPS(60);
Camera3D camera{};
- camera.position = {6.0f, 6.0f, 6.0f};
+ camera.position = {8.0f, 8.5f, 8.0f};
camera.target = {0.0f, 0.0f, 0.0f};
camera.up = {0.0f, 1.0f, 0.0f};
camera.fovy = 45.0f;
camera.projection = CAMERA_PERSPECTIVE;
- // Nur 3 Farben für 3 Paare
- Color colors[] = { RED, GREEN, BLUE };
+ int cubePairs = 3; //Cube count => 2*cubePairs
+ std::vector positions =createCubes(cubePairs);
+
+ // Nur 3 Farben für 3 Paare
+ std::vector colors= getColors(cubePairs);
- // 6 Karten-Positionen im 3x2 Raster
- std::vector positions = {{-2, 0, -2}, {0, 0, -2}, {2, 0, -2},{-2, 0, 0}, {0, 0, 0}, {2, 0, 0}};
// Farben doppelt in einen Pool legen und mischen
std::vector colorPool;
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < cubePairs; i++)
{
colorPool.push_back(colors[i]);
colorPool.push_back(colors[i]);
@@ -46,7 +48,7 @@ int main()
// Karten/Würfel erstellen
std::vector cubes;
- for (int i = 0; i < 6; i++)
+ for (int i = 0; i < cubePairs*2; i++)
cubes.emplace_back(positions[i], colorPool[i]);
gamecube* first = nullptr;