Skip to content

Commit

Permalink
#206 Created EGridBaseGui.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Mar 20, 2023
1 parent a001baf commit 2dcaa38
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Dev/srcStrat/dless/DLessGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
package ostrat; package dless
import geom._, prid._, phex._, pgui._, egrid._

case class DLessGui(canv: CanvasPlatform, scenIn: DLessScen, viewIn: HGView, isFlat: Boolean = false) extends HGridSysGui("Diceless Gui")
case class DLessGui(canv: CanvasPlatform, scenIn: DLessScen, viewIn: HGView, isFlat: Boolean = false) extends EGridBaseGui("Diceless Gui")
{ var scen: DLessScen = scenIn
override implicit val gridSys: HGridSys = scenIn.gridSys
override implicit val gridSys: EGridSys = scenIn.gridSys
val terrs: HCenLayer[WTile] = scen.terrs
val sTerrs: HSideLayer[WSide] = scen.sTerrs
val corners = scen.corners
Expand Down Expand Up @@ -81,7 +81,7 @@ case class DLessGui(canv: CanvasPlatform, scenIn: DLessScen, viewIn: HGView, isF
/** This is the graphical display of the planned move orders. */
def moveGraphics: GraphicElems = moveSegPairs.pairFlatMap { (seg, pl) => seg.draw(pl.colour).arrow }

tileFills ++ islands ++ tileActives ++ straits ++ lines2 ++ hexStrs2 ++ units ++ moveGraphics
tileBackFills ++ tileFills ++ islands ++ tileActives ++ straits ++ lines2 ++ hexStrs2 ++ units ++ moveGraphics
}

/** Creates the turn button and the action to commit on mouse click. */
Expand Down
3 changes: 2 additions & 1 deletion Dev/srcStrat/dless/DLessScen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import prid._, phex._, eg320._, pEarth._, egrid._
trait DLessScen extends HSysTurnScen
{ ThisScen =>
def title: String = "DLessScen"
override implicit val gridSys: EGridSys
val terrs: HCenLayer[WTile]
val sTerrs: HSideLayer[WSide]
val corners: HCornerLayer
Expand All @@ -23,7 +24,7 @@ trait DLessScen extends HSysTurnScen
targets.foreach { (hc2, buff) => buff.foreachLen1(stCenStep => if (armies.tileNone(hc2)) armiesNew.moveMut(stCenStep.startHC, hc2)) }

new DLessScen
{ override implicit def gridSys: HGridSys = ThisScen.gridSys
{ override implicit val gridSys: EGridSys = ThisScen.gridSys
override val terrs: HCenLayer[WTile] = ThisScen.terrs
override val sTerrs: HSideLayer[WSide] = ThisScen.sTerrs
override val corners: HCornerLayer = ThisScen.corners
Expand Down
21 changes: 21 additions & 0 deletions EGrid/src/egrid/EGridBaseGui.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2018-23 Richard Oliver. Licensed under Apache Licence version 2.0. */
package ostrat; package egrid
import geom._, pglobe._, prid._, phex._, egrid._

abstract class EGridBaseGui(title: String) extends HGridSysGui(title)
{ implicit val gridSys: HGridSys
def terrs: HCenLayer[WTile]
def sTerrs: HSideLayer[WSide]
def corners: HCornerLayer
implicit val proj: HSysProjection

def tileBackFills: GraphicElems = terrs.hcOptMap { (tile, hc) =>
tile match
{ case li: Coastal =>
{ val res = hc.hVertPolygon.toPolygon(proj.transCoord).fill(li.sideTerrs.colour)
Some(res)
}
case _ => None
}
}
}

0 comments on commit 2dcaa38

Please sign in to comment.