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(const std::string &application_name)
22
23 auto context() -> const std::shared_ptr<Context> & { return ctx; }
24 void run();
25
26 void add_callback_to_phase(CallbackPhase phase, const phase_cb_t &cb);
27
28 private:
29 explicit Application(const std::shared_ptr<Context> &ctx,
30 const std::shared_ptr<Renderer> &renderer);
31
32 std::shared_ptr<Context> ctx;
33 std::shared_ptr<Renderer> renderer;
34
35 std::vector<phase_cb_t> startup_phase;
36 std::vector<phase_cb_t> update_phase;
37 std::vector<phase_cb_t> shutdown_phase;
38
39 bool running;
40};
41
42} // namespace wren
Application(const std::shared_ptr< Context > &ctx, const std::shared_ptr< Renderer > &renderer)
Definition application.cpp:63
errors
Definition application.hpp:18
std::shared_ptr< Renderer > renderer
Definition application.hpp:33
std::vector< phase_cb_t > startup_phase
Definition application.hpp:35
void add_callback_to_phase(CallbackPhase phase, const phase_cb_t &cb)
Definition application.cpp:48
std::shared_ptr< Context > ctx
Definition application.hpp:32
std::vector< phase_cb_t > shutdown_phase
Definition application.hpp:37
std::vector< phase_cb_t > update_phase
Definition application.hpp:36
static auto Create(const std::string &application_name) -> expected< std::shared_ptr< Application > >
Definition application.cpp:17
bool running
Definition application.hpp:39
void run()
Definition application.cpp:67
auto context() -> const std::shared_ptr< Context > &
Definition application.hpp:23
Definition editor_scene.hpp:5
std::function< void()> phase_cb_t
Definition application.hpp:14
std::expected< T, Err > expected
Definition result.hpp:50
CallbackPhase
Definition application.hpp:12
@ Update
Definition application.hpp:12
@ Startup
Definition application.hpp:12
@ Shutdown
Definition application.hpp:12