Question

Je suis nouveau à GL et je voulais créer une carte carrelée en tant que tuorial.Je veux créer une petite carte hexagonale (peut-être 7 hexes large).Ma première pensée était de créer une méthode pour dessiner un hex, puis traduisez simplement le décalage approprié et placez le nouvel hexagone.Mais cela ne semble pas effacieux.Des idées?ALOS en tant que question secondaire, comment puis-je déterminer si un nouvelevent a-t-il d'un hexagone donné?

Était-ce utile?

Autres conseils

To determine if a MotionEvent is within a certain hex you have to convert the coords passed in via the motion event to your OpenGL World coords. Its just like a unit conversion, you know the screen goes from 0 - WIDTH and your GL world lets say goes from -1 to 1.

(xCoord / (Width - 0)) * (1 - (-1)) = xCoordWorld

will give you the xCoord from 0 to 2, then subtract 1 to get it in -1 to 1.

As far as the hexes go I've always used 'art' hexes. Draw the hex out in paint then render a bunch of squares with that piece of art on them, fast and easy to swap a hex out for another hex.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top