[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] [PATCH] JOYHATMOTION events with wrong 'value' attrib



Hello,

there seems to be a typo in the code that assembles JOYHATMOTION event
objects - the 'value' attribute is computed incorrectly.  The following
trivial patch should correct it:

--- event-orig.c        2003-08-10 13:56:33.000000000 +0000
+++ event.c     2003-08-10 13:57:36.000000000 +0000
@@ -271,7 +271,7 @@
                hx = hy = 0;
                if(event->jhat.value&SDL_HAT_UP) hy = 1;
                else if(event->jhat.value&SDL_HAT_DOWN) hy = -1;
-               if(event->jhat.value&SDL_HAT_LEFT) hx = 1;
+               if(event->jhat.value&SDL_HAT_RIGHT) hx = 1;
                else if(event->jhat.value&SDL_HAT_LEFT) hx = -1;
                insobj(dict, "value", Py_BuildValue("(ii)", hx, hy));
                break;

Thanks for the great pygame library!

	latimerius