SDL Updates

This commit is contained in:
Sri Sham Haran 2022-09-15 09:26:43 +08:00
parent 5e4eabc582
commit bd69c6043a
6 changed files with 37 additions and 95 deletions

View File

@ -8,16 +8,15 @@ echo "A - All"
echo "B - VMA" echo "B - VMA"
echo "C - msdf" echo "C - msdf"
echo "D - assimp" echo "D - assimp"
echo "E - ktx" echo "E - spdlog"
echo "F - spdlog" echo "F - reactphysics3d"
echo "G - reactphysics3d" echo "G - imgui"
echo "H - imgui" echo "H - imguizmo"
echo "I - imguizmo" echo "I - imnodes"
echo "J - imnodes" echo "J - tracy"
echo "K - tracy" echo "K - RTTR"
echo "L - RTTR" echo "L - yamlcpp"
echo "M - yamlcpp" echo "N - SDL"
echo "O - SDL"
echo --------------------------------------------------- echo ---------------------------------------------------
echo. echo.
@ -28,16 +27,15 @@ if %_e%==1 goto VMA
if %_e%==2 goto VMA if %_e%==2 goto VMA
if %_e%==3 goto MSDF if %_e%==3 goto MSDF
if %_e%==4 goto assimp if %_e%==4 goto assimp
if %_e%==5 goto ktx if %_e%==5 goto spdlog
if %_e%==6 goto spdlog if %_e%==6 goto reactphysics3d
if %_e%==7 goto reactphysics3d if %_e%==7 goto imgui
if %_e%==8 goto imgui if %_e%==8 goto imguizmo
if %_e%==9 goto imguizmo if %_e%==9 goto imnodes
if %_e%==10 goto imnodes if %_e%==10 goto tracy
if %_e%==11 goto tracy if %_e%==11 goto RTTR
if %_e%==12 goto RTTR if %_e%==12 goto yamlcpp
if %_e%==13 goto yamlcpp if %_e%==14 goto SDL
if %_e%==15 goto SDL
:VMA :VMA
echo -----------------------VMA---------------------------- echo -----------------------VMA----------------------------
@ -57,59 +55,59 @@ rmdir "Dependencies/assimp" /S /Q
git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp" git clone https://github.com/SHADE-DP/assimp.git "Dependencies/assimp"
if %_e%==4 (goto :done) else (goto :ktx) if %_e%==4 (goto :done) else (goto :ktx)
:ktx @REM :ktx
rmdir "Dependencies/ktx" /S /Q @REM rmdir "Dependencies/ktx" /S /Q
echo -----------------------ktx---------------------------- @REM echo -----------------------ktx----------------------------
git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx" @REM git clone https://github.com/SHADE-DP/ktx.git "Dependencies/ktx"
if %_e%==5 (goto :done) else (goto :spdlog) @REM if %_e%==5 (goto :done) else (goto :spdlog)
:spdlog :spdlog
echo -----------------------spdlog---------------------------- echo -----------------------spdlog----------------------------
rmdir "Dependencies/spdlog" /S /Q rmdir "Dependencies/spdlog" /S /Q
git clone https://github.com/SHADE-DP/spdlog.git "Dependencies/spdlog" 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 :reactphysics3d
echo -----------------------reactphysics3d---------------------------- echo -----------------------reactphysics3d----------------------------
rmdir "Dependencies/reactphysics3d" /S /Q rmdir "Dependencies/reactphysics3d" /S /Q
git clone https://github.com/SHADE-DP/reactphysics3d.git "Dependencies/reactphysics3d" 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 :imgui
echo -----------------------imgui---------------------------- echo -----------------------imgui----------------------------
rmdir "Dependencies/imgui" /S /Q rmdir "Dependencies/imgui" /S /Q
git clone https://github.com/SHADE-DP/imgui.git "Dependencies/imgui" 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 :imguizmo
echo -----------------------imguizmo---------------------------- echo -----------------------imguizmo----------------------------
rmdir "Dependencies/imguizmo" /S /Q rmdir "Dependencies/imguizmo" /S /Q
git clone https://github.com/SHADE-DP/ImGuizmo.git "Dependencies/imguizmo" 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 :imnodes
echo -----------------------imnodes---------------------------- echo -----------------------imnodes----------------------------
rmdir "Dependencies/imnodes" /S /Q rmdir "Dependencies/imnodes" /S /Q
git clone https://github.com/SHADE-DP/imnodes.git "Dependencies/imnodes" 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 :tracy
echo -----------------------tracy---------------------------- echo -----------------------tracy----------------------------
rmdir "Dependencies/tracy" /S /Q rmdir "Dependencies/tracy" /S /Q
git clone https://github.com/SHADE-DP/tracy.git "Dependencies/tracy" 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 :RTTR
echo -----------------------RTTR---------------------------- echo -----------------------RTTR----------------------------
rmdir "Dependencies/RTTR" /S /Q rmdir "Dependencies/RTTR" /S /Q
git clone https://github.com/SHADE-DP/RTTR.git "Dependencies/RTTR" 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 :yamlcpp
echo -----------------------yamlcpp---------------------------- echo -----------------------yamlcpp----------------------------
rmdir "Dependencies/yamlcpp" /S /Q rmdir "Dependencies/yamlcpp" /S /Q
git clone https://github.com/SHADE-DP/yaml-cpp.git "Dependencies/yamlcpp" git clone https://github.com/SHADE-DP/yaml-cpp.git "Dependencies/yamlcpp"
if %_e%==13 (goto :done) else (goto :SDL) if %_e%==12 (goto :done) else (goto :SDL)
:SDL :SDL
echo -----------------------SDL---------------------------- echo -----------------------SDL----------------------------

View File

@ -10,7 +10,6 @@ IncludeDir["tracy"] = "%{wks.location}/Dependencies/tracy"
IncludeDir["VMA"] = "%{wks.location}/Dependencies/VMA" IncludeDir["VMA"] = "%{wks.location}/Dependencies/VMA"
IncludeDir["yamlcpp"] = "%{wks.location}/Dependencies/yamlcpp/include" IncludeDir["yamlcpp"] = "%{wks.location}/Dependencies/yamlcpp/include"
IncludeDir["RTTR"] = "%{wks.location}/Dependencies/RTTR" IncludeDir["RTTR"] = "%{wks.location}/Dependencies/RTTR"
IncludeDir["ktx"] = "%{wks.location}/Dependencies/ktx"
IncludeDir["reactphysics3d"] = "%{wks.location}/Dependencies/reactphysics3d" IncludeDir["reactphysics3d"] = "%{wks.location}/Dependencies/reactphysics3d"
IncludeDir["SDL"] = "%{wks.location}/Dependencies/SDL" IncludeDir["SDL"] = "%{wks.location}/Dependencies/SDL"
IncludeDir["VULKAN"] = "$(VULKAN_SDK)" IncludeDir["VULKAN"] = "$(VULKAN_SDK)"

View File

@ -11,6 +11,7 @@
#include <chrono> #include <chrono>
#include <ratio> #include <ratio>
#include <ctime> #include <ctime>
#include <SDL.h>
namespace Sandbox namespace Sandbox
{ {
@ -24,9 +25,9 @@ namespace Sandbox
) )
{ {
//SHLOG_TITLE("Initialising SBApplication") //SHLOG_TITLE("Initialising SBApplication")
SHADE::SHSDLWindow::InitPlatform(); SDL_Init(SDL_INIT_VIDEO);
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow); window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
sdlWindow.CreateSDLWindow(window.GetHWND()); SDL_CreateWindowFrom(window.GetHWND());
#ifdef SHEDITOR #ifdef SHEDITOR
#else #else
@ -48,6 +49,7 @@ namespace Sandbox
void SBApplication::Exit(void) void SBApplication::Exit(void)
{ {
SDL_DestroyWindow(sdlWindow);
#ifdef SHEDITOR #ifdef SHEDITOR
#else #else
#endif #endif

View File

@ -1,6 +1,6 @@
#ifndef SB_APPLICATION_H #ifndef SB_APPLICATION_H
#define SB_APPLICATION_H #define SB_APPLICATION_H
#include <Graphics/Windowing/SDL/SHSDLWindow.h> #include <SDL_video.h>
#include "Graphics/Windowing/SHWindow.h" #include "Graphics/Windowing/SHWindow.h"
//using namespace SHADE; //using namespace SHADE;
@ -10,7 +10,7 @@ namespace Sandbox
{ {
private: private:
SHADE::SHWindow window; SHADE::SHWindow window;
SHADE::SHSDLWindow sdlWindow; SDL_Window* sdlWindow;
//SHAppConfig config; //SHAppConfig config;
public: public:
SBApplication() = default; SBApplication() = default;

View File

@ -1,36 +0,0 @@
#include "SHpch.h"
#include "SHSDLWindow.h"
#include "Tools/SHLogger.h"
namespace SHADE
{
SHSDLWindow::~SHSDLWindow()
{
SDL_DestroyWindow(sdlWindow);
}
void SHSDLWindow::InitPlatform(void) noexcept
{
SDL_Init(SDL_INIT_EVERYTHING);
}
void SHSDLWindow::CreateSDLWindow(const char* title, int x, int y, int width, int height) noexcept
{
sdlWindow = SDL_CreateWindow(title, x, y, width, height, 0);
if (sdlWindow == nullptr)
{
SHLOG_ERROR("Failed to create window")
}
}
void SHSDLWindow::CreateSDLWindow(HWND hwnd) noexcept
{
sdlWindow = SDL_CreateWindowFrom(hwnd);
if (sdlWindow == nullptr)
{
SHLOG_ERROR("Failed to create window from existing native Win32 Window")
}
}
}

View File

@ -1,21 +0,0 @@
#pragma once
#include <Windows.h>
#define SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN 0
#include <SDL.h>
namespace SHADE
{
class SHSDLWindow
{
public:
SHSDLWindow() = default;
~SHSDLWindow();
static void InitPlatform(void) noexcept;
void CreateSDLWindow(const char* title, int x, int y, int width, int height) noexcept;
void CreateSDLWindow(HWND hwnd) noexcept;
private:
SDL_Window* sdlWindow = nullptr;
};
}