OpenGLでHEXマップを再帰的に描画するのですか?
-
14-11-2019 - |
質問
私はGLに新しいことで、タイルティックマップを自己結成されたものとして作成したいと思いました。私は小さい(たぶん7ヘクス広い/背の高い)16進マップを作りたいです。私の最初の考えは、1六角を描く方法を作成してから、適切なオフセットを翻訳して新しい16進数を配置する方法を作成することでした。しかし、これは効率的ではないようです。何か案は?側面の質問としてのALOS、MoteVentが与えられた六角のものであるかどうかを判断するのですか?
他のヒント
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.