Compare commits
8 Commits
5e76c8a382
...
6a579a0512
Author | SHA1 | Date | |
---|---|---|---|
6a579a0512 | |||
b939530536 | |||
baf933569b | |||
df8f0866c0 | |||
d285346662 | |||
63ed6f862f | |||
e121126a37 | |||
933bf16737 |
37
.clang-format
Normal file
37
.clang-format
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
BasedOnStyle: "Chromium"
|
||||
Standard: Cpp20
|
||||
|
||||
# I like K&R, fight me
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
BreakBeforeBraces: Attach
|
||||
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AlignAfterOpenBracket: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakString: 1000
|
||||
PointerAlignment: Left
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
32
.clang-tidy
Normal file
32
.clang-tidy
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
Checks: >
|
||||
-*,
|
||||
readability-*,
|
||||
modernize-*,
|
||||
cppcoreguidelines-*,
|
||||
performance-*,
|
||||
bugprone-*,
|
||||
clang-analyzer-*,
|
||||
misc-*,
|
||||
google-*,
|
||||
cert-*,
|
||||
portability-*,
|
||||
cppcoreguidelines-pro-bounds-array-to-pointer-decay
|
||||
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: '.*'
|
||||
FormatStyle: none
|
||||
User: ''
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.VariableCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.FunctionCase
|
||||
value: CamelCase
|
||||
- key: modernize-use-auto
|
||||
value: 0
|
||||
- key: modernize-use-nullptr
|
||||
value: 1
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes
|
||||
value: 1
|
||||
- key: modernize-use-override
|
||||
value: 1
|
22
.editorconfig
Normal file
22
.editorconfig
Normal file
@ -0,0 +1,22 @@
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.cpp]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.hpp]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
charset = utf-8
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[*.bin]
|
||||
binary = true
|
35
Doxygen
Normal file
35
Doxygen
Normal file
@ -0,0 +1,35 @@
|
||||
PROJECT_NAME = "ICEngine"
|
||||
PROJECT_NUMBER = "ALPHA-2.0.0"
|
||||
OUTPUT_DIRECTORY = docs-gen
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
|
||||
INPUT = src/ include/
|
||||
FILE_PATTERNS = *.cpp *.h *.hpp
|
||||
RECURSIVE = YES
|
||||
|
||||
# Default to html
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
GENERATE_MAN = NO
|
||||
|
||||
INLINE_INHERITED_MEMB = YES
|
||||
FULL_PATH_NAMES = YES
|
||||
|
||||
EXTRACT_NAMESPACE = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_GROUP_NAMES = YES
|
||||
|
||||
ENUM_VALUES_PER_LINE = 1
|
@ -16,7 +16,7 @@ namespace ICEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void ICEApplication::HandleFatalError(const std::string& message) {
|
||||
void ICEApplication::HandleFatalError(const std::string &message) {
|
||||
if (customHandler) {
|
||||
customHandler(message);
|
||||
} else {
|
||||
@ -24,7 +24,7 @@ namespace ICEngine {
|
||||
}
|
||||
}
|
||||
|
||||
void ICEApplication::DefaultTerminationHandler(const std::string& message) {
|
||||
void ICEApplication::DefaultTerminationHandler(const std::string &message) {
|
||||
Log::GetCoreLogger()->Log(CRITICAL, __FILE__, __LINE__, __FUNCTION__, message);
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -33,7 +33,7 @@ namespace ICEngine {
|
||||
Log::Init();
|
||||
CORE_LOG_TRACE("Starting ICEngine");
|
||||
|
||||
ICEApplication* app = CreateICEApplication();
|
||||
ICEApplication *app = CreateICEApplication();
|
||||
if (app) {
|
||||
CORE_LOG_TRACE("Starting User Application");
|
||||
app->Run();
|
||||
|
@ -10,23 +10,28 @@
|
||||
namespace ICEngine {
|
||||
class ICEApplication {
|
||||
public:
|
||||
ICEApplication() {}
|
||||
virtual ~ICEApplication() {}
|
||||
ICEApplication() {
|
||||
}
|
||||
|
||||
virtual ~ICEApplication() {
|
||||
}
|
||||
|
||||
virtual void Run() = 0;
|
||||
|
||||
using TerminationHandler = std::function<void(const std::string&)>;
|
||||
using TerminationHandler = std::function<void(const std::string &)>;
|
||||
|
||||
static void SetTerminationHandler(TerminationHandler handler);
|
||||
static void HandleFatalError(const std::string& message);
|
||||
|
||||
static void HandleFatalError(const std::string &message);
|
||||
|
||||
private:
|
||||
static TerminationHandler customHandler;
|
||||
static void DefaultTerminationHandler(const std::string& message);
|
||||
|
||||
static void DefaultTerminationHandler(const std::string &message);
|
||||
};
|
||||
|
||||
void StartApplication();
|
||||
|
||||
// Application-specific function that will be defined by the user
|
||||
extern ICEApplication* CreateICEApplication();
|
||||
extern ICEApplication *CreateICEApplication();
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
//
|
||||
// Created by illyum on 9/15/2024.
|
||||
//
|
@ -8,7 +8,10 @@
|
||||
|
||||
namespace Platform {
|
||||
void ShowPopup(const char *message);
|
||||
|
||||
void ShowPopup(const char *title, const char *message);
|
||||
|
||||
void ShowPopup(const std::string &message);
|
||||
|
||||
void ShowPopup(const std::string &title, const std::string &message);
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
#include <src/platform/Platform.hpp>
|
||||
|
||||
void ShowLogger();
|
||||
void CustomTermHandler(const std::string& message);
|
||||
|
||||
void CustomTermHandler(const std::string &message);
|
||||
|
||||
int main() {
|
||||
// You can set a custom termination handler/function.
|
||||
@ -44,7 +45,7 @@ void ShowLogger() {
|
||||
|
||||
// You can have multiple log streams, ie console + file etc
|
||||
// You do not need to have the same streams for each logger
|
||||
#include <fstream>
|
||||
#include <fstream>
|
||||
// Create file streams and transfer ownership to the logger
|
||||
// You need to create a unique pointer, because the logger will
|
||||
// take ownership of the streams and clean them up when the app
|
||||
@ -62,11 +63,16 @@ void ShowLogger() {
|
||||
// CORE logger is intended for internal engine or core-level logging
|
||||
// In most cases, you won't need to use CORE logging in game/application code,
|
||||
// but it's available for engine-level diagnostics if necessary
|
||||
CORE_LOG_TRACE("Initializing {} with age {}", module, age); // Logs a trace-level message, useful for very detailed information
|
||||
CORE_LOG_DEBUG("This is an example of a debug message"); // Logs a debug message, typically used for debugging purposes
|
||||
CORE_LOG_WARN("This is an example of a warn message"); // Logs a warning, indicating a non-critical issue that should be investigated
|
||||
CORE_LOG_ERROR("This is an example of an error message"); // Logs an error, signaling that something has gone wrong but the engine can still run
|
||||
CORE_LOG_CRITICAL("This is an example of a critical message"); // Logs a critical issue, often indicating a major problem in the core system that needs immediate attention.
|
||||
CORE_LOG_TRACE("Initializing {} with age {}", module, age);
|
||||
// Logs a trace-level message, useful for very detailed information
|
||||
CORE_LOG_DEBUG("This is an example of a debug message");
|
||||
// Logs a debug message, typically used for debugging purposes
|
||||
CORE_LOG_WARN("This is an example of a warn message");
|
||||
// Logs a warning, indicating a non-critical issue that should be investigated
|
||||
CORE_LOG_ERROR("This is an example of an error message");
|
||||
// Logs an error, signaling that something has gone wrong but the engine can still run
|
||||
CORE_LOG_CRITICAL("This is an example of a critical message");
|
||||
// Logs a critical issue, often indicating a major problem in the core system that needs immediate attention.
|
||||
// CORE_LOG_FATAL: Logs a fatal error that crashes the application. Fatal errors in the core usually lead to dumping information into crash logs
|
||||
// and stopping the program. Use with extreme caution and only in situations where the application can't recover
|
||||
// CORE_LOG_FATAL("This is an example of a fatal message");
|
||||
@ -74,18 +80,23 @@ void ShowLogger() {
|
||||
|
||||
// These macros are designed for logging from your game or application code
|
||||
// They allow you to monitor application flow, errors, and warnings from the perspective of the game logic or app layer
|
||||
LOG_TRACE("App took longer to respond than expected: {} seconds", 2.34); // Logs a trace message, ideal for fine-grained, verbose debugging details
|
||||
LOG_DEBUG("This is an example of a debug message"); // Logs a debug message, typically used to help trace the execution during development
|
||||
LOG_WARN("This is an example of a warn message"); // Logs a warning, indicating something unexpected happened, but the application can continue running
|
||||
LOG_ERROR("This is an example of an error message"); // Logs an error, signaling that an issue occurred that may require attention but is not catastrophic
|
||||
LOG_CRITICAL("This is an example of a critical message"); // Logs a critical message, suggesting something very wrong happened, but the program may still attempt to run
|
||||
LOG_TRACE("App took longer to respond than expected: {} seconds", 2.34);
|
||||
// Logs a trace message, ideal for fine-grained, verbose debugging details
|
||||
LOG_DEBUG("This is an example of a debug message");
|
||||
// Logs a debug message, typically used to help trace the execution during development
|
||||
LOG_WARN("This is an example of a warn message");
|
||||
// Logs a warning, indicating something unexpected happened, but the application can continue running
|
||||
LOG_ERROR("This is an example of an error message");
|
||||
// Logs an error, signaling that an issue occurred that may require attention but is not catastrophic
|
||||
LOG_CRITICAL("This is an example of a critical message");
|
||||
// Logs a critical message, suggesting something very wrong happened, but the program may still attempt to run
|
||||
|
||||
// LOG_FATAL: Logs a fatal error in the application layer. This will trigger the Fatal Handler, which you can override
|
||||
// The Fatal Handler provides a mechanism for handling unrecoverable errors gracefully, allowing you to define how the application reacts to fatal crashes
|
||||
// LOG_FATAL("This is an example of log fatal crash!");
|
||||
}
|
||||
|
||||
void CustomTermHandler(const std::string& message) {
|
||||
void CustomTermHandler(const std::string &message) {
|
||||
// Perform any other task here, like showing a popup warning indicating something crashed
|
||||
Platform::ShowPopup("Demo App", message);
|
||||
// You don't have to specify a title, it will default to ICEngine
|
||||
@ -103,6 +114,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
ICEngine::ICEApplication* ICEngine::CreateICEApplication() {
|
||||
ICEngine::ICEApplication *ICEngine::CreateICEApplication() {
|
||||
return new DemoApp();
|
||||
}
|
||||
|
@ -5,5 +5,4 @@
|
||||
#include <ICEngine.hpp>
|
||||
|
||||
int main() {
|
||||
|
||||
}
|
3
generate-visualstudio.bat
Normal file
3
generate-visualstudio.bat
Normal file
@ -0,0 +1,3 @@
|
||||
mkdir build-vs
|
||||
cd build-vs
|
||||
cmake -G "Visual Studio 17 2022" ..
|
Loading…
x
Reference in New Issue
Block a user