ST_engine  0.3-ALPHA
assets_manager.hpp
1 /* This file is part of the "ST" project.
2  * You may use, distribute or modify this code under the terms
3  * of the GNU General Public License version 2.
4  * See LICENCE.txt in the root directory of the project.
5  *
6  * Author: Maxim Atanasov
7  * E-mail: maxim.atanasov@protonmail.com
8  */
9 
10 #ifndef ASST_DEF
11 #define ASST_DEF
12 
13 #include "assets.hpp"
14 #include <string>
15 #include <fstream>
16 #include <sstream>
17 #include <message_bus.hpp>
18 #include <task_manager.hpp>
19 #include <cstdint>
20 #include <ST_loaders/loaders.hpp>
21 
22 
25  friend class asset_manager_test;
26 
27 private:
28  message_bus &gMessage_bus;
29  task_manager &gTask_manager;
30  subscriber msg_sub{};
31  ST::assets all_assets;
32  ska::bytell_hash_map<std::string, uint16_t> count;
33 
34  int8_t load_asset(std::string path);
35 
36  int8_t unload_asset(std::string path);
37 
38  int8_t unload_assets_from_list(const std::string &path);
39 
40  int8_t load_assets_from_list(const std::string &path);
41 
42  int8_t load_assets_from_binary(const std::string &path);
43 
44  int8_t unload_assets_from_binary(const std::string &path);
45 
46  void handle_messages();
47 
48  void send_assets();
49 
50 public:
51  assets_manager(message_bus &gMessageBus, task_manager &tsk_mngr);
52 
54 
55  void update();
56 
57  static void update_task(void *arg);
58 };
59 
60 #endif
Tests fixture for the assets_manager.
This object is responsible for loading/unloading assets.
assets_manager(message_bus &gMessageBus, task_manager &tsk_mngr)
static void update_task(void *arg)
The central messaging system of the engine. All subsystem make extensive use of it.
Definition: message_bus.hpp:29
This class handles a small queue for messages.
Definition: subscriber.hpp:20
The Task Manager handles all things multi-threaded in the engine.
A container that holds all asset types used in the game.
Definition: assets.hpp:24