Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. F# and IEnumerable

F# and IEnumerable

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorial
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matty22
    wrote on last edited by
    #1

    I can't for the life of me work out how to implement this in f# protected override IEnumerable GetShapeDefinition() { // Yield out a Box2D shape definition PolygonDef def = new PolygonDef(); def.VertexCount = 3; def.Vertices[0] = new Vector2(0f, 6f); def.Vertices[1] = new Vector2(-2f, -3f); def.Vertices[2] = new Vector2(2f, -3f); def.Restitution = 0f; def.Friction = 1f; def.Density = 1f; yield return def; } The closest I've come is this override x.GetShapeDefinition = seq{ let def = new PolygonDef() def.VertexCount <- 3 def.Vertices.(0) <- new Vector2(1.0f, 2.0f) def.Vertices.(1) <- new Vector2(-2.0f,-3.0f) def.Vertices.(2) <- new Vector2(2.0f,-3.0f) def.Restitution <- 0.0f def.Friction <- 1.0f def.Density <- 1.0f yield (def :> ShapeDef) } But I get No abstract property was found that corresponds to this override. (FS0191) - C:\Users\Matthew\Documents\SharpDevelop Projects\FSharpGame\FSharpGame\Ship.fs:20,14

    M 1 Reply Last reply
    0
    • M Matty22

      I can't for the life of me work out how to implement this in f# protected override IEnumerable GetShapeDefinition() { // Yield out a Box2D shape definition PolygonDef def = new PolygonDef(); def.VertexCount = 3; def.Vertices[0] = new Vector2(0f, 6f); def.Vertices[1] = new Vector2(-2f, -3f); def.Vertices[2] = new Vector2(2f, -3f); def.Restitution = 0f; def.Friction = 1f; def.Density = 1f; yield return def; } The closest I've come is this override x.GetShapeDefinition = seq{ let def = new PolygonDef() def.VertexCount <- 3 def.Vertices.(0) <- new Vector2(1.0f, 2.0f) def.Vertices.(1) <- new Vector2(-2.0f,-3.0f) def.Vertices.(2) <- new Vector2(2.0f,-3.0f) def.Restitution <- 0.0f def.Friction <- 1.0f def.Density <- 1.0f yield (def :> ShapeDef) } But I get No abstract property was found that corresponds to this override. (FS0191) - C:\Users\Matthew\Documents\SharpDevelop Projects\FSharpGame\FSharpGame\Ship.fs:20,14

      M Offline
      M Offline
      Matty22
      wrote on last edited by
      #2

      Got it to work; override this.GetShapeDefinition() = seq{ let def = new PolygonDef() def.VertexCount <- 3 def.Vertices.[0] <- new Vector2(1.0f, 2.0f) def.Vertices.[1] <- new Vector2(-2.0f,-3.0f) def.Vertices.[2] <- new Vector2(2.0f,-3.0f) def.Restitution <- 0.0f def.Friction <- 1.0f def.Density <- 1.0f yield (def :> ShapeDef) }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups