Skip to content

Commit

Permalink
#194 Game Two converted except MoveGraphics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Oct 5, 2022
1 parent 93ce06a commit 1b1b1b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Tiling/ExsSrc/gTwo/GTwoGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ case class GTwoGui(canv: CanvasPlatform, scenStart: TwoScen, viewIn: SqGridView)
/** This makes the tiles active. They respond to mouse clicks. It does not paint or draw the tiles. */
def actives: Arr[PolygonActive] = proj.tileActives

def lunits: Arr[PolygonCompound] = players.scSomesMap{ (sc, pl) =>
def lunits: Arr[PolygonCompound] = players.projSomeScPtMap { (pl, sc, pt) =>
val str = ptScale.scaledStr(170, pl.toString + "\n" + sc.strComma, 150, pl.charStr + "\n" + sc.strComma, 60, pl.charStr)
Rect(1.2, 0.8, sc.toPt2Reg).fillDrawTextActive(pl.colour, SPlayer(pl, sc), str, 24, 2.0) }
Rect(80, 60, pt).fillDrawTextActive(pl.colour, SPlayer(pl, sc), str, 24, 2.0) }

/** Not sure why this is called css. */
def css: Arr[TextGraphic] = players.projNoneScPtMap((sc, pt) => pt.textAt(sc.rcStr, 20))
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).slate(-focus).scale(cPScale) +% sidesDraw ++ css ++ moveGraphics2
def frame: GraphicElems = actives ++ lunits +% sidesDraw ++ css ++ moveGraphics2

proj.getFrame = () => frame
proj.setStatusText = { str =>
Expand Down
10 changes: 5 additions & 5 deletions Tiling/src/prid/psq/SqCenOptLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class SqCenOptLayer[A <: AnyRef](val unsafeArr: Array[A]) extends AnyVal with TC

/** Drops the None values mapping the [[Some]]'s value with the [[SqCen]] to an option value, collecting the values of the [[Some]]s returned by the
* function. Returns a [[Seqimut]] of length 0 to the length of this [[SqCenOptLayer]]. */
def projSomeScMap[B, ArrB <: SeqImut[B]](f: (A, SqCen) => B)(implicit proj: SqSysProjection, build: ArrBuilder[B, ArrB]): ArrB =
projSomeScMap(proj)(f)(build)
def projSomeScPtMap[B, ArrB <: SeqImut[B]](f: (A, SqCen, Pt2) => B)(implicit proj: SqSysProjection, build: ArrBuilder[B, ArrB]): ArrB =
projSomeScPtMap(proj)(f)(build)

def projSomeScMap[B, ArrB <: SeqImut[B]](proj: SqSysProjection)(f: (A, SqCen) => B)(implicit build: ArrBuilder[B, ArrB]): ArrB = {
val buff = build.newBuff()
def projSomeScPtMap[B, ArrB <: SeqImut[B]](proj: SqSysProjection)(f: (A, SqCen, Pt2) => B)(implicit build: ArrBuilder[B, ArrB]): ArrB =
{ val buff = build.newBuff()
proj.gChild.foreach { sc =>
val a: A = unsafeArr(proj.gridSys.arrIndex(sc))
if (a != null) {
build.buffGrow(buff, f(a, sc))
build.buffGrow(buff, f(a, sc, proj.transCoord(sc)))
}
}
build.buffToBB(buff)
Expand Down

0 comments on commit 1b1b1b8

Please sign in to comment.