سؤال

أنا جديد في GL وأراد إنشاء خريطة مبلطة كوسيرية ذاتية.أريد إنشاء خريطة عرافة صغيرة (ربما 7 عريوز).كان من الفكر الأول هو مجرد إنشاء طريقة لرسم عرافة واحدة ثم مجرد ترجمة الإزاحة المناسبة ووضع عرافة جديدة.ولكن هذا لا يبدو داء.أيه أفكار؟ALOS كمسألة جانبية، كيف يمكنني تحديد ما إذا كانت MotionEvent موجودة في HEX معينة؟

هل كانت مفيدة؟

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top