Browse Source

add hex_line_color property to hexgrid struct

master
cinnaboot 8 years ago
parent
commit
c14688a82c
  1. 2
      data/scene_schema.json
  2. 1
      data/test_scene.json
  3. 5
      src/hexgrid.h
  4. 2
      src/scene_loader.cpp

2
data/scene_schema.json

@ -52,6 +52,7 @@
"position": { "$ref": "#/definitions/vector3" },
"fill_color" : { "type": "string" },
"selected_fill_color" : { "type": "string" },
"hex_line_color" : { "type": "string" },
"hexlib_orientation" : { "type": "string" },
"hex_size" : { "type": "number" },
"grid_type" : { "type": "string" },
@ -61,6 +62,7 @@
"position",
"fill_color",
"selected_fill_color",
"hex_line_color",
"hexlib_orientation",
"hex_size",
"grid_type",

1
data/test_scene.json

@ -26,6 +26,7 @@
"hex_size" : 10,
"fill_color" : "0x565656FF",
"selected_fill_color": "0xF46000FF",
"hex_line_color": "0x00000000",
"hexlib_orientation" : "layout_flat",
"grid_type" : "hexagon",
"hex_radius" : 20

5
src/hexgrid.h

@ -46,8 +46,9 @@ struct hexgrid
v3f position = v3f(0, 0, 0);
uint hex_size = 10;
uint hex_radius = 0;
uint32 fill_color = 0x565656FF;
uint32 selected_fill_color = 0xF46000FF;
uint32 fill_color = 0xFFFFFFFF;
uint32 selected_fill_color = 0xFFFFFFFF;
uint32 hex_line_color = 0xFFFFFFFF;
std::vector<hex_info>* hex_array = nullptr;
hex_info* start_hex = nullptr;

2
src/scene_loader.cpp

@ -135,6 +135,8 @@ slParseHexGrid(slSceneDoc* sd, hexgrid& hg)
hg.fill_color = std::stoul(fill_color_str, nullptr, 16);
std::string selected_fill_color_str = json_grid["selected_fill_color"].GetString();
hg.selected_fill_color = std::stoul(selected_fill_color_str, nullptr, 16);
std::string hex_line_color_str = json_grid["hex_line_color"].GetString();
hg.hex_line_color = std::stoul(hex_line_color_str, nullptr, 16);
std::string orientation_str = json_grid["hexlib_orientation"].GetString();
hg.hexlib_orientation = (orientation_str == "layout_flat") ? layout_flat : layout_pointy;
Layout lo(hg.hexlib_orientation, Point(hg.hex_size, hg.hex_size), Point(hg.position.x, hg.position.y));

Loading…
Cancel
Save