Frage

Ich bin neu auf GL und wollte eine geflieste Karte als Selbsttororial erstellen.Ich möchte eine kleine (vielleicht 7-Hexe-Wide / Tall-Hex-Karte erstellen.Mein erster Gedanke war, einfach eine Methode zu erstellen, um einen SEX zu zeichnen, und übersetzen Sie dann einfach den entsprechenden Versatz und platzieren Sie den neuen Hex.Dies scheint jedoch nicht effizient zu sein.Irgendwelche Ideen?ALOS als Seitenfrage, wie er bestehe, ob ein MotionEvent mit in den gegebenen Hexen ist?

War es hilfreich?

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top