6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[Bb]uild*
|
||||||
|
bfl
|
||||||
|
.cache
|
||||||
|
.direnv
|
||||||
|
compile_commands.json
|
||||||
|
|
39
bfl.cpp
Normal file
39
bfl.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#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") {
|
||||||
|
}
|
||||||
|
}
|
59
flake.lock
generated
Normal file
59
flake.lock
generated
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1757068644,
|
||||||
|
"narHash": "sha256-NOrUtIhTkIIumj1E/Rsv1J37Yi3xGStISEo8tZm3KW4=",
|
||||||
|
"rev": "8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9",
|
||||||
|
"revCount": 856926,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.856926%2Brev-8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9/019921d1-c8bb-7ab1-9a48-c4f8bca22352/source.tar.gz?rev=8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9&revCount=856926"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
52
flake.nix
Normal file
52
flake.nix
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
description = "My flake";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
nativeBuildInputs = [ ];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
ninja
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.default = pkgs.mkShell.override { stdenv = pkgs.llvmPackages_21.libcxxStdenv; } {
|
||||||
|
packages =
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
llvmPackages_21.clang-tools
|
||||||
|
lldb
|
||||||
|
codespell
|
||||||
|
doxygen
|
||||||
|
gtest
|
||||||
|
cppcheck
|
||||||
|
]
|
||||||
|
++ buildInputs
|
||||||
|
++ nativeBuildInputs
|
||||||
|
++ pkgs.lib.optionals pkgs.stdenv.isLinux (
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
valgrind-light
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
env = { };
|
||||||
|
|
||||||
|
shellHook = '''';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
7988
stb_image.h
Normal file
7988
stb_image.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user