README

mizchi/terrain/types does not have a README file

#
Edge

pub(all) struct Edge {
from : Int
to : Int
}

impl Show for Edge

#
GraphNode

pub(all) struct GraphNode {
id : Int
kind : NodeKind
children : Array[Int]
}

impl Show for GraphNode

#
Grid2D

pub(all) struct Grid2D {
width : Int
height : Int
cells : Array[Tile]
}

#
Grid2D::carve_l_corridor

fn Grid2D::carve_l_corridor(self : Grid2D, from : Point, to : Point, tile : Tile) -> Unit

#
Grid2D::carve_line

fn Grid2D::carve_line(self : Grid2D, from : Point, to : Point, tile : Tile) -> Unit

#
Grid2D::clone

fn Grid2D::clone(self : Grid2D) -> Grid2D

#
Grid2D::count_neighbors

fn Grid2D::count_neighbors(self : Grid2D, x : Int, y : Int, tile : Tile) -> Int

#
Grid2D::fill_rect

fn Grid2D::fill_rect(self : Grid2D, rect : Rect, tile : Tile) -> Unit

#
Grid2D::get

fn Grid2D::get(self : Grid2D, x : Int, y : Int) -> Tile

#
Grid2D::in_bounds

fn Grid2D::in_bounds(self : Grid2D, x : Int, y : Int) -> Bool

#
Grid2D::make

fn Grid2D::make(width : Int, height : Int, fill : Tile) -> Grid2D

#
Grid2D::neighbors4

fn Grid2D::neighbors4(self : Grid2D, x : Int, y : Int) -> Array[Point]

#
Grid2D::set

fn Grid2D::set(self : Grid2D, x : Int, y : Int, tile : Tile) -> Unit

#
Grid2D::to_ascii

fn Grid2D::to_ascii(self : Grid2D) -> String

#
Grid3D

pub(all) struct Grid3D {
width : Int
height : Int
depth : Int
layers : Array[Grid2D]
}
Grid3D — 多層グリッド

#
Grid3D::get

fn Grid3D::get(self : Grid3D, x : Int, y : Int, z : Int) -> Tile

#
Grid3D::get_layer

fn Grid3D::get_layer(self : Grid3D, z : Int) -> Grid2D

#
Grid3D::make

fn Grid3D::make(width : Int, height : Int, depth : Int, fill : Tile) -> Grid3D

#
Grid3D::neighbors6

fn Grid3D::neighbors6(self : Grid3D, x : Int, y : Int, z : Int) -> Array[(Int, Int, Int)]
6方向隣接: 上下左右 + 上層/下層

#
Grid3D::set

fn Grid3D::set(self : Grid3D, x : Int, y : Int, z : Int, tile : Tile) -> Unit

#
Grid3D::to_ascii

fn Grid3D::to_ascii(self : Grid3D, layer_idx : Int) -> String

#
GridMetrics

pub(all) struct GridMetrics {
open_ratio : Double
room_count : Int
connectivity : Bool
largest_component : Int
dead_end_count : Int
}

impl Show for GridMetrics

#
HeightGrid

pub(all) struct HeightGrid {
width : Int
height : Int
cells : Array[Tile]
heights : Array[Int]
max_height : Int
}
HeightGrid — 高さ付き2Dグリッド(クォータービュー用)

#
HeightGrid::get

fn HeightGrid::get(self : HeightGrid, x : Int, y : Int) -> Tile

#
HeightGrid::get_height

fn HeightGrid::get_height(self : HeightGrid, x : Int, y : Int) -> Int

#
HeightGrid::in_bounds

fn HeightGrid::in_bounds(self : HeightGrid, x : Int, y : Int) -> Bool

#
HeightGrid::make

fn HeightGrid::make(width : Int, height : Int, fill : Tile, max_height : Int) -> HeightGrid

#
HeightGrid::set

fn HeightGrid::set(self : HeightGrid, x : Int, y : Int, tile : Tile) -> Unit

#
HeightGrid::set_height

fn HeightGrid::set_height(self : HeightGrid, x : Int, y : Int, h : Int) -> Unit

#
HeightGrid::to_ascii

fn HeightGrid::to_ascii(self : HeightGrid) -> String

#
HeightGrid::to_grid2d

fn HeightGrid::to_grid2d(self : HeightGrid) -> Grid2D
HeightGridをGrid2Dに変換(高さ情報は失われる)

#
HexGrid

pub(all) struct HexGrid {
cols : Int
rows : Int
cells : Array[Tile]
orientation : Int
}
HexGrid — odd-r offset座標の六角グリッド

#
HexGrid::get

fn HexGrid::get(self : HexGrid, col : Int, row : Int) -> Tile

#
HexGrid::in_bounds

fn HexGrid::in_bounds(self : HexGrid, col : Int, row : Int) -> Bool

#
HexGrid::make

fn HexGrid::make(cols : Int, rows : Int, fill : Tile, orientation? : Int) -> HexGrid

#
HexGrid::neighbors6

fn HexGrid::neighbors6(self : HexGrid, col : Int, row : Int) -> Array[(Int, Int)]
odd-r offset座標での6方向隣接セル

#
HexGrid::set

fn HexGrid::set(self : HexGrid, col : Int, row : Int, tile : Tile) -> Unit

#
HexGrid::to_ascii

fn HexGrid::to_ascii(self : HexGrid) -> String

#
HexGrid::to_grid2d

fn HexGrid::to_grid2d(self : HexGrid, hex_size : Int) -> Grid2D
HexGridをGrid2Dに変換(各hexセルをhex_size四方のタイルとして展開)

#
NodeKind

pub(all) enum NodeKind {
StartNode
GoalNode
RoomNode
KeyNode
LockNode
}

impl Eq for NodeKind
impl Show for NodeKind

#
Point

pub(all) struct Point {
x : Int
y : Int
}

impl Compare for Point
impl Eq for Point
impl Show for Point

#
RNG

pub(all) struct RNG {
state : UInt
}

#
RNG::next

fn RNG::next(self : RNG) -> UInt

#
RNG::next_int

fn RNG::next_int(self : RNG, max : Int) -> Int

#
RNG::rand_bool

fn RNG::rand_bool(self : RNG, probability : Double) -> Bool

#
RNG::rand_direction

fn RNG::rand_direction(self : RNG) -> Point

#
RNG::rand_pick

fn[T] RNG::rand_pick(self : RNG, arr : Array[T]) -> T

#
RNG::rand_range

fn RNG::rand_range(self : RNG, min : Int, max : Int) -> Int

#
RNG::rand_shuffle

fn[T] RNG::rand_shuffle(self : RNG, arr : Array[T]) -> Unit

#
Rect

pub(all) struct Rect {
x : Int
y : Int
w : Int
h : Int
}

impl Eq for Rect
impl Show for Rect

#
Rect::center

fn Rect::center(self : Rect) -> Point

#
Rect::contains

fn Rect::contains(self : Rect, p : Point) -> Bool

#
Rect::intersects

fn Rect::intersects(self : Rect, other : Rect) -> Bool

#
Room

pub(all) struct Room {
rect : Rect
id : Int
}

impl Show for Room

#
Tile

pub(all) enum Tile {
Floor
Wall
Door
LockedDoor
Key
Start
Goal
Corridor
Water
Empty
}

impl Eq for Tile
impl Show for Tile

#
Tile::to_char

fn Tile::to_char(self : Tile) -> Char

#
compute_metrics

fn compute_metrics(grid : Grid2D, room_count : Int) -> GridMetrics

#
flood_fill

fn flood_fill(grid : Grid2D, start_x : Int, start_y : Int) -> Array[Point]

#
make_rng

fn make_rng(seed : UInt) -> RNG