Skip to content

Commit

Permalink
#194.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Oct 4, 2022
1 parent 09d2ccf commit 7903509
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Tiling/ExsSrc/gOne/GOneGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext
}

/** [[TextGraphic]]s to display the [[HCen]] coordinate in the tiles that have no unit counters. */
def hexStrs: Arr[TextGraphic] = players.projNoneHCPtMap{ (hc, pt) => TextGraphic(hc.strComma, 20, pt) }
def hexStrs: Arr[TextGraphic] = players.projNoneHcPtMap{ (hc, pt) => TextGraphic(hc.strComma, 20, pt) }

/** This makes the tiles active. They respond to mouse clicks. It does not paint or draw the tiles. */
val actives: Arr[PolygonActive] = proj.tileActives
Expand Down
2 changes: 1 addition & 1 deletion Tiling/ExsSrc/gThree/GThreeGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ case class GThreeGui(canv: CanvasPlatform, scenStart: ThreeScen, viewIn: HGView)
}

/** [[TextGraphic]]s to display the [[HCen]] coordinate in the tiles that have no unit counters. */
def hexStrs: Arr[TextGraphic] = players.projNoneHCPtMap{ (hc, pt) => TextGraphic(hc.strComma, 20, pt) }
def hexStrs: Arr[TextGraphic] = players.projNoneHcPtMap{ (hc, pt) => TextGraphic(hc.strComma, 20, pt) }

/** This makes the tiles active. They respond to mouse clicks. It does not paint or draw the tiles. */
def tiles: Arr[PolygonActive] = proj.tileActives
Expand Down
4 changes: 2 additions & 2 deletions Tiling/ExsSrc/gTwo/GTwoGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ case class GTwoGui(canv: CanvasPlatform, scenStart: TwoScen, viewIn: SqGridView)
Rect(1.2, 0.8, sc.toPt2Reg).fillDrawTextActive(p.colour, SPlayer(p, sc), str, 24, 2.0) }

/** Not sure why this is called css. */
def css: Arr[TextGraphic] = players.scNoneMap(hc => TextGraphic(hc.rcStr, 20, hc.toPt2Reg))
def css = players.projNoneScMap(sc => TextGraphic(sc.rcStr, 20, sc.toPt2Reg))

/** This is the planned moves or orders for the next turn. Note this is just a record of the planned moves it is not graphical display of
* those moves. This data is state for the Gui. */
Expand Down Expand Up @@ -67,7 +67,7 @@ case class GTwoGui(canv: CanvasPlatform, scenStart: TwoScen, viewIn: SqGridView)
thisTop()
def moveGraphics2: GraphicElems = moveGraphics.slate(-focus).scale(cPScale).flatMap(_.arrow)

def frame: GraphicElems = actives ++ (lunits +% sidesDraw ++ css).slate(-focus).scale(cPScale) ++ moveGraphics2
def frame: GraphicElems = actives ++ (lunits ++ css).slate(-focus).scale(cPScale) +% sidesDraw ++ moveGraphics2

proj.getFrame = () => frame
proj.setStatusText = { str =>
Expand Down
6 changes: 3 additions & 3 deletions Tiling/src/prid/phex/HCenOptLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ class HCenOptLayer[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TCe
build.buffToBB(buff)
}

def projNoneHCPtMap[B, ArrB <: SeqImut[B]](f: (HCen, Pt2) => B)(implicit proj: HSysProjection, build: ArrBuilder[B, ArrB]): ArrB =
projNoneHCPtMap(proj)(f)
def projNoneHcPtMap[B, ArrB <: SeqImut[B]](f: (HCen, Pt2) => B)(implicit proj: HSysProjection, build: ArrBuilder[B, ArrB]): ArrB =
projNoneHcPtMap(proj)(f)

def projNoneHCPtMap[B, ArrB <: SeqImut[B]](proj: HSysProjection)(f: (HCen, Pt2) => B)(implicit build: ArrBuilder[B, ArrB]): ArrB = {
def projNoneHcPtMap[B, ArrB <: SeqImut[B]](proj: HSysProjection)(f: (HCen, Pt2) => B)(implicit build: ArrBuilder[B, ArrB]): ArrB = {
val buff = build.newBuff()

proj.gChild.foreach { hc =>
Expand Down
20 changes: 12 additions & 8 deletions Tiling/src/prid/psq/SqCenOptLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class SqCenOptLayer[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TC

def projSomeSqCMap[B, ArrB <: SeqImut[B]](proj: SqSysProjection)(f: (A, SqCen) => B)(implicit build: ArrBuilder[B, ArrB]): ArrB = {
val buff = build.newBuff()
proj.gChild.foreach { hc =>
val a: A = unsafeArr(proj.gridSys.arrIndex(hc))
proj.gChild.foreach { sc =>
val a: A = unsafeArr(proj.gridSys.arrIndex(sc))
if (a != null) {
build.buffGrow(buff, f(a, hc))
build.buffGrow(buff, f(a, sc))
}
}
build.buffToBB(buff)
Expand All @@ -89,17 +89,21 @@ class SqCenOptLayer[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TC

/** Coordinate map Nones. Map the None values respective [[SqCen]] coordinates of this [[SqCenOptLayer]] to type B, the first type parameter. Returns
* an immutable Array based collection of type ArrT, the second type parameter. */
/*def projNoneScMap[B, ArrT <: SeqImut[B]](proj: SqSysProjection)(f: SqCen => B): GraphicElems = {
val buff = BuffGraphic()// build.newBuff()
def projNoneScMap(f: SqCen => GraphicElem)(implicit proj: SqSysProjection): GraphicElems = projNoneScMap(proj)(f)

/** Coordinate map Nones. Map the None values respective [[SqCen]] coordinates of this [[SqCenOptLayer]] to type B, the first type parameter. Returns
* an immutable Array based collection of type ArrT, the second type parameter. */
def projNoneScMap(proj: SqSysProjection)(f: SqCen => GraphicElem): GraphicElems =
{ val buff = BuffGraphic()
proj.foreach { r =>
val a: A = unsafeArr(gridSys.arrIndex(r))
val a: A = unsafeArr(proj.gridSys.arrIndex(r))
if (a == null) {
val newVal = f(r)
build.buffGrow(buff, newVal)
buff.append(newVal)
}
}
buff.toArr
}*/
}

/** Moves the object in the array location given by HCen1 to HCen2, by setting H2 to the value of h1 and setting H1 to null. */
def mutMove(s1: SqCen, s2: SqCen)(implicit gridSys: SqGridSys): Unit =
Expand Down

0 comments on commit 7903509

Please sign in to comment.