• Create Account

## Getting the first field to be drawn

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1ThePrime  Members

122
Like
Likes
Like

Posted 21 December 1999 - 03:09 AM

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.

### #2logistix  Members

122
Like
Likes
Like

Posted 20 December 1999 - 03:05 PM

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.

### #3TANSTAAFL  Moderators

1160
Like
Likes
Like

Posted 21 December 1999 - 01:47 AM

(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.

### #4SiCrane  Moderators

11523
Like
Likes
Like

Posted 21 December 1999 - 03:09 AM

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?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.