Exploring raycasters and possibly make a little "doom like" game based on it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
raycaster/tests/textures.cpp

32 lines
904 B

#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <string>
#include "textures.hpp"
#include "levelmanager.hpp"
using namespace fmt;
TEST_CASE("test texture management", "[textures]") {
textures::init();
auto spider = textures::get("hairy_spider");
REQUIRE(spider.sprite != nullptr);
REQUIRE(spider.texture != nullptr);
auto image = textures::load_image("assets/hairy_spider-256.png");
auto img_ptr = textures::get_surface(0);
REQUIRE(img_ptr != nullptr);
auto floor_ptr = textures::get_floor();
REQUIRE(floor_ptr != nullptr);
auto ceiling_ptr = textures::get_ceiling();
REQUIRE(ceiling_ptr != nullptr);
LevelManager levels;
GameLevel level = levels.current();
auto& tiles = level.map->tiles();
auto& walls = level.map->walls();
REQUIRE(matrix::width(tiles) == matrix::width(walls));
REQUIRE(matrix::height(tiles) == matrix::height(walls));
}