Skip to content

Commit

Permalink
CharSheet contains character crop data
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Oct 29, 2023
1 parent b7e3baa commit 10937c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion paint/src/main/scala/roguepaint/PaintGame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ object PaintGame extends IndigoGame[Size, Size, Model, ViewModel]:
.withMagnification(1),
Config.config.viewport.size
)
.withFonts(RoguelikeTiles.Size10x10.Fonts.fontInfo)
.withAssets(Assets.assets.assetSet)
.withShaders(
TerminalText.standardShader,
Expand Down
6 changes: 4 additions & 2 deletions paint/src/main/scala/roguepaint/PaintScene.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ object PaintModel:
private val defaultCharSheet: CharSheet =
CharSheet(
Assets.assets.AnikkiSquare10x10,
Size(10)
Size(10),
RoguelikeTiles.Size10x10.charCrops
)
private val screenSize: Size = Size(1280, 720) / 10

Expand Down Expand Up @@ -155,7 +156,8 @@ object PaintModel:
None,
CharSheet(
Assets.assets.AnikkiSquare10x10,
Size(10)
Size(10),
RoguelikeTiles.Size10x10.charCrops
)
)

Expand Down
8 changes: 6 additions & 2 deletions paint/src/main/scala/roguepaint/components/Window.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object Window:
val clones =
vm.terminal.toCloneTiles(
tempModel.bounds.position * charSize,
RoguelikeTiles.Size10x10.charCrops
model.charSheet.charCrops
) { case (fg, bg) =>
graphic10x10.withMaterial(TerminalText(model.charSheet.assetName, fg, bg))
}
Expand Down Expand Up @@ -488,5 +488,9 @@ object DragData:
val zero: DragData =
DragData(Point.zero, Point.zero)

final case class CharSheet(assetName: AssetName, size: Size):
final case class CharSheet(
assetName: AssetName,
size: Size,
charCrops: Batch[(Int, Int, Int, Int)]
):
val charSize: Int = size.width
2 changes: 1 addition & 1 deletion paint/src/main/scala/roguepaint/windows/CanvasWindow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ object CanvasWindow {

val clones = model.terminal.toCloneTiles(
context.bounds.position / magnification,
RoguelikeTiles.Size10x10.charCrops
context.data.charSheet.charCrops
) { case (fg, bg) =>
graphic.withMaterial(TerminalText(context.data.charSheet.assetName, fg, bg))
}
Expand Down

0 comments on commit 10937c8

Please sign in to comment.