8 people like it.

Missile Command script (WPF)

WPF version of Missile Command. Run as a script in Visual Studio or create a new application project, reference the assemblies listed at the top of the script and paste the code over Program.fs and hit F5.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
204: 
205: 
206: 
207: 
208: 
209: 
210: 
211: 
212: 
213: 
214: 
215: 
216: 
217: 
218: 
219: 
220: 
221: 
222: 
223: 
224: 
225: 
226: 
227: 
228: 
229: 
230: 
231: 
232: 
233: 
234: 
235: 
236: 
237: 
238: 
239: 
240: 
241: 
242: 
243: 
244: 
245: 
246: 
247: 
248: 
249: 
250: 
251: 
252: 
253: 
254: 
255: 
256: 
257: 
#if INTERACTIVE
#r "PresentationCore.dll"
#r "PresentationFramework.dll"
#r "System.Xaml.dll"
#r "UIAutomationTypes.dll"
#r "WindowsBase.dll"
#endif

open System
open System.Collections.Generic
open System.Windows
open System.Windows.Controls
open System.Windows.Data
open System.Windows.Input
open System.Windows.Media
open System.Windows.Shapes
open System.Windows.Threading

[<AutoOpen>]
module Resources =
    let rand  = System.Random()
    let toPoints (xys) = 
        let coll = PointCollection()
        xys |> Seq.iter (fun (x,y) -> coll.Add(Point(x,y)))
        coll
    let toGradientStops stops =
        let collection = GradientStopCollection()
        stops
        |> List.map (fun (color,offset) -> GradientStop(Color=color,Offset=offset)) 
        |> List.iter collection.Add
        collection

type Missile (x,y,isBomb) =
    let canvas = Canvas ()
    let downBrush = LinearGradientBrush([Colors.Black,0.0;Colors.White,1.0] |> toGradientStops, 90.0)
    let upBrush = LinearGradientBrush([Colors.White,0.0;Colors.Black,1.0] |> toGradientStops, 90.0)
    let brush = if isBomb then downBrush else upBrush
    let line = Line(X1=x, Y1=y, X2=x, Y2=y, Stroke=brush)
    let endPoint = TranslateTransform()
    let missileBrush = SolidColorBrush(Colors.Red) :> Brush
    let circle = Ellipse(Width=3.0,Height=3.0,Fill=missileBrush,RenderTransform=endPoint)
    do  canvas.Children.Add line |> ignore
        canvas.Children.Add circle |> ignore
    member this.IsBomb = isBomb
    member this.Control = canvas
    member this.Update(x,y) =
        line.X2 <- x
        line.Y2 <- y
        endPoint.X <- x - 1.5
        endPoint.Y <- y - 1.5
    static member Path (x1,y1,x2,y2,velocity) = seq {
        let x, y = ref x1, ref y1
        let dx,dy = x2 - x1, y2 - y1
        let angle = atan2 dx dy
        let length = sqrt(dx * dx + dy * dy)
        let steps = length/velocity
        for i = 1 to int steps do
            y := !y + cos(angle)*velocity
            x := !x + sin(angle)*velocity
            yield !x , !y
        }

type Explosion (x,y) =
    let bombBrush = RadialGradientBrush(Colors.Yellow,Colors.White) :> Brush
    let explosion = Ellipse(Opacity=0.5, Fill=bombBrush)
    member this.Control = explosion
    member this.Update r =
        explosion.RenderTransform <- 
            TranslateTransform(X = x - r, Y = y - r)
        explosion.Width <- r * 2.0
        explosion.Height <- r * 2.0 
    static member Path radius = seq {
        for i in [50..2..100] do
            yield radius * ((float i / 100.0) ** 3.0)
        for i in [100..-1..0] do
            yield radius * ((float i / 100.0) ** 3.0)
        }

type City (x,y,width,height) =
    let canvas = Canvas ()
    let fill ws hs brush =
        let mutable i = 0
        do while i < width do
            let w = Seq.nth (Seq.length ws |> rand.Next) ws 
            let h = Seq.nth (Seq.length hs |> rand.Next) hs 
            Rectangle(Width=float w,Height=float h, Fill=brush,
                RenderTransform=TranslateTransform(X=x+float i,Y=y+float (height-h)))
            |> canvas.Children.Add |> ignore
            i <- i + w
    do  SolidColorBrush Colors.Blue |> fill [2..4] [height/2..height] 
    do  SolidColorBrush Colors.Cyan |> fill [1..3] [height/4..height*2/3] 
    member this.Control = canvas
    member this.IsHit (x',y') =
        x' >= x && x' < x + float width &&
        y' >= y && y' < y + float height

type GameControl () as this =
    inherit UserControl ()

    let mutable disposables = []
    let remember disposable = disposables <- disposable :: disposables
    let dispose (d:IDisposable) = d.Dispose()
    let forget () = disposables |> List.iter dispose; disposables <- []

    let width, height = 500.0, 500.0
    do  this.Width <- width; this.Height <- height
    let skyBrush = 
        let darkBlue = Color.FromArgb(255uy,0uy,0uy,40uy)
        let stops = [Colors.Black,0.0; darkBlue,1.0] |> toGradientStops
        LinearGradientBrush(stops, 90.0)
    let canvas = Canvas(Background=skyBrush, Cursor=Cursors.Cross)
    let add (x:#UIElement) = canvas.Children.Add x |> ignore
    let remove (x:#UIElement) = canvas.Children.Remove x |> ignore

    let sandBrush = SolidColorBrush(Colors.Yellow)
    let planet = Rectangle(Width=width, Height=20.0, Fill=sandBrush)
    do  planet.RenderTransform <- TranslateTransform(X=0.0,Y=height-20.0)
    do  add planet
    let platform = System.Windows.Shapes.Polygon(Fill=sandBrush)
    do  platform.Points <- 
            let center = width/2.0
            [center,height-40.0;center-40.0,height;center+40.0,height]
            |> toPoints
    do  add platform

    let mutable score = 0
    let mutable cities = []
    let mutable missiles = []
    let mutable explosions = []
    let mutable wave = 5

    let scoreControl = TextBlock(Foreground=SolidColorBrush Colors.White)
    do  scoreControl.Text <- sprintf "SCORE %d" score
    do  add scoreControl

    do  cities <- [1..4] |> List.map (fun i -> City((width*(float i)/5.0)-25.0,height-33.3,40,15))
        cities |> List.iter (fun city -> add city.Control)

    let fireMissile (x1,y1,x2,y2,velocity,isBomb) =       
        let missile = Missile(x1,y1,isBomb)
        let path = Missile.Path(x1,y1,x2,y2,velocity)
        missiles <- ((x2,y2),missile,path.GetEnumerator()) :: missiles
        add missile.Control

    let startExplosion (x,y) = 
        let explosion = Explosion(x,y) 
        let path = Explosion.Path 50.0
        explosions <- ((x,y),explosion,path.GetEnumerator()) :: explosions
        explosion.Control |> add

    let dropBombs count =
        for i = 1 to count do 
        let x1, x2 = rand.NextDouble()*width, rand.NextDouble()*width
        fireMissile(x1,0.0,x2,height-20.0,1.0,true)

    let update () =
        let current, expired = 
            explosions |> List.partition (fun (_,_,path) -> path.MoveNext())
        explosions <- current
        expired |> List.iter (fun (_,explosion:Explosion,_) -> remove explosion.Control)
        current |> List.iter (fun (_,explosion,path) -> path.Current |> explosion.Update)

        let current, expired = missiles |> List.partition (fun (_,_,path) -> path.MoveNext())
        expired |> List.iter (fun (target,missile:Missile,path) -> 
            remove missile.Control
            startExplosion target
        )
        current |> List.iter (fun (_,missile:Missile,path) -> path.Current |> missile.Update)
        let hit,notHit,casualties = 
            current 
            |> List.fold  (fun (hit,notHit,casualties) missile ->
                let _,_, path = missile
                let x,y = path.Current
                let isHit = 
                    explosions |> List.exists (fun ((x',y'),_,path) ->
                        let r = path.Current
                        (x - x') ** 2.0 + (y - y') ** 2.0 < (r**2.0) 
                    )
                let casualty = cities |> List.tryFind (fun city -> city.IsHit(x,y))
            
                let casualties = 
                    match casualty with
                    | Some city -> city::casualties
                    | None -> casualties

                match isHit || Option.isSome casualty with
                | true -> (missile::hit,notHit,casualties)
                | false -> (hit,missile::notHit,casualties)          
            ) ([],[],[])
        hit |> List.iter (fun (_,missile,path) ->
            let x,y = path.Current
            startExplosion(x,y)
            remove missile.Control
        )
        missiles <- notHit
        score <- score + 10 * (hit |> List.filter (fun (_,missile,_) -> missile.IsBomb) |> List.length)
        casualties |> List.iter (fun city -> remove city.Control)
        cities <- cities |> List.filter (fun city -> casualties |> List.exists ((=) city) |> not)
        scoreControl.Text <- sprintf "SCORE %d" score

        if missiles.Length = 0 then
            wave <- wave + 1
            dropBombs wave

        cities.Length > 0

    let message s =
        let t = TextBlock(Text=s)
        t.HorizontalAlignment <- HorizontalAlignment.Center
        t.VerticalAlignment <- VerticalAlignment.Center
        t.Foreground <- SolidColorBrush Colors.White
        t

    let layout = Grid()

    let startGame () =
        dropBombs wave

        canvas.MouseLeftButtonDown
        |> Observable.subscribe (fun me ->
            let point = me.GetPosition(canvas)
            fireMissile(width/2.0,height-40.0,point.X,point.Y,2.0,false)
        )
        |> remember

        let timer = DispatcherTimer()
        timer.Interval <- TimeSpan.FromMilliseconds(20.0)
        timer.Tick
        |> Observable.subscribe (fun _ -> 
            let undecided = update ()
            if not undecided then
                message "The End" |> layout.Children.Add |> ignore
                forget()
        )
        |> remember
        timer.Start()
        {new IDisposable with member this.Dispose() = timer.Stop()}
        |> remember
    
    do  layout.Children.Add canvas |> ignore
        this.Content <- layout
    
    do  let t = message "Click to Start"
        layout.Children.Add t |> ignore
        this.MouseLeftButtonUp
        |> Observable.subscribe (fun _ -> 
            forget ();
            layout.Children.Remove t |> ignore
            startGame() )
        |> remember

    interface System.IDisposable with
        member this.Dispose() = forget()

[<STAThread>]
do  let win = Window(Content=new GameControl(), Width=512., Height=540.)
    (new Application()).Run(win) |> ignore
namespace System
namespace System.Collections
namespace System.Collections.Generic
namespace System.Windows
namespace System.Windows.Controls
namespace System.Windows.Data
namespace System.Windows.Input
namespace System.Windows.Media
namespace System.Windows.Shapes
namespace System.Windows.Threading
Multiple items
type AutoOpenAttribute =
  inherit Attribute
  new : unit -> AutoOpenAttribute
  new : path:string -> AutoOpenAttribute
  member Path : string

Full name: Microsoft.FSharp.Core.AutoOpenAttribute

--------------------
new : unit -> AutoOpenAttribute
new : path:string -> AutoOpenAttribute
Multiple items
namespace System.Windows.Resources

--------------------
namespace System.Resources
val rand : Random

Full name: Script.Resources.rand
Multiple items
type Random =
  new : unit -> Random + 1 overload
  member Next : unit -> int + 2 overloads
  member NextBytes : buffer:byte[] -> unit
  member NextDouble : unit -> float

Full name: System.Random

--------------------
Random() : unit
Random(Seed: int) : unit
val toPoints : xys:seq<float * float> -> PointCollection

Full name: Script.Resources.toPoints
val xys : seq<float * float>
val coll : PointCollection
Multiple items
type PointCollection =
  inherit Freezable
  new : unit -> PointCollection + 2 overloads
  member Add : value:Point -> unit
  member Clear : unit -> unit
  member Clone : unit -> PointCollection
  member CloneCurrentValue : unit -> PointCollection
  member Contains : value:Point -> bool
  member CopyTo : array:Point[] * index:int -> unit
  member Count : int
  member GetEnumerator : unit -> Enumerator
  member IndexOf : value:Point -> int
  ...
  nested type Enumerator

Full name: System.Windows.Media.PointCollection

--------------------
PointCollection() : unit
PointCollection(capacity: int) : unit
PointCollection(collection: IEnumerable<Point>) : unit
module Seq

from Microsoft.FSharp.Collections
val iter : action:('T -> unit) -> source:seq<'T> -> unit

Full name: Microsoft.FSharp.Collections.Seq.iter
val x : float
val y : float
PointCollection.Add(value: Point) : unit
Multiple items
type Point =
  struct
    new : x:float * y:float -> Point
    member Equals : o:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member Offset : offsetX:float * offsetY:float -> unit
    member ToString : unit -> string + 1 overload
    member X : float with get, set
    member Y : float with get, set
    static member Add : point:Point * vector:Vector -> Point
    static member Equals : point1:Point * point2:Point -> bool
    static member Multiply : point:Point * matrix:Matrix -> Point
    ...
  end

Full name: System.Windows.Point

--------------------
Point()
Point(x: float, y: float) : unit
val toGradientStops : stops:(Color * float) list -> GradientStopCollection

Full name: Script.Resources.toGradientStops
val stops : (Color * float) list
val collection : GradientStopCollection
Multiple items
type GradientStopCollection =
  inherit Animatable
  new : unit -> GradientStopCollection + 2 overloads
  member Add : value:GradientStop -> unit
  member Clear : unit -> unit
  member Clone : unit -> GradientStopCollection
  member CloneCurrentValue : unit -> GradientStopCollection
  member Contains : value:GradientStop -> bool
  member CopyTo : array:GradientStop[] * index:int -> unit
  member Count : int
  member GetEnumerator : unit -> Enumerator
  member IndexOf : value:GradientStop -> int
  ...
  nested type Enumerator

Full name: System.Windows.Media.GradientStopCollection

--------------------
GradientStopCollection() : unit
GradientStopCollection(capacity: int) : unit
GradientStopCollection(collection: IEnumerable<GradientStop>) : unit
Multiple items
type List<'T> =
  new : unit -> List<'T> + 2 overloads
  member Add : item:'T -> unit
  member AddRange : collection:IEnumerable<'T> -> unit
  member AsReadOnly : unit -> ReadOnlyCollection<'T>
  member BinarySearch : item:'T -> int + 2 overloads
  member Capacity : int with get, set
  member Clear : unit -> unit
  member Contains : item:'T -> bool
  member ConvertAll<'TOutput> : converter:Converter<'T, 'TOutput> -> List<'TOutput>
  member CopyTo : array:'T[] -> unit + 2 overloads
  ...
  nested type Enumerator

Full name: System.Collections.Generic.List<_>

--------------------
List() : unit
List(capacity: int) : unit
List(collection: IEnumerable<'T>) : unit
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
val color : Color
val offset : float
Multiple items
type GradientStop =
  inherit Animatable
  new : unit -> GradientStop + 1 overload
  member Clone : unit -> GradientStop
  member CloneCurrentValue : unit -> GradientStop
  member Color : Color with get, set
  member Offset : float with get, set
  member ToString : unit -> string + 1 overload
  static val ColorProperty : DependencyProperty
  static val OffsetProperty : DependencyProperty

Full name: System.Windows.Media.GradientStop

--------------------
GradientStop() : unit
GradientStop(color: Color, offset: float) : unit
type Color =
  struct
    member A : byte with get, set
    member B : byte with get, set
    member Clamp : unit -> unit
    member ColorContext : ColorContext
    member Equals : color:Color -> bool + 1 overload
    member G : byte with get, set
    member GetHashCode : unit -> int
    member GetNativeColorValues : unit -> float32[]
    member R : byte with get, set
    member ScA : float32 with get, set
    ...
  end

Full name: System.Windows.Media.Color
val iter : action:('T -> unit) -> list:'T list -> unit

Full name: Microsoft.FSharp.Collections.List.iter
GradientStopCollection.Add(value: GradientStop) : unit
Multiple items
type Missile =
  new : x:float * y:float * isBomb:bool -> Missile
  member Update : x:float * y:float -> unit
  member Control : Canvas
  member IsBomb : bool
  static member Path : x1:float * y1:float * x2:float * y2:float * velocity:float -> seq<float * float>

Full name: Script.Missile

--------------------
new : x:float * y:float * isBomb:bool -> Missile
val isBomb : bool
val canvas : Canvas
Multiple items
type Canvas =
  inherit Panel
  new : unit -> Canvas
  static val LeftProperty : DependencyProperty
  static val TopProperty : DependencyProperty
  static val RightProperty : DependencyProperty
  static val BottomProperty : DependencyProperty
  static member GetBottom : element:UIElement -> float
  static member GetLeft : element:UIElement -> float
  static member GetRight : element:UIElement -> float
  static member GetTop : element:UIElement -> float
  static member SetBottom : element:UIElement * length:float -> unit
  ...

Full name: System.Windows.Controls.Canvas

--------------------
Canvas() : unit
val downBrush : LinearGradientBrush
Multiple items
type LinearGradientBrush =
  inherit GradientBrush
  new : unit -> LinearGradientBrush + 5 overloads
  member Clone : unit -> LinearGradientBrush
  member CloneCurrentValue : unit -> LinearGradientBrush
  member EndPoint : Point with get, set
  member StartPoint : Point with get, set
  static val StartPointProperty : DependencyProperty
  static val EndPointProperty : DependencyProperty

Full name: System.Windows.Media.LinearGradientBrush

--------------------
LinearGradientBrush() : unit
LinearGradientBrush(gradientStopCollection: GradientStopCollection) : unit
LinearGradientBrush(gradientStopCollection: GradientStopCollection, angle: float) : unit
LinearGradientBrush(startColor: Color, endColor: Color, angle: float) : unit
LinearGradientBrush(gradientStopCollection: GradientStopCollection, startPoint: Point, endPoint: Point) : unit
LinearGradientBrush(startColor: Color, endColor: Color, startPoint: Point, endPoint: Point) : unit
type Colors =
  static member AliceBlue : Color
  static member AntiqueWhite : Color
  static member Aqua : Color
  static member Aquamarine : Color
  static member Azure : Color
  static member Beige : Color
  static member Bisque : Color
  static member Black : Color
  static member BlanchedAlmond : Color
  static member Blue : Color
  ...

Full name: System.Windows.Media.Colors
property Colors.Black: Color
property Colors.White: Color
val upBrush : LinearGradientBrush
val brush : LinearGradientBrush
val line : Line
Multiple items
type Line =
  inherit Shape
  new : unit -> Line
  member X1 : float with get, set
  member X2 : float with get, set
  member Y1 : float with get, set
  member Y2 : float with get, set
  static val X1Property : DependencyProperty
  static val Y1Property : DependencyProperty
  static val X2Property : DependencyProperty
  static val Y2Property : DependencyProperty

Full name: System.Windows.Shapes.Line

--------------------
Line() : unit
val endPoint : TranslateTransform
Multiple items
type TranslateTransform =
  inherit Transform
  new : unit -> TranslateTransform + 1 overload
  member Clone : unit -> TranslateTransform
  member CloneCurrentValue : unit -> TranslateTransform
  member Value : Matrix
  member X : float with get, set
  member Y : float with get, set
  static val XProperty : DependencyProperty
  static val YProperty : DependencyProperty

Full name: System.Windows.Media.TranslateTransform

--------------------
TranslateTransform() : unit
TranslateTransform(offsetX: float, offsetY: float) : unit
val missileBrush : Brush
Multiple items
type SolidColorBrush =
  inherit Brush
  new : unit -> SolidColorBrush + 1 overload
  member Clone : unit -> SolidColorBrush
  member CloneCurrentValue : unit -> SolidColorBrush
  member Color : Color with get, set
  static val ColorProperty : DependencyProperty
  static member DeserializeFrom : reader:BinaryReader -> obj

Full name: System.Windows.Media.SolidColorBrush

--------------------
SolidColorBrush() : unit
SolidColorBrush(color: Color) : unit
property Colors.Red: Color
type Brush =
  inherit Animatable
  member Clone : unit -> Brush
  member CloneCurrentValue : unit -> Brush
  member Opacity : float with get, set
  member RelativeTransform : Transform with get, set
  member ToString : unit -> string + 1 overload
  member Transform : Transform with get, set
  static val OpacityProperty : DependencyProperty
  static val TransformProperty : DependencyProperty
  static val RelativeTransformProperty : DependencyProperty

Full name: System.Windows.Media.Brush
val circle : Ellipse
Multiple items
type Ellipse =
  inherit Shape
  new : unit -> Ellipse
  member GeometryTransform : Transform
  member RenderedGeometry : Geometry

Full name: System.Windows.Shapes.Ellipse

--------------------
Ellipse() : unit
property Panel.Children: UIElementCollection
UIElementCollection.Add(element: UIElement) : int
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
val this : Missile
member Missile.IsBomb : bool

Full name: Script.Missile.IsBomb
Multiple items
member Missile.Control : Canvas

Full name: Script.Missile.Control

--------------------
type Control =
  inherit FrameworkElement
  new : unit -> Control
  member Background : Brush with get, set
  member BorderBrush : Brush with get, set
  member BorderThickness : Thickness with get, set
  member FontFamily : FontFamily with get, set
  member FontSize : float with get, set
  member FontStretch : FontStretch with get, set
  member FontStyle : FontStyle with get, set
  member FontWeight : FontWeight with get, set
  member Foreground : Brush with get, set
  ...

Full name: System.Windows.Controls.Control

--------------------
Control() : unit
member Missile.Update : x:float * y:float -> unit

Full name: Script.Missile.Update
property Line.X2: float
property Line.Y2: float
property TranslateTransform.X: float
property TranslateTransform.Y: float
Multiple items
static member Missile.Path : x1:float * y1:float * x2:float * y2:float * velocity:float -> seq<float * float>

Full name: Script.Missile.Path

--------------------
type Path =
  inherit Shape
  new : unit -> Path
  member Data : Geometry with get, set
  static val DataProperty : DependencyProperty

Full name: System.Windows.Shapes.Path

--------------------
Path() : unit
val x1 : float
val y1 : float
val x2 : float
val y2 : float
val velocity : float
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
val x : float ref
val y : float ref
Multiple items
val ref : value:'T -> 'T ref

Full name: Microsoft.FSharp.Core.Operators.ref

--------------------
type 'T ref = Ref<'T>

Full name: Microsoft.FSharp.Core.ref<_>
val dx : float
val dy : float
val angle : float
val atan2 : y:'T1 -> x:'T1 -> 'T2 (requires member Atan2)

Full name: Microsoft.FSharp.Core.Operators.atan2
val length : float
val sqrt : value:'T -> 'U (requires member Sqrt)

Full name: Microsoft.FSharp.Core.Operators.sqrt
val steps : float
val i : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
val cos : value:'T -> 'T (requires member Cos)

Full name: Microsoft.FSharp.Core.Operators.cos
val sin : value:'T -> 'T (requires member Sin)

Full name: Microsoft.FSharp.Core.Operators.sin
Multiple items
type Explosion =
  new : x:float * y:float -> Explosion
  member Update : r:float -> unit
  member Control : Ellipse
  static member Path : radius:float -> seq<float>

Full name: Script.Explosion

--------------------
new : x:float * y:float -> Explosion
val bombBrush : Brush
Multiple items
type RadialGradientBrush =
  inherit GradientBrush
  new : unit -> RadialGradientBrush + 2 overloads
  member Center : Point with get, set
  member Clone : unit -> RadialGradientBrush
  member CloneCurrentValue : unit -> RadialGradientBrush
  member GradientOrigin : Point with get, set
  member RadiusX : float with get, set
  member RadiusY : float with get, set
  static val CenterProperty : DependencyProperty
  static val RadiusXProperty : DependencyProperty
  static val RadiusYProperty : DependencyProperty
  ...

Full name: System.Windows.Media.RadialGradientBrush

--------------------
RadialGradientBrush() : unit
RadialGradientBrush(gradientStopCollection: GradientStopCollection) : unit
RadialGradientBrush(startColor: Color, endColor: Color) : unit
property Colors.Yellow: Color
val explosion : Ellipse
val this : Explosion
Multiple items
member Explosion.Control : Ellipse

Full name: Script.Explosion.Control

--------------------
type Control =
  inherit FrameworkElement
  new : unit -> Control
  member Background : Brush with get, set
  member BorderBrush : Brush with get, set
  member BorderThickness : Thickness with get, set
  member FontFamily : FontFamily with get, set
  member FontSize : float with get, set
  member FontStretch : FontStretch with get, set
  member FontStyle : FontStyle with get, set
  member FontWeight : FontWeight with get, set
  member Foreground : Brush with get, set
  ...

Full name: System.Windows.Controls.Control

--------------------
Control() : unit
member Explosion.Update : r:float -> unit

Full name: Script.Explosion.Update
val r : float
property UIElement.RenderTransform: Transform
property FrameworkElement.Width: float
property FrameworkElement.Height: float
Multiple items
static member Explosion.Path : radius:float -> seq<float>

Full name: Script.Explosion.Path

--------------------
type Path =
  inherit Shape
  new : unit -> Path
  member Data : Geometry with get, set
  static val DataProperty : DependencyProperty

Full name: System.Windows.Shapes.Path

--------------------
Path() : unit
val radius : float
Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
Multiple items
type City =
  new : x:float * y:float * width:int * height:int -> City
  member IsHit : x':float * y':float -> bool
  member Control : Canvas

Full name: Script.City

--------------------
new : x:float * y:float * width:int * height:int -> City
val width : int
val height : int
val fill : (seq<int> -> seq<int> -> Brush -> unit)
val ws : seq<int>
val hs : seq<int>
val brush : Brush
val mutable i : int
val w : int
val nth : index:int -> source:seq<'T> -> 'T

Full name: Microsoft.FSharp.Collections.Seq.nth
val length : source:seq<'T> -> int

Full name: Microsoft.FSharp.Collections.Seq.length
Random.Next() : int
Random.Next(maxValue: int) : int
Random.Next(minValue: int, maxValue: int) : int
val h : int
Multiple items
type Rectangle =
  inherit Shape
  new : unit -> Rectangle
  member GeometryTransform : Transform
  member RadiusX : float with get, set
  member RadiusY : float with get, set
  member RenderedGeometry : Geometry
  static val RadiusXProperty : DependencyProperty
  static val RadiusYProperty : DependencyProperty

Full name: System.Windows.Shapes.Rectangle

--------------------
Rectangle() : unit
property Colors.Blue: Color
property Colors.Cyan: Color
val this : City
Multiple items
member City.Control : Canvas

Full name: Script.City.Control

--------------------
type Control =
  inherit FrameworkElement
  new : unit -> Control
  member Background : Brush with get, set
  member BorderBrush : Brush with get, set
  member BorderThickness : Thickness with get, set
  member FontFamily : FontFamily with get, set
  member FontSize : float with get, set
  member FontStretch : FontStretch with get, set
  member FontStyle : FontStyle with get, set
  member FontWeight : FontWeight with get, set
  member Foreground : Brush with get, set
  ...

Full name: System.Windows.Controls.Control

--------------------
Control() : unit
member City.IsHit : x':float * y':float -> bool

Full name: Script.City.IsHit
val x' : float
val y' : float
Multiple items
type GameControl =
  inherit UserControl
  interface IDisposable
  new : unit -> GameControl

Full name: Script.GameControl

--------------------
new : unit -> GameControl
val this : GameControl
Multiple items
type UserControl =
  inherit ContentControl
  new : unit -> UserControl

Full name: System.Windows.Controls.UserControl

--------------------
UserControl() : unit
val mutable disposables : IDisposable list
val remember : (IDisposable -> unit)
val disposable : IDisposable
val dispose : (IDisposable -> unit)
val d : IDisposable
type IDisposable =
  member Dispose : unit -> unit

Full name: System.IDisposable
IDisposable.Dispose() : unit
val forget : (unit -> unit)
val width : float
val height : float
val skyBrush : LinearGradientBrush
val darkBlue : Color
Color.FromArgb(a: byte, r: byte, g: byte, b: byte) : Color
val stops : GradientStopCollection
Multiple items
type Cursor =
  new : cursorFile:string -> Cursor + 1 overload
  member Dispose : unit -> unit
  member ToString : unit -> string

Full name: System.Windows.Input.Cursor

--------------------
Cursor(cursorFile: string) : unit
Cursor(cursorStream: IO.Stream) : unit
type Cursors =
  static member AppStarting : Cursor
  static member Arrow : Cursor
  static member ArrowCD : Cursor
  static member Cross : Cursor
  static member Hand : Cursor
  static member Help : Cursor
  static member IBeam : Cursor
  static member No : Cursor
  static member None : Cursor
  static member Pen : Cursor
  ...

Full name: System.Windows.Input.Cursors
property Cursors.Cross: Cursor
val add : (#UIElement -> unit)
val x : #UIElement
Multiple items
type UIElement =
  inherit Visual
  new : unit -> UIElement
  member AddHandler : routedEvent:RoutedEvent * handler:Delegate -> unit + 1 overload
  member AddToEventRoute : route:EventRoute * e:RoutedEventArgs -> unit
  member AllowDrop : bool with get, set
  member ApplyAnimationClock : dp:DependencyProperty * clock:AnimationClock -> unit + 1 overload
  member AreAnyTouchesCaptured : bool
  member AreAnyTouchesCapturedWithin : bool
  member AreAnyTouchesDirectlyOver : bool
  member AreAnyTouchesOver : bool
  member Arrange : finalRect:Rect -> unit
  ...

Full name: System.Windows.UIElement

--------------------
UIElement() : unit
val remove : (#UIElement -> unit)
UIElementCollection.Remove(element: UIElement) : unit
val sandBrush : SolidColorBrush
val planet : Rectangle
val platform : Polygon
Multiple items
type Polygon =
  inherit Shape
  new : unit -> Polygon
  member FillRule : FillRule with get, set
  member Points : PointCollection with get, set
  static val PointsProperty : DependencyProperty
  static val FillRuleProperty : DependencyProperty

Full name: System.Windows.Shapes.Polygon

--------------------
Polygon() : unit
property Polygon.Points: PointCollection
val center : float
val mutable score : int
val mutable cities : City list
val mutable missiles : ((float * float) * Missile * IEnumerator<float * float>) list
val mutable explosions : ((float * float) * Explosion * IEnumerator<float>) list
val mutable wave : int
val scoreControl : TextBlock
Multiple items
type TextBlock =
  inherit FrameworkElement
  new : unit -> TextBlock + 1 overload
  member Background : Brush with get, set
  member BaselineOffset : float with get, set
  member BreakAfter : LineBreakCondition
  member BreakBefore : LineBreakCondition
  member ContentEnd : TextPointer
  member ContentStart : TextPointer
  member FontFamily : FontFamily with get, set
  member FontSize : float with get, set
  member FontStretch : FontStretch with get, set
  ...

Full name: System.Windows.Controls.TextBlock

--------------------
TextBlock() : unit
TextBlock(inline: Documents.Inline) : unit
property TextBlock.Text: string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val city : City
property City.Control: Canvas
val fireMissile : (float * float * float * float * float * bool -> unit)
val missile : Missile
val path : seq<float * float>
static member Missile.Path : x1:float * y1:float * x2:float * y2:float * velocity:float -> seq<float * float>
IEnumerable.GetEnumerator() : IEnumerator<float * float>
property Missile.Control: Canvas
val startExplosion : (float * float -> unit)
val explosion : Explosion
val path : seq<float>
static member Explosion.Path : radius:float -> seq<float>
IEnumerable.GetEnumerator() : IEnumerator<float>
property Explosion.Control: Ellipse
val dropBombs : (int -> unit)
val count : int
Random.NextDouble() : float
val update : (unit -> bool)
val current : ((float * float) * Explosion * IEnumerator<float>) list
val expired : ((float * float) * Explosion * IEnumerator<float>) list
val partition : predicate:('T -> bool) -> list:'T list -> 'T list * 'T list

Full name: Microsoft.FSharp.Collections.List.partition
val path : IEnumerator<float>
Collections.IEnumerator.MoveNext() : bool
property IEnumerator.Current: float
member Explosion.Update : r:float -> unit
val current : ((float * float) * Missile * IEnumerator<float * float>) list
val expired : ((float * float) * Missile * IEnumerator<float * float>) list
val path : IEnumerator<float * float>
val target : float * float
property IEnumerator.Current: float * float
member Missile.Update : x:float * y:float -> unit
val hit : ((float * float) * Missile * IEnumerator<float * float>) list
val notHit : ((float * float) * Missile * IEnumerator<float * float>) list
val casualties : City list
val fold : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State

Full name: Microsoft.FSharp.Collections.List.fold
val missile : (float * float) * Missile * IEnumerator<float * float>
val isHit : bool
val exists : predicate:('T -> bool) -> list:'T list -> bool

Full name: Microsoft.FSharp.Collections.List.exists
val casualty : City option
val tryFind : predicate:('T -> bool) -> list:'T list -> 'T option

Full name: Microsoft.FSharp.Collections.List.tryFind
member City.IsHit : x':float * y':float -> bool
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
module Option

from Microsoft.FSharp.Core
val isSome : option:'T option -> bool

Full name: Microsoft.FSharp.Core.Option.isSome
val filter : predicate:('T -> bool) -> list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.filter
property Missile.IsBomb: bool
val length : list:'T list -> int

Full name: Microsoft.FSharp.Collections.List.length
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
property List.Length: int
val message : (string -> TextBlock)
val s : string
val t : TextBlock
namespace System.Text
property FrameworkElement.HorizontalAlignment: HorizontalAlignment
type HorizontalAlignment =
  | Left = 0
  | Center = 1
  | Right = 2
  | Stretch = 3

Full name: System.Windows.HorizontalAlignment
field HorizontalAlignment.Center = 1
property FrameworkElement.VerticalAlignment: VerticalAlignment
type VerticalAlignment =
  | Top = 0
  | Center = 1
  | Bottom = 2
  | Stretch = 3

Full name: System.Windows.VerticalAlignment
field VerticalAlignment.Center = 1
property TextBlock.Foreground: Brush
val layout : Grid
Multiple items
type Grid =
  inherit Panel
  new : unit -> Grid
  member ColumnDefinitions : ColumnDefinitionCollection
  member RowDefinitions : RowDefinitionCollection
  member ShouldSerializeColumnDefinitions : unit -> bool
  member ShouldSerializeRowDefinitions : unit -> bool
  member ShowGridLines : bool with get, set
  static val ShowGridLinesProperty : DependencyProperty
  static val ColumnProperty : DependencyProperty
  static val RowProperty : DependencyProperty
  static val ColumnSpanProperty : DependencyProperty
  ...

Full name: System.Windows.Controls.Grid

--------------------
Grid() : unit
val startGame : (unit -> unit)
event UIElement.MouseLeftButtonDown: IEvent<MouseButtonEventHandler,MouseButtonEventArgs>
module Observable

from Microsoft.FSharp.Control
val subscribe : callback:('T -> unit) -> source:IObservable<'T> -> IDisposable

Full name: Microsoft.FSharp.Control.Observable.subscribe
val me : MouseButtonEventArgs
val point : Point
MouseEventArgs.GetPosition(relativeTo: IInputElement) : Point
property Point.X: float
property Point.Y: float
val timer : DispatcherTimer
Multiple items
type DispatcherTimer =
  new : unit -> DispatcherTimer + 3 overloads
  member Dispatcher : Dispatcher
  member Interval : TimeSpan with get, set
  member IsEnabled : bool with get, set
  member Start : unit -> unit
  member Stop : unit -> unit
  member Tag : obj with get, set
  event Tick : EventHandler

Full name: System.Windows.Threading.DispatcherTimer

--------------------
DispatcherTimer() : unit
DispatcherTimer(priority: DispatcherPriority) : unit
DispatcherTimer(priority: DispatcherPriority, dispatcher: Dispatcher) : unit
DispatcherTimer(interval: TimeSpan, priority: DispatcherPriority, callback: EventHandler, dispatcher: Dispatcher) : unit
property DispatcherTimer.Interval: TimeSpan
Multiple items
type TimeSpan =
  struct
    new : ticks:int64 -> TimeSpan + 3 overloads
    member Add : ts:TimeSpan -> TimeSpan
    member CompareTo : value:obj -> int + 1 overload
    member Days : int
    member Duration : unit -> TimeSpan
    member Equals : value:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member Hours : int
    member Milliseconds : int
    member Minutes : int
    ...
  end

Full name: System.TimeSpan

--------------------
TimeSpan()
TimeSpan(ticks: int64) : unit
TimeSpan(hours: int, minutes: int, seconds: int) : unit
TimeSpan(days: int, hours: int, minutes: int, seconds: int) : unit
TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int) : unit
TimeSpan.FromMilliseconds(value: float) : TimeSpan
event DispatcherTimer.Tick: IEvent<EventHandler,EventArgs>
val undecided : bool
DispatcherTimer.Start() : unit
val this : IDisposable
DispatcherTimer.Stop() : unit
property ContentControl.Content: obj
event UIElement.MouseLeftButtonUp: IEvent<MouseButtonEventHandler,MouseButtonEventArgs>
override GameControl.Dispose : unit -> unit

Full name: Script.GameControl.Dispose
Multiple items
type STAThreadAttribute =
  inherit Attribute
  new : unit -> STAThreadAttribute

Full name: System.STAThreadAttribute

--------------------
STAThreadAttribute() : unit
val win : Window
Multiple items
type Window =
  inherit ContentControl
  new : unit -> Window
  member Activate : unit -> bool
  member AllowsTransparency : bool with get, set
  member Close : unit -> unit
  member DialogResult : Nullable<bool> with get, set
  member DragMove : unit -> unit
  member Hide : unit -> unit
  member Icon : ImageSource with get, set
  member IsActive : bool
  member Left : float with get, set
  ...

Full name: System.Windows.Window

--------------------
Window() : unit
Multiple items
type Application =
  inherit DispatcherObject
  new : unit -> Application
  member FindResource : resourceKey:obj -> obj
  member MainWindow : Window with get, set
  member Properties : IDictionary
  member Resources : ResourceDictionary with get, set
  member Run : unit -> int + 1 overload
  member Shutdown : unit -> unit + 1 overload
  member ShutdownMode : ShutdownMode with get, set
  member StartupUri : Uri with get, set
  member TryFindResource : resourceKey:obj -> obj
  ...

Full name: System.Windows.Application

--------------------
Application() : unit
Raw view Test code New version

More information

Link:http://fssnip.net/jR
Posted:11 years ago
Author:Phillip Trelford
Tags: game