diff --git a/src/gooey.h b/src/gooey.h index 282eb6b..2d020d1 100644 --- a/src/gooey.h +++ b/src/gooey.h @@ -2,6 +2,8 @@ #pragma once #include "hexgame.h" +#include "hexgrid.h" +#include "renderer.h" bool initGooey(SDL_Handles &handles, v2i vp_dims); void shutdownGooey(); diff --git a/src/hexgame.cpp b/src/hexgame.cpp index a6ed90f..237c357 100644 --- a/src/hexgame.cpp +++ b/src/hexgame.cpp @@ -65,7 +65,6 @@ #include "gooey.h" #include "hexgame.h" -#include "hexlib.h" #include "mesh.h" #include "platform_wait_for_vblank.h" #include "renderer.h" diff --git a/src/hexgame.h b/src/hexgame.h index 629af42..c5cc93d 100644 --- a/src/hexgame.h +++ b/src/hexgame.h @@ -3,58 +3,14 @@ #include -#if defined (_WIN32) - #include -#else - #include -#endif - #include #include "entity.h" +#include "hexgrid.h" #include "hexlib.h" -#include "mesh.h" #include "util.h" -// TODO: should move this to renderer.h -struct SDL_Handles -{ - SDL_Window *window; - SDL_GLContext glContext; - SDL_DisplayMode currentDisplayMode; - std::vector texSurfaces; -}; - -struct hex_info -{ - int32 hexID = 0; - Hex hex = {}; - real64 XPos = 0; - real64 YPos = 0; - uint32 current_color = 0; // RGBA - uint32 stored_color = 0; // RGBA - bool selected = false; - std::vector vertices; -}; - -enum HexDrawMode -{ - NONE, - FILL, - LINE, - CONE_FILL, - PATHFINDING -}; - -struct render_state -{ - v2i viewport_dims; - bool is_debug_draw; - uint32 fill_color; - uint32 selected_fill_color; -}; - struct game_state { std::vector *hex_array; @@ -80,6 +36,7 @@ struct game_state bool is_rotateCW = false; bool is_rotateCCW = false; + // TODO: initialize this in hexgrid.h to remove hexlib.h dep? game_state(Layout &l) : hex_layout(l) {} }; diff --git a/src/hexgrid.cpp b/src/hexgrid.cpp new file mode 100644 index 0000000..23ec008 --- /dev/null +++ b/src/hexgrid.cpp @@ -0,0 +1,21 @@ + +#include "hexgrid.h" + + +void +hgCreateHexes(vector *hxi_array, const Layout &layout, uint32 color) +{ + +} + +hex_info* +hgGetSingleHex(int32 x, int32 y) +{ + return nullptr; +} + +void +hgResetHexes() +{ + +} diff --git a/src/hexgrid.h b/src/hexgrid.h index f80e172..c3cc2d4 100644 --- a/src/hexgrid.h +++ b/src/hexgrid.h @@ -1,10 +1,38 @@ +#pragma once + +#include + #include "hexlib.h" #include "util.h" -// TODO: move hex_info definition here and update references -struct hex_info; +enum HexDrawMode +{ + NONE, + FILL, + LINE, + CONE_FILL, + PATHFINDING +}; + +struct hex_info +{ + int32 hexID = 0; + Hex hex = {}; + real64 XPos = 0; + real64 YPos = 0; + uint32 current_color = 0; // RGBA + uint32 stored_color = 0; // RGBA + bool selected = false; + std::vector vertices; +}; + +struct hexgrid +{ + Layout hex_layout; +}; + void hgCreateHexes(vector *hxi_array, const Layout &layout, uint32 color); hex_info* hgGetSingleHex(int32 x, int32 y); diff --git a/src/hexlib.h b/src/hexlib.h index 4df7fe3..10d073b 100644 --- a/src/hexlib.h +++ b/src/hexlib.h @@ -56,9 +56,9 @@ const Orientation layout_flat = Orientation(3.0 / 2.0, 0.0, sqrt(3.0) / 2.0, sqr struct Layout { - const Orientation orientation; - const Point size; - const Point origin; + Orientation orientation; + Point size; + Point origin; Layout(Orientation orientation_, Point size_, Point origin_): orientation(orientation_), size(size_), origin(origin_) {} }; diff --git a/src/render_group.h b/src/render_group.h index e58de1e..279d0e5 100644 --- a/src/render_group.h +++ b/src/render_group.h @@ -4,7 +4,6 @@ #include #include "entity.h" -//#include "hexgame.h" #include "util.h" struct Entity; diff --git a/src/renderer.h b/src/renderer.h index 1da5fb7..dea01c3 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -3,12 +3,34 @@ #include +#if defined (_WIN32) + #include +#else + #include +#endif #include #include "camera.h" #include "entity.h" +#include "hexgrid.h" #include "util.h" -#include "hexgame.h" // TODO: should move hex_info object out of hexgame.h + + +struct SDL_Handles +{ + SDL_Window *window; + SDL_GLContext glContext; + SDL_DisplayMode currentDisplayMode; + std::vector texSurfaces; +}; + +struct render_state +{ + v2i viewport_dims; + bool is_debug_draw; + uint32 fill_color; + uint32 selected_fill_color; +}; struct renPointLight {