Enhance examples (#17)
* enhance examples * doc enhancement * mv pool to stack * missing ; and doc update fix readme example image link
This commit is contained in:
committed by
Maximilian Kueffner
parent
244b00fa5c
commit
356f966d01
@@ -1,5 +1,5 @@
|
||||
set(SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simple.cpp)
|
||||
|
||||
set(SIMPLE_NAME "${PROJECT_NAME}_SIMPLE")
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <memory>
|
||||
|
||||
#include "DefaultApp.hpp"
|
||||
#include "resources/resource.hpp"
|
||||
#include "utilities/ILog.hpp"
|
||||
#include "utilities/SpdLogger.hpp"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using namespace pixelarium;
|
||||
using namespace std;
|
||||
unique_ptr<utils::log::ILog> logger;
|
||||
#ifdef _WIN32
|
||||
logger = make_unique<utils::log::SpdLogger>(string(getenv("APPDATA")) + "/pixelarium/logfile.log", "default");
|
||||
#else
|
||||
logger = make_unique<utils::log::SpdLogger>(std::string(getenv("HOME")) + "/.cache/pixelarium/log.log", "default");
|
||||
#endif
|
||||
logger->Info(std::format("{}: Starting Application {}", __FUNCTION__, "Pixelarium"));
|
||||
|
||||
logger->ChangeLevel(utils::log::LogLevel::kDebug);
|
||||
auto image_pool{std::make_unique<resources::ImageResourcePool>()};
|
||||
|
||||
application::DefaultApp app = application::DefaultApp(*logger, *image_pool);
|
||||
|
||||
app.Start();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <memory>
|
||||
|
||||
#include "DefaultApp.hpp"
|
||||
#include "resources/resource.hpp"
|
||||
#include "utilities/ILog.hpp"
|
||||
#include "utilities/SpdLogger.hpp"
|
||||
|
||||
using namespace pixelarium;
|
||||
using namespace std;
|
||||
using Log = utils::log::ILog;
|
||||
using Pool = resources::ImageResourcePool;
|
||||
|
||||
// setup a logger
|
||||
#ifdef _WIN32
|
||||
unique_ptr<Log> logger{
|
||||
make_unique<utils::log::SpdLogger>(string(getenv("APPDATA")) + "/pixelarium/simple_app.log", "default")};
|
||||
#else
|
||||
unique_ptr<Log> logger{
|
||||
make_unique<utils::log::SpdLogger>(string(getenv("HOME")) + "/.cache/pixelarium/simple_app.log", "default")};
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
// some initial log message and default log level setting
|
||||
logger->Info(format("{}: Starting Application {}", __FUNCTION__, "Pixelarium"));
|
||||
logger->ChangeLevel(utils::log::LogLevel::kDebug);
|
||||
|
||||
// instantiate an image pool for the application
|
||||
resources::ImageResourcePool image_pool;
|
||||
|
||||
// create an application, inject its dependencies and start it
|
||||
auto app{application::DefaultApp(*logger, image_pool)};
|
||||
app.Start();
|
||||
}
|
||||
Reference in New Issue
Block a user