Commits

Anonymous committed 58ce880

better pictures

Comments (0)

Files changed (4)

data/memory/back.png

Added
New image

data/memory/background.jpg

Added
New image

data/memory/background.png

Removed
Old image
   
   let imgsize = 115
   
+  let back = ref None
+  let background = ref None
   let images = Array.make 12 None
-  let background = ref None
   
   let load () =
-    background := Some (load_image "data/memory/background.png");
+    back := Some (load_image "data/memory/back.png");
+    background := Some (load_image "data/memory/background.jpg");
     for i = 0 to (Array.length images -1) do
       images.(i) <- Some (load_image ("data/memory/" ^ string_of_int i ^ ".png"))
     done
   let blit dst dst_rect img = match img with
     | None -> failwith "image not initialized"
     | Some image ->
-        Sdlvideo.blit_surface ~dst_rect: dst_rect ~src: image ~dst: dst ()
+        Sdlvideo.blit_surface ~dst_rect: dst_rect ~src: image ~dst: dst () 
   
   let draw_img screen x y img =
     let open Sdlvideo in
     let fullrect = rect x y imgsize imgsize in
-    blit screen fullrect img;
-    update_rect ~rect: fullrect screen
+    blit screen fullrect img
+    
+  let draw_background screen =
+    draw_img screen 0 0 !background    
 end
 
 let layout = function
   
   let rec play screen cards =
     let show_backgrounds () =
-      let white = Sdlvideo.map_RGB screen Sdlvideo.white in
-      Sdlvideo.fill_rect screen white;
-      List.iter (fun c -> Image.draw_img screen c.x c.y !Image.background) cards;
+      Image.draw_background screen;
+      List.iter (fun c -> Image.draw_img screen c.x c.y !Image.back) cards;
       Sdlvideo.flip screen
     and show_card c =
       Image.draw_img screen c.x c.y Image.images.(c.img);