• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • KGrid2D
  • Generic
Public Member Functions | Protected Attributes | List of all members
KGrid2D::Generic< Type > Class Template Reference

#include <kgrid2d.h>

Inheritance diagram for KGrid2D::Generic< Type >:
KGrid2D::Hexagonal< Type >

Public Member Functions

 Generic (uint width=0, uint height=0)
 
void resize (uint width, uint height)
 
void fill (const Type &value)
 
uint width () const
 
uint height () const
 
uint size () const
 
uint index (const Coord &c) const
 
Coord coord (uint index) const
 
const Type & at (const Coord &c) const
 
Type & at (const Coord &c)
 
const Type & operator[] (const Coord &c) const
 
Type & operator[] (const Coord &c)
 
const Type & at (uint index) const
 
Type & at (uint index)
 
const Type & operator[] (uint index) const
 
Type & operator[] (uint index)
 
bool inside (const Coord &c) const
 
void bound (Coord &c) const
 

Protected Attributes

uint _width
 
uint _height
 
TQValueVector< Type > _vector
 

Detailed Description

template<class Type>
class KGrid2D::Generic< Type >

This template class represents a generic bidimensionnal grid.

Each node contains an element of the template type.

Since
3.2

Definition at line 96 of file kgrid2d.h.

Constructor & Destructor Documentation

◆ Generic()

template<class Type >
KGrid2D::Generic< Type >::Generic ( uint  width = 0,
uint  height = 0 
)
inline

Constructor.

Definition at line 102 of file kgrid2d.h.

Member Function Documentation

◆ at() [1/4]

template<class Type >
Type& KGrid2D::Generic< Type >::at ( const Coord &  c)
inline
Returns
the value at the given coordinate.

Definition at line 158 of file kgrid2d.h.

◆ at() [2/4]

template<class Type >
const Type& KGrid2D::Generic< Type >::at ( const Coord &  c) const
inline
Returns
the value at the given coordinate.

Definition at line 154 of file kgrid2d.h.

◆ at() [3/4]

template<class Type >
Type& KGrid2D::Generic< Type >::at ( uint  index)
inline
Returns
the value at the given linear index.

Definition at line 175 of file kgrid2d.h.

◆ at() [4/4]

template<class Type >
const Type& KGrid2D::Generic< Type >::at ( uint  index) const
inline
Returns
the value at the given linear index.

Definition at line 171 of file kgrid2d.h.

◆ bound()

template<class Type >
void KGrid2D::Generic< Type >::bound ( Coord &  c) const
inline

Bound the given coordinate with the grid dimensions.

Definition at line 196 of file kgrid2d.h.

◆ coord()

template<class Type >
Coord KGrid2D::Generic< Type >::coord ( uint  index) const
inline
Returns
the coordinate corresponding to the linear index.

Definition at line 147 of file kgrid2d.h.

◆ fill()

template<class Type >
void KGrid2D::Generic< Type >::fill ( const Type &  value)
inline

Fill the nodes with the given value.

Definition at line 120 of file kgrid2d.h.

◆ height()

template<class Type >
uint KGrid2D::Generic< Type >::height ( ) const
inline
Returns
the height.

Definition at line 131 of file kgrid2d.h.

◆ index()

template<class Type >
uint KGrid2D::Generic< Type >::index ( const Coord &  c) const
inline
Returns
the linear index for the given coordinate.

Definition at line 140 of file kgrid2d.h.

◆ inside()

template<class Type >
bool KGrid2D::Generic< Type >::inside ( const Coord &  c) const
inline
Returns
if the given coordinate is inside the grid.

Definition at line 188 of file kgrid2d.h.

◆ operator[]() [1/4]

template<class Type >
Type& KGrid2D::Generic< Type >::operator[] ( const Coord &  c)
inline
Returns
the value at the given coordinate.

Definition at line 166 of file kgrid2d.h.

◆ operator[]() [2/4]

template<class Type >
const Type& KGrid2D::Generic< Type >::operator[] ( const Coord &  c) const
inline
Returns
the value at the given coordinate.

Definition at line 162 of file kgrid2d.h.

◆ operator[]() [3/4]

template<class Type >
Type& KGrid2D::Generic< Type >::operator[] ( uint  index)
inline
Returns
the value at the given linear index.

Definition at line 183 of file kgrid2d.h.

◆ operator[]() [4/4]

template<class Type >
const Type& KGrid2D::Generic< Type >::operator[] ( uint  index) const
inline
Returns
the value at the given linear index.

Definition at line 179 of file kgrid2d.h.

◆ resize()

template<class Type >
void KGrid2D::Generic< Type >::resize ( uint  width,
uint  height 
)
inline

Resize the grid.

Definition at line 111 of file kgrid2d.h.

◆ size()

template<class Type >
uint KGrid2D::Generic< Type >::size ( ) const
inline
Returns
the number of nodes (ie width*height).

Definition at line 135 of file kgrid2d.h.

◆ width()

template<class Type >
uint KGrid2D::Generic< Type >::width ( ) const
inline
Returns
the width.

Definition at line 127 of file kgrid2d.h.


The documentation for this class was generated from the following file:
  • kgrid2d.h

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.1
This website is maintained by Timothy Pearson.