I've built SFML myself using the latest snapshot, everything works fine, however I noticed that there's no longer a convertCoords option, and instead there are some mapCoordinatesToPixels method and another one, every source tells me to use convertcoords which no longer exists, the tutorials should really be updated but what I'm really here for is to find out how to actually convert coords in the latest snapshot?
All I want is to render a camera and a sprite, and I don't want the sprite to move with the camera. Here's my code:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow winMain(sf::VideoMode(500, 500, 32), "Title");
sf::View camera = winMain.getDefaultView();
sf::Event mainEvent;
sf::Texture logo_tex;
logo_tex.loadFromFile("textlogo.png");
sf::Sprite logo_spr(logo_tex);
logo_spr.setPosition(350, 350);
winMain.setView(camera);
while(winMain.isOpen())
{
winMain.mapPixelToCoords(logo_spr.getPosition());
while(winMain.pollEvent(mainEvent))
{
if(mainEvent.type == sf::Event::Closed)
winMain.close();
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) camera.move(1, 0);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) camera.move(-1, 0);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) camera.move(0, -1);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) camera.move(0, 1);
}
winMain.clear();
winMain.draw(logo_spr);
winMain.display();
}
}
However I'm getting an error when trying to convert the coords, it tells me the paramater is vector2f and not vector2i.
Any ideas?