diff --git a/Dependencies.bat b/Dependencies.bat index bbce926b..f156b91c 100644 --- a/Dependencies.bat +++ b/Dependencies.bat @@ -8,34 +8,34 @@ echo "A - All" echo "B - VMA" echo "C - msdf" echo "D - assimp" -echo "E - ktx" -echo "F - spdlog" -echo "G - reactphysics3d" -echo "H - imgui" -echo "I - imguizmo" -echo "J - imnodes" -echo "K - tracy" -echo "L - RTTR" -echo "M - yamlcpp" +echo "E - spdlog" +echo "F - reactphysics3d" +echo "G - imgui" +echo "H - imguizmo" +echo "I - imnodes" +echo "J - tracy" +echo "K - RTTR" +echo "L - yamlcpp" +echo "N - SDL" echo --------------------------------------------------- echo. -choice /C ABCDEFGHIJKLM /T 10 /D A +choice /C ABCDEFGHIJKLMNO /T 10 /D A set _e=%ERRORLEVEL% if %_e%==1 goto VMA if %_e%==2 goto VMA if %_e%==3 goto MSDF if %_e%==4 goto assimp -if %_e%==5 goto ktx -if %_e%==6 goto spdlog -if %_e%==7 goto reactphysics3d -if %_e%==8 goto imgui -if %_e%==9 goto imguizmo -if %_e%==10 goto imnodes -if %_e%==11 goto tracy -if %_e%==12 goto RTTR -if %_e%==13 goto yamlcpp +if %_e%==5 goto spdlog +if %_e%==6 goto reactphysics3d +if %_e%==7 goto imgui +if %_e%==8 goto imguizmo +if %_e%==9 goto imnodes +if %_e%==10 goto tracy +if %_e%==11 goto RTTR +if %_e%==12 goto yamlcpp +if %_e%==14 goto SDL :VMA echo -----------------------VMA---------------------------- @@ -55,58 +55,71 @@ rmdir "Dependencies/assimp" /S /Q git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp" if %_e%==4 (goto :done) else (goto :ktx) -:ktx -rmdir "Dependencies/ktx" /S /Q -echo -----------------------ktx---------------------------- -git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx" -if %_e%==5 (goto :done) else (goto :spdlog) +@REM :ktx +@REM rmdir "Dependencies/ktx" /S /Q +@REM echo -----------------------ktx---------------------------- +@REM git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx" +@REM if %_e%==5 (goto :done) else (goto :spdlog) :spdlog echo -----------------------spdlog---------------------------- rmdir "Dependencies/spdlog" /S /Q git clone https://github.com/SHADE-DP/spdlog.git "Dependencies/spdlog" -if %_e%==6 (goto :done) else (goto :reactphysics3d) +if %_e%==5 (goto :done) else (goto :reactphysics3d) :reactphysics3d echo -----------------------reactphysics3d---------------------------- rmdir "Dependencies/reactphysics3d" /S /Q git clone https://github.com/SHADE-DP/reactphysics3d.git "Dependencies/reactphysics3d" -if %_e%==7 (goto :done) else (goto :imgui) +if %_e%==6 (goto :done) else (goto :imgui) :imgui echo -----------------------imgui---------------------------- rmdir "Dependencies/imgui" /S /Q git clone https://github.com/SHADE-DP/imgui.git "Dependencies/imgui" -if %_e%==8 (goto :done) else (goto :imguizmo) +if %_e%==7 (goto :done) else (goto :imguizmo) :imguizmo echo -----------------------imguizmo---------------------------- rmdir "Dependencies/imguizmo" /S /Q git clone https://github.com/SHADE-DP/ImGuizmo.git "Dependencies/imguizmo" -if %_e%==9 (goto :done) else (goto :imnodes) +if %_e%==8 (goto :done) else (goto :imnodes) :imnodes echo -----------------------imnodes---------------------------- rmdir "Dependencies/imnodes" /S /Q git clone https://github.com/SHADE-DP/imnodes.git "Dependencies/imnodes" -if %_e%==10 (goto :done) else (goto :tracy) +if %_e%==9 (goto :done) else (goto :tracy) :tracy echo -----------------------tracy---------------------------- rmdir "Dependencies/tracy" /S /Q git clone https://github.com/SHADE-DP/tracy.git "Dependencies/tracy" -if %_e%==11 (goto :done) else (goto :RTTR) +if %_e%==10 (goto :done) else (goto :RTTR) :RTTR echo -----------------------RTTR---------------------------- rmdir "Dependencies/RTTR" /S /Q git clone https://github.com/SHADE-DP/RTTR.git "Dependencies/RTTR" -if %_e%==12 (goto :done) else (goto :yamlcpp) +if %_e%==11 (goto :done) else (goto :yamlcpp) :yamlcpp echo -----------------------yamlcpp---------------------------- rmdir "Dependencies/yamlcpp" /S /Q git clone https://github.com/SHADE-DP/yaml-cpp.git "Dependencies/yamlcpp" +if %_e%==12 (goto :done) else (goto :SDL) + +:SDL +echo -----------------------SDL---------------------------- +rmdir "Dependencies/SDL" /S /Q +mkdir "Dependencies/SDL/include" +mkdir "Dependencies/SDL/lib" +powershell -Command "& {wget https://github.com/libsdl-org/SDL/releases/download/release-2.24.0/SDL2-devel-2.24.0-VC.zip -OutFile "Dependencies/SDL/SDL.zip"}" +powershell -Command "& {Expand-Archive -LiteralPath Dependencies/SDL/SDL.zip -DestinationPath Dependencies/SDL/tmp}" +robocopy "Dependencies/SDL/tmp/SDL2-2.24.0/lib/x64" "Dependencies/SDL/lib/" /ns /nfl /ndl /nc /njh +robocopy "Dependencies/SDL/tmp/SDL2-2.24.0/include/" "Dependencies/SDL/include/" /ns /nfl /ndl /nc /njh +rmdir "Dependencies/SDL/tmp/" /s /q +powershell -Command "& {Remove-Item "Dependencies/SDL/SDL.zip"}" :done echo DONE! diff --git a/Dependencies.lua b/Dependencies.lua index 32382cf9..d2d6cdfd 100644 --- a/Dependencies.lua +++ b/Dependencies.lua @@ -10,6 +10,6 @@ IncludeDir["tracy"] = "%{wks.location}/Dependencies/tracy" IncludeDir["VMA"] = "%{wks.location}/Dependencies/VMA" IncludeDir["yamlcpp"] = "%{wks.location}/Dependencies/yamlcpp/include" IncludeDir["RTTR"] = "%{wks.location}/Dependencies/RTTR" -IncludeDir["ktx"] = "%{wks.location}/Dependencies/ktx" IncludeDir["reactphysics3d"] = "%{wks.location}/Dependencies/reactphysics3d" +IncludeDir["SDL"] = "%{wks.location}/Dependencies/SDL" IncludeDir["VULKAN"] = "$(VULKAN_SDK)" diff --git a/SHADE_Application/premake5.lua b/SHADE_Application/premake5.lua index 5c408fb5..98e26a3e 100644 --- a/SHADE_Application/premake5.lua +++ b/SHADE_Application/premake5.lua @@ -26,6 +26,7 @@ project "SHADE_Application" "../SHADE_Engine/src", "src", "%{IncludeDir.dotnet}/include", + "%{IncludeDir.SDL}/include", } flags @@ -36,6 +37,14 @@ project "SHADE_Application" links { "SHADE_Engine", + "SDL2.lib", + "SDL2main.lib" + } + + libdirs + { + "%{IncludeDir.spdlog}/lib", + "%{IncludeDir.SDL}/lib", } warnings 'Extra' diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index dc497dbe..2ce30a2f 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace Sandbox { @@ -27,7 +28,9 @@ namespace Sandbox // Set working directory SHADE::SHFileUtilities::SetWorkDirToExecDir(); + SDL_Init(SDL_INIT_VIDEO); window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow); + SDL_CreateWindowFrom(window.GetHWND()); #ifdef SHEDITOR #else @@ -49,6 +52,7 @@ namespace Sandbox void SBApplication::Exit(void) { + SDL_DestroyWindow(sdlWindow); #ifdef SHEDITOR #else #endif diff --git a/SHADE_Application/src/Application/SBApplication.h b/SHADE_Application/src/Application/SBApplication.h index a1bf11eb..9a6e4153 100644 --- a/SHADE_Application/src/Application/SBApplication.h +++ b/SHADE_Application/src/Application/SBApplication.h @@ -1,6 +1,7 @@ #ifndef SB_APPLICATION_H #define SB_APPLICATION_H -#include +#include +#include "Graphics/Windowing/SHWindow.h" //using namespace SHADE; namespace Sandbox @@ -9,6 +10,7 @@ namespace Sandbox { private: SHADE::SHWindow window; + SDL_Window* sdlWindow; //SHAppConfig config; public: SBApplication() = default; diff --git a/SHADE_Engine/premake5.lua b/SHADE_Engine/premake5.lua index f10369a5..a8f37057 100644 --- a/SHADE_Engine/premake5.lua +++ b/SHADE_Engine/premake5.lua @@ -31,7 +31,7 @@ project "SHADE_Engine" "%{IncludeDir.tracy}", "%{IncludeDir.VMA}/include", "%{IncludeDir.yamlcpp}", - "%{IncludeDir.ktx}/include", + "%{IncludeDir.SDL}/include", "%{IncludeDir.RTTR}/include", "%{IncludeDir.reactphysics3d}/include", "%{IncludeDir.VULKAN}/include", @@ -45,6 +45,7 @@ project "SHADE_Engine" "%{IncludeDir.assimp}/lib/Debug", "%{IncludeDir.assimp}/lib/Release", "%{IncludeDir.RTTR}/lib", + "%{IncludeDir.SDL}/lib", "%{IncludeDir.spdlog}/lib" } @@ -56,6 +57,8 @@ project "SHADE_Engine" "reactphysics3d", "imgui", "vulkan-1.lib", + "SDL2.lib", + "SDL2main.lib", "shaderc_shared.lib", "shlwapi" }