40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#include <filesystem>
|
|
#include <fstream>
|
|
#include <print>
|
|
#include <vector>
|
|
|
|
#define STB_IMAGE_IMPLEMENTATION
|
|
#include "stb_image.h"
|
|
|
|
struct Bitmap {
|
|
int width, height;
|
|
bool compressed{};
|
|
std::vector<bool> image_data;
|
|
std::vector<bool> transparency_data;
|
|
};
|
|
|
|
auto read_entire_file(std::filesystem::path const &path)
|
|
-> std::vector<uint8_t> {
|
|
std::ifstream stream(path, std::ios::in | std::ios::binary);
|
|
std::vector<uint8_t> const contents((std::istreambuf_iterator<char>(stream)),
|
|
std::istreambuf_iterator<char>());
|
|
return contents;
|
|
}
|
|
|
|
auto write_entire_file(std::filesystem::path const &path,
|
|
std::span<uint8_t> const &data) -> void {
|
|
std::ofstream stream(path, std::ios::out | std::ios::binary);
|
|
stream.write(reinterpret_cast<char *>(data.data()), data.size());
|
|
}
|
|
|
|
auto main(int const argc, char const *argv[]) -> int {
|
|
if (argc != 2) {
|
|
std::println(stderr, "Usage: {} <file>", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
std::filesystem::path filepath{argv[1]};
|
|
if (filepath.extension() == ".bfl") {
|
|
}
|
|
}
|