DSC Engine
Loading...
Searching...
No Matches
palette_loader.hpp
1#pragma once
2
5#include "DSCEngine/types/hash_map.hpp"
6
7namespace DSC
8{
10 {
11 static constexpr int asset_hashtable_size = 8;
12 static constexpr int record_hashtable_size = 4;
13 private:
14 PaletteManager* standard_pal_mng = nullptr;
15 Vector<PaletteManager*> extended_pal_mng;
16 HashMap<const AssetData*,
18 default_hash<const AssetData*, asset_hashtable_size>, asset_hashtable_size>
19 managed_assets;
20
21 PaletteAllocationResult try_alloc_standard(const AssetData* asset);
22 PaletteAllocationResult try_alloc_extended(const AssetData* asset, int pal_index);
23
24 int default_alloc_mode = 0;
25 public:
27 PaletteLoader(PaletteManager* standard_pal_mng);
28 PaletteLoader(PaletteManager* standard_pal_mng, const Vector<PaletteManager*>& extended_pal_mng);
29
30 void add_extended_palette_manager(PaletteManager* pal_mng);
31
32 void set_default_allocation_mode(int allocation_mode);
33 PaletteAllocationResult try_load(const AssetData* asset, int allocation_mode = 0);
34 void unload(const AssetData* asset);
35 void unload(const AssetData* asset, int palette_index);
36
37 static constexpr int ALLOC_MODE_DEFAULT = 0;
38 static constexpr int ALLOC_MODE_STANDARD_PALETTE = 1<<0;
39 static constexpr int ALLOC_MODE_EXTENDED_PALETTES = 1<<1;
40
41 static constexpr int STANDARD_PALETTE = -1;
42 static constexpr int EXTENDED_PALETTE(int p) { return p; }
43
45 };
46}
Definition: asset_data.hpp:8
Generic hash map.
Definition: hash_map.hpp:18
Definition: palette_loader.hpp:10
Automatic palette manager.
Definition: palette_manager.hpp:16
Generic dynamic vector.
Definition: vector.hpp:23
PaletteManager class definitions.
Struct that contains information following an asset allocation attempt via PaletteManager::try_load()...
Definition: palette_manager.hpp:93
Generic dynamic vector definition.