Hi everybody
This is the code, that i have right now. Sorry for the german
comments, but I think it should be understandable code. It draws 2 Hex
Polys. Now i want know how does pyglet know if the Mouse cursoer is
over one of them. Searched in the OpenGL and PyGlet docs but I could
not find anything. A Hint would be much appreciated.
Thanks in advance
Thorsten
from
pyglet.gl import *
window = pyglet.window.Window()
class my_hexagon():
def __init__(self, posX, posY):
glBegin(GL_TRIANGLE_FAN)
glVertex2f(posX, posY) # Mittelpunkt
glVertex2f(posX-50, posY-86.6) # Unten Links
glVertex2f(posX+50, posY-86.6) # Unten Rechts
glVertex2f(posX+100, posY) # Rechts
glVertex2f(posX+50, posY+86.6) # Oben Rechts
glVertex2f(posX-50, posY+86.6) # Oben Links
glVertex2f(posX-100, posY) # Links
glVertex2f(posX-50, posY-86.6) # Unten Links
glEnd()
@window.event
def on_draw():
glClear(GL_COLOR_BUFFER_BIT)
glLoadIdentity()
HexA = my_hexagon(400, 400)
HexB = my_hexagon(200, 200)
pyglet.app.run()