From 1b1b1b8d6f63a795e0053bdd897ad2155f8f7bf1 Mon Sep 17 00:00:00 2001 From: Rich2 Date: Wed, 5 Oct 2022 18:00:24 +0100 Subject: [PATCH] #194 Game Two converted except MoveGraphics. --- Tiling/ExsSrc/gTwo/GTwoGui.scala | 6 +++--- Tiling/src/prid/psq/SqCenOptLayer.scala | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tiling/ExsSrc/gTwo/GTwoGui.scala b/Tiling/ExsSrc/gTwo/GTwoGui.scala index 1c308d724..65552863c 100644 --- a/Tiling/ExsSrc/gTwo/GTwoGui.scala +++ b/Tiling/ExsSrc/gTwo/GTwoGui.scala @@ -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)) @@ -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 => diff --git a/Tiling/src/prid/psq/SqCenOptLayer.scala b/Tiling/src/prid/psq/SqCenOptLayer.scala index 2a0d69a8d..214f7d3d0 100644 --- a/Tiling/src/prid/psq/SqCenOptLayer.scala +++ b/Tiling/src/prid/psq/SqCenOptLayer.scala @@ -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)