Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing.

master
Zed A. Shaw 2 weeks ago
parent 6c1d851e85
commit f3e1413022
  1. 2
      Makefile
  2. 4
      combat_ui.cpp
  3. 2
      combat_ui.hpp
  4. 4
      guecs.cpp
  5. 8
      guecs.hpp
  6. 8
      gui_fsm.cpp
  7. 1
      gui_fsm.hpp
  8. 2
      main.cpp
  9. 7
      main_ui.cpp
  10. 3
      main_ui.hpp
  11. 2
      meson.build
  12. 9
      overlay_ui.cpp
  13. 3
      overlay_ui.hpp
  14. 21
      raycaster.cpp
  15. 7
      raycaster.hpp
  16. 10
      status_ui.cpp
  17. 4
      status_ui.hpp
  18. 6
      tests/guecs.cpp
  19. 17
      tests/textures.cpp
  20. 14
      texture.cpp
  21. 3
      texture.hpp
  22. 38
      textures2.cpp
  23. 18
      textures2.hpp

@ -22,7 +22,7 @@ tracy_build:
meson compile -j 10 -C builddir meson compile -j 10 -C builddir
test: build test: build
./builddir/runtests ./builddir/runtests "[textures]"
run: build test run: build test
powershell "cp ./builddir/zedcaster.exe ." powershell "cp ./builddir/zedcaster.exe ."

@ -15,7 +15,7 @@ namespace gui {
"[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]"); "[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]");
} }
void CombatUI::render(TexturePack& textures) { void CombatUI::render() {
auto& world = $gui.world(); auto& world = $gui.world();
world.set_the<Background>({$gui.$parser}); world.set_the<Background>({$gui.$parser});
@ -39,7 +39,7 @@ namespace gui {
} }
} }
$gui.init(textures); $gui.init();
} }
void CombatUI::draw(sf::RenderWindow& window) { void CombatUI::draw(sf::RenderWindow& window) {

@ -13,7 +13,7 @@ namespace gui {
CombatUI(GameLevel level); CombatUI(GameLevel level);
void render(TexturePack& texture); void render();
void draw(sf::RenderWindow& window); void draw(sf::RenderWindow& window);
void update_level(GameLevel &level) { $level = level; } void update_level(GameLevel &level) { $level = level; }
void set_damage(float percent); void set_damage(float percent);

@ -28,7 +28,7 @@ namespace guecs {
} }
} }
void UI::init(TexturePack& textures) { void UI::init() {
if($world.has_the<Background>()) { if($world.has_the<Background>()) {
auto& bg = $world.get_the<Background>(); auto& bg = $world.get_the<Background>();
bg.init(); bg.init();
@ -59,7 +59,7 @@ namespace guecs {
}); });
$world.query<lel::Cell, Sprite>([&](auto, auto &cell, auto &sprite) { $world.query<lel::Cell, Sprite>([&](auto, auto &cell, auto &sprite) {
sprite.init(cell, textures); sprite.init(cell);
}); });
} }

@ -5,7 +5,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include "texture.hpp" #include "textures2.hpp"
#include <functional> #include <functional>
#include "events.hpp" #include "events.hpp"
#include "constants.hpp" #include "constants.hpp"
@ -57,8 +57,8 @@ namespace guecs {
std::shared_ptr<sf::Sprite> sprite = nullptr; std::shared_ptr<sf::Sprite> sprite = nullptr;
std::shared_ptr<sf::Texture> texture = nullptr; std::shared_ptr<sf::Texture> texture = nullptr;
void init(lel::Cell &cell, TexturePack &textures) { void init(lel::Cell &cell) {
auto sprite_texture = textures.get(name); auto sprite_texture = textures::get(name);
texture = sprite_texture.texture; texture = sprite_texture.texture;
sprite = make_shared<sf::Sprite>(*texture); sprite = make_shared<sf::Sprite>(*texture);
sprite->setPosition({ sprite->setPosition({
@ -145,7 +145,7 @@ namespace guecs {
return $world; return $world;
} }
void init(TexturePack& textures); void init();
void render(sf::RenderWindow& window); void render(sf::RenderWindow& window);
void mouse(float x, float y); void mouse(float x, float y);

@ -13,7 +13,7 @@ namespace gui {
FSM::FSM() : FSM::FSM() :
$window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Zed's Raycaster Thing"), $window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Zed's Raycaster Thing"),
$main_ui($window, $levels.current(), $textures), $main_ui($window, $levels.current()),
$renderer($window), $renderer($window),
$level($levels.current()), $level($levels.current()),
$map_ui($level), $map_ui($level),
@ -21,8 +21,6 @@ namespace gui {
$status_ui($level), $status_ui($level),
$font{FONT_FILE_NAME} $font{FONT_FILE_NAME}
{ {
$textures.load_tiles();
$textures.load_sprites();
} }
void FSM::event(Event ev) { void FSM::event(Event ev) {
@ -45,8 +43,8 @@ namespace gui {
$main_ui.init(); $main_ui.init();
$combat_ui.render($textures); $combat_ui.render();
$status_ui.render($textures); $status_ui.render();
$status_ui.log("Welcome to the game!"); $status_ui.log("Welcome to the game!");
$renderer.init_terminal(); $renderer.init_terminal();

@ -52,7 +52,6 @@ namespace gui {
CombatUI $combat_ui; CombatUI $combat_ui;
StatusUI $status_ui; StatusUI $status_ui;
sf::Font $font; sf::Font $font;
TexturePack $textures;
FSM(); FSM();

@ -1,6 +1,8 @@
#include "gui_fsm.hpp" #include "gui_fsm.hpp"
#include "textures2.hpp"
int main() { int main() {
textures::init();
gui::FSM main; gui::FSM main;
main.event(gui::Event::STARTED); main.event(gui::Event::STARTED);

@ -4,12 +4,11 @@
namespace gui { namespace gui {
using namespace components; using namespace components;
MainUI::MainUI(sf::RenderWindow& window, GameLevel level, TexturePack& textures) : MainUI::MainUI(sf::RenderWindow& window, GameLevel level) :
$window(window), $window(window),
$level(level), $level(level),
$textures(textures), $overlay_ui($level),
$overlay_ui($level, $textures), $rayview(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT)
$rayview($textures, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT)
{ {
$window.setVerticalSyncEnabled(VSYNC); $window.setVerticalSyncEnabled(VSYNC);
$window.setFramerateLimit(FRAME_LIMIT); $window.setFramerateLimit(FRAME_LIMIT);

@ -15,12 +15,11 @@ namespace gui {
Stats $stats; Stats $stats;
sf::RenderWindow& $window; sf::RenderWindow& $window;
GameLevel $level; GameLevel $level;
TexturePack& $textures;
OverlayUI $overlay_ui; OverlayUI $overlay_ui;
Raycaster $rayview; Raycaster $rayview;
CameraLOL $camera; CameraLOL $camera;
MainUI(sf::RenderWindow& window, GameLevel level, TexturePack &textures); MainUI(sf::RenderWindow& window, GameLevel level);
void mouse(int x, int y); void mouse(int x, int y);
void debug(); void debug();

@ -85,6 +85,7 @@ sources = [
'status_ui.cpp', 'status_ui.cpp',
'systems.cpp', 'systems.cpp',
'texture.cpp', 'texture.cpp',
'textures2.cpp',
'tilemap.cpp', 'tilemap.cpp',
'worldbuilder.cpp', 'worldbuilder.cpp',
] ]
@ -105,6 +106,7 @@ executable('runtests', sources + [
'tests/pathing.cpp', 'tests/pathing.cpp',
'tests/spatialmap.cpp', 'tests/spatialmap.cpp',
'tests/tilemap.cpp', 'tests/tilemap.cpp',
'tests/textures.cpp',
], override_options: exe_defaults, ], override_options: exe_defaults,
dependencies: dependencies + [catch2]) dependencies: dependencies + [catch2])

@ -8,9 +8,8 @@ namespace gui {
using namespace guecs; using namespace guecs;
using std::string; using std::string;
OverlayUI::OverlayUI(GameLevel level, TexturePack& textures) : OverlayUI::OverlayUI(GameLevel level) :
$level(level), $level(level)
$textures(textures)
{ {
$gui.position(RAY_VIEW_X, RAY_VIEW_Y, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT); $gui.position(RAY_VIEW_X, RAY_VIEW_Y, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT);
$gui.layout( $gui.layout(
@ -28,7 +27,7 @@ namespace gui {
auto region = $gui.entity(name); auto region = $gui.entity(name);
world.set<lel::Cell>(region, cell); world.set<lel::Cell>(region, cell);
} }
$gui.init($textures); $gui.init();
} }
void OverlayUI::draw(sf::RenderWindow& window) { void OverlayUI::draw(sf::RenderWindow& window) {
@ -39,7 +38,7 @@ namespace gui {
auto ent = $gui.entity(region); auto ent = $gui.entity(region);
Sprite blood{sprite_name}; Sprite blood{sprite_name};
auto& cell = $gui.cell_for(ent); auto& cell = $gui.cell_for(ent);
blood.init(cell, $textures); blood.init(cell);
$gui.set<guecs::Sprite>(ent, blood); $gui.set<guecs::Sprite>(ent, blood);
} }

@ -9,9 +9,8 @@ namespace gui {
public: public:
guecs::UI $gui; guecs::UI $gui;
GameLevel $level; GameLevel $level;
TexturePack& $textures;
OverlayUI(GameLevel level, TexturePack& $textures); OverlayUI(GameLevel level);
void render(); void render();
void draw(sf::RenderWindow& window); void draw(sf::RenderWindow& window);

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include <numbers> #include <numbers>
#include "components.hpp" #include "components.hpp"
#include "textures2.hpp"
using namespace fmt; using namespace fmt;
using std::make_unique; using std::make_unique;
@ -33,8 +34,7 @@ inline uint32_t new_lighting(uint32_t pixel, int level) {
return conv.as_int; return conv.as_int;
} }
Raycaster::Raycaster(TexturePack &textures, int width, int height) : Raycaster::Raycaster(int width, int height) :
$textures(textures),
$view_texture(sf::Vector2u{(unsigned int)width, (unsigned int)height}), $view_texture(sf::Vector2u{(unsigned int)width, (unsigned int)height}),
$view_sprite($view_texture), $view_sprite($view_texture),
$width(width), $height(height), $width(width), $height(height),
@ -44,6 +44,8 @@ Raycaster::Raycaster(TexturePack &textures, int width, int height) :
$view_sprite.setPosition({0, 0}); $view_sprite.setPosition({0, 0});
$pixels = make_unique<RGBA[]>($width * $height); $pixels = make_unique<RGBA[]>($width * $height);
$view_texture.setSmooth(false); $view_texture.setSmooth(false);
$floor_texture = textures::get_floor();
$ceiling_texture = textures::get_ceiling();
} }
void Raycaster::set_position(int x, int y) { void Raycaster::set_position(int x, int y) {
@ -226,7 +228,7 @@ void Raycaster::cast_rays() {
int draw_end = line_height / 2 + $height / 2 + $pitch; int draw_end = line_height / 2 + $height / 2 + $pitch;
if(draw_end >= $height) draw_end = $height - 1; if(draw_end >= $height) draw_end = $height - 1;
auto texture = $textures.get_surface($map[map_y][map_x] - 1); auto texture = textures::get_surface($map[map_y][map_x] - 1);
// calculate value of wall_x // calculate value of wall_x
double wall_x; // where exactly the wall was hit double wall_x; // where exactly the wall was hit
@ -265,9 +267,6 @@ void Raycaster::cast_rays() {
void Raycaster::draw_ceiling_floor() { void Raycaster::draw_ceiling_floor() {
constexpr static const int texture_width = TEXTURE_WIDTH; constexpr static const int texture_width = TEXTURE_WIDTH;
constexpr static const int texture_height = TEXTURE_HEIGHT; constexpr static const int texture_height = TEXTURE_HEIGHT;
auto floor_texture = (const uint32_t *)$textures.floor.getPixelsPtr();
auto ceiling_texture = (const uint32_t *)$textures.ceiling.getPixelsPtr();
auto &lights = $level.lights->lighting(); auto &lights = $level.lights->lighting();
for(int y = $height / 2 + 1; y < $height; ++y) { for(int y = $height / 2 + 1; y < $height; ++y) {
@ -324,11 +323,11 @@ void Raycaster::draw_ceiling_floor() {
float light_level = matrix::inbounds(lights, map_x, map_y) ? lights[map_y][map_x] : 30; float light_level = matrix::inbounds(lights, map_x, map_y) ? lights[map_y][map_x] : 30;
// FLOOR // FLOOR
color = floor_texture[texture_width * ty + tx]; color = $floor_texture[texture_width * ty + tx];
$pixels[pixcoord(x, y)] = new_lighting(color, light_level); $pixels[pixcoord(x, y)] = new_lighting(color, light_level);
// CEILING // CEILING
color = ceiling_texture[texture_width * ty + tx]; color = $ceiling_texture[texture_width * ty + tx];
$pixels[pixcoord(x, $height - y - 1)] = new_lighting(color, light_level); $pixels[pixcoord(x, $height - y - 1)] = new_lighting(color, light_level);
} }
} }
@ -344,7 +343,7 @@ void Raycaster::draw(sf::RenderTarget& target) {
void Raycaster::update_sprite(DinkyECS::Entity ent, components::Sprite& sprite) { void Raycaster::update_sprite(DinkyECS::Entity ent, components::Sprite& sprite) {
fmt::println("entity UPDATE SPRITE {} will have sprite named {}", ent, sprite.name); fmt::println("entity UPDATE SPRITE {} will have sprite named {}", ent, sprite.name);
auto sprite_txt = $textures.get(sprite.name); auto sprite_txt = textures::get(sprite.name);
$sprites.insert_or_assign(ent, sprite_txt); $sprites.insert_or_assign(ent, sprite_txt);
} }
@ -353,13 +352,13 @@ void Raycaster::set_level(GameLevel level) {
auto& tiles = $level.map->tiles(); auto& tiles = $level.map->tiles();
auto world = $level.world; auto world = $level.world;
auto& player = world->get_the<components::Player>(); auto& player = world->get_the<components::Player>();
$map = $textures.convert_char_to_texture(tiles.$tile_ids); $map = textures::convert_char_to_texture(tiles.$tile_ids);
world->query<components::Sprite>([&](const auto ent, auto& sprite) { world->query<components::Sprite>([&](const auto ent, auto& sprite) {
// player doesn't need a sprite // player doesn't need a sprite
if(player.entity == ent) return; if(player.entity == ent) return;
fmt::println("entity {} will have sprite named {}", ent, sprite.name); fmt::println("entity {} will have sprite named {}", ent, sprite.name);
auto sprite_txt = $textures.get(sprite.name); auto sprite_txt = textures::get(sprite.name);
$sprites.try_emplace(ent, sprite_txt); $sprites.try_emplace(ent, sprite_txt);
}); });
} }

@ -2,10 +2,10 @@
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <SFML/System/Clock.hpp> #include <SFML/System/Clock.hpp>
#include "texture.hpp"
#include "animator.hpp" #include "animator.hpp"
#include "spatialmap.hpp" #include "spatialmap.hpp"
#include "levelmanager.hpp" #include "levelmanager.hpp"
#include "texture.hpp"
using matrix::Matrix; using matrix::Matrix;
using RGBA = uint32_t; using RGBA = uint32_t;
@ -14,7 +14,6 @@ struct Raycaster {
int $pitch=0; int $pitch=0;
sf::Clock $clock; sf::Clock $clock;
sf::Shader $brightness; sf::Shader $brightness;
TexturePack &$textures;
double $pos_x = 0; double $pos_x = 0;
double $pos_y = 0; double $pos_y = 0;
@ -27,6 +26,8 @@ struct Raycaster {
double $plane_y = 0.66; double $plane_y = 0.66;
sf::Texture $view_texture; sf::Texture $view_texture;
sf::Sprite $view_sprite; sf::Sprite $view_sprite;
const uint32_t *$floor_texture = nullptr;
const uint32_t *$ceiling_texture = nullptr;
std::unique_ptr<RGBA[]> $pixels = nullptr; std::unique_ptr<RGBA[]> $pixels = nullptr;
@ -40,7 +41,7 @@ struct Raycaster {
std::vector<double> $zbuffer; // width std::vector<double> $zbuffer; // width
Animator $anim; Animator $anim;
Raycaster(TexturePack &textures, int width, int height); Raycaster(int width, int height);
void cast_rays(); void cast_rays();
void draw_ceiling_floor(); void draw_ceiling_floor();

@ -12,16 +12,16 @@ namespace gui {
{ {
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT); $gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
$gui.layout( $gui.layout(
"[button1 | button2 | button3]"
"[button4 | button5 | button6]"
"[button7 | button8 | button9]"
"[*%(100,300)log_view]" "[*%(100,300)log_view]"
"[_]" "[_]"
"[_]" "[_]"
"[button1 | button2 | button3]"
"[button4 | button5 | button6]"
"[button7 | button8 | button9]"
); );
} }
void StatusUI::render(TexturePack &textures) { void StatusUI::render() {
auto& world = $gui.world(); auto& world = $gui.world();
std::vector<std::string> fake_items{ std::vector<std::string> fake_items{
@ -48,7 +48,7 @@ namespace gui {
} }
} }
$gui.init(textures); $gui.init();
} }
void StatusUI::draw(sf::RenderWindow &window) { void StatusUI::draw(sf::RenderWindow &window) {

@ -2,7 +2,7 @@
#include "levelmanager.hpp" #include "levelmanager.hpp"
#include "constants.hpp" #include "constants.hpp"
#include <deque> #include <deque>
#include "texture.hpp" #include "textures2.hpp"
#include "guecs.hpp" #include "guecs.hpp"
namespace gui { namespace gui {
@ -15,7 +15,7 @@ namespace gui {
StatusUI(GameLevel level); StatusUI(GameLevel level);
void update_level(GameLevel &level) { $level = level; } void update_level(GameLevel &level) { $level = level; }
void log(std::string msg); void log(std::string msg);
void render(TexturePack &textures); void render();
void draw(sf::RenderWindow &window); void draw(sf::RenderWindow &window);
}; };
} }

@ -8,9 +8,7 @@ using namespace guecs;
TEST_CASE("prototype one gui", "[ecs-gui]") { TEST_CASE("prototype one gui", "[ecs-gui]") {
guecs::UI gui; guecs::UI gui;
textures::init();
TexturePack textures;
textures.load_sprites();
gui.position(0, 0, 1000, 500); gui.position(0, 0, 1000, 500);
gui.layout("[test1|test2|test3][test4|_|test5]"); gui.layout("[test1|test2|test3][test4|_|test5]");
@ -24,7 +22,7 @@ TEST_CASE("prototype one gui", "[ecs-gui]") {
world.set<Textual>(button, {name}); world.set<Textual>(button, {name});
} }
gui.init(textures); gui.init();
// at this point it's mostly ready but I'd need to render it to a window real quick // at this point it's mostly ready but I'd need to render it to a window real quick
sf::RenderWindow window; sf::RenderWindow window;

@ -0,0 +1,17 @@
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <string>
#include "textures2.hpp"
using namespace fmt;
TEST_CASE("test texture management", "[textures]") {
textures::init();
auto spider = textures::get("hairy_spider");
auto image = textures::load_image("assets/hairy_spider-256.png");
auto img_ptr = textures::get_surface(0);
REQUIRE(img_ptr != nullptr);
}

@ -7,14 +7,14 @@
using std::shared_ptr, std::make_shared; using std::shared_ptr, std::make_shared;
sf::Image TexturePack::load_image(std::string filename) { sf::Image TextureManager::load_image(std::string filename) {
sf::Image texture; sf::Image texture;
bool good = texture.loadFromFile(filename); bool good = texture.loadFromFile(filename);
dbc::check(good, fmt::format("failed to load {}", filename)); dbc::check(good, fmt::format("failed to load {}", filename));
return texture; return texture;
} }
void TexturePack::load_sprites() { void TextureManager::load_sprites() {
Config assets("assets/config.json"); Config assets("assets/config.json");
for(auto& el : assets["sprites"].items()) { for(auto& el : assets["sprites"].items()) {
@ -28,13 +28,11 @@ void TexturePack::load_sprites() {
sprite_textures[name] = {sprite, texture}; sprite_textures[name] = {sprite, texture};
} }
sword = sprite_textures["sword"];
floor = load_image(assets["sprites"]["floor"]); floor = load_image(assets["sprites"]["floor"]);
ceiling = load_image(assets["sprites"]["ceiling"]); ceiling = load_image(assets["sprites"]["ceiling"]);
} }
void TexturePack::load_tiles() { void TextureManager::load_tiles() {
Config assets("assets/tiles.json"); Config assets("assets/tiles.json");
auto &tiles = assets.json(); auto &tiles = assets.json();
@ -50,11 +48,11 @@ void TexturePack::load_tiles() {
} }
} }
const uint32_t* TexturePack::get_surface(size_t num) { const uint32_t* TextureManager::get_surface(size_t num) {
return (const uint32_t *)surfaces[num].getPixelsPtr(); return (const uint32_t *)surfaces[num].getPixelsPtr();
} }
matrix::Matrix TexturePack::convert_char_to_texture(matrix::Matrix &tile_ids) { matrix::Matrix TextureManager::convert_char_to_texture(matrix::Matrix &tile_ids) {
auto result = matrix::make(matrix::width(tile_ids), matrix::height(tile_ids)); auto result = matrix::make(matrix::width(tile_ids), matrix::height(tile_ids));
for(matrix::each_cell it(tile_ids); it.next();) { for(matrix::each_cell it(tile_ids); it.next();) {
@ -65,7 +63,7 @@ matrix::Matrix TexturePack::convert_char_to_texture(matrix::Matrix &tile_ids) {
return result; return result;
} }
SpriteTexture TexturePack::get(std::string name) { SpriteTexture TextureManager::get(std::string name) {
dbc::check(sprite_textures.contains(name), dbc::check(sprite_textures.contains(name),
fmt::format("!!!!! texture pack does not contain {} sprite", name)); fmt::format("!!!!! texture pack does not contain {} sprite", name));
return sprite_textures.at(name); return sprite_textures.at(name);

@ -13,13 +13,12 @@ struct SpriteTexture {
std::shared_ptr<sf::Texture> texture = nullptr; std::shared_ptr<sf::Texture> texture = nullptr;
}; };
struct TexturePack { struct TextureManager {
std::vector<sf::Image> surfaces; std::vector<sf::Image> surfaces;
std::unordered_map<std::string, SpriteTexture> sprite_textures; std::unordered_map<std::string, SpriteTexture> sprite_textures;
std::unordered_map<wchar_t, int> char_to_texture; std::unordered_map<wchar_t, int> char_to_texture;
sf::Image floor; sf::Image floor;
sf::Image ceiling; sf::Image ceiling;
SpriteTexture sword;
void load_tiles(); void load_tiles();
void load_sprites(); void load_sprites();

@ -0,0 +1,38 @@
#include "textures2.hpp"
namespace textures {
static TextureManager textures;
static bool initialized = false;
void init() {
if(!initialized) {
textures.load_tiles();
textures.load_sprites();
initialized = true;
}
}
SpriteTexture get(std::string name) {
return textures.get(name);
}
sf::Image load_image(std::string filename) {
return textures.load_image(filename);
}
const uint32_t* get_surface(size_t num) {
return textures.get_surface(num);
}
matrix::Matrix convert_char_to_texture(matrix::Matrix &from) {
return textures.convert_char_to_texture(from);
}
const uint32_t* get_floor() {
return (const uint32_t *)textures.floor.getPixelsPtr();
}
const uint32_t* get_ceiling() {
return (const uint32_t *)textures.ceiling.getPixelsPtr();
}
};

@ -0,0 +1,18 @@
#pragma once
#include "texture.hpp"
namespace textures {
void init();
SpriteTexture get(std::string name);
sf::Image load_image(std::string filename);
const uint32_t* get_surface(size_t num);
matrix::Matrix convert_char_to_texture(matrix::Matrix &from);
const uint32_t* get_floor();
const uint32_t* get_ceiling();
}
Loading…
Cancel
Save