Unravel Engine C++ Reference
Loading...
Searching...
No Matches
hub.h
Go to the documentation of this file.
1#pragma once
2
3#include <base/basetypes.hpp>
4#include <context/context.hpp>
5#include <ospp/event.h>
6
7#include "panels/panel.h"
8
9namespace unravel
10{
11
12class hub
13{
14public:
15 hub(rtti::context& ctx);
16 auto init(rtti::context& ctx) -> bool;
17 auto deinit(rtti::context& ctx) -> bool;
18
19 void open_project_settings(rtti::context& ctx, const std::string& hint);
20private:
21 void on_frame_update(rtti::context& ctx, delta_t dt);
22 void on_frame_before_render(rtti::context& ctx, delta_t dt);
23 void on_frame_render(rtti::context& ctx, delta_t dt);
24 void on_frame_ui_render(rtti::context& ctx, delta_t dt);
25 void on_play_begin(rtti::context& ctx);
26 void on_script_recompile(rtti::context& ctx, const std::string& protocol, uint64_t version);
27 void on_os_event(rtti::context& ctx, os::event& e);
28
29 void on_start_page_render(rtti::context& ctx);
30 void on_opened_project_render(rtti::context& ctx);
31
32 void render_projects_list_view(rtti::context& ctx);
33 void render_new_project_creator_view(rtti::context& ctx);
34 void render_project_remover_view(rtti::context& ctx);
35
36 // Draw a project card with consistent styling
37 auto draw_project_card(const std::string& id,
38 const std::string& name,
39 const std::string& directory,
40 const std::chrono::system_clock::time_point& last_modified,
41 bool is_selected = false,
42 bool enable_interaction = true,
43 float form_width = 0.0f) -> bool;
44
45 std::shared_ptr<int> sentinel_ = std::make_shared<int>(0);
46
47 imgui_panels panels_{};
48
49 enum class view_state
50 {
51 projects_list,
52 new_project_creator,
53 project_remover
54 };
55
56 view_state current_view_{view_state::projects_list};
57 std::string project_name_{};
58 std::string project_directory_{};
59 std::string project_to_remove_{};
60 std::string selected_project_{};
61};
62} // namespace unravel
void open_project_settings(rtti::context &ctx, const std::string &hint)
Definition hub.cpp:296
auto deinit(rtti::context &ctx) -> bool
Definition hub.cpp:287
auto init(rtti::context &ctx) -> bool
Definition hub.cpp:278
hub(rtti::context &ctx)
Definition hub.cpp:263
std::chrono::duration< float > delta_t
std::string name
Definition hub.cpp:27