From fb6a4df1bb848c7254fb95defde26ccafa35a5575fc8de84a6cc247f9fe9a061 Mon Sep 17 00:00:00 2001 From: yeet Date: Sun, 1 Feb 2026 16:51:56 +0000 Subject: [PATCH] Initial commit --- .gitignore | 93 ++++++++++++++++++++++ .gitmodules | 3 + .vscode/c_cpp_properties.json | 27 +++++++ .vscode/launch.json | 30 +++++++ .vscode/tasks.json | 93 ++++++++++++++++++++++ CMakeLists.txt | 124 +++++++++++++++++++++++++++++ DemoProject/Resources/test.png | Bin 0 -> 608 bytes DemoProject/include/globalVars.hpp | 3 + DemoProject/src/main.cpp | 86 ++++++++++++++++++++ LICENSE | 18 +++++ ProjectConfigurator.sh | 109 +++++++++++++++++++++++++ README.md | 3 + TSE | 1 + 13 files changed, 590 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 CMakeLists.txt create mode 100644 DemoProject/Resources/test.png create mode 100644 DemoProject/include/globalVars.hpp create mode 100644 DemoProject/src/main.cpp create mode 100644 LICENSE create mode 100755 ProjectConfigurator.sh create mode 100644 README.md create mode 160000 TSE diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..192c4c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,93 @@ +# ---> C++ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Executables +*.exe +*.out +*.app + +# ---> C +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# ---> CMake +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +CMakeUserPresets.json + +build +bin +lib \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dbddb60 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "TSE"] + path = TSE + url = https://git.kerner.dev/yeet/TSE.git diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..329a6ae --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/DemoProject/include", + "${workspaceFolder}/DemoProject/src", + "${workspaceFolder}/TSE/TSE_Base/include", + "${workspaceFolder}/TSE/TSE_Base/src", + "${workspaceFolder}/TSE/TSE_Core/include", + "${workspaceFolder}/TSE/TSE_Core/src", + "${workspaceFolder}/TSE/TSE_Math/src", + "${workspaceFolder}/TSE/TSE_GlfwImpl/include", + "${workspaceFolder}/TSE/TSE_GlfwImpl/src", + "${workspaceFolder}/TSE/TSE_GlfwOpenGlImpl/include", + "${workspaceFolder}/TSE/TSE_GlfwOpenGlImpl/src", + "${workspaceFolder}/TSE/TSE_Editor/src" + ], + "defines": [], + "compilerPath": "/usr/bin/clang++", + "cStandard": "c17", + "cppStandard": "c++20", + "intelliSenseMode": "clang-x64" + } + ], + "version": 4 +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b8c34a0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,30 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Linux", + "type": "cppdbg", + "request": "launch", + "MIMode": "gdb", + "program": "${workspaceFolder}/bin/DemoProject", + "preLaunchTask": "build_debug_linux", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/bin" + }, + { + "name": "Debug Windows", + "type": "cppvsdbg", + "request": "launch", + //"MIMode": "gdb", + "program": "${workspaceFolder}/bin/DemoProject", + "preLaunchTask": "build_debug_linux", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/bin" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..eb7dd36 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,93 @@ +{ + "version": "2.0.0", + "tasks": [ + //Build Linux + + { + "label": "make_linux", + "type": "shell", + "command": "cmake", + "args": [ + "--build", + "${workspaceFolder}/build", + "--target", + "all" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "build_debug_linux_cmake", + "type": "shell", + "command": "cmake", + "args": [ + "-S", + "${workspaceFolder}/.", + "-B", + "${workspaceFolder}/./build", + "-DDEBUG=ON", + "-G Ninja", + "-DCMAKE_C_COMPILER=clang", + "-DCMAKE_CXX_COMPILER=clang++", + "-DCMAKE_LINKER=lld-link", + "-DCMAKE_BUILD_TYPE=Debug" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "build_release_linux_cmake", + "type": "shell", + "command": "cmake", + "args": [ + "-S", + "${workspaceFolder}/.", + "-B", + "${workspaceFolder}/./build", + "-DDEBUG=OFF", + "-G Ninja", + "-DCMAKE_C_COMPILER=clang", + "-DCMAKE_CXX_COMPILER=clang++", + "-DCMAKE_LINKER=lld-link", + "-DCMAKE_BUILD_TYPE=Release" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "build_debug_linux", + "dependsOn": [ + "build_debug_linux_cmake", + "make_linux" + ], + "dependsOrder": "sequence", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "build_release_linux", + "dependsOn": [ + "build_release_linux_cmake", + "make_linux" + ], + "dependsOrder": "sequence", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9eeb6e9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,124 @@ +#cmake version +cmake_minimum_required(VERSION 3.31) + +#project name +project(DemoProject) + +#cpp settings +find_program(CLANG_C NAMES clang) +find_program(CLANG_CXX NAMES clang++) + +if(CLANG_C AND CLANG_CXX) + message(STATUS "foung Clang, using as Compiler") + set(CMAKE_C_COMPILER ${CLANG_C} CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER ${CLANG_CXX} CACHE STRING "C++ Compiler" FORCE) +else() + message(STATUS "Clang not found, using Standard-Compiler") +endif() +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +#project output settings +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_SOURCE_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_SOURCE_DIR}/bin") + +#engine projects +add_subdirectory(TSE/TSE_Base) +add_subdirectory(TSE/TSE_Math) +add_subdirectory(TSE/TSE_Core) +add_subdirectory(TSE/TSE_Editor) +add_subdirectory(TSE/TSE_GlfwImpl) +add_subdirectory(TSE/TSE_GlfwOpenGlImpl) + +#source files +file(GLOB CPP_SOURCE + "${PROJECT_SOURCE_DIR}/DemoProject/src/*.cpp" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*.cpp" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*/*.cpp" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*/*/*.cpp" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*.c" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*.c" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*/*.c" + "${PROJECT_SOURCE_DIR}/DemoProject/src/*/*/*/*.c" +) + +#includes +include_directories(${PROJECT_SOURCE_DIR}/DemoProject/src) +include_directories(${PROJECT_SOURCE_DIR}/DemoProject/include) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Math/src) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Core/src) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Base/src) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Base/include) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_Editor/src) + +#includes Glfw +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwImpl/src) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwImpl/include) + +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwOpenGlImpl/src) +include_directories(${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwOpenGlImpl/include) + +#project def +add_executable(DemoProject ${CPP_SOURCE}) + +if (WIN32) + if(DEBUG) + set(DEBUGSPEC + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/FreeImageLib.d.lib" + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/box2dd.lib" + ) + else() + set(DEBUGSPEC + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/FreeImageLib.r.lib" + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/box2d.lib" + ) + endif() + set(LIB_SOURCE + "${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwImpl/include/glfw3.lib" + # "${PROJECT_SOURCE_DIR}/../TSE.Core/lib/freetype.lib" + "${DEBUGSPEC}" + ) +else() + set(LIB_SOURCE + # "${PROJECT_SOURCE_DIR}/../TSE.Core/lib/libfreetype.a" + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/libfreeimage.a" + "${PROJECT_SOURCE_DIR}/TSE/TSE_GlfwImpl/include/libglfw3.a" + "${PROJECT_SOURCE_DIR}/TSE/TSE_Core/include/libbox2d.a" + ) +endif() + +if (WIN32) + target_link_libraries(DemoProject PUBLIC + TSE_Base + TSE_Math + TSE_Core + TSE_GlfwImpl + TSE_GlfwOpenGlImpl + TSE_Editor + ${LIB_SOURCE}) +else() + target_link_libraries(DemoProject PUBLIC + TSE_Editor + TSE_GlfwOpenGlImpl + TSE_GlfwImpl + TSE_Core + TSE_Math + TSE_Base + ${LIB_SOURCE}) +endif() + +#flags +target_compile_options(DemoProject PRIVATE -march=native) + +set(TARGET_DIR "${PROJECT_SOURCE_DIR}/bin") + +add_custom_command( + TARGET DemoProject + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${PROJECT_SOURCE_DIR}/DemoProject/Resources" + "${TARGET_DIR}" + COMMENT "📂 Kopiere Resources/ nach bin/ nach Buildabschluss\n" +) \ No newline at end of file diff --git a/DemoProject/Resources/test.png b/DemoProject/Resources/test.png new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..33c10d9c9dfe6722170bbcbac976abf9b5d2a675675a65842e4a789481b0a830 GIT binary patch literal 608 zcmV-m0-ybfP)EX>4Tx04R}tkv&MmKpe$iQ;VV%K|6?4$WWc^q9Ts93Pq?8YK2xEOfLO`CJjl7 zi=*ILaPVWX>fqw6tAnc`2!4RL3r>nIQsV!TLW@`rj{EWM-sA2aAk@oDv$|q{rrTyJ z5f?MrRk8aO0gPf0eF)3UGUg;HiH_sz9zMR_MR``|bAOJ0HD@uvClbe)VcNtS#50?= z!FiuJ#EP;?d`>)J(glehxvqHp#<}3Kz%xT;IyFxmA{Gm6th6yJni}ymaYWU0$`>*o ztDLtuYvn3y-jlyDnA2C5xlS{T1QxLb2_h6!Q9>CuqO|IySV+-+yn}zl^-JVZ$W;O( z#{w$QAiI9>Klt6Pm7kjQl7ev{@ZvZhV?g&V(5N}i_p#$NP5}QiaHY5Wl{zr{NqViN zMUH@hZQ$a%r73&B0000 +#include "GL/gl3w.h" +#include "globalVars.hpp" +#include "WindowGlfw.hpp" +#include "OpenGLRenderingBackend.hpp" +#include "imgui/imgui.h" +#include "shader/defaultShaderHandler.cpp" +#include "DefaultRendererOpenGL.hpp" +#include "BehaviourScripts/RectBase.hpp" +#include "BehaviourScripts/Renderable.hpp" +#include "BehaviourScripts/Camera.hpp" +#include "elements/Sprite.hpp" +#include "elements/Texture.hpp" +#include "elements/Layer.hpp" +#include "elements/Scene.hpp" +#include "EditorSubsystem.hpp" + +using namespace TSE; +using namespace TSE::GLFW; +using namespace TSE::EDITOR; + +int main(int argc, char** argv) +{ + IWindow* wnd = new WindowGlfw("DemoProject", 600, 400, new OpenGLRenderingBackend(Color::aqua, false, 4, true)); + EditorSubsystem editor; + LoadBasicShaders(600, 400); + + DefaultRendererOpenGL rnd = DefaultRendererOpenGL(*BasicShader::Instance()); + + #pragma region obj1 + + Transformable* obj1 = new Transformable("testObj"); + + RectBase rb = RectBase(); + obj1->AddBehaviourScript(&rb); + Material mat = Material("testMat", BasicShader::Instance()); + mat.SetValue("mainColor", Color::black); + Renderable r = Renderable(&mat); + obj1->AddBehaviourScript(&r); + obj1->position = Vector3(0,0,0); + obj1->scale = Vector3(8,1,1); + + #pragma endregion + + Layer game("game"); + + game.AddTransformable(obj1); + + Scene scene; + scene.AddLayer(&game); + scene.AddLayer(&editor.editorLayer); + + //((Camera*)(editor.editorLayer.GetAllObjects()[0]->GetBehaviourScriptAt(0)))->SetRenderTarget(wnd); + + editor.hv.SetScene(&scene); + + while(!wnd->ShouldClose()) + { + wnd->Clear(); + rnd.Begin(); + + scene.Render(rnd, *wnd); + + rnd.End(); + rnd.Flush(); + + scene.DoneRender(); + + //editor.sv.Render(); + editor.controller.Update(); + //ImGui::ShowDemoWindow(); + wnd->Update(); + scene.Update(); + } + UnLoadBasicShaders(); + Transformable::DeleteAll(); + + return 0; +} + +#if defined(_WIN32) +extern "C" { + __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; // NVIDIA + __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; // AMD +} +#endif \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f4011e8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2026 yeet + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ProjectConfigurator.sh b/ProjectConfigurator.sh new file mode 100755 index 0000000..504b251 --- /dev/null +++ b/ProjectConfigurator.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ----------------------------- +# Intro +# ----------------------------- +echo "Project Configurator" +echo "--------------------" + +# ----------------------------- +# Projektname abfragen +# ----------------------------- +read -rp "What should the project be called? " PROJECT_NAME + +if [[ -z "$PROJECT_NAME" ]]; then + echo "Project name cannot be empty." + exit 1 +fi + +if [[ ! "$PROJECT_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then + echo "Invalid project name. Use only letters, numbers, _ or -" + exit 1 +fi + +# ----------------------------- +# Ordner umbenennen +# ----------------------------- +if [ ! -d "DemoProject" ]; then + echo "Placeholder directory 'DemoProject' not found." + exit 1 +fi + +echo "Renaming project directory..." +mv "DemoProject" "$PROJECT_NAME" + +# ----------------------------- +# CMakeLists.txt anpassen +# ----------------------------- +if [ ! -f "CMakeLists.txt" ]; then + echo "CMakeLists.txt not found in root." + exit 1 +fi + +echo "Updating CMakeLists.txt..." +sed -i "s/DemoProject/$PROJECT_NAME/g" CMakeLists.txt + +# ----------------------------- +# globalVars.hpp anpassen +# ----------------------------- +GLOBAL_VARS_PATH="$PROJECT_NAME/include/globalVars.hpp" + +if [ ! -f "$GLOBAL_VARS_PATH" ]; then + echo "globalVars.hpp not found in root." + exit 1 +fi + +echo "Updating globalVars.hpp..." +sed -i "s/DemoProject/$PROJECT_NAME/g" "$GLOBAL_VARS_PATH" + +# ----------------------------- +# launch.json anpassen +# ----------------------------- +GLOBAL_VARS_PATH=".vscode/launch.json" + +if [ ! -f "$GLOBAL_VARS_PATH" ]; then + echo "globalVars.hpp not found in root." + exit 1 +fi + +echo "Updating globalVars.hpp..." +sed -i "s/DemoProject/$PROJECT_NAME/g" "$GLOBAL_VARS_PATH" + +# ----------------------------- +# Git Submodule aktualisieren +# ----------------------------- +if [ -f ".gitmodules" ]; then + echo "Initializing and updating submodules..." + git submodule update --init --recursive + + echo "Updating submodules to latest main branch..." + git submodule foreach ' + git fetch origin && + git checkout main && + git pull origin main + ' +else + echo "No submodules found. Skipping." +fi + +# ----------------------------- +# Git vorbereiten +# ----------------------------- +echo "Preparing git repository..." + +# falls das Repo aus Template kommt, existiert Git schon +git add . +git commit -m "Configure project $PROJECT_NAME" + +# ----------------------------- +# Ziel-Repository pushen +# ----------------------------- + +git push -u origin main + +# ----------------------------- +# Fertig +# ----------------------------- +echo "Done." +echo "Project '$PROJECT_NAME' is ready." diff --git a/README.md b/README.md new file mode 100644 index 0000000..967d471 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# TSE_Project_Template + +this is a template for using TSE \ No newline at end of file diff --git a/TSE b/TSE new file mode 160000 index 0000000..473ff08 --- /dev/null +++ b/TSE @@ -0,0 +1 @@ +Subproject commit 473ff0840dad104c9511f6aff70b449171f8979a19d075968da9f2ce5cb6ef41