Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
GridRenderer Class Reference

Helper class for rendering the game world grid. More...

#include <GridRenderer.hpp>

+ Collaboration diagram for GridRenderer:

Static Public Member Functions

static void drawTiles (int width, int height, float tileSize)
 Draws filled tile quads for the entire grid in a checkerboard pattern.
 
static void drawGrid (int width, int height, float tileSize, Color color=GRAY)
 Draws a custom grid centered at (0, 0, 0).
 
static void drawTileHighlight (int tileX, int tileY, int worldWidth, int worldHeight, float tileSize, Color color, float lineThickness=1.0f)
 Draws a highlight outline around a specific tile.
 

Static Public Attributes

static constexpr Color TILE_COLOR = {230, 230, 230, 255}
 
static constexpr Color TILE_COLOR_ALT = {210, 210, 210, 255}
 

Detailed Description

Helper class for rendering the game world grid.

Definition at line 8 of file GridRenderer.hpp.

Member Function Documentation

◆ drawGrid()

void GridRenderer::drawGrid ( int  width,
int  height,
float  tileSize,
Color  color = GRAY 
)
static

Draws a custom grid centered at (0, 0, 0).

Parameters
widthNumber of tiles in X direction.
heightNumber of tiles in Z direction.
tileSizeSize of each tile in world units.
colorGrid line color.

Definition at line 18 of file GridRenderer.cpp.

◆ drawTileHighlight()

void GridRenderer::drawTileHighlight ( int  tileX,
int  tileY,
int  worldWidth,
int  worldHeight,
float  tileSize,
Color  color,
float  lineThickness = 1.0f 
)
static

Draws a highlight outline around a specific tile.

Parameters
tileXTile X coordinate.
tileYTile Y coordinate (Z in 3D).
worldWidthTotal world width in tiles.
worldHeightTotal world height in tiles.
tileSizeSize of each tile in world units.
colorColor of the highlight outline.
lineThicknessThickness of the outline lines.

Definition at line 36 of file GridRenderer.cpp.

Referenced by RaylibRenderer::_drawSelectionHighlight().

+ Here is the caller graph for this function:

◆ drawTiles()

void GridRenderer::drawTiles ( int  width,
int  height,
float  tileSize 
)
static

Draws filled tile quads for the entire grid in a checkerboard pattern.

Parameters
widthNumber of tiles in X direction.
heightNumber of tiles in Z direction.
tileSizeSize of each tile in world units.

Definition at line 3 of file GridRenderer.cpp.

References TILE_COLOR, and TILE_COLOR_ALT.

Referenced by RaylibRenderer::_render3D().

+ Here is the caller graph for this function:

Member Data Documentation

◆ TILE_COLOR

constexpr Color GridRenderer::TILE_COLOR = {230, 230, 230, 255}
staticconstexpr

Definition at line 10 of file GridRenderer.hpp.

Referenced by drawTiles().

◆ TILE_COLOR_ALT

constexpr Color GridRenderer::TILE_COLOR_ALT = {210, 210, 210, 255}
staticconstexpr

Definition at line 11 of file GridRenderer.hpp.

Referenced by drawTiles().


The documentation for this class was generated from the following files: