Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b48ce207fc | ||
|
|
ca71990a2d | ||
|
|
c9701664ae | ||
|
|
8c67791c90 | ||
|
|
2822ce206e | ||
|
|
92e4646f11 | ||
|
|
873ec1d29c | ||
|
|
09ec5b288e | ||
|
|
c72b95036d | ||
|
|
3625bf2506 | ||
|
|
1ff4c9397c | ||
|
|
27ea219f41 | ||
|
|
86776f70bc | ||
|
|
dd23eef896 | ||
|
|
5a8a8ab255 | ||
|
|
42649ea0db | ||
|
|
85c69bf196 | ||
|
|
99f3b60261 | ||
|
|
fd43435619 | ||
|
|
1f6cb722f8 | ||
|
|
1a1f0d56cd | ||
|
|
3b0da0a8a5 |
@@ -1,3 +0,0 @@
|
||||
cmake-build-debug-mingw/
|
||||
cmake-build-debug/
|
||||
.idea/
|
||||
Generated
+131
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="BackendCodeEditorMiscSettings">
|
||||
<option name="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
|
||||
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexRemoved" />
|
||||
</component>
|
||||
<component name="CMakePresetLoader">{
|
||||
"useNewFormat": true
|
||||
}</component>
|
||||
<component name="CMakeProjectFlavorService">
|
||||
<option name="flavorId" value="CMakePlainProjectFlavor" />
|
||||
</component>
|
||||
<component name="CMakeReloadState">
|
||||
<option name="reloaded" value="true" />
|
||||
</component>
|
||||
<component name="CMakeRunConfigurationManager">
|
||||
<generated />
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e1b17018-ef5c-443f-8959-8b1378194905" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cache-v2-d31d158d5d73e0fb9fdb.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-0cd519ded762bd1e9624.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-bda2de0eb0d53be41ce0.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/index-2025-11-17T12-14-54-0703.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/target-Prog3B-Debug-749e7631d897282e0e5b.json" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeCXXCompiler.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeCXXCompiler.cmake" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_C.bin" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_C.bin" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_CXX.bin" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_CXX.bin" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeSystem.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeSystem.cmake" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdC/a.exe" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdC/a.exe" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdCXX/a.exe" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdCXX/a.exe" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeConfigureLog.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeConfigureLog.yaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Prog3B.dir/gamecube.cpp.obj" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Prog3B.dir/main.cpp.obj" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Prog3B.dir/tests.cpp.obj" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-Debug-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-Debug-log.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-environment.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-environment.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/rules.ninja" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/Testing/Temporary/LastTest.log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/Testing/Temporary/LastTest.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/compile_commands.json" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/compile_commands.json" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 0
|
||||
}</component>
|
||||
<component name="ProjectId" id="34yCUQNT5FEzK3w2FlmvvgM9a9g" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"CMake Application.Prog3B.executor": "Run",
|
||||
"CMake Application.Prog3B_tests.executor": "Run",
|
||||
"RunOnceActivity.RadMigrateCodeStyle": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"RunOnceActivity.west.config.association.type.startup.service": "true",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/marce/Desktop/Prog Praktikum C++/Vorlesung/Lambda",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="e1b17018-ef5c-443f-8959-8b1378194905" name="Changes" comment="" />
|
||||
<created>1762176441912</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1762176441912</updated>
|
||||
<workItem from="1762176443926" duration="3810000" />
|
||||
<workItem from="1762783055261" duration="74000" />
|
||||
<workItem from="1763367345575" duration="665000" />
|
||||
<workItem from="1763368121506" duration="692000" />
|
||||
<workItem from="1763385066418" duration="421000" />
|
||||
<workItem from="1763385896177" duration="1973000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VCPKGProject">
|
||||
<isAutomaticCheckingOnLaunch value="false" />
|
||||
<isAutomaticFoundErrors value="true" />
|
||||
<isAutomaticReloadCMake value="true" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,70 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Prog3B)
|
||||
|
||||
# === Basis-Konfiguration ===
|
||||
set(EXECUTABLE_NAME Prog3B)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Default-Build-Type (falls nicht angegeben)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
||||
endif()
|
||||
|
||||
# === Quell- und Header-Dateien ===
|
||||
set(SRC_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/gamecube.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/gamematrix.cpp
|
||||
)
|
||||
|
||||
set(INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}/windows
|
||||
${CMAKE_CURRENT_LIST_DIR}/raylib
|
||||
)
|
||||
|
||||
# === Betriebssystem automatisch erkennen ===
|
||||
if(WIN32)
|
||||
set(OS_DIR "windows")
|
||||
elseif(APPLE)
|
||||
# Prüfen, ob ARM oder x86
|
||||
execute_process(
|
||||
COMMAND uname -m
|
||||
OUTPUT_VARIABLE ARCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(ARCH STREQUAL "arm64")
|
||||
set(OS_DIR "mac_arm")
|
||||
else()
|
||||
set(OS_DIR "mac_x86")
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
set(OS_DIR "linux")
|
||||
else()
|
||||
message(FATAL_ERROR "Unbekanntes Betriebssystem!")
|
||||
endif()
|
||||
|
||||
|
||||
# === Executable erstellen ===
|
||||
add_executable(${EXECUTABLE_NAME} ${SRC_FILES})
|
||||
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${INCLUDE_DIRS})
|
||||
|
||||
# === Bibliotheken verlinken ===
|
||||
target_link_libraries(${EXECUTABLE_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/${OS_DIR}/libraylib.a
|
||||
)
|
||||
|
||||
# Windows: zusätzliche Systemlib
|
||||
if(WIN32)
|
||||
target_link_libraries(${EXECUTABLE_NAME} PRIVATE winmm)
|
||||
endif()
|
||||
|
||||
# macOS: Frameworks
|
||||
if(APPLE)
|
||||
target_link_libraries(${EXECUTABLE_NAME}
|
||||
"-framework IOKit"
|
||||
"-framework Cocoa"
|
||||
"-framework OpenGL"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
CMakeLists.txt not found in C:\Users\marce\Desktop\Prog Praktikum C++\Semester 3\Stone_Development Select CMakeLists.txt
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
========================================================
|
||||
Projekt: gamematrix (C++ Library)
|
||||
Rolle: Architekt
|
||||
Datei: design.txt
|
||||
Datum: 03.11
|
||||
Team: Stone_Development
|
||||
========================================================
|
||||
|
||||
# ----------------------------
|
||||
# 1. Projektstruktur / Namespace
|
||||
# ----------------------------
|
||||
Namespace: Matrix3D
|
||||
|
||||
Ziel: Saubere Trennung der Bibliothek, Vermeidung von Namenskonflikten.
|
||||
|
||||
Beispiel:
|
||||
namespace Matrix3D {
|
||||
// Funktionen, ggf Klasse(n)
|
||||
}
|
||||
|
||||
# ----------------------------
|
||||
# 2. Datenstrukturen / Klassen
|
||||
# ----------------------------
|
||||
Listen Sie die Klassen oder Structs auf, die verwendet werden:
|
||||
|
||||
| Name | Typ | Beschreibung |
|
||||
|--------|------------------------------------------|--------------|
|
||||
| Vec3 | struct Vec3 | 3D-Vektor (x, y, z) |
|
||||
| Mat4 | std::array<std::array<double,4>,4> | 4x4-Matrix (homogen) |
|
||||
| ______ | ________ | ___________________ |
|
||||
| ______ | ________ | ___________________ |
|
||||
|
||||
# ----------------------------
|
||||
# 3. Operatoren / Templates
|
||||
# ----------------------------
|
||||
Welche Operatoren oder Templates sollen definiert werden?
|
||||
|
||||
- Templates für unterschiedliche Datentypen? x Ja
|
||||
- Operatoren:
|
||||
- Mat4 * Mat4
|
||||
- Mat4 * Vec3
|
||||
|
||||
# ----------------------------
|
||||
# 4. Funktionen / Schnittstellen
|
||||
# ----------------------------
|
||||
Liste der Funktionen mit Eingabe/Ausgabe und kurzer Beschreibung:
|
||||
|
||||
| Funktion | Eingabe | Ausgabe | Kurzbeschreibung |
|
||||
|---------------|------------------------------------|-----------------------|----------------------------------------|
|
||||
| matmul | Mat4 A, Mat4 B | Mat4 | Matrixmultiplikation 4x4 |
|
||||
| translate | Vec3 pos | Mat4 | Verschiebungstransformation |
|
||||
| rot3D | double angle_deg, char axis | Mat4 | Rotation um Achse x/y/z | |
|
||||
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||
|
||||
# ----------------------------
|
||||
# 5. Designentscheidungen / Hinweise
|
||||
# ----------------------------
|
||||
- Rückgabe der Matrizen per Wert oder Referenz? Rückgabe
|
||||
- Verwendung von std::array oder std::vector? std::array
|
||||
- Homogene Koordinaten für Translation / Rotation (4x4)? ☐ Ja
|
||||
- Weitere Designüberlegungen: ___________________________
|
||||
|
||||
# ----------------------------
|
||||
# 6. Deliverables / Milestones
|
||||
# ----------------------------
|
||||
- design.txt fertig und im Branch architect committed
|
||||
- Übergabe an Entwickler für Implementierung
|
||||
|
||||
========================================================
|
||||
Hinweis:
|
||||
- Dieses Dokument dient als Grundlage für die Implementierung.
|
||||
- Alle Designentscheidungen sollen klar nachvollziehbar sein.
|
||||
========================================================
|
||||
|
||||
test
|
||||
@@ -1,71 +0,0 @@
|
||||
#include "gamecube.h"
|
||||
|
||||
gamecube::gamecube(const Vec3 &pos, Color col)
|
||||
: position(pos), color(col) {}
|
||||
|
||||
|
||||
// hallo hier ist robert
|
||||
//hallo Robert hier ist Niklas
|
||||
//test
|
||||
// Ich bin ein Roberter
|
||||
void gamecube::Update(float flipSpeed)
|
||||
{
|
||||
if (flippingForward)
|
||||
{
|
||||
rotation += flipSpeed;
|
||||
if (rotation >= 180.0f)
|
||||
{
|
||||
rotation = 180.0f;
|
||||
flippingForward = false;
|
||||
flipped = true;
|
||||
}
|
||||
}
|
||||
else if (flippingBackward)
|
||||
{
|
||||
rotation -= flipSpeed;
|
||||
if (rotation <= 0.0f)
|
||||
{
|
||||
rotation = 0.0f;
|
||||
flippingBackward = false;
|
||||
flipped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gamecube::FlipForward() { flippingForward = true; }
|
||||
void gamecube::FlipBackward() { flippingBackward = true; }
|
||||
|
||||
bool gamecube::IsFlipped() const { return flipped; }
|
||||
bool gamecube::IsMatched() const { return matched; }
|
||||
void gamecube::SetMatched(bool m) { matched = m; }
|
||||
|
||||
void gamecube::Draw() const
|
||||
{
|
||||
rlPushMatrix();
|
||||
|
||||
// Matrizen für Rotation und Translation erzeugen
|
||||
auto matrix_a = Matrix3D::gameMatrix::translate({ position.x, position.y, position.z});
|
||||
auto matrix_b = Matrix3D::gameMatrix::rot3D(rotation, 'y');
|
||||
|
||||
// Matrizen multiplizieren (Translation * Rotation)
|
||||
auto model = Matrix3D::gameMatrix::matmul(matrix_a, matrix_b);
|
||||
|
||||
// transform for raylib matrix
|
||||
float f[16];
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
f[j * 4 + i] = model[i][j];
|
||||
rlMultMatrixf(f);
|
||||
|
||||
if (rotation < 90.0f)
|
||||
DrawCube({0,0,0}, 1,1,1, GRAY);
|
||||
else
|
||||
DrawCube({0,0,0}, 1,1,1, color);
|
||||
|
||||
DrawCubeWires({0,0,0}, 1,1,1, BLACK);
|
||||
|
||||
rlPopMatrix();
|
||||
}
|
||||
|
||||
Vec3 gamecube::GetPosition() const { return position; }
|
||||
float gamecube::GetRotationY() const { return rotation; }
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
#include "gamematrix.h"
|
||||
#include "raylib.h"
|
||||
#include <rlgl.h>
|
||||
|
||||
struct Vec3
|
||||
{
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
class gamecube
|
||||
{
|
||||
public:
|
||||
gamecube(const Vec3 &pos, Color col);
|
||||
void Update(float flipSpeed);
|
||||
void FlipForward();
|
||||
void FlipBackward();
|
||||
bool IsFlipped() const;
|
||||
bool IsMatched() const;
|
||||
void SetMatched(bool m);
|
||||
void Draw() const;
|
||||
Vec3 GetPosition() const;
|
||||
float GetRotationY() const;
|
||||
Color GetColor() const { return color; }
|
||||
|
||||
private:
|
||||
Vec3 position;
|
||||
Color color;
|
||||
bool flipped = false;
|
||||
bool matched = false;
|
||||
bool flippingForward = false;
|
||||
bool flippingBackward = false;
|
||||
float rotation = 0.0f;
|
||||
};
|
||||
@@ -1,87 +0,0 @@
|
||||
#include "gamematrix.h"
|
||||
|
||||
|
||||
using namespace Matrix3D;
|
||||
|
||||
///
|
||||
/// @param matrix1 - First matrix
|
||||
/// @param matrix2 - Second matrix
|
||||
/// @return Returns the multiplication of matrix 1 and matrix 2.
|
||||
std::array<std::array<double,4>,4> gameMatrix::matmul(const std::array<std::array<double,4>,4>& matrix1,
|
||||
const std::array<std::array<double,4>,4>& matrix2) {
|
||||
|
||||
std::array<std::array<double,4>,4> matrix3 = {};
|
||||
if (matrix1[0].size() != matrix2.size()) {
|
||||
throw std::invalid_argument("Number of columns of matrix 1 must be equal to number of rows of matrix 2");
|
||||
};
|
||||
for (int i = 0; i < matrix1.size(); i++) {
|
||||
std::array<double,4> temp_array = {};
|
||||
for (int j = 0; j < matrix2[i].size(); j++) {
|
||||
double temp = 0;
|
||||
for (int k = 0; k < matrix2.size(); k++) {
|
||||
temp += matrix1[i][k] * matrix2[k][j];
|
||||
}
|
||||
temp_array[j] = temp;
|
||||
}
|
||||
matrix3[i] = temp_array;
|
||||
}
|
||||
return matrix3;
|
||||
}
|
||||
|
||||
///
|
||||
/// @param angle_deg Rotation angle
|
||||
/// @param axis Rotation axis (x, y, z)
|
||||
/// @return Returns a rotation matrix based on a given angle and axis.
|
||||
std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, char axis) {
|
||||
if (axis != 'x' && axis != 'y' && axis != 'z') {
|
||||
throw std::invalid_argument("Invalid axis");
|
||||
};
|
||||
const auto angle_rad = angle_deg * M_PI / 180;
|
||||
std::array<std::array<double,4>,4> rotationMatrix = {};
|
||||
switch (axis) {
|
||||
case 'x': {
|
||||
std::array<std::array<double,4>,4> rMx = {{
|
||||
{1, 0, 0, 0},
|
||||
{0, cos(angle_rad), -sin(angle_rad), 0},
|
||||
{0, sin(angle_rad), cos(angle_rad), 0},
|
||||
{0, 0, 0, 1}
|
||||
}};
|
||||
rotationMatrix = rMx;
|
||||
}
|
||||
break;
|
||||
case 'y': {
|
||||
std::array<std::array<double,4>,4> rMy = {{
|
||||
{cos(angle_rad), 0, sin(angle_rad), 0},
|
||||
{0, 1, 0, 0},
|
||||
{-sin(angle_rad), 0, cos(angle_rad), 0},
|
||||
{0, 0, 0, 1}
|
||||
}};
|
||||
rotationMatrix = rMy;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'z': {
|
||||
std::array<std::array<double,4>,4> rMz = {{
|
||||
{cos(angle_rad), -sin(angle_rad), 0, 0},
|
||||
{sin(angle_rad), cos(angle_rad), 0, 0},
|
||||
{0, 0, 1, 0},
|
||||
{0, 0, 0, 1}
|
||||
}};
|
||||
rotationMatrix = rMz;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return rotationMatrix;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// @param pos 3 point vector (x, y, z)
|
||||
/// @return Returns a 4x4 translation matrix base on a given vector.
|
||||
std::array<std::array<double,4>,4> gameMatrix::translate(const std::array<double, 3>& pos) {
|
||||
std::array<std::array<double,4>,4> transMatrix = {{{1, 0, 0, pos[0]}, {0, 1, 0, pos[1]}, {0, 0, 1, pos[2]}, {0, 0, 0, 1}}};
|
||||
return transMatrix;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
|
||||
namespace Matrix3D {
|
||||
class gameMatrix
|
||||
{
|
||||
public:
|
||||
// Matrix Multiplikation
|
||||
static std::array<std::array<double,4>,4> matmul(const std::array<std::array<double,4>,4>& matrix1,
|
||||
const std::array<std::array<double,4>,4>& matrix2);
|
||||
|
||||
// Rotationsmatrix um Achse x/y/z
|
||||
static std::array<std::array<double,4>,4> rot3D(double angle_deg, char axis);
|
||||
|
||||
// Verschiebung
|
||||
static std::array<std::array<double,4>,4> translate(const std::array<double, 3>& pos);
|
||||
|
||||
private:
|
||||
//TODO: Was für eine Rolle spielen Vec3 und Mat4???
|
||||
struct Vec3 {double x,y,z;};
|
||||
std::array<std::array<double,4>,4> Mat4 {};
|
||||
};
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,137 +0,0 @@
|
||||
#include "gamecube.h"
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 3D Memory Game – Hauptprogramm
|
||||
// -----------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
//CHRIS WAR HIER
|
||||
//AXIOM WAR HIER
|
||||
// Zufall initialisieren
|
||||
srand(time(NULL));
|
||||
// Fenster und Kamera
|
||||
InitWindow(800, 600, "3D Memory Game with Matrix3D Library");
|
||||
SetTargetFPS(60);
|
||||
|
||||
Camera3D camera{};
|
||||
camera.position = {6.0f, 6.0f, 6.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 };
|
||||
|
||||
// 6 Karten-Positionen im 3x2 Raster
|
||||
std::vector<Vec3> 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<Color> colorPool;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
colorPool.push_back(colors[i]);
|
||||
colorPool.push_back(colors[i]);
|
||||
}
|
||||
|
||||
// Fisher-Yates Shuffle mit rand()
|
||||
for (int i = colorPool.size() - 1; i > 0; --i)
|
||||
{
|
||||
int j = rand() % (i + 1); // Zufallsindex von 0 bis i
|
||||
std::swap(colorPool[i], colorPool[j]);
|
||||
}
|
||||
|
||||
// Karten/Würfel erstellen
|
||||
std::vector<gamecube> cubes;
|
||||
for (int i = 0; i < 6; i++)
|
||||
cubes.emplace_back(positions[i], colorPool[i]);
|
||||
|
||||
gamecube* first = nullptr;
|
||||
gamecube* second = nullptr;
|
||||
float flipSpeed = 5.0f; // Drehgeschwindigkeit
|
||||
bool gameWon = false;
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Hauptspielschleife
|
||||
// -----------------------------------------------------------
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Klick-Erkennung
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Animation aller Würfel
|
||||
for (auto &c : cubes)
|
||||
{
|
||||
c.Update(flipSpeed);
|
||||
|
||||
// Sobald ein Würfel vollständig umgedreht ist → merken
|
||||
if (c.IsFlipped() && !c.IsMatched())
|
||||
{
|
||||
if (!first) first = &c;
|
||||
else if (!second && &c != first) second = &c;
|
||||
}
|
||||
}
|
||||
|
||||
// Matching-Logik
|
||||
if (first && second)
|
||||
{
|
||||
Color col1 = first->GetColor();
|
||||
Color col2 = second->GetColor();
|
||||
|
||||
if (col1.r == col2.r && col1.g == col2.g && col1.b == col2.b)
|
||||
{
|
||||
first->SetMatched(true);
|
||||
second->SetMatched(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
first->FlipBackward();
|
||||
second->FlipBackward();
|
||||
}
|
||||
|
||||
first = second = nullptr;
|
||||
}
|
||||
|
||||
// Gewinnprüfung
|
||||
if (!gameWon)
|
||||
gameWon = std::all_of(cubes.begin(), cubes.end(), [](const gamecube &c){ return c.IsMatched(); });
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Zeichnen
|
||||
// -----------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginMode3D(camera);
|
||||
|
||||
for (auto &c : cubes)
|
||||
c.Draw();
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (gameWon)
|
||||
DrawText("Congrats! You found all pairs!", 150, 260, 30, DARKBLUE);
|
||||
else
|
||||
DrawText("Flip 2 cubes - find matching pairs!", 10, 10, 20, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
Hallo ehrwürdige Teamkameraden, wir werden das Projekt mit Bravur meistern! //lern deutsch //Wovon redest du hä? ist doch alles astrein... //du Schlingel
|
||||
-1708
File diff suppressed because it is too large
Load Diff
-2941
File diff suppressed because it is too large
Load Diff
-5262
File diff suppressed because it is too large
Load Diff
@@ -1,64 +0,0 @@
|
||||
========================================================
|
||||
Projekt: gamematrix (C++ Library)
|
||||
Rolle: Projektleiter
|
||||
Datei: requirements.txt
|
||||
Datum: 03.11.2025
|
||||
Team: Stone_Development
|
||||
========================================================
|
||||
|
||||
# ----------------------------
|
||||
# 1. Projektziel
|
||||
# ----------------------------
|
||||
Beschreiben Sie hier kurz das Ziel des Projekts:
|
||||
|
||||
Ziel: gamematrix.cpp erweitern, Matrizenoperationen für 3D-Transformationen bereitstellen,
|
||||
Integration in das bestehende Spielprojekt, Vorgehensmodell: Wasserfall
|
||||
|
||||
# ----------------------------
|
||||
# 2. Funktionale Anforderungen
|
||||
# ----------------------------
|
||||
Listen Sie alle Funktionen auf, die die Bibliothek bereitstellen soll.
|
||||
Tragen Sie ein: Funktion, Eingabe, Ausgabe, kurze Beschreibung
|
||||
|
||||
| Funktion | Eingabe, Kurzbeschreibung | Ausgabe | |
|
||||
|---------------|------------------------------------|-----------------------|----------------------------------------|
|
||||
| matmul | 4x4 Matrix A, 4x4 Matrix B | 4x4 Matrix | _____________________________________ |
|
||||
| translate | 3D Vektor | 4x4 Matrix | _____________________________________ |
|
||||
| rot3D | Winkel in °, Rotationsachse (x/y/z)| 4x4 Matrix | _____________________________________ |
|
||||
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||
|
||||
# ----------------------------
|
||||
# 3. Nicht-funktionale Anforderungen
|
||||
# ----------------------------
|
||||
|
||||
|
||||
- Lesbarkeit
|
||||
- Performance
|
||||
- Wartbarkeit
|
||||
- Python-Kompatibilität via pybind11
|
||||
|
||||
# ----------------------------
|
||||
# 4. Annahmen / Einschränkungen
|
||||
# ----------------------------
|
||||
(z. B. alle Matrizen sind 4x4, Winkel in Grad, nur double)
|
||||
|
||||
- Alle Matrizen sind 4x4
|
||||
- Winkel in Grad
|
||||
- nur double
|
||||
|
||||
# ----------------------------
|
||||
# 5. Abnahmekriterien
|
||||
# ----------------------------
|
||||
Wie soll geprüft werden, dass die Anforderungen erfüllt sind?
|
||||
(z. B. Unit-Tests, Beispielrotationen, Matrizenmultiplikation)
|
||||
|
||||
- Unit-Tests
|
||||
- Beispielrotationen
|
||||
- Matrizenmultiplikation
|
||||
|
||||
========================================================
|
||||
Hinweis:
|
||||
- Diese Datei wird vom Projektleiter erstellt und gepflegt.
|
||||
- Jede Phase des Projekts soll hier dokumentiert werden.
|
||||
========================================================
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user