Skip to content

Commit

Permalink
#194 Outer hex sides now working through projection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Aug 12, 2022
1 parent 2a93d4d commit a03fd51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Tiling/ExsSrc/gOne/GOneGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext
def players: HCenOptDGrid[Player] = scen.oPlayers
cPScale = viewIn.pxScale
focus = viewIn.vec
val proj = gridSys.projection(mainPanel)
proj.setView(viewIn)

/** There are no moves set. The Gui is reset to this state at the start of every turn. */
def NoMoves: HCenOptDGrid[HDirn] = gridSys.newHCenOptDGrid[HDirn]
Expand Down Expand Up @@ -41,7 +43,8 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext
def innerSidesDraw: LinesDraw = gridSys.innerSidesDraw()

/** Draws the tiles sides (or edges). */
def outerSidesDraw: LinesDraw = gridSys.outerSidesDraw(Colour.Gold)
def outerSidesDraw: LinesDraw = proj.outerSidesDraw(2, Colour.Gold)
//gridSys.outerSidesDraw(Colour.Gold).slate(-focus).scale(cPScale)

/** This is the graphical display of the planned move orders. */
def moveGraphics: Arr[LineSegDraw] = moves.hcSomesMap { (hc, step) =>
Expand Down Expand Up @@ -78,6 +81,6 @@ case class GOneGui(canv: CanvasPlatform, scenStart: OneScen, viewIn: HGView) ext
thisTop()

def moveGraphics2: GraphicElems = moveGraphics.slate(-focus).scale(cPScale).flatMap(_.arrow)
def frame: GraphicElems = (tiles +% outerSidesDraw +% innerSidesDraw ++ units ++ hexStrs).slate(-focus).scale(cPScale) ++ moveGraphics2
def frame: GraphicElems = (tiles +% innerSidesDraw ++ units ++ hexStrs).slate(-focus).scale(cPScale) +% outerSidesDraw ++ moveGraphics2
repaint()
}
9 changes: 9 additions & 0 deletions Tiling/src/prid/phex/HProjectionFlat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ final case class HProjectionFlat(gridSys: HGridSys, panel: Panel) extends HSysPr
override def innerSides: LineSegArr = gridSys.innerSideLines.slate(-focus).scale(cPScale)
override def outerSides: LineSegArr = gridSys.outerSideLines.slate(-focus).scale(cPScale)

override def setView(view: Any): Unit = view match
{
case hv: HGView => {
cPScale = hv.pxScale
focus = hv.vec
}
case d: Double => cPScale = d
case _ =>
}

def frame: GraphicElems = ???
def zoomIn: PolygonCompound = clickButton("+") { _ =>
Expand Down
1 change: 1 addition & 0 deletions Tiling/src/prid/phex/HSysProjection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ trait HSysProjection
def innerSidesDraw(lineWidth: Double = 2, colour: Colour = Colour.Black): LinesDraw = innerSides.draw(lineWidth, colour)
def outerSidesDraw(lineWidth: Double = 2, colour: Colour = Colour.Black): LinesDraw = outerSides.draw(lineWidth, colour)
def panel: Panel
def setView(view: Any): Unit = {}
}

0 comments on commit a03fd51

Please sign in to comment.