Skip to content

Commit

Permalink
Fixed #25: All top level types have headline docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Nov 14, 2023
1 parent 2563825 commit e4f38fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import indigo.*
import indigo.shared.datatypes.RGBA
import io.indigoengine.roguelike.starterkit.Tile

/** Represents the three basic properties of a tile: Character, foreground colour, and background
* colour.
*/
final case class MapTile(char: Tile, foreground: RGBA, background: RGBA):
def withChar(newChar: Tile): MapTile =
this.copy(char = newChar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import io.indigoengine.roguelike.starterkit.Tile

import scala.annotation.tailrec

/** Represents the output of converting a Terminal into clones ready for rendering. You must add the
* clones to you scene and register the clone blanks.
*/
final case class TerminalClones(blanks: Batch[CloneBlank], clones: Batch[CloneTiles]):
def |+|(other: TerminalClones): TerminalClones =
combine(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import indigo.*

import scala.annotation.tailrec

/** Helper methods for working out a players field of view. */
object FOV:

/** An implementation of the Bresenham Line algorithm, which plots clean lines across grids. Used
* by drawing tools and in this case, for lines of sight.
*/
@SuppressWarnings(Array("scalafix:DisableSyntax.var"))
def bresenhamLine(from: Point, to: Point): Batch[Point] =
val x0: Int = from.x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import indigo.shared.dice.Dice

import scala.annotation.tailrec

/** A simple path finding implementation for a grid. */
final case class PathFinder(size: Size, grid: Batch[GridSquare]):

def contains(coords: Point): Boolean =
Expand All @@ -25,6 +26,7 @@ final case class PathFinder(size: Size, grid: Batch[GridSquare]):
this.copy(grid = PathFinder.scoreGridSquares(start: Point, end: Point, this, scoreAmount))
)

/** A simple path finding implementation for a grid. */
object PathFinder:

def sampleAt(searchGrid: PathFinder, coords: Point, gridWidth: Int): Batch[GridSquare] =
Expand Down Expand Up @@ -143,6 +145,7 @@ object PathFinder:
)
}

/** A GridSquare represents a position on the gird in the PathFinder implementation. */
enum GridSquare(val score: Int):
val index: Int
val coords: Point
Expand All @@ -155,6 +158,7 @@ enum GridSquare(val score: Int):
case gs: Walkable => gs.copy(weight = newScore)
case gs: Blocked => gs

/** A GridSquare represents a position on the gird in the PathFinder implementation. */
object GridSquare:
val Max: Int = Int.MaxValue

Expand Down

0 comments on commit e4f38fc

Please sign in to comment.