/*
 * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#pragma once

#include <ox/std/stringliteral.hpp>

namespace nostalgia::gfx {

constexpr auto TileWidth = 8;
constexpr auto TileHeight = 8;
constexpr auto PixelsPerTile = TileWidth * TileHeight;

constexpr ox::StringLiteral FileExt_ng{"ng"};
constexpr ox::StringLiteral FileExt_nts{"nts"};
constexpr ox::StringLiteral FileExt_npal{"npal"};

constexpr ox::Array<ox::StringLiteral, 2> FileExts_TileSheet{
	FileExt_nts,
	FileExt_ng,
};

constexpr ox::Array<ox::StringLiteral, 2> FileExts_Palette{
	FileExt_npal,
};

[[nodiscard]]
constexpr bool isTileSheet(ox::StringViewCR path) noexcept {
	return ox::any_of(
		FileExts_TileSheet.begin(),
		FileExts_TileSheet.end(),
		[path](ox::StringLiteral const &ext) {
			return endsWith(path, ext);
		});
}

[[nodiscard]]
constexpr bool isPalette(ox::StringViewCR path) noexcept {
	return ox::any_of(
		FileExts_Palette.begin(),
		FileExts_Palette.end(),
		[path](ox::StringLiteral const &ext) {
			return endsWith(path, ext);
		});
}

}
