Commits

ptrelford committed d491198

In-Browser Silverlight prompts user to click to start

  • Participants
  • Parent commits 261fe62

Comments (0)

Files changed (2)

PacMan.Xaml/App.fs

             member this.IsRight = pressed right
         }
     let game = Game(scene, input)
-    do  control.Loaded.Subscribe(fun _ ->
-        run control (1.0/50.0) game.Update |> ignore
-        ) |> ignore
+    let start _ = run control (1.0/50.0) game.Update |> ignore
+#if SILVERLIGHT
+    do  if Application.Current.IsRunningOutOfBrowser then start()
+        else
+            let prompt = scene.CreateText("Click To Start")
+            prompt.Move(6.0*8.0, 15.0*8.0)
+            scene.Contents.Add(prompt)
+            async { 
+                do! control.MouseLeftButtonDown |> Async.AwaitEvent |> Async.Ignore
+                scene.Contents.Remove(prompt)
+                start ()
+            } |> Async.StartImmediate
+#else
+    do  control.Loaded.Subscribe start |> ignore 
+#endif
     override control.MeasureOverride(size) =
         let mutable scale = 1.0
         while (width * scale) < size.Width && 

PacMan.Xaml/PacMan.fs

 
     let ghost_starts = 
         [
-            "red", (16, 12), (1,0)
+            "red", (16, 16), (1,0)
             "cyan", (14, 16), (1,0)
             "pink" , (16, 14), (0,-1)
             "orange" , (18, 16), (-1,0)