You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried changing the sx value on my TileEngine and I noticed that it wasn't working. I thought that was weird as the current value was 0 and I was just trying to increment it by 1. It would remain at 0.
A look at the setter made me understand the problem.
It is comparing the mapwidth with the canvas' width. In my particular case the mapwidth value was 1024 and the canvas width was 1920. Which at face value seems right. That's like saying that the map width is contained within the canvas. But the thing is, it wasn't. For one very simple reason, I'm scaling using context.scale(scaleFactorX, scaleFacorY).
I would think that scaling like this is a pretty common thing to do. Is it not?
Anyway, I'm thinking that it would be useful to account for scaling in the sx and sy setters to make it possible for people who are doing it to use the TileEngine.
Modifying those setters like this should do the trick:
I tried changing the sx value on my TileEngine and I noticed that it wasn't working. I thought that was weird as the current value was 0 and I was just trying to increment it by 1. It would remain at 0.
A look at the setter made me understand the problem.
It is comparing the
mapwidth
with the canvas'width
. In my particular case themapwidth
value was 1024 and the canvaswidth
was 1920. Which at face value seems right. That's like saying that the map width is contained within the canvas. But the thing is, it wasn't. For one very simple reason, I'm scaling usingcontext.scale(scaleFactorX, scaleFacorY)
.I would think that scaling like this is a pretty common thing to do. Is it not?
Anyway, I'm thinking that it would be useful to account for scaling in the sx and sy setters to make it possible for people who are doing it to use the TileEngine.
Modifying those setters like this should do the trick:
I'd be happy to make a PR if you think this is a good idea.
The text was updated successfully, but these errors were encountered: