bool arrowdrawed = false; //mousePos = sf::vector2i de la pos souris
if (mousePos.x > 0 && mousePos.x < 30 && arrowdrawed == false) {
arrowdrawed = true;
if (m_fleche.getPathName() != "flechegauche")
m_fleche.load(m_tex->images.getPath("flechegauche"), "flechegauche");
m_fleche.setPosition(0.f, -1.f);
sf::Vector2i tile = perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng"));
for(int i(0); i < tile.y; ++i) { //Mes tiles iso font 64x32 px
m_fleche.move(0.f, 32.f);
}
}
if (mousePos.y > 0 && mousePos.y < 30 && arrowdrawed == false) {
arrowdrawed = true;
if (m_fleche.getPathName() != "flechehaut")
m_fleche.load(m_tex->images.getPath("flechehaut"), "flechehaut");
m_fleche.setPosition(-1.f, 0.f);
sf::Vector2i tile = perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng"));
for(int i(0); i < tile.x; ++i) {
m_fleche.move(64.f, 0.f);
}
} //map.MAPX = 15, map.MAPY = 8
if (mousePos.x > map.getMAPX()*32 && mousePos.x < map.getMAPX()*32+32 && arrowdrawed == false) {
arrowdrawed = true;
if (m_fleche.getPathName() != "flechedroite")
m_fleche.load(m_tex->images.getPath("flechedroite"), "flechedroite");
m_fleche.setPosition(static_cast<float>(15*32+32-47), -1.f); //on enlève 47 pour que la flèche soit visible (taille de la flèche)
sf::Vector2i tile = perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng"));
for(int i(0); i < tile.y; ++i) {
m_fleche.move(0.f, 32.f);
}
}
if (mousePos.y > map.getMAPY()*32-32 && mousePos.y < map.getMAPY()*32 && arrowdrawed == false) {
arrowdrawed = true;
if (m_fleche.getPathName() != "flechebas")
m_fleche.load(m_tex->images.getPath("flechebas"), "flechebas");
m_fleche.setPosition(-1.f, static_cast<float>(8*32-47));
sf::Vector2i tile = perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng"));
for(int i(0); i < tile.x; ++i) {
m_fleche.move(64.f, 0.f);
}
}
if (arrowdrawed == true) {
draw(m_fleche);
if (showIt == true) {
showIt = false;
std::cout << std::flush;
std::cout << "ArrowDrawed True. Pos Mouse: " << mousePos.x << ", " << mousePos.y << std::endl;
std::cout << "Tile: " << perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng")).x;
std::cout << ", " << perso.getTileIso(sf::Vector2i(mousePos.x, mousePos.y), m_tex->images.getPath("schemepng")).y << std::endl;
}
}