Bonjour,
Tout d'abord, je vous remercie pour vos messages, et désolé pour la réponse tardive.
J'ai fait une conversion des codes pour les adapter au C#.
Le code fonctionne, mais ne donne pas du tout les bons résultats.
Voici le code converti en C#
public object get_pos(int cellId, int mapWidth, float windowWidth)
{
float cellWidth = windowWidth / (mapWidth - 1);
float cellHeight = 0.5f * cellWidth;
float offset = 0.5f * cellWidth;
int err = (int)Math.Round(Math.Floor(cellId / (float)(mapWidth * 2 - 1)));
int row = (int)Math.Round((cellId + err) / (double)mapWidth);
int col = (cellId + err) % mapWidth;
return Tuple.Create(cellWidth * col + ((row & 1) != 0 ? offset : 0.0f), cellHeight * (row * 0.5f));
}
et je l'appelle avec ceci pour avoir un messagebox
Interaction.MsgBox(get_pos(230, 15, 1000).ToString());
et quand je compare sur la position de la map celle-ci n'est pas du tout la même elle m'indique autre chose
J'ai peut être fait une erreur ? :/