Skip to content
Snippets Groups Projects
Commit 3c238651 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

make use of board object

parent 9aa636c6
No related branches found
No related tags found
No related merge requests found
......@@ -52,9 +52,9 @@ namespace demo::hexboard {
void Scene::render(fggl::gfx::Graphics &gfx) {
// if the board is not set, abort
/*if ( m_board == nullptr ){
if ( m_board == nullptr ){
return;
}*/
}
// draw the grid
// FIXME don't hard-code the screen size
......@@ -72,12 +72,15 @@ namespace demo::hexboard {
auto rowBasis = hexPos;
for(auto i=0; i<gridHeight; ++i) {
for (auto j=0; j<gridWidth; ++j) {
auto pos = hexToScreen(hexPos, hexRadius, offset);
auto hex = fggl::gfx::make_shape(pos, hexRadius, 6);
paint.stroke(hex);
pos.x += hexRadius;
hexPos = hexPos.neighbour( fggl::grid::HexDirPointy::RIGHT );
if ( m_board->isValidPos(hexPos) ) {
auto pos = hexToScreen(hexPos, hexRadius, offset);
auto hexShape = fggl::gfx::make_shape(pos, hexRadius, 6);
paint.stroke(hexShape);
}
// next hexagon
hexPos = hexPos.neighbour(fggl::grid::HexDirPointy::RIGHT);
}
rowBasis = i % 2 == 0 ? rowBasis.neighbour(fggl::grid::HexDirPointy::BOTTOM_RIGHT) : rowBasis.neighbour(fggl::grid::HexDirPointy::BOTTOM_LEFT);
......
......@@ -24,7 +24,10 @@
namespace fggl::grid {
class HexGrid {
public:
inline bool isValidPos(const IntHex& pos) {
return true;
}
};
} // namespace fggl::grid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment