Tried out 512px tiles and sprites and they actually look like crap. They just look like bad textures not better painted. With 256 they look nicely pixelated.
This commit is contained in:
parent
d397c02d38
commit
5e6f95513c
42 changed files with 41 additions and 44 deletions
18
texture.cpp
18
texture.cpp
|
@ -3,16 +3,12 @@
|
|||
#include "dbc.hpp"
|
||||
#include <fmt/core.h>
|
||||
#include "config.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
Image TexturePack::load_image(std::string filename) {
|
||||
Image texture(TEXTURE_WIDTH * TEXTURE_HEIGHT);
|
||||
sf::Image img;
|
||||
bool good = img.loadFromFile(filename);
|
||||
sf::Image TexturePack::load_image(std::string filename) {
|
||||
sf::Image texture;
|
||||
bool good = texture.loadFromFile(filename);
|
||||
dbc::check(good, fmt::format("failed to load {}", filename));
|
||||
|
||||
uint32_t *pixbuf = (uint32_t *)img.getPixelsPtr();
|
||||
std::copy_n(pixbuf, texture.size(), texture.begin());
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
@ -29,7 +25,7 @@ void TexturePack::load_textures() {
|
|||
floor = load_image(assets["floor"]);
|
||||
ceiling = load_image(assets["ceiling"]);
|
||||
|
||||
sf::Texture* sprite_texture = new sf::Texture("assets/evil_eye_test-256.png");
|
||||
sf::Texture* sprite_texture = new sf::Texture("assets/evil_eye_test-512.png");
|
||||
sprite_texture->setSmooth(false);
|
||||
sf::Sprite* sf_sprite = new sf::Sprite(*sprite_texture);
|
||||
sprites.push_back({4.0, 3.55, 6, sf_sprite, sprite_texture});
|
||||
|
@ -39,8 +35,8 @@ void TexturePack::load_textures() {
|
|||
sword.sprite = new sf::Sprite(*sword.sprite_texture);
|
||||
}
|
||||
|
||||
Image& TexturePack::get_texture(size_t num) {
|
||||
return images[num];
|
||||
const uint32_t* TexturePack::get_texture(size_t num) {
|
||||
return (const uint32_t *)images[num].getPixelsPtr();
|
||||
}
|
||||
|
||||
Sprite &TexturePack::get_sprite(size_t sprite_num) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue