Compare commits

...

3 Commits

Author SHA1 Message Date
BrSh31
3ceecb69f9 otto 2025-11-10 16:20:01 +01:00
BrSh31
cad7bcb83b Add .gitignore to ignore build and temporary files 2025-11-09 16:58:59 +01:00
BrSh31
8910b73468 Refactor CMakeLists.txt for platform-independent build and reorganize project structure 2025-11-09 16:48:06 +01:00
7 changed files with 130 additions and 92 deletions

31
.gitignore vendored Normal file
View File

@ -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

113
.idea/workspace.xml generated
View File

@ -28,52 +28,14 @@
</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 default="true" id="bc14ea44-6152-4afc-90d0-07644981c8ca" name="Changes" comment="otto">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gamecube.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/gamecube.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gamecube.h" beforeDir="false" afterPath="$PROJECT_DIR$/includes/gamecube.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gamematrix.h" beforeDir="false" afterPath="$PROJECT_DIR$/includes/gamematrix.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -101,29 +63,34 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;CMake Application.Prog3B.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.RadMigrateCodeStyle&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;RunOnceActivity.readMode.enableVisualFormatting&quot;: &quot;true&quot;,
&quot;RunOnceActivity.west.config.association.type.startup.service&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;last_opened_file_path&quot;: &quot;/Users/bendit.str/Desktop/CLION/PROG_3B&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"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": "Merging 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>
<component name="RunManager">
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
</method>
</configuration>
<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" />
@ -158,7 +125,15 @@
<option name="project" value="LOCAL" />
<updated>1761580176311</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="otto">
<option name="closed" value="true" />
<created>1762787735213</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1762787735214</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -171,6 +146,6 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="otto" />
<option name="LAST_COMMIT_MESSAGE" value="" />
<option name="LAST_COMMIT_MESSAGE" value="otto" />
</component>
</project>

View File

@ -1,39 +1,71 @@
cmake_minimum_required(VERSION 3.28)
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
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
# Set the default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
set(SRC_FILES
${CMAKE_CURRENT_LIST_DIR}/main.cpp
${CMAKE_CURRENT_LIST_DIR}/gamecube.cpp
)
# --- Sources & Include directories ---
# Automatically include all .cpp files in the src/ folder
file(GLOB SRC_FILES "src/*.cpp")
# Include directories for header files
set(INCLUDE_DIRS
${CMAKE_CURRENT_LIST_DIR}/linux
${CMAKE_CURRENT_LIST_DIR}/includes
${CMAKE_CURRENT_LIST_DIR}/raylib
)
add_executable(${EXECUTABLE_NAME} ${SRC_FILES})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${INCLUDE_DIRS})
target_link_libraries(${EXECUTABLE_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/${OS_NAME}/libgamematrix.a
${CMAKE_CURRENT_LIST_DIR}/${OS_NAME}/libraylib.a
)
# Create the executable target
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Add include directories to the target
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIRS})
# --- Automatic platform detection ---
if (WIN32)
target_link_libraries(Prog3B PRIVATE winmm)
endif()
# Windows build
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)
if (APPLE)
target_link_libraries(Prog3B "-framework IOKit")
target_link_libraries(Prog3B "-framework Cocoa")
target_link_libraries(Prog3B "-framework OpenGL")
elseif(APPLE)
# macOS build
message(STATUS "Building for macOS...")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
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()

View File

@ -1,7 +1,7 @@
#pragma once
#include "gamematrix.h"
#include "raylib.h"
#include <rlgl.h>
#include "rlgl.h"
struct Vec3 //anisch unnötig weil rylib schon vec3 hat
{

View File

@ -1,4 +1,4 @@
#include "gamecube.h"
#include "../../prog_3/includes/gamecube.h"
#include <algorithm>
#include <ctime>