Skip to content

Commit 16d8721

Browse files
committed
Add FileDataLoader
1 parent 24c9873 commit 16d8721

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

assets/test_file.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"hello world"

src/app.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <imgui.h>
22
#include <app.hpp>
3+
#include <djson/json.hpp>
4+
#include <log.hpp>
35

46
namespace miracle {
57
namespace {
@@ -8,7 +10,10 @@ constexpr auto context_ci = le::Context::CreateInfo{
810
};
911
} // namespace
1012

11-
App::App() : m_context(context_ci) {}
13+
App::App() : m_context(context_ci), m_data_loader(le::FileDataLoader::upfind("assets")) {
14+
// test code, remove later.
15+
if (auto json = dj::Json{}; m_data_loader.load_json(json, "test_file.json")) { log.info("loaded JSON: {}", json); }
16+
}
1217

1318
void App::run() {
1419
while (m_context.is_running()) {

src/app.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include <le2d/context.hpp>
3+
#include <le2d/file_data_loader.hpp>
34

45
namespace miracle {
56
class App {
@@ -10,5 +11,6 @@ class App {
1011

1112
private:
1213
le::Context m_context;
14+
le::FileDataLoader m_data_loader{};
1315
};
1416
} // namespace miracle

0 commit comments

Comments
 (0)