switching to tilemap, the game loads fine, the map is made fine, I get no errors, but the tilemap only renders as a transparent rectangle with the dimensions I specified. I have no clue if this is just due to a function I need to run, (I've run setSize, setTexture, setTextureTileSize, setOutOfBoundsTile, and setLevel, as well as update and redraw in the draw loop) or if I'm doing it wrong.
int main()
{
tileMapImg.loadFromFile("Assets/Textures/tilemap.png");
mapTex.create(32, 32);
mapTex.update(tileMapImg);
tileMapDisplay.setSize(sf::Vector2f(mapWidth * blockZoom, mapHeight * blockZoom));
tileMapDisplay.setTexture(mapTex);
tileMapDisplay.setTextureTileSize(sf::Vector2u(1, 1));
tileMapDisplay.setOutOfBoundsTile(3);
sf::RenderWindow window(sf::VideoMode(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height), "Teria: also try pixel game!", sf::Style::Fullscreen);
window.setVerticalSyncEnabled(true);
view.setSize(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height);
view.setCenter(0, 0);
window.setView(view);
//map generation code here
{
...
}
tileMapDisplay.setLevel(map, mapWidth);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if (event.type == sf::Event::Resized)
{
sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height);
window.setView(sf::View(visibleArea));
}
}
window.clear(sf::Color::Blue);
sf::Time elapsed = gameClock.restart();
//game update logic (doesn't work in it's own function for unknown reasons)
{
//map drawing
{
tileMapDisplay.update();
tileMapDisplay.redraw();
window.draw(tileMapDisplay);
}
//player movement
{
...
}
}
window.display();
}
return 0;
}
EDIT:
fixed it, turns out I misunderstood a function and was only rendering the first 16x16 square of tiles.