[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] MacOS/PyGame/PyOpenGL mouse inversion
- To: pygame-users@xxxxxxxx
- Subject: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
- From: "Dave LeCompte (really)" <dave@xxxxxxxxxxxx>
- Date: Tue, 16 Jan 2007 17:19:33 -0800 (PST)
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 16 Jan 2007 20:19:48 -0500
- Importance: Normal
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: SquirrelMail/1.4.8-2.fc6
Hi there, I'm new to the list, so this may have been answered before.
I've got a PyGame/PyOpenGL app that I'm working on which I can run under
MSWindows or Mac OSX and in windowed or fullscreen mode. I notice that
when I run in a window on my Mac, the value returned by
pygame.mouse.get_pos() is relative to the lower left corner of the screen,
but if I run fullscreen on the Mac, fullscreen on by Windows PC, or in a
window on the Windows PC, the value is relative the the upper left corner
(agreeing with the docs at
http://www.pygame.org/docs/ref/mouse.html#pygame.mouse.get_pos ).
Is this a known issue?
Attached is a short test script that displays the strange behavior.
-Dave LeCompte
import sys
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
def main():
video_flags = OPENGL|DOUBLEBUF
if "-f" in sys.argv:
video_flags |= FULLSCREEN
pygame.init()
surf=pygame.display.set_mode((640,480), video_flags)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluOrtho2D(0,640,480,0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glColor3f(1.0, 1.0, 1.0)
done=False
while not done:
glClear(GL_COLOR_BUFFER_BIT)
for e in pygame.event.get():
if e.type==QUIT or e.type == KEYDOWN:
done=True
mx,my=pygame.mouse.get_pos()
glBegin(GL_LINE_LOOP)
glVertex2f(320,0)
glVertex2f(340,20)
glVertex2f(300,20)
glEnd()
glBegin(GL_LINE_LOOP)
glVertex2f(mx-5.0,my)
glVertex2f(mx,my-5.0)
glVertex2f(mx+5.0,my)
glVertex2f(mx,my+5.0)
glEnd()
pygame.display.flip()
main()