Changed project back to C++
This commit is contained in:
1 parent
ce0c399810
commit
e7b9d4a32f
15 files changed
+1181
-412
No files matched your search
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @file logger.cpp
|
||||
* @author Piotr Krygier (everyonecancode@gmail.com)
|
||||
* @brief Implementation for the logger
|
||||
* @version 0.1
|
||||
* @date 2022-07-06
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "logger.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace rse::log
|
||||
{
|
||||
|
||||
Logger::Logger(LogLevel level)
|
||||
{
|
||||
if (level < LOG_LEVEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case LOGLEVEL_TRACE:
|
||||
mMessageBuffer << "[TRACE] ";
|
||||
break;
|
||||
case LOGLEVEL_DEBUG:
|
||||
mMessageBuffer << "[DEBUG] ";
|
||||
break;
|
||||
case LOGLEVEL_INFO:
|
||||
mMessageBuffer << "[INFO] ";
|
||||
break;
|
||||
case LOGLEVEL_WARNING:
|
||||
mMessageBuffer << "[WARNING] ";
|
||||
break;
|
||||
case LOGLEVEL_ERROR:
|
||||
mMessageBuffer << "[ERROR] ";
|
||||
break;
|
||||
case LOGLEVEL_FATAL:
|
||||
mMessageBuffer << "[FATAL] ";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
{
|
||||
std::cout << mMessageBuffer.str() << std::endl;
|
||||
}
|
||||
|
||||
} // namespace rse::log
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
#include "log.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "window.hpp"
|
||||
#include "vulkanBase.hpp"
|
||||
|
||||
@@ -8,15 +8,15 @@ int main(int argc, char** argv)
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
windowInit();
|
||||
rse::graphics::window::windowInit();
|
||||
|
||||
initVulkan();
|
||||
rse::graphics::vulkanbase::initVulkan();
|
||||
|
||||
windowLoop();
|
||||
rse::graphics::window::windowLoop();
|
||||
|
||||
deinitVulkan();
|
||||
rse::graphics::vulkanbase::deinitVulkan();
|
||||
|
||||
windowTerminate();
|
||||
rse::graphics::window::windowTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
+857
-145
File diff suppressed because it is too large.
Load diff
+18
-8
@@ -9,10 +9,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "window.h"
|
||||
#include "window.hpp"
|
||||
|
||||
#include "localeWindow.h"
|
||||
#include "log.h"
|
||||
#include "localeWindow.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "vulkanBase.hpp"
|
||||
|
||||
namespace rse::graphics::window
|
||||
{
|
||||
|
||||
using namespace locale::window;
|
||||
|
||||
/* Error codes */
|
||||
typedef enum {
|
||||
@@ -33,7 +39,7 @@ GLFWwindow *gpWindowHandle = NULL;
|
||||
static void errrorCallback(int error, const char* description)
|
||||
{
|
||||
(void)error;
|
||||
LOG(ERROR, "Error: %s", description);
|
||||
LOGE << "Error: " << description;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,19 +61,20 @@ static void keyCallback(GLFWwindow* window, int key, int scancode, int action, i
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint16_t windowInit()
|
||||
{
|
||||
/* Initiliaze GLFW AP */
|
||||
if (GLFW_TRUE != glfwInit())
|
||||
{
|
||||
LOG(FATAL, "%s", LOCALIZE(windowErrorMesssages[WINDOW_GLFW_INIT_FAILED]));
|
||||
LOGF << windowErrorMesssages[WINDOW_GLFW_INIT_FAILED];
|
||||
return WINDOW_ERROR_GLFW_INIT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
/* Check for Vulkan support */
|
||||
if (GLFW_FALSE == glfwVulkanSupported()) {
|
||||
LOG(FATAL, "%s", LOCALIZE(windowErrorMesssages[WINDOW_VULKAN_NOT_SUPPORTED]));
|
||||
LOGF << windowErrorMesssages[WINDOW_VULKAN_NOT_SUPPORTED];
|
||||
return WINDOW_ERROR_VULKAN_NOT_LOADED;
|
||||
}
|
||||
|
||||
@@ -80,7 +87,7 @@ uint16_t windowInit()
|
||||
gpWindowHandle = glfwCreateWindow(640, 480, "RedScarfEngine", NULL, NULL);
|
||||
|
||||
if (NULL == gpWindowHandle) {
|
||||
LOG(FATAL, "%s", LOCALIZE(windowErrorMesssages[WINDOW_NOT_CREATED]));
|
||||
LOGF << windowErrorMesssages[WINDOW_NOT_CREATED];
|
||||
return WINDOW_ERROR_WINDOW_NOT_CREATED;
|
||||
}
|
||||
|
||||
@@ -93,6 +100,7 @@ uint16_t windowLoop()
|
||||
{
|
||||
while (!glfwWindowShouldClose(gpWindowHandle)) {
|
||||
glfwPollEvents();
|
||||
rse::graphics::vulkanbase::drawFrame();
|
||||
}
|
||||
|
||||
return WINDOW_ERROR_NO_ERROR;
|
||||
@@ -108,4 +116,6 @@ void windowTerminate()
|
||||
GLFWwindow* getWindowHandle()
|
||||
{
|
||||
return gpWindowHandle;
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace rse::graphics::window */
|
||||
Reference in new issue
Block a user