|
|
|
|
@ -23,14 +23,6 @@
|
|
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
// Some defaults for the game layout
|
|
|
|
|
#if 0 |
|
|
|
|
#define HEX_SIZE 10 |
|
|
|
|
#define HEX_RADIUS 19 |
|
|
|
|
#define HEX_ORIENTATION layout_flat |
|
|
|
|
#define FILL_COLOR 0x565656FF |
|
|
|
|
#define SELECTED_FILL_COLOR 0xF46000FF |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define DEBUG_DRAW true |
|
|
|
|
#define VIEWPORT_WIDTH 1920 |
|
|
|
|
#define VIEWPORT_HEIGHT 1080 |
|
|
|
|
@ -120,7 +112,7 @@ void
|
|
|
|
|
setStartHex(hex_info *hex) |
|
|
|
|
{ |
|
|
|
|
hex->selected = true; |
|
|
|
|
hex->current_color = g_render_state->selected_fill_color; |
|
|
|
|
hex->current_color = g_game_state->grid.selected_fill_color; |
|
|
|
|
g_game_state->grid.start_hex = g_game_state->grid.current_hex = hex; |
|
|
|
|
g_game_state->grid.is_selecting = true; |
|
|
|
|
} |
|
|
|
|
@ -148,7 +140,7 @@ updateHexFill(int32 x, int32 y)
|
|
|
|
|
if (hex_distance(g_game_state->grid.start_hex->hex, h.hex) <= l) |
|
|
|
|
{ |
|
|
|
|
h.selected = true; |
|
|
|
|
h.current_color = g_render_state->selected_fill_color; |
|
|
|
|
h.current_color = g_game_state->grid.selected_fill_color; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
@ -176,7 +168,7 @@ updateHexLineDraw(int32 x, int32 y)
|
|
|
|
|
if (hex_equal(h1.hex, h2)) |
|
|
|
|
{ |
|
|
|
|
h1.selected = true; |
|
|
|
|
h1.current_color = g_render_state->selected_fill_color; |
|
|
|
|
h1.current_color = g_game_state->grid.selected_fill_color; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
else if (i == hexLine.size() - 1) |
|
|
|
|
@ -226,7 +218,7 @@ updateHexConeFill(int32 x, int32 y)
|
|
|
|
|
if (crossingTest(vertices, test_p)) |
|
|
|
|
{ |
|
|
|
|
h.selected = true; |
|
|
|
|
h.current_color = g_render_state->selected_fill_color; |
|
|
|
|
h.current_color = g_game_state->grid.selected_fill_color; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
@ -274,7 +266,7 @@ handleMouseDown(SDL_MouseButtonEvent &e)
|
|
|
|
|
hex->selected = !hex->selected; |
|
|
|
|
if (hex->selected) |
|
|
|
|
{ |
|
|
|
|
hex->current_color = g_render_state->selected_fill_color; |
|
|
|
|
hex->current_color = g_game_state->grid.selected_fill_color; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
@ -528,10 +520,9 @@ int main(int argc, char* argv[])
|
|
|
|
|
slSceneDoc* sd = slLoadFile(DATA_DIR, DEFAULT_SCENE_FILE, SCENE_SCHEMA_FILE); |
|
|
|
|
if (sd != nullptr) { |
|
|
|
|
game_state* g = g_game_state; |
|
|
|
|
render_state* r = g_render_state; |
|
|
|
|
slParseEntities(sd, g->entities, g->entity_count, MAX_ENTITIES, DATA_DIR); |
|
|
|
|
slParseCamera(sd, renGetCamera()); |
|
|
|
|
slParseHexGrid(sd, g->grid, r->fill_color, r->selected_fill_color); |
|
|
|
|
slParseHexGrid(sd, g->grid); |
|
|
|
|
slFreeSceneDoc(sd); |
|
|
|
|
} else { |
|
|
|
|
LOG(ERROR) << "Error loading scene, exiting\n"; |
|
|
|
|
|