diff --git a/.clwb/.blaze/modules/.project-data-dir.iml b/.clwb/.blaze/modules/.project-data-dir.iml new file mode 100644 index 0000000..1ed44f8 --- /dev/null +++ b/.clwb/.blaze/modules/.project-data-dir.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.clwb/.blaze/modules/.workspace.iml b/.clwb/.blaze/modules/.workspace.iml new file mode 100644 index 0000000..6e20532 --- /dev/null +++ b/.clwb/.blaze/modules/.workspace.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.clwb/.idea/.name b/.clwb/.idea/.name new file mode 100644 index 0000000..709962e --- /dev/null +++ b/.clwb/.idea/.name @@ -0,0 +1 @@ +umbra \ No newline at end of file diff --git a/.clwb/.idea/modules.xml b/.clwb/.idea/modules.xml new file mode 100644 index 0000000..6e46a2e --- /dev/null +++ b/.clwb/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.clwb/.idea/vcs.xml b/.clwb/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/.clwb/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 77e6241..2b8786f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,5 @@ riderModule.iml /_ReSharper.Caches/ *.user -projs/shadow-file-format/shadow-file-format.vcxproj.user bazel-*/ \ No newline at end of file diff --git a/Umbra.CPP.props b/Umbra.CPP.props deleted file mode 100644 index 8eaa8c7..0000000 --- a/Umbra.CPP.props +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - 15.0 - {47591591-E091-4B88-8418-74D3CBEC5712} - Win32Proj - 10.0 - - - - - x64 - $(SolutionDir)bin\$(Configuration)\$(MSBuildProjectName)\ - $(SolutionDir)obj\$(Configuration)\$(MSBuildProjectName)\ - $(SolutionDir) - - - - Application - v143 - Unicode - - - - - true - true - - - false - false - true - - - - - - NotUsing - Level3 - Disabled - true - _CONSOLE;%(PreprocessorDefinitions) - true - pch.h - stdcpp20 - true - - - Console - true - - - - - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - - - - \ No newline at end of file diff --git a/Umbra.props b/Umbra.props deleted file mode 100644 index 0d9948f..0000000 --- a/Umbra.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - Debug - x64 - - - Release - x64 - - - - \ No newline at end of file diff --git a/projs/shadow-engine/BUILD.bazel b/projs/shadow-engine/BUILD.bazel new file mode 100644 index 0000000..10916b9 --- /dev/null +++ b/projs/shadow-engine/BUILD.bazel @@ -0,0 +1,17 @@ + + +cc_library( + name = "shadow-engine", + srcs = glob(["src/**/*.cpp", "src/**/*.h"]), + hdrs = glob(["src/**/*.h"]), + strip_include_prefix = "src/", + includes = [], + copts = [ + "/std:c++20" + ], + deps = [ + "//projs/shadow-utility", + "@sdl2" + ], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/projs/shadow-engine/shadow-engine.vcxproj b/projs/shadow-engine/shadow-engine.vcxproj deleted file mode 100644 index 7e22d1b..0000000 --- a/projs/shadow-engine/shadow-engine.vcxproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - 15.0 - {76759923-036B-4D7B-A79C-332698CDC6A8} - Win32Proj - shadow_engine - 10.0 - - - - - - - - - - - - - - - - - {47591591-e091-4b88-8418-74d3cbec5712} - shadow-entity - - - - - - \ No newline at end of file diff --git a/projs/shadow-engine/shadow-engine.vcxproj.filters b/projs/shadow-engine/shadow-engine.vcxproj.filters deleted file mode 100644 index 26977e8..0000000 --- a/projs/shadow-engine/shadow-engine.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/projs/shadow-engine/shadow-engine.vcxproj.user b/projs/shadow-engine/shadow-engine.vcxproj.user deleted file mode 100644 index 966b4ff..0000000 --- a/projs/shadow-engine/shadow-engine.vcxproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - true - - \ No newline at end of file diff --git a/projs/shadow-engine/src/core/ShadowApplication.cpp b/projs/shadow-engine/src/core/ShadowApplication.cpp new file mode 100644 index 0000000..1b3fb8e --- /dev/null +++ b/projs/shadow-engine/src/core/ShadowApplication.cpp @@ -0,0 +1,77 @@ +#include "ShadowApplication.h" + +#include "Time.h" + +#include + +namespace ShadowEngine { + + ShadowApplication* ShadowApplication::instance = nullptr; + + ShadowApplication::ShadowApplication(int argc, char* argv[]) + { + instance = this; + + if(argc > 1) + { + for (size_t i = 0; i < argc; i++) + { + std::string param(argv[i]); + if(param == "-no-gui") + { + this->no_gui = true; + } + } + } + + + //game = _setupFunc(); + } + + + ShadowApplication::~ShadowApplication() + { + } + + void ShadowApplication::Init() + { + // Initialize SDL. SDL_Init will return -1 if it fails. + if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) { + //std::cout << "Error initializing SDL: " << SDL_GetError() << std::endl; + //system("pause"); + // End the program + //return 1; + } + + window_ = new ShadowWindow(800,450); + + /* + moduleManager.PushModule(new Log()); + moduleManager.PushModule(new EventSystem::ShadowEventManager()); + moduleManager.PushModule(new SDLPlatform::SDLModule()); + moduleManager.PushModule(new Rendering::Renderer()); + + moduleManager.PushModule(new Assets::AssetManager()); + + if(!no_gui) + moduleManager.PushModule(new DebugGui::ImGuiModule()); + + moduleManager.PushModule(new InputSystem::ShadowActionSystem()); + //moduleManager.PushModule(new Debug::DebugModule()); + moduleManager.PushModule(new EntitySystem::EntitySystem()); + + + game->Init(); + + moduleManager.Init(); + */ + } + + void ShadowApplication::Start() + { + while (running) + { + Time::UpdateTime(); + } + } +} diff --git a/projs/shadow-engine/src/core/ShadowApplication.h b/projs/shadow-engine/src/core/ShadowApplication.h new file mode 100644 index 0000000..6688f51 --- /dev/null +++ b/projs/shadow-engine/src/core/ShadowApplication.h @@ -0,0 +1,60 @@ +#pragma once +#include "ShadowWindow.h" + +namespace ShadowEngine { + + /// + /// Represents the application + /// + class ShadowApplication + { + /// + /// This is the singleton instance + /// + static ShadowApplication* instance; + + /// + /// The active window that we are drawing to + /// + ShadowWindow* window_; + + /// + /// The module manager instance + /// + //ShadowEngine::ShadowModuleManager moduleManager; + + /// + /// Represents the running state. + /// + /// If set to false the main loop will stop and continue with the shutdown. + bool running = true; + + bool no_gui = false; + + public: + /// + /// Default constructor + /// + ShadowApplication(int argc, char* argv[]); + virtual ~ShadowApplication(); + + /// + /// Static getter for the singleton instance + /// + /// Use this for accessing the Application + /// The current application reference + static ShadowApplication& Get() { return *instance; }; + + /// + /// Returns the active window used for rendering + /// + /// The window instance + //ShadowWindow& const GetWindow() const { return window_; }; + //void SetWindow(ShadowWindow w) { window_ = w; } + + //ShadowEngine::ShadowModuleManager& GetModuleManager() { return moduleManager; }; + + void Init(); + void Start(); + }; +} \ No newline at end of file diff --git a/projs/shadow-engine/src/core/ShadowWindow.cpp b/projs/shadow-engine/src/core/ShadowWindow.cpp new file mode 100644 index 0000000..4baecc1 --- /dev/null +++ b/projs/shadow-engine/src/core/ShadowWindow.cpp @@ -0,0 +1,37 @@ +#include "ShadowWindow.h" + + +ShadowWindow::ShadowWindow(int W, int H) : Height(H), Width(W) +{ + // Create our window + sdlWindowPtr = SDL_CreateWindow( "Example", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Width, Height, SDL_WINDOW_SHOWN ); + + // Make sure creating the window succeeded + if ( !sdlWindowPtr ) { + //Raise an error in the log + //std::cout << "Error creating window: " << SDL_GetError() << std::endl; + } + + // Get the surface from the window + sdlSurface = SDL_GetWindowSurface( sdlWindowPtr ); + + // Make sure getting the surface succeeded + if ( !sdlSurface ) { + //Raise an error in the log + //std::cout << "Error getting surface: " << SDL_GetError() << std::endl; + } + + // Create window + /* + this->winPtr = SDL_CreateWindow("Hello World!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, W, H, + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); + SH_CORE_ASSERT(winPtr, "Window could not be created! SDL_Error: %s\n", SDL_GetError()); + + context = ShadowEngine::Rendering::GraphicsContext::Create(this); + context->Init(); + */ +} + +ShadowWindow::~ShadowWindow() +{ +} diff --git a/projs/shadow-engine/src/core/ShadowWindow.h b/projs/shadow-engine/src/core/ShadowWindow.h new file mode 100644 index 0000000..f74d935 --- /dev/null +++ b/projs/shadow-engine/src/core/ShadowWindow.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +class ShadowWindow +{ +public: + + int Height; + int Width; + + SDL_Window* sdlWindowPtr; + + SDL_Surface* sdlSurface = NULL; + + + //ShadowEngine::Ref context; + + ShadowWindow(int W, int H); + + ~ShadowWindow(); +}; diff --git a/projs/shadow-engine/src/core/Time.cpp b/projs/shadow-engine/src/core/Time.cpp new file mode 100644 index 0000000..7fca16c --- /dev/null +++ b/projs/shadow-engine/src/core/Time.cpp @@ -0,0 +1,20 @@ +#include "Time.h" +//#include +//#include + +int Time::NOW = 0;//SDL_GetPerformanceCounter(); +int Time::LAST = 0; +double Time::deltaTime_ms = 0; +double Time::deltaTime = 0; + +void Time::UpdateTime() +{ + /* + NOW = SDL_GetTicks(); + deltaTime_ms = LAST > 0 ? (NOW - LAST) *10 : (1.0f / 60.0f); + deltaTime_ms = deltaTime_ms == 0 ? (1.0f / 60.0f) : deltaTime_ms; + + LAST = NOW; + deltaTime = deltaTime_ms * 0.001; + */ +} diff --git a/projs/shadow-engine/src/core/Time.h b/projs/shadow-engine/src/core/Time.h new file mode 100644 index 0000000..c0fcd66 --- /dev/null +++ b/projs/shadow-engine/src/core/Time.h @@ -0,0 +1,14 @@ +#pragma once + +class Time +{ + static int NOW; + +public: + static int LAST; + + static double deltaTime; + static double deltaTime_ms; + + static void UpdateTime(); +}; diff --git a/projs/shadow-entity/shadow-entity.vcxproj b/projs/shadow-entity/shadow-entity.vcxproj deleted file mode 100644 index d5f8989..0000000 --- a/projs/shadow-entity/shadow-entity.vcxproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - 15.0 - {47591591-E091-4B88-8418-74D3CBEC5712} - Win32Proj - shadow_entity - 10.0 - - - StaticLibrary - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/projs/shadow-entity/shadow-entity.vcxproj.filters b/projs/shadow-entity/shadow-entity.vcxproj.filters deleted file mode 100644 index c0b9c95..0000000 --- a/projs/shadow-entity/shadow-entity.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/projs/shadow-entity/shadow-entity.vcxproj.user b/projs/shadow-entity/shadow-entity.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/projs/shadow-entity/shadow-entity.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/projs/shadow-file-format/shadow-file-format.vcxproj b/projs/shadow-file-format/shadow-file-format.vcxproj deleted file mode 100644 index bd8b1c2..0000000 --- a/projs/shadow-file-format/shadow-file-format.vcxproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - {B2E3515C-3FE0-44B9-9ABE-8584A836230F} - shadow_file_format - shadow-file-format - - - StaticLibrary - - - - - - - - - $(SolutionDir)\projs\shadow-utility\src\; %(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - {7b9e6056-e4fb-411b-9612-a2fd679c2b69} - - - - - \ No newline at end of file diff --git a/projs/shadow-file-format/shadow-file-format.vcxproj.filters b/projs/shadow-file-format/shadow-file-format.vcxproj.filters deleted file mode 100644 index 9382977..0000000 --- a/projs/shadow-file-format/shadow-file-format.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - \ No newline at end of file diff --git a/projs/shadow-file-format/test/test.cpp b/projs/shadow-file-format/test/test.cpp index 43595be..67e7b0c 100644 --- a/projs/shadow-file-format/test/test.cpp +++ b/projs/shadow-file-format/test/test.cpp @@ -4,7 +4,6 @@ #include #include "SFFParser.h" -//import Shadow.FileFormat; std::string example_empty = "ShadowFileFormat_1_0_0"; diff --git a/projs/shadow-runtime/BUILD.bazel b/projs/shadow-runtime/BUILD.bazel new file mode 100644 index 0000000..4915d0d --- /dev/null +++ b/projs/shadow-runtime/BUILD.bazel @@ -0,0 +1,16 @@ + + + + +cc_binary( + name = "shadow-runtime", + srcs = glob(["src/**/*.cpp", "src/**/*.h"]), + includes = [], + copts = [ + "/std:c++20" + ], + deps = [ + "//projs/shadow-engine", + "@sdl2" + ], +) \ No newline at end of file diff --git a/projs/shadow-runtime/src/main.cpp b/projs/shadow-runtime/src/main.cpp new file mode 100644 index 0000000..b59a9bc --- /dev/null +++ b/projs/shadow-runtime/src/main.cpp @@ -0,0 +1,28 @@ +#include "main.h" + +#include +#include +#include + +#include "core/ShadowApplication.h" + +#include + +int main(int argc, char *argv[]) +{ + std::cout << "argc == " << argc << '\n'; + + for(int ndx{}; ndx != argc; ++ndx) { + std::cout << "argv[" << ndx << "] == " << std::quoted(argv[ndx]) << '\n'; + } + std::cout << "argv[" << argc << "] == " + << static_cast(argv[argc]) << '\n'; + /*...*/ + + ShadowEngine::ShadowApplication app(argc, argv); + app.Init(); + app.Start(); + + + return argc == 3 ? EXIT_SUCCESS : EXIT_FAILURE; // optional return value +} \ No newline at end of file diff --git a/projs/shadow-runtime/src/main.h b/projs/shadow-runtime/src/main.h new file mode 100644 index 0000000..6d17370 --- /dev/null +++ b/projs/shadow-runtime/src/main.h @@ -0,0 +1,8 @@ +// +// Created by dpete on 2022-06-20. +// + +#ifndef UMBRA_MAIN_H +#define UMBRA_MAIN_H + +#endif //UMBRA_MAIN_H diff --git a/projs/shadow-utility/shadow-utility.vcxproj b/projs/shadow-utility/shadow-utility.vcxproj deleted file mode 100644 index ff62eed..0000000 --- a/projs/shadow-utility/shadow-utility.vcxproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - 15.0 - {7B9E6056-E4FB-411B-9612-A2FD679C2B69} - Win32Proj - shadow_utility - 10.0 - - - StaticLibrary - - - - - - - - - - - - - - - - - {47591591-e091-4b88-8418-74d3cbec5712} - - - - - - \ No newline at end of file diff --git a/projs/shadow-utility/shadow-utility.vcxproj.filters b/projs/shadow-utility/shadow-utility.vcxproj.filters deleted file mode 100644 index 1f8d2a1..0000000 --- a/projs/shadow-utility/shadow-utility.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/projs/shadow-utility/shadow-utility.vcxproj.user b/projs/shadow-utility/shadow-utility.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/projs/shadow-utility/shadow-utility.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/projs/shadow-utility/shadow-utils.ixx b/projs/shadow-utility/shadow-utils.ixx deleted file mode 100644 index e5b693b..0000000 --- a/projs/shadow-utility/shadow-utils.ixx +++ /dev/null @@ -1,9 +0,0 @@ -module; - -#include -#include - -export module shadow_utils; - - -export std::vector explode(const std::string& s, const char& c); \ No newline at end of file diff --git a/vendor/sdl2/sdl2.props b/vendor/sdl2/sdl2.props deleted file mode 100644 index 37f9efa..0000000 --- a/vendor/sdl2/sdl2.props +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - $(SolutionDir)vendor/sdl2/SDL2-2.0.22/include/ - - - - - $(SolutionDir)vendor/sdl2/SDL2-2.0.22/include/; %(AdditionalIncludeDirectories) - - - $(SolutionDir)vendor/sdl2/SDL2-2.0.22/lib/$(Platform) - sdl2.lib;sdl2main.lib;%(AdditionalDependencies) - - - \ No newline at end of file