The gamebox-grids Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The gamebox-grids Reference Manual

This is the gamebox-grids Reference Manual, version 1.0.0, generated automatically by Declt version 2.3 "Robert April" on Tue Jan 09 14:39:03 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

gamebox-grids

Create and manipulate tiles in a two-dimensional grid layout.

Overview

This library allows you to represent cells of a grid, and perform operations on them which are common to game development. Currently 4 different square grids and 8 different hexagonal grids are supported. With them, you can perform such queries as calculating the distance between any two given cells, listing all neighboring cells, and more.

Install

(ql:quickload :gamebox-grids)

Usage

To make use of this library, the first thing you'll need is to create a grid specification. To do so you can use the GRID function, giving it a grid type, and optional arguments to control how the grid behaves.

Some examples of a grid with square cells:

;; A grid of square cells, supporting 4 directions of movement, orthogonally.
(grid 'quad4)

;; A grid of square cells, supporting 8 directions of movement, both
;; orthogonally and diagonally.
(grid 'quad8)

;; You can specify the width and height of the grid in cells. This will create
;; a 20x20 grid.
(grid 'quad8 :size (vec2 20 20))

;; You can also specify the size in pixels of the cells. This is useful for
;; converting a cell to screen coordinates, and vice versa.
(grid 'quad4 :cell-size (vec2 32 32))

;; Even rectangular sizes are supported.
(grid 'quad8 :cell-size (vec2 12 4))

;; By default the Y axis is incremented downward. This means the grid origin
;; cell (0,0) is at the top left. We can change the Y axis to be up as such.
(grid 'quad4 :cell-size (vec2 16 16) :y-axis :up)

Hexagonal grids are also supported, with 8 different layouts. It's best to explain the different layouts with a diagram:

Hexagon Grid Diagram

In the above image, the 8 different hexagonal grid layouts can be seen. On the left side, are 4 column-based layouts, and on the right side are 4 row-based layouts. For each of these, there is a staggering or offset which is applied to even or odd columns or rows. When stagger is odd, odd-numbered columns and rows are offset down and right, respectively. When stagger is even, even-numbered columns and rows are offset down and right, respectively. Finally, there is the Y-axis, which specifies how cell coordinates are assigned.

Some examples of hexagonal grids:

(grid 'hex-rows :offset :even :y-axis :down)
(grid 'hex-rows :offset :odd :y-axis :down
(grid 'hex-rows :offset :even :y-axis :up))
(grid 'hex-rows :offset :odd :y-axis :up)
(grid 'hex-cols :offset :even :y-axis :down)
(grid 'hex-cols :offset :odd :y-axis :down
(grid 'hex-cols :offset :even :y-axis :up))
(grid 'hex-cols :offset :odd :y-axis :up)

Just like a square grid, you can also specify the size of the grid and cells for hexagonal grids.

Once we have a grid, it would be nice to use it. You should first lexically bind it, or store the object returned from the above GRID example somewhere to be accessed later:

(let ((grid (grid 'hex-rows :size (vec2 10 10) :cell-size (vec2 32 32))))

  ;; Test if a cell is a member of the grid. A cell with negative coordinates,
  ;; or coordinates that fall outside the size of the grid will not be a member.
  ;; All others will, as we do not support sparse grids at this time.
  (cell-member-p grid (cell 5 5)) ; => T

  ;; Find the distance from one cell to another.
  (cell-distance grid (cell 0 1) (cell 4 4)) ; => 6

  ;; If you were to drawn a line on the grid from the center of a cell to the
  ;; center of any other cell, this will find all cells that are touching the
  ;; line.
  (cell-select-line grid (cell 1 0) (cell 2 3)) ; => (#(1.0 0.0)
                                                ;     #(2.0 1.0)
                                                ;     #(1.0 2.0)
                                                ;     #(2.0 3.0))

  ;; You can select all cells that surround a cell up to N steps away.
  (cell-select-range grid (cell 3 3) 1) ; => (#(2.0 3.0)
                                        ;     #(2.0 4.0)
                                        ;     #(2.0 2.0)
                                        ;     #(3.0 3.0)
                                        ;     #(3.0 4.0)
                                        ;     #(3.0 2.0)
                                        ;     #(4.0 3.0))

  ;; Find the screen coordinates in pixels of the center of a cell.
  (cell-to-point grid (cell 3 4)) ; => #(166.0 192.0)

  ;; Find the cell located at the given screen coordinates:
  (cell-from-point grid (vec 166 96)) ; => #(3.0 4.0)

  ;; Get a list of direction vectors from the center of a cell to each of its
  ;; corners, keyed by an approximate cardinal direction.
  (cell-corner-directions grid) ; => (:NE #<0.8660254 0.5>
                                ;     :N #<0.0 1.0>
                                ;     :NW #<-0.8660254 0.5>
                                ;     :SW #<-0.8660254 -0.5>
                                ;     :S #<0.0 -1.0>
                                ;     :SE #<0.8660254 -0.5>)

  ;; Get a list of direction vectors from the center of a cell to each of its
  ;; edges, keyed by an approximate cardinal direction.
  (cell-edge-directions grid) ; => (:NE #<0.5 0.8660254>
                              ;     :NW #<-0.5 0.8660254>
                              ;     :W #<-1.0 0.0>
                              ;     :SW #<-0.5 -0.8660254>
                              ;     :SE #<0.5 -0.8660254>
                              ;     :E #<1.0 0.0>)

  ;; Get a list of neighbors, keyed by their approximate cardinal direction from
  ;; a cell.
  (cell-neighbors grid (cell 3 3)) ; => (:E #<4.0 3.0>
                                   ;     :NE #<3.0 2.0>
                                   ;     :NW #<2.0 2.0>
                                   ;     :W #<2.0 3.0>
                                   ;     :SW #<2.0 4.0>
                                   ;     :SE #<3.0 4.0>)

  ;; Check whether or not two cells are neighbors.
  (cell-neighbors-p grid (cell 3 3) (cell 2 3)) ; => T

  ;; Get the neighbor of a cell given an approximate cardinal direction.
  (cell-neighbor grid (cell 3 3) :w) ; => #(2.0 3.0))

License

Copyright © 2015 Michael Fiano michael.fiano@gmail.com.

Licensed under the MIT License.

A copy of the license is available here.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 gamebox-grids

Maintainer

Michael Fiano <michael.fiano@gmail.com>

Author

Michael Fiano <michael.fiano@gmail.com>

Home Page

https://github.com/mfiano/gamebox-grids

Source Control

(:git "git@github.com:mfiano/gamebox-grids.git")

Bug Tracker

https://github.com/mfiano/gamebox-grids/issues

License

MIT

Description

Create and manipulate tiles in a two-dimensional grid layout.

Long Description

# gamebox-grids

Create and manipulate tiles in a two-dimensional grid layout.

## Overview

This library allows you to represent cells of a grid, and perform operations on
them which are common to game development. Currently 4 different square grids
and 8 different hexagonal grids are supported. With them, you can perform such
queries as calculating the distance between any two given cells, listing all
neighboring cells, and more.

## Install

“‘ lisp
(ql:quickload :gamebox-grids)
“‘

## Usage

To make use of this library, the first thing you’ll need is to create a grid
specification. To do so you can use the ‘GRID‘ function, giving it a grid type,
and optional arguments to control how the grid behaves.

Some examples of a grid with square cells:

“‘ lisp
;; A grid of square cells, supporting 4 directions of movement, orthogonally.
(grid ’quad4)

;; A grid of square cells, supporting 8 directions of movement, both
;; orthogonally and diagonally.
(grid ’quad8)

;; You can specify the width and height of the grid in cells. This will create
;; a 20x20 grid.
(grid ’quad8 :size (vec2 20 20))

;; You can also specify the size in pixels of the cells. This is useful for
;; converting a cell to screen coordinates, and vice versa.
(grid ’quad4 :cell-size (vec2 32 32))

;; Even rectangular sizes are supported.
(grid ’quad8 :cell-size (vec2 12 4))

;; By default the Y axis is incremented downward. This means the grid origin
;; cell (0,0) is at the top left. We can change the Y axis to be up as such.
(grid ’quad4 :cell-size (vec2 16 16) :y-axis :up)
“‘

Hexagonal grids are also supported, with 8 different layouts. It’s best to
explain the different layouts with a diagram:

![Hexagon Grid Diagram](https://files.lispcoder.net/images/projects/gamebox-grids/hex-layouts.png)

In the above image, the 8 different hexagonal grid layouts can be seen. On the
left side, are 4 column-based layouts, and on the right side are 4 row-based
layouts. For each of these, there is a staggering or offset which is applied to
even or odd columns or rows. When stagger is odd, odd-numbered columns and rows
are offset down and right, respectively. When stagger is even, even-numbered
columns and rows are offset down and right, respectively. Finally, there is the
Y-axis, which specifies how cell coordinates are assigned.

Some examples of hexagonal grids:

“‘ lisp
(grid ’hex-rows :offset :even :y-axis :down)
(grid ’hex-rows :offset :odd :y-axis :down
(grid ’hex-rows :offset :even :y-axis :up))
(grid ’hex-rows :offset :odd :y-axis :up)
(grid ’hex-cols :offset :even :y-axis :down)
(grid ’hex-cols :offset :odd :y-axis :down
(grid ’hex-cols :offset :even :y-axis :up))
(grid ’hex-cols :offset :odd :y-axis :up)
“‘

Just like a square grid, you can also specify the size of the grid and cells for
hexagonal grids.

Once we have a grid, it would be nice to use it. You should first lexically bind
it, or store the object returned from the above ‘GRID‘ example somewhere to be
accessed later:

“‘ lisp
(let ((grid (grid ’hex-rows :size (vec2 10 10) :cell-size (vec2 32 32))))

;; Test if a cell is a member of the grid. A cell with negative coordinates,
;; or coordinates that fall outside the size of the grid will not be a member.
;; All others will, as we do not support sparse grids at this time.
(cell-member-p grid (cell 5 5)) ; => T

;; Find the distance from one cell to another.
(cell-distance grid (cell 0 1) (cell 4 4)) ; => 6

;; If you were to drawn a line on the grid from the center of a cell to the
;; center of any other cell, this will find all cells that are touching the
;; line.
(cell-select-line grid (cell 1 0) (cell 2 3)) ; => (#(1.0 0.0)
; #(2.0 1.0)
; #(1.0 2.0)
; #(2.0 3.0))

;; You can select all cells that surround a cell up to N steps away.
(cell-select-range grid (cell 3 3) 1) ; => (#(2.0 3.0)
; #(2.0 4.0)
; #(2.0 2.0)
; #(3.0 3.0)
; #(3.0 4.0)
; #(3.0 2.0)
; #(4.0 3.0))

;; Find the screen coordinates in pixels of the center of a cell.
(cell-to-point grid (cell 3 4)) ; => #(166.0 192.0)

;; Find the cell located at the given screen coordinates:
(cell-from-point grid (vec 166 96)) ; => #(3.0 4.0)

;; Get a list of direction vectors from the center of a cell to each of its
;; corners, keyed by an approximate cardinal direction.
(cell-corner-directions grid) ; => (:NE #<0.8660254 0.5>
; :N #<0.0 1.0>
; :NW #<-0.8660254 0.5>
; :SW #<-0.8660254 -0.5>
; :S #<0.0 -1.0>
; :SE #<0.8660254 -0.5>)

;; Get a list of direction vectors from the center of a cell to each of its
;; edges, keyed by an approximate cardinal direction.
(cell-edge-directions grid) ; => (:NE #<0.5 0.8660254>
; :NW #<-0.5 0.8660254>
; :W #<-1.0 0.0>
; :SW #<-0.5 -0.8660254>
; :SE #<0.5 -0.8660254>
; :E #<1.0 0.0>)

;; Get a list of neighbors, keyed by their approximate cardinal direction from
;; a cell.
(cell-neighbors grid (cell 3 3)) ; => (:E #<4.0 3.0>
; :NE #<3.0 2.0>
; :NW #<2.0 2.0>
; :W #<2.0 3.0>
; :SW #<2.0 4.0>
; :SE #<3.0 4.0>)

;; Check whether or not two cells are neighbors.
(cell-neighbors-p grid (cell 3 3) (cell 2 3)) ; => T

;; Get the neighbor of a cell given an approximate cardinal direction.
(cell-neighbor grid (cell 3 3) :w) ; => #(2.0 3.0))
“‘

## License

Copyright © 2015 Michael Fiano <michael.fiano@gmail.com>.

Licensed under the MIT License.

A copy of the license is available [here](LICENSE).

Version

1.0.0

Dependencies
Source

gamebox-grids.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 gamebox-grids.asd

Location

/home/quickbuilder/quicklisp/dists/quicklisp/software/gamebox-grids-20171227-git/gamebox-grids.asd

Systems

gamebox-grids (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 gamebox-grids/package.lisp

Parent

gamebox-grids (system)

Location

package.lisp

Packages

gamebox-grids


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 gamebox-grids/grid.lisp

Dependency

package.lisp (file)

Parent

gamebox-grids (system)

Location

grid.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 gamebox-grids/quad.lisp

Dependency

grid.lisp (file)

Parent

gamebox-grids (system)

Location

quad.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.5 gamebox-grids/hex.lisp

Dependency

quad.lisp (file)

Parent

gamebox-grids (system)

Location

hex.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 gamebox-grids

Source

package.lisp (file)

Nickname

box.grid

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: cell X Y

Define a cell located at the specified coordinates in a grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-corner-directions GRID

Get a property list mapping cardinal directions to direction vectors for each corner of a cell.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-edge-directions GRID

Get a property list mapping cardinal directions to direction vectors for each edge of a cell.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-member-p GRID CELL

Test if a cell is a member of the specified grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-neighbor GRID CELL DIR

Get the neighbor of a cell in the specified cardinal direction.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-neighbors GRID CELL

Get a property list mapping cardinal directions to cell neighbors for a cell.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-neighbors-p GRID CELL1 CELL2

Test if two cells are neighbors in the specified grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: grid GRID-TYPE &rest ARGS

Define a grid specification given a grid type and options.

Package

gamebox-grids

Source

grid.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Generic functions

Generic Function: cell-distance GRID CELL1 CELL2

The distance in cells between two particular cells.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-distance (GRID hex-grid) CELL1 CELL2

The distance in cells between two particular cells.

Source

hex.lisp (file)

Method: cell-distance (GRID quad8) CELL1 CELL2

The distance in cells between two particular cells on an 8-way quad grid.

Source

quad.lisp (file)

Method: cell-distance (GRID quad4) CELL1 CELL2

The distance in cells between two particular cells on an 4-way quad grid.

Source

quad.lisp (file)

Generic Function: cell-from-point GRID POINT

Get a cell at a particular point in screen coordinates.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-from-point (GRID hex-grid) POINT

Get a cell at a particular point in screen coordinates.

Source

hex.lisp (file)

Method: cell-from-point (GRID quad-grid) POINT

Get a cell at a particular point in screen coordinates.

Source

quad.lisp (file)

Generic Function: cell-select-line GRID CELL1 CELL2

Get a list of cells that intersect a line drawn from one cell to another.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-select-line (GRID hex-grid) CELL1 CELL2

Get a list of cells that intersect a line drawn from one cell to another.

Source

hex.lisp (file)

Method: cell-select-line (GRID quad-grid) CELL1 CELL2

Get a list of cells that intersect a line drawn from one cell to another.

Source

quad.lisp (file)

Generic Function: cell-select-range GRID CELL RANGE

Get a list of cells up to a certain range of cells away from a cell.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-select-range (GRID hex-grid) CELL RANGE

Get a list of cells up to a certain range of cells away from a cell.

Source

hex.lisp (file)

Method: cell-select-range (GRID quad-grid) CELL RANGE

Get a list of cells up to a certain range of cells away from a cell.

Source

quad.lisp (file)

Generic Function: cell-to-point GRID CELL

Get a point in screen coordinates of a particular cell.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-to-point (GRID hex-grid) CELL

Get a point in screen coordinates of a particular cell.

Source

hex.lisp (file)

Method: cell-to-point (GRID quad-grid) CELL

Get a point in screen coordinates of a particular cell.

Source

quad.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Classes

Class: hex-cols ()

A column-based hexagon grid definition.

Package

gamebox-grids

Source

hex.lisp (file)

Direct superclasses

hex-grid (class)

Direct methods
Direct slots
Slot: forward
Initform

(gamebox-math:quat (/ 3.0 2.0) 0.0 (/ (sqrt 3) 2) (sqrt 3))

Slot: inverse
Initform

(gamebox-math:quat (/ 2.0 3.0) 0.0 (/ -1.0 3.0) (/ (sqrt 3) 3))

Slot: neighbor-dirs
Initform

(quote (:se :ne :n :nw :sw :s))

Slot: corner-dirs
Initform

(quote (:e :ne :nw :w :sw :se))

Slot: edge-dirs
Initform

(quote (:ne :n :nw :sw :s :se))

Class: hex-rows ()

A row-based hexagon grid definition.

Package

gamebox-grids

Source

hex.lisp (file)

Direct superclasses

hex-grid (class)

Direct methods
Direct slots
Slot: start-angle
Initform

1

Slot: forward
Initform

(gamebox-math:quat (sqrt 3) (/ (sqrt 3) 2) 0.0 (/ 3.0 2.0))

Slot: inverse
Initform

(gamebox-math:quat (/ (sqrt 3) 3) (/ -1.0 3.0) 0.0 (/ 2.0 3.0))

Slot: neighbor-dirs
Initform

(quote (:e :ne :nw :w :sw :se))

Slot: corner-dirs
Initform

(quote (:ne :n :nw :sw :s :se))

Slot: edge-dirs
Initform

(quote (:ne :nw :w :sw :se :e))

Class: quad4 ()

A quad grid definition with 4-way movement.

Package

gamebox-grids

Source

quad.lisp (file)

Direct superclasses

quad-grid (class)

Direct methods
Direct slots
Slot: neighbor-dirs
Initform

(quote (:e :n :w :s))

Slot: corner-dirs
Initform

(quote (:ne :nw :sw :se))

Slot: edge-dirs
Initform

(quote (:e :n :w :s))

Class: quad8 ()

A quad grid definition with 8-way movement.

Package

gamebox-grids

Source

quad.lisp (file)

Direct superclasses

quad-grid (class)

Direct methods
Direct slots
Slot: neighbor-dirs
Initform

(quote (:e :ne :n :nw :w :sw :s :se))

Slot: corner-dirs
Initform

(quote (:ne :nw :sw :se))

Slot: edge-dirs
Initform

(quote (:e :ne :n :nw :w :sw :s :se))


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: cell-corner-count GRID

The number of corners for a cell in the specified grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-direction-count GRID

The number of corners and edges combined for a cell in the specified grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-directions GRID

Get a list of direction vectors pointing from a cell’s origin to each of its corners and edges.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-edge-count GRID

The number of edges for a cell in the specified grid.

Package

gamebox-grids

Source

grid.lisp (file)

Function: cell-nudge CELL

Apply an epsilon to a cell’s coordinates to prevent interpolating on an edge.

Package

gamebox-grids

Source

grid.lisp (file)

Function: grid-offset GRID

Map a grid’s offset keyword specifier to an integer.

Package

gamebox-grids

Source

hex.lisp (file)

Function: hex X Y

Calculate cube coordinates from grid coordinates.

Package

gamebox-grids

Source

hex.lisp (file)

Function: hex-neighbor-offsets ()

A list of cardinal direction vectors representing a hexagon cell’s neighbors.

Package

gamebox-grids

Source

hex.lisp (file)

Function: hex-nudge HEX

Apply an epsilon to a hexagon’s cube coordinates to prevent interpolating on an edge.

Package

gamebox-grids

Source

hex.lisp (file)

Function: hex-round HEX

Round a hexagon’s cube coordinates to the nearest cell.

Package

gamebox-grids

Source

hex.lisp (file)

Function: swap-grid-offset GRID

Change a grid’s offset to even if it is odd, or odd if it is even.

Package

gamebox-grids

Source

hex.lisp (file)

Function: y-axis GRID

Map a grid’s y-axis keyword specifier to an integer.

Package

gamebox-grids

Source

grid.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Generic functions

Generic Function: cell-neighbor-by-index GRID CELL INDEX
Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-neighbor-by-index (GRID hex-grid) CELL INDEX

Low-level function to get a cell’s neighbor given an index.

Source

hex.lisp (file)

Method: cell-neighbor-by-index (GRID quad-grid) CELL INDEX

Low-level function to get a cell’s neighbor given an index.

Source

quad.lisp (file)

Generic Function: cell-neighbor-offsets GRID

A list of cardinal direction vectors representing a cell’s neighbors.

Package

gamebox-grids

Source

grid.lisp (file)

Methods
Method: cell-neighbor-offsets (GRID quad8)

A list of cardinal direction vectors representing a cell’s neighbors.

Source

quad.lisp (file)

Method: cell-neighbor-offsets (GRID quad4)

A list of cardinal direction vectors representing a cell’s neighbors.

Source

quad.lisp (file)

Generic Function: corner-dirs OBJECT
Package

gamebox-grids

Methods
Method: corner-dirs (GRID-SPEC grid-spec)

automatically generated reader method

Source

grid.lisp (file)

Generic Function: edge-dirs OBJECT
Package

gamebox-grids

Methods
Method: edge-dirs (GRID-SPEC grid-spec)

automatically generated reader method

Source

grid.lisp (file)

Generic Function: forward OBJECT
Package

gamebox-grids

Methods
Method: forward (HEX-GRID hex-grid)

automatically generated reader method

Source

hex.lisp (file)

Generic Function: hex-from-cell GRID CELL

Convert a hexagon’s grid coordinates to cube coordinates.

Package

gamebox-grids

Source

hex.lisp (file)

Methods
Method: hex-from-cell (GRID hex-cols) CELL

For column-based hexagon grids, convert a hexagon’s grid coordinates to cube coordinates.

Method: hex-from-cell (GRID hex-rows) CELL

For row-based hexagon grids, convert a hexagon’s grid coordinates to cube coordinates.

Generic Function: hex-to-cell GRID HEX

Convert a hexagon’s cube coordinates to grid coordinates.

Package

gamebox-grids

Source

hex.lisp (file)

Methods
Method: hex-to-cell (GRID hex-cols) HEX

For column-based hexagon grids, convert a hexagon’s cube coordinates to grid coordinates.

Method: hex-to-cell (GRID hex-rows) HEX

For row-based hexagon grids, convert a hexagon’s cube coordinates to grid coordinates.

Generic Function: inverse OBJECT
Package

gamebox-grids

Methods
Method: inverse (HEX-GRID hex-grid)

automatically generated reader method

Source

hex.lisp (file)

Generic Function: neighbor-dirs OBJECT
Package

gamebox-grids

Methods
Method: neighbor-dirs (GRID-SPEC grid-spec)

automatically generated reader method

Source

grid.lisp (file)

Generic Function: size OBJECT
Package

gamebox-grids

Methods
Method: size (GRID-SPEC grid-spec)

automatically generated reader method

Source

grid.lisp (file)

Generic Function: start-angle OBJECT
Package

gamebox-grids

Methods
Method: start-angle (GRID-SPEC grid-spec)

automatically generated reader method

Source

grid.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Classes

Class: grid-spec ()

A generic grid definition.

Package

gamebox-grids

Source

grid.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods
Direct slots
Slot: size
Initargs

:size

Initform

(gamebox-math:vec2 10 10)

Readers

size (generic function)

Slot: y-axis
Initargs

:y-axis

Initform

:down

Slot: cell-size
Initargs

:cell-size

Initform

(gamebox-math:vec2 1 1)

Slot: cell-origin
Initargs

:cell-origin

Initform

(gamebox-math:v2zero)

Slot: start-angle
Initform

0

Readers

start-angle (generic function)

Slot: neighbor-dirs
Readers

neighbor-dirs (generic function)

Slot: edge-dirs
Readers

edge-dirs (generic function)

Slot: corner-dirs
Readers

corner-dirs (generic function)

Class: hex-grid ()

A hexagon grid definition.

Package

gamebox-grids

Source

hex.lisp (file)

Direct superclasses

grid-spec (class)

Direct subclasses
Direct methods
Direct slots
Slot: forward
Readers

forward (generic function)

Slot: inverse
Readers

inverse (generic function)

Slot: offset
Initargs

:offset

Initform

:even

Class: quad-grid ()

A quad grid definition.

Package

gamebox-grids

Source

quad.lisp (file)

Direct superclasses

grid-spec (class)

Direct subclasses
Direct methods
Direct slots
Slot: start-angle
Initform

1


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   G   L  
Index Entry  Section

F
File, Lisp, gamebox-grids.asd: The gamebox-grids<dot>asd file
File, Lisp, gamebox-grids/grid.lisp: The gamebox-grids/grid<dot>lisp file
File, Lisp, gamebox-grids/hex.lisp: The gamebox-grids/hex<dot>lisp file
File, Lisp, gamebox-grids/package.lisp: The gamebox-grids/package<dot>lisp file
File, Lisp, gamebox-grids/quad.lisp: The gamebox-grids/quad<dot>lisp file

G
gamebox-grids.asd: The gamebox-grids<dot>asd file
gamebox-grids/grid.lisp: The gamebox-grids/grid<dot>lisp file
gamebox-grids/hex.lisp: The gamebox-grids/hex<dot>lisp file
gamebox-grids/package.lisp: The gamebox-grids/package<dot>lisp file
gamebox-grids/quad.lisp: The gamebox-grids/quad<dot>lisp file

L
Lisp File, gamebox-grids.asd: The gamebox-grids<dot>asd file
Lisp File, gamebox-grids/grid.lisp: The gamebox-grids/grid<dot>lisp file
Lisp File, gamebox-grids/hex.lisp: The gamebox-grids/hex<dot>lisp file
Lisp File, gamebox-grids/package.lisp: The gamebox-grids/package<dot>lisp file
Lisp File, gamebox-grids/quad.lisp: The gamebox-grids/quad<dot>lisp file

Jump to:   F   G   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   E   F   G   H   I   M   N   S   Y  
Index Entry  Section

C
cell: Exported functions
cell-corner-count: Internal functions
cell-corner-directions: Exported functions
cell-direction-count: Internal functions
cell-directions: Internal functions
cell-distance: Exported generic functions
cell-distance: Exported generic functions
cell-distance: Exported generic functions
cell-distance: Exported generic functions
cell-edge-count: Internal functions
cell-edge-directions: Exported functions
cell-from-point: Exported generic functions
cell-from-point: Exported generic functions
cell-from-point: Exported generic functions
cell-member-p: Exported functions
cell-neighbor: Exported functions
cell-neighbor-by-index: Internal generic functions
cell-neighbor-by-index: Internal generic functions
cell-neighbor-by-index: Internal generic functions
cell-neighbor-offsets: Internal generic functions
cell-neighbor-offsets: Internal generic functions
cell-neighbor-offsets: Internal generic functions
cell-neighbors: Exported functions
cell-neighbors-p: Exported functions
cell-nudge: Internal functions
cell-select-line: Exported generic functions
cell-select-line: Exported generic functions
cell-select-line: Exported generic functions
cell-select-range: Exported generic functions
cell-select-range: Exported generic functions
cell-select-range: Exported generic functions
cell-to-point: Exported generic functions
cell-to-point: Exported generic functions
cell-to-point: Exported generic functions
corner-dirs: Internal generic functions
corner-dirs: Internal generic functions

E
edge-dirs: Internal generic functions
edge-dirs: Internal generic functions

F
forward: Internal generic functions
forward: Internal generic functions
Function, cell: Exported functions
Function, cell-corner-count: Internal functions
Function, cell-corner-directions: Exported functions
Function, cell-direction-count: Internal functions
Function, cell-directions: Internal functions
Function, cell-edge-count: Internal functions
Function, cell-edge-directions: Exported functions
Function, cell-member-p: Exported functions
Function, cell-neighbor: Exported functions
Function, cell-neighbors: Exported functions
Function, cell-neighbors-p: Exported functions
Function, cell-nudge: Internal functions
Function, grid: Exported functions
Function, grid-offset: Internal functions
Function, hex: Internal functions
Function, hex-neighbor-offsets: Internal functions
Function, hex-nudge: Internal functions
Function, hex-round: Internal functions
Function, swap-grid-offset: Internal functions
Function, y-axis: Internal functions

G
Generic Function, cell-distance: Exported generic functions
Generic Function, cell-from-point: Exported generic functions
Generic Function, cell-neighbor-by-index: Internal generic functions
Generic Function, cell-neighbor-offsets: Internal generic functions
Generic Function, cell-select-line: Exported generic functions
Generic Function, cell-select-range: Exported generic functions
Generic Function, cell-to-point: Exported generic functions
Generic Function, corner-dirs: Internal generic functions
Generic Function, edge-dirs: Internal generic functions
Generic Function, forward: Internal generic functions
Generic Function, hex-from-cell: Internal generic functions
Generic Function, hex-to-cell: Internal generic functions
Generic Function, inverse: Internal generic functions
Generic Function, neighbor-dirs: Internal generic functions
Generic Function, size: Internal generic functions
Generic Function, start-angle: Internal generic functions
grid: Exported functions
grid-offset: Internal functions

H
hex: Internal functions
hex-from-cell: Internal generic functions
hex-from-cell: Internal generic functions
hex-from-cell: Internal generic functions
hex-neighbor-offsets: Internal functions
hex-nudge: Internal functions
hex-round: Internal functions
hex-to-cell: Internal generic functions
hex-to-cell: Internal generic functions
hex-to-cell: Internal generic functions

I
inverse: Internal generic functions
inverse: Internal generic functions

M
Method, cell-distance: Exported generic functions
Method, cell-distance: Exported generic functions
Method, cell-distance: Exported generic functions
Method, cell-from-point: Exported generic functions
Method, cell-from-point: Exported generic functions
Method, cell-neighbor-by-index: Internal generic functions
Method, cell-neighbor-by-index: Internal generic functions
Method, cell-neighbor-offsets: Internal generic functions
Method, cell-neighbor-offsets: Internal generic functions
Method, cell-select-line: Exported generic functions
Method, cell-select-line: Exported generic functions
Method, cell-select-range: Exported generic functions
Method, cell-select-range: Exported generic functions
Method, cell-to-point: Exported generic functions
Method, cell-to-point: Exported generic functions
Method, corner-dirs: Internal generic functions
Method, edge-dirs: Internal generic functions
Method, forward: Internal generic functions
Method, hex-from-cell: Internal generic functions
Method, hex-from-cell: Internal generic functions
Method, hex-to-cell: Internal generic functions
Method, hex-to-cell: Internal generic functions
Method, inverse: Internal generic functions
Method, neighbor-dirs: Internal generic functions
Method, size: Internal generic functions
Method, start-angle: Internal generic functions

N
neighbor-dirs: Internal generic functions
neighbor-dirs: Internal generic functions

S
size: Internal generic functions
size: Internal generic functions
start-angle: Internal generic functions
start-angle: Internal generic functions
swap-grid-offset: Internal functions

Y
y-axis: Internal functions

Jump to:   C   E   F   G   H   I   M   N   S   Y  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   C   E   F   I   N   O   S   Y  
Index Entry  Section

C
cell-origin: Internal classes
cell-size: Internal classes
corner-dirs: Exported classes
corner-dirs: Exported classes
corner-dirs: Exported classes
corner-dirs: Exported classes
corner-dirs: Internal classes

E
edge-dirs: Exported classes
edge-dirs: Exported classes
edge-dirs: Exported classes
edge-dirs: Exported classes
edge-dirs: Internal classes

F
forward: Exported classes
forward: Exported classes
forward: Internal classes

I
inverse: Exported classes
inverse: Exported classes
inverse: Internal classes

N
neighbor-dirs: Exported classes
neighbor-dirs: Exported classes
neighbor-dirs: Exported classes
neighbor-dirs: Exported classes
neighbor-dirs: Internal classes

O
offset: Internal classes

S
size: Internal classes
Slot, cell-origin: Internal classes
Slot, cell-size: Internal classes
Slot, corner-dirs: Exported classes
Slot, corner-dirs: Exported classes
Slot, corner-dirs: Exported classes
Slot, corner-dirs: Exported classes
Slot, corner-dirs: Internal classes
Slot, edge-dirs: Exported classes
Slot, edge-dirs: Exported classes
Slot, edge-dirs: Exported classes
Slot, edge-dirs: Exported classes
Slot, edge-dirs: Internal classes
Slot, forward: Exported classes
Slot, forward: Exported classes
Slot, forward: Internal classes
Slot, inverse: Exported classes
Slot, inverse: Exported classes
Slot, inverse: Internal classes
Slot, neighbor-dirs: Exported classes
Slot, neighbor-dirs: Exported classes
Slot, neighbor-dirs: Exported classes
Slot, neighbor-dirs: Exported classes
Slot, neighbor-dirs: Internal classes
Slot, offset: Internal classes
Slot, size: Internal classes
Slot, start-angle: Exported classes
Slot, start-angle: Internal classes
Slot, start-angle: Internal classes
Slot, y-axis: Internal classes
start-angle: Exported classes
start-angle: Internal classes
start-angle: Internal classes

Y
y-axis: Internal classes

Jump to:   C   E   F   I   N   O   S   Y  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   G   H   P   Q   S  
Index Entry  Section

C
Class, grid-spec: Internal classes
Class, hex-cols: Exported classes
Class, hex-grid: Internal classes
Class, hex-rows: Exported classes
Class, quad-grid: Internal classes
Class, quad4: Exported classes
Class, quad8: Exported classes

G
gamebox-grids: The gamebox-grids system
gamebox-grids: The gamebox-grids package
grid-spec: Internal classes

H
hex-cols: Exported classes
hex-grid: Internal classes
hex-rows: Exported classes

P
Package, gamebox-grids: The gamebox-grids package

Q
quad-grid: Internal classes
quad4: Exported classes
quad8: Exported classes

S
System, gamebox-grids: The gamebox-grids system

Jump to:   C   G   H   P   Q   S