summaryrefslogtreecommitdiffstats
path: root/GLX.hs
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2010-03-08 20:16:51 +0100
committerMatthias Schiffer <matthias@gamezock.de>2010-03-08 20:16:51 +0100
commit996313bd8994d4536492ec8000f7a92fb015433e (patch)
tree3c41f2ccf5504016b8353d277fac970b6115a26a /GLX.hs
parentd8cf601ac2aa36e299e5d50e246f73497409a110 (diff)
downloadhtanks-996313bd8994d4536492ec8000f7a92fb015433e.tar
htanks-996313bd8994d4536492ec8000f7a92fb015433e.zip
Re-corrected coordinates... and new tank texture
Diffstat (limited to 'GLX.hs')
-rw-r--r--GLX.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/GLX.hs b/GLX.hs
index ba2bfeb..f98d367 100644
--- a/GLX.hs
+++ b/GLX.hs
@@ -157,9 +157,12 @@ handleEvent glx xevent = do
wa <- getWindowAttributes (glxDisplay glx) (glxWindow glx)
let x = fromIntegral . ev_x $ event
y = fromIntegral . ev_y $ event
+ w = fromIntegral . wa_width $ wa
h = fromIntegral . wa_height $ wa
s = fromRational . glxScale $ glx
- return (glx, Just $ SomeEvent $ MouseMotionEvent (x/s) ((h-y)/s))
+ lw = fromIntegral . glxLevelWidth $ glx
+ lh = fromIntegral . glxLevelHeight $ glx
+ return (glx, Just $ SomeEvent $ MouseMotionEvent ((w/2+x)/s - lw/2) ((h/2-y)/s + lh/2))
| otherwise -> return (glx, Nothing)