#### Archived

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

# Getting the first field to be drawn

This topic is 6881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 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 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?

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009808
• ### Who's Online (See full list)

There are no registered users currently online

×