Skip to main content
GameDev.net gamedev.net
🔒 Locked

ISO3D Tile Selection

Started by MCAgni Aug 11, 2002 at 6:17 PM 1 replies 400+ views
Original Post
MCAgni
MCAgni
Hello, i have read the book "Isometric Game Programming with DirectX 7.0" and in the last Chapter TRANSTAAFL told me how to do a Tile Selection in ISO3D, but i don''t understand this. I make a Surface for the MouseMap, and each Row have a Color. So, when i click on the Mouse, i read the MouseMap-Surface Pixel at the Mouse-Coordinate. And, then???? How i can transform the WORD Color into the Map-Location??? Have somebody a Code for this stupid Problem??? My CodeBy Mouse-Click) POINT Convert_Color_Tile(POINT ptMousePos) { POINT ptTemp; DDSURFACEDESC2 ddsd; memset(&ddsd,0,sizeof(DDSURFACEDESC2)); ddsd.dwSize=sizeof(DDSURFACEDESC2); lpddsMouseMap->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL); LONG lPitch = ddsd.lPitch/sizeof(WORD); WORD* pSurface = (WORD*)ddsd.lpSurface; WORD dwColor = pSurface[ptMousePos.x+ptMousePos.y*lPitch]; lpddsMouseMap->Unlock(NULL); // Here is the Problem...what must i do with the Color? return ptTemp; } I hope somebody have read the book too, and can help me. I relly don''t know how to do this! Cya MC Agni
Wyrframe
Wyrframe
I''m not sure about that specific book... but the general method is thus.


----------------------
|Blue /\ Green|
| / \ |
| / \ |
|/ White \|
|\ /|
| \ / |
| \ / |
|Magenta \/ Red |
----------------------



  
switch (dwColor) {
case COLOR_WHITE:
// Clicked on this tile.

break;
case COLOR_BLUE:
if (ptTemp.y is even) ptTemp.x--; ptTemp.y--; break;
case COLOR_GREEN:
if (ptTemp.y is odd) ptTemp.x++; ptTemp.y--; break;
case COLOR_MAGENTA:
if (ptTemp.y is even) ptTemp.x--; ptTemp.y++; break;
case COLOR_RED:
if (ptTemp.y is odd) ptTemp.x++; ptTemp.y++; break;
default:
break;
}


The maths above are assuming you show the map by interleaving the odd rows by moving the tiles over half a column. But that is the basic concept; use the color to determine exactly which tile to shove the "real" cursor position into.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
MCAgni
MCAgni
Hello,

thank you for your answer, but in ISO3D you don''t use these Bitmap-MouseMap.

Have nobody read this book, and have a code for this Problem???

So, TRANSTAAFEL give me a answer,please! Or somebody else...

Cya MC Agni

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.