Hey,
I couldn't log in for whatever reason earlier. But I appreciate all the help!
What I did was this:
_shape.setPointCount(4);
_shape.setPoint(0,sf::Vector2f(_width/2,0));
_shape.setPoint(1,sf::Vector2f(_width,_height/2.0));
_shape.setPoint(2,sf::Vector2f(_width/2.0,_height));
_shape.setPoint(3,sf::Vector2f(0,_height/2.0));
_shape.setOrigin(_width/2.0,_height/2.0);
_shape.setScale(scale,scale);
then used functions like
sf::Vector2f mapCoordsToPixel(const sf::Vector2i& coord) const
{
const float sw = _scale * _width/2.0;
const float sh = _scale * _height/2.0;
return sf::Vector2f((coord.x-coord.y) * sw,
(coord.x + coord.y) * sh);
}
sf::Vector2i mapPixelToCoords(const sf::Vector2f& coord) const
{
return round(sf::Vector2f(
(coord.x/_width + coord.y/_height)/ _scale,
(-coord.x/_width + coord.y/_height)/_scale)
);
}
Which was something I found on github after looking through isometric projects? I have a bunch of formulas for positioning isometric tiles, but drawing the outline stumped me. After looking at that example it makes complete sense based on positioning by half width and half height.
I know that isometric is different, which is why I was confused about how to draw the diamond shape. The sprites are 64x96, when the sprites are not the same size does this often cause problems? I have a few isometric formulas and some seem to not work as well as others depending on the size. For example, sometimes I see people divide by 4 on the Y-axis. Sometimes I see people multiply by the tile size width on both axis. While other times I see it multiply according to the axis tile size.
Can anyone explain the ratio bit? I see this a lot when dealing with isometric. I recall an SDL Isometric engine (Flare) that used this ratio float into the equation. 64/96 = 0.66...What is the significance of knowing this value?As far as the texture looking distorted. I don't really need to shrink it, but just capture the middle since the size is way bigger. But I've come to the conclusion it's better to just hop on photoshop and make it an isometric tile.
Have a great day!
Thanks, everyone.