Compare commits

..

3 commits

Author SHA1 Message Date
9d4436cc00 Added Logging 2023-05-01 23:45:29 +01:00
531cfbd006 Added logging to the engine 2023-03-01 00:11:37 +00:00
5e77883bd2 Initial Commit 2023-02-28 20:25:38 +00:00
14 changed files with 285 additions and 32 deletions

38
.gitignore vendored
View file

@ -1,32 +1,6 @@
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
bin/
bin-int/
*.sln
*.vcxproj
*.vcxproj.filters
!/vendor/**

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "FluxEngine/vendor/spdlog"]
path = FluxEngine/vendor/spdlog
url = https://github.com/gabime/spdlog

6
FluxEngine/src/Flux.h Normal file
View file

@ -0,0 +1,6 @@
#pragma once
#include "Flux/Application.h"
#include "Flux/Log.h"
#include "Flux/EntryPoint.h"

View file

@ -0,0 +1,19 @@
#include "Application.h"
#include "Log.h"
namespace Flux {
Application::Application()
{
}
Application::~Application()
{
}
void Application::Run()
{
FLUX_CORE_TRACE("FLUX Engine Running!");
while (true);
}
}

View file

@ -0,0 +1,18 @@
#pragma once
#include "Core.h"
namespace Flux {
class FLUX_API Application
{
public:
Application();
virtual ~Application();
void Run();
};
Application* CreateApplication();
}

View file

@ -0,0 +1,11 @@
#pragma once
#ifdef FLUX_PLATFORM_WINDOWS
#ifdef FLUX_BUILD_DLL
#define FLUX_API __declspec(dllexport)
#else
#define FLUX_API __declspec(dllimport)
#endif
#else
#error Flux only supports windows!
#endif

View file

@ -0,0 +1,21 @@
#pragma once
#include "Log.h"
#ifdef FLUX_PLATFORM_WINDOWS
extern Flux::Application* Flux::CreateApplication();
int main(int argc, char** argv)
{
Flux::Log::Init();
FLUX_CORE_WARN("Logging Initialized!");
int a = 5;
FLUX_INFO("Hello! {0}", a);
auto app = Flux::CreateApplication();
app->Run();
delete app;
}
#endif

View file

@ -0,0 +1,19 @@
#include "Log.h"
#include "spdlog/sinks/stdout_color_sinks.h"
namespace Flux
{
std::shared_ptr<spdlog::logger> Log::s_CoreLogger;
std::shared_ptr<spdlog::logger> Log::s_ClientLogger;
void Log::Init()
{
spdlog::set_pattern("%^[%T] %n: %v%$");
s_CoreLogger = spdlog::stdout_color_mt("FLUX");
s_CoreLogger->set_level(spdlog::level::trace);
s_ClientLogger = spdlog::stdout_color_mt("APP");
s_ClientLogger->set_level(spdlog::level::trace);
}
}

36
FluxEngine/src/Flux/Log.h Normal file
View file

@ -0,0 +1,36 @@
#pragma once
#include <memory>
#include "Core.h"
#include "spdlog/spdlog.h"
namespace Flux
{
class FLUX_API Log
{
public:
static void Init();
inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
private:
static std::shared_ptr<spdlog::logger> s_CoreLogger;
static std::shared_ptr<spdlog::logger> s_ClientLogger;
};
}
// Core log macros
#define FLUX_CORE_TRACE(...) ::Flux::Log::GetCoreLogger()->trace(__VA_ARGS__)
#define FLUX_CORE_INFO(...) ::Flux::Log::GetCoreLogger()->info(__VA_ARGS__)
#define FLUX_CORE_WARN(...) ::Flux::Log::GetCoreLogger()->warn(__VA_ARGS__)
#define FLUX_CORE_ERROR(...) ::Flux::Log::GetCoreLogger()->error(__VA_ARGS__)
#define FLUX_CORE_FATAL(...) ::Flux::Log::GetCoreLogger()->fatal(__VA_ARGS__)
// Client log macros
#define FLUX_TRACE(...) ::Flux::Log::GetCoreLogger()->trace(__VA_ARGS__)
#define FLUX_INFO(...) ::Flux::Log::GetCoreLogger()->info(__VA_ARGS__)
#define FLUX_WARN(...) ::Flux::Log::GetCoreLogger()->warn(__VA_ARGS__)
#define FLUX_ERROR(...) ::Flux::Log::GetCoreLogger()->error(__VA_ARGS__)
#define FLUX_FATAL(...) ::Flux::Log::GetCoreLogger()->fatal(__VA_ARGS__)

2
GenerateProjects.bat Normal file
View file

@ -0,0 +1,2 @@
call .\vendor\bin\premake\premake5.exe vs2022
PAUSE

View file

@ -0,0 +1,19 @@
#include <Flux.h>
class Sandbox : public Flux::Application
{
public:
Sandbox()
{
}
~Sandbox()
{
}
};
Flux::Application* Flux::CreateApplication()
{
return new Sandbox();
}

98
premake5.lua Normal file
View file

@ -0,0 +1,98 @@
workspace "FluxEngine"
architecture "x64"
startproject "Sandbox"
configurations { "Debug", "Release", "Dist" }
outputdir = "%{cfg.buildcfg}-%{cfg.system}"
project "FluxEngine"
location "FluxEngine"
kind "SharedLib"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp",
}
includedirs
{
"%{prj.name}/vendor/spdlog/include",
}
filter "system:windows"
cppdialect "C++20"
staticruntime "on"
systemversion "latest"
defines
{
"FLUX_PLATFORM_WINDOWS",
"FLUX_BUILD_DLL"
}
postbuildcommands
{
("{COPY} %{cfg.buildtarget.relpath} ../bin/".. outputdir .. "/Sandbox")
}
filter "configurations:Debug"
defines "FLUX_DEBUG"
symbols "On"
filter "configurations:Release"
defines "FLUX_RELEASE"
optimize "On"
filter "configurations:Dist"
defines "FLUX_DIST"
optimize "On"
project "Sandbox"
location "Sandbox"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp",
}
includedirs
{
"FluxEngine/vendor/spdlog/include",
"FluxEngine/src"
}
links
{
"FluxEngine"
}
filter "system:windows"
cppdialect "C++20"
staticruntime "on"
systemversion "latest"
defines
{
"FLUX_PLATFORM_WINDOWS"
}
filter "configurations:Debug"
defines "FLUX_DEBUG"
symbols "On"
filter "configurations:Release"
defines "FLUX_RELEASE"
optimize "On"
filter "configurations:Dist"
defines "FLUX_DIST"
optimize "On"

27
vendor/bin/premake/LICENSE.txt vendored Normal file
View file

@ -0,0 +1,27 @@
Copyright (c) 2003-2022 Jason Perkins and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of Premake nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BIN
vendor/bin/premake/premake5.exe vendored Normal file

Binary file not shown.