Skip to content
Snippets Groups Projects
Commit 079b3974 authored by Marek Trtik's avatar Marek Trtik
Browse files

Added lfs tutorial

parent 362eba14
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ struct Presenter : public com::Runner
protected:
void on_content_changed(File* sender) override;
void initialize() override;
void release() override;
};
......
......@@ -3,6 +3,7 @@
#include <gfx/index.hpp>
#include <osi/index.hpp>
#include <com/math_files.hpp>
#include <lfs/index.hpp>
namespace mak {
......@@ -59,6 +60,24 @@ void Presenter::initialize()
gfx::object_system()->insert_light(test_box, dir_light);
gfx::light_system()->insert_shadow_caster(dir_light, test_box);
// -----------------------------
auto* handle{ lfs::loader()->load({"age", "texture", "font", "Consolas_16.txt"}) };
if (handle->state() == lfs::ResourceHandle::LOADED)
Presenter::on_content_changed(handle);
else
handle->register_on_content_changed(this);
}
void Presenter::on_content_changed(File* const sender)
{
if (lfs::ResourceHandle* const handle = dynamic_cast<lfs::ResourceHandle*>(sender))
{
ASSUMPTION(handle->state() == lfs::ResourceHandle::LOADED);
std::string const my_loaded_data{ handle->data().begin(), handle->data().end() };
handle->unregister_on_content_changed(this);
}
}
void Presenter::release()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment