summaryrefslogtreecommitdiffstats
path: root/src/GLX.hs
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2010-04-12 16:17:41 +0200
committerMatthias Schiffer <matthias@gamezock.de>2010-04-12 16:17:41 +0200
commit08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2 (patch)
treebb4f2f36cd4fc5c230744d44bdd40aa3e4badaa8 /src/GLX.hs
parentdafe16f191f99dc1199a5b386fad916a78c5c4f1 (diff)
downloadhtanks-08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2.tar
htanks-08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2.zip
Simplified texture and model loading; also use crosshair for DefaultPlayer
Diffstat (limited to 'src/GLX.hs')
-rw-r--r--src/GLX.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/GLX.hs b/src/GLX.hs
index bc2201e..9ad6392 100644
--- a/src/GLX.hs
+++ b/src/GLX.hs
@@ -15,10 +15,11 @@ import Graphics.Rendering.OpenGL.GL.CoordTrans (matrixMode, MatrixMode(..), view
import Graphics.X11.Types
import Graphics.X11.Xlib.Atom (internAtom)
-import Graphics.X11.Xlib.Display (defaultScreen, openDisplay, rootWindow)
-import Graphics.X11.Xlib.Event (XEventPtr, allocaXEvent, nextEvent, get_Window, get_EventType, pending)
+import Graphics.X11.Xlib.Color (queryColor)
+import Graphics.X11.Xlib.Display (defaultScreen, openDisplay, rootWindow, whitePixel)
+import Graphics.X11.Xlib.Event (XEventPtr, allocaXEvent, nextEvent, get_Window, get_EventType, pending, sync)
import Graphics.X11.Xlib.Extras (ClassHint(..), getEvent, ev_event_type, ev_width, ev_height, ev_keycode, ev_data, ev_x, ev_y, getWindowAttributes, wa_width, wa_height)
-import Graphics.X11.Xlib.Misc (keycodeToKeysym, setWMProtocols)
+import Graphics.X11.Xlib.Misc (keycodeToKeysym, setWMProtocols, createPixmap, createPixmapCursor, defineCursor)
import Graphics.X11.Xlib.Types
import Graphics.X11.Xlib.Window (destroyWindow, mapWindow, storeName)
@@ -78,12 +79,19 @@ instance Driver GLX where
setClassHint disp wnd (ClassHint "HTanks" "htanks")
setWMProtocols disp wnd [delwnd]
+ color <- queryColor disp cmap $ Graphics.X11.Xlib.Types.Color (whitePixel disp $ fromIntegral . viScreen $ visualinfo) 0 0 0 0
+ pixmap <- createPixmap disp wnd 1 1 1
+ cursor <- createPixmapCursor disp pixmap pixmap color color 0 0
+ sync disp False
+
storeName disp wnd "HTanks"
mapWindow disp wnd
waitForMapNotify disp wnd
+ defineCursor disp wnd cursor
+
ctx <- with visualinfo $ \vi -> createContext disp vi (Context nullPtr) True
makeCurrent disp wnd ctx