]> git.jsancho.org Git - gacela.git/blobdiff - src/video.scm
Running gacela functions inside game loop thread for avoiding GL problems with threads
[gacela.git] / src / video.scm
index e183f13330f05713125651b2063ea9ff83fabf39..18d51852ef0c105b77da2ab68ecb7e44c6b751af 100644 (file)
 (define flags 0)
 
 (define* (init-video width height bpp #:key (mode '2d) (title "") (fps 20))
-  (cond ((not screen)
-        (SDL_Init SDL_INIT_VIDEO)
-        (let ((info (SDL_GetVideoInfo)))
-          (SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER 1)
-          (set! flags (+ SDL_OPENGL SDL_GL_DOUBLEBUFFER SDL_HWPALETTE SDL_RESIZABLE
-                         (if (= (assoc-ref info 'hw_available) 0) SDL_SWSURFACE SDL_HWSURFACE)
-                         (if (= (assoc-ref info 'blit_hw) 0) 0 SDL_HWACCEL)))
-          (set! screen (SDL_SetVideoMode width height bpp flags))
-          (set-screen-title! title)
-          (set-frames-per-second! fps)
-          (init-gl)
-          (if (eq? mode '3d) (set-3d-mode) (set-2d-mode))))))
+  (SDL_Init SDL_INIT_VIDEO)
+  (let ((info (SDL_GetVideoInfo)))
+    (SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER 1)
+    (set! flags (+ SDL_OPENGL SDL_GL_DOUBLEBUFFER SDL_HWPALETTE SDL_RESIZABLE
+                  (if (= (assoc-ref info 'hw_available) 0) SDL_SWSURFACE SDL_HWSURFACE)
+                  (if (= (assoc-ref info 'blit_hw) 0) 0 SDL_HWACCEL)))
+    (set! screen (SDL_SetVideoMode width height bpp flags))
+    (set-screen-title! title)
+    (set-frames-per-second! fps)
+    (init-gl)
+    (if (eq? mode '3d) (set-3d-mode) (set-2d-mode))))
 
 (define (get-screen-height)
   (surface-h screen))