Commits

Anonymous committed 58ce880

better pictures

Comments (0)

Files changed (4)

Added
New image
Add a comment to this file

data/memory/background.jpg

Added
New image
Add a comment to this file

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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.