Browse Source

testing sparse hex grid

master
cinnaboot 8 years ago
parent
commit
a91e3193e1
  1. 4
      src/hexgame.cpp
  2. 9
      src/hexgrid.cpp

4
src/hexgame.cpp

@ -194,8 +194,10 @@ handleMouseDown(SDL_MouseButtonEvent &e)
v2i dims = g_render_state->viewport_dims;
v2f v = cameraUnproject(g_render_state->cam, coords.x, coords.y, dims.x, dims.y);
hex_info *hex = hgGetSingleHex(g_game_state->grid, v.x, v.y);
if (hex)
if (hex) {
hex->selected = !hex->selected;
g_game_state->grid.start_hex = g_game_state->grid.current_hex = hex;
}
}break;
}
}

9
src/hexgrid.cpp

@ -189,7 +189,14 @@ createHexagonGrid(hexgrid hg)
hxi.YPos = p.y;
hxi.vertices = polygon_corners(hg.hexlib_layout, hxi.hex);
hxi.vertices.shrink_to_fit();
hg.hex_array->push_back(hxi);
// NOTE: testing sparse grid
if ((q > -2 && q < 2) && (r > -2 && r < 2)) {
// skip
} else {
hg.hex_array->push_back(hxi);
}
/////////////
}
}

Loading…
Cancel
Save