Can someone help me render a screen full of isometric tiles? No matter what formula I come up with, I can either make a screen full of tiles that are not clickable OR have clickable tiles that don't fill the screen. I'm also having trouble getting through all the crap filling google now.
#How to render a screen of isometric tiles
14 messages · Page 1 of 1 (latest)
I've tried clint Bellanger and javidx9's tutorials, and while they get me most the way there, is the full screen aspect that's breaking me
Maybe you can show us what you so far?
If i was smart I would have pushed to github. I'll check back in tomorrow morning
I have some conversion code written out. Just make sure to do your calculations on 2d and display it on 3d(isometric).
Vector2f to3D(float x, float y)
{
float tileWidth = 120.0f;
float tileHeight = 60.0f;
return Vector2f((x - y) * (tileWidth / 2), (x + y) * (tileHeight / 2));
}
Vector2f to2DGrid(float isoX, float isoY)//restricted to grid
{
float tileWidth = 120.0f;
float tileHeight = 60.0f;
float x = (isoX / (tileWidth / 2) + isoY / (tileHeight / 2)) / 2;
float y = (isoY / (tileHeight / 2) - isoX / (tileWidth / 2)) / 2;
x = x-1;
return Vector2f(static_cast<int>(round(x)), static_cast<int>(round(y)));
}
Vector2f to2D(float isoX, float isoY)//Not restricted to grid
{
float tileWidth = 120.0f;
float tileHeight = 60.0f;
float x = (isoX / (tileWidth / 2) + isoY / (tileHeight / 2)) / 2;
float y = (isoY / (tileHeight / 2) - isoX / (tileWidth / 2)) / 2;
return Vector2f(x, y);
}
That looks similar to what I had that will print a diamond to the screen. My issue has been expanding that diamond out to the whole screen
I'll try again when I get time though
Is your issue in the number of cells displayed or in the size of each cell?
Scenerio A: a diamond shape, but the standard click fuction works (ignore my click code)
https://github.com/oldCooner/isometricRendering/blob/38993c5a2c67e70f92fefcd41a47774196afea6a/game/map/Map.c#L42
Scenerio B: Actual screen full of tiles that I could scroll through, but not even a faint idea how to click them:
https://github.com/oldCooner/isometricRendering/blob/screenFull/game/map/Map.c#L42
PS: found staggered technique and this may be what I needed
@supple marsh has reached level 5. GG!
You can transform your mouse position to tile space
With matrix