PixelBullet
0.0.1
A C++ game engine
Loading...
Searching...
No Matches
engine
include
pixelbullet
assets
archive.h
1
#pragma once
2
3
#include <cstdint>
4
#include <cstdio>
5
#include <string>
6
#include <unordered_map>
7
#include <vector>
8
9
namespace
pixelbullet
10
{
11
class
Filesystem;
12
class
VirtualPath;
13
14
struct
FileEntry
15
{
16
uint64_t offset;
17
uint64_t compressed_size;
18
uint64_t uncompressed_size;
19
};
20
21
class
Archive
22
{
23
public
:
24
Archive
();
25
~Archive
();
26
28
bool
Open
(
const
Filesystem
& filesystem,
const
VirtualPath
& archivePath);
29
32
std::vector<uint8_t>
GetAsset
(
const
std::string& assetName);
33
34
private
:
36
bool
ReadIndex();
37
38
private
:
39
FILE* file_;
40
std::unordered_map<std::string, FileEntry> index_;
41
};
42
}
// namespace pixelbullet
pixelbullet::Archive
Definition
archive.h:22
pixelbullet::Archive::Open
bool Open(const Filesystem &filesystem, const VirtualPath &archivePath)
Opens the archive at the given path and reads the index.
Definition
archive.cc:25
pixelbullet::Archive::GetAsset
std::vector< uint8_t > GetAsset(const std::string &assetName)
Definition
archive.cc:91
pixelbullet::Filesystem
Definition
filesystem.h:16
pixelbullet::VirtualPath
Definition
virtual_path.h:10
pixelbullet::FileEntry
Definition
archive.h:15
Generated by
1.12.0