Compare commits
12
Commits
7259b8efb5
...
game_timer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89d25ccdf6 | ||
|
|
fba740c35c | ||
|
|
7666d43cfc | ||
|
|
28041fcf9f | ||
|
|
ad3ae081a9 | ||
|
|
779114d5d2 | ||
|
|
f613b5a97f | ||
|
|
90728defd6 | ||
|
|
ed1bf4a9b1 | ||
|
|
3ceecb69f9 | ||
|
|
cad7bcb83b | ||
|
|
8910b73468 |
No files matched your search
+31
@@ -0,0 +1,31 @@
|
|||||||
|
# Ignore CMake build folders
|
||||||
|
cmake-build-debug/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# CLion project files
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Object files and libraries
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
*.so
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# CMake generated files
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
cmake_install.cmake
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.log
|
||||||
|
*.tmp
|
||||||
Generated
-176
@@ -1,176 +0,0 @@
|
|||||||
<?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" />
|
|
||||||
</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>
|
|
||||||
<config projectName="Prog3B" targetName="Prog3B" />
|
|
||||||
</generated>
|
|
||||||
</component>
|
|
||||||
<component name="CMakeSettings">
|
|
||||||
<configurations>
|
|
||||||
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
|
|
||||||
</configurations>
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="bc14ea44-6152-4afc-90d0-07644981c8ca" name="Changes" comment="">
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/query/cache-v2" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/query/cmakeFiles-v1" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/query/codemodel-v2" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/query/toolchains-v1" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cache-v2-26fadb9308b8155ab863.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cache-v2-fbf4a2b9ca92fc7ef85d.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-02c2dc126835d6afc55e.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-308a5d6da17c4de0a89b.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-798b7ea5b88f6efe1e96.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-9dea2b442e0ec6147017.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-d0094a50bb2071803777.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/index-2025-10-26T17-41-38-0649.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/index-2025-10-27T15-44-42-0976.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/target-Prog3B-Debug-5b953e9dac460ea09172.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/target-Prog3B-Debug-792d125264c5420d6d10.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-2f427dcd6919a7ef66e5.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-6082f31f4c46160119db.json" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.ninja_deps" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/.ninja_log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeCCompiler.cmake" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeCXXCompiler.cmake" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_C.bin" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeDetermineCompilerABI_CXX.bin" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeRCCompiler.cmake" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CMakeSystem.cmake" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdC/CMakeCCompilerId.c" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdC/CMakeCCompilerId.o" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdC/a.exe" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdCXX/CMakeCXXCompilerId.cpp" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdCXX/CMakeCXXCompilerId.o" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.30.5/CompilerIdCXX/a.exe" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeConfigureLog.yaml" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Prog3B.dir/main.cpp.o" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-Debug-log.txt" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-environment.txt" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/cmake.check_cache" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/rules.ninja" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/Prog3B" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/Testing/Temporary/LastTest.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/build.ninja" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/compile_commands.json" beforeDir="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="ProjectApplicationVersion">
|
|
||||||
<option name="ide" value="CLion" />
|
|
||||||
<option name="majorVersion" value="2024" />
|
|
||||||
<option name="minorVersion" value="3.5" />
|
|
||||||
<option name="productBranch" value="Classic" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectColorInfo">{
|
|
||||||
"associatedIndex": 4
|
|
||||||
}</component>
|
|
||||||
<component name="ProjectId" id="34ehK54dp6OU0qNeW3IKWIrbM5O" />
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">{
|
|
||||||
"keyToString": {
|
|
||||||
"CMake Application.Prog3B.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",
|
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
||||||
"cf.first.check.clang-format": "false",
|
|
||||||
"cidr.known.project.marker": "true",
|
|
||||||
"git-widget-placeholder": "master",
|
|
||||||
"last_opened_file_path": "/Users/bendit.str/Desktop/CLION/PROG_3B",
|
|
||||||
"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 name="Prog3B" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="Prog3B" TARGET_NAME="Prog3B" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="Prog3B" RUN_TARGET_NAME="Prog3B">
|
|
||||||
<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="bc14ea44-6152-4afc-90d0-07644981c8ca" name="Changes" comment="" />
|
|
||||||
<created>1761579877481</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1761579877481</updated>
|
|
||||||
<workItem from="1761579878668" duration="1151000" />
|
|
||||||
<workItem from="1761659218955" duration="52000" />
|
|
||||||
<workItem from="1762719029166" duration="1000" />
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00001" summary="otto">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1761580147769</created>
|
|
||||||
<option name="number" value="00001" />
|
|
||||||
<option name="presentableId" value="LOCAL-00001" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1761580147769</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00002" summary="otto">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1761580176311</created>
|
|
||||||
<option name="number" value="00002" />
|
|
||||||
<option name="presentableId" value="LOCAL-00002" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1761580176311</updated>
|
|
||||||
</task>
|
|
||||||
<option name="localTasksCounter" value="3" />
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
|
||||||
<option name="version" value="3" />
|
|
||||||
</component>
|
|
||||||
<component name="VCPKGProject">
|
|
||||||
<isAutomaticCheckingOnLaunch value="false" />
|
|
||||||
<isAutomaticFoundErrors value="true" />
|
|
||||||
<isAutomaticReloadCMake value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="VcsManagerConfiguration">
|
|
||||||
<MESSAGE value="otto" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
+53
-21
@@ -1,39 +1,71 @@
|
|||||||
cmake_minimum_required(VERSION 3.28)
|
cmake_minimum_required(VERSION 3.28)
|
||||||
project(Prog3B)
|
project(Prog3B)
|
||||||
set(EXECUTABLE_NAME Prog3B)
|
|
||||||
set(OS_NAME windows)
|
# Set C++ standard to C++20
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# Generate compile_commands.json
|
# Generate compile_commands.json
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
|
|
||||||
# Set the default build type if not specified
|
# Set the default build type if not specified
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SRC_FILES
|
# --- Sources & Include directories ---
|
||||||
${CMAKE_CURRENT_LIST_DIR}/main.cpp
|
# Automatically include all .cpp files in the src/ folder
|
||||||
${CMAKE_CURRENT_LIST_DIR}/gamecube.cpp
|
file(GLOB SRC_FILES "src/*.cpp")
|
||||||
)
|
|
||||||
|
|
||||||
|
# Include directories for header files
|
||||||
set(INCLUDE_DIRS
|
set(INCLUDE_DIRS
|
||||||
${CMAKE_CURRENT_LIST_DIR}/linux
|
${CMAKE_CURRENT_LIST_DIR}/includes
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/raylib
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(${EXECUTABLE_NAME} ${SRC_FILES})
|
# Create the executable target
|
||||||
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${INCLUDE_DIRS})
|
add_executable(${PROJECT_NAME} ${SRC_FILES})
|
||||||
target_link_libraries(${EXECUTABLE_NAME} PRIVATE
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/${OS_NAME}/libgamematrix.a
|
# Add include directories to the target
|
||||||
${CMAKE_CURRENT_LIST_DIR}/${OS_NAME}/libraylib.a
|
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIRS})
|
||||||
)
|
|
||||||
|
|
||||||
|
# --- Automatic platform detection ---
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(Prog3B PRIVATE winmm)
|
# Windows build
|
||||||
endif()
|
message(STATUS "Building for Windows...")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/windows/libgamematrix.a
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/windows/libraylib.a
|
||||||
|
winmm # Windows multimedia library required by Raylib
|
||||||
|
)
|
||||||
|
|
||||||
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
elseif(APPLE)
|
||||||
if (APPLE)
|
# macOS build
|
||||||
target_link_libraries(Prog3B "-framework IOKit")
|
message(STATUS "Building for macOS...")
|
||||||
target_link_libraries(Prog3B "-framework Cocoa")
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
||||||
target_link_libraries(Prog3B "-framework OpenGL")
|
set(OS_FOLDER "mac_arm")
|
||||||
|
else()
|
||||||
|
set(OS_FOLDER "mac_x86")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/${OS_FOLDER}/libgamematrix.a
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/${OS_FOLDER}/libraylib.a
|
||||||
|
"-framework IOKit" # For device input
|
||||||
|
"-framework Cocoa" # For windows/UI
|
||||||
|
"-framework OpenGL" # For rendering
|
||||||
|
)
|
||||||
|
|
||||||
|
elseif(UNIX)
|
||||||
|
# Linux build
|
||||||
|
message(STATUS "Building for Linux...")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/linux/libgamematrix.a
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/linux/libraylib.a
|
||||||
|
m pthread dl # Standard Linux libraries
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
# Unsupported OS
|
||||||
|
message(FATAL_ERROR "Unsupported operating system.")
|
||||||
endif()
|
endif()
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
========================================================
|
||||||
|
Projekt: gamematrix (C++ Library)
|
||||||
|
Rolle: Projektleiter
|
||||||
|
Datei: requirements.txt
|
||||||
|
Datum: 10.11.2025
|
||||||
|
Team: ShehiBr (fuh wit yuh buh)
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 1. Projektziel
|
||||||
|
# ----------------------------
|
||||||
|
Beschreiben Sie hier kurz das Ziel des Projekts:
|
||||||
|
|
||||||
|
Ziel: Die Bibliothek gamematrix um grundlegende 3D-Transformationsfunktionen zu erweitern,
|
||||||
|
die später über pybind11 in Python eingebunden werden können.
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 2. Funktionale Anforderungen
|
||||||
|
# ----------------------------
|
||||||
|
Listen Sie alle Funktionen auf, die die Bibliothek bereitstellen soll.
|
||||||
|
Tragen Sie ein: Funktion, Eingabe, Ausgabe, kurze Beschreibung
|
||||||
|
|
||||||
|
| Funktion | Eingabe | Ausgabe | Kurzbeschreibung |
|
||||||
|
|---------------|------------------------------------|-----------------------|----------------------------------------|
|
||||||
|
| matmul | 4x4 Matrix A, 4x4 Matrix B | 4x4 Matrix | Multipliziert 2 Matrizen |
|
||||||
|
| translate | 3D Vektor | 4x4 Matrix | Liefert eine Übersetzungs Matrix |
|
||||||
|
| rot3D | Winkel in °, Rotationsachse (x/y/z)| 4x4 Matrix | Liefert eine Rotationsmatrix |
|
||||||
|
| identity (optional)| --- | 4x4 Matrix | Liefert eine Einheitsmatrix |
|
||||||
|
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||||
|
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 3. Nicht-funktionale Anforderungen
|
||||||
|
# ----------------------------
|
||||||
|
(z. B. Performance, Lesbarkeit, 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 werden in Grad angegeben
|
||||||
|
- Keine Skalierung, nur Rotation und Translation
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 5. Abnahmekriterien
|
||||||
|
# ----------------------------
|
||||||
|
Wie soll geprüft werden, dass die Anforderungen erfüllt sind?
|
||||||
|
(z. B. Unit-Tests, Beispielrotationen, Matrizenmultiplikation)
|
||||||
|
|
||||||
|
- Alle Matrixfunktionen liefern korrekte Ergebnisse bei Testeingaben
|
||||||
|
- Vergleich mit bekannten Referenzwerten (Rotation 90° um x-Achse, etc.)
|
||||||
|
- Kompilierbarkeit der Bibliothek und Integration in das Spielprojekt
|
||||||
|
|
||||||
|
========================================================
|
||||||
|
Hinweis:
|
||||||
|
- Diese Datei wird vom Projektleiter erstellt und gepflegt.
|
||||||
|
- Jede Phase des Projekts soll hier dokumentiert werden.
|
||||||
|
========================================================
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
========================================================
|
||||||
|
Projekt: gamematrix (C++ Library)
|
||||||
|
Rolle: Architekt
|
||||||
|
Datei: design.txt
|
||||||
|
Datum: ____________________
|
||||||
|
Team: ____________________
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 1. Projektstruktur / Namespace
|
||||||
|
# ----------------------------
|
||||||
|
Namespace: _______________________________________________
|
||||||
|
|
||||||
|
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? ☐ Ja ☐ Nein
|
||||||
|
- 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 |
|
||||||
|
| identity (optional)| --- | Mat4 | Identitätsmatrix |
|
||||||
|
| _____________ | __________________________________ | ____________________ | ______________________________ |
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 5. Designentscheidungen / Hinweise
|
||||||
|
# ----------------------------
|
||||||
|
- Rückgabe der Matrizen per Wert oder Referenz? ___________
|
||||||
|
- Verwendung von std::array oder std::vector? ___________
|
||||||
|
- Homogene Koordinaten für Translation / Rotation (4x4)? ☐ Ja ☐ Nein
|
||||||
|
- 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.
|
||||||
|
========================================================
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "gamematrix.h"
|
#include "gamematrix.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include <rlgl.h>
|
#include "rlgl.h"
|
||||||
|
|
||||||
struct Vec3 //anisch unnötig weil rylib schon vec3 hat
|
struct Vec3 //anisch unnötig weil rylib schon vec3 hat
|
||||||
{
|
{
|
||||||
File renamed without changes.
@@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
class Timer {
|
||||||
|
public:
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
|
long long elapsedMs() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> startTime;
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> endTime;
|
||||||
|
bool running = false;
|
||||||
|
};
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,75 @@
|
|||||||
|
#include <gamematrix.h>
|
||||||
|
|
||||||
|
|
||||||
|
std::array<std::array<double,4>,4> gameMatrix::matmul(const std::array<std::array<double,4>,4>& A,
|
||||||
|
const std::array<std::array<double,4>,4>& B) {
|
||||||
|
std::array<std::array<double,4>,4> result{};
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
for (int j = 0; j < 4; ++j) {
|
||||||
|
double sum = 0.0;
|
||||||
|
for (int k = 0; k < 4; ++k) {
|
||||||
|
sum += A[i][k] * B[k][j];
|
||||||
|
}
|
||||||
|
result[i][j] = sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, char axis) {
|
||||||
|
double angle = angle_deg * M_PI / 180.0; // Grad → Radiant
|
||||||
|
double c = std::cos(angle);
|
||||||
|
double s = std::sin(angle);
|
||||||
|
std::array<std::array<double,4>,4> R{}; // alles 0 initialisiert
|
||||||
|
|
||||||
|
switch (axis) {
|
||||||
|
case 'x':
|
||||||
|
R = {{
|
||||||
|
{1, 0, 0, 0},
|
||||||
|
{0, c, -s, 0},
|
||||||
|
{0, s, c, 0},
|
||||||
|
{0, 0, 0, 1}
|
||||||
|
}};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'y':
|
||||||
|
R = {{
|
||||||
|
{ c, 0, s, 0},
|
||||||
|
{ 0, 1, 0, 0},
|
||||||
|
{-s, 0, c, 0},
|
||||||
|
{ 0, 0, 0, 1}
|
||||||
|
}};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'z':
|
||||||
|
R = {{
|
||||||
|
{c, -s, 0, 0},
|
||||||
|
{s, c, 0, 0},
|
||||||
|
{0, 0, 1, 0},
|
||||||
|
{0, 0, 0, 1}
|
||||||
|
}};
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::invalid_argument("Axis must be 'x', 'y' or 'z'");
|
||||||
|
}
|
||||||
|
|
||||||
|
return R;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::array<std::array<double,4>,4> gameMatrix::translate(const std::array<double, 3>& pos) {
|
||||||
|
std::array<std::array<double,4>,4> T{{
|
||||||
|
{1, 0, 0, pos[0]},
|
||||||
|
{0, 1, 0, pos[1]},
|
||||||
|
{0, 0, 1, pos[2]},
|
||||||
|
{0, 0, 0, 1}
|
||||||
|
}};
|
||||||
|
|
||||||
|
return T;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Created by Fabian Weber on 10.11.25.
|
||||||
|
//
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "gametimer.h"
|
||||||
|
|
||||||
|
void Timer::start() {
|
||||||
|
running = true;
|
||||||
|
startTime = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Timer::stop() {
|
||||||
|
running = false;
|
||||||
|
endTime = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
long long Timer::elapsedMs() const {
|
||||||
|
if (running) {
|
||||||
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
std::chrono::high_resolution_clock::now() - startTime
|
||||||
|
).count();
|
||||||
|
}
|
||||||
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
endTime - startTime
|
||||||
|
).count();
|
||||||
|
}
|
||||||
+30
-2
@@ -1,4 +1,5 @@
|
|||||||
#include "gamecube.h"
|
#include "gamecube.h"
|
||||||
|
#include "gametimer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
@@ -14,6 +15,9 @@ int main()
|
|||||||
InitWindow(800, 600, "3D Memory Game with Matrix3D Library");
|
InitWindow(800, 600, "3D Memory Game with Matrix3D Library");
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
Timer timer;
|
||||||
|
timer.start();
|
||||||
|
|
||||||
Camera3D camera{};
|
Camera3D camera{};
|
||||||
camera.position = {6.0f, 6.0f, 6.0f};
|
camera.position = {6.0f, 6.0f, 6.0f};
|
||||||
camera.target = {0.0f, 0.0f, 0.0f};
|
camera.target = {0.0f, 0.0f, 0.0f};
|
||||||
@@ -108,9 +112,15 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gewinnprüfung
|
// Gewinnprüfung
|
||||||
if (!gameWon)
|
// Gewinnprüfung
|
||||||
gameWon = std::all_of(cubes.begin(), cubes.end(), [](const gamecube &c){ return c.IsMatched(); });
|
if (!gameWon) {
|
||||||
|
gameWon = std::all_of(cubes.begin(), cubes.end(),
|
||||||
|
[](const gamecube &c){ return c.IsMatched(); });
|
||||||
|
|
||||||
|
if (gameWon)
|
||||||
|
timer.stop();
|
||||||
|
}
|
||||||
|
// <--- NEU
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// Zeichnen
|
// Zeichnen
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
@@ -128,6 +138,24 @@ int main()
|
|||||||
else
|
else
|
||||||
DrawText("Flip 2 cubes - find matching pairs!", 10, 10, 20, DARKGRAY);
|
DrawText("Flip 2 cubes - find matching pairs!", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
|
if (gameWon)
|
||||||
|
DrawText("Congrats! You found all pairs!", 150, 260, 30, DARKBLUE);
|
||||||
|
else
|
||||||
|
DrawText("Flip 2 cubes - find matching pairs!", 10, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
|
|
||||||
|
if (!gameWon) {
|
||||||
|
long long elapsed = timer.elapsedMs() / 1000; // Sekunden
|
||||||
|
std::string timeStr = "Time: " + std::to_string(elapsed) + "s";
|
||||||
|
DrawText(timeStr.c_str(), 10, 40, 20, DARKGRAY);
|
||||||
|
} else {
|
||||||
|
// Optional: Endzeit anzeigen
|
||||||
|
long long totalTime = timer.elapsedMs() / 1000;
|
||||||
|
std::string endStr = "Finished in " + std::to_string(totalTime) + " seconds!";
|
||||||
|
DrawText(endStr.c_str(), 150, 300, 25, DARKBLUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user