Archived

This topic is now archived and is closed to further replies.

ThePrime

Getting the first field to be drawn

Recommended Posts

Instead of using a "viewpoint" why don't you just use the first-tile as your reference point? Then have an X offset and Y offset that are pixel perfect. When they hit a limit (0 or the size of the tile) the first tile changes.

Share this post


Link to post
Share on other sites
(let me translate this into my own jargon to see if i understand the problem correctly)

so, you have a screenspace with the anchor on (0,0), and this anchor corresponds to some point in tilespace, right? and you want to know how to test for partially visible tiles.

if this is the problem, you only need to test for the corners. you translate the screenspace coordinates into tilespace coordinates, then translate the tilespace coordinates into tilemap coordinates using a mousemap.

Share this post


Link to post
Share on other sites
I am writing an isoengine which is capable of (smooth) scrolling. I think you now the technique... I have a "viewpoint" which represents the current screenposition on the isomap (the vp is relative to the 0, 0 screencoordinate). Now I need a fast function that gives me the position and fieldnumber (row/col) of the first field (tile) to be drawn. My first (totally unserious) idea was just to check each pixel: convert some coordinates and see if there is a tile (have that formula) Of course it was more a joke - imagine how slow this would be. After I would have calculated the first tile, I could go on with the normal drawing. Now I need a better function (can it be worse?) for this purpose. Thanks in advance.

Share this post


Link to post
Share on other sites
If you draw from left to right, top to bottom, why don't you just convert the pixel in the upper left of the screen into tile-coordintates? Is your map irregular?

Share this post


Link to post
Share on other sites