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
7#include "context.hpp"
8#include "wren/renderer.hpp"
9
10namespace wren {
11
13
14using phase_cb_t = std::function<void()>;
15
17 public:
18 enum class errors {};
19
20 static auto Create(std::string const &application_name)
22
23 auto context() -> std::shared_ptr<Context> const & { return ctx; }
24 void run();
25
27 phase_cb_t const &cb);
28
29 private:
30 explicit Application(std::shared_ptr<Context> const &ctx,
31 std::shared_ptr<Renderer> const &renderer);
32
33 std::shared_ptr<Context> ctx;
34 std::shared_ptr<Renderer> renderer;
35
36 std::vector<phase_cb_t> startup_phase;
37 std::vector<phase_cb_t> update_phase;
38 std::vector<phase_cb_t> shutdown_phase;
39
40 bool running;
41};
42
43} // namespace wren
Definition application.hpp:16
errors
Definition application.hpp:18
auto context() -> std::shared_ptr< Context > const &
Definition application.hpp:23
Application(std::shared_ptr< Context > const &ctx, std::shared_ptr< Renderer > const &renderer)
Definition application.cpp:63
std::shared_ptr< Renderer > renderer
Definition application.hpp:34
std::vector< phase_cb_t > startup_phase
Definition application.hpp:36
std::shared_ptr< Context > ctx
Definition application.hpp:33
std::vector< phase_cb_t > shutdown_phase
Definition application.hpp:38
std::vector< phase_cb_t > update_phase
Definition application.hpp:37
void add_callback_to_phase(CallbackPhase phase, phase_cb_t const &cb)
Definition application.cpp:48
static auto Create(std::string const &application_name) -> expected< std::shared_ptr< Application > >
Definition application.cpp:17
bool running
Definition application.hpp:40
void run()
Definition application.cpp:67
Definition editor_scene.hpp:5
std::function< void()> phase_cb_t
Definition application.hpp:14
std::expected< T, Err > expected
Definition result.hpp:49
CallbackPhase
Definition application.hpp:12