wren
Vulkan-based game engine
Loading...
Searching...
No Matches
application.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <spdlog/spdlog.h>
4
5#include <memory>
6#include <tl/expected.hpp>
7
8#include "context.hpp"
9#include "wren/renderer.hpp"
10
11namespace wren {
12
14
15using phase_cb_t = std::function<void()>;
16
18 public:
19 enum class errors {};
20
21 static auto Create(std::string const &application_name)
23
24 auto context() -> std::shared_ptr<Context> const & { return ctx; }
25 void run();
26
28 phase_cb_t const &cb);
29
30 private:
31 explicit Application(std::shared_ptr<Context> const &ctx,
32 std::shared_ptr<Renderer> const &renderer);
33
34 std::shared_ptr<Context> ctx;
35 std::shared_ptr<Renderer> renderer;
36
37 std::vector<phase_cb_t> startup_phase;
38 std::vector<phase_cb_t> update_phase;
39 std::vector<phase_cb_t> shutdown_phase;
40
41 bool running;
42};
43
44} // namespace wren
Definition application.hpp:17
errors
Definition application.hpp:19
auto context() -> std::shared_ptr< Context > const &
Definition application.hpp:24
void add_callback_to_phase(CallbackPhase phase, phase_cb_t const &cb)
Definition application.cpp:49
static auto Create(std::string const &application_name) -> expected< std::shared_ptr< Application > >
Definition application.cpp:18
void run()
Definition application.cpp:68
Definition editor.hpp:14
tl::expected< T, Err > expected
Definition errors.hpp:49
std::function< void()> phase_cb_t
Definition application.hpp:15
CallbackPhase
Definition application.hpp:13